Postman返回:{"otherAmount":"1","rechargeMin":0.01,"rechargeMax":99999.0,"datas":[{"amount":5.0,"actualAmount":5.0,"sendAmount":0.0,"discAmount":0.0,"minDiscRate":1,"payable":5.0,"ruleBillNo":"","ruleDescription":"","incentiveList":[]},{"amount":10.0,"actualAmount":10.0,"sendAmount":0.0,"discAmount":0.0,"minDiscRate":1,"payable":10.0,"ruleBillNo":"","ruleDescription":"","incentiveList":[]},{"amount":15.0,"actualAmount":15.0,"sendAmount":0.0,"discAmount":0.0,"minDiscRate":1,"payable":15.0,"ruleBillNo":"","ruleDescription":"","incentiveList":[]}],"rechargeFree":null,"success":true,"serviceStatus":"000","serviceDescription":"服务执行成功"}
微信开发工具返回:{"otherAmount":"1","rechargeMin":0.01,"rechargeMax":99999,"datas":[{"amount":5,"actualAmount":5,"sendAmount":0,"discAmount":0,"minDiscRate":1,"payable":5,"ruleBillNo":"","ruleDescription":"","incentiveList":[]},{"amount":10,"actualAmount":10,"sendAmount":0,"discAmount":0,"minDiscRate":1,"payable":10,"ruleBillNo":"","ruleDescription":"","incentiveList":[]},{"amount":15,"actualAmount":15,"sendAmount":0,"discAmount":0,"minDiscRate":1,"payable":15,"ruleBillNo":"","ruleDescription":"","incentiveList":[]}],"rechargeFree":null,"success":true,"serviceStatus":"000","serviceDescription":"服务执行成功"}
这个是这样的实际不影响你使用,你可以直接使用.toFixed(2)
js: var num = 1 num = num.toFixed( 2 ) console.log(num)//1.00 var num = 1.0 num = num.toFixed( 2 ) console.log(num)//1.00 var num = 1.1 num = num.toFixed( 2 ) console.log(num)//1.10 var num = 0.01 num = num.toFixed( 2 ) console.log(num)//0.01 页面: <view>{{(1).toFixed( 2 )}}</view>//1.00 <view>{{(1.0).toFixed( 2 )}}</view>//1.00 <view>{{(0.1).toFixed( 2 )}}</view>//0.10 <view>{{(0.01).toFixed( 2 )}}</view>//0.01