250825
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
ThinkCardLog,
|
||||
ThinkCardLogParam
|
||||
} from '@/api/think/thinkCardLog/model';
|
||||
import { listThinkCardLog } from '@/api/think/thinkCardLog';
|
||||
import { listThinkCardLog, thinkCardLogExport } from "@/api/think/thinkCardLog";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -106,74 +106,8 @@
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
loading.value = true;
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'卡号',
|
||||
'姓名',
|
||||
'手机号',
|
||||
'会员卡名称',
|
||||
'支付方式',
|
||||
'充值金额',
|
||||
'充值次数',
|
||||
'操作员',
|
||||
'第三方订单号',
|
||||
'充值时间'
|
||||
]
|
||||
];
|
||||
if (!where.timeStart) {
|
||||
message.error('请选择导出的开始日期、结束日期,每次最多导出5000条记录');
|
||||
return false;
|
||||
}
|
||||
await listThinkCardLog(where)
|
||||
.then((list) => {
|
||||
orders.value = list;
|
||||
orders.value?.forEach((d: ThinkCardLog) => {
|
||||
array.push([
|
||||
`${d.code}`,
|
||||
`${d.username}`,
|
||||
`${d.phone}`,
|
||||
`${d.cardName}`,
|
||||
`${payType.value[Number(d.payType)]}`,
|
||||
`${d.money}`,
|
||||
`${d.count}`,
|
||||
`${d.adminName || d.aid}`,
|
||||
`${d.wechatOrder}`,
|
||||
`${toDateString(d.createTime)}`
|
||||
]);
|
||||
});
|
||||
const sheetName = `充值记录导出`;
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
Sheets: {}
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 10 },
|
||||
{ wch: 20 },
|
||||
{ wch: 40 },
|
||||
{ wch: 10 }
|
||||
];
|
||||
message.loading('正在导出...');
|
||||
setTimeout(() => {
|
||||
writeFile(
|
||||
workbook,
|
||||
`${
|
||||
where.createTimeEnd ? xlsFileName.value + '_' : ''
|
||||
}${sheetName}.xlsx`
|
||||
);
|
||||
loading.value = false;
|
||||
}, 2000);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
loading.value = false;
|
||||
})
|
||||
.finally(() => {});
|
||||
const res = await thinkCardLogExport(where)
|
||||
window.open(res.data.url);
|
||||
};
|
||||
|
||||
watch(
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
<a-tag v-if="record.payType === 2">支付宝支付</a-tag>
|
||||
<a-tag v-if="record.payType === 3">现金支付</a-tag>
|
||||
<a-tag v-if="record.payType === 4">POS支付</a-tag>
|
||||
<a-tag v-if="record.payType === 5">平安健康卡</a-tag>
|
||||
<a-tag v-if="record.payType === 6">对公支付</a-tag>
|
||||
<a-tag v-if="record.payType === 8">抖音支付</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'money'">
|
||||
¥{{ formatNumber(record.money) }}
|
||||
|
||||
Reference in New Issue
Block a user