|
@@ -1,6 +1,12 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
let pageNumber = 1,
|
|
|
- pageTotal = 1;
|
|
|
+ pageTotal = 1,
|
|
|
+ currency = require("../../utils/currency"),
|
|
|
+ CNY = value => currency(value, {
|
|
|
+ symbol: "¥",
|
|
|
+ precision: 2
|
|
|
+ }).format();
|
|
|
+
|
|
|
import {
|
|
|
formatTime
|
|
|
} from "../../utils/getTime";
|
|
@@ -29,7 +35,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);
|
|
|
})
|
|
@@ -49,7 +60,7 @@ Page({
|
|
|
this.getList();
|
|
|
},
|
|
|
getList(init = false) {
|
|
|
- if (init){
|
|
|
+ if (init) {
|
|
|
pageNumber = 1;
|
|
|
pageTotal = 1
|
|
|
}
|
|
@@ -74,10 +85,15 @@ Page({
|
|
|
earning = 0; //支出
|
|
|
if (res.data.length) {
|
|
|
let expendObj = res.data[0].total.find(v => v.type == 1);
|
|
|
- if (expendObj) expend = expendObj.sumamount;
|
|
|
+ if (expendObj) expend = CNY(expendObj.sumamount);
|
|
|
let earningObj = res.data[0].total.find(v => v.type == 0);
|
|
|
- if (earningObj) earning = earningObj.sumamount;
|
|
|
+ if (earningObj) earning = CNY(earningObj.sumamount);
|
|
|
}
|
|
|
+ res.data = res.data.map(v=>{
|
|
|
+ v.amount = CNY(v.amount)
|
|
|
+ v.showBalance = CNY(v.balance)
|
|
|
+ return v
|
|
|
+ })
|
|
|
pageNumber += 1;
|
|
|
pageTotal = res.pageTotal;
|
|
|
this.setData({
|
|
@@ -88,7 +104,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onReachBottom(){
|
|
|
+ onReachBottom() {
|
|
|
this.getList();
|
|
|
}
|
|
|
})
|