提交价格套餐功能
This commit is contained in:
@@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<basic-table
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:search-columns="searchColumns"
|
||||
:query="queryList"
|
||||
row-key="priceSetId"
|
||||
>
|
||||
<template #toolbar="{ selection, ids }">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleCreate"
|
||||
v-hasPermi="['price:set:add']"
|
||||
>新建套餐</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="!selection.length"
|
||||
@click="handleDelete(ids)"
|
||||
v-hasPermi="['price:set:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template #col-setType="{ row }">
|
||||
<el-tag :type="row.setType === 'FIXED' ? 'warning' : 'primary'" size="small" effect="plain">
|
||||
{{ row.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}
|
||||
</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>
|
||||
|
||||
<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 === 'D' || row.status === 'R'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleEdit(row)"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
>{{ row.status === 'D' ? '继续配置' : '编辑' }}</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'D' || row.status === 'R'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleSubmit(row)"
|
||||
v-hasPermi="['price:set:audit']"
|
||||
>提交审核</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'A'"
|
||||
link
|
||||
type="success"
|
||||
@click="handleApprove(row)"
|
||||
v-hasPermi="['price:set:audit']"
|
||||
>审批</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'E' && !row.expired"
|
||||
link
|
||||
type="warning"
|
||||
@click="handleDisable(row)"
|
||||
v-hasPermi="['price:set:audit']"
|
||||
>停用</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'S'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleCopy(row)"
|
||||
v-hasPermi="['price:set:add']"
|
||||
>复用</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'D' || row.status === 'R'"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(row.priceSetId)"
|
||||
v-hasPermi="['price:set:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</basic-table>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PriceSet">
|
||||
import {
|
||||
listPriceSet, delPriceSet, submitPriceSet, approvePriceSet, disablePriceSet, copyPriceSet
|
||||
} from '@/api/price/set'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const tableRef = ref()
|
||||
const isFirstActivate = ref(true)
|
||||
|
||||
const searchColumns = [
|
||||
{
|
||||
label: '类型',
|
||||
prop: 'setType',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: 'FIXED 固定价', value: 'FIXED' },
|
||||
{ label: 'DISCOUNT 折扣', value: 'DISCOUNT' }
|
||||
],
|
||||
placeholder: '全部类型',
|
||||
width: '160px'
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '草稿', value: 'D' },
|
||||
{ label: '审核中', value: 'A' },
|
||||
{ label: '生效', value: 'E' },
|
||||
{ label: '驳回', value: 'R' },
|
||||
{ label: '已停用', value: 'S' }
|
||||
],
|
||||
placeholder: '全部状态',
|
||||
width: '140px'
|
||||
},
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐ID / 名称 / 客户', width: '240px' }
|
||||
]
|
||||
|
||||
const columns = [
|
||||
{ label: '套餐编码', prop: 'priceSetCode', width: 110 },
|
||||
{ label: '套餐名称', prop: 'priceSetName', minWidth: 160 },
|
||||
{ label: '类型', prop: 'setType', width: 140 },
|
||||
{ label: '说明', prop: 'priceSetNote', minWidth: 160 },
|
||||
{ label: '产品数', prop: 'productCount', width: 80 },
|
||||
{ label: '客户数', prop: 'customerCount', width: 80 },
|
||||
{ label: '生效日期', prop: 'dateRange', minWidth: 200 },
|
||||
{ label: '状态', prop: 'status', width: 90 },
|
||||
{ label: '操作', prop: 'action', width: 280, showInToolbar: false }
|
||||
]
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
|
||||
function handleCreate() {
|
||||
proxy.$router.push({ path: '/customer/setCreate' })
|
||||
}
|
||||
|
||||
function handleDetail(row) {
|
||||
proxy.$router.push({ path: '/customer/setDetail', query: { priceSetId: row.priceSetId } })
|
||||
}
|
||||
|
||||
function handleEdit(row) {
|
||||
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: row.priceSetId } })
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
tableRef.value?.refresh()
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
if (isFirstActivate.value) {
|
||||
isFirstActivate.value = false
|
||||
return
|
||||
}
|
||||
tableRef.value?.reload()
|
||||
})
|
||||
|
||||
function handleDelete(ids) {
|
||||
proxy.$modal.confirm('是否确认删除套餐编号为 "' + ids + '" 的数据项?').then(() => {
|
||||
return delPriceSet(ids)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleSubmit(row) {
|
||||
proxy.$modal.confirm('确认提交套餐【' + row.priceSetName + '】审核?').then(() => {
|
||||
return submitPriceSet(row.priceSetId)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('已提交审核')
|
||||
refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleApprove(row) {
|
||||
proxy.$modal.confirm('确认将套餐【' + row.priceSetName + '】审批生效?').then(() => {
|
||||
return approvePriceSet(row.priceSetId)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('套餐已生效')
|
||||
refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleDisable(row) {
|
||||
proxy.$modal.confirm('停用后该套餐不再参与计费命中,确认停用【' + row.priceSetName + '】?').then(() => {
|
||||
return disablePriceSet(row.priceSetId)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('已停用')
|
||||
refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleCopy(row) {
|
||||
copyPriceSet(row.priceSetId).then(res => {
|
||||
proxy.$modal.msgSuccess('已复制为草稿')
|
||||
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: res.data } })
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hint-card {
|
||||
margin-top: 16px;
|
||||
}
|
||||
.hint-body {
|
||||
font-size: 13px;
|
||||
color: #595959;
|
||||
line-height: 1.7;
|
||||
padding: 8px 12px;
|
||||
background: #f6ffed;
|
||||
border: 1px solid #b7eb8f;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.hint-body b {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user