Просмотр исходного кода

采购重量商家自己可以修改

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

+ 3 - 2
ghsApp/src/components/plugin/modal.vue

@@ -134,9 +134,10 @@ export default {
 			})
 		},
 		handleClickCancel() {
-			if (!this.maskClosable) return
+			// if (!this.maskClosable)return;
 			// this.$emit('cancel')
-			this.$emit('click', {index: 0})
+			// this.$emit('click', {index: 0})
+			// if (!this.maskClosable)return;
 		}
 	}
 }

+ 10 - 0
ghsApp/src/mixins/allMoreSelectInput.js

@@ -10,12 +10,21 @@ export default {
 	},
 
 	methods: {
+		// 计算重量
+		countWeight(){
+			let ratio = this.customData.ratio;
+			let smallCount = this.customData.smallCount;
+			let bigCount = this.customData.bigCount;
+			let weight = this.customData.weight;
+			this.customData.realityWeight = smallCount * weight / ratio + bigCount * weight
+		},
 		// 离开全选input
 		moveAllInput(e){
 			this.isActive=false;
 			this.isFocus=false;
 			if(e==''){return}
 			this.customData.bigCount = e;
+			this.countWeight();
 		},
 		//input点击删除按键
 		deleteInputVal(){
@@ -34,6 +43,7 @@ export default {
 			this.isFocusOne=false;
 			if(e==''){return}
 			this.customData.smallCount = e;
+			this.countWeight();
 		},
 		//input点击删除按键
 		deleteInputValOne(){

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

@@ -181,6 +181,7 @@ export default {
 						element.child.forEach(child => {
 							child.classId = element.classId;
 							child.className = element.className;
+							child.realityWeight = 0
 						});
 				});
 				this.productInfo = data;
@@ -517,6 +518,7 @@ export default {
 						...element,
 						bigCount: Number(item.bigCount),
 						smallCount: Number(item.smallCount),
+						realityWeight: Number(item.realityWeight),
 						itemPrice: item.itemPrice?Number(item.itemPrice):''
 					};
 

+ 6 - 4
ghsApp/src/pagesPurchase/add.vue

@@ -92,7 +92,7 @@
 					<view class="select-cmd_bx">
 						<view class="num_bx">
 							<view class="kc">重量</view>
-							<allSelectInput :isActive="isWeightActive" :isFocus="isWeightFocus" :value="customData.weight" :placeholder="'公斤'"
+							<allSelectInput :isActive="isWeightActive" :isFocus="isWeightFocus" :value="customData.realityWeight" :placeholder="'公斤'"
 																							:width="416" :height="80" :fontSize="40"
 																							@deleteInputVal="deleteWeightInputVal" @initAllInput="initWeightAllInput" @moveAllInput="moveWeightAllInput">
 							</allSelectInput>
@@ -156,7 +156,8 @@ export default {
 				bigCount: 0,
 				smallCount: 0,
 				itemPrice: 0,
-				weight:0
+				weight:0,
+				realityWeight:0,
 			}
 		};
 	},
@@ -174,7 +175,7 @@ export default {
 			this.isWeightActive=false;
 			this.isWeightFocus=false;
 			if(e==''){return}
-			this.customData.weight = e;
+			this.customData.realityWeight = e;
 		},
 		//input点击删除按键
 		deleteAloneInputVal(){
@@ -184,7 +185,7 @@ export default {
 		//input重量点击删除按键
 		deleteWeightInputVal(){
 			this.isWeightActive=false;
-			this.customData.weight = '';
+			this.customData.realityWeight = '';
 		},
 		//自定义数量
 		customNum(info) {
@@ -213,6 +214,7 @@ export default {
 
 				if (val.index === 0) {
 					this.modalCancel();
+					this.delAllEvent(this.customData)
 				} else {
 					if(this.customData.itemPrice==0||this.customData.itemPrice==''){
 						uni.showToast({title:"请输入总价格",icon:"none"})

+ 2 - 1
ghsApp/src/pagesPurchase/details.vue

@@ -213,6 +213,7 @@ export default {
 			let price = 0;
 
 			if (this.selectList) {
+				console.log(this.selectList,'selectList')
 				for (const item of this.selectList) {
 					if (item.itemPrice) {
 						price += Number(item.itemPrice);
@@ -312,7 +313,7 @@ export default {
 						bigNum: ele.bigCount,
 						smallNum: ele.smallCount,
 						itemId:ele.itemId,
-						weight:ele.weight,
+						weight:ele.realityWeight,
 						itemPrice: ele.itemPrice || this.getSelectItemPrice(ele)
 					};
 				});