Commit c03a68f6 by 李伟康

修改样式

1 parent 85fedc07
......@@ -239,6 +239,11 @@
import NP from 'number-precision'
import pointsConfig from './components/pointsConfig.vue'
import importErrDialog from './components/importErrDialog.vue'
const truncateDecimal = (number, decimalPlaces = 2) => {
let multiplier = Math.pow(10, decimalPlaces),
truncatedNumber = Math.floor(number * multiplier) / multiplier
return truncatedNumber.toFixed(decimalPlaces)
}
export default {
components: {
pointsConfig,
......@@ -299,7 +304,7 @@ export default {
const { passageService } = cell,
{ passageServiceCharge } = this.chargeObject,
passageSum = passageService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(passageSum, passageServiceCharge, 0.01).toFixed(2)
sum = truncateDecimal(NP.times(passageSum, passageServiceCharge, 0.01))
return `${passageSum}*${passageServiceCharge}%=${sum}`
}
},
......@@ -310,7 +315,7 @@ export default {
const { gasService } = cell,
{ gasCardServiceCharge } = this.chargeObject,
gasCardSum = gasService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(gasCardSum, gasCardServiceCharge, 0.01).toFixed(2)
sum = truncateDecimal(NP.times(gasCardSum, gasCardServiceCharge, 0.01))
return `${gasCardSum}*${gasCardServiceCharge}%=${sum}`
}
},
......@@ -323,8 +328,7 @@ export default {
gasPrice = NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge, 0.01),
passagePrice = NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge, 0.01),
totalPrice = total.reduce((acc, cur) => acc + cur, 0)
return NP.plus(gasPrice, passagePrice, totalPrice).toFixed(2)
return truncateDecimal(NP.plus(gasPrice, passagePrice, totalPrice))
}
},
],
......@@ -362,12 +366,12 @@ export default {
},
{
label: '赠送油券',
minWidth: 200,
minWidth: 260,
addHtml: 'oilList'
},
{
label: '赠送自店服务',
minWidth: 200,
minWidth: 260,
addHtml: 'couponList'
},
{
......
......@@ -134,12 +134,12 @@ export default {
{
label: '赠送油券',
addHtml: 'oilList',
minWidth: 150,
minWidth: 260,
},
{
label: '赠送自店服务',
addHtml: 'couponList',
minWidth: 150,
minWidth: 260,
},
{
label: '充值积分小计',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!