detail-table.vue
5.01 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
<template>
<div>
<el-form ref="queryForm" :model="query" inline class="top-search" label-position="left" label-width="">
<el-form-item label="" prop="customerName">
<el-input clearable v-model="query.customerName" placeholder="请输入老客名称"></el-input>
</el-form-item>
<el-form-item label="">
<el-input :value="qrUserName" readonly @focus="dialogVisible = true" placeholder="请选择发送员工" />
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="mid-action">
<div></div>
<div>
<el-button type="primary" v-loading="exportLoading" @click="exportFn">
导出Excel
</el-button>
</div>
</div>
<el-table :data="list" v-loading="loading">
<el-table-column prop="oldCustomerName" label="老客" align="center"></el-table-column>
<el-table-column prop="sendWeUserName" label="发送员工" align="center"></el-table-column>
<el-table-column prop="inviterState" label="裂变状态" align="center">
<template slot-scope="{ row }">
{{ row.inviterState == 1 ? '已完成' : row.inviterState == 2 ? '未完成' : '' }}
</template>
</el-table-column>
<el-table-column prop="inviterNumber" label="裂变新客数" align="center">
<template slot-scope="{ row }">
<a class="self_a" @click="getDetailTable(row.fissionInviterRecordId)">{{ row.inviterNumber }}</a>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList"
/>
</div>
<SelectWeUser
:visible.sync="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"
></SelectWeUser>
<SubDetailVue :visible.sync="detailVisible" :fissionInviterRecordId="detailId"></SubDetailVue>
</div>
</template>
<script>
import { getFissionCustomerTable, exportCustomerTable } from './api'
import SubDetailVue from '../common/SubDetail.vue'
import { dateFormat } from '@/utils/index'
export default {
name: 'task-customer-detail-table',
components: {
SubDetailVue
},
data() {
return {
loading: false,
list: [],
total: 0,
qrUserName: '',
query: {
customerName: '',
pageNum: 1,
pageSize: 10,
weUserId: ''
},
dialogVisible: false,
userArray: [], // 选择人员
userArrayStr: '',
detailVisible: false,
detailId: '',
exportLoading: false
}
},
methods: {
exportFn() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return exportCustomerTable(this.query)
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '裂变明细' + dateFormat(new Date()) + '.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
},
getDetailTable(id) {
this.detailId = id
this.detailVisible = true
},
getList() {
this.loading = true
this.query.fissionId = this.$route.query.id
getFissionCustomerTable(this.query).then((res) => {
this.loading = false
this.list = res.rows
this.total = Number(res.total)
})
},
search() {
this.query.pageNum = 1
this.getList()
},
resetQuery() {
this.query.weUserId = ''
this.query.customerName = ''
this.userArray = []
this.qrUserName = ''
this.search()
},
getSelectUser(data) {
this.userArray = data
this.qrUserName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.weUserId = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
}
},
created() {
this.search()
}
}
</script>
<style lang="scss" scoped>
.self_a {
color: #07c160;
text-decoration: underline;
&:hover {
opacity: 0.8;
}
}
</style>