lilei 10 месяцев назад
Родитель
Сommit
c671b75d56
3 измененных файлов с 23 добавлено и 24 удалено
  1. 2 0
      pages/index/index.vue
  2. 0 7
      pages/promo/index.vue
  3. 21 17
      pagesB/promoDetail.vue

+ 2 - 0
pages/index/index.vue

@@ -242,6 +242,8 @@
 					// 查询红包活动
 					// 查询红包活动
 					this.getRedPacketRule()
 					this.getRedPacketRule()
 				}
 				}
+				// 重新刷新
+				this.pageInit(true)
 			}else{
 			}else{
 				// 隐藏促销模块
 				// 隐藏促销模块
 				this.hidePromoTab()
 				this.hidePromoTab()

+ 0 - 7
pages/promo/index.vue

@@ -53,15 +53,8 @@
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
-		},
-		onShow() {
 			this.pageInit()
 			this.pageInit()
 		},
 		},
-		onHide() {
-			this.list.map(item => {
-				item.showVideo = false
-			})
-		},
 		methods: {
 		methods: {
 			pageInit(){
 			pageInit(){
 				this.total = 0
 				this.total = 0

+ 21 - 17
pagesB/promoDetail.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
 	<view class="video-pagesCons">
 	<view class="video-pagesCons">
 		<view class="tab-search">
 		<view class="tab-search">
-			<u-search placeholder="请输入产品名称/轮胎规格" shape="round" :clearabled="true" show-action v-model="queryWord" @clear="getRow" @search="getRow" @custom="getRow"></u-search>
+			<u-search placeholder="请输入产品名称/轮胎规格" shape="round" :clearabled="true" show-action v-model="queryWord" @clear="pageInit" @search="pageInit" @custom="pageInit"></u-search>
 		</view>
 		</view>
 		<view class="tab-body">
 		<view class="tab-body">
 			<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
 			<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
@@ -176,6 +176,12 @@
 			})
 			})
 			this.$store.state.vuex_tempData = null
 			this.$store.state.vuex_tempData = null
 			this.promoActiveSn = opts.promoActiveSn
 			this.promoActiveSn = opts.promoActiveSn
+			// 购物车是否有缓存
+			const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
+			if(hasCache){
+				this.chooseList = hasCache.list
+			}
+			this.screenWidth = uni.getSystemInfoSync().windowWidth
 			// 查询产品列表
 			// 查询产品列表
 			this.pageInit()
 			this.pageInit()
 		},
 		},
@@ -192,15 +198,10 @@
 		methods: {
 		methods: {
 			// 初始化页面
 			// 初始化页面
 			pageInit(){
 			pageInit(){
-				this.screenWidth = uni.getSystemInfoSync().windowWidth
-				// 购物车是否有缓存
-				const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
-				if(hasCache){
-					this.chooseList = hasCache.list
-				}
 				// 重置分页
 				// 重置分页
 				this.total = 0
 				this.total = 0
 				this.pageNo = 1
 				this.pageNo = 1
+				this.list = []
 				// 获取列表数据
 				// 获取列表数据
 				this.getRow()
 				this.getRow()
 			},
 			},
@@ -268,12 +269,16 @@
 					this.chooseProductList[rowIndex].qty = e.value
 					this.chooseProductList[rowIndex].qty = e.value
 					// 更新原始数据
 					// 更新原始数据
 					const rindex = this.chooseList.findIndex(key => key.id == e.index)
 					const rindex = this.chooseList.findIndex(key => key.id == e.index)
-					this.chooseList[rindex].qty = e.value
-					this.chooseList.splice()
+					if(rindex>=0){
+						this.chooseList[rindex].qty = e.value
+						this.chooseList.splice()
+					}
 					// 更新页面产品数据
 					// 更新页面产品数据
 					const aindex = this.list.findIndex(key => key.id == e.index)
 					const aindex = this.list.findIndex(key => key.id == e.index)
-					this.list[aindex].qty = e.value
-					this.list.splice()
+					if(aindex>=0){
+						this.list[aindex].qty = e.value
+						this.list.splice()
+					}
 				}else{
 				}else{
 					// 数量为0时,删除
 					// 数量为0时,删除
 					this.chooseClick(e.index,0)
 					this.chooseClick(e.index,0)
@@ -289,8 +294,10 @@
 						row.qty = 0
 						row.qty = 0
 					}
 					}
 					const rindex = this.chooseProductList.findIndex(item => item.id == index)
 					const rindex = this.chooseProductList.findIndex(item => item.id == index)
-					this.chooseProductList.splice(rindex, 1);
-					this.chooseList.splice(rindex, 1);
+					if(rindex>=0){
+						this.chooseProductList.splice(rindex, 1);
+						this.chooseList.splice(rindex, 1);
+					}
 					this.$u.toast(`删除成功!`);
 					this.$u.toast(`删除成功!`);
 				}
 				}
 			},
 			},
@@ -345,11 +352,8 @@
 				}
 				}
 			},
 			},
 			// 查询列表
 			// 查询列表
-			getRow (pageNo) {
+			getRow () {
 			  let _this = this
 			  let _this = this
-			  if (pageNo) {
-			    this.pageNo = pageNo
-			  }
 			  let params = {
 			  let params = {
 			    pageNo: this.pageNo,
 			    pageNo: this.pageNo,
 			    pageSize: this.pageSize,
 			    pageSize: this.pageSize,