微信小程序
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.

3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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. //查询已发起
  62. this.getTransferList();
  63. this.getTransferList1();
  64. //查询已制单
  65. this.getTransferList2();
  66. //查询dept
  67. this.getTreeDept();
  68. },
  69. reset:function(){
  70. this.setData({
  71. active:1,
  72. todoList:[],
  73. doneList:[],
  74. yfqList:[],
  75. yzdList:[],
  76. todoNum:0,
  77. doneNum:0,
  78. yfqNum:0,
  79. yzdNum:0
  80. })
  81. },
  82. switchTab:function(e){
  83. this.setData({
  84. active:e.currentTarget.dataset.gid
  85. })
  86. },
  87. dictTranslate(d,value){
  88. let val = ""
  89. for(var index in d){
  90. if(d[index].dictVale==value){
  91. return val = d[index].dictLabel
  92. }
  93. }
  94. },
  95. getTaskList:function(e){
  96. let data = {
  97. pageNum:1,
  98. pageSize:10,
  99. orderByColumn:"A.ID_",
  100. isAsc:"desc",
  101. systemType:4,
  102. method:"GET"
  103. }
  104. UTIL.httpRequest(API.URL_GET_TASKLIST,data, {
  105. success: (res) => {
  106. if (res.code == API.SUCCESS_CODE) {
  107. this.setData({todoNum:res.total})
  108. if(res.rows!=null&&res.rows!=""){
  109. for(let i = 0;i<res.total;i++){
  110. let d = this.dictTranslate(this.data.transferType,res.rows[i].formData.transferType)
  111. res.rows[i].formData.transferType = d
  112. }
  113. this.setData({todoList:res.rows})
  114. }
  115. }
  116. }, fail: (res) => {
  117. console.log(res);
  118. },
  119. complete: (res) => {
  120. }
  121. })
  122. },
  123. getTaskDoneList:function(e){
  124. let data = {
  125. pageNum:1,
  126. pageSize:10,
  127. orderByColumn:"A.ID_",
  128. isAsc:"desc",
  129. systemType:4,
  130. method:"GET"
  131. }
  132. UTIL.httpRequest(API.URL_GET_TASKDONELIST,data, {
  133. success: (res) => {
  134. if (res.code == API.SUCCESS_CODE) {
  135. this.setData({doneNum:res.total})
  136. if(res.rows!=null&&res.rows!=""){
  137. for(var index in res.rows){
  138. let d = this.dictTranslate(this.data.transferType,res.rows[index].formData.transferType)
  139. res.rows[index].formData.transferType = d
  140. }
  141. this.setData({doneList:res.rows})
  142. }
  143. }
  144. }, fail: (res) => {
  145. console.log(res);
  146. },
  147. complete: (res) => {
  148. }
  149. })
  150. },
  151. getTransferList:function(e){
  152. let data = {
  153. // pageNum:1,
  154. // pageSize:10,
  155. transferType:"1",
  156. auditStatus:"2",
  157. method:"GET"
  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 = this.data.yfqNum+res.total
  164. this.setData({yfqNum:a})
  165. let b = this.data.yfqList
  166. this.setData({yfqList:res.rows.concat(b)})
  167. }
  168. }, fail: (res) => {
  169. },
  170. complete: (res) => {
  171. }
  172. })
  173. },
  174. getTransferList1:function(e){
  175. let data = {
  176. // pageNum:1,
  177. // pageSize:10,
  178. transferType:"1",
  179. auditStatus:"3",
  180. method:"GET"
  181. }
  182. UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
  183. success: (res) => {
  184. console.log(res);
  185. if (res.code == API.SUCCESS_CODE) {
  186. let a = this.data.yfqNum+res.total
  187. this.setData({yfqNum:a})
  188. let b = this.data.yfqList
  189. this.setData({yfqList:res.rows.concat(b)})
  190. }
  191. }, fail: (res) => {
  192. },
  193. complete: (res) => {
  194. }
  195. })
  196. },
  197. //已制单
  198. getTransferList2:function(e){
  199. let data = {
  200. // pageNum:1,
  201. // pageSize:10,
  202. transferType:"1",
  203. auditStatus:"0",
  204. method:"GET"
  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. }
  282. })
  283. },
  284. /* 获取区镇村*/
  285. getTreeDept:function(){
  286. UTIL.httpRequest(API.URL_GET_TREESELECTBYUSER, {method:'GET'}, {
  287. success: (res) => {
  288. if (res.code == API.SUCCESS_CODE) {
  289. this.setData({provinces:res.data})
  290. this.setData({citys:res.data[0].children})
  291. this.setData({areas:res.data[0].children[this.data.value[1]].children})
  292. }
  293. }
  294. })
  295. },
  296. /* 获取账套*/
  297. getBookList:function(){
  298. let d = {
  299. loginDeptID : this.data.userInfoObj.loginDeptId
  300. }
  301. UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
  302. success: (res) => {
  303. if (res.code == API.SUCCESS_CODE) {
  304. this.setData({bookList:res.rows})
  305. if(this.data.bookName==""&&res.total>0){
  306. this.setData({bookName:res.rows[0].bookName})
  307. this.setData({bookId:res.rows[0].id})
  308. }else if(this.data.bookName==""&&res.total==0){
  309. this.setData({bookName:"无可用账套"})
  310. }
  311. }
  312. },fail:(res) => {
  313. },complete:(res) => {
  314. }
  315. })
  316. },
  317. bindPickerChange:function(e){
  318. this.setData({
  319. bookId: this.data.bookList[e.detail.value].id,
  320. bookName:this.data.bookList[e.detail.value].bookName
  321. })
  322. let data={
  323. loginBookId:this.data.bookList[e.detail.value].id
  324. }
  325. let _this = this
  326. UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
  327. success: (res) => {
  328. _this.reset()
  329. _this.onLoad()
  330. }
  331. })
  332. },
  333. closePopUp() {
  334. this.setData({
  335. visible: false
  336. })
  337. },
  338. pickAddress() {
  339. this.setData({
  340. visible: true,
  341. value: [...this.data.regionValue]
  342. })
  343. },
  344. // 处理省市县联动逻辑 并保存 value
  345. cityChange(e) {
  346. var value = e.detail.value
  347. let {
  348. provinces,
  349. citys
  350. } = this.data
  351. var provinceNum = value[0]
  352. var cityNum = value[1]
  353. var areaNum = value[2]
  354. if (this.data.value[0] !== provinceNum) {
  355. var id = provinces[provinceNum].id
  356. this.setData({
  357. value: [provinceNum, 0, 0],
  358. citys: this.data.provinces[provinceNum].children,
  359. areas: this.data.provinces[provinceNum].children[cityNum].children
  360. })
  361. } else if (this.data.value[1] !== cityNum) {
  362. var id = citys[cityNum].id
  363. this.setData({
  364. value: [provinceNum, cityNum, 0],
  365. areas: this.data.provinces[provinceNum].children[cityNum].children
  366. })
  367. } else {
  368. this.setData({
  369. value: [provinceNum, cityNum, areaNum]
  370. })
  371. }
  372. console.log(this.data.value);
  373. },
  374. preventTouchmove() {},
  375. // 城市选择器
  376. // 点击地区选择取消按钮
  377. cityCancel(e) {
  378. var id = this.data.provinces[0].id
  379. this.setData({
  380. citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
  381. areas: this.data.lastAreas || this.data.userInfoObj.deptName,
  382. value: [...this.data.regionValue],
  383. visible: false
  384. })
  385. },
  386. // 提交时由序号获取省市区id
  387. getRegionId(type) {
  388. let value = this.data.regionValue
  389. let provinceId = this.data.provinces[value[0]].id
  390. let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  391. let areaId = ''
  392. if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) {
  393. areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  394. } else {
  395. areaId = 0
  396. }
  397. if (type === 'provinceId') {
  398. return provinceId
  399. } else if (type === 'townId') {
  400. return townId
  401. } else {
  402. return areaId
  403. }
  404. },
  405. chooseStart(e) {
  406. this.setData({
  407. isCanConfirm: false
  408. })
  409. },
  410. chooseEnd(e) {
  411. this.setData({
  412. isCanConfirm: true
  413. })
  414. },
  415. // 点击地区选择确定按钮
  416. citySure(e) {
  417. if (this.data.isCanConfirm) {
  418. var value = this.data.value
  419. this.setData({
  420. visible: false
  421. })
  422. // 将选择的城市信息显示到输入框
  423. try {
  424. var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
  425. if (this.data.areas.length > 0) {
  426. region = this.data.areas[value[2]].label || ''
  427. } else {
  428. this.data.value[2] = 0
  429. }
  430. } catch (error) {
  431. console.log('adress select something error')
  432. }
  433. this.setData({
  434. region: region,
  435. lastCitys: this.data.citys,
  436. lastAreas: this.data.areas,
  437. regionValue: value,
  438. deptId:this.getRegionId('areas'),
  439. bookName:"",
  440. bookId:""
  441. }, () => {
  442. let data={
  443. loginDeptID : this.getRegionId('areas')
  444. }
  445. let _this = this
  446. UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
  447. success: (res) => {
  448. setTimeout(()=>{
  449. _this.reset()
  450. _this.onLoad()
  451. },1000)
  452. }
  453. })
  454. })
  455. }
  456. }
  457. })