修改价格套餐版本

This commit is contained in:
wuweihua
2026-09-17 10:41:19 +08:00
parent f76c90643e
commit 5fe2351990
21 changed files with 668 additions and 116 deletions
@@ -107,7 +107,7 @@ const editInputRefs = {}
const title = computed(() => {
const code = props.productCode || ''
const name = props.productName || ''
return code + ' �� ' + name + ' �� 国家服务价格'
return code + ' · ' + name + ' · 国家服务价格'
})
const hint = '黄色行=已改价;点编辑图标后修改,失焦即刻写入数据库。单位:运费 RMB/KG,挂号费 RMB/票。'
const phSearch = '搜索国家/分区'
@@ -0,0 +1,136 @@
<template>
<div class="price-edit-panel" v-loading="loading">
<div class="panel-head">
<div class="panel-title">
<el-button link type="primary" @click="close">
<el-icon><arrow-left /></el-icon>
返回详情
</el-button>
<i class="panel-bar" />
<span>{{ title }}</span>
</div>
<div class="panel-actions">
<el-button @click="close">关闭</el-button>
<el-button type="primary" :disabled="!priceSetId" @click="close">完成</el-button>
</div>
</div>
<div class="panel-body">
<step-details
v-if="loaded"
:details="details"
:price-set-id="priceSetId"
:set-type="setType"
:effective-time="version.effectiveTime"
:version-no="version.versionNo"
:ref-data="refData"
header-title="编辑产品价格"
/>
</div>
</div>
</template>
<script setup name="PriceEditPanel">
import { ArrowLeft } from '@element-plus/icons-vue'
import StepDetails from './StepDetails.vue'
import { usePriceSetRefData, useDetailCascade } from '../../composables/usePriceSetRefData'
import { getPriceSet } from '@/api/price/set'
const props = defineProps({
priceSetId: { type: [Number, String], default: undefined },
psvId: { type: [Number, String], default: undefined }
})
const emit = defineEmits(['close'])
const { proxy } = getCurrentInstance()
const refData = usePriceSetRefData()
const cascade = useDetailCascade(refData)
const loading = ref(false)
const loaded = ref(false)
const setType = ref('FIXED')
const version = reactive({ psvId: undefined, versionNo: 'V1', effectiveTime: undefined })
const details = ref([])
const title = computed(() => '编辑产品价格 · ' + (version.versionNo || ''))
function load() {
const id = props.priceSetId
if (!id) {
proxy.$modal.msgError('缺少套餐ID')
return
}
loading.value = true
loaded.value = false
getPriceSet(id).then(res => {
const data = res.data || {}
setType.value = data.setType || 'FIXED'
const versions = data.versions || []
const qPsv = props.psvId
const byQuery = qPsv != null ? versions.find(v => String(v.psvId) === String(qPsv)) : null
const current = byQuery || data.version || versions[0] || {}
version.psvId = current.psvId
version.versionNo = current.versionNo || 'V1'
version.effectiveTime = current.effectiveTime
const src = (current.details && current.details.length) ? current.details : (data.details || [])
details.value = src.map(d => cascade.hydrateRow(d, setType.value))
loaded.value = true
}).finally(() => {
loading.value = false
})
}
function close() {
emit('close')
}
onMounted(() => {
refData.loadProducts().finally(load)
})
</script>
<style scoped>
.price-edit-panel {
background: #fff;
border: 1px solid #e4e7ed;
border-radius: 8px;
margin-bottom: 16px;
}
.panel-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 16px;
border-bottom: 1px solid #ebeef5;
}
.panel-title {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.panel-bar {
width: 3px;
height: 14px;
border-radius: 2px;
background: #1890ff;
flex: none;
}
.panel-title span {
font-size: 15px;
font-weight: 600;
color: #303133;
}
.panel-actions {
flex: none;
display: flex;
align-items: center;
gap: 8px;
}
.panel-body {
padding: 16px;
}</style>
@@ -105,7 +105,8 @@ const props = defineProps({
setType: { type: String, default: 'FIXED' },
effectiveTime: { type: String, default: undefined },
versionNo: { type: String, default: '' },
refData: { type: Object, required: true }
refData: { type: Object, required: true },
headerTitle: { type: String, default: '第 2 步 · 编辑产品价格' }
})
const { proxy } = getCurrentInstance()
@@ -113,7 +114,6 @@ const { bms_tax_mode } = useDict('bms_tax_mode')
const { hydrateRow } = useDetailCascade(props.refData)
const loadingText = '正在全量拉取产品价格…'
const headerTitle = '第 2 步 · 编辑产品价格'
const phKeyword = '产品代码/名称'
const phTax = '全部税模式'
const colCode = '产品代码'
@@ -9,10 +9,26 @@
<div class="drawer-body" v-loading="loading">
<div class="toolbar">
<el-input
v-model="query.keyword"
v-model="query.productKeyword"
clearable
:placeholder="phSearch"
style="width: 280px"
:placeholder="phProduct"
style="width: 160px"
@keyup.enter="search"
/>
<el-input
v-if="isFixed"
v-model="query.countryKeyword"
clearable
:placeholder="phCountry"
style="width: 140px"
@keyup.enter="search"
/>
<el-input
v-if="isFixed"
v-model="query.zoneKeyword"
clearable
:placeholder="phZone"
style="width: 140px"
@keyup.enter="search"
/>
<el-button type="primary" @click="search">查询</el-button>
@@ -111,10 +127,14 @@ const total = ref(0)
const query = reactive({
pageNum: 1,
pageSize: 20,
keyword: ''
productKeyword: '',
countryKeyword: '',
zoneKeyword: ''
})
const phSearch = '产品/国家/分区/重量段'
const phProduct = '产品代码/名称'
const phCountry = '国家'
const phZone = '分区'
const colProduct = '产品'
const colCountry = '国家'
const colZone = '分区'
@@ -147,7 +167,9 @@ function search() {
}
function reset() {
query.keyword = ''
query.productKeyword = ''
query.countryKeyword = ''
query.zoneKeyword = ''
query.pageNum = 1
load()
}
@@ -162,7 +184,9 @@ function load() {
loading.value = true
listSetDetail({
psvId,
keyword: query.keyword || undefined,
productKeyword: query.productKeyword || undefined,
countryKeyword: isFixed.value ? (query.countryKeyword || undefined) : undefined,
zoneKeyword: isFixed.value ? (query.zoneKeyword || undefined) : undefined,
pageNum: query.pageNum,
pageSize: query.pageSize
}).then(res => {
@@ -178,7 +202,9 @@ watch(
([open]) => {
if (open) {
query.pageNum = 1
query.keyword = ''
query.productKeyword = ''
query.countryKeyword = ''
query.zoneKeyword = ''
load()
}
}
@@ -197,6 +223,7 @@ watch(
gap: 8px;
margin-bottom: 12px;
flex-wrap: wrap;
align-items: center;
}
.pager {
margin-top: 12px;