import * as UTIL from '../../utils/util.js'; import * as API from '../../utils/API.js'; Page({ data: { //顶部胶囊按钮位置信息rect CustomMenuButton: null, wrokScrollHeight:0, userInfoObj:{}, //用户信息, item:"", active:1, // 待办列表 todoList:[], // 已办列表 doneList:[], // 已发起 yfqList:[], // 已制单 yzdList:[], //待办数量 todoNum:0, //已办数量 doneNum:0, //已发起数量 yfqNum:0, //已制单数量 yzdNum:0, //字典 transferType:[ {"dictVale":1,"dictLabel":"村账户转账"}, {"dictVale":2,"dictLabel":"公务卡转账"}, {"dictVale":3,"dictLabel":"虚拟挂账"}, {"dictVale":4,"dictLabel":"代管账户转账"}, {"dictVale":5,"dictLabel":"母子转账"}, {"dictVale":10,"dictLabel":"现金提现"}, {"dictVale":11,"dictLabel":"现金使用"}, {"dictVale":12,"dictLabel":"汇票支出"} ] }, onLoad: function (options) { //获取用户信息 this.getUserInfo() //获取滚动条高度 this.computeBarLocation(); //查询待办 this.getTaskList(); //查询已办 this.getTaskDoneList(); //查询已发起 this.getTransferList(); this.getTransferList1(); //查询已制单 this.getTransferList2(); }, switchTab:function(e){ this.setData({ active:e.currentTarget.dataset.gid }) }, dictTranslate(d,value){ let val = "" for(var index in d){ if(d[index].dictVale==value){ return val = d[index].dictLabel } } }, getTaskList:function(e){ let data = { pageNum:1, pageSize:10, orderByColumn:"A.ID_", isAsc:"desc", systemType:4, method:"GET" } UTIL.httpRequest(API.URL_GET_TASKLIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { this.setData({todoNum:res.total}) if(res.rows!=null&&res.rows!=""){ for(let i = 0;i { console.log(res); }, complete: (res) => { console.log(res); } }) }, getTaskDoneList:function(e){ let data = { pageNum:1, pageSize:10, orderByColumn:"A.ID_", isAsc:"desc", systemType:4, method:"GET" } UTIL.httpRequest(API.URL_GET_TASKDONELIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { this.setData({doneNum:res.total}) if(res.rows!=null&&res.rows!=""){ for(var index in res.rows){ let d = this.dictTranslate(this.data.transferType,res.rows[index].formData.transferType) res.rows[index].formData.transferType = d } this.setData({doneList:res.rows}) } } }, fail: (res) => { console.log(res); }, complete: (res) => { console.log(res); } }) }, getTransferList:function(e){ let data = { // pageNum:1, // pageSize:10, transferType:"1", auditStatus:"2", method:"GET" } UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { console.log(res); let a = this.data.yfqNum+res.total this.setData({yfqNum:a}) this.setData({yfqList:res.rows}) } }, fail: (res) => { console.log(res); }, complete: (res) => { console.log(res); } }) }, getTransferList1:function(e){ let data = { // pageNum:1, // pageSize:10, transferType:"1", auditStatus:"3", method:"GET" } UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { console.log(); let a = this.data.yfqNum+res.total this.setData({yfqNum:a}) this.setData({yfqList:res.rows}) } }, fail: (res) => { console.log(res); }, complete: (res) => { console.log(res); } }) }, //已制单 getTransferList2:function(e){ let data = { // pageNum:1, // pageSize:10, transferType:"1", auditStatus:"0", method:"GET" } UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, { success: (res) => { if (res.code == API.SUCCESS_CODE) { this.setData({yzdNum:res.total}) this.setData({yzdList:res.rows}) } }, fail: (res) => { console.log(res); }, complete: (res) => { console.log(res); } }) }, //跳转收入登记 swichInCome:function(e){ wx.navigateTo({ url: '../inCome/inCome?', }) }, //跳转支出申请 swichPayment:function(e){ console.log(e.currentTarget.dataset.current); // let cur = e.currentTarget.dataset.current; // if (this.data.currentTaB == cur) { // return false; // }else{ // wx.navigateTo({ // url: '../inCome/index?id=' + id, // }) // } wx.navigateTo({ url: '/pages/apply/index?', }) }, //跳转个人设置 swichSettle:function(e){ // console.log(e.currentTarget.dataset.current); // let cur = e.currentTarget.dataset.current; // if (this.data.currentTaB == cur) { // return false; // }else{ // wx.navigateTo({ // url: '../inCome/index?id=' + id, // }) // } wx.navigateTo({ url: 'settle/index?', }) }, /* 计算bar 高度*/ computeBarLocation() { var that = this; let CustomMenuButton = wx.getMenuButtonBoundingClientRect(); let CustomWidows = wx.getSystemInfoSync(); // 根据文档,先创建一个SelectorQuery对象实例 let query = wx.createSelectorQuery().in(this); query.select('.top_title').boundingClientRect(); query.select('.information_header').boundingClientRect(); query.select('.navList_main').boundingClientRect(); query.select('.child_function').boundingClientRect(); query.select('.work_plan').boundingClientRect(); query.exec((res) => { let wrokScrollHeight = CustomWidows.windowHeight; res.forEach((v)=>{ wrokScrollHeight = wrokScrollHeight - v.height; }) wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15; that.setData({ wrokScrollHeight: wrokScrollHeight, }); }) that.setData({ CustomMenuButton: CustomMenuButton, }); }, /* 获取用户信息*/ getUserInfo(){ UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { success: (res) => { if (res.code == API.SUCCESS_CODE) { this.setData({userInfoObj:res.user}) this.setData({item:JSON.stringify(res.user)}) } } }) } })