This commit is contained in:
@@ -155,9 +155,7 @@
|
||||
<div class="task-list-toolbar">
|
||||
<ElButton
|
||||
v-if="hasAuth(BULK_PURCHASE_PERMISSIONS.template)"
|
||||
tag="a"
|
||||
href="/templates/bulk-purchase-template.csv"
|
||||
download="批量订购套餐模板.csv"
|
||||
@click="downloadTemplate"
|
||||
>
|
||||
下载模板
|
||||
</ElButton>
|
||||
@@ -306,6 +304,21 @@
|
||||
() => submitting.value || voucherUploading.value || orderFileUploading.value
|
||||
)
|
||||
|
||||
const downloadTemplate = () => {
|
||||
try {
|
||||
const link = document.createElement('a')
|
||||
link.href = new URL('@/template/批量订购套餐模板.csv', import.meta.url).href
|
||||
link.download = '批量订购套餐模板.csv'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
ElMessage.success('模板下载成功')
|
||||
} catch (error) {
|
||||
console.error('下载模板失败:', error)
|
||||
ElMessage.error('模板下载失败')
|
||||
}
|
||||
}
|
||||
|
||||
const form = reactive<{
|
||||
series_id?: number
|
||||
package_id?: number
|
||||
@@ -526,6 +539,7 @@
|
||||
) => {
|
||||
stopTaskStatusPolling()
|
||||
const session = taskStatusPollSession
|
||||
let lastStatus = initialStatus
|
||||
|
||||
const poll = async () => {
|
||||
if (session !== taskStatusPollSession) return
|
||||
@@ -537,10 +551,22 @@
|
||||
})
|
||||
if (response.code === 0) {
|
||||
const task = response.data.items.find((item) => (item.task_id ?? item.id) === taskId)
|
||||
if (task && task.status !== initialStatus) {
|
||||
await loadTaskList()
|
||||
stopTaskStatusPolling()
|
||||
return
|
||||
if (task) {
|
||||
if (task.status !== lastStatus) {
|
||||
lastStatus = task.status
|
||||
await loadTaskList()
|
||||
}
|
||||
if (
|
||||
session === taskStatusPollSession &&
|
||||
[
|
||||
BulkPurchaseTaskStatus.COMPLETED,
|
||||
BulkPurchaseTaskStatus.FAILED,
|
||||
BulkPurchaseTaskStatus.CANCELED
|
||||
].includes(task.status)
|
||||
) {
|
||||
stopTaskStatusPolling()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -391,8 +391,8 @@
|
||||
const downloadTemplate = () => {
|
||||
try {
|
||||
const link = document.createElement('a')
|
||||
link.href = new URL('@/template/批量订购套餐模板.csv', import.meta.url).href
|
||||
link.download = '批量订购套餐模板.csv'
|
||||
link.href = new URL('@/template/设备批量任务.csv', import.meta.url).href
|
||||
link.download = '设备批量任务.csv'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
@@ -450,6 +450,7 @@
|
||||
) => {
|
||||
stopTaskStatusPolling()
|
||||
const session = taskStatusPollSession
|
||||
let lastStatus = initialStatus
|
||||
|
||||
const poll = async () => {
|
||||
if (session !== taskStatusPollSession) return
|
||||
@@ -461,10 +462,20 @@
|
||||
})
|
||||
if (response.code === 0) {
|
||||
const task = response.data.items.find((item) => item.id === taskId)
|
||||
if (task && task.status !== initialStatus) {
|
||||
await loadTaskList()
|
||||
stopTaskStatusPolling()
|
||||
return
|
||||
if (task) {
|
||||
if (task.status !== lastStatus) {
|
||||
lastStatus = task.status
|
||||
await loadTaskList()
|
||||
}
|
||||
if (
|
||||
session === taskStatusPollSession &&
|
||||
[DeviceImportTaskStatus.COMPLETED, DeviceImportTaskStatus.FAILED].includes(
|
||||
task.status
|
||||
)
|
||||
) {
|
||||
stopTaskStatusPolling()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -338,13 +338,11 @@
|
||||
const isPlatformAccount = computed(() => [1, 2].includes(Number(userStore.info.user_type)))
|
||||
const canViewRecharge = computed(() => [1, 2, 3].includes(Number(userStore.info.user_type)))
|
||||
const canCreateRecharge = computed(() => isAgentAccount.value || isPlatformAccount.value)
|
||||
const createMode = ref<'online' | 'offline'>('offline')
|
||||
const createMode = ref<'online' | 'offline'>(isAgentAccount.value ? 'online' : 'offline')
|
||||
const createDialogTitle = computed(() =>
|
||||
createMode.value === 'online' ? '代理钱包在线扫码充值' : '创建平台线下代充'
|
||||
)
|
||||
const createButtonLabel = computed(() =>
|
||||
createMode.value === 'online' ? '立即充值' : '创建充值订单'
|
||||
)
|
||||
const createButtonLabel = computed(() => (isAgentAccount.value ? '立即充值' : '创建充值订单'))
|
||||
|
||||
const loading = ref(false)
|
||||
const createLoading = ref(false)
|
||||
|
||||
@@ -324,21 +324,6 @@
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
|
||||
<ElRow :gutter="20">
|
||||
<ElCol :span="24">
|
||||
<ElFormItem label="套餐描述" prop="description">
|
||||
<ElInput
|
||||
v-model="form.description"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入套餐描述(可选)"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
</ElForm>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@@ -737,8 +722,7 @@
|
||||
virtual_data_mb: 0,
|
||||
cost_price: 0,
|
||||
suggested_retail_price: undefined,
|
||||
is_gift: false,
|
||||
description: ''
|
||||
is_gift: false
|
||||
})
|
||||
|
||||
// GB 输入值(用于界面显示)
|
||||
@@ -1369,7 +1353,6 @@
|
||||
: undefined
|
||||
originalSuggestedRetailPrice.value = data.suggested_retail_price ?? null
|
||||
form.is_gift = data.is_gift || false
|
||||
form.description = data.description || ''
|
||||
|
||||
// 数据填充完成后再显示对话框
|
||||
dialogVisible.value = true
|
||||
@@ -1397,7 +1380,6 @@
|
||||
virtualRatioPercent.value = null
|
||||
form.cost_price = 0
|
||||
form.suggested_retail_price = undefined
|
||||
form.description = ''
|
||||
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@@ -1443,7 +1425,6 @@
|
||||
form.suggested_retail_price = undefined
|
||||
originalSuggestedRetailPrice.value = null
|
||||
form.is_gift = false
|
||||
form.description = ''
|
||||
}
|
||||
|
||||
// 删除套餐
|
||||
|
||||
@@ -1021,11 +1021,14 @@
|
||||
|
||||
// 添加强充配置:元 -> 分(仅累计充值时需要)
|
||||
if (form.one_time_commission_config.trigger_type === 'accumulated_recharge') {
|
||||
commissionConfig.enable_force_recharge = true
|
||||
commissionConfig.force_amount =
|
||||
form.one_time_commission_config.force_amount != null
|
||||
const enableForceRecharge =
|
||||
form.one_time_commission_config.enable_force_recharge === true
|
||||
commissionConfig.enable_force_recharge = enableForceRecharge
|
||||
commissionConfig.force_amount = enableForceRecharge
|
||||
? form.one_time_commission_config.force_amount != null
|
||||
? Math.round(form.one_time_commission_config.force_amount * 100)
|
||||
: undefined
|
||||
: 0
|
||||
commissionConfig.force_calc_type = form.one_time_commission_config.force_calc_type
|
||||
}
|
||||
|
||||
|
||||
@@ -484,14 +484,14 @@
|
||||
<ElFormItem label="启用强制充值">
|
||||
<ElSwitch
|
||||
v-model="form.enable_force_recharge"
|
||||
:disabled="form.force_recharge_locked && isAgentAccount"
|
||||
:disabled="isForceRechargeLockedForAgent"
|
||||
/>
|
||||
<ElTag v-if="form.force_recharge_locked" type="danger" size="small">
|
||||
平台已锁定
|
||||
</ElTag>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol
|
||||
:span="12"
|
||||
v-if="form.enable_force_recharge && !(form.force_recharge_locked && isAgentAccount)"
|
||||
>
|
||||
<ElCol :span="12" v-if="form.enable_force_recharge">
|
||||
<ElFormItem label="强充金额(元)" prop="force_recharge_amount">
|
||||
<ElInputNumber
|
||||
v-model="form.force_recharge_amount"
|
||||
@@ -499,6 +499,7 @@
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
:controls="false"
|
||||
:disabled="isForceRechargeLockedForAgent"
|
||||
style="width: 100%"
|
||||
placeholder="请输入强制充值金额(元)"
|
||||
/>
|
||||
@@ -516,6 +517,9 @@
|
||||
>¥{{ form.series_force_recharge_amount.toFixed(2) }}</span
|
||||
>
|
||||
</span>
|
||||
<span v-if="isForceRechargeLockedForAgent" class="force-recharge-lock-hint">
|
||||
<br />平台已锁定,代理不可修改强充配置
|
||||
</span>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
@@ -797,6 +801,10 @@
|
||||
}> // 套餐配置
|
||||
})
|
||||
|
||||
const isForceRechargeLockedForAgent = computed(
|
||||
() => form.force_recharge_locked === true && isAgentAccount.value
|
||||
)
|
||||
|
||||
// 动态验证规则
|
||||
const rules = computed<FormRules>(() => {
|
||||
const baseRules: FormRules = {
|
||||
@@ -1574,11 +1582,10 @@
|
||||
}
|
||||
|
||||
// 设置强制充值配置
|
||||
form.enable_force_recharge = detail.force_recharge_enabled
|
||||
form.force_recharge_amount = detail.force_recharge_amount
|
||||
? detail.force_recharge_amount / 100
|
||||
: undefined
|
||||
form.force_recharge_locked = detail.force_recharge_locked || false
|
||||
form.force_recharge_locked = detail.force_recharge_locked ?? false
|
||||
form.enable_force_recharge = detail.force_recharge_enabled ?? false
|
||||
form.force_recharge_amount =
|
||||
detail.force_recharge_amount != null ? detail.force_recharge_amount / 100 : undefined
|
||||
|
||||
// 设置套餐数据
|
||||
if (detail.packages && detail.packages.length > 0) {
|
||||
@@ -1910,6 +1917,10 @@
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.force-recharge-lock-hint {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
}
|
||||
|
||||
.form-section-title {
|
||||
|
||||
Reference in New Issue
Block a user