微信小程序
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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. this.setData({region:res.user.deptName})
  277. this.setData({item:JSON.stringify(res.user)})
  278. this.getBookList()
  279. }
  280. }
  281. })
  282. },
  283. /* 获取区镇村*/
  284. getTreeDept:function(){
  285. UTIL.httpRequest(API.URL_GET_TREESELECTBYUSER, {method:'GET'}, {
  286. success: (res) => {
  287. if (res.code == API.SUCCESS_CODE) {
  288. this.setData({provinces:res.data})
  289. this.setData({citys:res.data[0].children})
  290. this.setData({areas:res.data[0].children[this.data.value[1]].children})
  291. }
  292. }
  293. })
  294. },
  295. /* 获取区镇村*/
  296. getBookList:function(){
  297. let d = {
  298. loginDeptID : this.data.userInfoObj.loginDeptId
  299. }
  300. UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
  301. success: (res) => {
  302. if (res.code == API.SUCCESS_CODE) {
  303. this.setData({bookList:res.rows})
  304. if(this.data.bookName==""&&res.total>0){
  305. this.setData({bookName:res.rows[0].bookName})
  306. this.setData({bookId:res.rows[0].id})
  307. }else if(this.data.bookName==""&&res.total==0){
  308. this.setData({bookName:"无可用账套"})
  309. }
  310. }
  311. },fail:(res) => {
  312. },complete:(res) => {
  313. }
  314. })
  315. },
  316. bindPickerChange:function(e){
  317. this.setData({
  318. bookId: this.data.bookList[e.detail.value].id,
  319. bookName:this.data.bookList[e.detail.value].bookName
  320. })
  321. let data={
  322. loginBookId:this.data.bookList[e.detail.value].id
  323. }
  324. let _this = this
  325. UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
  326. success: (res) => {
  327. _this.reset()
  328. _this.onLoad()
  329. }
  330. })
  331. },
  332. closePopUp() {
  333. this.setData({
  334. visible: false
  335. })
  336. },
  337. pickAddress() {
  338. this.setData({
  339. visible: true,
  340. value: [...this.data.regionValue]
  341. })
  342. },
  343. // 处理省市县联动逻辑 并保存 value
  344. cityChange(e) {
  345. var value = e.detail.value
  346. let {
  347. provinces,
  348. citys
  349. } = this.data
  350. var provinceNum = value[0]
  351. var cityNum = value[1]
  352. var areaNum = value[2]
  353. if (this.data.value[0] !== provinceNum) {
  354. var id = provinces[provinceNum].id
  355. this.setData({
  356. value: [provinceNum, 0, 0],
  357. citys: this.data.provinces[provinceNum].children,
  358. areas: this.data.provinces[provinceNum].children[cityNum].children
  359. })
  360. } else if (this.data.value[1] !== cityNum) {
  361. var id = citys[cityNum].id
  362. this.setData({
  363. value: [provinceNum, cityNum, 0],
  364. areas: this.data.provinces[provinceNum].children[cityNum].children
  365. })
  366. } else {
  367. this.setData({
  368. value: [provinceNum, cityNum, areaNum]
  369. })
  370. }
  371. console.log(this.data.value);
  372. },
  373. preventTouchmove() {},
  374. // 城市选择器
  375. // 点击地区选择取消按钮
  376. cityCancel(e) {
  377. var id = this.data.provinces[0].id
  378. this.setData({
  379. citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
  380. areas: this.data.lastAreas || this.data.userInfoObj.deptName,
  381. value: [...this.data.regionValue],
  382. visible: false
  383. })
  384. },
  385. // 提交时由序号获取省市区id
  386. getRegionId(type) {
  387. let value = this.data.regionValue
  388. let provinceId = this.data.provinces[value[0]].id
  389. let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  390. let areaId = ''
  391. if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) {
  392. areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
  393. } else {
  394. areaId = 0
  395. }
  396. if (type === 'provinceId') {
  397. return provinceId
  398. } else if (type === 'townId') {
  399. return townId
  400. } else {
  401. return areaId
  402. }
  403. },
  404. chooseStart(e) {
  405. this.setData({
  406. isCanConfirm: false
  407. })
  408. },
  409. chooseEnd(e) {
  410. this.setData({
  411. isCanConfirm: true
  412. })
  413. },
  414. // 点击地区选择确定按钮
  415. citySure(e) {
  416. if (this.data.isCanConfirm) {
  417. var value = this.data.value
  418. this.setData({
  419. visible: false
  420. })
  421. // 将选择的城市信息显示到输入框
  422. try {
  423. var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
  424. if (this.data.areas.length > 0) {
  425. region = this.data.areas[value[2]].label || ''
  426. } else {
  427. this.data.value[2] = 0
  428. }
  429. } catch (error) {
  430. console.log('adress select something error')
  431. }
  432. this.setData({
  433. region: region,
  434. lastCitys: this.data.citys,
  435. lastAreas: this.data.areas,
  436. regionValue: value,
  437. deptId:this.getRegionId('areas')
  438. }, () => {
  439. let data={
  440. loginDeptID : this.getRegionId('areas')
  441. }
  442. let _this = this
  443. UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
  444. success: (res) => {
  445. setTimeout(()=>{
  446. _this.reset()
  447. _this.onLoad()
  448. },1000)
  449. }
  450. })
  451. })
  452. }
  453. }
  454. })