pointsReview.js
5.56 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
// pages/pointsReview/index.js
import api from '~/api/api'
Page({
/**
* 页面的初始数据
*/
data: {
tabList: ['全部', '待审批', '已审批', '已失效'],
keyword: '',
sceneType: '',
listData: [],
statusObj: {
0: {
text: '待审批',
color: '#FF9D0A',
background: '#FFF5E6'
},
1: {
text: '已审批',
color: '#347BFF',
background: '#EAF1FF'
},
2: {
text: '已失效',
color: '#F24724',
background: '#FDECE9'
}
},
listItemObj: [{
label: '订单编号',
key: 'orderCode'
}, {
label: '支付时间',
key: 'payTime'
}, {
label: '推荐人',
arr: ['referrerName', 'referrerPhone']
}, {
label: '门店名称',
key: 'merchantName'
}, {
label: '订单时间',
key: 'orderTime'
}, {
label: '交易流水号',
key: 'tradeNo'
}, {
label: '积分归属',
key: 'staffSource'
}, {
label: '备注',
key: 'remark'
}],
imageUrlData: [],
pageNum: 1,
nothing: false,
total: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onRoute(options) {
this.setData({
sceneType: options?.scene
})
},
tabClick(e) {
this.setData({
tabIndex: e?.detail
}, () => {
this.search()
})
},
search() {
this.setData({
listData: [],
pageNum: 1,
flag: false,
nothing: false
}, () => {
this.getListData()
})
},
getListData() {
let { sceneType, listData, pageNum, nothing, keyword, tabIndex } = this.data
let statusObj = {0: '', 1: 0, 2: 1, 3: 2}
let params = {
// sceneType,
pageNum,
pageSize: 4,
search: keyword,
supervisorStatus: statusObj[tabIndex]
}
if (nothing) return
api.getPointsReviewListAPI(params).then(res => {
let { code, data, message } = res
if (code == 0) {
data?.list?.forEach(val => {
val.payTime = (val.payTime && (new Date(val.payTime).format('yyyy.MM.dd hh:mm:ss') || val.payTime)) || '' // 支付时间
val.orderTime = (val.orderTime && (new Date(val.orderTime).format('yyyy.MM.dd hh:mm:ss') || val.orderTime)) || '' // 订单时间
val.subOrderList = val?.goodsName?.split(',') // 商品
val.failTime = (val.failTime && (new Date(val.failTime).format('yyyy.MM.dd hh:mm:ss') || val.failTime)) || '' // 退款,撤单,错单时间
val.operateTime = (val?.operationList?.[0]?.operateTime && (new Date(val.operationList[0].operateTime).format('yyyy.MM.dd hh:mm:ss') || val.operationList[0].operateTime)) || '' // 审批时间
val.operator = val?.operationList?.[0]?.operator || '' // 审批人
val.operatorPhone = val?.operationList?.[0]?.operatorPhone || '' // 审批人手机号
val.staffSource = val.staffSource == 1 ? '驻店员工' : '门店员工' // 积分归属
})
let tempList = listData?.concat(data?.list)
this.setData({
listData: tempList,
nothing: data?.total == (tempList?.length - 1),
total: data?.total,
flag: true,
triggered: false
})
} else {
wx.$util.showToast(message)
}
}).catch(err => {})
},
// 查看全部商品
showAllGoodsList(e) {
let {
item
} = e.currentTarget.dataset
let {
listData
} = this.data
listData.forEach(subVal => {
if (subVal.id == item.id) subVal.showAllGoodsListFlag = !subVal?.showAllGoodsListFlag
})
this.setData({
listData
})
},
// 审批
handleReview(e) {
let { item } = e.currentTarget.dataset
this.setData({
show: true,
approvedItem: item,
imageUrlData: item?.attachments?.split(',') || []
})
},
handleConfirm() {
let {approvedItem} = this.data
let userInfo = wx.$util.getUserInfo()
let params = {
id: approvedItem?.id,
auditResult: 0,
operatorId: userInfo?.uuid
}
api.approvedPointsAPI(params).then(res => {
let { code, message } = res
if (code == 0) {
this.search()
} else {
wx.$util.showToast(message)
}
}).catch(err => {})
this.hideDialog()
},
handleCancel() {
this.hideDialog()
},
hideDialog() {
this.setData({
show: false
})
},
viewImage(e) {
let { url } = e.currentTarget.dataset
let { imageUrlData } = this.data
wx.previewImage({
urls: imageUrlData,
current: url
})
},
input(e) {
let { value } = e.detail
this.setData({
keyword: value
})
},
clear() {
this.setData({
keyword: ''
}, () => {
this.search()
})
},
scrollonReachBottom() {
let {
total,
pageNum,
nothing
} = this.data
wx.$util.onReachBottom({
total,
pageNum,
nothing,
pageSize: 4
},
res => {
this.getListData()
}
)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})