微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

573 lines
16 KiB

  1. // pages/handle/expenditureAudit/expenditureAudit.js
  2. import * as UTIL from '../../../utils/util.js';
  3. import * as API from '../../../utils/API.js';
  4. let EVN_CONFIG = require('../../../env/env');
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. isIPX: app.globalData.isIPX,
  12. active:0,
  13. spsxOptions:[],
  14. paymentPatternOptions:[],
  15. nickName:'',
  16. comment:'',
  17. activeNames: 0,
  18. transferTypeOption:[
  19. {
  20. dictLabel:'银行转账',
  21. dictValue:'1'
  22. },
  23. {
  24. dictLabel:'信用卡转账',
  25. dictValue:'2'
  26. }
  27. ],
  28. showSteps:false,
  29. activeStepsNames:''
  30. },
  31. showS(){
  32. this.setData({
  33. showSteps:!this.data.showSteps,
  34. })
  35. },
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad: function (options) {
  40. var that = this;
  41. that.setData({
  42. taskId:options.taskId,
  43. pageType:options.type
  44. })
  45. wx.showLoading({
  46. title: '正在加载模板',
  47. mask:true
  48. })
  49. //所属银行
  50. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  51. success: (res) => {
  52. this.setData({
  53. bankTypeOptions:res.data
  54. });
  55. }
  56. })
  57. // 资金支出类别字典查询
  58. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  59. success: (res) => {
  60. that.setData({
  61. capitalExpenditureTypeOptions:res.data,
  62. })
  63. }
  64. })
  65. // 汇票列表查询
  66. UTIL.httpRequest(API.URL_GET_GETMONEYORDERLIST, {method:'GET'}, {
  67. success: (res) => {
  68. that.setData({
  69. moneyOrderOptions:res.rows,
  70. })
  71. }
  72. })
  73. // 付款方式类型字典查询 (2.0)
  74. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, {
  75. success: (res) => {
  76. that.setData({
  77. transferTypeOptions:res.data,
  78. })
  79. }
  80. })
  81. // 项目工程列表
  82. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  83. success: (res) => {
  84. that.setData({
  85. projectOptions:res.rows,
  86. })
  87. }
  88. })
  89. // 工程款类型字典查询
  90. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  91. success: (res) => {
  92. that.setData({
  93. projectFundTypeOptions:res.data,
  94. })
  95. }
  96. })
  97. // 获取合同信息列表
  98. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET',contractionStatus:1}, {
  99. success: (res) => {
  100. that.setData({
  101. contractionOptions:res.rows,
  102. })
  103. }
  104. })
  105. let templateQueryParams = {
  106. // 分页
  107. method:'GET',
  108. pageNum: 1,
  109. pageSize: 999,
  110. type:'1'
  111. };
  112. // 审批流程列表
  113. UTIL.httpRequest(API.URL_GET_TEMPLATELIST , templateQueryParams, {
  114. success: (res) => {
  115. that.setData({
  116. approvalTemplateNameOptions:res.rows,
  117. ["form.approvalTemplateId"]:res.rows[0].id,
  118. ["form.approvalTemplateName"]:res.rows[0].name,
  119. })
  120. }
  121. })
  122. UTIL.showLoadingHaveMask();
  123. var perames = {
  124. pageNum:1,
  125. pageSize:999,
  126. accountType:'102',
  127. method:'POST'
  128. }
  129. // 付款方列表
  130. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  131. success: (res) => {
  132. console.log(res);
  133. that.setData({
  134. accountOptions:res.rows,
  135. })
  136. }
  137. })
  138. setTimeout(function(){
  139. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  140. success: (res) => {
  141. if (res.code == API.SUCCESS_CODE) {
  142. // 审批模板
  143. UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.data.approvalTemplateId, {method:'GET'}, {
  144. success: (rres) => {
  145. that.setData({
  146. steps:rres.approvalDetails
  147. })
  148. }
  149. })
  150. res.data.capitalExpenditureTypeText = UTIL.getTransform(res.data.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  151. res.data.transferTypeText = UTIL.getTransform(res.data.transferType,that.data.transferTypeOption);
  152. if(res.data.capitalExpenditureType == 2){
  153. let prames = {
  154. outId:res.data.id,
  155. ynType: res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2'
  156. }
  157. // 工程项目查询
  158. UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, {
  159. success: (res) => {
  160. res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions);
  161. that.setData({
  162. ["form.projectForm"]:res.data,
  163. })
  164. }
  165. })
  166. }
  167. if(res.data.capitalExpenditureType == 4){
  168. let prames = {
  169. transferId:res.data.id,
  170. }
  171. // 关联合同查询
  172. UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, {
  173. success: (res) => {
  174. that.setData({
  175. ["form.contractionForm"]:res.data,
  176. })
  177. }
  178. })
  179. }
  180. that.setData({
  181. ["form.fileNum"]:0,
  182. })
  183. UTIL.httpRequest(
  184. API.URL_GET_FINDLIST,
  185. {
  186. method:'GET',
  187. tableName:'t_yinnong_transfer',
  188. tableId:res.data.id,
  189. fileType:1
  190. },
  191. {
  192. success: (res) => {
  193. let list = [];
  194. res.data.forEach((item2,index2)=>{
  195. let fileForm = res.data.fileForm?res.data.fileForm:[];
  196. fileForm.push({
  197. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  198. fileType:'1',
  199. bizPath:'transfer',
  200. tableName:'t_yinnong_transfer',
  201. tableId:''
  202. })
  203. list.push({
  204. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  205. id:item2.id
  206. })
  207. that.setData({
  208. ["form.fileNum"]:that.data.form.fileNum+1,
  209. ["form.SJimage"]:list,
  210. ["form.fileForm"]:fileForm
  211. });
  212. })
  213. }
  214. })
  215. //发票
  216. UTIL.httpRequest(
  217. API.URL_GET_FINDLIST,
  218. {
  219. method:'GET',
  220. tableName:'t_yinnong_transfer',
  221. tableId:res.data.id,
  222. fileType:2
  223. },
  224. {
  225. success: (res) => {
  226. let list = [];
  227. res.data.forEach((item2,index2)=>{
  228. let fileForm = res.data.fileForm?res.data.fileForm:[];
  229. fileForm.push({
  230. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  231. fileType:'2',
  232. bizPath:'transfer',
  233. tableName:'t_yinnong_transfer',
  234. tableId:res.data.id
  235. })
  236. list.push({
  237. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  238. id:item2.id
  239. })
  240. that.setData({
  241. ["form.fileNum"]:that.data.form.fileNum+1,
  242. ["form.FPimage"]:list,
  243. ["form.fileForm"]:fileForm
  244. });
  245. })
  246. }
  247. })
  248. //其他
  249. UTIL.httpRequest(
  250. API.URL_GET_FINDLIST,
  251. {
  252. method:'GET',
  253. tableName:'t_yinnong_transfer',
  254. tableId:res.data.id,
  255. fileType:3
  256. },
  257. {
  258. success: (res) => {
  259. let list = [];
  260. res.data.forEach((item2,index2)=>{
  261. let fileForm = res.data.fileForm?res.data.fileForm:[];
  262. fileForm.push({
  263. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  264. fileType:'3',
  265. bizPath:'transfer',
  266. tableName:'t_yinnong_transfer',
  267. tableId:res.data.id
  268. })
  269. list.push({
  270. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  271. id:item2.id
  272. })
  273. that.setData({
  274. ["form.fileNum"]:that.data.form.fileNum+1,
  275. ["form.QTimage"]:list,
  276. ["form.fileForm"]:fileForm
  277. });
  278. })
  279. }
  280. })
  281. let query = {
  282. method:'GET',
  283. // accountType:res.data.accountType,
  284. // status:"0",
  285. // orderByColumn: "id",
  286. // isAsc: "desc",
  287. }
  288. UTIL.httpRequest(API.URL_GET_TRANSFERINFOS+options.id, query, {
  289. success: (response) => {
  290. if (res.code == API.SUCCESS_CODE) {
  291. for(let i = 0 ; i < response.rows.length ; i++){
  292. response.rows[i].bankTypeText = UTIL.getTransform(response.rows[i].bankType,that.data.bankTypeOptions);
  293. }
  294. that.setData({
  295. ["form.payeeList"]:response.rows
  296. })
  297. }
  298. }
  299. })
  300. that.setData({
  301. form:res.data,
  302. isUpdate:true,
  303. showFile:true,
  304. activeNames:null
  305. })
  306. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  307. success: (res) => {
  308. if (res.code == API.SUCCESS_CODE) {
  309. that.setData({
  310. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  311. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  312. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  313. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  314. })
  315. }
  316. }
  317. })
  318. // 查询审批事项流转进度
  319. UTIL.httpRequest(API.URL_GET_GETPROCESS+options.id , {method:'GET'}, {
  320. success: (res) => {
  321. console.log(res);
  322. for (let i = 0; i < res.data.processSchedule.审批事项.length; i++) {
  323. const element = res.data.processSchedule.审批事项[i];
  324. if (element.electronicSignature!=null) {
  325. element.electronicSignature = wx.getStorageSync('dressCode')+element.electronicSignature;
  326. }
  327. }
  328. if(res.data.processSchedule != null){
  329. that.setData({spsxOptions:res.data.processSchedule.审批事项})
  330. }
  331. that.setData({instanceId:res.data.instanceId})
  332. if(options.business == 'xj'){
  333. console.log(that.data.instanceId)
  334. // 查询现金审批事项流转进度
  335. UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, {
  336. success: (res) => {
  337. console.log(res);
  338. if(res.data.processSchedule.审批事项){
  339. that.setData({spsxOptions:res.data.processSchedule.审批事项})
  340. }
  341. that.setData({instanceId:res.data.instanceId})
  342. }
  343. })
  344. }
  345. }
  346. })
  347. UTIL.hideLoadingHaveMask();
  348. }
  349. }
  350. })
  351. },1000)
  352. },
  353. onChangePayee(event) {
  354. console.log(event);
  355. this.setData({
  356. ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:event.detail
  357. });
  358. },
  359. onClosePayee(event){
  360. console.log("aaa");
  361. this.setData({
  362. ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:''
  363. });
  364. console.log(this.data.form.transfers[event.currentTarget.dataset.index]);
  365. },
  366. goDis(){
  367. var that = this ;
  368. console.log()
  369. let data = {
  370. taskId:that.data.taskId,
  371. instanceId:that.data.instanceId,
  372. variables:JSON.stringify({
  373. comment:that.data.comment == '' ? '驳回':that.data.comment,
  374. pass:false,
  375. }),
  376. method:'POST'
  377. };
  378. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  379. success: (res) => {
  380. console.log(res);
  381. if (res.code == API.SUCCESS_CODE) {
  382. wx.showToast({
  383. title: '审批成功',
  384. icon: 'success',
  385. duration: 2000,
  386. complete(){
  387. setTimeout(function(){
  388. that.back();
  389. },2000)
  390. }
  391. })
  392. }else{
  393. wx.showToast({
  394. title: '操作失败',
  395. icon: 'error',
  396. duration: 2000
  397. })
  398. }
  399. }
  400. })
  401. },
  402. goAgree(){
  403. var that = this ;
  404. let data = {
  405. taskId:that.data.taskId,
  406. instanceId:that.data.instanceId,
  407. variables:JSON.stringify({
  408. "comment":that.data.comment == '' ? '同意':that.data.comment,
  409. "pass":true,
  410. }),
  411. method:'POST'
  412. };
  413. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  414. success: (res) => {
  415. console.log(res);
  416. if (res.code == API.SUCCESS_CODE) {
  417. wx.showToast({
  418. title: '审批成功',
  419. icon: 'success',
  420. duration: 2000,
  421. complete(){
  422. setTimeout(function(){
  423. that.back();
  424. },2000)
  425. }
  426. })
  427. }else{
  428. wx.showToast({
  429. title: '操作失败',
  430. icon: 'error',
  431. duration: 2000
  432. })
  433. }
  434. }
  435. })
  436. },
  437. commentInput(e){
  438. console.log(e);
  439. var that = this;
  440. that.setData({
  441. comment:e.detail.value
  442. })
  443. },
  444. onChangeBox(event) {
  445. console.log(event);
  446. this.setData({
  447. activeNames: event.detail,
  448. });
  449. },
  450. onCloseSecond(e){
  451. var that = this ;
  452. console.log(e);
  453. that.setData({
  454. ["form.showTitle"]:false
  455. })
  456. },
  457. onChangeSteps(event) {
  458. console.log(event);
  459. this.setData({
  460. activeStepsNames:event.detail
  461. });
  462. },
  463. onCloseSteps(event){
  464. console.log("aaa");
  465. this.setData({
  466. activeStepsNames:''
  467. });
  468. },
  469. onOpen(e){
  470. var that = this ;
  471. that.setData({
  472. ["form.showTitle"]:true
  473. })
  474. },
  475. openPreview(e){
  476. let array = [];
  477. console.log(e);
  478. e.currentTarget.dataset.option.forEach(item=>{
  479. array.push(item.tempFilePath)
  480. })
  481. console.log(array);
  482. wx.previewImage({
  483. urls: array,
  484. showmenu:true,
  485. current:array[e.currentTarget.dataset.index]
  486. })
  487. },
  488. goPayee(event){
  489. wx.navigateTo({
  490. url: '/pages/pay/payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option)
  491. })
  492. },
  493. /**
  494. * 生命周期函数--监听页面初次渲染完成
  495. */
  496. onReady: function () {
  497. },
  498. /**
  499. * 生命周期函数--监听页面显示
  500. */
  501. onShow: function () {
  502. },
  503. back:function(){
  504. wx.navigateBack({
  505. delta: 1
  506. })
  507. },
  508. /**
  509. * 生命周期函数--监听页面隐藏
  510. */
  511. onHide: function () {
  512. },
  513. /**
  514. * 生命周期函数--监听页面卸载
  515. */
  516. onUnload: function () {
  517. },
  518. /**
  519. * 页面相关事件处理函数--监听用户下拉动作
  520. */
  521. onPullDownRefresh: function () {
  522. },
  523. /**
  524. * 页面上拉触底事件的处理函数
  525. */
  526. onReachBottom: function () {
  527. },
  528. /**
  529. * 用户点击右上角分享
  530. */
  531. onShareAppMessage: function () {
  532. }
  533. })