// pages/order/detail/detail.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { btnInfo: app.globalData.btnInfo, order_no:"", adder:"1号", uptime:'9:00-18:00', logistics1:[ { title:'请您打包好待清洗衣物,前往网点存衣 ', desc:"建议使用一次性包装袋打包衣物", foot:"" }, { title:'衣物已收到 ', desc:"衣物将被送往洗护中心清洗", foot:"" }, { title:'送洗途中 ', desc:"衣物送往", foot:"" }, { title:'清洗中 ', desc:"衣物正在", foot:"进行清洗" }, { title:'送回途中 ', desc:"衣物正在送回途中", foot:"" }, { title:'管家已存衣 ', desc:"请尽快取走您的衣物", foot:"" }, ], logistics2:[ { title:'请您打包好待清洗衣物,等待工作人员上门取衣 ', desc:"建议使用一次性打包袋打包衣物,上门服务时间:", }, { title:'衣物已收到 ', desc:"衣物将被送往洗护中心清洗", }, { title:'送洗途中 ', desc:"衣物送往{{adder}}洗护中心途中", }, { title:'清洗中 ', desc:"衣物正在{{adder}}洗护中心进行清洗", }, { title:'送回途中 ', desc:"衣物正在送回途中", }, { title:'管家已存衣 ', desc:"请尽快取走您的衣物", }, { title:'您已取回衣服 ', desc:"长期保存前先拆除外包装后再放入衣橱,避免因温度差异产生的水汽导致衣物发霉", }, ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let that = this that.setData({ order_no:options.order_no?options.order_no:"" }) // setTimeout(() => { // if(options.subscribe==1){ // that.opensubscribe() // } // }, 1000); // console.log(options.order_no) }, onShow(){ this.detail(this.data.order_no) }, opensubscribe(){ wx.showToast({ title: '开启订阅授权', icon: 'none', duration: 1200 }) wx.requestSubscribeMessage({ tmplIds: ['VGlAo-fOukIVSjdmOS5_-9IldrNplzrbKzZzWI2rFuc'], success (res) { console.log('成功-'+res) } }) }, goreport(){ wx.navigateTo({ url: '/pages/order/cleanReport/cleanReport?id='+this.data.orderinfo.id, }) }, backBtn() { wx.switchTab({ url: '/pages/tabber/order/index', }) }, home(){ wx.switchTab({ url: '/pages/tabber/home/index', }) }, location(){ console.log(this.data.orderinfo.network.lat) wx.openLocation({ latitude: Number(this.data.orderinfo.network.lat), longitude: Number(this.data.orderinfo.network.lng), }); }, rightClick() { console.log(1); }, detail(order) { var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/order_detail", { order_no: order, }, "get").then(function (res) { if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading({ success: (res) => { }, }) }, 2000); } else { console.log(res.message.data); that.setData({ orderinfo: res.message.data, address: res.message.address.address, code: res.message.address.phone, name: res.message.address.username, address_id:res.message.address.id, useraddr: res.message.address, }) } }).catch(function (err) { console.log(222); }) }, changeClose1(e) { this.setData({ show1: !this.data.show1 }) }, copy(e){ wx.setClipboardData({ data: e.currentTarget.dataset.no, success (res) { wx.showLoading({ title: '复制成功', }) setTimeout(function () { wx.hideLoading({ success: (res) => { }, }) }, 1000); } }) }, open(e){ let that = this var no=e.currentTarget.dataset.no; var network_id=e.currentTarget.dataset.network_id; var is_deposit=e.currentTarget.dataset.is_deposit; if(that.data.orderinfo.logistics_status!=2&&that.data.orderinfo.logistics_status!=4){ wx.scanCode({ onlyFromCamera: true, success (res) { console.log(res); var reg= new RegExp('(^)?network_id=([^&]*)(&|$)orde_num=([^&]*)(&|$)','i') var str= res.result.match(reg); wx.redirectTo({ url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit+"&order_num="+str[4]+"&device_id="+str[4], }) } }) } // wx.navigateTo({ // url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit, // }) }, logistic_code(e){ console.log(e) var logistic_code=e.currentTarget.dataset.no; var status=e.currentTarget.dataset.status; if(status==1||status==6){ wx.showModal({ title: '存/取件码', content: logistic_code }) } }, pay(){ wx.redirectTo({ url: "/pages/my/cashier/cashier?order_no="+this.data.order_no, }) }, // onUnload:function(){ // wx.switchTab({ // url: '/pages/tabber/order/index' // }) // }, closOrder(e) { console.log(e); var that = this; var order = e.currentTarget.dataset.oid app.api.useApi(app.globalData.baseAppUrl + "api/CancelOrders", { order_id: that.data.order_no, }, "post").then(function (res) { if (res.code != 200) { console.log(res.message.msg) wx.showToast({ title: res.message.msg, }) // that.detail(that.data.order_no); } else { wx.showLoading({ title: res.message.msg, }) setTimeout(() => { wx.navigateBack() }, 1000); } wx.hideLoading(); }).catch(function (err) { console.log(222); }) }, })