优化
This commit is contained in:
@@ -39,3 +39,8 @@ export const generateRedeemCodes = async (data) => {
|
||||
export const exportRedeemCode = async (params) => {
|
||||
return await request.download({ url: `/admin-api/muye/redeem-code/export-excel`, params })
|
||||
}
|
||||
|
||||
// 导出兑换码纯文本(按批次号)
|
||||
export const exportRedeemCodePlain = async (batchNo: string) => {
|
||||
return await request.download({ url: `/admin-api/muye/redeem-code/export-plain`, params: { batchNo } })
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ const download = {
|
||||
json: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'application/json')
|
||||
},
|
||||
// 下载纯文本方法
|
||||
txt: (data: Blob, fileName: string) => {
|
||||
download0(data, fileName, 'text/plain')
|
||||
},
|
||||
// 下载图片(允许跨域)
|
||||
image: ({
|
||||
url,
|
||||
|
||||
@@ -67,11 +67,16 @@
|
||||
|
||||
<el-form-item label="来源" prop="source">
|
||||
<el-select v-model="formData.source" placeholder="请选择来源" class="!w-full">
|
||||
<el-option label="淘宝" value="taobao" />
|
||||
<el-option label="闲鱼" value="xianyu" />
|
||||
<el-option label="后台生成" value="admin" />
|
||||
<el-option label="活动发放" value="activity" />
|
||||
<el-option label="支付发放" value="payment" />
|
||||
<el-option label="其他" value="other" />
|
||||
</el-select>
|
||||
<div class="text-gray-400 text-12px mt-5px">
|
||||
用于区分不同销售渠道
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
||||
@@ -68,7 +68,16 @@
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['muye:redeem-code:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出Excel
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="handleExportPlain"
|
||||
:disabled="!queryParams.batchNo"
|
||||
v-hasPermi="['muye:redeem-code:export']"
|
||||
>
|
||||
<Icon icon="ep:document" class="mr-5px" /> 导出纯文本
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@@ -246,6 +255,19 @@ const handleExport = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 导出纯文本按钮操作 */
|
||||
const handleExportPlain = async () => {
|
||||
if (!queryParams.batchNo) {
|
||||
message.warning('请先输入批次号')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.confirm('确定导出该批次未使用的兑换码吗?')
|
||||
const data = await RedeemCodeApi.exportRedeemCodePlain(queryParams.batchNo)
|
||||
download.txt(data, `codes_${queryParams.batchNo}.txt`)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
||||
Reference in New Issue
Block a user