|
|
|
@ -251,6 +251,7 @@ import DialogBatchAudit from './DialogBatchAudit.vue' |
|
|
|
import { removeNullField } from '@/utils' |
|
|
|
import { removeNullField } from '@/utils' |
|
|
|
import { dateFormatter } from '@/utils/formatTime' |
|
|
|
import { dateFormatter } from '@/utils/formatTime' |
|
|
|
import { useAppStore } from '@/store/modules/app' |
|
|
|
import { useAppStore } from '@/store/modules/app' |
|
|
|
|
|
|
|
import { exportArrayToExcel } from '@/utils/index' |
|
|
|
|
|
|
|
|
|
|
|
const afterSaleAuditDialog = ref() |
|
|
|
const afterSaleAuditDialog = ref() |
|
|
|
|
|
|
|
|
|
|
|
@ -366,8 +367,37 @@ async function afterSalesUpload(data) { |
|
|
|
const fd = new FormData() |
|
|
|
const fd = new FormData() |
|
|
|
fd.append('file', data.file) |
|
|
|
fd.append('file', data.file) |
|
|
|
try { |
|
|
|
try { |
|
|
|
await AfterSaleApi.importAfterSales(fd) |
|
|
|
const resp = await AfterSaleApi.importAfterSales(fd) |
|
|
|
message.success('导入成功') |
|
|
|
debugger |
|
|
|
|
|
|
|
if (resp && resp.data && resp.data.length) { |
|
|
|
|
|
|
|
const succList = resp.data.filter((item) => item.success) |
|
|
|
|
|
|
|
const failList = resp.data.filter((item) => !item.success) |
|
|
|
|
|
|
|
let msg = `导入完成!成功 ${succList.length} 条,失败 ${failList.length} 条。` |
|
|
|
|
|
|
|
if (failList.length) { |
|
|
|
|
|
|
|
// 如果有失败,提示下载失败文件 |
|
|
|
|
|
|
|
msg += '\n请点击消息下载失败明细进行查看。' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ElNotification({ |
|
|
|
|
|
|
|
title: '导入结果', |
|
|
|
|
|
|
|
message: msg, |
|
|
|
|
|
|
|
type: 'info', |
|
|
|
|
|
|
|
duration: 0, |
|
|
|
|
|
|
|
onClick: () => { |
|
|
|
|
|
|
|
if (failList.length) { |
|
|
|
|
|
|
|
// 将failList生成文件,使用前端下载 |
|
|
|
|
|
|
|
exportArrayToExcel(failList, `售后导入失败明细${new Date().getTime()}`, [ |
|
|
|
|
|
|
|
{ title: '手机号', key: 'phone' }, |
|
|
|
|
|
|
|
{ title: '售后原因', key: 'reason' }, |
|
|
|
|
|
|
|
{ title: '退款金额', key: 'refundAmount' }, |
|
|
|
|
|
|
|
{ title: '提成扣款', key: 'percentageDeductAmount' }, |
|
|
|
|
|
|
|
{ title: '解决方案', key: 'solution' }, |
|
|
|
|
|
|
|
{ title: '备注', key: 'remark' }, |
|
|
|
|
|
|
|
{ title: '失败原因', key: 'message' } |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
uploading.value = false |
|
|
|
uploading.value = false |
|
|
|
getList() |
|
|
|
getList() |
|
|
|
|