This commit is contained in:
van
2026-04-12 11:14:43 +08:00
parent d0883e8f89
commit aad1984fea

View File

@@ -351,7 +351,16 @@
</div> </div>
<div class="field-row"> <div class="field-row">
<span class="field-label">标记</span> <span class="field-label">标记</span>
<span class="field-value">{{ row.distributionMark || '-' }}</span> <div class="field-value field-value--third-party-edit">
<el-input
v-model="row.distributionMark"
size="small"
clearable
placeholder="分销标识,失焦或保存写入"
@blur="onDistributionMarkBlur(row)"
/>
<el-button type="primary" size="mini" plain @click="onDistributionMarkSave(row)">保存</el-button>
</div>
</div> </div>
<div class="field-row"> <div class="field-row">
<span class="field-label">型号</span> <span class="field-label">型号</span>
@@ -539,7 +548,18 @@
</el-table-column> </el-table-column>
<!-- 业务信息列 --> <!-- 业务信息列 -->
<el-table-column label="标记" prop="distributionMark" width="56" align="center"/> <el-table-column label="标记" prop="distributionMark" min-width="92" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.distributionMark"
size="mini"
clearable
placeholder="标识"
@blur="onDistributionMarkBlur(scope.row)"
@keyup.enter.native="onDistributionMarkBlur(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="型号" prop="modelNumber" width="140"/> <el-table-column label="型号" prop="modelNumber" width="140"/>
<el-table-column label="地址" prop="address" min-width="220" show-overflow-tooltip class-name="address-cell"> <el-table-column label="地址" prop="address" min-width="220" show-overflow-tooltip class-name="address-cell">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -1164,6 +1184,8 @@ export default {
}, },
data() { data() {
return { return {
/** 列表加载时的分销标识快照,失焦保存时与当前值比较避免重复请求 */
_distMarkBaseline: {},
loading: false, loading: false,
list: [], list: [],
total: 0, total: 0,
@@ -1431,8 +1453,13 @@ export default {
}, },
/** 列表行默认值(退款开关、利润手填标记等) */ /** 列表行默认值(退款开关、利润手填标记等) */
normalizeOrderListItem(item) { normalizeOrderListItem(item) {
const dist = this.normalizeDistributionMarkInput(item.distributionMark)
if (item.id != null) {
this.$set(this._distMarkBaseline, item.id, dist)
}
return { return {
...item, ...item,
distributionMark: dist,
isRefunded: item.isRefunded != null ? item.isRefunded : 0, isRefunded: item.isRefunded != null ? item.isRefunded : 0,
isRefundReceived: item.isRefundReceived != null ? item.isRefundReceived : 0, isRefundReceived: item.isRefundReceived != null ? item.isRefundReceived : 0,
isRebateReceived: item.isRebateReceived != null ? item.isRebateReceived : 0, isRebateReceived: item.isRebateReceived != null ? item.isRebateReceived : 0,
@@ -1444,6 +1471,7 @@ export default {
} }
}, },
assignListFromResponse(res) { assignListFromResponse(res) {
this._distMarkBaseline = {}
const list = (res.rows || res.data || []) const list = (res.rows || res.data || [])
this.list = list.map(item => this.normalizeOrderListItem(item)) this.list = list.map(item => this.normalizeOrderListItem(item))
this.total = res.total || 0 this.total = res.total || 0
@@ -1792,6 +1820,26 @@ export default {
onThirdPartyOrderNoSave(row) { onThirdPartyOrderNoSave(row) {
this.saveThirdPartyOrderNoIfFilled(row, '第三方单号已保存') this.saveThirdPartyOrderNoIfFilled(row, '第三方单号已保存')
}, },
/** 分销标识:去首尾空白、合并连续空白(与录单行习惯一致) */
normalizeDistributionMarkInput(v) {
if (v == null) return ''
return String(v).trim().replace(/\s+/g, ' ')
},
/** 分销标识失焦或点保存时写入数据库(与基线一致则不调接口) */
saveDistributionMarkIfChanged(row, successMsg) {
if (row == null || row.id == null) return
const next = this.normalizeDistributionMarkInput(row.distributionMark)
row.distributionMark = next
const base = this._distMarkBaseline[row.id] != null ? this._distMarkBaseline[row.id] : ''
if (next === base) return
this.persistOrderRow(row, successMsg)
},
onDistributionMarkBlur(row) {
this.saveDistributionMarkIfChanged(row)
},
onDistributionMarkSave(row) {
this.saveDistributionMarkIfChanged(row, '分销标识已保存')
},
onOrderSellingPriceTypeChange(row) { onOrderSellingPriceTypeChange(row) {
row.sellingPriceManual = 0 row.sellingPriceManual = 0
row.profitManual = 0 row.profitManual = 0