|
@@ -1,66 +1,116 @@
|
|
|
-// packageA/forecast/record.js
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
-
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
-
|
|
|
+ list: [],
|
|
|
+ showArr: [],
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastmodelid": null,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageTotal": 1,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ total: 0
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
-
|
|
|
+ this.setData({
|
|
|
+ 'content.sa_salesforecastmodelid': options.id,
|
|
|
+ userid: wx.getStorageSync("userMsg").userid
|
|
|
+ })
|
|
|
+ this.getList();
|
|
|
+ this.getShowArr();
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
-
|
|
|
+ /* 开始搜索 */
|
|
|
+ startSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': detail.trim()
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
-
|
|
|
+ cancelSearch() {
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': ""
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {
|
|
|
-
|
|
|
+ /* 展示列表 */
|
|
|
+ getShowArr() {
|
|
|
+ return _Http.basic({
|
|
|
+ "id": 20220906150303,
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_salesforecastmodelid": this.data.content.sa_salesforecastmodelid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ showArr: [{
|
|
|
+ label: "订单金额(万元)",
|
|
|
+ value: res.data.orderamountsum
|
|
|
+ }, {
|
|
|
+ label: "出货金额(万元)",
|
|
|
+ value: res.data.outamountsum
|
|
|
+ }, {
|
|
|
+ label: "开票金额(万元)",
|
|
|
+ value: res.data.invoiceamountsum
|
|
|
+ }, {
|
|
|
+ label: "订货数量(个)",
|
|
|
+ value: res.data.orderqtysum
|
|
|
+ }, {
|
|
|
+ label: "出货数量(个)",
|
|
|
+ value: res.data.outqtysum
|
|
|
+ }, {
|
|
|
+ label: "开票数量(个)",
|
|
|
+ value: res.data.invoiceqtysum
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {
|
|
|
-
|
|
|
+ getList(init = false) {
|
|
|
+ //init 用于初始化分页
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ if (init) this.setData({
|
|
|
+ ['content.pageNumber']: 1
|
|
|
+ })
|
|
|
+ if (this.data.content.pageNumber > this.data.content.pageTotal) return;
|
|
|
+ return _Http.basic({
|
|
|
+ "id": 20220906150403,
|
|
|
+ "version": 1,
|
|
|
+ content: this.data.content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("列表", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ 'content.pageNumber': res.pageNumber + 1,
|
|
|
+ 'content.pageTotal': res.pageTotal,
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
+ total: res.total
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
-
|
|
|
+ onPullDownRefresh: function () {
|
|
|
+ Promise.all([this.getList(true), this.getShowArr()]).then(res => {
|
|
|
+ wx.stopPullDownRefresh()
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
onReachBottom() {
|
|
|
-
|
|
|
+ this.getList();
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
-
|
|
|
- }
|
|
|
+ onShareAppMessage() {}
|
|
|
})
|