This commit is contained in:
van
2026-04-30 17:53:34 +08:00
parent 77712048d4
commit 9e0d9dda48
2 changed files with 74 additions and 2 deletions

View File

@@ -11,6 +11,14 @@ export function listJDOrders(query) {
})
}
/** 快捷录单页:型号及该型号最近一次订单的付款/后返 */
export function listQuickRecordModelOptions() {
return request({
url: '/system/jdorder/quickRecord/modelOptions',
method: 'get'
})
}
// JD订单详情
export function getJDOrder(id) {
return request({

View File

@@ -14,7 +14,23 @@
</div>
</el-form-item>
<el-form-item label="型号" required>
<el-input v-model="form.model" placeholder="必填" clearable />
<el-select
v-model="form.model"
class="model-select-full"
filterable
allow-create
default-first-option
clearable
placeholder="必选或输入新型号;从历史单选时将带出最近一单付款 / 后返"
@change="onModelChange"
>
<el-option
v-for="item in modelOptions"
:key="item.modelNumber"
:label="modelOptionLabel(item)"
:value="item.modelNumber"
/>
</el-select>
</el-form-item>
<el-form-item label="下单地址" required>
<el-input
@@ -90,6 +106,7 @@
<script>
import { executeInstruction, executeInstructionWithForce } from '@/api/system/instruction'
import { listQuickRecordModelOptions } from '@/api/system/jdorder'
export default {
name: 'FadanQuickRecord',
@@ -121,9 +138,13 @@ export default {
verifyInput: '',
verifyMessage: '',
verifyLoading: false,
pendingCommand: ''
pendingCommand: '',
modelOptions: []
}
},
mounted() {
this.loadModelOptions()
},
computed: {
dialogWidth() {
return this.isMobile ? '92%' : '480px'
@@ -151,6 +172,40 @@ export default {
normalizeAddressField() {
this.form.address = this.compressAddressOneLine(this.form.address)
},
formatMoneyText(v) {
if (v == null || v === '') return ''
const n = Number(v)
if (!Number.isFinite(n)) return ''
return n.toFixed(2)
},
modelOptionLabel(row) {
if (!row || !row.modelNumber) return ''
const p = this.formatMoneyText(row.lastPaymentAmount)
const r = this.formatMoneyText(row.lastRebateAmount)
if (!p && !r) return row.modelNumber
return `${row.modelNumber}(付款 ${p || '—'} / 后返 ${r || '—'}`
},
async loadModelOptions() {
try {
const res = await listQuickRecordModelOptions()
if (!(res && (res.code === 200 || res.msg === '操作成功'))) {
return
}
this.modelOptions = Array.isArray(res.data) ? res.data : []
} catch (e) {
// 静默失败,不影响手输型号
}
},
onModelChange(val) {
const key = (val != null ? String(val) : '').trim()
if (!key) return
const hit = this.modelOptions.find(o => o && String(o.modelNumber || '').trim() === key)
if (!hit) return
const payRaw = hit.lastPaymentAmount
const rebateRaw = hit.lastRebateAmount
this.form.paymentText = payRaw != null && payRaw !== '' ? this.formatMoneyText(payRaw) : ''
this.form.rebateText = rebateRaw != null && rebateRaw !== '' ? this.formatMoneyText(rebateRaw) : ''
},
buildCommand() {
const mark = this.buildDistributionMark()
const model = (this.form.model || '').trim()
@@ -444,6 +499,15 @@ export default {
min-width: 0;
}
.model-select-full {
width: 100%;
}
.model-select-full ::v-deep .el-input__inner,
.model-select-full ::v-deep .el-input__prefix {
line-height: normal;
}
.btn-row {
display: flex;
flex-wrap: wrap;