index.vue
7.24 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
<template>
<div>
<div class="scrm-sub-client-container">
<!-- <p class="pageTitle">客户群管理</p> -->
<div class="pageContent">
<search-form class="searchTop border-shadow" :isHasSyncBtn="true" :showDefaultTime="true" :merchantModel="merchantModel" :accountLevel="accountLevel" :formModel="searchForm" :formList="clientGroupFormList" @setTableHeightEvent="setTableHeightEvent" @resetTable="resetTable" @searchTable="searchTable" @syncClick="syncClick">
<span class="inline-b" slot="form-slot">
<el-button plain @click="resetTable">重置</el-button>
<el-button type="primary" @click="searchTable">查询</el-button>
<!-- v-if="(merchantModel == 1 && accountLevel == 1) || (merchantModel == 2 && accountLevel == 4)"允许所有人同步 -->
<el-button type="primary" @click="syncClick" :loading="sloading" >同步数据</el-button>
</span>
</search-form>
<GLTable @setTableFinishFun="setTableFinishFun" ref="clientGroupManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :pageConf="pageConf" :searchForm="searchFormTable" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="status" slot-scope="scope">
<!-- <span class="dot" :class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"></span> -->
<span class="statusText" :class="scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[1] : ''">{{ scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[0] : '--' }}</span>
</span>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- <auth-button :data="scope.scope"></auth-button> -->
<span @click="goDetail(scope.scope.id, scope.scope.custGroupName)" class="blue-text">详情</span>
</template>
</GLTable>
</div>
</div>
</div>
</template>
<script>
import { getTableList, syncCustomerBase } from '@/api/modules/clientGroupManage'
import url from '@/assets/clientDataOverview/nodata.png'
export default {
name: 'clientManage',
data() {
return {
url: url,
sloading: false,
titles: [
{ name: '客户群总数', num: 100, rate: '+10%', isUp: true, tips: '群提示消息1' },
{ name: '新增客户群数', num: 100, rate: '+10%', isUp: true, tips: '群提示消息2' }
],
searchForm: {},
searchFormTable: {},
clientGroupFormList: [
{
type: 'daterange',
prop: 'daterange',
label: '创建时间',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
},
{
type: 'input',
inputType: 'text',
prop: 'custGroupName',
label: '客户群名称',
placeholder: '请输入客户群名称'
},
{
type: 'input',
inputType: 'text',
prop: 'groupHostName',
label: '群主',
placeholder: '请输入群主'
},
{
type: 'input',
inputType: 'text',
prop: 'groupAdminName',
label: '管理员',
placeholder: '请输入管理员'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
tableColumns: [
{
label: '客户群名称',
prop: 'custGroupName'
},
{
label: '当前客户数',
prop: 'totalCount'
},
{
label: '新增入群客户数',
prop: 'newCustomerCount'
},
{
label: '新增退群客户数',
prop: 'delCustomerCount'
},
{
label: '群主',
prop: 'groupHostName'
},
{
label: '管理员',
prop: 'groupAdminName'
},
{
label: '创建时间',
prop: 'addTime',
width: 188
}
],
tableOption: {
width: 170,
btnList: [
{
name: '详情',
pType: 'detail'
}
]
}
},
getListApi: getTableList,
merchantModel: 1,
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
flushTime: false
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
}
},
mounted() {},
methods: {
syncClick() {
let _this = this
_this.sloading = true
syncCustomerBase({})
.then(res => {
if (!res) {
return
}
_this.sloading = false
this.$message.success('已同步客户群')
this.$refs.clientGroupManage.refreshTable()
})
.catch(err => {
_this.sloading = false
})
},
setTableHeightEvent() {
this.$refs.clientGroupManage.setTableHeightFun()
},
setTableFinishFun(content) {
console.log(content, this.$refs.clientGroupManage.data.length, '获取数据')
if (!this.flushTime) {
this.flushTime = true
this.searchTable()
}
//接收到的数据为空
if (!this.$refs.clientGroupManage.data.length) {
this.$refs.clientGroupManage.setTableHeightFun()
}
},
searchTable() {
this.$refs.clientGroupManage.refreshTable()
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchFormTable.daterange) {
this.searchFormTable.beginTime = this.searchForm.daterange[0]
this.searchFormTable.endTime = this.searchForm.daterange[1]
} else {
if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
}
delete this.searchFormTable.daterange
resolve()
})
},
resetTable() {
this.searchForm = {}
this.$refs.clientGroupManage.refreshTable()
},
btnClick(ptype, scope) {},
goDetail(id, name) {
this.$router.push({
path: '/clientGroupManage/clientGroupDetail',
query: {
id: id,
groupName: name
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.scrm-sub-client-container {
.pageTitle {
position: relative;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
padding: 6px 20px 30px;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
// min-width: 1300px;
background-color: #fff;
.el-button + .el-button {
margin-left: 20px;
}
}
}
</style>