From 9e0d9dda48b26284f71ab8e10ba85582d2731859 Mon Sep 17 00:00:00 2001 From: van Date: Thu, 30 Apr 2026 17:53:34 +0800 Subject: [PATCH] 1 --- src/api/system/jdorder.js | 8 +++ .../jd-instruction/fadan-quick-record.vue | 68 ++++++++++++++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/src/api/system/jdorder.js b/src/api/system/jdorder.js index a45838f..10a3fc5 100644 --- a/src/api/system/jdorder.js +++ b/src/api/system/jdorder.js @@ -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({ diff --git a/src/views/system/jd-instruction/fadan-quick-record.vue b/src/views/system/jd-instruction/fadan-quick-record.vue index b9d1563..ed1da42 100644 --- a/src/views/system/jd-instruction/fadan-quick-record.vue +++ b/src/views/system/jd-instruction/fadan-quick-record.vue @@ -14,7 +14,23 @@ - + + + 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;