lilei 11 mesi fa
parent
commit
29d4ef1989
3 ha cambiato i file con 28 aggiunte e 20 eliminazioni
  1. 10 7
      pages/index/index.vue
  2. 1 1
      pagesB/procureOrder.vue
  3. 17 12
      pagesB/promoDetail.vue

+ 10 - 7
pages/index/index.vue

@@ -427,13 +427,16 @@
 			// 显示促销模块
 			showPromoTab(){
 				// 添加促销模块
-				this.$store.state.vuex_tabBarList.splice(1,0,{
-					"pagePath": "/pages/promo/index",
-					"iconPath": "/static/tab/tab_promo_normal.png",
-					"selectedIconPath": "/static/tab/tab_promo_pressed.png",
-					"text": "促销",
-					'customIcon': false,
-				})
+				const promoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '促销')
+				if(promoIndex<0){
+					this.$store.state.vuex_tabBarList.splice(1,0,{
+						"pagePath": "/pages/promo/index",
+						"iconPath": "/static/tab/tab_promo_normal.png",
+						"selectedIconPath": "/static/tab/tab_promo_pressed.png",
+						"text": "促销",
+						'customIcon': false,
+					})
+				}
 				// 居中透出显示扫描按钮
 				const scanTab = this.$store.state.vuex_tabBarList.find(item => item.text == '扫描VIN')
 				if(scanTab){

+ 1 - 1
pagesB/procureOrder.vue

@@ -108,7 +108,7 @@
 			  const data = this.$store.state.vuex_tempData
 			  if(data){
 				  this.info = data
-				  this.partList = data.detailList
+				  this.partList = data.detailList||[]
 			  }
 			  uni.setNavigationBarTitle({
 			  	title: ''

+ 17 - 12
pagesB/promoDetail.vue

@@ -141,7 +141,8 @@
 				choosePageNo: 1, // 已选产品当前页
 				choosePageSize: 8, // 已选产品每页数
 				chooseTotal: 0 ,// 已选产品总记录数
-				promoActiveSn: null
+				promoActiveSn: null, // 活动sn
+				cacheChooseList: [] // 缓存得已选列表
 			}
 		},
 		computed: {
@@ -177,10 +178,8 @@
 			this.$store.state.vuex_tempData = null
 			this.promoActiveSn = opts.promoActiveSn
 			// 购物车是否有缓存
-			const hasCache = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
-			if(hasCache){
-				this.chooseList = hasCache.list
-			}
+			const cacheList = this.$store.state.vuex_cartList.find(k => k.sn == this.promoActiveSn)
+			this.cacheChooseList = cacheList ? cacheList.list : []
 			this.screenWidth = uni.getSystemInfoSync().windowWidth
 			// 查询产品列表
 			this.pageInit()
@@ -211,9 +210,9 @@
 					item.checked = true
 					item.qty = 1
 					item.show = false
-					this.chooseList.unshift(this.$u.deepClone(item))
+					this.chooseList.unshift(item)
 				}else{
-					item.qty = item.qty + 1
+					// item.qty = item.qty + 1
 					// 已添加,则增加数量
 					const row = this.chooseList.find(key => key.id == item.id)
 					if(row){
@@ -274,11 +273,11 @@
 						this.chooseList.splice()
 					}
 					// 更新页面产品数据
-					const aindex = this.list.findIndex(key => key.id == e.index)
-					if(aindex>=0){
-						this.list[aindex].qty = e.value
-						this.list.splice()
-					}
+					// const aindex = this.list.findIndex(key => key.id == e.index)
+					// if(aindex>=0){
+					// 	this.list[aindex].qty = e.value
+					// 	this.list.splice()
+					// }
 				}else{
 					// 数量为0时,删除
 					this.chooseClick(e.index,0)
@@ -366,6 +365,12 @@
 				  const list = res.data.list||[]
 				  // 更新已选状态
 				  list.map(k => {
+					  const hascache = this.cacheChooseList.find(s=>s.id == k.id)
+					  // 如果缓存中有,添加到当前页面已选列表中
+					  if(hascache){
+						  this.chooseProduct(k)
+					  }
+					  // 如果筛选或分页后,重新更新页面列表产品数量
 					  const hasChecked = this.chooseList.find(s=>s.id == k.id)
 					  k.checked = hasChecked
 					  if(hasChecked){