微信小程序
Não pode escolher mais do que 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.

index.js 14 KiB

há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. address: '', //详细收货地址(四级)
  11. value: [0, 0, 0], // 地址选择器省市区 暂存 currentIndex
  12. region: '', //所在地区
  13. deptId: '',
  14. regionValue: [0, 0, 0], // 地址选择器省市区 最终 currentIndex
  15. provinces: [], // 一级地址
  16. citys: [], // 二级地址
  17. areas: [], // 三级地址
  18. visible: false,
  19. isCanConfirm: true, //是否禁止在第一列滚动期间点击确定提交数据
  20. bookId:"",
  21. bookName:"",
  22. bookList:[],
  23. active:1,
  24. // 待办列表
  25. todoList:[],
  26. // 已办列表
  27. doneList:[],
  28. // 已发起
  29. yfqList:[],
  30. // 已制单
  31. yzdList:[],
  32. //待办数量
  33. todoNum:0,
  34. //已办数量
  35. doneNum:0,
  36. //已发起数量
  37. yfqNum:0,
  38. //已制单数量
  39. yzdNum:0,
  40. //字典
  41. transferType:[
  42. {"dictVale":1,"dictLabel":"村账户转账"},
  43. {"dictVale":2,"dictLabel":"公务卡转账"},
  44. {"dictVale":3,"dictLabel":"虚拟挂账"},
  45. {"dictVale":4,"dictLabel":"代管账户转账"},
  46. {"dictVale":5,"dictLabel":"母子转账"},
  47. {"dictVale":10,"dictLabel":"现金提现"},
  48. {"dictVale":11,"dictLabel":"现金使用"},
  49. {"dictVale":12,"dictLabel":"汇票支出"}
  50. ]
  51. },
  52. onLoad: function (options) {
  53. //获取滚动条高度
  54. this.computeBarLocation();
  55. },
  56. onShow(){
  57. //获取用户信息
  58. this.getUserInfo()
  59. //查询待办
  60. this.getTaskList();
  61. //查询已办
  62. this.getTaskDoneList();
  63. //查询dept
  64. this.getTreeDept();
  65. },
  66. reset:function(){
  67. this.setData({
  68. active:1,
  69. todoList:[],
  70. doneList:[],
  71. yfqList:[],
  72. yzdList:[],
  73. todoNum:0,
  74. doneNum:0,
  75. yfqNum:0,
  76. yzdNum:0
  77. })
  78. },
  79. switchTab:function(e){
  80. this.setData({
  81. active:e.currentTarget.dataset.gid
  82. })
  83. },
  84. dictTranslate(d,value){
  85. let val = ""
  86. for(var index in d){
  87. if(d[index].dictVale==value){
  88. return val = d[index].dictLabel
  89. }
  90. }
  91. },
  92. getTaskList:function(e){
  93. let data = {
  94. pageNum:1,
  95. pageSize:10,
  96. orderByColumn:"A.ID_",
  97. isAsc:"desc",
  98. systemType:4,
  99. method:"GET",
  100. taskName:'相关人员审批'
  101. }
  102. UTIL.httpRequest(API.URL_GET_TASKLIST,data, {
  103. success: (res) => {
  104. if (res.code == API.SUCCESS_CODE) {
  105. this.setData({todoNum:res.total})
  106. if(res.rows!=null&&res.rows!=""){
  107. for(let i = 0;i<res.total;i++){
  108. let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType)
  109. res.rows[i].formData.transferType = d
  110. }
  111. this.setData({todoList:res.rows})
  112. }
  113. }
  114. }, fail: (res) => {
  115. console.log(res);
  116. },
  117. complete: (res) => {
  118. }
  119. })
  120. },
  121. getTaskDoneList:function(e){
  122. let data = {
  123. pageNum:1,
  124. pageSize:10,
  125. orderByColumn:"A.ID_",
  126. isAsc:"desc",
  127. systemType:4,
  128. method:"GET",
  129. taskName:'相关人员审批'
  130. }
  131. UTIL.httpRequest(API.URL_GET_TASKDONELIST,data, {
  132. success: (res) => {
  133. if (res.code == API.SUCCESS_CODE) {
  134. this.setData({doneNum:res.total})
  135. if(res.rows!=null&&res.rows!=""){
  136. for(var index in res.rows){
  137. let d = this.dictTranslate(this.data.transferType,res.rows[index].formData.transferType)
  138. res.rows[index].formData.transferType = d
  139. }
  140. this.setData({doneList:res.rows})
  141. }
  142. }
  143. }, fail: (res) => {
  144. console.log(res);
  145. },
  146. complete: (res) => {
  147. }
  148. })
  149. },
  150. getTransferList:function(e){
  151. let data = {
  152. // pageNum:1,
  153. // pageSize:10,
  154. transferType:"1",
  155. status:"5",
  156. method:"GET",
  157. applyUserName:this.data.userInfoObj.nickName
  158. }
  159. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  160. success: (res) => {
  161. console.log(res);
  162. if (res.code == API.SUCCESS_CODE) {
  163. let a = res.total
  164. this.setData({yfqNum:a})
  165. this.setData({yfqList:res.rows})
  166. }
  167. }, fail: (res) => {
  168. },
  169. complete: (res) => {
  170. }
  171. })
  172. },
  173. getTransferList1:function(e){
  174. let data = {
  175. // pageNum:1,
  176. // pageSize:10,
  177. transferType:"1",
  178. auditStatus:"3",
  179. method:"GET"
  180. }
  181. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  182. success: (res) => {
  183. console.log(res);
  184. if (res.code == API.SUCCESS_CODE) {
  185. let a = this.data.yfqNum+res.total
  186. this.setData({yfqNum:a})
  187. let b = this.data.yfqList
  188. this.setData({yfqList:res.rows.concat(b)})
  189. }
  190. }, fail: (res) => {
  191. },
  192. complete: (res) => {
  193. }
  194. })
  195. },
  196. //已制单
  197. getTransferList2:function(e){
  198. let data = {
  199. // pageNum:1,
  200. // pageSize:10,
  201. transferType:"1",
  202. status:"0",
  203. method:"GET",
  204. submitter:this.data.userInfoObj.nickName
  205. }
  206. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  207. success: (res) => {
  208. if (res.code == API.SUCCESS_CODE) {
  209. this.setData({yzdNum:res.total})
  210. this.setData({yzdList:res.rows})
  211. }
  212. }, fail: (res) => {
  213. },
  214. complete: (res) => {
  215. }
  216. })
  217. },
  218. //跳转收入登记
  219. swichInCome:function(e){
  220. wx.navigateTo({
  221. url: '../inCome/inCome?',
  222. })
  223. },
  224. //跳转支出申请
  225. swichPayment:function(e){
  226. console.log(e.currentTarget.dataset.current);
  227. // let cur = e.currentTarget.dataset.current;
  228. // if (this.data.currentTaB == cur) {
  229. // return false;
  230. // }else{
  231. // wx.navigateTo({
  232. // url: '../inCome/index?id=' + id,
  233. // })
  234. // }
  235. wx.navigateTo({
  236. url: '/pages/apply/index?',
  237. })
  238. },
  239. toList:function(){
  240. wx.navigateTo({
  241. url: '/pages/handle/liist?active='+this.data.active,
  242. })
  243. },
  244. /* 计算bar 高度*/
  245. computeBarLocation() {
  246. var that = this;
  247. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  248. let CustomWidows = wx.getSystemInfoSync();
  249. // 根据文档,先创建一个SelectorQuery对象实例
  250. let query = wx.createSelectorQuery().in(this);
  251. query.select('.top_title').boundingClientRect();
  252. query.select('.information_header').boundingClientRect();
  253. query.select('.navList_main').boundingClientRect();
  254. query.select('.child_function').boundingClientRect();
  255. query.select('.work_plan').boundingClientRect();
  256. query.exec((res) => {
  257. let wrokScrollHeight = CustomWidows.windowHeight;
  258. res.forEach((v)=>{
  259. wrokScrollHeight = wrokScrollHeight - v.height;
  260. })
  261. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  262. that.setData({
  263. wrokScrollHeight: wrokScrollHeight,
  264. });
  265. })
  266. that.setData({
  267. CustomMenuButton: CustomMenuButton,
  268. });
  269. },
  270. /* 获取用户信息*/
  271. getUserInfo(){
  272. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  273. success: (res) => {
  274. if (res.code == API.SUCCESS_CODE) {
  275. this.setData({userInfoObj:res.user})
  276. console.log(res.user);
  277. this.setData({region:res.user.deptName})
  278. this.setData({item:JSON.stringify(res.user)})
  279. this.getBookList()
  280. //查询已制单
  281. this.getTransferList2();
  282. //查询已发起
  283. this.getTransferList();
  284. // this.getTransferList1();
  285. }
  286. }
  287. })
  288. },
  289. /* 获取区镇村*/
  290. getTreeDept:function(){
  291. UTIL.httpRequest(API.URL_GET_TREESELECTBYUSER, {method:'GET'}, {
  292. success: (res) => {
  293. if (res.code == API.SUCCESS_CODE) {
  294. this.setData({provinces:res.data})
  295. if(res.data[0].children){
  296. this.setData({citys:res.data[0].children})
  297. if(res.data[0].children[this.data.value[1]].children){this.setData({areas:res.data[0].children[this.data.value[1]].children})}
  298. }
  299. }
  300. }
  301. })
  302. },
  303. /* 获取账套*/
  304. getBookList:function(){
  305. let d = {
  306. loginDeptID : this.data.userInfoObj.loginDeptId,
  307. method:'GET'
  308. }
  309. UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
  310. success: (res) => {
  311. if (res.code == API.SUCCESS_CODE) {
  312. this.setData({bookList:res.rows})
  313. if(this.data.bookName==""&&res.total>0){
  314. this.setData({bookName:res.rows[0].bookName})
  315. this.setData({bookId:res.rows[0].id})
  316. }else if(this.data.bookName==""&&res.total==0){
  317. this.setData({bookName:"无可用账套"})
  318. }
  319. }
  320. },fail:(res) => {
  321. },complete:(res) => {
  322. }
  323. })
  324. },
  325. bindPickerChange:function(e){
  326. this.setData({
  327. bookId: this.data.bookList[e.detail.value].id,
  328. bookName:this.data.bookList[e.detail.value].bookName
  329. })
  330. let data={
  331. loginBookId:this.data.bookList[e.detail.value].id,
  332. method:'GET'
  333. }
  334. let _this = this
  335. UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
  336. success: (res) => {
  337. _this.reset()
  338. _this.onLoad()
  339. }
  340. })
  341. },
  342. closePopUp() {
  343. this.setData({
  344. visible: false
  345. })
  346. },
  347. pickAddress() {
  348. this.setData({
  349. visible: true,
  350. value: [...this.data.regionValue]
  351. })
  352. },
  353. // 处理省市县联动逻辑 并保存 value
  354. cityChange(e) {
  355. var value = e.detail.value
  356. let {
  357. provinces,
  358. citys
  359. } = this.data
  360. var provinceNum = value[0]
  361. var cityNum = value[1]
  362. var areaNum = value[2]
  363. if (this.data.value[0] !== provinceNum) {
  364. var id = provinces[provinceNum].id
  365. this.setData({
  366. value: [provinceNum, 0, 0],
  367. citys: this.data.provinces[provinceNum].children,
  368. areas: this.data.provinces[provinceNum].children[cityNum].children
  369. })
  370. } else if (this.data.value[1] !== cityNum) {
  371. var id = citys[cityNum].id
  372. this.setData({
  373. value: [provinceNum, cityNum, 0],
  374. areas: this.data.provinces[provinceNum].children[cityNum].children
  375. })
  376. } else {
  377. this.setData({
  378. value: [provinceNum, cityNum, areaNum]
  379. })
  380. }
  381. console.log(this.data.value);
  382. },
  383. preventTouchmove() {},
  384. // 城市选择器
  385. // 点击地区选择取消按钮
  386. cityCancel(e) {
  387. var id = this.data.provinces[0].id
  388. this.setData({
  389. citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
  390. areas: this.data.lastAreas || this.data.userInfoObj.deptName,
  391. value: [...this.data.regionValue],
  392. visible: false
  393. })
  394. },
  395. // 提交时由序号获取省市区id
  396. getRegionId(type) {
  397. let value = this.data.regionValue
  398. let provinceId = this.data.provinces[value[0]].id
  399. let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  400. let areaId = ''
  401. if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) {
  402. areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  403. } else {
  404. areaId = 0
  405. }
  406. if (type === 'provinceId') {
  407. return provinceId
  408. } else if (type === 'townId') {
  409. return townId
  410. } else {
  411. return areaId
  412. }
  413. },
  414. chooseStart(e) {
  415. this.setData({
  416. isCanConfirm: false
  417. })
  418. },
  419. chooseEnd(e) {
  420. this.setData({
  421. isCanConfirm: true
  422. })
  423. },
  424. // 点击地区选择确定按钮
  425. citySure(e) {
  426. if (this.data.isCanConfirm) {
  427. var value = this.data.value
  428. this.setData({
  429. visible: false
  430. })
  431. // 将选择的城市信息显示到输入框
  432. try {
  433. var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
  434. if (this.data.areas.length > 0) {
  435. region = this.data.areas[value[2]].label || ''
  436. } else {
  437. this.data.value[2] = 0
  438. }
  439. } catch (error) {
  440. console.log('adress select something error')
  441. }
  442. this.setData({
  443. region: region,
  444. lastCitys: this.data.citys,
  445. lastAreas: this.data.areas,
  446. regionValue: value,
  447. deptId:this.getRegionId('areas'),
  448. bookName:"",
  449. bookId:""
  450. }, () => {
  451. let data={
  452. loginDeptID : this.getRegionId('areas'),
  453. method:'GET'
  454. }
  455. let _this = this
  456. UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
  457. success: (res) => {
  458. setTimeout(()=>{
  459. _this.reset()
  460. _this.onLoad()
  461. },1000)
  462. }
  463. })
  464. })
  465. }
  466. },
  467. godetail:function(e){
  468. wx.navigateTo({
  469. url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id,
  470. })
  471. },
  472. gosee:function(e){
  473. wx.navigateTo({
  474. url: '/pages/handle/expenditureAudit/expenditureAudit?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid+'&type='+e.currentTarget.dataset.type+'&business='+e.currentTarget.dataset.business,
  475. })
  476. },
  477. goUpdate(e){
  478. wx.navigateTo({
  479. url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id,
  480. })
  481. },
  482. showModal(){
  483. wx.showModal({
  484. title: '提示',
  485. content: '功能正在开发中,敬请期待',
  486. showCancel: false,
  487. success (res) {
  488. if (res.confirm) {
  489. console.log('用户点击确定')
  490. } else if (res.cancel) {
  491. console.log('用户点击取消')
  492. }
  493. }
  494. })
  495. }
  496. })