jf 5 лет назад
Родитель
Сommit
c9a75678e4

+ 36 - 0
ghsApp/src/mixins/product.js

@@ -297,6 +297,37 @@ export default {
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			// this.$forceUpdate();
 			// this.$forceUpdate();
 		},
 		},
+
+		addCustomNumEvent(item,params1) {
+			const list = this.selectList;
+
+			// if (!has) {}
+				let info = { classId: item.classId, id: item.id };
+
+				const classInfo =
+					this.productInfo &&
+					this.productInfo.find(element => {
+						return element.classId == item.classId && element.child;
+					});
+				if (classInfo) {
+					info = classInfo.child.find(ele => {
+						return ele.id == item.id;
+					});
+				}
+
+				let params = {
+					...info,
+					bigCount: 0, //扎数
+					smallCount: 0, //支数
+					autoPrice: 0 //调价价格
+				};
+				list.push(params);
+			this.setSelectInfoByType({ type: this.pageType, info: list });
+			this.$nextTick(()=>{
+				this.customNum(params1)
+			})
+			// this.$forceUpdate();
+		},
 		/**
 		/**
 		 * 减去商品
 		 * 减去商品
 		 */
 		 */
@@ -358,6 +389,11 @@ export default {
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			this.setSelectInfoByType({ type: this.pageType, info: list });
 			// this.$forceUpdate();
 			// this.$forceUpdate();
 		},
 		},
+		//减去所有商品
+		delAllEvent(item) {
+			const list = [];
+			this.setSelectInfoByType({ type: this.pageType, info: list });
+		},
 		// /**
 		// /**
 		//  * 删除商品
 		//  * 删除商品
 		//  */
 		//  */

+ 3 - 3
ghsApp/src/pagesPurchase/add.vue

@@ -72,8 +72,8 @@
 									getSelectItemById(productItem.id, classItem.classId).smallCount
 									getSelectItemById(productItem.id, classItem.classId).smallCount
 								"
 								"
 								@customNum="customNum"
 								@customNum="customNum"
-								@add="addEvent"
-								@del="delEvent"
+								@add="addCustomNumEvent"
+								@del="delAllEvent"
 							></CommodityPurchase>
 							></CommodityPurchase>
 						</template>
 						</template>
 					</view>
 					</view>
@@ -150,7 +150,6 @@ import CommodityPurchase from "./components/CommodityPurchase";
 import ModalModule from "@/components/plugin/modal";
 import ModalModule from "@/components/plugin/modal";
 import FooterCart from "@/components/module/app-footer-cart";
 import FooterCart from "@/components/module/app-footer-cart";
 import productMins from "@/mixins/product";
 import productMins from "@/mixins/product";
-
 export default {
 export default {
 	name: "purchase", // 采购
 	name: "purchase", // 采购
 	components: {
 	components: {
@@ -179,6 +178,7 @@ export default {
 	methods: {
 	methods: {
 		//自定义数量
 		//自定义数量
 		customNum(info) {
 		customNum(info) {
+			console.log(info)
 			this.isModel = true;
 			this.isModel = true;
 			this.customData = info;
 			this.customData = info;
 		},
 		},

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

@@ -68,7 +68,12 @@ export default {
 	created() {},
 	created() {},
 	methods: {
 	methods: {
 		addEvent() {
 		addEvent() {
-			this.$emit("add", this.info);
+			let params = {
+				...this.info,
+				bigCount: this.bigCount,
+				smallCount: this.smallCount
+			};
+			this.$emit("add", this.info,params);
 		},
 		},
 		delEvent() {
 		delEvent() {
 			this.$emit("del", this.info);
 			this.$emit("del", this.info);