123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- const _Http = getApp().globalData.http;
- import {
- formatTime
- } from "../../utils/getTime";
- Page({
- data: {
- accountList: [],
- active: 0,
- ymonth: "",
- dateEnd: "",
- },
- onLoad(options) {
- let ymonth = formatTime(new Date(), '-').split(" ")[0].slice(0, 7);
- this.setData({
- ymonth,
- dateEnd: ymonth
- });
- _Http.basic({
- id: 20221008145903,
- "content": {
- pageSize: 999,
- type: 1,
- "where": {
- "condition": ""
- }
- }
- }).then(res => {
- console.log(res)
- this.setData({
- accountList: res.data
- });
- this.getList(true);
- })
- },
-
- changeAccount(e) {
- this.setData({
- active: e.detail.value || e.detail.current
- });
- this.getList();
- },
-
- changeDate(e) {
- this.setData({
- ymonth: e.detail.value
- })
- this.getList();
- },
- getList() {
- let data = this.data.accountList[this.data.active];
- _Http.basic({
- "id": "20230111103403",
- "version": 1,
- "content": {
- "sys_enterpriseid": data.sys_enterpriseid,
- "sa_accountclassid": data.sa_accountclassid,
- "where": {
- "year": this.data.ymonth.split("-")[0],
- "month": this.data.ymonth.split("-")[1]
- }
- }
- }).then(res => {
- console.log("账户流水", res)
- if (res.msg == '成功') {
- let expend = 0,
- earning = 0;
- if (res.data.total.length) {
- let expendObj = res.data.total.find(v => v.type == 1);
- if (expendObj) expend = expendObj.sumamount;
- let earningObj = res.data.total.find(v => v.type == 1);
- if (earningObj) earning = earningObj.sumamount;
- }
- this.setData({
- recordList: res.data.rows,
- expend,
- earning
- })
- }
- })
- },
- onReady() {
- },
- })
|