新增按版本获取价格设置明细的接口,优化产品下拉选项查询,更新相关服务和前端调用逻辑。

This commit is contained in:
wuweihua
2026-10-29 16:13:18 +08:00
parent 59eb4b23cc
commit c3456ca92a
14 changed files with 218 additions and 29 deletions
+9
View File
@@ -198,6 +198,15 @@ export function listSetDetailByProduct(psvId, productCode) {
})
}
/** All detail rows for a version (no pagination); one call instead of N byProduct. */
export function listSetDetailByVersion(psvId) {
return request({
url: '/price/set/detail/byVersion',
method: 'get',
params: { psvId }
})
}
/** 版本明细搜索下拉选项:按版本去重后的 产品/国家/分区 */
export function listSetDetailOptions(psvId) {
return request({
+5 -5
View File
@@ -125,7 +125,7 @@
@click="openBatchFee"
>批量增加费用</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="primary"
plain
@@ -133,7 +133,7 @@
v-hasPermi="['price:billing:chargeWeightEdit']"
@click="openChargeWeightImport"
>批量修改计费重</el-button>
</el-col> -->
</el-col>
<el-col :span="1.5">
<el-button
type="info"
@@ -164,14 +164,14 @@
</template>
<template #col-action="{ row }">
<el-button link type="primary" icon="View" @click="handleView(row)">查看</el-button>
<!-- <el-button
<el-button
link
type="primary"
icon="Edit"
:disabled="row.refundStatus === 'REFUNDED'"
v-hasPermi="['price:billing:chargeWeightEdit']"
@click="openEditChargeWeight(row)"
>改计费重</el-button> -->
>改计费重</el-button>
<el-button
link
type="danger"
@@ -461,7 +461,7 @@ const columns = [
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
{ label: '客服员', prop: 'serviceMan', minWidth: 100, showOverflowTooltip: true },
{ label: '操作', prop: 'action', align: 'center', width: 150, fixed: 'right', slot: 'action', showInToolbar: false, showOverflowTooltip: false }
{ label: '操作', prop: 'action', align: 'center', width: 240, fixed: 'right', slot: 'action', showInToolbar: false, showOverflowTooltip: false }
]
const arrearsStatusOptions = [
@@ -245,7 +245,7 @@ const columns = [
{ label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' },
{ label: '计费状态', prop: 'billingFailStatus', align: 'center', width: 140, slot: 'billingFailStatus' },
{ label: '计费时间', prop: 'bizDate', align: 'center', width: 170, parseTime: true },
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
// { label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
{ label: '提货时间', prop: 'pickupDate', align: 'center', width: 170, parseTime: true },
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
@@ -227,7 +227,7 @@ import {
surchargeAppliesToRow,
toDetailPayload
} from '../../utils/priceSet'
import { getPriceSet, listSetDetailByProduct, importSetDetailPricesAsync, pullSetDetailsFromLibraryAsync, previewPullFromLibrary, previewImportDetailPrices, updateSetDetail, updateSetDetailSurchargeAsync, delSetDetail } from '@/api/price/set'
import { getPriceSet, listSetDetailByProduct, listSetDetailByVersion, importSetDetailPricesAsync, pullSetDetailsFromLibraryAsync, previewPullFromLibrary, previewImportDetailPrices, updateSetDetail, updateSetDetailSurchargeAsync, delSetDetail } from '@/api/price/set'
import { listRegionOptions } from '@/api/data/region'
const props = defineProps({
@@ -437,12 +437,8 @@ async function loadLatestPriorVersionDraft() {
return row
})
if (!products.length) return false
const chunks = await Promise.all(products.map(p =>
listSetDetailByProduct(prior.psvId, p.productCode)
.then(r => r.data || [])
.catch(() => [])
))
applyLocalDraft(products, chunks.flat())
const detailRes = await listSetDetailByVersion(prior.psvId)
applyLocalDraft(products, detailRes.data || [])
return true
} finally {
pulling.value = false
@@ -123,9 +123,21 @@ function toEffMs(v) {
return Number.isNaN(t) ? NaN : t
}
/** Sort by effective time descending; drafts without time last. */
function sortByEffectiveTime(list) {
/** draft / pending first, then effect, then expired; within group by effective time desc. */
function statusRank(v) {
const s = String(v && v.status != null ? v.status : '')
if (s === '0') return 0
if (s === '3') return 1
if (s === '1') return 2
if (s === '2') return 3
return 9
}
function sortVersions(list) {
return (list || []).slice().sort((a, b) => {
const ra = statusRank(a)
const rb = statusRank(b)
if (ra !== rb) return ra - rb
const ta = toEffMs(a)
const tb = toEffMs(b)
const aNull = Number.isNaN(ta)
@@ -143,7 +155,7 @@ const filteredVersions = computed(() => {
const filtered = statusTab.value === 'all'
? list
: list.filter(v => String(v.status) === statusTab.value)
return sortByEffectiveTime(filtered)
return sortVersions(filtered)
})
function detailCount(row) {