This commit is contained in:
ghusermoon 2020-07-14 09:15:51 +08:00
parent 58b02c7432
commit 700ae94f79
3 changed files with 84 additions and 17 deletions

View File

@ -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', {

View File

@ -40,22 +40,31 @@
<image src="../static/image/1.png"></image>
</view>
</view>
<view>
<view class="title">配送方式</view>
<view class="value">
<view>快递</view>
<image src="../static/image/1.png"></image>
</view>
</view>
<view>
<!-- <view>
<view class="title">支付方式</view>
<view class="value">
<view>微信</view>
<image src="../static/image/1.png"></image>
</view>
</view> -->
</view>
</view>
</view>
<view class="common-active">
<view>
<view class="title">平台优惠券</view>
<view class="value">
<view>-0.00</view>
<image src="../static/image/1.png"></image>
</view>
</view>
<view>
<view class="title">配送方式</view>
<view class="value">
<view>快递</view>
<image src="../static/image/1.png"></image>
</view>
</view>
</view>
<view class="bottom">
<view class="left">
@ -63,7 +72,7 @@
<view class="price">{{ orderInfo.store_goods_total | showTotalPrice }}</view>
</view>
<view class="right">
<view class="num">1件商品</view>
<view class="num">{{ orderInfo.store_cart_list | setTotalNumber }}商品</view>
<view class="btn" @click="settlement">结算</view>
</view>
</view>
@ -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,8 +171,10 @@ export default {
font-size: 28rpx;
color: rgba(51,51,51,1);
margin-bottom: 20rpx;
> view:first-child {
margin-right: 13rpx;
}
}
.address-text {
font-size: 24rpx;
color: rgba(102,102,102,1);
@ -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;

View File

@ -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',