This commit is contained in:
van
2026-05-17 16:27:41 +08:00
parent db893b5d95
commit 716fd95903

View File

@@ -424,7 +424,6 @@
controls-position="right" controls-position="right"
class="mobile-pricing-input" class="mobile-pricing-input"
@change="onOrderPaymentOrRebateChange(row)" @change="onOrderPaymentOrRebateChange(row)"
@blur="onOrderPaymentOrRebateChange(row)"
/> />
</div> </div>
</div> </div>
@@ -440,7 +439,6 @@
controls-position="right" controls-position="right"
class="mobile-pricing-input" class="mobile-pricing-input"
@change="onOrderPaymentOrRebateChange(row)" @change="onOrderPaymentOrRebateChange(row)"
@blur="onOrderPaymentOrRebateChange(row)"
/> />
</div> </div>
</div> </div>
@@ -456,7 +454,6 @@
controls-position="right" controls-position="right"
class="mobile-pricing-input" class="mobile-pricing-input"
@change="onOrderExtraCostChange(row)" @change="onOrderExtraCostChange(row)"
@blur="onOrderExtraCostChange(row)"
/> />
</div> </div>
</div> </div>
@@ -473,7 +470,7 @@
<span class="field-label">售价</span> <span class="field-label">售价</span>
<span class="field-value field-value--pricing-control"> <span class="field-value field-value--pricing-control">
<div class="mobile-pricing-num-wrap"> <div class="mobile-pricing-num-wrap">
<el-input-number v-model="row.sellingPrice" :min="0" :step="1" :precision="2" size="small" controls-position="right" class="mobile-pricing-input" @change="onOrderSellingPriceChange(row)" @blur="onOrderSellingPriceChange(row)" /> <el-input-number v-model="row.sellingPrice" :min="0" :step="1" :precision="2" size="small" controls-position="right" class="mobile-pricing-input" @change="onOrderSellingPriceChange(row)" />
<el-tag v-if="row.sellingPriceManual === 1" type="info" size="mini" class="mobile-pricing-tag">手填</el-tag> <el-tag v-if="row.sellingPriceManual === 1" type="info" size="mini" class="mobile-pricing-tag">手填</el-tag>
</div> </div>
</span> </span>
@@ -482,7 +479,7 @@
<span class="field-label">利润</span> <span class="field-label">利润</span>
<span class="field-value field-value--pricing-control"> <span class="field-value field-value--pricing-control">
<div class="mobile-pricing-num-wrap"> <div class="mobile-pricing-num-wrap">
<el-input-number v-model="row.profit" :step="0.01" :precision="2" size="small" controls-position="right" class="mobile-pricing-input" @change="onOrderProfitChange(row)" @blur="onOrderProfitChange(row)" /> <el-input-number v-model="row.profit" :step="0.01" :precision="2" size="small" controls-position="right" class="mobile-pricing-input" @change="onOrderProfitChange(row)" />
<el-tag v-if="row.profitManual === 1" type="warning" size="mini" class="mobile-pricing-tag">手填</el-tag> <el-tag v-if="row.profitManual === 1" type="warning" size="mini" class="mobile-pricing-tag">手填</el-tag>
</div> </div>
</span> </span>
@@ -671,7 +668,6 @@
controls-position="right" controls-position="right"
class="jd-order-input-money jd-order-input-money--payment" class="jd-order-input-money jd-order-input-money--payment"
@change="onOrderPaymentOrRebateChange(scope.row)" @change="onOrderPaymentOrRebateChange(scope.row)"
@blur="onOrderPaymentOrRebateChange(scope.row)"
/> />
</div> </div>
</template> </template>
@@ -688,7 +684,6 @@
controls-position="right" controls-position="right"
class="jd-order-input-money jd-order-input-money--rebate" class="jd-order-input-money jd-order-input-money--rebate"
@change="onOrderPaymentOrRebateChange(scope.row)" @change="onOrderPaymentOrRebateChange(scope.row)"
@blur="onOrderPaymentOrRebateChange(scope.row)"
/> />
</div> </div>
</template> </template>
@@ -706,21 +701,21 @@
<el-table-column label="售价" prop="sellingPrice" min-width="150" align="right" class-name="jd-col-money jd-col-money--selling"> <el-table-column label="售价" prop="sellingPrice" min-width="150" align="right" class-name="jd-col-money jd-col-money--selling">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="jd-cell-stretch jd-cell-stretch--num"> <div class="jd-cell-stretch jd-cell-stretch--num">
<el-input-number v-model="scope.row.sellingPrice" :min="0" :step="1" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--selling" @change="onOrderSellingPriceChange(scope.row)" @blur="onOrderSellingPriceChange(scope.row)" /> <el-input-number v-model="scope.row.sellingPrice" :min="0" :step="1" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--selling" @change="onOrderSellingPriceChange(scope.row)" />
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="额外成本" prop="extraCost" min-width="112" align="right" class-name="jd-col-money jd-col-money--extra-cost"> <el-table-column label="额外成本" prop="extraCost" min-width="112" align="right" class-name="jd-col-money jd-col-money--extra-cost">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="jd-cell-stretch jd-cell-stretch--num"> <div class="jd-cell-stretch jd-cell-stretch--num">
<el-input-number v-model="scope.row.extraCost" :min="0" :step="1" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--rebate" @change="onOrderExtraCostChange(scope.row)" @blur="onOrderExtraCostChange(scope.row)" /> <el-input-number v-model="scope.row.extraCost" :min="0" :step="1" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--rebate" @change="onOrderExtraCostChange(scope.row)" />
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="利润" prop="profit" min-width="118" align="right" class-name="jd-col-money jd-col-money--profit"> <el-table-column label="利润" prop="profit" min-width="118" align="right" class-name="jd-col-money jd-col-money--profit">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="jd-cell-stretch jd-cell-stretch--num"> <div class="jd-cell-stretch jd-cell-stretch--num">
<el-input-number v-model="scope.row.profit" :step="0.01" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--profit" @change="onOrderProfitChange(scope.row)" @blur="onOrderProfitChange(scope.row)" /> <el-input-number v-model="scope.row.profit" :step="0.01" :precision="2" size="mini" controls-position="right" class="jd-order-input-money jd-order-input-money--profit" @change="onOrderProfitChange(scope.row)" />
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -1412,6 +1407,9 @@ export default {
syncAutoProfitSeq: 0, syncAutoProfitSeq: 0,
/** 延后拉单条详情的防抖句柄(字符串 id -> timeout id */ /** 延后拉单条详情的防抖句柄(字符串 id -> timeout id */
_patchRowTimers: null, _patchRowTimers: null,
/** 单行 PUT 防抖(避免 change+blur 连击触发若依重复提交拦截) */
_persistOrderTimers: null,
_persistOrderPendingMsg: null,
/** 移动端卡片:当前展开的订单 idnull 表示全部收起,同时只展开一条) */ /** 移动端卡片:当前展开的订单 idnull 表示全部收起,同时只展开一条) */
mobileExpandedOrderId: null, mobileExpandedOrderId: null,
/** 视口高度(桌面端用于矮窗口下自动收起「跟进状态」筛选) */ /** 视口高度(桌面端用于矮窗口下自动收起「跟进状态」筛选) */
@@ -1514,6 +1512,8 @@ export default {
created() { created() {
this.applyMobileSlowOrderPageSize() this.applyMobileSlowOrderPageSize()
this._patchRowTimers = {} this._patchRowTimers = {}
this._persistOrderTimers = {}
this._persistOrderPendingMsg = {}
// 设置默认日期为今天 // 设置默认日期为今天
this.setDefaultDateRange() this.setDefaultDateRange()
this.getListWithFallback() this.getListWithFallback()
@@ -1555,6 +1555,9 @@ export default {
if (this._patchRowTimers) { if (this._patchRowTimers) {
Object.keys(this._patchRowTimers).forEach(k => clearTimeout(this._patchRowTimers[k])) Object.keys(this._patchRowTimers).forEach(k => clearTimeout(this._patchRowTimers[k]))
} }
if (this._persistOrderTimers) {
Object.keys(this._persistOrderTimers).forEach(k => clearTimeout(this._persistOrderTimers[k]))
}
}, },
methods: { methods: {
onJdFilterViewportResize() { onJdFilterViewportResize() {
@@ -2064,13 +2067,41 @@ export default {
}) })
.catch(() => {}) .catch(() => {})
}, },
/**
* 单行保存 PUT防抖合并短时间内的多次触发避免 ElementUI input-number 等在失焦时与 change 叠加,
* 连续两次相同 URL 请求触发若依「请勿重复提交」。
*/
persistOrderRow(row, successMsg) { persistOrderRow(row, successMsg) {
if (!row || row.id == null) { if (!row || row.id == null) {
return Promise.resolve() return Promise.resolve()
} }
this.ensureMoneyFieldsForPersist(row) 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() this.invalidatePendingSyncAutoProfit()
return updateJDOrder(row) updateJDOrder(row)
.then(() => { .then(() => {
if (successMsg) this.$message.success(successMsg) if (successMsg) this.$message.success(successMsg)
this.schedulePatchOrderRowFromServer(row.id) this.schedulePatchOrderRowFromServer(row.id)