This commit is contained in:
van
2026-09-06 21:08:29 +08:00
parent 7c6e701e97
commit d5a774e103
@@ -7,13 +7,22 @@
<el-form :model="form" label-position="top" class="fadan-form"> <el-form :model="form" label-position="top" class="fadan-form">
<el-form-item label="分销标记"> <el-form-item label="分销标记">
<div class="mark-row"> <div class="mark-row">
<span class="mark-prefix" aria-hidden="true">F-</span> <span v-if="!form.markFull" class="mark-prefix" aria-hidden="true">F-</span>
<el-input <el-input
v-if="!form.markFull"
v-model="form.markSuffix" v-model="form.markSuffix"
class="mark-suffix-input" class="mark-suffix-input"
placeholder="后缀,如 李旭、闲鱼;留空则仅为 F" placeholder="后缀,如 李旭、闲鱼;留空则仅为 F"
clearable clearable
/> />
<el-input
v-else
v-model="form.markFull"
class="mark-suffix-input"
placeholder="完整分销标记,如 H-TF"
clearable
@clear="form.markFull = ''"
/>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="型号" required> <el-form-item label="型号" required>
@@ -239,6 +248,7 @@ export default {
return { return {
form: { form: {
markSuffix: '', markSuffix: '',
markFull: '',
model: '', model: '',
shopPrefix: '', shopPrefix: '',
address: '', address: '',
@@ -335,6 +345,10 @@ export default {
} }
}, },
buildDistributionMark() { buildDistributionMark() {
const full = (this.form.markFull || '').trim()
if (full) {
return full
}
let s = (this.form.markSuffix || '').trim() let s = (this.form.markSuffix || '').trim()
if (s.startsWith('-')) { if (s.startsWith('-')) {
s = s.slice(1).trim() s = s.slice(1).trim()
@@ -705,6 +719,7 @@ export default {
resetForm() { resetForm() {
this.form = { this.form = {
markSuffix: '', markSuffix: '',
markFull: '',
model: '', model: '',
shopPrefix: '', shopPrefix: '',
address: '', address: '',
@@ -963,19 +978,21 @@ export default {
}, },
applyMarkSuffixFromText(mark) { applyMarkSuffixFromText(mark) {
const v = String(mark || '').trim() const v = String(mark || '').trim()
this.form.markFull = ''
this.form.markSuffix = ''
if (!v || v === 'F') { if (!v || v === 'F') {
this.form.markSuffix = ''
return return
} }
if (v.startsWith('F-')) { if (v.startsWith('F-')) {
this.form.markSuffix = v.slice(2).trim() this.form.markSuffix = v.slice(2).trim()
return return
} }
if (v.startsWith('F') && v.length > 1) { if (v === 'F' || (v.startsWith('F') && v.length > 1 && !v.includes('-'))) {
this.form.markSuffix = v.slice(1).replace(/^-/, '').trim() this.form.markSuffix = v.slice(1).replace(/^-/, '').trim()
return return
} }
this.form.markSuffix = v // H-TF、PDD 等非 F 标记:原样回填,不再拼 F-
this.form.markFull = v
}, },
applyHistoryItem(row) { applyHistoryItem(row) {
if (!row) return if (!row) return