warningStoreList.js
3.84 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
// packageIndex/pages/salesSummary/salesSummary.js
import IndexApi from '~/api/index/index'
import { tsFormatTime } from '~/utils/format'
Page({
/**
* 页面的初始数据
*/
data: {
activeIndex: 0,
tabList: [
{
count: 0,
text: '兜底指标预警'
},
{
count: 0,
text: '丢店风险预警'
},
{
count: 0,
text: '亏损预警'
}
],
list: []
},
getWarningStores() {
let { month, staffUuid, regionId, tabList } = this.data
let params = { month }
if (staffUuid) {
params.staffUuid = staffUuid
}
if (regionId) {
params.regionId = regionId
}
IndexApi.getWarningStores(params).then(res => {
console.log(res, 'res')
let { backstopWarningCount, lostShopWarningCount, lossWarningCount, backstopWarningList = [], lostShopWarningList = [], lossWarningList = [] } =
res.data
tabList[0].count = backstopWarningCount || 0
tabList[1].count = lostShopWarningCount || 0
tabList[2].count = lossWarningCount
// list 根据
this.setData({
tabList,
backstopWarningList,
lostShopWarningList,
lossWarningList,
list: backstopWarningList || []
})
})
},
getList() {
let { activeIndex } = this.data
IndexApi.summaryMonthShowPersonList({
personType: activeIndex == 0 ? 1 : 2
}).then(res => {
console.log(res)
res.data = res.data.map(item => ({
...item,
lastFollowUpTime: item.lastFollowUpTime
? tsFormatTime(item.lastFollowUpTime)
: '-'
}))
this.setData({
list: res.data
})
})
},
initTablist() {
IndexApi.summaryMonthShow({}).then(res => {
console.log(res)
const { noExpansionPersonCount = 0, noSignCustomerCount = 0 } =
res.data || {}
const tabList = this.data.tabList.map(item => ({ ...item }))
tabList[0].count = noExpansionPersonCount
tabList[1].count = noSignCustomerCount
this.setData({ tabList })
// this.setData({
// tabList[0].count: res.data.noExpansionPersonCount,
// tabList[1].count: res.data.noSignCustomerCount,
// })
})
},
tabClick(e) {
// 根据索引获取数据
let { backstopWarningList, lostShopWarningList, lossWarningList } =
this.data
let list =
e.detail == 0
? backstopWarningList
: e.detail == 1
? lostShopWarningList
: lossWarningList
this.setData({
activeIndex: e.detail,
list: list || []
})
},
navigateToStoreDetail(e) {
let { item } = e.currentTarget.dataset
item.currentTab = 2
wx.navigateTo({
url: `/packageCustomer/pages/merchantDetail/merchantDetail?query=${encodeURIComponent(
JSON.stringify(item)
)}`
})
},
onRoute(options) {
console.log(options, 'options')
// console.log(options, 'options')
this.setData({
month: options.month,
staffUuid: options.staffUuid,
regionId: options.regionId
})
this.getWarningStores()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) { },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() { },
/**
* 生命周期函数--监听页面显示
*/
onShow() { },
/**
* 生命周期函数--监听页面隐藏
*/
onHide() { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload() { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() { },
/**
* 用户点击右上角分享
*/
onShareAppMessage() { }
})