From 700ae94f79881c7a936c1a4661354f3b42566400 Mon Sep 17 00:00:00 2001
From: ghusermoon <2673031505@qq.com>
Date: Tue, 14 Jul 2020 09:15:51 +0800
Subject: [PATCH] order
---
common/api/shop.js | 21 +++++++++-
pageC/cart/ConfirmOrder.vue | 76 ++++++++++++++++++++++++++++++-------
pageC/cart/index.vue | 4 +-
3 files changed, 84 insertions(+), 17 deletions(-)
diff --git a/common/api/shop.js b/common/api/shop.js
index 6d025d9..d0afccd 100644
--- a/common/api/shop.js
+++ b/common/api/shop.js
@@ -97,12 +97,29 @@ export default {
quantity: quantity
});
},
- // 订单结算数据
- settlementOrder({ cart_id }) {
+ // 订单步骤1:展示结算数据
+ settlementOrder({ ifcart, cart_id }) {
return vm.$u.post('buy/buy_step1', {
+ ifcart: ifcart,
cart_id: cart_id,
});
},
+ // 订单步骤2:发起订单,返回订单信息
+ sendOrder({ ifcart, cart_id, address_id, buy_city_id }) {
+ return vm.$u.post('buy/buy_step2', {
+ ifcart: ifcart,
+ cart_id: cart_id,
+ address_id: address_id,
+ buy_city_id: buy_city_id,
+ });
+ },
+ // 订单步骤3:发起支付(第三方统一下单)
+ sendPay({ pay_sn, payment_code }) {
+ return vm.$u.post('Payment/real_order', {
+ pay_sn: pay_sn,
+ payment_code: payment_code,
+ });
+ },
// 选择地区计算运费
getFreight({ freight_hash, city_id, area_id }) {
return vm.$u.post('Buy/change_addr', {
diff --git a/pageC/cart/ConfirmOrder.vue b/pageC/cart/ConfirmOrder.vue
index 3a47718..9c724d2 100644
--- a/pageC/cart/ConfirmOrder.vue
+++ b/pageC/cart/ConfirmOrder.vue
@@ -40,20 +40,29 @@
-
- 配送方式
-
- 快递
-
-
-
-
+
+
+
+
+
+
+ 平台优惠券
+
+ -¥0.00
+
+
+
+
+ 配送方式
+
+ 快递
+
@@ -63,7 +72,7 @@
¥{{ orderInfo.store_goods_total | showTotalPrice }}
- 共1件商品
+ 共件{{ orderInfo.store_cart_list | setTotalNumber }}商品
结算
@@ -89,7 +98,18 @@ export default {
}
}
return price.toFixed(2);
- }
+ },
+ setTotalNumber(data) {
+ let num = 0;
+ for (const key in data) {
+ if (data.hasOwnProperty(key)) {
+ const element = data[key][0];
+ console.log(element);
+ num += element.goods_num;
+ }
+ }
+ return num;
+ },
},
onLoad(option) {
console.log(JSON.parse(option.info));
@@ -151,7 +171,9 @@ export default {
font-size: 28rpx;
color: rgba(51,51,51,1);
margin-bottom: 20rpx;
- margin-right: 13rpx;
+ > view:first-child {
+ margin-right: 13rpx;
+ }
}
.address-text {
font-size: 24rpx;
@@ -167,7 +189,7 @@ export default {
}
}
.main {
- margin-bottom: 100rpx;
+ margin-bottom: 50rpx;
> view {
.goods-info {
background-color: #ffffff;
@@ -276,6 +298,34 @@ export default {
}
}
}
+ .common-active {
+ padding-bottom: 200rpx;
+ > view {
+ height: 98rpx;
+ background: rgba(255,255,255,1);
+ padding: 35rpx 30rpx;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 2rpx;
+ .title {
+ font-size: 28rpx;
+ color: rgba(102,102,102,1);
+ }
+ .value {
+ display: flex;
+ align-items: center;
+ font-size: 30rpx;
+ color:rgba(51,51,51,1);
+ > image {
+ width: 12rpx;
+ height: 22rpx;
+ flex-shrink: 0;
+ margin-left: 20rpx;
+ }
+ }
+ }
+ }
.bottom {
padding: 35rpx 30rpx;
position: fixed;
diff --git a/pageC/cart/index.vue b/pageC/cart/index.vue
index 096bffa..f501e87 100644
--- a/pageC/cart/index.vue
+++ b/pageC/cart/index.vue
@@ -93,8 +93,8 @@ export default {
temp = '';
})
// console.log(id);
-
- this.$u.api.settlementOrder({ cart_id: id }).then(res => {
+ // ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀)
+ this.$u.api.settlementOrder({ ifcart: 1, cart_id: id }).then(res => {
if(res.errCode == 0) {
this.$u.route({
url: '/pageC/cart/ConfirmOrder',