|
@@ -1,4 +1,9 @@
|
|
|
-const _Http = getApp().globalData.http;
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = value => currency(value, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
import {
|
|
|
formatTime
|
|
|
} from "../../utils/getTime";
|
|
@@ -27,7 +32,12 @@ Page({
|
|
|
}).then(res => {
|
|
|
console.log(res)
|
|
|
this.setData({
|
|
|
- accountList: res.data
|
|
|
+ accountList: res.data.map(v => {
|
|
|
+ v.creditquota = CNY(v.creditquota);
|
|
|
+ v.usable = CNY(currency(v.creditquota).add(v.balance));
|
|
|
+ v.balance = CNY(v.balance)
|
|
|
+ return v
|
|
|
+ })
|
|
|
});
|
|
|
this.getList(true);
|
|
|
})
|
|
@@ -66,12 +76,16 @@ Page({
|
|
|
earning = 0; //支出
|
|
|
if (res.data.total.length) {
|
|
|
let expendObj = res.data.total.find(v => v.type == 1);
|
|
|
- if (expendObj) expend = expendObj.sumamount;
|
|
|
+ if (expendObj) expend = CNY(expendObj.sumamount);
|
|
|
let earningObj = res.data.total.find(v => v.type == 0);
|
|
|
- if (earningObj) earning = earningObj.sumamount;
|
|
|
+ if (earningObj) earning = CNY(earningObj.sumamount);
|
|
|
}
|
|
|
this.setData({
|
|
|
- recordList: res.data.rows,
|
|
|
+ recordList: res.data.rows.map(v => {
|
|
|
+ v.amount = CNY(v.amount)
|
|
|
+ v.showBalance = CNY(v.balance)
|
|
|
+ return v
|
|
|
+ }),
|
|
|
expend,
|
|
|
earning
|
|
|
})
|