shish 4 anni fa
parent
commit
5dd8840024

+ 2 - 4
ghsApp/src/components/module/app-commodity.vue

@@ -101,12 +101,10 @@ export default {
 	},
 	methods: {
 		addItemFn () {
-			this.info.bigCount++
-			this.$emit("replaceItemFn", this.info)
+			this.$emit("replaceItemFn", this.info,0,'add')
 		},
 		reduceItemFn() {
-			this.info.bigCount--
-			this.$emit("replaceItemFn", this.info)
+			this.$emit("replaceItemFn", this.info,0,'sub')
 		},
 		showAddModelFn() {
 			this.$emit("showAddModelFn", { ...this.info, bigCount: this.bigCount, smallCount: this.smallCount, userPrice: this.userPrice})

+ 13 - 1
ghsApp/src/mixins/product.js

@@ -370,7 +370,18 @@ export default {
 			return info;
 		},
 		//添加删除和修改花材
-		replaceItemFn(item,multiple=0) {
+		//multiple 0单个加减 1弹框方式多个加减
+		//calc 当multiple=0时,add表示加,sub表示减
+		replaceItemFn(product,multiple=0,calc='add') {
+			let item = copyObject(product)
+			if(multiple == 0){
+				if(calc == 'add'){
+					item.bigCount++
+				}
+				if(calc == 'sub'){
+					item.bigCount--
+				}
+			}
 			console.log('........replace_item......')
 			console.log(item)
 			const list = this.selectList
@@ -395,6 +406,7 @@ export default {
 					list[index].userPrice = item.userPrice
 				}
 			}
+
 			if(this.kdType == 'HIT' && multiple ==0){
 				this.$util.hitRemind()
 			}

+ 1 - 1
ghsApp/src/pagesPurchase/components/CommodityPurchase.vue

@@ -70,7 +70,7 @@ export default {
     delItemFn () {
       this.info.bigCount = 0
       this.info.smallCount = 0
-      this.$emit("replaceItemFn", this.info)
+      this.$emit("replaceItemFn", this.info,1)
     },
     showAddModelFn () {
         this.$emit("showAddModelFn", { ...this.info, bigCount: this.bigCount, smallCount: this.smallCount, userPrice: this.userPrice })