index.vue
6 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
<template>
<div class="marketing">
<div class="flex head">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">新增营销</el-button>
<div class="head-info flex">
<p>结合门店营销活动,指定客户创建智能营销,提高活动转化率</p>
<el-popover placement="top" width="560" trigger="hover" content="通过导入的客户,门店可通过智能外呼及智能短信,结合营销活动的需要向离店用户进行智能营销,可实现标准、高效的营销同时实现用户线上化。">
<img src="@/images/question.png" slot="reference" class="count-item-question" />
</el-popover>
</div>
</div>
<div class="container">
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<GLTable ref="marketingRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<template slot="imStatus" slot-scope="scope">
<div :class="['task_icon', scope.scope.imStatus == 1 ? 'task_icon1' : 'task_icon2']">{{ scope.scope.imStatus == 1 ? '待处理' : scope.scope.imStatus == 2 ? '已完成' : '删除' }}</div>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetails(scope.scope)">详情</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
data() {
return {
url: url,
tableSearchForm: {
imName: '',
imStatus: '',
createDate: []
},
searchForm: {},
// 搜索
searchFormData: [
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true
},
{
label: '状态',
name: 'imStatus',
type: 'select',
optionList: [
{ text: '全部', id: '' },
{ text: '待处理', id: 1 },
{ text: '已完成', id: 2 }
],
optionId: 'id',
optionLabel: 'text'
},
{
label: '营销名称',
name: 'imName',
type: 'input'
}
],
getListApi: this.$apis.marketing.getMessageList,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '营销名称',
prop: 'imName',
line: 1,
width: 350
},
{
label: '营销客户数',
prop: 'customerCount'
},
{
label: '状态',
prop: 'imStatus',
addHtml: 'imStatus'
},
{
label: '创建时间',
prop: 'sendTime'
},
{
label: '创建人',
prop: 'createdName'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
}
},
methods: {
handleAdd() {
this.$router.push({
path: '/marketing/add'
})
},
handleDetails(data) {
this.$router.push({
path: '/marketing/details',
query: {
id: data.id
}
})
},
handleDelete(data) {
this.$confirm('删除后数据将无法恢复,是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$apis.marketing.updateMessageInfoStatus({ id: data.id, imStatus: 3 }).then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
})
})
.catch(() => {})
},
getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm))
if (this.tableSearchForm.createDate.length) {
params.startTime = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.tableSearchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
params.taskStatus = this.currentIndex
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
delete this.searchForm.createDate
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.marketingRef.data.length ? (this.$refs.marketingRef.tableHeightValues = '') : this.$refs.marketingRef.setTableHeightFun()
},
handleSearch() {
this.$refs.marketingRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
imName: '',
imStatus: '',
createDate: []
}
this.searchForm = {
imName: '',
imStatus: '',
startTime: '',
endTime: ''
}
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.marketing {
.head {
margin-bottom: 16px;
}
.head-info {
font-weight: 400;
font-size: 14px;
color: #666666;
p {
margin: 0 4px 0 12px;
line-height: 16px;
}
.count-item-question {
width: 14px;
height: 14px;
display: inline-block;
}
}
.task_icon {
position: relative;
&::after {
content: '';
position: absolute;
top: 4px;
left: -10px;
width: 6px;
height: 6px;
border-radius: 4px;
}
&.task_icon1 {
&::after {
background: #fdb757;
}
}
&.task_icon2 {
&::after {
background: #2cca74;
}
}
}
}
</style>