var e = getApp(), os = e.globalData.setting; var utils = require('../../../../utils/util.js'); var regeneratorRuntime = require('../../../../utils/runtime.js'); const request = getApp().request; let app = getApp(); Page({ filters: { toFix(val) { if (val === undefined) return 0; if (val === null) return 0; if (isNaN(val)) return 0; if (val === '') return 0; return parseFloat(val).toFixed(2); }, //获取样式 set_def: function (val, def, is_price) { if (val == undefined) { if (def) return def; return "-" } if (is_price) { return parseFloat(val + "").toFixed(2); } return val; }, }, data:{ imghost: app.globalData.setting.imghost, keyword: '', list: [], list2:[], diffweight:'', standardweight:'', howday:'', }, onLoad(options) { var that = this; if (options.customerid != undefined && options.customerid != "" && options.customerid != null) { that.setData({ customerid:options.customerid, diffweight:options.diffweight, standardweight:options.standardweight, howday:options.howday }) } var userInfo = getApp().globalData.userInfo; if (userInfo) { that.userInfo = userInfo; that.loding = 1; that.init_data(); } wx.getSystemInfo({ success: function (res) { var clientWidth = res.windowWidth; var clientHeight = res.windowHeight; var rpxR = 750 / clientWidth; var calc = clientHeight * rpxR; that.setData({ calc:calc }) } }) }, onShow: function () { if (getApp().globalData.userInfo && !this.userInfo) { this.setData({ userInfo:userInfo }) this.loding = 1; this.init_data(); } }, //初始化数据 init_data() { var that = this; let userInfo = getApp().globalData.userInfo; let req = { customerid: that.data.customerid, store_id: userInfo.store_id, //用户id //staffid: getApp().globalData.RoleData.StaffId, //商户编号 ApiName: 'api.slimming.clock.registration.sum.query', }; that.get_list(req); }, //获取门店报表 get_list(req) { var that = this; if (that.loading) { return false; } that.loading = 1; if (req) { that.setData({ noMore:false, list:[], list2:[] }) } else { if (that.noMore) { that.loading = 0; return false; } req = that.req; //如果不是全选的参数,就是page分页+1 req.page++; } //请求参数进行存储 that.req = req; wx.showLoading({ title: '加载中' }); var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid; getApp().request.promiseGet(url, { data: req }) .then((res) => { wx.hideLoading(); that.loading = 0; if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { var list=that.data.list; for (let i = 0; i < res.data.data.pageData.length; i++) { list.push(res.data.data.pageData[i]); } that.setData({ list:list }) } else { getApp().confirmBox(res.data.msg) } }); }, })