shish 4 лет назад
Родитель
Сommit
cdaf5e49fb
2 измененных файлов с 14 добавлено и 51 удалено
  1. 9 35
      hdApp/src/admin/billing/affirmGhs.vue
  2. 5 16
      hdApp/src/mixins/cgProduct.js

+ 9 - 35
hdApp/src/admin/billing/affirmGhs.vue

@@ -168,7 +168,6 @@ export default {
 			showCustomer: false,
 			today:'',
 			monthLater:'',
-			modifyPrice:0,
 			hasHb:0,
 			selectedHb:{couponAmount:0,hbId:0,couponSelInx:0},
 			customData: {
@@ -181,26 +180,6 @@ export default {
 		this.getGhsData(e.id);
 	},
 	onShow() {
-		let selectList = this.$util.copyObject(this.selectList);
-		let list = [];
-		for (let i=0;i<selectList.length;i++){
-			if(list==''){
-				list.push(selectList[i])
-			}else{
-				let has = false
-				list.map(res=>{
-					if(res.id == selectList[i].id){
-						res.bigCount = (res.bigCount+selectList[i].bigCount)
-						res.smallCount = (res.smallCount+selectList[i].smallCount)
-						has = true
-					}
-				})
-				if(has == false){
-					list.push(selectList[i])
-				}
-			}
-		}
-		this.list = list;
 		if(this.selectedHb.hbId && this.selectedHb.hbId > 0) {
 			this.form.hbId = this.selectedHb.hbId
 			this.calcPrice()
@@ -211,7 +190,13 @@ export default {
 		}
 	},
 	computed: {
-		...mapGetters(["getMerchantInfo", "getLoginInfo"])
+		...mapGetters(["getMerchantInfo", "getLoginInfo"]),
+		modifyPrice(){
+			let allPrice = this.allPrice.toFixed(2)
+			let price = Number(allPrice)
+			price = parseFloat(price)
+			return price
+		}
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
@@ -292,14 +277,6 @@ export default {
 			})
 
 		},
-		calcPrice(){
-			let allPrice = this.allPrice.toFixed(2)
-			this.modifyPrice = Number(allPrice)
-			if(this.selectedHb.hbId && this.selectedHb.hbId > 0) {
-				this.modifyPrice = (this.modifyPrice - Number(this.selectedHb.couponAmount)).toFixed(2)
-			}
-			this.modifyPrice = parseFloat(this.modifyPrice)
-		},
 		init() {
 			this._getDet()
 		},
@@ -351,10 +328,7 @@ export default {
 		},
 		getGhsData(id) {
 			getGhsDataApi({id:id}).then(res => {
-				this.ghsInfo = res.data;
-				//注释计算运费
-				//this.purchaseFreight(this.ghsInfo);
-				this.calcPrice()
+				this.ghsInfo = res.data
 			});
 		},
 		countAllPrices(e){
@@ -404,7 +378,7 @@ export default {
 			});
 		},
 		affirmFormSubmit(){
-			const product = this.list.map(ele => {
+			const product = this.selectList.map(ele => {
 				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
 			});
 			let xj = uni.getStorageSync("ghsXj"+this.ghsInfo.id)

+ 5 - 16
hdApp/src/mixins/cgProduct.js

@@ -50,8 +50,6 @@ export default {
 				if(!this.$util.isEmpty(this.tabIndex)){
 					this.initData();//组合
 				}
-				// this.initGoodsData();//商品
-				// this.initPxClassData();//课程
 			}
 		}
 	},
@@ -67,34 +65,26 @@ export default {
 			if (curClass) {
 				return `class_${curClass.classId}`;
 			}
-
 			return "";
 		},
 		//选择商品总价
 		allPrice() {
 			let price = 0;
-
 			if (this.selectList) {
 				for (const item of this.selectList) {
 					const itemInfo = this.getSelectItemById(item.id, item.classId);
-					if (
-						itemInfo &&
-						!this.$util.isEmpty(itemInfo.bigPrice) &&
-						!this.$util.isEmpty(itemInfo.smallPrice)
-					) {
+					if ( itemInfo && !this.$util.isEmpty(itemInfo.bigPrice) && !this.$util.isEmpty(itemInfo.smallPrice) ) {
 						price += item.bigCount * Number(itemInfo.bigPrice);
 						price += item.smallCount * Number(itemInfo.smallPrice);
 					}
 				}
 			}
-
 			return Math.round(price * 100) / 100;
 		},
 		allPriceFun() {
 			let price = 0;
-
-			if (this.list) {
-				for (const item of this.list) {
+			if (this.selectList) {
+				for (const item of this.selectList) {
 					const itemInfo = this.getSelectItemById(item.id, item.classId);
 					if (
 						itemInfo &&
@@ -106,7 +96,6 @@ export default {
 					}
 				}
 			}
-
 			return Math.round(price * 100) / 100;
 		},
 		//选择商品总数
@@ -124,8 +113,8 @@ export default {
 		allCountFun() {
 			let bigLength = 0;
 			let smallLength = 0;
-			if (this.list) {
-				for (const item of this.list) {
+			if (this.selectList) {
+				for (const item of this.selectList) {
 					bigLength += item.bigCount
 					smallLength += item.smallCount
 				}