burialPointList.vue
7.46 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
<!-- 秒杀活动 -->
<template>
<div>
<div class="big-title">
攻略名称:{{strategyName || '--'}}
</div>
<div class="ctnr">
<GLCombiForm ref="goodsRef" @handleOk="handleSearch" @handleRest="handleReset" :formObj="searchFormObj" :formData="searchFormData">
</GLCombiForm>
<div class="operate-wrap">
<span class="table-title">已累计{{searchFormObj.recordType==1 ? '浏览' : searchFormObj.recordType==2 ? '分享' : ''}}<span style="color: #5850FF;">{{total}}</span>{{searchFormObj.recordType==3 ? '位访客' : '次'}}</span>
<div class="operate-btn">
<el-button :size="size" type="primary" plain @click="handleExport">导出</el-button>
</div>
</div>
<GLTable ref="tableRef" :pageConf="pageConf" :searchForm="searchFormObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="customerSlot" class="goodsNameSlot" slot-scope="scope">
<img v-if="scope.scope.customerAvatar" :src="scope.scope.customerAvatar" alt="">{{ scope.scope.customerName }}
</div>
<div slot="shareSlot" class="goodsNameSlot" slot-scope="scope">
<img v-if="scope.scope.shareAvatar" :src="scope.scope.shareAvatar" alt="">{{ scope.scope.shareName }}
</div>
<div slot="goodsNameSlot" class="goodsNameSlot" slot-scope="scope">
<img :src="scope.scope.goodsImgUrl" alt="">{{ scope.scope.goodsSkuName }}
</div>
<div class="setPriceSlot" slot="setPriceSlot" slot-scope="scope">
<el-input v-if="curEditId==scope.scope.id" :value="scope.scope.salePrice" type="text" clearable @blur="setPriceFn(scope.scope)"></el-input>
<span class="unedited" v-else>
{{scope.scope.salePrice}}
<img :src="require('@/assets/images/edit.png')" alt="" @click="editPrice(scope.scope)">
</span>
</div>
</GLTable>
</div>
</div>
</template>
<script>
const baseColumn = [
{
label: '微信昵称',
addHtml: 'customerSlot'
},
{
label: '手机号',
prop: 'mobile'
},
{
label: '分享人',
addHtml: 'shareSlot'
}
]
const otherColumn = {
1: [
{
label: '浏览时长',
prop: 'browserTime'
},
{
label: '进入页面时间',
prop: 'operationDate'
},
{
label: '离开页面时间',
prop: 'leaveDate'
},
],
2: [
{
label: '分享时间',
prop: 'operationDate'
},
{
label: '浏览时长',
prop: 'browserTime',
formatter: cell =>{
return '--'
}
},
{
label: '进入页面时间',
prop: 'operationDate',
formatter: cell =>{
return '--'
}
},
{
label: '离开页面时间',
prop: 'leaveDate',
formatter: cell =>{
return '--'
}
},
],
3: [
{
label: '浏览次数',
prop: 'browseCount'
},
{
label: '最后浏览时间',
prop: 'lastBrowseDate'
},
]
}
import { utils } from 'glsx-common'
export default {
name: 'browse',
data() {
return {
size: 'small',
searchFormObj: {
recordType: 1,
strategyId: '',
customerName: '',
mobile: '',
shareName: ''
},
strategyName: '',
total: 0,
searchFormData: [
{
label: '微信昵称',
name: 'customerName',
type: 'input',
isClear: true
},
{
label: '手机号',
name: 'mobile',
type: 'input',
isClear: true
},
{
label: '分享人',
name: 'shareName',
type: 'input',
isClear: true
}
],
getListApi: this.$apis.strategy.getburialPointListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
listName: 'list',
tableOption: null,
tableColumns: []
},
}
},
components: {
},
created() {
const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
console.log(this.routeInfo)
const {id, recordType, strategyName} = this.routeInfo
this.strategyName = strategyName
this.searchFormObj.strategyId = id
this.searchFormObj.recordType = recordType
this.tableParams.tableColumns = [...baseColumn,...otherColumn[recordType]]
},
mounted() {
},
methods: {
handleReset(){
this.searchFormObj = {
strategyId: this.routeInfo.id,
recordType: 1,
customerName: '',
mobile: '',
shareName: ''
}
this.handleSearch()
},
setTableFinishFun(){
this.total = this.$refs.tableRef.total
},
handleExport() {
const parmas = { ...this.searchFormObj }
this.$apis.strategy.exportListApi(parmas).then(({ code, data, message }) => {
if (code == '0') {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', data)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
} else {
this.$message.error(message)
}
})
},
handleSearch(){
this.$refs.tableRef.refreshTable()
},
beforeSearchFn(){
return new Promise((resolve, reject)=>{
this.searchForm = utils.deepClone(this.searchFormObj)
const { categoryCode } = this.searchForm
this.searchForm.categoryCode = categoryCode && categoryCode.length ? categoryCode.pop() : ''
resolve()
})
},
goDetaillPage(item){
this.$router.push({ path: `/goodsWarehouse/detail/${item.id}`})
}
}
}
</script>
<style scoped lang="scss">
.big-title{
height: 52px;
background: #FFFFFF;
margin-bottom: 16px;
padding: 0 20px;
line-height: 52px;
font-weight: 600;
font-size: 14px;
color: #333333;
font-family: PingFangSC-Medium;
}
.ctnr{
background-color: #fff;
padding: 20px;
.goodsNameSlot{
img{
width: 36px;
height: 36px;
vertical-align: middle;
margin-right: 8px;
}
}
.setPriceSlot{
.unedited{
display: flex;
align-items: center;
}
img{
width: 16px;
height: 16px;
vertical-align: middle;
margin-left: 8px;
cursor: pointer;
}
}
}
</style>