zhaoxiaohai 2 years ago
parent
commit
a25b5dfb77
3 changed files with 72 additions and 43 deletions
  1. 52 27
      packageA/account/index.js
  2. 3 2
      packageA/account/index.scss
  3. 17 14
      packageA/account/index.wxml

+ 52 - 27
packageA/account/index.js

@@ -1,34 +1,10 @@
+const _Http = getApp().globalData.http;
 import {
   formatTime
 } from "../../utils/getTime";
-
 Page({
   data: {
-    accountList: [{
-        name: "默认账户",
-        price: 620864.86,
-        xyprice: 100000,
-        kyprice: 100000,
-      },
-      {
-        name: "活动账户",
-        price: -320864.86,
-        xyprice: 100000,
-        kyprice: 9000,
-      },
-      {
-        name: "现金账户",
-        price: -320864.86,
-        xyprice: 180000,
-        kyprice: 50000,
-      },
-      {
-        name: "备用账户",
-        price: -320864.86,
-        xyprice: 100000,
-        kyprice: 30000,
-      }
-    ],
+    accountList: [],
     active: 0,
     ymonth: "", //年月
     dateEnd: "", //日期结束时间
@@ -38,19 +14,68 @@ Page({
     this.setData({
       ymonth,
       dateEnd: ymonth
+    });
+    _Http.basic({
+      id: 20221008145903,
+      "content": {
+        pageSize: 999,
+        "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() {
 

+ 3 - 2
packageA/account/index.scss

@@ -4,8 +4,8 @@
     z-index: 1;
     display: flex;
     justify-content: space-between;
-    align-items: center;
-    width: 100vw;
+		align-items: center;
+		width: 100vw;
     height: 80rpx;
     background-color: #fff;
     box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
@@ -83,6 +83,7 @@
             top: 30rpx;
             right: 100rpx;
             z-index: 10;
+            border-radius: 16rpx;
         }
 
         .top {

+ 17 - 14
packageA/account/index.wxml

@@ -1,6 +1,6 @@
 <view class="head">
-    <picker mode="selector" range='{{accountList}}' range-key='name' value='{{active}}' bindchange='changeAccount'>
-        <navigator class="line-1" url="#">{{accountList[active].name}}</navigator>
+    <picker mode="selector" range='{{accountList}}' range-key='accountname' value='{{active}}' bindchange='changeAccount'>
+        <navigator class="line-1" url="#">{{accountList[active].accountname}}</navigator>
     </picker>
     <picker mode="date" fields='month' end='dateEnd' bindchange='changeDate'>
         <navigator url="#">{{ymonth}}月</navigator>
@@ -11,23 +11,23 @@
     <swiper-item wx:for="{{accountList}}" wx:key="name">
         <view class="upper">
             <view class="name">
-                {{item.name}}(元)
+                {{item.accountname}}(元)
             </view>
             <view class="price">
-                {{item.price}}
+                {{item.balance}}
             </view>
         </view>
         <view class="lower">
             <view class="item">
                 <view class="name">信用额度(元)</view>
                 <view class="price">
-                    {{item.xyprice}}
+                    {{item.creditquota}}
                 </view>
             </view>
             <view class="item">
                 <view class="name">可用额度(元)</view>
                 <view class="price">
-                    {{item.kyprice}}
+                    {{item.creditquota+item.balance}}
                 </view>
             </view>
         </view>
@@ -38,16 +38,19 @@
     </swiper-item>
 </swiper>
 <view class="total">
-    收入总计:100000,支出总计:80650
+    收入总计:{{expend}},支出总计:{{earning}}
 </view>
 
-<navigator url="#" class="record" wx:for="{{20}}" wx:key="index">
+<navigator url="#" class="record" wx:for="{{recordList}}" wx:key="sa_accountclassid">
     <view class="content">
-        <view class="title">支出-贷款</view>
-        <view class="exp">{{accountList[active].name}}:余额1534{{index}}</view>
-        <view class="exp">{{ymonth}}-{{index+1}}</view>
+        <view class="title">{{item.type==0?'支出':'收入'}}-{{item.source}}</view>
+        <view class="exp">{{item.accountname}}:{{item.amount}}</view>
+        <view class="exp">交易备注:{{item.remarks || ' --'}}</view>
+        <view class="exp">{{item.createdate}}</view>
     </view>
-    <view class="price">
-        ¥2345.{{index+2}}
+    <view class="price" style="color:{{item.balance>=0?'#DB0D27':'var(--success)'}} ;">
+        ¥{{item. balance}}
     </view>
-</navigator>
+</navigator>
+
+<Yl_Empty wx:if="{{recordList.length==0}}" />