125 lines
2.4 KiB
JavaScript
125 lines
2.4 KiB
JavaScript
import userApi from '../../../api/user';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orderId:'',
|
|
orderDetail:{},
|
|
orderStatusKV:userApi.order.statusKV,
|
|
orderStatus:userApi.order.status,
|
|
|
|
orderDeliverStatusKV:userApi.order.orderDeliverStatusKV,
|
|
|
|
scrollViewHeight:0,
|
|
|
|
refresherTriggered:true
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
const windowInfo = wx.getWindowInfo();
|
|
this.setData({
|
|
orderId:options.id,
|
|
scrollViewHeight:windowInfo.windowHeight - 94
|
|
});
|
|
this.getOrderDetail();
|
|
},
|
|
getOrderDetail(){
|
|
wx.showNavigationBarLoading();
|
|
userApi.order.detail(this.data.orderId).then((data)=>{
|
|
wx.hideNavigationBarLoading();
|
|
let totalPackage = 0;
|
|
data.packages.map((item)=>{
|
|
item.pickup_codes = item.pickup_codes.split(',');
|
|
totalPackage+=item.pickup_codes.length;
|
|
});
|
|
data.totalPackage = totalPackage;
|
|
this.setData({
|
|
orderDetail:data,
|
|
refresherTriggered:false
|
|
})
|
|
})
|
|
},
|
|
cancelOrder(){
|
|
wx.showModal({
|
|
title: '你确定取消此订单吗?',
|
|
complete: (res) => {
|
|
if (res.confirm) {
|
|
userApi.order.cancel(this.data.orderDetail.order.orderid).then(()=>{
|
|
this.getOrderDetail(this.data.orderDetail.order.orderid);
|
|
const pages = getCurrentPages();
|
|
const prePage = pages[pages.length-2];
|
|
prePage.loadOrderList();
|
|
});
|
|
}
|
|
}
|
|
})
|
|
},
|
|
copyOrderId(){
|
|
wx.setClipboardData({
|
|
data: this.data.orderDetail.order.orderid,
|
|
})
|
|
},
|
|
handleContact(e){
|
|
console.log('handleContact');
|
|
console.log(e.detail.path)
|
|
console.log(e.detail.query)
|
|
},
|
|
makePhoneCall(){
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.orderDetail.order.deliveryman_phone,
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |