|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693 |
- import * as UTIL from '../../utils/util.js';
- import * as API from '../../utils/API.js';
- Page({
- data: {
- //顶部胶囊按钮位置信息rect
- CustomMenuButton: null,
- wrokScrollHeight:0,
- userInfoObj:{}, //用户信息,
- item:"",
- address: '', //详细收货地址(四级)
- value: [0, 0, 0], // 地址选择器省市区 暂存 currentIndex
- region: '', //所在地区
- deptId: '',
- regionValue: [0, 0, 0], // 地址选择器省市区 最终 currentIndex
- provinces: [], // 一级地址
- citys: [], // 二级地址
- areas: [], // 三级地址
- visible: false,
- isCanConfirm: true, //是否禁止在第一列滚动期间点击确定提交数据
- bookId:"",
- bookName:"",
- bookList:[],
- 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":"汇票支出"}
- ],
- showList:false,
- showListText:'更多',
- num:1,
- active:1
- },
- onLoad: function (options) {
- //获取滚动条高度
- this.computeBarLocation();
- },
- openView(){
- var that = this;
- let num = that.data.num;
- console.log((num%2));
- if( (num%2) > 0 ){
- num++;
- that.setData({
- showList:true,
- showListText:'收起',
- num:num
- })
- }else{
- num++;
- that.setData({
- showList:false,
- showListText:'更多',
- num:num
- })
- }
- },
- // getUserProfile(e) {
- // // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
- // // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
- // wx.getUserProfile({
- // desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
- // success: (res) => {
- // this.setData({
- // userInfo: res.userInfo,
- // hasUserInfo: true
- // })
- // }
- // })
- // },
- onShow(){
- //获取用户信息
- this.getUserInfo()
- //查询待办
- this.getTaskList();
- //查询已办
- this.getTaskDoneList();
- //查询dept
- this.getTreeDept();
- },
-
- reset:function(){
- this.setData({
- active:1,
- todoList:[],
- doneList:[],
- yfqList:[],
- yzdList:[],
- todoNum:0,
- doneNum:0,
- yfqNum:0,
- yzdNum:0
- })
- },
- 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:999,
- orderByColumn:"A.ID_",
- isAsc:"desc",
- systemType:4,
- method:"GET",
- // taskName:'相关人员审批'
- }
- UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'activity_business_type', {method:'GET'}, {
- success: (res) => {
- }
- })
- UTIL.httpRequest(API.URL_GET_TASKLIST,data, {
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- let list = [];
- for(let i = 0;i < res.total;i++){
- if(res.rows[i].formData){
- if (res.rows[i].formData.activityBusinessType == '16' || res.rows[i].formData.activityBusinessType=='36') {
- res.rows[i].formData.expenditureAmount = Number(res.rows[i].formData.expenditureAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
- return $1 + ","; }).replace(/\.$/, "")
- list.push(res.rows[i])
- }
- }
- }
- this.setData({todoList:list,todoNum:list.length})
-
- }
- }, fail: (res) => {
- console.log(res);
- },
- complete: (res) => {
- }
- })
- },
- getTaskDoneList:function(e){
- let data = {
- pageNum:1,
- pageSize:999,
- orderByColumn:"A.ID_",
- isAsc:"desc",
- systemType:4,
- method:"GET",
- // taskName:'相关人员审批'
- }
- UTIL.httpRequest(API.URL_GET_TASKDONELIST,data, {
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- let list = [];
- for(let i = 0;i<res.total;i++){
- if(res.rows[i].formData){
- if (res.rows[i].formData.activityBusinessType == '16' || res.rows[i].formData.activityBusinessType=='36') {
- let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType)
- res.rows[i].formData.transferType = d
- res.rows[i].formData.expenditureAmount = Number(res.rows[i].formData.expenditureAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
- return $1 + ","; }).replace(/\.$/, "")
- list.push(res.rows[i])
- }
- }
- }
- this.setData({doneList:list,doneNum:list.length})
- }
- }, fail: (res) => {
- console.log(res);
- },
- complete: (res) => {
- }
- })
- },
- getTransferList:function(e){
- let data = {
- // pageNum:1,
- // pageSize:10,
- transferType:"1",
- status:"5",
- method:"GET",
- applyUserName:this.data.userInfoObj.nickName
- }
- UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
- success: (res) => {
- console.log(res);
- if (res.code == API.SUCCESS_CODE) {
- let a = res.total
- this.setData({yfqNum:a})
- for(let i = 0;i<res.total;i++){
- res.rows[i].totalAmount = Number(res.rows[i].totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
- return $1 + ","; }).replace(/\.$/, "")
- }
- this.setData({yfqList:res.rows})
- }
- }, fail: (res) => {
- },
- complete: (res) => {
- }
- })
- },
- getTransferList1:function(e){
- let data = {
- // pageNum:1,
- // pageSize:10,
- transferType:"",
- params:{
- "auditStatusXiaochengxu":"2"
- },
- method:"POST",
- }
- UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
- success: (res) => {
- console.log(res);
- if (res.code == API.SUCCESS_CODE) {
- this.setData({yfqNum:res.total})
- let c = res.rows
- for(let i = 0;i< c.length;i++){
- c[i].totalAmount = Number(c[i].totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
- return $1 + ","; }).replace(/\.$/, "")
- }
- this.setData({yfqList:c})
- }
- }, fail: (res) => {
- },
- complete: (res) => {
- }
- })
- },
- //已制单
- getTransferList2:function(e){
- let data = {
- // pageNum:1,
- // pageSize:10,
- transferType:"",
- method:"POST",
- params:{
- "auditStatusXiaochengxu":"1"
- },
- }
- UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- this.setData({yzdNum:res.total})
- for(let i = 0;i< res.rows.length;i++){
- res.rows[i].totalAmount = Number(res.rows[i].totalAmount).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
- return $1 + ","; }).replace(/\.$/, "")
- }
- this.setData({yzdList:res.rows})
- }
- }, fail: (res) => {
- },
- complete: (res) => {
- }
- })
- },
- //跳转收入登记
- swichInCome:function(e){
- wx.navigateTo({
- url: '../inCome/index?',
- })
- },
- //跳转收入登记
- swichKeeping:function(e){
- wx.navigateTo({
- url: '/pages/Bookkeeping/Bookkeeping',
- })
- },
- //跳转支出申请
- 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?',
- })
- },
- toList:function(){
- wx.navigateTo({
- url: '/pages/handle/liist?active='+this.data.active,
- })
- },
- /* 计算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({region:res.user.deptName})
- this.setData({item:JSON.stringify(res.user)})
- this.getBookList()
- //查询已制单
- this.getTransferList2();
-
- //查询已发起
- // this.getTransferList();
- this.getTransferList1();
- }
- }
- })
- },
- /* 获取区镇村*/
- getTreeDept:function(){
- UTIL.httpRequest(API.URL_GET_TREESELECTBYUSER, {method:'GET'}, {
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- this.setData({provinces:res.data})
- if(res.data[0].children){
- this.setData({citys:res.data[0].children})
- if(res.data[0].children[this.data.value[1]].children){this.setData({areas:res.data[0].children[this.data.value[1]].children})}
- }
-
- }
- }
- })
- },
- /* 获取账套*/
- getBookList:function(){
- var that = this ;
- let d = {
- loginDeptID : this.data.userInfoObj.loginDeptId,
- method:'GET'
- }
- UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- this.setData({bookList:res.rows})
- if(this.data.bookName==""&&res.total>0){
- let loginBookId = res.rows.filter(function (e) { return e.id == that.data.userInfoObj.loginBookId; });
- if(loginBookId.length > 0){
- loginBookId =loginBookId[0].bookName
- this.setData({bookName:loginBookId})
- this.setData({bookId:res.rows[0].id})
- }else{
- this.setData({bookName:"选择账套"})
- }
- }else if(this.data.bookName==""&&res.total==0){
- this.setData({bookName:"无可用账套"})
- }
- }
- },fail:(res) => {
-
- },complete:(res) => {
-
- }
- })
- },
- bindPickerChange:function(e){
- this.setData({
- bookId: this.data.bookList[e.detail.value].id,
- bookName:this.data.bookList[e.detail.value].bookName
- })
- let data={
- loginBookId:this.data.bookList[e.detail.value].id,
- method:'GET'
- }
- let _this = this
- UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
- success: (res) => {
- _this.reset();
- _this.onShow();
- }
- })
- },
- closePopUp() {
- this.setData({
- visible: false
- })
- },
- pickAddress() {
- this.setData({
- visible: true,
- value: [...this.data.regionValue]
- })
- },
- // 处理省市县联动逻辑 并保存 value
- cityChange(e) {
- var value = e.detail.value
- let {
- provinces,
- citys
- } = this.data
- var provinceNum = value[0]
- var cityNum = value[1]
- var areaNum = value[2]
-
- if (this.data.value[0] !== provinceNum) {
- var id = provinces[provinceNum].id
- this.setData({
- value: [provinceNum, 0, 0],
- citys: this.data.provinces[provinceNum].children,
- areas: this.data.provinces[provinceNum].children[cityNum].children
- })
- } else if (this.data.value[1] !== cityNum) {
- var id = citys[cityNum].id
- this.setData({
- value: [provinceNum, cityNum, 0],
- areas: this.data.provinces[provinceNum].children[cityNum].children
- })
- } else {
- this.setData({
- value: [provinceNum, cityNum, areaNum]
- })
- }
-
- console.log(this.data.value);
- },
- preventTouchmove() {},
- // 城市选择器
- // 点击地区选择取消按钮
- cityCancel(e) {
- var id = this.data.provinces[0].id
- this.setData({
- citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
- areas: this.data.lastAreas || this.data.userInfoObj.deptName,
- value: [...this.data.regionValue],
- visible: false
- })
- },
- // 提交时由序号获取省市区id
- getRegionId(type) {
- console.log(this.data.provinces);
- console.log(this.data.regionValue);
- let value = this.data.regionValue
- if (type === 'provinceId') {
- let provinceId = this.data.provinces[value[0]].id
- return provinceId
- } else if (type === 'townId') {
- let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
- return townId
- } else {
- let areaId = ''
- if (this.data.provinces[value[0]].children[value[1]].children) {
- areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
- } else if(this.data.provinces[value[0]].children){
- areaId = this.data.provinces[value[0]].children[value[1]].id
- } else if(this.data.provinces[value[0]]){
- areaId = this.data.provinces[value[0]].id
- } else {
- areaId = 0
- }
- return areaId
- }
- },
- chooseStart(e) {
- this.setData({
- isCanConfirm: false
- })
- },
- chooseEnd(e) {
- this.setData({
- isCanConfirm: true
- })
- },
- // 点击地区选择确定按钮
- citySure(e) {
- if (this.data.isCanConfirm) {
- var value = this.data.value
- this.setData({
- visible: false
- })
- // 将选择的城市信息显示到输入框
- try {
- var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
- if (this.data.areas.length > 0) {
- region = this.data.areas[value[2]].label || ''
- } else {
- this.data.value[2] = 0
- }
- } catch (error) {
- console.log('adress select something error')
- }
-
- console.log(this.getRegionId('areas'));
- this.setData({
- region: region,
- lastCitys: this.data.citys,
- lastAreas: this.data.areas,
- regionValue: value,
- deptId:this.getRegionId('areas'),
- bookName:"",
- bookId:""
- }, () => {
- let data={
- loginDeptID : this.getRegionId('areas'),
- method:'GET'
- }
- let _this = this
- UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
- success: (res) => {
- setTimeout(()=>{
- _this.reset()
- _this.onShow()
- },1000)
- }
- })
- })
-
- // this.data.userInfoObj.loginDeptId = this.getRegionId('areas');
- // this.getBookList();
-
- }
- },
- godetail:function(e){
- // wx.navigateTo({
- // url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id,
- // })
- wx.navigateTo({
- url: '/pages/apply/paymentTemplate/addNew/addNew?id='+e.currentTarget.dataset.id,
- })
- },
- goMajorDetail:function(e){
- wx.navigateTo({
- url: 'majorDetail/majorDetail?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid+'&type='+e.currentTarget.dataset.type,
- })
- },
- gosee:function(e){
- wx.navigateTo({
- url: '/pages/handle/expenditureAuditNew/expenditureAuditNew?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid+'&type='+e.currentTarget.dataset.type+'&business='+e.currentTarget.dataset.business,
- })
- },
- goUpdate(e){
- wx.navigateTo({
- url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id,
- })
- },
- showModal(){
- wx.showModal({
- title: '提示',
- content: '此功能未正式启用!',
- showCancel: false,
- success (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- navigate(even){
- wx.navigateTo({
- url: even.currentTarget.dataset.url,
- })
- },
- delete(e){
- console.log(e);
- var that = this;
- wx.showModal({
- title: '提示',
- content: '确认删除?',
- success (res) {
- if (res.confirm) {
- UTIL.httpRequest(API.URL_GET_REMOVETRANFERL + e.currentTarget.dataset.id, {method:'GET'},{
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- that.data.yzdList.splice(e.currentTarget.dataset.index, 1);
- wx.showToast({
- title: '删除成功!',
- icon: 'success',
- duration: 2000
- })
- that.setData({
- yzdList : that.data.yzdList,
- yzdNum:that.data.yzdNum-1
- })
- }
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- goRegion(){
- wx.navigateTo({
- url: '/pages/user/region/region',
- })
- },
- testBtn(){
- wx.requestSubscribeMessage({
- tmplIds: ['_Npje859RvKIf5AcqaikWYGXJpOcigMTzyB3HjJ1L9I'],
- success (res) { }
- })
- },
- rollback(e){
- var that = this;
- let prames = {
- id : e.currentTarget.dataset.id,
- auditStatus : '0',
- applyUserId : '',
- applyUserName : '',
- applyTime : '',
- instanceId : '',
- processKey : '',
- method:'POST'
- }
- wx.showModal({
- title: '提示',
- content: '确认撤回?',
- success (res) {
- if (res.confirm) {
- UTIL.httpRequest(API.URL_GET_UPDATETYINNONGTRANSFERFOSTATUS, prames ,{
- success: (res) => {
- if (res.code == API.SUCCESS_CODE) {
- wx.showToast({
- title: '撤回成功!',
- icon: 'success',
- duration: 2000
- })
- that.setData({
- yfqList:[],
- yzdList:[]
- })
- that.getTransferList2()
- that.getTransferList1()
- }else{
- wx.showToast({
- title: res.msg,
- icon: 'error',
- duration: 2000
- })
- }
- }
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- })
|