微信小程序
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
3 anni fa
3 anni fa
3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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. method:'GET'
  305. }
  306. UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
  307. success: (res) => {
  308. if (res.code == API.SUCCESS_CODE) {
  309. this.setData({bookList:res.rows})
  310. if(this.data.bookName==""&&res.total>0){
  311. this.setData({bookName:res.rows[0].bookName})
  312. this.setData({bookId:res.rows[0].id})
  313. }else if(this.data.bookName==""&&res.total==0){
  314. this.setData({bookName:"无可用账套"})
  315. }
  316. }
  317. },fail:(res) => {
  318. },complete:(res) => {
  319. }
  320. })
  321. },
  322. bindPickerChange:function(e){
  323. this.setData({
  324. bookId: this.data.bookList[e.detail.value].id,
  325. bookName:this.data.bookList[e.detail.value].bookName
  326. })
  327. let data={
  328. loginBookId:this.data.bookList[e.detail.value].id,
  329. method:'GET'
  330. }
  331. let _this = this
  332. UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
  333. success: (res) => {
  334. _this.reset()
  335. _this.onLoad()
  336. }
  337. })
  338. },
  339. closePopUp() {
  340. this.setData({
  341. visible: false
  342. })
  343. },
  344. pickAddress() {
  345. this.setData({
  346. visible: true,
  347. value: [...this.data.regionValue]
  348. })
  349. },
  350. // 处理省市县联动逻辑 并保存 value
  351. cityChange(e) {
  352. var value = e.detail.value
  353. let {
  354. provinces,
  355. citys
  356. } = this.data
  357. var provinceNum = value[0]
  358. var cityNum = value[1]
  359. var areaNum = value[2]
  360. if (this.data.value[0] !== provinceNum) {
  361. var id = provinces[provinceNum].id
  362. this.setData({
  363. value: [provinceNum, 0, 0],
  364. citys: this.data.provinces[provinceNum].children,
  365. areas: this.data.provinces[provinceNum].children[cityNum].children
  366. })
  367. } else if (this.data.value[1] !== cityNum) {
  368. var id = citys[cityNum].id
  369. this.setData({
  370. value: [provinceNum, cityNum, 0],
  371. areas: this.data.provinces[provinceNum].children[cityNum].children
  372. })
  373. } else {
  374. this.setData({
  375. value: [provinceNum, cityNum, areaNum]
  376. })
  377. }
  378. console.log(this.data.value);
  379. },
  380. preventTouchmove() {},
  381. // 城市选择器
  382. // 点击地区选择取消按钮
  383. cityCancel(e) {
  384. var id = this.data.provinces[0].id
  385. this.setData({
  386. citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
  387. areas: this.data.lastAreas || this.data.userInfoObj.deptName,
  388. value: [...this.data.regionValue],
  389. visible: false
  390. })
  391. },
  392. // 提交时由序号获取省市区id
  393. getRegionId(type) {
  394. let value = this.data.regionValue
  395. let provinceId = this.data.provinces[value[0]].id
  396. let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  397. let areaId = ''
  398. if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) {
  399. areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  400. } else {
  401. areaId = 0
  402. }
  403. if (type === 'provinceId') {
  404. return provinceId
  405. } else if (type === 'townId') {
  406. return townId
  407. } else {
  408. return areaId
  409. }
  410. },
  411. chooseStart(e) {
  412. this.setData({
  413. isCanConfirm: false
  414. })
  415. },
  416. chooseEnd(e) {
  417. this.setData({
  418. isCanConfirm: true
  419. })
  420. },
  421. // 点击地区选择确定按钮
  422. citySure(e) {
  423. if (this.data.isCanConfirm) {
  424. var value = this.data.value
  425. this.setData({
  426. visible: false
  427. })
  428. // 将选择的城市信息显示到输入框
  429. try {
  430. var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
  431. if (this.data.areas.length > 0) {
  432. region = this.data.areas[value[2]].label || ''
  433. } else {
  434. this.data.value[2] = 0
  435. }
  436. } catch (error) {
  437. console.log('adress select something error')
  438. }
  439. this.setData({
  440. region: region,
  441. lastCitys: this.data.citys,
  442. lastAreas: this.data.areas,
  443. regionValue: value,
  444. deptId:this.getRegionId('areas'),
  445. bookName:"",
  446. bookId:""
  447. }, () => {
  448. let data={
  449. loginDeptID : this.getRegionId('areas'),
  450. method:'GET'
  451. }
  452. let _this = this
  453. UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
  454. success: (res) => {
  455. setTimeout(()=>{
  456. _this.reset()
  457. _this.onLoad()
  458. },1000)
  459. }
  460. })
  461. })
  462. }
  463. },
  464. godetail:function(e){
  465. wx.navigateTo({
  466. url: '/pages/apply/paymentTemplate/add/add?id='+e.currentTarget.dataset.id,
  467. })
  468. },
  469. gosee:function(e){
  470. wx.navigateTo({
  471. url: '/pages/handle/expenditureAudit/expenditureAudit?id='+e.currentTarget.dataset.id+'&taskId='+e.currentTarget.dataset.taskid,
  472. })
  473. },
  474. })