增加专属报价功能

This commit is contained in:
wuweihua
2026-11-05 12:57:13 +08:00
parent 557d43a0b8
commit 308526ecee
32 changed files with 3817 additions and 567 deletions
+37 -34
View File
@@ -14,8 +14,8 @@
plain
icon="Plus"
@click="handleCreate"
v-hasPermi="['price:set:add']"
>新建套餐</el-button>
v-hasPermi="addPerm"
>{{ mod.labels.createButton }}</el-button>
</el-col>
</template>
@@ -52,37 +52,37 @@
type="primary"
:loading="activeLoadingId === row.priceSetId"
@click="handleActiveDetail(row)"
v-hasPermi="['price:set:query']"
v-hasPermi="queryPerm"
>查看明细</el-button>
</template>
<template #col-action="{ row }">
<el-button link type="primary" @click="handleDetail(row)" v-hasPermi="['price:set:query']">详情</el-button>
<el-button link type="primary" @click="openBasicEdit(row)" v-hasPermi="['price:set:edit']">修改</el-button>
<el-button link type="primary" @click="handleDetail(row)" v-hasPermi="queryPerm">详情</el-button>
<el-button link type="primary" @click="openBasicEdit(row)" v-hasPermi="editPerm">修改</el-button>
<el-button
v-if="row.status === 'E'"
link
type="warning"
@click="handleDisable(row)"
v-hasPermi="['price:set:audit']"
v-hasPermi="auditPerm"
>停用</el-button>
<el-button
v-if="row.status === 'D' || row.status === 'S'"
link
type="success"
@click="handleEnable(row)"
v-hasPermi="['price:set:audit']"
v-hasPermi="auditPerm"
>启用</el-button>
</template>
</basic-table>
<el-dialog v-model="basicDialog.visible" :title="basicDialogTitle" width="520px" append-to-body destroy-on-close>
<el-form ref="basicFormRef" :model="basicForm" :rules="basicRules" label-width="96px">
<el-form-item label="套餐编码">
<el-form-item :label="mod.labels.entityCode">
<el-input :model-value="basicForm.priceSetCode" disabled />
</el-form-item>
<el-form-item label="套餐名称" prop="priceSetName">
<el-input v-model="basicForm.priceSetName" maxlength="50" show-word-limit placeholder="请输入套餐名称" />
<el-form-item :label="mod.labels.entityName" prop="priceSetName">
<el-input v-model="basicForm.priceSetName" maxlength="50" show-word-limit :placeholder="'请输入' + mod.labels.entityName" />
</el-form-item>
<el-form-item label="说明备注" prop="priceSetNote">
<el-input v-model="basicForm.priceSetNote" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="可选" />
@@ -104,18 +104,21 @@
</template>
<script setup name="PriceSet">
import {
listPriceSet, disablePriceSet, enablePriceSet, copyPriceSet, getPriceSet, updatePriceSetBasic
} from '@/api/price/set'
import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.vue'
import CustomerSelect from '@/components/CustomerSelect/index.vue'
import { setStatusLabel, setStatusTagType } from './utils/priceSet'
import { usePriceSetModule, usePriceSetPerm } from './composables/usePriceSetModule'
const { proxy } = getCurrentInstance()
const mod = usePriceSetModule()
const addPerm = usePriceSetPerm('add')
const queryPerm = usePriceSetPerm('query')
const editPerm = usePriceSetPerm('edit')
const auditPerm = usePriceSetPerm('audit')
const tableRef = ref()
const isFirstActivate = ref(true)
const searchColumns = [
const searchColumns = computed(() => [
{
label: '状态',
prop: 'status',
@@ -128,23 +131,23 @@ const searchColumns = [
placeholder: '全部状态',
width: '140px'
},
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐编码 / 名称', width: '200px' },
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: mod.labels.keywordPlaceholder, width: '200px' },
{ label: '客户', prop: 'customerId', placeholder: '客户名称 / 代码', width: '240px' }
]
])
const columns = [
{ label: '套餐编码', prop: 'priceSetCode', width: 110 },
{ label: '套餐名称', prop: 'priceSetName', minWidth: 160 },
const columns = computed(() => [
{ label: mod.labels.entityCode, prop: 'priceSetCode', width: 110 },
{ label: mod.labels.entityName, prop: 'priceSetName', minWidth: 160 },
{ label: '类型', prop: 'setType', width: 140 },
{ label: '绑定客户', prop: 'boundCustomers', minWidth: 220 },
{ label: '说明', prop: 'priceSetNote', minWidth: 140 },
{ label: '状态', prop: 'status', width: 90 },
{ label: '生效明细', prop: 'activeDetail', width: 100 },
{ label: '操作', prop: 'action', width: 200, showInToolbar: false }
]
])
function queryList(params) {
return listPriceSet(params)
return mod.api.listPriceSet(params)
}
function statusLabel(row) {
@@ -156,11 +159,11 @@ function statusTag(row) {
}
function handleCreate() {
proxy.$router.push({ path: '/customer/setCreate' })
proxy.$router.push({ path: mod.routes.create })
}
function handleDetail(row) {
proxy.$router.push({ path: '/customer/setDetail', query: { priceSetId: row.priceSetId } })
proxy.$router.push({ path: mod.routes.detail, query: { priceSetId: row.priceSetId } })
}
@@ -173,9 +176,9 @@ const basicForm = reactive({
priceSetNote: ''
})
const basicRules = {
priceSetName: [{ required: true, message: '套餐名称不能为空', trigger: 'blur' }]
priceSetName: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
}
const basicDialogTitle = computed(() => '修改套餐基本信息')
const basicDialogTitle = computed(() => mod.labels.basicEditTitle)
function openBasicEdit(row) {
if (!row || row.priceSetId == null) return
@@ -191,7 +194,7 @@ function submitBasicEdit() {
basicFormRef.value.validate(valid => {
if (!valid) return
basicDialog.saving = true
updatePriceSetBasic({
mod.api.updatePriceSetBasic({
priceSetId: basicForm.priceSetId,
priceSetName: basicForm.priceSetName,
priceSetNote: basicForm.priceSetNote
@@ -214,12 +217,12 @@ const activeLoadingId = ref(null)
function handleActiveDetail(row) {
activeLoadingId.value = row.priceSetId
getPriceSet(row.priceSetId).then(res => {
mod.api.getPriceSet(row.priceSetId).then(res => {
const data = res.data || {}
const versions = data.versions || []
const active = versions.find(v => String(v.status) === '1')
if (!active || active.psvId == null) {
proxy.$modal.msgWarning('该套餐暂无生效版本')
proxy.$modal.msgWarning(mod.labels.noActiveVersion)
return
}
drawerSetType.value = row.setType
@@ -245,8 +248,8 @@ onActivated(() => {
function handleDisable(row) {
proxy.$modal.confirm('停用后该套餐不再参与计费命中,确认停用【' + row.priceSetName + '】?').then(() => {
return disablePriceSet(row.priceSetId)
proxy.$modal.confirm(mod.labels.disableConfirm.replace('{name}', row.priceSetName)).then(() => {
return mod.api.disablePriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('已停用')
refresh()
@@ -254,8 +257,8 @@ function handleDisable(row) {
}
function handleEnable(row) {
proxy.$modal.confirm('启用后该套餐将重新参与计费命中,确认启用【' + row.priceSetName + '】?').then(() => {
return enablePriceSet(row.priceSetId)
proxy.$modal.confirm(mod.labels.enableConfirm.replace('{name}', row.priceSetName)).then(() => {
return mod.api.enablePriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('已启用')
tableRef.value.refresh()
@@ -263,9 +266,9 @@ function handleEnable(row) {
}
function handleCopy(row) {
copyPriceSet(row.priceSetId).then(res => {
mod.api.copyPriceSet(row.priceSetId).then(res => {
proxy.$modal.msgSuccess('已复制为草稿')
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: res.data } })
proxy.$router.push({ path: mod.routes.create, query: { priceSetId: res.data } })
})
}
</script>