创建订单成功
This commit is contained in:
parent
c4a1aa873a
commit
fe6d62071f
@ -20,6 +20,7 @@ export default {
|
||||
return request.get('/api/user/info');
|
||||
},
|
||||
order:{
|
||||
pre:(data)=>request.post('/api/order/pre-order',data)
|
||||
pre:(data)=>request.post('/api/order/pre-order',data),
|
||||
real:(data)=>request.post('/api/order',data)
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
const app = getApp();
|
||||
import commonApi from '../../../api/common';
|
||||
import user from '../../../api/user';
|
||||
import userApi from '../../../api/user';
|
||||
|
||||
Page({
|
||||
|
||||
@ -17,7 +19,10 @@ Page({
|
||||
package:{
|
||||
name:'',
|
||||
count:0
|
||||
}
|
||||
},
|
||||
|
||||
isShowOrderConfirm:false,
|
||||
preOrder:{}
|
||||
|
||||
// addressList:[],
|
||||
// addressIndex:0
|
||||
@ -95,6 +100,41 @@ Page({
|
||||
currentAddress:address
|
||||
})
|
||||
},
|
||||
preOrder(){
|
||||
wx.getStorage({
|
||||
key:'pre-order',
|
||||
success:(res)=>{
|
||||
userApi.order.pre({
|
||||
packages:res.data.price_request.package
|
||||
}).then((data)=>{
|
||||
this.setData({
|
||||
isShowOrderConfirm:true,
|
||||
preOrder:data
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getOrder(){
|
||||
wx.getStorage({
|
||||
key:'pre-order',
|
||||
success:(res)=>{
|
||||
// let packages = [];
|
||||
// res.data.price_request.package.map((item)=>{
|
||||
// packages.push({
|
||||
// station_id:item.station_id,
|
||||
// pickup_codes:item.pickup_codes
|
||||
// });
|
||||
// });
|
||||
res.data.addressid = this.data.currentAddress.id;
|
||||
userApi.order.real(res.data).then((data)=>{
|
||||
wx.navigateTo({
|
||||
url: '/pages/help/success',
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button type="primary" class="order-button">立即下单</button>
|
||||
<button type="primary" class="order-button" bind:tap="preOrder">立即下单</button>
|
||||
<view class="login-panel" wx:if="{{!isLogin}}">
|
||||
<image class="icon" src="/assets/icon/help/redpacket@2x.png"/>
|
||||
<view class="text">登录后享跑腿服务</view>
|
||||
@ -72,4 +72,33 @@
|
||||
</view>
|
||||
<button class="button" type="primary">领</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<page-container show="{{isShowOrderConfirm}}" round close-on-slide-down>
|
||||
<view class="content pc-content">
|
||||
<view class="head">
|
||||
<view class="kv-item">
|
||||
<view class="key">送达地址</view>
|
||||
<view class="value">
|
||||
{{currentAddress.community_name+currentAddress.address_detail}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="kv-item">
|
||||
<view class="key">取件数量</view>
|
||||
<view class="value">{{preOrder.price_info.package_count}}个包裹</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="spliter"></view>
|
||||
<view class="kv-item">
|
||||
<view class="key">跑腿券</view>
|
||||
<view class="value yellow">0张</view>
|
||||
</view>
|
||||
<view class="kv-item">
|
||||
<view class="key">跑腿费</view>
|
||||
<view class="value red">¥3.5</view>
|
||||
</view>
|
||||
<view class="tips">*基础费3元 (含5件包裹) 超出部分0.5元/件</view>
|
||||
|
||||
<button class="button" type="primary" bind:tap="getOrder">立即购买</button>
|
||||
</view>
|
||||
</page-container>
|
||||
@ -155,4 +155,49 @@
|
||||
line-height: 1;
|
||||
padding:16rpx 22rpx;
|
||||
border-radius: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.pc-content{
|
||||
padding:30rpx;
|
||||
}
|
||||
|
||||
.pc-content .kv-item{
|
||||
display:flex;
|
||||
margin:12rpx 0 50rpx 0;
|
||||
}
|
||||
.pc-content .kv-item .key{
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pc-content .kv-item .value{
|
||||
font-weight: 500;
|
||||
}
|
||||
.pc-content .kv-item .yellow{
|
||||
color: #FF8400;
|
||||
}
|
||||
.pc-content .kv-item .red{
|
||||
color: #EB0000;
|
||||
}
|
||||
.pc-content .kv-item .key{
|
||||
flex:1
|
||||
}
|
||||
.pc-content .head .kv-item{
|
||||
margin:40rpx 0;
|
||||
}
|
||||
.pc-content .head .key{
|
||||
flex:none;
|
||||
}
|
||||
.pc-content .head .value{
|
||||
margin-left:24rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.pc-content .spliter{
|
||||
margin-bottom:40rpx;
|
||||
}
|
||||
.pc-content .tips{
|
||||
font-size:26rpx;
|
||||
color:#888888;
|
||||
}
|
||||
.pc-content .button{
|
||||
margin:60rpx 0 40rpx 0;
|
||||
}
|
||||
|
||||
@ -9,7 +9,8 @@ Page({
|
||||
data: {
|
||||
package:[],
|
||||
stationList:[],
|
||||
sendType:''
|
||||
sendType:'',
|
||||
preOrder:{}
|
||||
},
|
||||
|
||||
bottomBarButtonTap(){
|
||||
@ -62,6 +63,23 @@ Page({
|
||||
});
|
||||
console.log(this.data.stationList);
|
||||
},
|
||||
preOrder(){
|
||||
console.log(this.data.stationList);
|
||||
const data = [];
|
||||
this.data.stationList.map((item)=>{
|
||||
data.push({
|
||||
station_id:item.id,
|
||||
pickup_codes:item.package.join(',')
|
||||
});
|
||||
})
|
||||
userApi.order.pre({
|
||||
packages:data
|
||||
}).then((data)=>{
|
||||
this.setData({
|
||||
preOrder:data
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
@ -76,7 +94,9 @@ Page({
|
||||
const __item = res.data.price_request.package.find((_item)=>_item.station_id==item.id);
|
||||
item.package = __item.pickup_codes.split(',');
|
||||
});
|
||||
console.log(data.items);
|
||||
if(res.data.price_request){
|
||||
this.preOrder();
|
||||
}
|
||||
this.setData({
|
||||
stationList:data.items
|
||||
})
|
||||
|
||||
@ -2,5 +2,6 @@
|
||||
"usingComponents": {
|
||||
"bottomBar":"/components/bottomBar"
|
||||
},
|
||||
"navigationStyle": "default"
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "添加快递信息"
|
||||
}
|
||||
@ -34,10 +34,10 @@
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<view class="page-container">
|
||||
<!-- <view class="page-container">
|
||||
<view class="kv-item">
|
||||
<view class="key">取件量</view>
|
||||
<view class="value">2</view>
|
||||
<view class="value">{{preOrder.price_info.package_count}}</view>
|
||||
</view>
|
||||
<view class="kv-item">
|
||||
<view class="key">跑腿券</view>
|
||||
@ -48,6 +48,6 @@
|
||||
<view class="value red">¥3.5</view>
|
||||
</view>
|
||||
<view class="tips">*基础费3元 (含5件包裹) 超出部分0.5元/件</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<bottomBar bind:buttonTap="bottomBarButtonTap"/>
|
||||
@ -30,25 +30,6 @@
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.page-container .kv-item{
|
||||
display:flex;
|
||||
margin:12rpx 0 50rpx 0;
|
||||
}
|
||||
.page-container .kv-item .key{
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.page-container .kv-item .value{
|
||||
font-weight: 500;
|
||||
}
|
||||
.page-container .kv-item .yellow{
|
||||
color: #FF8400;
|
||||
}
|
||||
.page-container .kv-item .red{
|
||||
color: #EB0000;
|
||||
}
|
||||
.page-container .kv-item .key{
|
||||
flex:1
|
||||
}
|
||||
|
||||
.page-container .tips{
|
||||
font-size: 26rpx;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user