Commit 02d1d73f by 姜鹏凯

红包发放记录导出方式更改

1 parent 1105df04
...@@ -17,7 +17,7 @@ const service = window.lwConfig.services.system + window.lwConfig.services.wecom ...@@ -17,7 +17,7 @@ const service = window.lwConfig.services.system + window.lwConfig.services.wecom
export function getList(params) { export function getList(params) {
return request({ return request({
url: service + '/findRedEnveForUser', url: service + '/findRedEnveForUser',
params, params
}) })
} }
...@@ -35,6 +35,7 @@ export function exportCustomer(params) { ...@@ -35,6 +35,7 @@ export function exportCustomer(params) {
return request({ return request({
url: service + '/exportRedEnveForUser', url: service + '/exportRedEnveForUser',
params, params,
responseType: 'blob'
}) })
} }
...@@ -54,7 +55,7 @@ export function exportCustomer(params) { ...@@ -54,7 +55,7 @@ export function exportCustomer(params) {
export function getListGroup(params) { export function getListGroup(params) {
return request({ return request({
url: service + '/findRedEnveForGroup', url: service + '/findRedEnveForGroup',
params, params
}) })
} }
...@@ -71,7 +72,7 @@ export function getListGroup(params) { ...@@ -71,7 +72,7 @@ export function getListGroup(params) {
export function getListGroupUser(params) { export function getListGroupUser(params) {
return request({ return request({
url: service + '/findRedEnveForGroupUser', url: service + '/findRedEnveForGroupUser',
params, params
}) })
} }
...@@ -89,5 +90,6 @@ export function exportGroup(params) { ...@@ -89,5 +90,6 @@ export function exportGroup(params) {
return request({ return request({
url: service + '/exportRedEnveForGroup', url: service + '/exportRedEnveForGroup',
params, params,
responseType: 'blob'
}) })
} }
<script> <script>
import { getList, exportCustomer } from '@/api/redPacketTool/sendRecord' import { getList, exportCustomer } from '@/api/redPacketTool/sendRecord'
export default { export default {
data() { data() {
return { return {
query: { query: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userId: '', // 员工id userId: '', // 员工id
customerName: '', // 客户姓名 customerName: '', // 客户姓名
sendState: '', // 发送状态:1:待领取;2:已领取;3:发放失败;4:退款中;5:已退款 sendState: '', // 发送状态:1:待领取;2:已领取;3:发放失败;4:退款中;5:已退款
beginTime: '', // 创建开始时间 beginTime: '', // 创建开始时间
endTime: '', // 创建结束时间 endTime: '' // 创建结束时间
}, },
dateRange: [], // 添加日期 dateRange: [], // 添加日期
total: 0, // total: 0, //
list: [], // list: [], //
multiSelect: [], // 多选数据 multiSelect: [], // 多选数据
loading: false, loading: false,
queryUser: [], // 搜索框选择的添加人 queryUser: [], // 搜索框选择的添加人
dialogVisibleSelectUser: false, // 选择添加人弹窗显隐 dialogVisibleSelectUser: false, // 选择添加人弹窗显隐
dictStatusType: Object.freeze({ dictStatusType: Object.freeze({
0: '全部类型', 0: '全部类型',
1: '待领取', 1: '待领取',
2: '已领取', 2: '已领取',
3: '发放失败', 3: '发放失败',
5: '已退款', 5: '已退款'
}),
}
},
watch: {},
created() {
this.getList()
},
methods: {
getList(page) {
if (this.dateRange) {
;[this.query.beginTime, this.query.endTime] = this.dateRange
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
}) })
}
}, },
// 重置查询参数 watch: {},
resetQuery() { created() {
this.dateRange = [] this.getList()
this.queryUser = []
this.$refs['queryForm'].resetFields()
this.getList(1)
}, },
exportData() { methods: {
this.$confirm('确认导出吗?', '提示', { getList(page) {
confirmButtonText: '确定', if (this.dateRange) {
cancelButtonText: '取消', ;[this.query.beginTime, this.query.endTime] = this.dateRange
type: 'warning', } else {
}) this.query.beginTime = ''
.then(() => { this.query.endTime = ''
this.loading = true }
return exportCustomer(this.query) page && (this.query.pageNum = page)
}) this.loading = true
.then((res) => {
this.download(res.msg) getList(this.query)
}) .then(({ rows, total }) => {
.catch((error) => { this.list = rows
console.error(error) this.total = +total
}) this.loading = false
.finally(() => { })
this.loading = false .catch(() => {
this.loading = false
})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.queryUser = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
exportData() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
}, .then(() => {
// 处理多选 this.loading = true
handleSelectionChange(val) { return exportCustomer(this.query)
this.multiSelect = val })
}, .then((res) => {
// 获取显示用实际群聊 if (res != null) {
getDisplayGroups(row) { let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
if (row.groupList) { let url = window.URL.createObjectURL(blob)
const groups = row.groupList.map((g) => g.groupName) const link = document.createElement('a') // 创建a标签
return groups.join(',') link.href = url
link.download = '发放客户.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.loading = false
})
},
// 处理多选
handleSelectionChange(val) {
this.multiSelect = val
},
// 获取显示用实际群聊
getDisplayGroups(row) {
if (row.groupList) {
const groups = row.groupList.map((g) => g.groupName)
return groups.join(',')
}
} }
}, }
}, }
}
</script> </script>
<template> <template>
...@@ -120,7 +128,8 @@ export default { ...@@ -120,7 +128,8 @@ export default {
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
align="right"></el-date-picker> align="right"
></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="全部类型" prop="sendState"> <el-form-item label="全部类型" prop="sendState">
<el-select clearable v-model="query.sendState" placeholder="请选择"> <el-select clearable v-model="query.sendState" placeholder="请选择">
...@@ -135,7 +144,7 @@ export default { ...@@ -135,7 +144,7 @@ export default {
<el-button @click="resetQuery()">重置</el-button> <el-button @click="resetQuery()">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right;">
<!-- v-hasPermi="['customerManage:customer:query']" --> <!-- v-hasPermi="['customerManage:customer:query']" -->
<el-button type="primary" @click="exportData()">导出Excel</el-button> <el-button type="primary" @click="exportData()">导出Excel</el-button>
</el-form-item> </el-form-item>
...@@ -148,11 +157,12 @@ export default { ...@@ -148,11 +157,12 @@ export default {
label="发放员工" label="发放员工"
align="center" align="center"
prop="userName" prop="userName"
:show-overflow-tooltip="true"></el-table-column> :show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="领取客户" align="center" width="150"> <el-table-column label="领取客户" align="center" width="150">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="cp flex aic" @click="goRoute(row)"> <div class="cp flex aic" @click="goRoute(row)">
<el-image style="width: 50px; height: 50px; flex: none" :src="row.avatar" fit="fit"></el-image> <el-image style="width: 50px; height: 50px; flex: none;" :src="row.avatar" fit="fit"></el-image>
<div class="ml10"> <div class="ml10">
<p>{{ row.customerName }}</p> <p>{{ row.customerName }}</p>
<i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[row.gender]]"></i> <i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[row.gender]]"></i>
...@@ -179,7 +189,8 @@ export default { ...@@ -179,7 +189,8 @@ export default {
:total="total" :total="total"
:page.sync="query.pageNum" :page.sync="query.pageNum"
:limit.sync="query.pageSize" :limit.sync="query.pageSize"
@pagination="getList()" /> @pagination="getList()"
/>
</div> </div>
<!-- 选择使用员工弹窗 --> <!-- 选择使用员工弹窗 -->
...@@ -192,18 +203,19 @@ export default { ...@@ -192,18 +203,19 @@ export default {
queryUser = list queryUser = list
query.userId = list.map((i) => i.userId).join() query.userId = list.map((i) => i.userId).join()
} }
"></SelectUser> "
></SelectUser>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.overflow-ellipsis { .overflow-ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.table-desc { .table-desc {
max-width: 120px; max-width: 120px;
} }
</style> </style>
<script> <script>
import { getListGroup, getListGroupUser, exportGroup } from '@/api/redPacketTool/sendRecord' import { getListGroup, getListGroupUser, exportGroup } from '@/api/redPacketTool/sendRecord'
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
query: {
pageNum: 1,
pageSize: 10,
userId: '', // 员工id
groupName: '', // 客户群名
redEnvelopeType: '', // 1: 普通红包2:拼手气红包
beginTime: '', // 创建开始时间
endTime: '', // 创建结束时间
},
dateRange: [], // 添加日期
total: 0, //
list: [], //
multiSelect: [], // 多选数据
loading: false,
dictStatusType: Object.freeze({
0: '全部类型',
1: '普通红包',
2: '拼手气红包',
}),
dialogVisible: false,
cardData: [],
dialog: {
query: { query: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
chatId: '', // 群id userId: '', // 员工id
groupName: '', // 客户群名
redEnvelopeType: '', // 1: 普通红包2:拼手气红包
beginTime: '', // 创建开始时间
endTime: '' // 创建结束时间
}, },
loading: false, dateRange: [], // 添加日期
total: 0, // total: 0, //
list: [], // list: [], //
}, multiSelect: [], // 多选数据
loading: false,
dictStatusType: Object.freeze({
0: '全部类型',
1: '普通红包',
2: '拼手气红包'
}),
dialogVisibleSelectUser: false, // 选择添加人弹窗显隐 dialogVisible: false,
queryUser: [], // 搜索框选择的添加人 cardData: [],
} dialog: {
}, query: {
watch: {}, pageNum: 1,
created() { pageSize: 10,
this.getList() chatId: '' // 群id
}, },
methods: { loading: false,
getList(page) { total: 0, //
if (this.dateRange) { list: [] //
;[this.query.beginTime, this.query.endTime] = this.dateRange },
} else {
this.query.beginTime = '' dialogVisibleSelectUser: false, // 选择添加人弹窗显隐
this.query.endTime = '' queryUser: [] // 搜索框选择的添加人
} }
page && (this.query.pageNum = page)
this.loading = true
getListGroup(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.queryUser = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
exportData() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.loading = true
return exportGroup(this.query)
})
.then((res) => {
this.download(res.msg)
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.loading = false
})
},
// 处理多选
handleSelectionChange(val) {
this.multiSelect = val
}, },
view(row) { watch: {},
let cardData = [ created() {
{ this.getList()
title: '群主',
value: row.groupLeaderName,
noArrow: true,
},
{
title: '领取人数',
value: row.receiveNum,
noArrow: true,
},
{
title: '剩余红包个数',
value: row.surplusNum,
noArrow: true,
},
]
this.cardData = cardData
this.dialogVisible = true
this.dialog.query.chatId = row.chatId
this.dialog.query.orderNo = row.orderNo
this.getListGroupUser(1)
}, },
// 获取领取详情 methods: {
getListGroupUser(page) { getList(page) {
page && (this.dialog.query.pageNum = page) if (this.dateRange) {
this.dialog.loading = true ;[this.query.beginTime, this.query.endTime] = this.dateRange
getListGroupUser(this.dialog.query) } else {
.then(({ rows, total }) => { this.query.beginTime = ''
this.dialog.list = rows this.query.endTime = ''
this.dialog.total = +total }
this.dialog.loading = false page && (this.query.pageNum = page)
}) this.loading = true
.catch(() => { getListGroup(this.query)
this.dialog.loading = false .then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.queryUser = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
exportData() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
}, .then(() => {
}, this.loading = true
} return exportGroup(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 = '发放客群.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.loading = false
})
},
// 处理多选
handleSelectionChange(val) {
this.multiSelect = val
},
view(row) {
let cardData = [
{
title: '群主',
value: row.groupLeaderName,
noArrow: true
},
{
title: '领取人数',
value: row.receiveNum,
noArrow: true
},
{
title: '剩余红包个数',
value: row.surplusNum,
noArrow: true
}
]
this.cardData = cardData
this.dialogVisible = true
this.dialog.query.chatId = row.chatId
this.dialog.query.orderNo = row.orderNo
this.getListGroupUser(1)
},
// 获取领取详情
getListGroupUser(page) {
page && (this.dialog.query.pageNum = page)
this.dialog.loading = true
getListGroupUser(this.dialog.query)
.then(({ rows, total }) => {
this.dialog.list = rows
this.dialog.total = +total
this.dialog.loading = false
})
.catch(() => {
this.dialog.loading = false
})
}
}
}
</script> </script>
<template> <template>
...@@ -168,7 +176,8 @@ export default { ...@@ -168,7 +176,8 @@ export default {
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
align="right"></el-date-picker> align="right"
></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<!-- v-hasPermi="['customerManage:customer:query']" --> <!-- v-hasPermi="['customerManage:customer:query']" -->
...@@ -179,7 +188,7 @@ export default { ...@@ -179,7 +188,7 @@ export default {
<el-button @click="resetQuery()">重置</el-button> <el-button @click="resetQuery()">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right;">
<el-button type="primary" @click="exportData()">导出Excel</el-button> <el-button type="primary" @click="exportData()">导出Excel</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -202,7 +211,8 @@ export default { ...@@ -202,7 +211,8 @@ export default {
label="发放员工" label="发放员工"
align="center" align="center"
prop="userName" prop="userName"
:show-overflow-tooltip="true"></el-table-column> :show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="领取客户群" align="center" prop="groupName" width="120"></el-table-column> <el-table-column label="领取客户群" align="center" prop="groupName" width="120"></el-table-column>
<el-table-column label="红包类型" align="center" prop="redEnvelopeType"> <el-table-column label="红包类型" align="center" prop="redEnvelopeType">
...@@ -229,7 +239,8 @@ export default { ...@@ -229,7 +239,8 @@ export default {
:total="total" :total="total"
:page.sync="query.pageNum" :page.sync="query.pageNum"
:limit.sync="query.pageSize" :limit.sync="query.pageSize"
@pagination="getList()" /> @pagination="getList()"
/>
</div> </div>
<!-- 选择使用员工弹窗 --> <!-- 选择使用员工弹窗 -->
...@@ -242,7 +253,8 @@ export default { ...@@ -242,7 +253,8 @@ export default {
queryUser = list queryUser = list
query.userId = list.map((i) => i.userId).join() query.userId = list.map((i) => i.userId).join()
} }
"></SelectUser> "
></SelectUser>
<el-dialog title="领取详情" :visible.sync="dialogVisible" width="width"> <el-dialog title="领取详情" :visible.sync="dialogVisible" width="width">
<div> <div>
...@@ -259,7 +271,8 @@ export default { ...@@ -259,7 +271,8 @@ export default {
:total="dialog.total" :total="dialog.total"
:page.sync="dialog.query.pageNum" :page.sync="dialog.query.pageNum"
:limit.sync="dialog.query.pageSize" :limit.sync="dialog.query.pageSize"
@pagination="getListGroupUser()" /> @pagination="getListGroupUser()"
/>
</div> </div>
<div slot="footer"> <div slot="footer">
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
...@@ -269,13 +282,13 @@ export default { ...@@ -269,13 +282,13 @@ export default {
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.overflow-ellipsis { .overflow-ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.table-desc { .table-desc {
max-width: 120px; max-width: 120px;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!