diff --git a/src/views/system/jdorder/orderList.vue b/src/views/system/jdorder/orderList.vue index e7ac228..b204bc7 100644 --- a/src/views/system/jdorder/orderList.vue +++ b/src/views/system/jdorder/orderList.vue @@ -424,7 +424,6 @@ controls-position="right" class="mobile-pricing-input" @change="onOrderPaymentOrRebateChange(row)" - @blur="onOrderPaymentOrRebateChange(row)" /> @@ -440,7 +439,6 @@ controls-position="right" class="mobile-pricing-input" @change="onOrderPaymentOrRebateChange(row)" - @blur="onOrderPaymentOrRebateChange(row)" /> @@ -456,7 +454,6 @@ controls-position="right" class="mobile-pricing-input" @change="onOrderExtraCostChange(row)" - @blur="onOrderExtraCostChange(row)" /> @@ -473,7 +470,7 @@ 售价
- + 手填
@@ -482,7 +479,7 @@ 利润
- + 手填
@@ -671,7 +668,6 @@ controls-position="right" class="jd-order-input-money jd-order-input-money--payment" @change="onOrderPaymentOrRebateChange(scope.row)" - @blur="onOrderPaymentOrRebateChange(scope.row)" /> @@ -688,7 +684,6 @@ controls-position="right" class="jd-order-input-money jd-order-input-money--rebate" @change="onOrderPaymentOrRebateChange(scope.row)" - @blur="onOrderPaymentOrRebateChange(scope.row)" /> @@ -706,21 +701,21 @@ @@ -1412,6 +1407,9 @@ export default { syncAutoProfitSeq: 0, /** 延后拉单条详情的防抖句柄(字符串 id -> timeout id) */ _patchRowTimers: null, + /** 单行 PUT 防抖(避免 change+blur 连击触发若依重复提交拦截) */ + _persistOrderTimers: null, + _persistOrderPendingMsg: null, /** 移动端卡片:当前展开的订单 id(null 表示全部收起,同时只展开一条) */ mobileExpandedOrderId: null, /** 视口高度(桌面端用于矮窗口下自动收起「跟进状态」筛选) */ @@ -1514,6 +1512,8 @@ export default { created() { this.applyMobileSlowOrderPageSize() this._patchRowTimers = {} + this._persistOrderTimers = {} + this._persistOrderPendingMsg = {} // 设置默认日期为今天 this.setDefaultDateRange() this.getListWithFallback() @@ -1555,6 +1555,9 @@ export default { if (this._patchRowTimers) { Object.keys(this._patchRowTimers).forEach(k => clearTimeout(this._patchRowTimers[k])) } + if (this._persistOrderTimers) { + Object.keys(this._persistOrderTimers).forEach(k => clearTimeout(this._persistOrderTimers[k])) + } }, methods: { onJdFilterViewportResize() { @@ -2064,13 +2067,41 @@ export default { }) .catch(() => {}) }, + /** + * 单行保存 PUT(防抖):合并短时间内的多次触发,避免 ElementUI input-number 等在失焦时与 change 叠加, + * 连续两次相同 URL 请求触发若依「请勿重复提交」。 + */ persistOrderRow(row, successMsg) { if (!row || row.id == null) { return Promise.resolve() } this.ensureMoneyFieldsForPersist(row) + const sid = String(row.id) + if (!this._persistOrderTimers) this._persistOrderTimers = {} + if (!this._persistOrderPendingMsg) this._persistOrderPendingMsg = {} + if (this._persistOrderTimers[sid]) { + clearTimeout(this._persistOrderTimers[sid]) + } + if (successMsg) { + this._persistOrderPendingMsg[sid] = successMsg + } + this._persistOrderTimers[sid] = setTimeout(() => { + this._persistOrderTimers[sid] = null + const msg = + this._persistOrderPendingMsg && this._persistOrderPendingMsg[sid] != null + ? this._persistOrderPendingMsg[sid] + : null + delete this._persistOrderPendingMsg[sid] + this.flushPersistOrderRow(row, msg) + }, 340) + }, + flushPersistOrderRow(row, successMsg) { + if (!row || row.id == null) { + return + } + this.ensureMoneyFieldsForPersist(row) this.invalidatePendingSyncAutoProfit() - return updateJDOrder(row) + updateJDOrder(row) .then(() => { if (successMsg) this.$message.success(successMsg) this.schedulePatchOrderRowFromServer(row.id)