const app = getApp();
Page({
    data: {
        payList: [
            {"name":"薪资","money":"89310.00","icon":"/image/bill/0.png"},
            {"name":"红包","money":"0.23","icon":"/image/bill/2.png"}
        ]
    },
    onLoad: function (options) {

    },
    onShow() {
        app.$api.getSettings().then(setting => {
            let payList = setting.data.EXPEND_SETTING;
            app.$api.getSettingsExpend().then(res => {
                let result = res.data;
                payList.forEach(item => {
                    let money = 0
                    if (result[item.id]){
                        money = result[item.id];
                    }
                    if (!money){
                        money = 0
                    }
                    item.money = money;
                })
                console.log(payList);
                this.setData({payList})
            });
        });
    },
    handleClick() {
        wx.navigateTo({
            url : "../edit/index?isAccount=0&isIncome=0&isAdd=1"
        })
    }
});
