修改测算逻辑

This commit is contained in:
wuweihua
2026-09-18 17:09:43 +08:00
parent e08a36de91
commit bb240746a6
22 changed files with 435 additions and 44 deletions
@@ -9,8 +9,6 @@
</div>
</template>
<el-alert type="info" :closable="false" show-icon class="mb12" :title="metaText" />
<div class="filters">
<el-input v-model="query.keyword" clearable :placeholder="phKeyword" style="width: 180px" />
<el-select v-model="query.taxMode" clearable :placeholder="phTax" style="width: 140px">
@@ -148,11 +146,6 @@ const discCode = ref('')
const typeHint = computed(() => '· 当前:' + setTypeLabel(props.setType))
const metaText = computed(() => {
const ver = props.versionNo || 'V?'
return ver + ' · 数据已落库,编辑价格/附加费会立即写入数据库。'
})
const productGroups = computed(() => {
const map = new Map()
for (const d of props.details) {
@@ -8,29 +8,47 @@
>
<div class="drawer-body" v-loading="loading">
<div class="toolbar">
<el-input
<el-select
v-model="query.productKeyword"
filterable
clearable
:placeholder="phProduct"
style="width: 160px"
@keyup.enter="search"
/>
<el-input
:loading="optionsLoading"
style="width: 200px"
>
<el-option v-for="p in optionProducts" :key="p.code" :label="p.label" :value="p.code">
<span class="opt-name">{{ p.name }}</span>
<span class="opt-code">{{ p.code }}</span>
</el-option>
</el-select>
<el-select
v-if="isFixed"
v-model="query.countryKeyword"
filterable
clearable
:placeholder="phCountry"
style="width: 140px"
@keyup.enter="search"
/>
<el-input
:loading="optionsLoading"
style="width: 160px"
>
<el-option v-for="c in optionCountries" :key="c.key" :label="c.label" :value="c.value">
<span class="opt-name">{{ c.name }}</span>
<span class="opt-code">{{ c.code }}</span>
</el-option>
</el-select>
<el-select
v-if="isFixed"
v-model="query.zoneKeyword"
filterable
clearable
:placeholder="phZone"
style="width: 140px"
@keyup.enter="search"
/>
:loading="optionsLoading"
style="width: 160px"
>
<el-option v-for="z in optionZones" :key="z.key" :label="z.label" :value="z.value">
<span class="opt-name">{{ z.name }}</span>
<span class="opt-code">{{ z.code }}</span>
</el-option>
</el-select>
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
@@ -110,7 +128,7 @@
<script setup name="SetVersionDetailDrawer">
import SurchargeTags from '../SurchargeTags.vue'
import { isFixedType } from '../../utils/priceSet'
import { listSetDetail } from '@/api/price/set'
import { listSetDetail, listSetDetailOptions } from '@/api/price/set'
const props = defineProps({
modelValue: { type: Boolean, default: false },
@@ -132,7 +150,48 @@ const query = reactive({
zoneKeyword: ''
})
const phProduct = '产品代码/名称'
// 下拉选项:当前版本内去重后的 产品/国家/分区
const optionsLoading = ref(false)
const optionProducts = ref([])
const optionCountries = ref([])
const optionZones = ref([])
function loadOptions() {
const psvId = props.version && props.version.psvId
if (!psvId) {
optionProducts.value = []
optionCountries.value = []
optionZones.value = []
return
}
optionsLoading.value = true
listSetDetailOptions(psvId).then(res => {
const data = res.data || {}
optionProducts.value = (data.products || []).map(p => ({
code: p.code,
name: p.name || p.code,
label: (p.name && p.name !== p.code) ? `${p.code} ${p.name}` : p.code
}))
optionCountries.value = (data.countries || []).map(c => ({
key: c.code || c.name,
code: c.code || '-',
name: c.name || c.code,
value: c.code || c.name, // 有代码按代码搜,否则按名称搜(后端 code/name 双 LIKE)
label: (c.name && c.code) ? `${c.name} ${c.code}` : (c.name || c.code)
}))
optionZones.value = (data.zones || []).map(z => ({
key: z.code || z.name,
code: z.code || '-',
name: z.name || z.code,
value: z.code || z.name,
label: (z.name && z.code) ? `${z.name} ${z.code}` : (z.name || z.code)
}))
}).finally(() => {
optionsLoading.value = false
})
}
const phProduct = '产品'
const phCountry = '国家'
const phZone = '分区'
const colProduct = '产品'
@@ -205,6 +264,7 @@ watch(
query.productKeyword = ''
query.countryKeyword = ''
query.zoneKeyword = ''
loadOptions()
load()
}
}
@@ -242,6 +302,13 @@ watch(
padding: 0 6px;
}
.p-name { color: #303133; }
.opt-name { margin-right: 8px; }
.opt-code {
float: right;
color: var(--el-text-color-secondary);
font-size: 12px;
font-family: Consolas, Monaco, monospace;
}
.hl { color: #1890ff; font-weight: 600; }
.reg { color: #d48806; font-weight: 600; }
.pct { color: #1890ff; font-weight: 600; }
@@ -28,7 +28,7 @@
<el-table-column :label="colRows" width="100" align="center">
<template #default="{ row }">{{ detailCount(row) }}</template>
</el-table-column>
<el-table-column :label="colAction" width="320" align="center" fixed="right">
<el-table-column :label="colAction" width="360" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="primary" @click="openDetails(row)">查看详情</el-button>
<el-button
@@ -38,6 +38,12 @@
@click="emit('edit', row)"
v-hasPermi="['price:set:edit']"
>继续配置</el-button>
<el-button
link
type="warning"
@click="emit('edit', row)"
v-hasPermi="['price:set:forceEdit']"
>编辑</el-button>
<el-button
v-if="isDraftVersion(row)"
link
@@ -99,8 +105,8 @@ function tabLabel(key) {
all: '全部',
'0': '草稿',
'3': '待生效',
'1': '生效',
'2': '失效'
'1': '已生效',
'2': '已失效'
}
return labels[key] + ' (' + (counts.value[key] || 0) + ')'
}