修改套餐价格
This commit is contained in:
@@ -203,6 +203,7 @@ import {
|
||||
isFixedType,
|
||||
isImportBuildMode,
|
||||
isPullBuildMode,
|
||||
pickLatestPriorVersion,
|
||||
setTypeLabel,
|
||||
surchargeAppliesToRow,
|
||||
toDetailPayload
|
||||
@@ -306,8 +307,8 @@ const importDesc = computed(() => {
|
||||
}
|
||||
return [
|
||||
'适用威狮B2C小包价表(含「产品目录」)。',
|
||||
'按产品+国家覆盖:Excel 中出现的产品+国家会替换已有同范围明细,其它产品/国家保留。',
|
||||
'仅固定价套餐「导入 Excel 建价」可用;不影响导入修改价格/拉取产品库。'
|
||||
'先带出上一版全部产品;导入按「产品+国家」匹配:命中则覆盖该国家明细,未命中则新增;其它产品/国家保留。',
|
||||
'同一产品下重复国家+重量段将整单失败。仅固定价套餐「导入 Excel 建价」可用。'
|
||||
]
|
||||
})
|
||||
|
||||
@@ -324,7 +325,7 @@ const showImportAction = computed(() => hasBuildMode.value && isFixedType(props.
|
||||
const emptyTip = computed(() => {
|
||||
if (props.livePersist) return '暂无产品'
|
||||
if (isPullBuildMode(props.priceBuildMode)) return '暂无产品,请先返回上一步重新拉取或等待拉取完成'
|
||||
if (isImportBuildMode(props.priceBuildMode)) return '暂无产品,请点击右上角导入 Excel 建价'
|
||||
if (isImportBuildMode(props.priceBuildMode)) return '暂无上一版产品,请点击右上角导入 Excel 建价(按产品+国家覆盖或新增)'
|
||||
return '暂无产品,请先选择创建价格方式'
|
||||
})
|
||||
|
||||
@@ -373,6 +374,41 @@ function clearLocalDraft() {
|
||||
editGroup.value = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel build-price: preload products + details from latest prior version
|
||||
* so import can upsert by product+country.
|
||||
*/
|
||||
async function loadLatestPriorVersionDraft() {
|
||||
if (!props.priceSetId) return false
|
||||
pulling.value = true
|
||||
try {
|
||||
const res = await getPriceSet(props.priceSetId)
|
||||
const data = res.data || {}
|
||||
const versions = data.versions || []
|
||||
const prior = pickLatestPriorVersion(versions, props.psvId || resolvedPsvId.value)
|
||||
if (!prior || prior.psvId == null) return false
|
||||
const products = (prior.products || [])
|
||||
.filter(p => p && p.productCode)
|
||||
.map(p => {
|
||||
const row = { ...p }
|
||||
delete row.pspId
|
||||
delete row.psvId
|
||||
delete row.priceSetId
|
||||
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())
|
||||
return true
|
||||
} finally {
|
||||
pulling.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProductDetails(productCode, force) {
|
||||
if (!productCode) return []
|
||||
if (!force && detailByProduct[productCode]) return detailByProduct[productCode]
|
||||
@@ -987,7 +1023,7 @@ async function removeProduct(code) {
|
||||
proxy.$modal.msgSuccess('已移除产品明细')
|
||||
}
|
||||
|
||||
defineExpose({ pullAllFromLibrary, clearLocalDraft })
|
||||
defineExpose({ pullAllFromLibrary, clearLocalDraft, loadLatestPriorVersionDraft })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user