微信小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

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