shish 7 luni în urmă
părinte
comite
579e242382

+ 38 - 3
ghsPad/src/mixins/product.js

@@ -112,6 +112,13 @@ export default {
 			}
 			uni.setStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId, currentInfo)
 
+			//多颜色也要挂单
+			let xjInfo = uni.getStorageSync("xj")
+			if (!this.$util.isEmpty(xjInfo)) {
+				uni.setStorageSync("xj_hand_"+this.currentBackJobId, xjInfo)
+				uni.removeStorageSync("xj")
+			}
+
 			uni.removeStorageSync('selectList_'+that.currentJobType+'_target_'+that.currentJobId)
 			that.reSetSelectInfo({currentJobType:that.currentJobType,currentJobId:that.currentJobId})
 
@@ -136,6 +143,13 @@ export default {
 			//清除挂单
 			uni.removeStorageSync('selectList_'+that.currentJobType+'_target_'+that.currentBackJobId)
 
+			//多颜色的处理
+			let xjInfo = uni.getStorageSync("xj_hand_"+this.currentBackJobId)
+			if (!this.$util.isEmpty(xjInfo)) {
+				uni.setStorageSync("xj", xjInfo)
+				uni.removeStorageSync("xj_hand_"+this.currentBackJobId)
+			}
+
 			this.globalHasHand = 0
 		},
 		removeFromSave(){
@@ -195,6 +209,11 @@ export default {
 				item.currentNum = parseInt(Number(item.currentNum)+Number(list[index].currentNum))
 			}
 
+			//多颜色,弹框时,没有选花材,直接点清除全部
+			if(index == -1 && item.currentNum<=0){
+				return
+			}
+
 			//扫码会出现负数
 			if(Number(item.currentNum)<0){
 				return false
@@ -228,9 +247,9 @@ export default {
 			}else{
 				if(item.currentNum <= 0){
 					list.splice(index,1)
-					if(item.variety == 1){
-						uni.removeStorageSync("xj")
-					}
+					//删除当前花材的多颜色
+					this.delCurrentXj(item)
+					
 				}else{
 					list[index].currentNum = item.currentNum
 					list[index].unitPrice = item.unitPrice
@@ -246,6 +265,22 @@ export default {
 			this.pushToSave(list)
 			this.addItemModelHidden()
 		},
+		delCurrentXj(item){
+			if(item.variety == 0){
+				return true
+			}
+			console.log('item',item)
+            let saveInfo = uni.getStorageSync("xj")
+            const ptItemId = item.itemId
+            if (!this.$util.isEmpty(saveInfo)) {
+                saveInfo.forEach((colorItem, colorIndex) => {
+                    if (colorItem.ptItemId == ptItemId) {
+                        saveInfo.splice(colorIndex, 1)
+                    }
+                })
+				uni.setStorageSync("xj", saveInfo)
+            } 
+		},
 		//显示可以修改花材的弹框
 		showAddModelFn(info) {
 			if(Number(info.stock) <= 0){

+ 5 - 3
ghsPad/src/pages/home/components/selectFlowerGrid.vue

@@ -78,8 +78,7 @@ export default {
             handler(newData) {
                 const dataToUse = (newData && newData.length > 0) ? newData : []
                 this.flowerList = dataToUse
-                // 初始化 numList,保持已有的数量
-                dataToUse.forEach(item => {
+                this.flowerList.forEach(item => {
                     if (!this.numList[item.id]) {
                         this.numList[item.id] = 0
                     }
@@ -102,6 +101,9 @@ export default {
     },
     methods: {
         initXjData() {
+            this.flowerList.forEach(item => {
+                this.numList[item.id] = 0
+            })
             let saveInfo = uni.getStorageSync("xj")
             if (!this.$util.isEmpty(saveInfo)) {
                 saveInfo.forEach((item, index) => {
@@ -188,7 +190,7 @@ export default {
 
             // 保存到本地存储
             let saveInfo = uni.getStorageSync("xj")
-            const ptItemId = this.customData.id ? this.customData.id : 0
+            const ptItemId = this.customData.itemId ? this.customData.itemId : 0
             if (!this.$util.isEmpty(saveInfo)) {
                 let getIndex = -1
                 saveInfo.forEach((colorItem, colorIndex) => {