123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- const utils = require('../../utils/util')
- const app = getApp();
- Page({
- data: {
- currentTab: 0,
- bgColor: "linear-gradient(90deg, rgb(255, 118, 38), rgb(252, 30, 82))",
- navbar: [{
- name: "收入"
- }, {
- name: "支出"
- }],
- isPickerRender: false,
- isPickerShow: false,
- pickerConfig: {
- endDate: true,
- dateLimit: true,
- initStartTime: "2020-01-01",
- initEndTime: "2020-12-01",
- limitStartTime: "2015-01-01",
- limitEndTime: "2095-01-01"
- },
- searchParams: {
- startTime: "2019-01-01 ",
- endTime: "2019-12-01",
- pageNo: 1,
- pageSize: 10,
- createTime_begin:"",
- createTime_end:"",
- tradingStatus:1
- },
- dataStr: '',
- totalAmount:0,
- loadding: false,
- pullUpOn: true,
- list:[],
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- ["searchParams.pageNo"]: 1,
- pullUpOn: true,
- loadding: false,
- list: []
- })
- this.getList()
- setTimeout(() => {
- wx.stopPullDownRefresh()
- }, 300);
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- let that = this;
- //只是测试效果,逻辑以实际数据为准
- this.setData({
- loadding: true,
- pullUpOn: true
- })
- this.setData({
- ["searchParams.pageNo"]: that.data.searchParams.pageNo + 1
- })
- this.getList()
- },
- onLoad: function (options) {
- this.getList();
- },
- onReady: function (options) {
- },
- changeTab(e) {
- console.log(e)
- this.setData({
- currentTab: e.detail.index,
- list:[]
- })
- if(e.detail.index==0){//收入列表
- this.setData({
- ["searchParams.tradingStatus"]:1
-
- })
- }else if(e.detail.index==1){//支出列表
- this.setData({
- ["searchParams.tradingStatus"]:0
- })
- }
- this.getList();
- },
- timePickerShow: function () {
- this.setData({
- isPickerShow: true,
- isPickerRender: true,
- chartHide: true
- });
- },
- pickerHide: function () {
- this.setData({
- isPickerShow: false,
- chartHide: false
- });
- },
- setPickerTime: function (val) {
- let data = val.detail;
- let startTime = utils.formatDate(data.startTime,'yyyy-MM-dd')
- let endTime = utils.formatDate(data.endTime,'yyyy-MM-dd')
- this.setData({
- ["searchParams.startTime"]: data.startTime,
- ["searchParams.endTime"]: data.endTime,
- dataStr: startTime +" ~ "+ endTime,
- ["searchParams.createTime_begin"]: data.startTime,
- ["searchParams.createTime_end"]: data.endTime,
- list:[]
- });
- this.getList();
- },
- getList() {
- var that = this
- utils.request(utils.api.mgVmBillList, that.data.searchParams, "GET", true, false, app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- totalAmount: res.result.allMoney,
- })
- if (res.result.list.records.length > 0) {
- if (that.data.searchParams.pageNo > 0) {
- let list = that.data.list
- res.result.list.records.forEach((e)=>{
- list.push(e)
- })
- that.setData({
- list: list
- })
- }else{
- that.setData({
- list: res.result.list.records
- })
- }
- } else {
- that.setData({
- loadding: false,
- pullUpOn: false,
- ["searchParams.pageNo"]:that.data.searchParams.pageNo-1
- })
- }
- }
- }).catch((res) => {})
- },
-
- })
|