eolink对数据进行四舍五入处理
作者:互联网
下图“BalanceAmount”返回值显示小数点2位以后的值,这样就与预计匹配值不等导致脚本错误
对这个值进行四舍五入处理,比如返回值变成整数
var num = eo.env.envParam["BalanceAmount_1"]-eo.env.envParam['TradeFee']+eo.env.envParam['SalePrice']; num =Math.round(num); eo.env.envParam['BalanceAmount'] = num;
或者保留2位小数
var num = eo.env.envParam["BalanceAmount_1"]-eo.env.envParam['TradeFee']+eo.env.envParam['SalePrice']; num =Math.round((num) * 100) / 100; eo.env.envParam['BalanceAmount'] = num;
标签:四舍五入,eo,env,处理,envParam,num,eolink,BalanceAmount 来源: https://www.cnblogs.com/becks/p/16693516.html