// nova-tourism/pages/my/my-order/order-detail-good/index.js let Parse = getApp().Parse; const company = getApp().globalData.company const uid = Parse.User.current()?.id const dateF = require("../../../../../utils/date") Page({ /** * 页面的初始数据 */ data: { statusBarHeight: 0, screenHeight: 0, customHeight: 0, bottomNavHeight: 0, contentHeight: 0, objectId: '', value: '', roomList: {}, statusMap: { '200': '待发货', '500': '等待退款', '601': '退款中', '602': '待发货', '300': '已发货', '400': '已收货', '700': '已收货', '800': '已收货', }, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const { objectId } = options; this.setData({ objectId, }) console.log(this.data.objectId); const systemInfo = wx.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 0; const screenHeight = systemInfo.screenHeight || 0; const custom = wx.getMenuButtonBoundingClientRect(); const customHeight = custom.height + 10 + 2 || 0; const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0; const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth; this.setData({ statusBarHeight, screenHeight, customHeight, bottomNavHeight, contentHeight }); this.getOrder() }, /**获取订单 */ async getOrder() { let { objectId } = this.data let query = new Parse.Query('Order') query.include('targetObject', 'store','expressCompany') let d = await query.get(objectId) let order = d?.toJSON() if(order.payTime){ order.payTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order?.payTime?.iso) } if (order.startTime) { order.startTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order?.startTime?.iso) } console.log(order) this.setData({ order }) }, /** 复制*/ copyStr(e) { let { str } = e.currentTarget.dataset if (str) { wx.setClipboardData({ data: str, success: () => { wx.showToast({ title: '复制成功', icon: 'success', }); }, fail: (err) => { console.error('复制失败:', err); wx.showToast({ title: '复制失败', icon: 'none', duration: 2000 }); } }); } else { wx.showToast({ title: '没有订单编号', icon: 'none', duration: 2000 }); } }, /**查看物流 */ toExpress() { let { order } = this.data if (!order?.trackingNumber||!order?.expressCompany?.objectId) { wx.showToast({ title: '暂无物流单号或快递公司', icon:'none' }) return } wx.navigateTo({ url: `/common-page/pages/nova-express/index?num=${order?.trackingNumber}&com=${order?.expressCompany?.code}&phone=${order?.info?.mobile}`, }) }, tourl(e) { let url = e.currentTarget.dataset.url wx.navigateTo({ url: `${url}`, }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })