slimming.js
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var e = getApp(), os = e.globalData.setting;
var utils = require('../../../../utils/util.js');
var regeneratorRuntime = require('../../../../utils/runtime.js');
Page({
/**
* 页面的初始数据
*/
data: {
userInfo:null,
iurl: os.imghost,
portrait_list: [],
loading: 0,
portrait_req: {},
industry:'',
is_get:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that=this;
this.setData({
userInfo: getApp().globalData.userInfo
})
getApp().getConfig(function (e){
that.init_data();
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: async function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
init_data() {
let userInfo = getApp().globalData.userInfo;
var portrait_req = {
ApiName:'api.slimming.member.portrait',
store_id: userInfo.store_id,
//StaffId: that.idd,
vipid: userInfo.erpvipid,
};
this.get_service_portrait(portrait_req);
},
get_service_portrait(portrait_req) {
//var str='{"code":0,"msg":"操作成功!","data":[{"id":"a1ff01bc-b755-4a5c-8675-06b33354d5ec","customerno":"18650904780","customername":"心如水","sex":"女","mobiletel":"18650904780","birthday":"2000-11-23","age":22,"signingdate":"2022-11-22","weightlosscourse":4,"shapecourse":3,"weight":62,"targetweight":30,"subtracted":26,"advisername":"泉州万达纪莉(工号:07)","beautyconsultant":"泉州万达纪莉(工号:07)","diffweight":24,"minweight":100,"ideaweight":92,"tostoreqty":3,"dayweight":102,"previousweight":100,"lastweight":102,"actualweight":22,"ringratioweight":2,"undeduced":10,"standardweight":98}]}';
//var res=JSON.parse(str);
//this.setData({portrait_list: res.data});
//return false;
var that = this;
if (that.loading) {
return false;
}
that.loading = 1;
if (portrait_req) {
that.setData({
noMore: false,
portrait_list: [],
is_get: 0,
noMore: false
})
} else {
if (that.noMore) {
that.loading = 0;
return false;
}
portrait_req = that.portrait_req; //如果不是全选的参数,就是page分页+1
portrait_req.page++;
}
//请求参数进行存储
that.portrait_req = portrait_req;
wx.showLoading({
title: '加载中'
});
console.log(getApp().globalData.config,1111);
var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid;
getApp().request.promiseGet(url, {
data: portrait_req
})
.then((res) => {
wx.hideLoading();
that.loading = 0;
that.setData({is_get: 1})
if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
var list=res.data.data.pageData;
list[0].weight = list[0].weight * 2
if (list[0].tostoreqty == 0) {
list[0].undeduced = list[0].undeduced + list[0].actualweight
list[0].actualweight = 0
list[0].ringratioweight = 0
} else if (list[0].tostoreqty == 1) {
list[0].ringratioweight = 0
}
that.setData({portrait_list: list})
} else {
that.setData({
noMore:true
})
}
});
},
goto:function (e){
var url=e.currentTarget.dataset.url;
getApp().goto(url);
}
})