// pages/detailInfo/detailData.js import http from '../../utils/http' import util from '../../utils/util' Page({ /** * 页面的初始数据 */ data: { dates: '', date: "", project_id: "", datainfo: {}, order_sn: "", th: ["租赁设备", "提交人", "金额"], td: [], is_manager:"" }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ date: options.date, project_id: options.id - 0, dates: options.dates, order_sn: options.order_sn }) this.getOrderDetails() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, getOrderDetails() { http({ url: 'orders/getOrderDetails', data: { date: this.data.date, project_id: this.data.project_id, dates: this.data.dates, order_sn: this.data.order_sn, user_id:wx.getStorageSync('sg-userinfo').id }, success: (res) => { console.log(res) if (res.code == 0) { this.setData({ datainfo: res.order_view, td: res.data, is_manager:res.is_manager }) } } }) }, confirmOrder() { let time = util.formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss') wx.showModal({ title: "提示", content: "是否确认账单", success: (res) => { if (res.confirm) { http({ url: 'orders/updateOrderviewStatus', data: { order_sn: this.data.order_sn, time: time }, success: (re) => { if (re.code == 0) { wx.showToast({ title: re.msg, icon: "none", duration:1000 }) setTimeout(()=>{ wx.navigateBack({ delta: 1, }) },1000) } } }) } } }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })