zs 2 年 前
コミット
d3ebd3de7a
1 ファイル変更27 行追加8 行削除
  1. 27 8
      pagesHome/order/order.vue

+ 27 - 8
pagesHome/order/order.vue

@@ -55,7 +55,8 @@
 									</view>
 									<view class="other">
 										<view class="other_1">运费</view>
-										<view class="other_2" v-if="!item.freight_total==0">¥{{item.freight_total}}</view>
+										<view class="other_2" v-if="!item.freight_total==0">¥{{item.freight_total}}
+										</view>
 										<view class="other_2" v-else>包邮</view>
 									</view>
 									<view class="other">
@@ -120,8 +121,8 @@
 				key: '',
 				address: {},
 				orderList: [],
-				shop:[],
-				goods_total:0,
+				shop: [],
+				goods_total: 0,
 				// 收货地址
 				addressList: [],
 			};
@@ -179,8 +180,25 @@
 				});
 			},
 			// 提交订单
-			toSubmit() {
-
+			async toSubmit() {
+				const that = this;
+				let data = {
+					address: that.address,
+					goods: that.orderList,
+					total_detail: that.goods_total
+				}
+				const arr = await that.$api(`/order`, 'POST', data)
+				if (arr.errcode == '0') {
+					uni.showToast({
+						title: `提交订单成功`,
+						icon: 'none'
+					})
+				} else {
+					uni.showToast({
+						title: arr.data.msg,
+						icon: 'none'
+					})
+				}
 			},
 			// 监听用户是否登录
 			watchLogin() {
@@ -215,7 +233,7 @@
 				if (arr.errcode == '0') {
 					that.$set(that, `address`, arr.data.address);
 					that.$set(that, `orderList`, arr.data.goodsData);
-					var total=arr.data.orderTotal.freight_total+arr.data.orderTotal.goods_total
+					var total = arr.data.orderTotal.freight_total + arr.data.orderTotal.goods_total
 					that.$set(that, `goods_total`, total);
 				}
 			},
@@ -309,8 +327,9 @@
 						.c {
 							width: 60vw;
 							padding: 0 2vw;
-							.Spec{
-								font-size: var(--font12Size);					
+
+							.Spec {
+								font-size: var(--font12Size);
 								color: var(--f85Color);
 							}
 						}