This commit is contained in:
van
2026-04-10 00:29:10 +08:00
parent 416a7d77f5
commit 5e7b213497
4 changed files with 338 additions and 61 deletions
@@ -17,13 +17,24 @@
<el-input v-model="form.model" placeholder="必填" clearable />
</el-form-item>
<el-form-item label="下单地址" required>
<el-input v-model="form.address" type="textarea" :rows="3" placeholder="必填,与中控「生」指令第 6 行一致" clearable />
<el-input
v-model="form.address"
type="textarea"
:rows="2"
placeholder="必填;可粘贴多行,失焦或点击录单时会压成一行(去逗号、多空格合并)"
clearable
@blur="normalizeAddressField"
/>
</el-form-item>
<el-form-item label="转链链接(可空)">
<el-input v-model="form.link" type="textarea" :rows="2" placeholder="可空;留空则后台按型号尝试自动填充京粉链接" clearable />
</el-form-item>
<el-form-item label="数量">
<el-input-number v-model="form.qty" :min="1" :max="99" controls-position="right" :style="qtyInputStyle" />
<el-form-item label="第三方单号(选填)">
<el-input
v-model="form.thirdPartyOrderNoText"
placeholder="选填;写入录单文案「第三方单号:」行,可覆盖「生」自动带出内容"
clearable
/>
</el-form-item>
<el-divider content-position="left">落库必填(与中控录单一致)</el-divider>
@@ -95,7 +106,7 @@ export default {
model: '',
address: '',
link: '',
qty: 1,
thirdPartyOrderNoText: '',
buyer: '',
paymentText: '',
rebateText: '',
@@ -116,11 +127,6 @@ export default {
computed: {
dialogWidth() {
return this.isMobile ? '92%' : '480px'
},
qtyInputStyle() {
return this.isMobile
? { width: '100%' }
: { width: '200px' }
}
},
methods: {
@@ -142,10 +148,14 @@ export default {
.replace(/\s+/g, ' ')
.trim()
},
normalizeAddressField() {
this.form.address = this.compressAddressOneLine(this.form.address)
},
buildCommand() {
const mark = this.buildDistributionMark()
const model = (this.form.model || '').trim()
const address = this.compressAddressOneLine(this.form.address)
this.normalizeAddressField()
const address = (this.form.address || '').trim()
if (!model) {
this.$modal.msgError('请填写型号')
return null
@@ -155,8 +165,7 @@ export default {
return null
}
const link = (this.form.link || '').trim()
const qty = Number(this.form.qty) > 0 ? Number(this.form.qty) : 1
const lines = ['生', mark, model, link, String(qty), address]
const lines = ['生', mark, model, link, '1', address]
return lines.join('\n')
},
injectOptional(raw) {
@@ -167,6 +176,11 @@ export default {
const rebate = (this.form.rebateText || '').trim()
const orderId = (this.form.orderIdText || '').trim()
const logistics = (this.form.logisticsLink || '').trim()
const thirdPartyOrderNo = (this.form.thirdPartyOrderNoText || '').trim()
if (thirdPartyOrderNo) {
const re = /(第三方单号:)\n([^\n]*)\n(—————————)/g
t = t.replace(re, (_, a, _line, sep) => `${a}\n${thirdPartyOrderNo}\n${sep}`)
}
if (buyer) {
t = t.replace(/(下单人(需填):)\n\n/, `$1\n${buyer}\n\n`)
}
@@ -352,7 +366,7 @@ export default {
model: '',
address: '',
link: '',
qty: 1,
thirdPartyOrderNoText: '',
buyer: '',
paymentText: '',
rebateText: '',