// 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:"衣物正在送回途中", }, ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ order_no:options.order_no }) }, onShow(){ this.detail(this.data.order_no) }, 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){ var no=e.currentTarget.dataset.no; var network_id=e.currentTarget.dataset.network_id; var is_deposit=e.currentTarget.dataset.is_deposit; // wx.navigateTo({ // url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+network_id+"&is_deposit="+is_deposit, // }) 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.navigateTo({ url: '/pages/order/deposit/deposit?order_type='+no+"&network_id="+str[2]+"&is_deposit="+is_deposit+"&device_id="+str[4], }) } }) }, logistic_code(e){ var logistic_code=e.currentTarget.dataset.no; 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: '取消成功', }) that.detail(that.data.order_no); } else { wx.showLoading({ title: res.message.msg, }) } wx.hideLoading(); }).catch(function (err) { console.log(222); }) }, })