This commit is contained in:
2025-11-03 20:02:57 +08:00
parent a68eba7b5f
commit 1cbab3f248

View File

@@ -54,11 +54,23 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="批量创建数量" prop="batchSize">
<el-input-number v-model="form.batchSize" :min="1" :max="100" style="width: 100%" />
<div style="color: #909399; font-size: 12px; margin-top: 5px;">默认20张</div>
</el-form-item>
<el-col :span="24">
<el-alert
type="info"
:closable="false"
style="margin-bottom: 10px;"
>
<template slot="title">
<span style="font-weight: bold;">批量创建说明</span>
系统会自动解析文本中的京东商品URL根据解析出的URL数量自动批量创建对应数量的礼金券并替换URL
<span v-if="detectedUrls.length > 0" style="color: #409EFF; font-weight: bold;">
当前文本中已识别到 <strong style="font-size: 16px;">{{ detectedUrls.length }}</strong> 个URL将创建 <strong style="font-size: 16px;">{{ detectedUrls.length }}</strong> 张礼金券
</span>
<span v-else style="color: #909399;">
请在下方文本框中输入包含京东商品链接的文本内容
</span>
</template>
</el-alert>
</el-col>
</el-row>
</el-form>
@@ -192,16 +204,14 @@ export default {
materialUrl: '',
skuName: '',
owner: 'g',
amount: 1.0, // 默认1元
quantity: 1, // 默认每个礼金数量为1
batchSize: 20, // 默认批量创建20张
amount: 1.8, // 默认1元
quantity: 12, // 默认每个礼金数量为1
queryResult: null // 保存查询到的商品信息
},
rules: {
materialUrl: [{ required: true, message: '请输入商品链接或SKU', trigger: 'blur' }],
amount: [{ required: true, message: '请输入礼金金额', trigger: 'blur' }],
quantity: [{ required: true, message: '请输入礼金数量', trigger: 'blur' }],
batchSize: [{ required: true, message: '请输入批量创建数量', trigger: 'blur' }]
quantity: [{ required: true, message: '请输入礼金数量', trigger: 'blur' }]
},
queryLoading: false,
processing: false,
@@ -313,7 +323,7 @@ export default {
}
if (this.detectedUrls.length === 0) {
this.$modal.msgWarning('文本中未找到URL无需替换')
this.$modal.msgWarning('文本中未找到URL无需替换。请在文本框中输入包含京东商品链接的内容。')
return
}
@@ -325,10 +335,10 @@ export default {
// 确认操作
try {
await this.$confirm(
`检测到 ${this.detectedUrls.length} 个URL将批量创建 ${this.detectedUrls.length}${this.form.amount} 元礼金券并替换URL。是否继续?`,
'确认操作',
`检测到 ${this.detectedUrls.length}商品URL将批量创建 ${this.detectedUrls.length}${this.form.amount} 元礼金券并自动替换文本中的URL为包含礼金的推广链接。是否继续?`,
'确认批量创建',
{
confirmButtonText: '确定',
confirmButtonText: '确定创建',
cancelButtonText: '取消',
type: 'warning'
}
@@ -346,11 +356,12 @@ export default {
try {
// 构建请求参数
// 注意batchSize 会自动根据文本中解析出的URL数量设置
const params = {
content: this.content,
amount: this.form.amount,
quantity: this.form.quantity,
batchSize: this.detectedUrls.length, // 根据检测到的URL数量自动设置
// batchSize 会在后端根据content中解析出的URL数量自动计算这里不需要传
owner: this.form.owner || 'g',
skuName: this.form.skuName || ''
}