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(){ userApi.order.markup.accept(this.data.applyDetail.id).then((data)=>{ 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() { } })