增加专属报价功能

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
+12 -12
View File
@@ -83,11 +83,11 @@ import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.v
import SetVersionExcelFileDrawer from './components/detail/SetVersionExcelFileDrawer.vue'
import PriceEditPanel from './components/create/PriceEditPanel.vue'
import { usePriceSetRefData } from './composables/usePriceSetRefData'
import {
getPriceSet, disablePriceSet, enablePriceSet, activatePriceSetVersion, deletePriceSetVersion
} from '@/api/price/set'
import { usePriceSetModule } from './composables/usePriceSetModule'
import { isDraftVersion, isPendingVersion, isEffectVersion, isImportFreshBuildMode } from './utils/priceSet'
const mod = usePriceSetModule()
const { proxy } = getCurrentInstance()
const route = useRoute()
const router = useRouter()
@@ -140,7 +140,7 @@ function load() {
// 立即标记,首次挂载后紧随的 activated 不会重复请求
loadedId.value = String(id)
loading.value = true
getPriceSet(id).then(res => {
mod.api.getPriceSet(id).then(res => {
set.value = res.data || {}
const versions = set.value.versions || []
const cur = set.value.version || versions[0]
@@ -172,10 +172,10 @@ function confirmAction(text, request, successText, done) {
}
function onDisable() {
confirmAction('停用后不再参与计费命中,确认停用?', () => disablePriceSet(set.value.priceSetId), '已停用')
confirmAction(mod.labels.disableConfirm.replace('{name}', set.value.priceSetName || ''), () => mod.api.disablePriceSet(set.value.priceSetId), '已停用')
}
function onEnable() {
confirmAction('启用后套餐将重新参与计费命中,确认启用?', () => enablePriceSet(set.value.priceSetId), '已启用')
confirmAction(mod.labels.enableConfirm.replace('{name}', set.value.priceSetName || ''), () => mod.api.enablePriceSet(set.value.priceSetId), '已启用')
}
/** Effective time precision: hour only (mm:ss always 00) */
function pad2(n) {
@@ -413,7 +413,7 @@ function submitActivate() {
if (!valid) return
activateForm.effectiveTime = normalizeToHour(activateForm.effectiveTime)
activateSubmitting.value = true
activatePriceSetVersion(activateForm.psvId, { effectiveTime: activateForm.effectiveTime })
mod.api.activatePriceSetVersion(activateForm.psvId, { effectiveTime: activateForm.effectiveTime })
.then(() => {
const eff = activateForm.effectiveTime
const pending = eff && new Date(eff.replace(/-/g, '/')).getTime() > Date.now()
@@ -439,7 +439,7 @@ function onCreateVersion() {
}
// Do not insert draft until user clicks finish on the build-price page.
router.push({
path: '/customer/setCreate',
path: mod.routes.create,
query: { priceSetId, step: '2', newVersion: '1' }
})
}
@@ -451,7 +451,7 @@ function onRemoveVersion(row) {
proxy.$modal.confirm(msg).then(() => {
removingPsvId.value = row.psvId
proxy.$modal.loading("正在删除,请稍候...")
return deletePriceSetVersion(row.psvId).then(() => {
return mod.api.deletePriceSetVersion(row.psvId).then(() => {
proxy.$modal.msgSuccess("版本已删除")
load()
}).finally(() => {
@@ -468,7 +468,7 @@ function onEditVersion(row) {
// Empty unfinished draft (new version, not finished): resume create step2 with build-mode choice
if (isDraftVersion(row) && noMode && noProducts && priceSetId != null) {
router.push({
path: '/customer/setCreate',
path: mod.routes.create,
query: { priceSetId, psvId: row.psvId, step: '2', newVersion: '1' }
})
return
@@ -483,7 +483,7 @@ function closeEdit() {
load()
}
function goList() {
const obj = { path: '/customer/set' }
const obj = { path: mod.routes.list }
if (proxy.$tab) {
proxy.$tab.closeOpenPage(obj)
} else {
@@ -509,7 +509,7 @@ watch(() => route.query.priceSetId, () => {
// 离开详情页去新建/编辑套餐版本,返回后需要重新加载
onBeforeRouteLeave((to) => {
if (to && to.path === '/customer/setCreate') {
if (to && to.path === mod.routes.create) {
pendingRefresh.value = true
}
})