138 lines
2.3 KiB
JavaScript
138 lines
2.3 KiB
JavaScript
import userApi from '../../../api/user';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orderId:'',
|
|
applyDetail:{},
|
|
cancelling:false,
|
|
isShowCancelView:false,
|
|
isShowAcceptView:false,
|
|
refresherTriggered:false
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.data.orderId = options.orderid;
|
|
this.getDetail();
|
|
},
|
|
getDetail(){
|
|
this.setData({
|
|
refresherTriggered:true
|
|
})
|
|
userApi.order.markup.get(this.data.orderId).then((data)=>{
|
|
this.setData({
|
|
applyDetail:data,
|
|
refresherTriggered:false
|
|
})
|
|
})
|
|
},
|
|
accept(){
|
|
this.setData({
|
|
isShowAcceptView:true
|
|
})
|
|
},
|
|
acceptRequest(){
|
|
const merchantPay = this.selectComponent('#merchantPay');
|
|
merchantPay.createPayment(this.data.applyDetail.fee_order_id,true);
|
|
},
|
|
paySuccess(){
|
|
wx.navigateBack({
|
|
success(){
|
|
wx.showToast({
|
|
title: '加价已同意',
|
|
})
|
|
}
|
|
});
|
|
this.updatePrePage();
|
|
},
|
|
|
|
cancel(){
|
|
this.setData({
|
|
isShowCancelView:true
|
|
})
|
|
},
|
|
cancelOrder(){
|
|
this.setData({
|
|
cancelling:true
|
|
})
|
|
userApi.order.cancel(this.data.orderId).then(()=>{
|
|
wx.navigateBack({
|
|
success(){
|
|
wx.showToast({
|
|
title: '取消成功',
|
|
})
|
|
}
|
|
});
|
|
this.updatePrePage();
|
|
});
|
|
},
|
|
updatePrePage(){
|
|
const pages = getCurrentPages();
|
|
const prePage = pages[pages.length-2];
|
|
prePage.getOrderDetail();
|
|
},
|
|
makePhoneCall(){
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.applyDetail.deliveryman_phone,
|
|
})
|
|
},
|
|
viewImage(event){
|
|
wx.previewImage({
|
|
urls: this.data.applyDetail.photo_urls,
|
|
current:event.currentTarget.dataset.item
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |