增加专属报价功能
This commit is contained in:
@@ -44,7 +44,9 @@ import { ArrowLeft } from '@element-plus/icons-vue'
|
||||
import StepDetails from './StepDetails.vue'
|
||||
import { usePriceSetRefData } from '../../composables/usePriceSetRefData'
|
||||
import { isBuildModeLockedVersion } from '../../utils/priceSet'
|
||||
import { getPriceSet, savePriceSetAsync } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
|
||||
const props = defineProps({
|
||||
priceSetId: { type: [Number, String], default: undefined },
|
||||
@@ -82,7 +84,7 @@ function load() {
|
||||
}
|
||||
loading.value = true
|
||||
loaded.value = false
|
||||
getPriceSet(id).then(res => {
|
||||
api.getPriceSet(id).then(res => {
|
||||
const data = res.data || {}
|
||||
setType.value = data.setType || 'FIXED'
|
||||
priceSetName.value = data.priceSetName || ''
|
||||
@@ -137,7 +139,7 @@ function reloadSavedProducts() {
|
||||
const id = props.priceSetId
|
||||
if (!id) return
|
||||
loading.value = true
|
||||
getPriceSet(id).then(res => {
|
||||
api.getPriceSet(id).then(res => {
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const qPsv = props.psvId || version.psvId
|
||||
@@ -154,7 +156,7 @@ function reloadSavedProducts() {
|
||||
async function reloadProductsAfterImportModeSave() {
|
||||
const id = props.priceSetId
|
||||
if (!id) return
|
||||
const res = await getPriceSet(id)
|
||||
const res = await api.getPriceSet(id)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const qPsv = props.psvId || version.psvId
|
||||
@@ -190,7 +192,7 @@ async function finish() {
|
||||
priceBuildMode: version.priceBuildMode
|
||||
}
|
||||
}
|
||||
await savePriceSetAsync(payload)
|
||||
await api.savePriceSetAsync(payload)
|
||||
savedPriceBuildMode.value = version.priceBuildMode
|
||||
await nextTick()
|
||||
if (version.priceBuildMode === 'PULL' && detailsRef.value && detailsRef.value.pullAllFromLibrary) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@click="handlePullLibrary"
|
||||
>拉取产品列表</el-button>
|
||||
<el-dropdown
|
||||
v-if="showImportAction && !isModifyImport"
|
||||
v-if="showImportAction && !isModifyImport && showCountryImport"
|
||||
trigger="click"
|
||||
@command="handleImportCommand"
|
||||
>
|
||||
@@ -48,6 +48,7 @@
|
||||
<p class="build-choice__tip">创建价格方式</p>
|
||||
<div class="build-choice__cards">
|
||||
<button
|
||||
v-if="!onlyImportFresh"
|
||||
type="button"
|
||||
class="build-card build-card--pull"
|
||||
:class="{ selected: isPullBuildMode(priceBuildMode) }"
|
||||
@@ -58,7 +59,7 @@
|
||||
<div class="build-card__desc">按产品库基础价生成套餐产品列表,可再导入 Excel 修改价格</div>
|
||||
</button>
|
||||
<button
|
||||
v-if="showImportInherit"
|
||||
v-if="showImportInherit && !onlyImportFresh"
|
||||
type="button"
|
||||
class="build-card build-card--import"
|
||||
:class="{ selected: isImportBuildMode(priceBuildMode) }"
|
||||
@@ -76,7 +77,7 @@
|
||||
@click="chooseBuildMode('IMPORT_FRESH')"
|
||||
>
|
||||
<div class="build-card__title">Excel 新建价</div>
|
||||
<div class="build-card__desc">不延用以前的产品价格,不带出上一版,上传 Excel 直接生成套餐销售价</div>
|
||||
<div class="build-card__desc">{{ importFreshCardDesc }}</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -227,9 +228,14 @@ import {
|
||||
surchargeAppliesToRow,
|
||||
toDetailPayload
|
||||
} from '../../utils/priceSet'
|
||||
import { getPriceSet, listSetDetailByProduct, listSetDetailByVersion, importSetDetailPricesAsync, pullSetDetailsFromLibraryAsync, previewPullFromLibrary, previewImportDetailPrices, updateSetDetail, updateSetDetailSurchargeAsync, delSetDetail } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
import { listRegionOptions } from '@/api/data/region'
|
||||
|
||||
const mod = usePriceSetModule()
|
||||
const { api } = mod
|
||||
const onlyImportFresh = computed(() => !!mod.onlyImportFresh)
|
||||
const showCountryImport = computed(() => !mod.exclusiveQuote)
|
||||
|
||||
const props = defineProps({
|
||||
details: { type: Array, required: true },
|
||||
products: { type: Array, default: () => [] },
|
||||
@@ -326,7 +332,18 @@ const importActionLabel = computed(() =>
|
||||
isModifyImport.value ? '导入修改价格' : '导入 Excel 建价'
|
||||
)
|
||||
const importDialogTitle = computed(() => importActionLabel.value)
|
||||
const importFreshCardDesc = computed(() => onlyImportFresh.value
|
||||
? '仅支持大客折扣报价表(目的地/运费/操作费),导入后直接生成专属报价明细'
|
||||
: '不延用以前的产品价格,不带出上一版,上传 Excel 直接生成套餐销售价'
|
||||
)
|
||||
const importDesc = computed(() => {
|
||||
if (onlyImportFresh.value) {
|
||||
return [
|
||||
'\u4e13\u5c5e\u62a5\u4ef7\u4ec5\u652f\u6301\u5927\u5ba2\u6298\u6263\u62a5\u4ef7\u8868\uff08\u542b\u300c\u4ea7\u54c1\u76ee\u5f55\u300d\u4e0e\u5404\u56fd\u4ef7\u8868\uff09\u3002',
|
||||
'\u8868\u5934\u4e3a\u76ee\u7684\u5730 / \u91cd\u91cf\u6bb5 / \u8fd0\u8d39(CNY/KG) / \u64cd\u4f5c\u8d39(CNY/PCS)\uff0c\u4e0e\u666e\u901a\u5957\u9910 Excel \u6a21\u677f\u4e0d\u540c\u3002',
|
||||
'\u4ec5\u300cExcel \u65b0\u5efa\u4ef7\u300d\uff1a\u4e0d\u62c9\u53d6\u4ea7\u54c1\u5e93\u3001\u4e0d\u5ef6\u7528\u4e0a\u4e00\u7248\uff0c\u5bfc\u5165\u540e\u76f4\u63a5\u751f\u6210\u9500\u552e\u4ef7\u660e\u7ec6\u3002'
|
||||
]
|
||||
}
|
||||
if (isModifyImport.value) {
|
||||
return [
|
||||
'适用威狮B2C小包价表(含「产品目录」)。',
|
||||
@@ -377,7 +394,7 @@ async function resolvePsvId(force) {
|
||||
return resolvedPsvId.value
|
||||
}
|
||||
if (!props.priceSetId) return null
|
||||
const res = await getPriceSet(props.priceSetId)
|
||||
const res = await api.getPriceSet(props.priceSetId)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const fromData = (data.version && data.version.psvId) ? data.version : null
|
||||
@@ -420,7 +437,7 @@ async function loadLatestPriorVersionDraft() {
|
||||
if (!props.priceSetId) return false
|
||||
pulling.value = true
|
||||
try {
|
||||
const res = await getPriceSet(props.priceSetId)
|
||||
const res = await api.getPriceSet(props.priceSetId)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
// Only exclude the draft being edited. Do NOT use resolvedPsvId — it may
|
||||
@@ -437,7 +454,7 @@ async function loadLatestPriorVersionDraft() {
|
||||
return row
|
||||
})
|
||||
if (!products.length) return false
|
||||
const detailRes = await listSetDetailByVersion(prior.psvId)
|
||||
const detailRes = await api.listSetDetailByVersion(prior.psvId)
|
||||
applyLocalDraft(products, detailRes.data || [])
|
||||
return true
|
||||
} finally {
|
||||
@@ -455,7 +472,7 @@ async function loadProductDetails(productCode, force) {
|
||||
}
|
||||
const psvId = await resolvePsvId(false)
|
||||
if (!psvId) return []
|
||||
const res = await listSetDetailByProduct(psvId, productCode)
|
||||
const res = await api.listSetDetailByProduct(psvId, productCode)
|
||||
const rows = (res.data || []).map(d => hydrateRow(d, props.setType))
|
||||
detailByProduct[productCode] = rows
|
||||
// keep parent details array in sync for any legacy callers
|
||||
@@ -586,6 +603,18 @@ async function canOpenImport() {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
watch(
|
||||
() => [onlyImportFresh.value, props.priceBuildMode, props.buildModeReady],
|
||||
() => {
|
||||
if (!onlyImportFresh.value || !props.buildModeReady) return
|
||||
if (props.priceBuildMode) return
|
||||
if (buildModeLocked.value) return
|
||||
emit('update:priceBuildMode', 'IMPORT_FRESH')
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
async function openImport() {
|
||||
if (!(await canOpenImport())) return
|
||||
importRef.value && importRef.value.open()
|
||||
@@ -625,7 +654,7 @@ async function runImportAsync(uploadFile, countryCode) {
|
||||
}
|
||||
const replaceByProductCountry = !isModifyImport.value || !!countryCode
|
||||
if (!props.livePersist) {
|
||||
const res = await previewImportDetailPrices(files, {
|
||||
const res = await api.previewImportDetailPrices(files, {
|
||||
updateOnly: isModifyImport.value && !countryCode,
|
||||
replaceByProductCountry,
|
||||
countryCode: countryCode || undefined,
|
||||
@@ -640,7 +669,7 @@ async function runImportAsync(uploadFile, countryCode) {
|
||||
applyLocalDraft(products, data.details || [])
|
||||
return data.message || '导入完成'
|
||||
}
|
||||
const { task } = await importSetDetailPricesAsync(
|
||||
const { task } = await api.importSetDetailPricesAsync(
|
||||
files,
|
||||
{
|
||||
priceSetId: props.priceSetId,
|
||||
@@ -693,7 +722,7 @@ async function reloadDetailsFromServer() {
|
||||
if (!props.priceSetId) return
|
||||
try {
|
||||
clearDetailCache()
|
||||
const res = await getPriceSet(props.priceSetId)
|
||||
const res = await api.getPriceSet(props.priceSetId)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const qPsv = resolvedPsvId.value || props.psvId
|
||||
@@ -754,7 +783,7 @@ async function pullAllFromLibrary(opts = {}) {
|
||||
if (!props.livePersist) {
|
||||
importProgressMessage.value = '正在拉取产品库…'
|
||||
importProgressPercent.value = 40
|
||||
const res = await previewPullFromLibrary()
|
||||
const res = await api.previewPullFromLibrary()
|
||||
const data = res.data || {}
|
||||
applyLocalDraft(data.products || [], data.details || [])
|
||||
importProgressPercent.value = 100
|
||||
@@ -764,7 +793,7 @@ async function pullAllFromLibrary(opts = {}) {
|
||||
}
|
||||
return { added: (props.products || []).length }
|
||||
}
|
||||
const { task } = await pullSetDetailsFromLibraryAsync(
|
||||
const { task } = await api.pullSetDetailsFromLibraryAsync(
|
||||
{ priceSetId: props.priceSetId, psvId: await resolvePsvId(false), force },
|
||||
applyBuildProgress
|
||||
)
|
||||
@@ -864,7 +893,7 @@ async function persistDetail(row, withSurcharge) {
|
||||
const payload = toDetailPayload(row)
|
||||
payload.priceSetId = props.priceSetId
|
||||
if (!withSurcharge) delete payload.surcharges
|
||||
await updateSetDetail(payload)
|
||||
await api.updateSetDetail(payload)
|
||||
}
|
||||
|
||||
/** drawer hover remove surcharge -> write snapshot for this row */
|
||||
@@ -1035,7 +1064,7 @@ function onSurchargeConfirm(picked) {
|
||||
return
|
||||
}
|
||||
proxy.$modal.msgSuccess(okText + ',正在后台写入…')
|
||||
updateSetDetailSurchargeAsync(payload).then(() => {
|
||||
api.updateSetDetailSurchargeAsync(payload).then(() => {
|
||||
proxy.$modal.msgSuccess(okText + ',已写入数据库')
|
||||
}).catch(e => {
|
||||
proxy.$modal.msgError((e && e.message) ? e.message : '附加费后台写入失败')
|
||||
@@ -1048,7 +1077,7 @@ async function removeProduct(code) {
|
||||
const rows = await loadProductDetails(code)
|
||||
const ids = rows.filter(d => d && d.psdId).map(d => d.psdId)
|
||||
if (ids.length) {
|
||||
await delSetDetail(ids.join(','))
|
||||
await api.delSetDetail(ids.join(','))
|
||||
}
|
||||
} catch (e) {
|
||||
return
|
||||
|
||||
@@ -83,7 +83,9 @@
|
||||
* 套餐绑定客户 · 新增(支持批量) / 编辑弹窗
|
||||
*/
|
||||
import { createEmptyCustomerRow } from '../../utils/priceSet'
|
||||
import { batchAddSetCustomer, updateSetCustomer } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
|
||||
const props = defineProps({
|
||||
priceSetId: {
|
||||
@@ -174,7 +176,7 @@ async function submit() {
|
||||
try {
|
||||
if (isEdit.value) {
|
||||
const payload = { ...form.value, priceSetId: props.priceSetId }
|
||||
await updateSetCustomer(payload)
|
||||
await api.updateSetCustomer(payload)
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
} else {
|
||||
const customers = selectedCustomers.value.map(c => ({
|
||||
@@ -182,7 +184,7 @@ async function submit() {
|
||||
customerCode: c.customerCode,
|
||||
customerName: c.customerName
|
||||
}))
|
||||
const res = await batchAddSetCustomer({
|
||||
const res = await api.batchAddSetCustomer({
|
||||
priceSetId: props.priceSetId,
|
||||
bindPriority: form.value.bindPriority,
|
||||
prBegindate: form.value.prBegindate,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
size="small"
|
||||
icon="Plus"
|
||||
@click="dialogRef.open()"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
v-hasPermi="editPerm"
|
||||
>添加客户</el-button>
|
||||
</template>
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column v-if="editable" label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="dialogRef.open(row)" v-hasPermi="['price:set:edit']">编辑</el-button>
|
||||
<el-button link type="danger" @click="remove(row)" v-hasPermi="['price:set:edit']">解绑</el-button>
|
||||
<el-button link type="primary" @click="dialogRef.open(row)" v-hasPermi="editPerm">编辑</el-button>
|
||||
<el-button link type="danger" @click="remove(row)" v-hasPermi="editPerm">解绑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -55,7 +55,10 @@
|
||||
import SetSectionCard from './SetSectionCard.vue'
|
||||
import SetCustomerDialog from './SetCustomerDialog.vue'
|
||||
import { isChildEditable } from '../../utils/priceSet'
|
||||
import { delSetCustomer } from '@/api/price/set'
|
||||
import { usePriceSetModule, usePriceSetPerm } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
const editPerm = usePriceSetPerm('edit')
|
||||
|
||||
const props = defineProps({
|
||||
/** 套餐详情对象 */
|
||||
@@ -75,7 +78,7 @@ const customers = computed(() => props.set.customers || [])
|
||||
const editable = computed(() => isChildEditable(props.set.status))
|
||||
|
||||
function remove(row) {
|
||||
proxy.$modal.confirm('确认解绑该客户?').then(() => delSetCustomer(row.customerPricesetId)).then(() => {
|
||||
proxy.$modal.confirm('确认解绑该客户?').then(() => api.delSetCustomer(row.customerPricesetId)).then(() => {
|
||||
proxy.$modal.msgSuccess('已解绑')
|
||||
emit('refresh')
|
||||
}).catch(() => {})
|
||||
|
||||
@@ -164,7 +164,9 @@
|
||||
import SurchargeTags from '../SurchargeTags.vue'
|
||||
import { useDetailCascade } from '../../composables/usePriceSetRefData'
|
||||
import { createEmptyDetailRow, isFixedType, toEditableDetailRow } from '../../utils/priceSet'
|
||||
import { addSetDetail, updateSetDetail } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
|
||||
const props = defineProps({
|
||||
/** 所属套餐ID */
|
||||
@@ -228,7 +230,7 @@ async function submit() {
|
||||
const payload = { ...form.value, priceSetId: props.priceSetId }
|
||||
delete payload._countryKey
|
||||
submitting.value = true
|
||||
const req = payload.psdId ? updateSetDetail(payload) : addSetDetail(payload)
|
||||
const req = payload.psdId ? api.updateSetDetail(payload) : api.addSetDetail(payload)
|
||||
req.then(() => {
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
visible.value = false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="set-header">
|
||||
<div class="hd-main">
|
||||
<div class="hd-line">
|
||||
<h2 class="hd-name">{{ set.priceSetName || '套餐详情' }}</h2>
|
||||
<h2 class="hd-name">{{ set.priceSetName || mod.labels.detailTitleFallback }}</h2>
|
||||
<span v-if="set.priceSetCode" class="hd-code">{{ set.priceSetCode }}</span>
|
||||
<el-tag :type="setStatusTagType(set)" size="small">{{ setStatusLabel(set) }}</el-tag>
|
||||
</div>
|
||||
@@ -20,14 +20,14 @@
|
||||
type="danger"
|
||||
plain
|
||||
@click="emit('disable')"
|
||||
v-hasPermi="['price:set:audit']"
|
||||
v-hasPermi="auditPerm"
|
||||
>停用</el-button>
|
||||
<el-button
|
||||
v-if="set.status !== 'E'"
|
||||
type="success"
|
||||
plain
|
||||
@click="emit('enable')"
|
||||
v-hasPermi="['price:set:audit']"
|
||||
v-hasPermi="auditPerm"
|
||||
>启用</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,6 +35,10 @@
|
||||
|
||||
<script setup name="SetDetailHeader">
|
||||
import { isFixedType, setTypeLabel, setStatusLabel, setStatusTagType } from '../../utils/priceSet'
|
||||
import { usePriceSetModule, usePriceSetPerm } from '../../composables/usePriceSetModule'
|
||||
|
||||
const mod = usePriceSetModule()
|
||||
const auditPerm = usePriceSetPerm('audit')
|
||||
|
||||
defineProps({
|
||||
set: { type: Object, required: true }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
size="small"
|
||||
icon="Plus"
|
||||
@click="dialogRef.open()"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
v-hasPermi="editPerm"
|
||||
>添加明细</el-button>
|
||||
</template>
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
|
||||
<el-table-column v-if="editable" label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="dialogRef.open(row)" v-hasPermi="['price:set:edit']">编辑</el-button>
|
||||
<el-button link type="danger" @click="remove(row)" v-hasPermi="['price:set:edit']">删除</el-button>
|
||||
<el-button link type="primary" @click="dialogRef.open(row)" v-hasPermi="editPerm">编辑</el-button>
|
||||
<el-button link type="danger" @click="remove(row)" v-hasPermi="editPerm">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -113,7 +113,10 @@ import SetSectionCard from './SetSectionCard.vue'
|
||||
import SetDetailDialog from './SetDetailDialog.vue'
|
||||
import SurchargeTags from '../SurchargeTags.vue'
|
||||
import { isChildEditable, isFixedType } from '../../utils/priceSet'
|
||||
import { delSetDetail } from '@/api/price/set'
|
||||
import { usePriceSetModule, usePriceSetPerm } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
const editPerm = usePriceSetPerm('edit')
|
||||
|
||||
const props = defineProps({
|
||||
/** 套餐详情对象 */
|
||||
@@ -172,7 +175,7 @@ function roundModeLabel(mode) {
|
||||
}
|
||||
|
||||
function remove(row) {
|
||||
proxy.$modal.confirm('确认删除该明细?').then(() => delSetDetail(row.psdId)).then(() => {
|
||||
proxy.$modal.confirm('确认删除该明细?').then(() => api.delSetDetail(row.psdId)).then(() => {
|
||||
proxy.$modal.msgSuccess('已删除')
|
||||
emit('refresh')
|
||||
}).catch(() => {})
|
||||
|
||||
@@ -129,7 +129,9 @@
|
||||
import { ArrowLeft } from '@element-plus/icons-vue'
|
||||
import SurchargeTags from '../SurchargeTags.vue'
|
||||
import { isFixedType } from '../../utils/priceSet'
|
||||
import { listSetDetailByProduct, listSetDetailOptions } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
@@ -318,7 +320,7 @@ async function loadProducts() {
|
||||
products.value = fromVersion
|
||||
return
|
||||
}
|
||||
const res = await listSetDetailOptions(psvId)
|
||||
const res = await api.listSetDetailOptions(psvId)
|
||||
const data = res.data || {}
|
||||
products.value = normalizeProducts(data.products || [])
|
||||
} finally {
|
||||
@@ -335,7 +337,7 @@ async function openProductDetail(row) {
|
||||
detailKeyword.value = ''
|
||||
detailLoading.value = true
|
||||
try {
|
||||
const res = await listSetDetailByProduct(psvId, row.productCode)
|
||||
const res = await api.listSetDetailByProduct(psvId, row.productCode)
|
||||
detailRows.value = res.data || []
|
||||
} catch (e) {
|
||||
detailRows.value = []
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listPriceSetVersionExcelFiles } from '@/api/price/set'
|
||||
import { usePriceSetModule } from '../../composables/usePriceSetModule'
|
||||
|
||||
const { api } = usePriceSetModule()
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
@@ -39,7 +41,7 @@ function open(row) {
|
||||
function loadList() {
|
||||
if (!version.value || version.value.psvId == null) return
|
||||
loading.value = true
|
||||
listPriceSetVersionExcelFiles(version.value.psvId).then(res => {
|
||||
api.listPriceSetVersionExcelFiles(version.value.psvId).then(res => {
|
||||
list.value = res.data || []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
plain
|
||||
size="small"
|
||||
:disabled="hasDraft"
|
||||
v-hasPermi="['price:set:add']"
|
||||
v-hasPermi="addPerm"
|
||||
@click="emit('create-version')"
|
||||
>新建价格版本</el-button>
|
||||
</template>
|
||||
@@ -50,14 +50,14 @@
|
||||
link
|
||||
type="success"
|
||||
@click="emit('activate', row)"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
v-hasPermi="editPerm"
|
||||
>启动</el-button>
|
||||
<el-button
|
||||
v-if="isPendingVersion(row)"
|
||||
link
|
||||
type="primary"
|
||||
@click="emit('reschedule', row)"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
v-hasPermi="editPerm"
|
||||
>修改生效时间</el-button>
|
||||
<el-button
|
||||
v-if="isDraftVersion(row) || isPendingVersion(row) || isEffectVersion(row)"
|
||||
@@ -66,7 +66,7 @@
|
||||
:loading="isRemoving(row)"
|
||||
:disabled="removingPsvId != null"
|
||||
@click="emit('remove', row)"
|
||||
v-hasPermi="['price:set:edit']"
|
||||
v-hasPermi="editPerm"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -78,6 +78,11 @@
|
||||
import SetSectionCard from './SetSectionCard.vue'
|
||||
import { versionStatusLabel, versionStatusTag, isDraftVersion, isPendingVersion, isEffectVersion, isPriceEditableVersion } from '../../utils/priceSet'
|
||||
import { checkPermi } from '@/utils/permission'
|
||||
import { usePriceSetModule, usePriceSetPerm } from '../../composables/usePriceSetModule'
|
||||
|
||||
const mod = usePriceSetModule()
|
||||
const addPerm = usePriceSetPerm('add')
|
||||
const editPerm = usePriceSetPerm('edit')
|
||||
|
||||
const props = defineProps({
|
||||
versions: { type: Array, default: () => [] },
|
||||
@@ -164,8 +169,8 @@ function detailCount(row) {
|
||||
}
|
||||
|
||||
function showEditButton(row) {
|
||||
if (checkPermi(['price:set:forceEdit'])) return true
|
||||
return isPriceEditableVersion(row) && checkPermi(['price:set:edit'])
|
||||
if (checkPermi([mod.permPrefix + ':forceEdit'])) return true
|
||||
return isPriceEditableVersion(row) && checkPermi([mod.permPrefix + ':edit'])
|
||||
}
|
||||
|
||||
function isRemoving(row) {
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { inject, provide } from 'vue'
|
||||
import { priceSetApi } from '@/api/price/set'
|
||||
|
||||
export const PRICE_SET_MODULE_KEY = 'priceSetModule'
|
||||
|
||||
const defaultModule = Object.freeze({
|
||||
api: priceSetApi,
|
||||
permPrefix: 'price:set',
|
||||
exclusiveQuote: false,
|
||||
onlyImportFresh: false,
|
||||
routes: Object.freeze({
|
||||
list: '/customer/set',
|
||||
create: '/customer/setCreate',
|
||||
detail: '/customer/setDetail'
|
||||
}),
|
||||
labels: Object.freeze({
|
||||
entity: '套餐',
|
||||
entityCode: '套餐编码',
|
||||
entityName: '套餐名称',
|
||||
createButton: '新建套餐',
|
||||
saveProgressTitle: '正在保存套餐',
|
||||
savedSuccess: '套餐已保存',
|
||||
noActiveVersion: '该套餐暂无生效版本',
|
||||
disableConfirm: '停用后该套餐不再参与计费命中,确认停用【{name}】?',
|
||||
enableConfirm: '启用后该套餐将重新参与计费命中,确认启用【{name}】?',
|
||||
basicEditTitle: '修改套餐基本信息',
|
||||
keywordPlaceholder: '套餐编码 / 名称',
|
||||
detailTitleFallback: '套餐详情'
|
||||
})
|
||||
})
|
||||
|
||||
export function createExclusiveModule(api) {
|
||||
return Object.freeze({
|
||||
api,
|
||||
permPrefix: 'price:exclusive',
|
||||
exclusiveQuote: true,
|
||||
onlyImportFresh: true,
|
||||
routes: Object.freeze({
|
||||
list: '/exclusive/quote',
|
||||
create: '/exclusive/quoteCreate',
|
||||
detail: '/exclusive/quoteDetail'
|
||||
}),
|
||||
labels: Object.freeze({
|
||||
entity: '专属报价',
|
||||
entityCode: '报价编码',
|
||||
entityName: '报价名称',
|
||||
createButton: '新建报价',
|
||||
saveProgressTitle: '正在保存专属报价',
|
||||
savedSuccess: '专属报价已保存',
|
||||
noActiveVersion: '该专属报价暂无生效版本',
|
||||
disableConfirm: '停用后该专属报价不再参与计费命中,确认停用【{name}】?',
|
||||
enableConfirm: '启用后该专属报价将重新参与计费命中,确认启用【{name}】?',
|
||||
basicEditTitle: '修改专属报价基本信息',
|
||||
keywordPlaceholder: '报价编码 / 名称',
|
||||
detailTitleFallback: '专属报价详情'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide module for child inject, and return cfg for the providing page itself
|
||||
* (same-component inject cannot see its own provide).
|
||||
*/
|
||||
export function providePriceSetModule(moduleConfig) {
|
||||
const cfg = moduleConfig || defaultModule
|
||||
provide(PRICE_SET_MODULE_KEY, cfg)
|
||||
return cfg
|
||||
}
|
||||
|
||||
export function usePriceSetModule() {
|
||||
return inject(PRICE_SET_MODULE_KEY, defaultModule)
|
||||
}
|
||||
|
||||
export function usePriceSetPerm(action) {
|
||||
const mod = usePriceSetModule()
|
||||
return [`${mod.permPrefix}:${action}`]
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<el-dialog
|
||||
v-model="progressVisible"
|
||||
:title="'正在保存套餐'"
|
||||
:title="mod.labels.saveProgressTitle"
|
||||
width="420px"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
@@ -61,7 +61,9 @@ import {
|
||||
toCustomerPayload,
|
||||
toDetailPayload
|
||||
} from './utils/priceSet'
|
||||
import { getPriceSet, savePriceSetAsync, createPriceSetVersion, deletePriceSetVersion } from '@/api/price/set'
|
||||
import { usePriceSetModule } from './composables/usePriceSetModule'
|
||||
|
||||
const mod = usePriceSetModule()
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const route = useRoute()
|
||||
@@ -131,7 +133,7 @@ async function runSaveWithProgress(payload) {
|
||||
progressMessage.value = ''
|
||||
progressStatus.value = undefined
|
||||
try {
|
||||
const result = await savePriceSetAsync(payload, (task) => {
|
||||
const result = await mod.api.savePriceSetAsync(payload, (task) => {
|
||||
progressPercent.value = Math.min(100, Number(task.percent) || 0)
|
||||
progressMessage.value = mapSaveProgressMessage(task.message)
|
||||
if (task.status === 'FAIL') {
|
||||
@@ -204,7 +206,7 @@ async function finishEdit() {
|
||||
proxy.$modal.msgSuccess("修改已实时落库")
|
||||
}
|
||||
const obj = {
|
||||
path: '/customer/setDetail',
|
||||
path: mod.routes.detail,
|
||||
query: { priceSetId: form.priceSetId }
|
||||
}
|
||||
if (proxy.$tab) {
|
||||
@@ -230,7 +232,7 @@ async function finishEdit() {
|
||||
creating.value = true
|
||||
try {
|
||||
if (newVersionMode.value && form.version.psvId == null && form.priceSetId) {
|
||||
const verRes = await createPriceSetVersion(form.priceSetId)
|
||||
const verRes = await mod.api.createPriceSetVersion(form.priceSetId)
|
||||
if (verRes.data != null) {
|
||||
form.version.psvId = verRes.data
|
||||
}
|
||||
@@ -238,9 +240,9 @@ async function finishEdit() {
|
||||
const payload = buildPayload({ forceDetails: true })
|
||||
const priceSetId = await runSaveWithProgress(payload)
|
||||
form.priceSetId = priceSetId
|
||||
proxy.$modal.msgSuccess('套餐已保存')
|
||||
proxy.$modal.msgSuccess(mod.labels.savedSuccess)
|
||||
const obj = {
|
||||
path: '/customer/setDetail',
|
||||
path: mod.routes.detail,
|
||||
query: { priceSetId }
|
||||
}
|
||||
if (proxy.$tab) {
|
||||
@@ -305,14 +307,14 @@ async function tryDeleteEmptyNewVersionDraft() {
|
||||
if (!newVersionMode.value || !form.priceSetId || form.version.psvId == null) return
|
||||
const psvId = form.version.psvId
|
||||
try {
|
||||
const res = await getPriceSet(form.priceSetId)
|
||||
const res = await mod.api.getPriceSet(form.priceSetId)
|
||||
const versions = (res.data || {}).versions || []
|
||||
const v = versions.find(x => x && String(x.psvId) === String(psvId))
|
||||
if (!v || String(v.status) !== '0') return
|
||||
const noMode = !v.priceBuildMode
|
||||
const noDetails = !(Number(v.detailCount) > 0) && !(v.details || []).length
|
||||
if (noMode && noDetails) {
|
||||
await deletePriceSetVersion(psvId)
|
||||
await mod.api.deletePriceSetVersion(psvId)
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore cleanup errors; still navigate back
|
||||
@@ -322,8 +324,8 @@ async function tryDeleteEmptyNewVersionDraft() {
|
||||
async function goBack() {
|
||||
await tryDeleteEmptyNewVersionDraft()
|
||||
const obj = (newVersionMode.value || copyMode.value) && form.priceSetId
|
||||
? { path: '/customer/setDetail', query: { priceSetId: form.priceSetId } }
|
||||
: { path: '/customer/set' }
|
||||
? { path: mod.routes.detail, query: { priceSetId: form.priceSetId } }
|
||||
: { path: mod.routes.list }
|
||||
if (proxy.$tab) {
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
} else {
|
||||
@@ -418,7 +420,7 @@ function onPriceBuildModeUpdate(mode) {
|
||||
}
|
||||
|
||||
function reloadSavedProductsForCreate() {
|
||||
getPriceSet(form.priceSetId).then(res => {
|
||||
mod.api.getPriceSet(form.priceSetId).then(res => {
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const qPsv = form.version.psvId
|
||||
@@ -433,7 +435,7 @@ function reloadSavedProductsForCreate() {
|
||||
|
||||
async function refreshProductsFromCurrentVersion() {
|
||||
if (!form.priceSetId) return
|
||||
const res = await getPriceSet(form.priceSetId)
|
||||
const res = await mod.api.getPriceSet(form.priceSetId)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const qPsv = form.version.psvId
|
||||
@@ -520,7 +522,7 @@ function applySetData(data, asCopy, asNewVersion) {
|
||||
|
||||
function loadExisting(id, asCopy, asNewVersion) {
|
||||
pageReady.value = false
|
||||
return getPriceSet(id).then(res => {
|
||||
return mod.api.getPriceSet(id).then(res => {
|
||||
applySetData(res.data || {}, asCopy, asNewVersion)
|
||||
}).finally(() => {
|
||||
pageReady.value = true
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user