// pages/details/details.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { item: "", //余额字样 balanceLang: '余额', //门店独立余额 log_model: '', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (options.name == 'store') { this.setData({ id: options.id, }); this.getData(); } else { if (options.item) { this.setData({ item: JSON.parse(options.item) }); } try { var value = wx.getStorageSync('balance'); if (value) { this.setData({ balanceLang: value }); wx.setNavigationBarTitle({ title: this.data.balanceLang + '详情' }); // Do something with return value } } catch (e) { // Do something when catch error } } }, getData() { let urlStr = app.getNetAddresss("plugin.store-cashier.frontend.store.balance.log.detail"); app._postNetWork({ url: urlStr, data: { log_id: this.data.id, }, success: (resdata) => { let res = resdata.data; console.log(res); let log_model = res.data.log_model; let info = { serial_number: log_model.sn, change_money: `${log_model.op}${log_model.change_balance}`, service_type_name: log_model.mold_name, new_money: log_model.after_balance, }; this.setData({ item:info }); }, fail: function (res) { wx.showToast({ title: res.data.msg, duration: 1000, icon: 'none' }); } }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } });