zs 2 anos atrás
pai
commit
4439e1ed7a
2 arquivos alterados com 12 adições e 17 exclusões
  1. 6 15
      pages/market/index.vue
  2. 6 2
      pagesHome/order/detail.vue

+ 6 - 15
pages/market/index.vue

@@ -42,7 +42,8 @@
 											<view class="img">
 												<image :src="getFile(gs)"></image>
 											</view>
-											<view class=" one_1" v-if="num==0" @click="toCommon('/pagesHome/order/detail',gs)">
+											<view class=" one_1" v-if="num==0"
+												@click="toCommon('/pagesHome/order/detail',gs)">
 												<view class="name">{{gs.goods_name}}</view>
 												<view class="info">
 													<view class="title_1" v-if="gs.goodsSpec_name">
@@ -55,7 +56,8 @@
 												<view>x{{gs.num}}</view>
 											</view>
 											<view class="num" v-if="num==1">
-												<uni-number-box @change="changeValue(gs)" name="num" value="gs" :min="1" v-model="gs.num" />
+												<uni-number-box @change="changeValue(gs)" name="num" value="gs" :min="1"
+													v-model="gs.num" />
 											</view>
 											<view class="del" v-if="num==1">
 												<text class="iconfont icon-del-copy" @click="toDel(gs)"></text>
@@ -129,17 +131,6 @@
 					that.$set(that, `list`, res.data)
 				}
 			},
-			// // 转换金额
-			// showMoney(money) {
-			// 	const that = this;
-			// 	let moneys = `${money}`.split(".");
-			// 	if (moneys.length == 1) {
-			// 		money = money + ".00";
-			// 	} else if (moneys.length == 2) {
-			// 		money = money + "0";
-			// 	}
-			// 	return money;
-			// },
 			// 编辑
 			edit(num) {
 				const that = this;
@@ -328,14 +319,14 @@
 			// 计算总额
 			countMoney() {
 				const that = this;
-				const list = this.list;
+				const list = that.list;
 				let totalMoney = 0;
 				// 渲染结束执行下面方法
 				that.$nextTick(() => {
 					for (const val of list) {
 						for (let s of val.goods) {
 							if (s.check == true) {
-								let total = Number(s.money) * Number(s.num);
+								let total = that.$multiply(s.money, s.num);
 								totalMoney += Number(total);
 							}
 						}

+ 6 - 2
pagesHome/order/detail.vue

@@ -547,6 +547,9 @@
 				let user = that.user;
 				let info = that.info;
 				let specsInfo = that.specsInfo;
+				let act = that.info.act.map(item => {
+					return item._id
+				})
 				if (user && user._id) {
 					let obj = {
 						customer: user._id,
@@ -554,7 +557,8 @@
 						goods: info.goods._id,
 						goodsSpec: specsInfo._id,
 						num: that.buy_num,
-						inviter: that.inviter
+						inviter: that.inviter,
+						act
 					}
 					let res = await that.$api(`/cart`, 'POST', obj)
 					if (res.errcode == '0') {
@@ -592,7 +596,7 @@
 						goodsSpec: specsInfo._id,
 						num: that.buy_num,
 						inviter: that.inviter,
-						act: act
+						act
 					}]
 					let res = await that.$api(`/util/checkCanBuy`, 'POST', obj)
 					if (res.errcode == '0') {