Commit b7552868 by 前端

第二轮BUG修复

1 parent 3f7f90f2
...@@ -721,6 +721,8 @@ export default { ...@@ -721,6 +721,8 @@ export default {
// 有嘀加成本或第三方成本 商品成本显示- // 有嘀加成本或第三方成本 商品成本显示-
if (!this.filterEmpty(subItem.djCost) || !this.filterEmpty(subItem.thirdPartyCost)) subItem.goodsCost = '' if (!this.filterEmpty(subItem.djCost) || !this.filterEmpty(subItem.thirdPartyCost)) subItem.goodsCost = ''
subItem.uniqueKey = temp++ subItem.uniqueKey = temp++
// 主订单商品成本根据 是否有嘀加成本或商品成本累加计算
item.goodsCost = this.subStr(item.goodsCost, Number(subItem.goodsCost)) > 0 ? this.subStr(item.goodsCost, Number(subItem.goodsCost)) - 0 : ''
subItem = this.numAddPrefix(subItem) subItem = this.numAddPrefix(subItem)
subItem.positionStr = this.positionTypeList?.filter(val => val.positionValue == subItem.goodsPosition)[0]?.positionName || '-' subItem.positionStr = this.positionTypeList?.filter(val => val.positionValue == subItem.goodsPosition)[0]?.positionName || '-'
}) })
...@@ -795,6 +797,23 @@ export default { ...@@ -795,6 +797,23 @@ export default {
filterEmpty(data) { filterEmpty(data) {
return (data ?? '') === '' return (data ?? '') === ''
},
// 价格计算精度丢失处理
subStr(num1, num2) {
var r1, r2, m, n
try {
r1 = num1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = num2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
m = Math.pow(10, Math.max(r1, r2))
n = r1 >= r2 ? r1 : r2
return ((num1 * m + num2 * m) / m).toFixed(n)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!