修改套餐状态

This commit is contained in:
wuweihua
2026-09-20 10:29:10 +08:00
parent 24435e4113
commit cc5f1cf5de
15 changed files with 96 additions and 61 deletions
+23 -16
View File
@@ -25,10 +25,6 @@
</el-tag>
</template>
<template #col-dateRange="{ row }">
{{ formatDate(row.effectiveDate) }} ~ {{ row.expireDate ? formatDate(row.expireDate) : '长期' }}
</template>
<template #col-status="{ row }">
<el-tag :type="statusTag(row)" size="small">{{ statusLabel(row) }}</el-tag>
</template>
@@ -46,11 +42,19 @@
<template #col-action="{ row }">
<el-button link type="primary" @click="handleDetail(row)" v-hasPermi="['price:set:query']">详情</el-button>
<el-button
v-if="row.status === 'E'"
link
type="warning"
@click="handleDisable(row)"
v-hasPermi="['price:set:audit']"
>停用</el-button>
<el-button
v-if="row.status === 'D' || row.status === 'S'"
link
type="success"
@click="handleEnable(row)"
v-hasPermi="['price:set:audit']"
>启用</el-button>
</template>
</basic-table>
@@ -65,10 +69,10 @@
<script setup name="PriceSet">
import {
listPriceSet, disablePriceSet, copyPriceSet, getPriceSet
listPriceSet, disablePriceSet, enablePriceSet, copyPriceSet, getPriceSet
} from '@/api/price/set'
import { parseTime } from '@/utils/ruoyi'
import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.vue'
import { setStatusLabel, setStatusTagType } from './utils/priceSet'
const { proxy } = getCurrentInstance()
const tableRef = ref()
@@ -91,6 +95,7 @@ const searchColumns = [
prop: 'status',
component: 'select',
options: [
{ label: '待启用', value: 'D' },
{ label: '生效', value: 'E' },
{ label: '已停用', value: 'S' }
],
@@ -105,6 +110,7 @@ const columns = [
{ label: '套餐名称', prop: 'priceSetName', minWidth: 160 },
{ label: '类型', prop: 'setType', width: 140 },
{ label: '说明', prop: 'priceSetNote', minWidth: 160 },
{ label: '状态', prop: 'status', width: 90 },
{ label: '生效明细', prop: 'activeDetail', width: 100 },
{ label: '操作', prop: 'action', width: 160, showInToolbar: false }
]
@@ -113,20 +119,12 @@ function queryList(params) {
return listPriceSet(params)
}
function formatDate(val) {
return val ? parseTime(val, '{y}-{m}-{d}') : ''
}
function statusLabel(row) {
if (row.expired) return '已过期'
const map = { D: '草稿', A: '审核中', E: '生效', R: '驳回', S: '已停用' }
return map[row.status] || row.status
return setStatusLabel(row)
}
function statusTag(row) {
if (row.expired) return 'danger'
const map = { D: 'warning', A: 'primary', E: 'success', R: 'danger', S: 'info' }
return map[row.status] || 'info'
return setStatusTagType(row)
}
function handleCreate() {
@@ -184,6 +182,15 @@ function handleDisable(row) {
}).catch(() => {})
}
function handleEnable(row) {
proxy.$modal.confirm('启用后该套餐将重新参与计费命中,确认启用【' + row.priceSetName + '】?').then(() => {
return enablePriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('已启用')
tableRef.value.refresh()
}).catch(() => {})
}
function handleCopy(row) {
copyPriceSet(row.priceSetId).then(res => {
proxy.$modal.msgSuccess('已复制为草稿')