|
@@ -415,6 +415,10 @@ export default {
|
|
|
priceSnapshot: r.priceSnapshot,
|
|
priceSnapshot: r.priceSnapshot,
|
|
|
orderOnly: !!r.orderOnly,
|
|
orderOnly: !!r.orderOnly,
|
|
|
source: r.source === 'stash' ? 'stash' : 'submit',
|
|
source: r.source === 'stash' ? 'stash' : 'submit',
|
|
|
|
|
+ discountZhe:
|
|
|
|
|
+ r.discountZhe != null && r.discountZhe !== '' && !isNaN(Number(r.discountZhe))
|
|
|
|
|
+ ? parseFloat(Number(r.discountZhe).toFixed(2))
|
|
|
|
|
+ : undefined,
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
persistCalcHistoryToStorage() {
|
|
persistCalcHistoryToStorage() {
|
|
@@ -922,6 +926,7 @@ export default {
|
|
|
priceSnapshot: Number(this.price) || 0,
|
|
priceSnapshot: Number(this.price) || 0,
|
|
|
orderOnly,
|
|
orderOnly,
|
|
|
source: opts.source === 'stash' ? 'stash' : 'submit',
|
|
source: opts.source === 'stash' ? 'stash' : 'submit',
|
|
|
|
|
+ discountZhe: parseFloat(Number(this.discountZhe).toFixed(2)),
|
|
|
},
|
|
},
|
|
|
0
|
|
0
|
|
|
)
|
|
)
|
|
@@ -970,10 +975,28 @@ export default {
|
|
|
this.calcInput = ''
|
|
this.calcInput = ''
|
|
|
this.resetActiveDiscountToNone()
|
|
this.resetActiveDiscountToNone()
|
|
|
},
|
|
},
|
|
|
|
|
+ /** 从历史记录还原折扣(不写全局折扣 storage,避免覆盖用户默认偏好) */
|
|
|
|
|
+ restoreHistoryDiscountFromRow(row) {
|
|
|
|
|
+ let z = 10
|
|
|
|
|
+ const raw = row && row.discountZhe
|
|
|
|
|
+ if (raw != null && raw !== '' && !isNaN(Number(raw))) {
|
|
|
|
|
+ const n = Number(raw)
|
|
|
|
|
+ if (n > 0 && n <= 10) {
|
|
|
|
|
+ z = parseFloat(n.toFixed(2))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (z >= 10 - 1e-6) {
|
|
|
|
|
+ this.discountZhe = 10
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const ok = this.customDiscountZheList.some((x) => Math.abs(Number(x) - z) < 1e-4)
|
|
|
|
|
+ this.discountZhe = ok ? z : 10
|
|
|
|
|
+ },
|
|
|
applyHistoryRow(row) {
|
|
applyHistoryRow(row) {
|
|
|
if (!row) {
|
|
if (!row) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ this.restoreHistoryDiscountFromRow(row)
|
|
|
const ci = row.calcInput != null ? String(row.calcInput) : ''
|
|
const ci = row.calcInput != null ? String(row.calcInput) : ''
|
|
|
const hasTok = row.tokens && row.tokens.length > 0
|
|
const hasTok = row.tokens && row.tokens.length > 0
|
|
|
const hasLegacy = row.addends && row.addends.length
|
|
const hasLegacy = row.addends && row.addends.length
|