zs 2 yıl önce
ebeveyn
işleme
43e9153383
1 değiştirilmiş dosya ile 37 ekleme ve 51 silme
  1. 37 51
      pagesHome/order/order.vue

+ 37 - 51
pagesHome/order/order.vue

@@ -6,13 +6,13 @@
 					<view class="list-scroll-view">
 						<view class="one_1">
 							<text class="localicon iconfont icon-dingweixiao"></text>
-							<view class="other" v-if="info._id">
+							<view class="other" v-if="address._id">
 								<view class="name">
-									<text>{{info.name}},</text>{{info.phone}}
+									<text>{{address.name}},</text>{{address.phone}}
 								</view>
 								<view class="other_1">
-									<text>{{info.province}}</text><text>{{info.city}}</text>
-									<text>{{info.area}}</text><text>{{info.address}}</text>
+									<text>{{address.province}}</text><text>{{address.city}}</text>
+									<text>{{address.area}}</text><text>{{address.address}}</text>
 								</view>
 							</view>
 							<view class="address" v-else><text>请选择一个收货地址</text></view>
@@ -23,25 +23,28 @@
 								<view class="list_1">
 									<view class="l">
 										<text class="iconfont icon-shangdian"></text>
-										<text>{{item.shop}}</text>
+										<text>{{item.shop_name}}</text>
 									</view>
 								</view>
 								<view class="list_2">
 									<view class="l">
-										<image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''"
+										<image class="image" :src="item.goods[0].file&&item.goods[0].file.length>0?item.goods[0].file[0].url:''"
 											mode=""></image>
 									</view>
 									<view class="c">
 										<view class="name">
-											{{item.name}}
+											{{item.goods[0].goods_name}}
+										</view>
+										<view class="Spec">
+											规格:{{item.goods[0].goodsSpec_name}}
 										</view>
 									</view>
 									<view class="r">
 										<view class="price">
-											¥{{item.price}}
+											¥{{item.goods[0].money}}
 										</view>
 										<view class="num">
-											×{{item.buy_num}}
+											×{{item.goods[0].num}}
 										</view>
 									</view>
 								</view>
@@ -52,13 +55,13 @@
 									</view>
 									<view class="other">
 										<view class="other_1">运费</view>
-										<view class="other_2" v-if="!shop.freight==0">¥{{shop.freight}}</view>
+										<view class="other_2" v-if="!item.goods[0].freight==0">¥{{item.goods[0].freight}}</view>
 										<view class="other_2" v-else>包邮</view>
 									</view>
 									<view class="other">
 										<view class="other_1">订单备注</view>
 										<view class="other_3">
-											<input type="text" v-model="shop.remarks" placeholder="选填,可填写您与卖家达成一致的要求" />
+											<input type="text" v-model="item.goods[0].remarks" placeholder="选填,可填写您与卖家达成一致的要求" />
 										</view>
 									</view>
 								</view>
@@ -70,7 +73,7 @@
 			<view class="two">
 				<view class="two_1">
 					<view>实付金额:</view>
-					<view>¥{{shop.money}}</view>
+					<view>¥{{goods_total}}</view>
 				</view>
 				<view class="two_2">
 					<text @click="toSubmit">提交订单</text>
@@ -115,51 +118,17 @@
 			return {
 				user: {},
 				key: '',
-				info: {},
-				shop: {
-					money: 58,
-					freight: 7
-				},
-				orderList: [{
-					shop: '官方自营店',
-					status: '1',
-					url: [{
-						name: "20220928155634.jpg",
-						uri: "/files/point/20220928155634.jpg",
-						url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
-					}],
-					name: '饮用水',
-					price: 58,
-					buy_num: 1,
-					market_num: 1,
-					money: 58,
-					freight: 7
-				}, {
-					shop: '官方自营店',
-					status: '1',
-					url: [{
-						name: "20220928155634.jpg",
-						uri: "/files/point/20220928155634.jpg",
-						url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
-					}],
-					name: '饮用水',
-					price: 58,
-					buy_num: 1,
-					market_num: 1,
-					money: 58,
-					freight: 7
-				}],
+				address: {},
+				orderList: [],
+				goods_total:0,
 				// 收货地址
 				addressList: [],
 			};
 		},
-		onShow: function() {
-			const that = this;
-			that.watchLogin()
-		},
 		onLoad: async function(e) {
 			const that = this;
 			that.$set(that, `key`, e.key || '');
+			that.watchLogin()
 		},
 		methods: {
 			// 选择收货地址
@@ -176,7 +145,7 @@
 					const item = addressList[i]
 					if (values.includes(item._id)) {
 						that.$set(item, 'checked', true)
-						that.$set(that, `info`, item);
+						that.$set(that, `address`, item);
 					} else {
 						that.$set(item, 'checked', false)
 					}
@@ -239,6 +208,19 @@
 				if (res.errcode == '0') {
 					that.$set(that, `addressList`, res.data);
 				}
+				const arr = await that.$api(`/order/toMakeOrder`, 'POST', {
+					key: that.key
+				})
+				if (arr.errcode == '0') {
+					that.$set(that, `address`, arr.data.address);
+					that.$set(that, `orderList`, arr.data.goodsData);
+					var total_freight=0;
+					for (let val of arr.data.goodsData[0].goods) {
+						total_freight=total_freight+val.freight
+					}
+					var total=total_freight+arr.data.orderTotal.goods_total
+					that.$set(that, `goods_total`, total);
+				}
 			},
 		}
 	}
@@ -330,6 +312,10 @@
 						.c {
 							width: 60vw;
 							padding: 0 2vw;
+							.Spec{
+								font-size: var(--font12Size);					
+								color: var(--f85Color);
+							}
 						}
 
 						.r {