微信小程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

271 linhas
7.5 KiB

  1. import * as UTIL from '../../utils/util.js';
  2. import * as API from '../../utils/API.js';
  3. Page({
  4. data: {
  5. //顶部胶囊按钮位置信息rect
  6. CustomMenuButton: null,
  7. wrokScrollHeight:0,
  8. userInfoObj:{}, //用户信息,
  9. item:"",
  10. active:1,
  11. // 待办列表
  12. todoList:[],
  13. // 已办列表
  14. doneList:[],
  15. // 已发起
  16. yfqList:[],
  17. // 已制单
  18. yzdList:[],
  19. //待办数量
  20. todoNum:0,
  21. //已办数量
  22. doneNum:0,
  23. //已发起数量
  24. yfqNum:0,
  25. //已制单数量
  26. yzdNum:0,
  27. //字典
  28. transferType:[
  29. {"dictVale":1,"dictLabel":"村账户转账"},
  30. {"dictVale":2,"dictLabel":"公务卡转账"},
  31. {"dictVale":3,"dictLabel":"虚拟挂账"},
  32. {"dictVale":4,"dictLabel":"代管账户转账"},
  33. {"dictVale":5,"dictLabel":"母子转账"},
  34. {"dictVale":10,"dictLabel":"现金提现"},
  35. {"dictVale":11,"dictLabel":"现金使用"},
  36. {"dictVale":12,"dictLabel":"汇票支出"}
  37. ]
  38. },
  39. onLoad: function (options) {
  40. //获取用户信息
  41. this.getUserInfo()
  42. //获取滚动条高度
  43. this.computeBarLocation();
  44. //查询待办
  45. this.getTaskList();
  46. //查询已办
  47. this.getTaskDoneList();
  48. //查询已发起
  49. this.getTransferList();
  50. this.getTransferList1();
  51. //查询已制单
  52. this.getTransferList2();
  53. },
  54. switchTab:function(e){
  55. this.setData({
  56. active:e.currentTarget.dataset.gid
  57. })
  58. },
  59. dictTranslate(d,value){
  60. let val = ""
  61. for(var index in d){
  62. if(d[index].dictVale==value){
  63. return val = d[index].dictLabel
  64. }
  65. }
  66. },
  67. getTaskList:function(e){
  68. let data = {
  69. pageNum:1,
  70. pageSize:10,
  71. orderByColumn:"A.ID_",
  72. isAsc:"desc",
  73. systemType:4,
  74. method:"GET"
  75. }
  76. UTIL.httpRequest(API.URL_GET_TASKLIST,data, {
  77. success: (res) => {
  78. if (res.code == API.SUCCESS_CODE) {
  79. this.setData({todoNum:res.total})
  80. if(res.rows!=null&&res.rows!=""){
  81. for(let i = 0;i<res.total;i++){
  82. let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType)
  83. res.rows[i].formData.transferType = d
  84. }
  85. this.setData({todoList:res.rows})
  86. }
  87. }
  88. }, fail: (res) => {
  89. console.log(res);
  90. },
  91. complete: (res) => {
  92. console.log(res);
  93. }
  94. })
  95. },
  96. getTaskDoneList:function(e){
  97. let data = {
  98. pageNum:1,
  99. pageSize:10,
  100. orderByColumn:"A.ID_",
  101. isAsc:"desc",
  102. systemType:4,
  103. method:"GET"
  104. }
  105. UTIL.httpRequest(API.URL_GET_TASKDONELIST,data, {
  106. success: (res) => {
  107. if (res.code == API.SUCCESS_CODE) {
  108. this.setData({doneNum:res.total})
  109. if(res.rows!=null&&res.rows!=""){
  110. for(var index in res.rows){
  111. let d = this.dictTranslate(this.data.transferType,res.rows[index].formData.transferType)
  112. res.rows[index].formData.transferType = d
  113. }
  114. this.setData({doneList:res.rows})
  115. }
  116. }
  117. }, fail: (res) => {
  118. console.log(res);
  119. },
  120. complete: (res) => {
  121. console.log(res);
  122. }
  123. })
  124. },
  125. getTransferList:function(e){
  126. let data = {
  127. // pageNum:1,
  128. // pageSize:10,
  129. transferType:"1",
  130. auditStatus:"2",
  131. method:"GET"
  132. }
  133. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  134. success: (res) => {
  135. if (res.code == API.SUCCESS_CODE) {
  136. console.log(res);
  137. let a = this.data.yfqNum+res.total
  138. this.setData({yfqNum:a})
  139. this.setData({yfqList:res.rows})
  140. }
  141. }, fail: (res) => {
  142. console.log(res);
  143. },
  144. complete: (res) => {
  145. console.log(res);
  146. }
  147. })
  148. },
  149. getTransferList1:function(e){
  150. let data = {
  151. // pageNum:1,
  152. // pageSize:10,
  153. transferType:"1",
  154. auditStatus:"3",
  155. method:"GET"
  156. }
  157. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  158. success: (res) => {
  159. if (res.code == API.SUCCESS_CODE) {
  160. console.log();
  161. let a = this.data.yfqNum+res.total
  162. this.setData({yfqNum:a})
  163. this.setData({yfqList:res.rows})
  164. }
  165. }, fail: (res) => {
  166. console.log(res);
  167. },
  168. complete: (res) => {
  169. console.log(res);
  170. }
  171. })
  172. },
  173. //已制单
  174. getTransferList2:function(e){
  175. let data = {
  176. // pageNum:1,
  177. // pageSize:10,
  178. transferType:"1",
  179. auditStatus:"0",
  180. method:"GET"
  181. }
  182. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  183. success: (res) => {
  184. if (res.code == API.SUCCESS_CODE) {
  185. this.setData({yzdNum:res.total})
  186. this.setData({yzdList:res.rows})
  187. }
  188. }, fail: (res) => {
  189. console.log(res);
  190. },
  191. complete: (res) => {
  192. console.log(res);
  193. }
  194. })
  195. },
  196. //跳转收入登记
  197. swichInCome:function(e){
  198. wx.navigateTo({
  199. url: '../inCome/inCome?',
  200. })
  201. },
  202. //跳转支出申请
  203. swichPayment:function(e){
  204. console.log(e.currentTarget.dataset.current);
  205. // let cur = e.currentTarget.dataset.current;
  206. // if (this.data.currentTaB == cur) {
  207. // return false;
  208. // }else{
  209. // wx.navigateTo({
  210. // url: '../inCome/index?id=' + id,
  211. // })
  212. // }
  213. wx.navigateTo({
  214. url: '/pages/apply/index?',
  215. })
  216. },
  217. //跳转个人设置
  218. swichSettle:function(e){
  219. // console.log(e.currentTarget.dataset.current);
  220. // let cur = e.currentTarget.dataset.current;
  221. // if (this.data.currentTaB == cur) {
  222. // return false;
  223. // }else{
  224. // wx.navigateTo({
  225. // url: '../inCome/index?id=' + id,
  226. // })
  227. // }
  228. wx.navigateTo({
  229. url: 'settle/index?',
  230. })
  231. },
  232. /* 计算bar 高度*/
  233. computeBarLocation() {
  234. var that = this;
  235. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  236. let CustomWidows = wx.getSystemInfoSync();
  237. // 根据文档,先创建一个SelectorQuery对象实例
  238. let query = wx.createSelectorQuery().in(this);
  239. query.select('.top_title').boundingClientRect();
  240. query.select('.information_header').boundingClientRect();
  241. query.select('.navList_main').boundingClientRect();
  242. query.select('.child_function').boundingClientRect();
  243. query.select('.work_plan').boundingClientRect();
  244. query.exec((res) => {
  245. let wrokScrollHeight = CustomWidows.windowHeight;
  246. res.forEach((v)=>{
  247. wrokScrollHeight = wrokScrollHeight - v.height;
  248. })
  249. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  250. that.setData({
  251. wrokScrollHeight: wrokScrollHeight,
  252. });
  253. })
  254. that.setData({
  255. CustomMenuButton: CustomMenuButton,
  256. });
  257. },
  258. /* 获取用户信息*/
  259. getUserInfo(){
  260. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  261. success: (res) => {
  262. if (res.code == API.SUCCESS_CODE) {
  263. this.setData({userInfoObj:res.user})
  264. this.setData({item:JSON.stringify(res.user)})
  265. }
  266. }
  267. })
  268. }
  269. })