overView.js
4.32 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
// packageStoreAssistant/sopJourney/pages/overView/overView.js
import sopApi from '~/api/sopApi'
import stageData from '../../data/index'
// 1.短信 2.ai外呼 3.门店助手朋友圈 4.门店助手1v1转发 5.客户跟进提醒
const TASK_LIST = [{
icon: 'sms',
title: '批量发短信',
description: '批量发送续保膨胀金短信',
url: '/packageStoreAssistant/packageActivity/pages/marketing/task/task?type=2',
show: true
}, {
icon: 'ai-call',
title: '批量外呼',
description: '批量AI外呼,提醒续保',
url: '/packageStoreAssistant/packageActivity/pages/marketing/task/task?type=1',
show: true
}, {
icon: 'pyq',
title: '分享朋友圈',
description: '分享膨胀金链接到朋友圈',
show: true
},
{
icon: 'transmit',
title: '转发给客户',
description: '分享膨胀金链接到客户微信',
url: '/packageStoreAssistant/packageActivity/pages/marketing/task/task?type=2',
show: true
},
{
icon: 'remind',
title: '客户跟进提醒',
description: '及时跟进客户,提醒续保',
url: '/packageStoreAssistant/packageActivity/pages/marketing/task/task?type=2',
show: true
}
]
Page({
/**
* 页面的初始数据
*/
data: {
tab: [],
tabIndex: 0,
sopList: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onRoute(option) {
if (option) {
let {
activityId,
stageList,
stageName
} = option
this.setData({
activityId,
stageName,
tab: stageList
}, () => {
this.currentTab()
this.getSopList()
})
}
},
tabClick(e) {
let {
index
} = e.currentTarget.dataset, {
tab
} = this.data
this.setData({
tabIndex: index,
stageName: tab[index].stageName
})
this.clearData()
},
clearData() {
this.pageNum = 1
this.setData({
sopList: [],
pageFlag: false
})
this.getSopList()
},
currentTab() {
let {
tab,
tabIndex,
stageName
} = this.data;
if (stageName) {
tab.forEach((item, index) => {
if (item.stageName == stageName) {
tabIndex = index
this.setData({
tabIndex
})
}
})
} else {
this.setData({
stageName: tab[tabIndex].stageName
})
}
},
async getSopList() {
wx.$api.showLoading('加载中...')
let {
tab,
stageName
} = this.data,
sopArr = [],
nothing
try {
let data;
tab.forEach(item => {
if (item.stageName == stageName) {
data = item.nodeInfos
}
})
console.log(data)
// data = stageData[stageName]
if (data.length == 0) nothing = true
data.forEach(item => {
if ([1, 2, 3, 4, 5].includes(item.nodeParam.taskType)) {
if (sopArr[item.nodeParam.day - 1]) {
sopArr[item.nodeParam.day - 1].data.push(item.nodeParam)
} else {
sopArr[item.nodeParam.day - 1] = {
title: `客户旅程第${item.nodeParam.day}天`,
data: [item.nodeParam]
}
}
}
})
this.setData({
sopList: sopArr,
TASK_LIST: TASK_LIST,
nothing,
pageFlag: true,
triggered: false
})
wx.hideLoading()
} catch (error) {
console.log(error)
// wx.$api.showToast(error)
wx.hideLoading()
this.setData({
pageFlag: false
})
}
},
// 下拉触底
onScrolltolower(e) {
let {
pageNum,
nothing
} = this.data
if (nothing) return
this.setData({
pageNum: ++pageNum
}, () => {
this.getSopList()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})