const _Http = getApp().globalData.http; Page({ data: { loading: true, sa_orderid: null, tabsActive: 0, tabsList: [{ label: "详细信息", icon: "icon-tabchanpin", model: "#Product" }, { label: "物流查询", icon: "icon-tabfujian1", model: "#Query" }, { label: "装箱明细", icon: "icon-tabcaozuojilu1", model: "#Progress" }], }, onLoad(options) { /* this.setData({ sa_orderid: options.id }); this.getDetail(true); */ }, /* 获取详情 */ getDetail(init = false, show = true) { _Http.basic({ "id": 20221108151302, "content": { nocache: true, "sa_orderid": this.data.sa_orderid } }, show).then(res => { console.log("订单详情", res) if (res.msg != '成功') return wx.showToast({ title: res.msg, icon: "none" }); this.setData({ detail: res.data, loading: false }); if (init) this.partialRenewal(true) }) }, //tabs 切换 tabsChange({ detail }) { this.setData({ tabsActive: detail }); this.partialRenewal(); }, //局部数据更新 tabs partialRenewal(init = false) { return ; let model = this.data.tabsList[this.data.tabsActive].model; if (model) { let Component = this.selectComponent(model), { total, pageNumber, pageTotal } = Component.data.content, id = this.data.detail.sa_orderid; if (total == null || init) { Component.getList(id, init); } else if (pageNumber < pageTotal) { Component.getList(id, false); } } }, onReachBottom() { this.partialRenewal(); }, })