导入新产品,20.套餐编辑的时候,不能低于基准价,低于就提示不能保存

This commit is contained in:
wuweihua
2026-09-21 15:11:25 +08:00
committed by luojiaquan
parent 7ed03da9af
commit bbb312f49b
11 changed files with 739 additions and 11 deletions
@@ -115,7 +115,7 @@ const columns = [
{ prop: 'effectiveDate', label: '生效日期', width: 110, align: 'center' },
{ prop: 'expireDate', label: '失效日期', width: 110, align: 'center', formatter: (row) => row.expireDate || '长期' },
{ prop: 'status', label: '状态', width: 90, align: 'center', dict: 'bms_product_effect_status' },
{ prop: 'action', label: '操作', width: 70, fixed: 'right', slot: 'action' }
// { prop: 'action', label: '操作', width: 70, fixed: 'right', slot: 'action' }
]
const visible = ref(false)
@@ -5,7 +5,7 @@
:closable="false"
show-icon
class="mb16"
title="Excel 导入:相同产品代码+生效日期不覆盖;不同生效日期新增一条产品。同时入库国家×重量段(运费/挂号费/尺寸/尾程/时效)。"
title="多国家价表用「导入 Excel」。单国专线成本价用「按国家导入」:先选目的国家,目录里的产品都记到该国。相同产品代码+生效日期不覆盖主数据。"
/>
<basic-table
@@ -25,6 +25,9 @@
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['price:product:import']">导入 Excel</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleCountryImport" v-hasPermi="['price:product:import']">按国家导入</el-button>
</el-col>
</template>
<template #col-cargoAttr="{ row }">
@@ -53,6 +56,32 @@
:show-update-support="false"
@success="() => tableRef.refresh()"
/>
<excel-import-dialog
ref="countryImportRef"
title="按国家导入"
action="/price/product/importCountryData"
width="560px"
:show-update-support="false"
:extra-query="countryImportQuery"
:before-submit="validateCountryImport"
:import-desc="countryImportDesc"
@success="() => tableRef.refresh()"
>
<template #extra>
<el-form label-width="90px">
<el-form-item label="目的国家" required>
<el-select v-model="importCountryCode" filterable clearable placeholder="请选择国家" style="width: 100%">
<el-option
v-for="item in regionOptions"
:key="item.countryCode2"
:label="regionLabel(item)"
:value="item.countryCode2"
/>
</el-select>
</el-form-item>
</el-form>
</template>
</excel-import-dialog>
</div>
</template>
@@ -62,6 +91,7 @@ import ProductFormDialog from './components/ProductFormDialog.vue'
import ProductCountryDrawer from './components/ProductCountryDrawer.vue'
import ProductSurchargeDrawer from './components/ProductSurchargeDrawer.vue'
import { listProduct } from '@/api/price/product'
import { listRegionOptions } from '@/api/data/region'
const { proxy } = getCurrentInstance()
const { bms_product_effect_status } = useDict('bms_product_effect_status')
@@ -71,6 +101,14 @@ const formRef = ref()
const countryRef = ref()
const surchargeRef = ref()
const importRef = ref()
const countryImportRef = ref()
const importCountryCode = ref('')
const regionOptions = ref([])
const countryImportQuery = computed(() => ({ countryCode: importCountryCode.value }))
const countryImportDesc = [
'选择目的国家后上传专线成本价表,目录中的产品都会记到该国家。',
'邮编、赔偿标准等 sheet 不导入。相同产品代码+生效日期不覆盖主数据,重量段按生效日写入。'
]
const columns = [
{ prop: 'productCode', label: '产品代码', minWidth: 110 },
@@ -120,6 +158,32 @@ function handleUpdate(row) {
function handleImport() {
importRef.value.open()
}
function regionLabel(item) {
const name = item.countryNameCn || item.countryNameEn || ''
const code = item.countryCode2 || ''
return name && code ? name + ' (' + code + ')' : (name || code)
}
function loadRegionOptions() {
if (regionOptions.value.length) return
listRegionOptions().then(res => {
regionOptions.value = res.data || []
})
}
function handleCountryImport() {
importCountryCode.value = ''
loadRegionOptions()
countryImportRef.value.open()
}
function validateCountryImport() {
if (!importCountryCode.value) {
return '请先选择目的国家'
}
return ''
}
</script>
<style scoped>