Merge branch 'test'
This commit is contained in:
@@ -86,6 +86,15 @@ export function updatePriceSet(data) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Update package name and note only. */
|
||||
export function updatePriceSetBasic(data) {
|
||||
return request({
|
||||
url: '/price/set/basic',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function delPriceSet(priceSetIds) {
|
||||
return request({
|
||||
url: '/price/set/' + priceSetIds,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.7 KiB |
@@ -197,7 +197,11 @@ export const dynamicRoutes = [
|
||||
path: 'index',
|
||||
component: () => import('@/views/customersuppliermanagement/supplierinfo/supplieredit/index.vue'),
|
||||
name: 'SupplierEdit',
|
||||
meta: { title: '供应商编辑', activeMenu: '/customersuppliermanagement/supplierinfo' }
|
||||
// 高亮地址跟菜单走。供应商目录 path 曾被写成 "1",列表实际是 /1/supplierinfo,写死客户管理目录会对不上。
|
||||
beforeEnter(to) {
|
||||
to.meta.activeMenu = supplierListPath()
|
||||
},
|
||||
meta: { title: '供应商编辑', activeMenu: '/supplier/supplierinfo' }
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -264,4 +268,13 @@ const router = createRouter({
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* 供应商列表的真实地址由菜单注册,不写死目录。
|
||||
* 当前库里「供应商管理」目录 path 若仍是 1,这里会得到 /1/supplierinfo。
|
||||
*/
|
||||
export function supplierListPath() {
|
||||
const hit = router.getRoutes().find(r => /\/supplierinfo$/.test(r.path))
|
||||
return hit ? hit.path : '/supplier/supplierinfo'
|
||||
}
|
||||
|
||||
export default router
|
||||
|
||||
@@ -622,6 +622,7 @@ import { getToken } from '@/utils/auth'
|
||||
import axios from 'axios'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { useChannels, parseChannelCodes } from '@/components/ChannelSelect/useChannels'
|
||||
import { supplierListPath } from '@/router'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const route = useRoute()
|
||||
@@ -1063,7 +1064,8 @@ function submitForm() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
router.push({ path: '/customersuppliermanagement/supplierinfo' })
|
||||
// 关闭编辑页并回到已注册的供应商列表。菜单目录 path 是 1 时列表为 /1/supplierinfo,不能回到客户管理那条不存在的地址。
|
||||
proxy.$tab.closeOpenPage({ path: supplierListPath() })
|
||||
}
|
||||
|
||||
/* ============ 初始化 ============ */
|
||||
|
||||
@@ -118,7 +118,20 @@ const colSurcharge = '附加费'
|
||||
const colAction = '操作'
|
||||
|
||||
function cellKey(row, field) {
|
||||
return String(row && row.psdId != null ? row.psdId : row && row.productCountryId) + ':' + field
|
||||
if (!row) return 'none:' + field
|
||||
// Prefer DB id; local Excel draft uses _localKey (psdId cleared in applyLocalDraft).
|
||||
if (row.psdId != null && row.psdId !== '') return String(row.psdId) + ':' + field
|
||||
if (row._localKey) return String(row._localKey) + ':' + field
|
||||
const parts = [
|
||||
row.productCode,
|
||||
row.countryCode || row.countryName,
|
||||
row.zoneCode || row.zoneName,
|
||||
row.weightLabel,
|
||||
row.weightMin,
|
||||
row.weightMax,
|
||||
row.productCountryId
|
||||
]
|
||||
return parts.map(v => (v == null ? '' : String(v))).join('|') + ':' + field
|
||||
}
|
||||
|
||||
function formatNum(v, precision) {
|
||||
@@ -150,7 +163,8 @@ async function commitEdit(row, field) {
|
||||
editingKey.value = ''
|
||||
try {
|
||||
if (!row) return
|
||||
if (!row.psdId) return
|
||||
// Always emit: create/IMPORT_FRESH local draft has no psdId until finish;
|
||||
// parent persist path decides DB write vs local-only.
|
||||
emit('row-change', row)
|
||||
} finally {
|
||||
committing.value = false
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
<el-form ref="formRef" :model="basic" :rules="rules" label-width="120px" class="max-form">
|
||||
<el-form-item label="套餐名称" prop="priceSetName">
|
||||
<el-input v-model="basic.priceSetName" maxlength="50" placeholder="如:金牌电商专属套餐" />
|
||||
<div class="form-hint">显示给客户的套餐对外名称</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="说明备注" prop="priceSetNote">
|
||||
<el-input v-model="basic.priceSetNote" type="textarea" :rows="3" maxlength="200" placeholder="套餐业务说明,显示给客户与运营" />
|
||||
<el-input v-model="basic.priceSetNote" type="textarea" :rows="3" maxlength="200" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
@@ -890,7 +890,10 @@ async function onRowPriceChange(row) {
|
||||
proxy.$modal.msgSuccess('价格已更新(完成时统一落库)')
|
||||
return
|
||||
}
|
||||
if (!row.psdId) return
|
||||
if (!row.psdId) {
|
||||
proxy.$modal.msgWarning('明细尚未落库,请先点「完成」保存后再改价')
|
||||
return
|
||||
}
|
||||
const prevFv = row._editPrevFv
|
||||
const prevReg = row._editPrevReg
|
||||
try {
|
||||
@@ -899,6 +902,7 @@ async function onRowPriceChange(row) {
|
||||
} catch (e) {
|
||||
if (prevFv !== undefined) row.fvValue = prevFv
|
||||
if (prevReg !== undefined) row.fvRegistrationFee = prevReg
|
||||
proxy.$modal.msgError((e && e.message) ? e.message : '价格更新失败')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,17 @@
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template #search-customerId="{ model }">
|
||||
<customer-select
|
||||
v-model="model.customerId"
|
||||
option-select
|
||||
remote-search
|
||||
:page-size="20"
|
||||
placeholder="客户名称 / 代码"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #col-setType="{ row }">
|
||||
<el-tag :type="row.setType === 'FIXED' ? 'warning' : 'primary'" size="small" effect="plain">
|
||||
{{ row.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}
|
||||
@@ -29,6 +40,12 @@
|
||||
<el-tag :type="statusTag(row)" size="small">{{ statusLabel(row) }}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #col-boundCustomers="{ row }">
|
||||
<span v-if="row.boundCustomers">{{ row.boundCustomers }}</span>
|
||||
<span v-else class="text-muted">-</span>
|
||||
<el-tag v-if="row.customerCount > 0" size="small" type="info" effect="plain" class="cust-count">{{ row.customerCount }}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #col-activeDetail="{ row }">
|
||||
<el-button
|
||||
link
|
||||
@@ -41,6 +58,7 @@
|
||||
|
||||
<template #col-action="{ row }">
|
||||
<el-button link type="primary" @click="handleDetail(row)" v-hasPermi="['price:set:query']">详情</el-button>
|
||||
<el-button link type="primary" @click="openBasicEdit(row)" v-hasPermi="['price:set:edit']">修改</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'E'"
|
||||
link
|
||||
@@ -58,6 +76,24 @@
|
||||
</template>
|
||||
</basic-table>
|
||||
|
||||
<el-dialog v-model="basicDialog.visible" :title="basicDialogTitle" width="520px" append-to-body destroy-on-close>
|
||||
<el-form ref="basicFormRef" :model="basicForm" :rules="basicRules" label-width="96px">
|
||||
<el-form-item label="套餐编码">
|
||||
<el-input :model-value="basicForm.priceSetCode" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="套餐名称" prop="priceSetName">
|
||||
<el-input v-model="basicForm.priceSetName" maxlength="50" show-word-limit placeholder="请输入套餐名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="说明备注" prop="priceSetNote">
|
||||
<el-input v-model="basicForm.priceSetNote" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="可选" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="basicDialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="basicDialog.saving" @click="submitBasicEdit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<set-version-detail-drawer
|
||||
v-model="drawerVisible"
|
||||
:version="activeVersion"
|
||||
@@ -69,9 +105,10 @@
|
||||
|
||||
<script setup name="PriceSet">
|
||||
import {
|
||||
listPriceSet, disablePriceSet, enablePriceSet, copyPriceSet, getPriceSet
|
||||
listPriceSet, disablePriceSet, enablePriceSet, copyPriceSet, getPriceSet, updatePriceSetBasic
|
||||
} from '@/api/price/set'
|
||||
import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.vue'
|
||||
import CustomerSelect from '@/components/CustomerSelect/index.vue'
|
||||
import { setStatusLabel, setStatusTagType } from './utils/priceSet'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -79,17 +116,6 @@ const tableRef = ref()
|
||||
const isFirstActivate = ref(true)
|
||||
|
||||
const searchColumns = [
|
||||
{
|
||||
label: '类型',
|
||||
prop: 'setType',
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: 'FIXED 固定价', value: 'FIXED' },
|
||||
{ label: 'DISCOUNT 折扣', value: 'DISCOUNT' }
|
||||
],
|
||||
placeholder: '全部类型',
|
||||
width: '160px'
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
@@ -102,17 +128,19 @@ const searchColumns = [
|
||||
placeholder: '全部状态',
|
||||
width: '140px'
|
||||
},
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐ID / 名称 / 客户', width: '240px' }
|
||||
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐编码 / 名称', width: '200px' },
|
||||
{ label: '客户', prop: 'customerId', placeholder: '客户名称 / 代码', width: '240px' }
|
||||
]
|
||||
|
||||
const columns = [
|
||||
{ label: '套餐编码', prop: 'priceSetCode', width: 110 },
|
||||
{ label: '套餐名称', prop: 'priceSetName', minWidth: 160 },
|
||||
{ label: '类型', prop: 'setType', width: 140 },
|
||||
{ label: '说明', prop: 'priceSetNote', minWidth: 160 },
|
||||
{ label: '绑定客户', prop: 'boundCustomers', minWidth: 220 },
|
||||
{ label: '说明', prop: 'priceSetNote', minWidth: 140 },
|
||||
{ label: '状态', prop: 'status', width: 90 },
|
||||
{ label: '生效明细', prop: 'activeDetail', width: 100 },
|
||||
{ label: '操作', prop: 'action', width: 160, showInToolbar: false }
|
||||
{ label: '操作', prop: 'action', width: 200, showInToolbar: false }
|
||||
]
|
||||
|
||||
function queryList(params) {
|
||||
@@ -135,6 +163,49 @@ function handleDetail(row) {
|
||||
proxy.$router.push({ path: '/customer/setDetail', query: { priceSetId: row.priceSetId } })
|
||||
}
|
||||
|
||||
|
||||
const basicDialog = reactive({ visible: false, saving: false })
|
||||
const basicFormRef = ref()
|
||||
const basicForm = reactive({
|
||||
priceSetId: null,
|
||||
priceSetCode: '',
|
||||
priceSetName: '',
|
||||
priceSetNote: ''
|
||||
})
|
||||
const basicRules = {
|
||||
priceSetName: [{ required: true, message: '套餐名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
const basicDialogTitle = computed(() => '修改套餐基本信息')
|
||||
|
||||
function openBasicEdit(row) {
|
||||
if (!row || row.priceSetId == null) return
|
||||
basicForm.priceSetId = row.priceSetId
|
||||
basicForm.priceSetCode = row.priceSetCode || ''
|
||||
basicForm.priceSetName = row.priceSetName || ''
|
||||
basicForm.priceSetNote = row.priceSetNote || ''
|
||||
basicDialog.visible = true
|
||||
nextTick(() => basicFormRef.value && basicFormRef.value.clearValidate())
|
||||
}
|
||||
|
||||
function submitBasicEdit() {
|
||||
basicFormRef.value.validate(valid => {
|
||||
if (!valid) return
|
||||
basicDialog.saving = true
|
||||
updatePriceSetBasic({
|
||||
priceSetId: basicForm.priceSetId,
|
||||
priceSetName: basicForm.priceSetName,
|
||||
priceSetNote: basicForm.priceSetNote
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
basicDialog.visible = false
|
||||
refresh()
|
||||
}).finally(() => {
|
||||
basicDialog.saving = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/** 生效明细:拉详情找生效版本(status=1)弹抽屉 */
|
||||
const drawerVisible = ref(false)
|
||||
const activeVersion = ref(null)
|
||||
@@ -200,6 +271,8 @@ function handleCopy(row) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.text-muted { color: #909399; }
|
||||
.cust-count { margin-left: 6px; vertical-align: middle; }
|
||||
.hint-card {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user