微信小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2500 行
83 KiB

  1. // pages/apply/paymentTemplate/add/add.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. radio:'1',
  13. active:0,
  14. projectText:'',
  15. balance:0,
  16. capitalExpenditureTypeOptions:[],
  17. transferTypeOptions:[],
  18. projectOptions:[],
  19. projectFundTypeOptions:[],
  20. contractionOptions:[],
  21. accountOptions:[],
  22. moneyorderOptions:[],
  23. topInputTirme:false,
  24. // form:{
  25. // approvalMode:'1',
  26. // payeeList:[{}],
  27. // approvalItemTemplate:{
  28. // approvalItems:'',//审批事项
  29. // submitCompany:'',//提交单位
  30. // submitDate:'',//提交日期
  31. // submitter:'',//提交人
  32. // telephone:'',//联系方式
  33. // totalAmount:"0.00",//合计金额
  34. // templateName:'',//模板名称 选择保存模板的时候添加
  35. // dataType:'',//数据类型
  36. // },
  37. // transfers:[{//事项信息集合以下是List对象信息
  38. // num:"一",
  39. // amountReadonly:false,
  40. // expenditureAmountTirme:false,
  41. // remarkTirme:false,
  42. // showCapitalExpenditureType:false,
  43. // showApplyDate:false,
  44. // showTransferType:false,
  45. // showProject:false,
  46. // showProjectFundType:false,
  47. // showAccount:false,
  48. // showDialog:false,
  49. // showContraction:false,
  50. // showMoneyOrder:false,
  51. // cashForm:{
  52. // payee:'',
  53. // phone:'',
  54. // unit:'',
  55. // leader:'',
  56. // remark:'',
  57. // },
  58. // SJimage:[],
  59. // FPimage:[],
  60. // QTimage:[],
  61. // activeName:0,
  62. // showTitle:true,
  63. // collapseDis:false,
  64. // capitalExpenditureType:'1',//资金支出类别
  65. // capitalExpenditureTypeText:'结算类',//资金支出类别(展示用)
  66. // succeedAmount:'',//成功支付金额
  67. // payer:'',//付款方
  68. // paymentPattern:'1',
  69. // payerAccount:'',//付款方账户
  70. // bankType:'',//所属银行
  71. // bankTypeText:'',//所属银行(展示用)
  72. // isPeers:'N',//是否同行
  73. // operatorCode:'',//操作员代码
  74. // enterpriseCode:'',//企业编码
  75. // expenditureAmount:'',//支出总金额
  76. // applyDate:'',//申请时间
  77. // transferStatus:'',//转账状态
  78. // auditStatus:'0',//审批状态
  79. // paymentState:'',//支付状态
  80. // approvalMode:'1',//审批模式
  81. // paymentTime:'',//支付时间
  82. // bankPriority:'',//银行处理优先级
  83. // clientPriority:'',//客户处理优先级
  84. // transferType:'1',//付款方式
  85. // transferTypeText:'垫付报销:电子支付',//付款方式(展示用)
  86. // requiredTransferTime:'',//要求转账时间
  87. // remark:'',//付款事由
  88. // startTime:'',//开票日期
  89. // endTime:'',//到期日期
  90. // orderType:'',//汇票类型
  91. // bankAccountType:'2',//账户类别1 公户2私户
  92. // villageAccountType:'',//账户分类
  93. // payeeList:[{//收款方账户集合
  94. // payeeId:'0',//收款方id
  95. // payee:'',//收款方
  96. // bankDeposit:'',//开户行
  97. // incomeAmount:'',//收入金额
  98. // bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  99. // payeeAccount:'',//收款账户
  100. // }],
  101. // projectForm:{
  102. // projectId:'',
  103. // projectName:'',
  104. // projectContractor:'',
  105. // projectAmount:'',
  106. // projectBillNum:'',
  107. // projectFundType:'',
  108. // outId:'',
  109. // ynType:'1',
  110. // },
  111. // contractionForm:{
  112. // contractionId:'',
  113. // name:'',
  114. // code:'',
  115. // totalAmount:'',
  116. // },
  117. // moneyOrderForm:{
  118. // orderNum:'',
  119. // orderType:'',
  120. // orderAmount:'',
  121. // billPayUnit:'',
  122. // billReceiveUnit:'',
  123. // startTime:'',
  124. // endTime:'',
  125. // orderStatus:'',
  126. // remark:'',
  127. // }
  128. // }],
  129. // },
  130. form:{
  131. approvalItemTemplate:{
  132. approvalItems:'',//审批事项
  133. submitCompany:'',//提交单位
  134. submitDate:'',//提交日期
  135. submitter:'',//提交人
  136. telephone:'',//联系方式
  137. totalAmount:"0.00",//合计金额
  138. templateName:'',//模板名称 选择保存模板的时候添加
  139. dataType:'',//数据类型
  140. },
  141. num:"一",
  142. amountReadonly:false,
  143. expenditureAmountTirme:false,
  144. remarkTirme:false,
  145. showCapitalExpenditureType:false,
  146. showApplyDate:false,
  147. showTransferType:false,
  148. showProject:false,
  149. showProjectFundType:false,
  150. showAccount:false,
  151. showDialog:false,
  152. showContraction:false,
  153. showMoneyOrder:false,
  154. cashForm:{
  155. payee:'',
  156. phone:'',
  157. unit:'',
  158. leader:'',
  159. remark:'',
  160. },
  161. SJimage:[],
  162. FPimage:[],
  163. QTimage:[],
  164. SYLGKimage:[],
  165. activeName:0,
  166. showTitle:true,
  167. collapseDis:false,
  168. capitalExpenditureType:'1',//资金支出类别
  169. capitalExpenditureTypeText:'结算类',//资金支出类别(展示用)
  170. approvalTemplateId:'1',//资金支出类别
  171. approvalTemplateName:'',//资金支出类别(展示用)
  172. succeedAmount:'',//成功支付金额
  173. payer:'',//付款方
  174. paymentPattern:'1',
  175. payerAccount:'',//付款方账户
  176. bankType:'',//所属银行
  177. bankTypeText:'',//所属银行(展示用)
  178. isPeers:'N',//是否同行
  179. operatorCode:'',//操作员代码
  180. enterpriseCode:'',//企业编码
  181. expenditureAmount:'',//支出总金额
  182. applyDate:'',//申请时间
  183. transferStatus:'',//转账状态
  184. auditStatus:'0',//审批状态
  185. paymentState:'1',//支付状态
  186. approvalMode:'1',//审批模式
  187. paymentTime:'',//支付时间
  188. bankPriority:'',//银行处理优先级
  189. clientPriority:'',//客户处理优先级
  190. transferType:'1',//付款方式
  191. transferTypeText:'银行转账',//付款方式(展示用)
  192. requiredTransferTime:'',//要求转账时间
  193. remark:'',//付款事由
  194. startTime:'',//开票日期
  195. endTime:'',//到期日期
  196. orderType:'',//汇票类型
  197. bankAccountType:'2',//账户类别1 公户2私户
  198. villageAccountType:'',//账户分类
  199. payeeList:[{//收款方账户集合
  200. payeeId:'0',//收款方id
  201. payee:'',//收款方
  202. bankDeposit:'',//开户行
  203. incomeAmount:'',//收入金额
  204. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  205. payeeAccount:'',//收款账户
  206. }],
  207. projectForm:{
  208. projectId:'',
  209. projectName:'',
  210. projectContractor:'',
  211. projectAmount:'',
  212. projectBillNum:'',
  213. projectFundType:'',
  214. outId:'',
  215. ynType:'1',
  216. },
  217. contractionForm:{
  218. contractionId:'',
  219. name:'',
  220. code:'',
  221. totalAmount:'',
  222. },
  223. moneyOrderForm:{
  224. orderNum:'',
  225. orderType:'',
  226. orderAmount:'',
  227. billPayUnit:'',
  228. billReceiveUnit:'',
  229. startTime:'',
  230. endTime:'',
  231. orderStatus:'',
  232. remark:'',
  233. }
  234. },
  235. transferTypeOption:[
  236. {
  237. dictLabel:'银行转账',
  238. dictValue:'1'
  239. },
  240. {
  241. dictLabel:'信用卡转账',
  242. dictValue:'2'
  243. }
  244. ],
  245. accountForm:{},
  246. fileForm:[],
  247. isUpdate:false,
  248. SJimage: [],
  249. FPimage: [],
  250. QTimage: [],
  251. SYLGKimage: [],
  252. imgcount:0,
  253. activeNames: 0,
  254. applyDate:'',
  255. autosize: { maxHeight: 500, minHeight: 50 },
  256. showFile:false,
  257. showCapitalExpenditureType:false,
  258. showSteps:false,
  259. activeStepsNames: 0,
  260. },
  261. showS(){
  262. this.setData({
  263. showSteps:!this.data.showSteps,
  264. })
  265. },
  266. /**
  267. * 生命周期函数--监听页面加载
  268. */
  269. onLoad(options) {
  270. var that = this;
  271. //所属银行
  272. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  273. success: (res) => {
  274. this.setData({
  275. bankTypeOptions:res.data
  276. });
  277. }
  278. })
  279. // 资金支出类别字典查询
  280. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  281. success: (res) => {
  282. that.setData({
  283. capitalExpenditureTypeOptions:res.data,
  284. })
  285. }
  286. })
  287. // 汇票列表查询
  288. UTIL.httpRequest(API.URL_GET_GETMONEYORDERLIST, {method:'GET'}, {
  289. success: (res) => {
  290. that.setData({
  291. moneyOrderOptions:res.rows,
  292. })
  293. }
  294. })
  295. // 付款方式类型字典查询 (2.0)
  296. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, {
  297. success: (res) => {
  298. that.setData({
  299. transferTypeOptions:res.data,
  300. })
  301. }
  302. })
  303. // 项目工程列表
  304. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  305. success: (res) => {
  306. that.setData({
  307. projectOptions:res.rows,
  308. })
  309. }
  310. })
  311. // 工程款类型字典查询
  312. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  313. success: (res) => {
  314. that.setData({
  315. projectFundTypeOptions:res.data,
  316. })
  317. }
  318. })
  319. // 获取合同信息列表
  320. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET',contractionStatus:1}, {
  321. success: (res) => {
  322. that.setData({
  323. contractionOptions:res.rows,
  324. })
  325. }
  326. })
  327. let templateQueryParams = {
  328. // 分页
  329. method:'GET',
  330. pageNum: 1,
  331. pageSize: 999,
  332. orderByColumn:'defaultValue',
  333. isAsc: "desc",
  334. type:'1'
  335. };
  336. // 审批流程列表
  337. UTIL.httpRequest(API.URL_GET_TEMPLATELIST , templateQueryParams, {
  338. success: (res) => {
  339. that.setData({
  340. approvalTemplateNameOptions:res.rows,
  341. ["form.approvalTemplateId"]:res.rows[0].id,
  342. ["form.approvalTemplateName"]:res.rows[0].name,
  343. })
  344. // 审批模板
  345. UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.rows[0].id , {method:'GET'}, {
  346. success: (rres) => {
  347. that.setData({
  348. steps:rres.approvalDetails
  349. })
  350. }
  351. })
  352. }
  353. })
  354. if(options.id && options.type != 'template'){
  355. UTIL.showLoadingHaveMask();
  356. var perames = {
  357. pageNum:1,
  358. pageSize:999,
  359. accountType:'102',
  360. method:'POST'
  361. }
  362. // 付款方列表
  363. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  364. success: (res) => {
  365. console.log(res);
  366. that.setData({
  367. accountOptions:res.rows,
  368. })
  369. }
  370. })
  371. setTimeout(function(){
  372. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  373. success: (res) => {
  374. if (res.code == API.SUCCESS_CODE) {
  375. // 审批模板
  376. UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.data.approvalTemplateId, {method:'GET'}, {
  377. success: (rres) => {
  378. that.setData({
  379. steps:rres.approvalDetails
  380. })
  381. }
  382. })
  383. res.data.capitalExpenditureTypeText = UTIL.getTransform(res.data.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  384. res.data.transferTypeText = UTIL.getTransform(res.data.transferType,that.data.transferTypeOption);
  385. if(res.data.capitalExpenditureType == 2){
  386. let prames = {
  387. outId:res.data.id,
  388. ynType: res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2'
  389. }
  390. // 工程项目查询
  391. UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, {
  392. success: (res) => {
  393. res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions);
  394. that.setData({
  395. ["form.projectForm"]:res.data,
  396. })
  397. }
  398. })
  399. }
  400. if(res.data.capitalExpenditureType == 4){
  401. let prames = {
  402. transferId:res.data.id,
  403. }
  404. // 关联合同查询
  405. UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, {
  406. success: (res) => {
  407. that.setData({
  408. ["form.contractionForm"]:res.data,
  409. })
  410. }
  411. })
  412. }
  413. that.setData({
  414. ["form.fileNum"]:0,
  415. })
  416. UTIL.httpRequest(
  417. API.URL_GET_FINDLIST,
  418. {
  419. method:'GET',
  420. tableName:'t_yinnong_transfer',
  421. tableId:res.data.id,
  422. fileType:1
  423. },
  424. {
  425. success: (res) => {
  426. let list = [];
  427. res.data.forEach((item2,index2)=>{
  428. let fileForm = res.data.fileForm?res.data.fileForm:[];
  429. fileForm.push({
  430. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  431. fileType:'1',
  432. bizPath:'transfer',
  433. tableName:'t_yinnong_transfer',
  434. tableId:''
  435. })
  436. list.push({
  437. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  438. id:item2.id
  439. })
  440. that.setData({
  441. ["form.fileNum"]:that.data.form.fileNum+1,
  442. ["form.SJimage"]:list,
  443. ["form.fileForm"]:fileForm,
  444. });
  445. })
  446. }
  447. })
  448. //发票
  449. UTIL.httpRequest(
  450. API.URL_GET_FINDLIST,
  451. {
  452. method:'GET',
  453. tableName:'t_yinnong_transfer',
  454. tableId:res.data.id,
  455. fileType:2
  456. },
  457. {
  458. success: (res) => {
  459. let list = [];
  460. res.data.forEach((item2,index2)=>{
  461. let fileForm = res.data.fileForm?res.data.fileForm:[];
  462. fileForm.push({
  463. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  464. fileType:'2',
  465. bizPath:'transfer',
  466. tableName:'t_yinnong_transfer',
  467. tableId:res.data.id
  468. })
  469. list.push({
  470. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  471. id:item2.id
  472. })
  473. that.setData({
  474. ["form.fileNum"]:that.data.form.fileNum+1,
  475. ["form.FPimage"]:list,
  476. ["form.fileForm"]:fileForm
  477. });
  478. })
  479. }
  480. })
  481. //其他
  482. UTIL.httpRequest(
  483. API.URL_GET_FINDLIST,
  484. {
  485. method:'GET',
  486. tableName:'t_yinnong_transfer',
  487. tableId:res.data.id,
  488. fileType:3
  489. },
  490. {
  491. success: (res) => {
  492. let list = [];
  493. res.data.forEach((item2,index2)=>{
  494. let fileForm = res.data.fileForm?res.data.fileForm:[];
  495. fileForm.push({
  496. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  497. fileType:'3',
  498. bizPath:'transfer',
  499. tableName:'t_yinnong_transfer',
  500. tableId:res.data.id
  501. })
  502. list.push({
  503. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  504. id:item2.id
  505. })
  506. that.setData({
  507. ["form.fileNum"]:that.data.form.fileNum+1,
  508. ["form.QTimage"]:list,
  509. ["form.fileForm"]:fileForm
  510. });
  511. })
  512. }
  513. })
  514. //四议两公开
  515. UTIL.httpRequest(
  516. API.URL_GET_FINDLIST,
  517. {
  518. method:'GET',
  519. tableName:'t_yinnong_transfer',
  520. tableId:res.data.id,
  521. fileType:4
  522. },
  523. {
  524. success: (res) => {
  525. let list = [];
  526. res.data.forEach((item2,index2)=>{
  527. let fileForm = res.data.fileForm?res.data.fileForm:[];
  528. fileForm.push({
  529. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  530. fileType:'4',
  531. bizPath:'transfer',
  532. tableName:'t_yinnong_transfer',
  533. tableId:res.data.id
  534. })
  535. list.push({
  536. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  537. id:item2.id
  538. })
  539. that.setData({
  540. ["form.fileNum"]:that.data.form.fileNum+1,
  541. ["form.SYLGKimage"]:list,
  542. ["form.fileForm"]:fileForm
  543. });
  544. })
  545. }
  546. })
  547. let query = {
  548. method:'GET',
  549. // accountType:res.data.accountType,
  550. // status:"0",
  551. // orderByColumn: "id",
  552. // isAsc: "desc",
  553. }
  554. UTIL.httpRequest(API.URL_GET_TRANSFERINFOS+options.id, query, {
  555. success: (response) => {
  556. if (res.code == API.SUCCESS_CODE) {
  557. for(let i = 0 ; i < response.rows.length ; i++){
  558. response.rows[i].bankTypeText = UTIL.getTransform(response.rows[i].bankType,that.data.bankTypeOptions);
  559. }
  560. that.setData({
  561. ["form.payeeList"]:response.rows
  562. })
  563. }
  564. }
  565. })
  566. that.setData({
  567. form:res.data,
  568. isUpdate:true,
  569. showFile:true,
  570. activeNames:null,
  571. })
  572. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  573. success: (res) => {
  574. if (res.code == API.SUCCESS_CODE) {
  575. that.setData({
  576. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  577. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  578. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  579. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  580. })
  581. }
  582. }
  583. })
  584. UTIL.hideLoadingHaveMask();
  585. }
  586. }
  587. })
  588. },1000)
  589. }else{
  590. //村账户查询参数
  591. var perames = {
  592. pageNum:1,
  593. pageSize:999,
  594. accountType:'102',
  595. method:'post',
  596. }
  597. // 付款方列表
  598. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  599. success: (res) => {
  600. console.log(res);
  601. that.setData({
  602. accountOptions:res.rows,
  603. ["form.applyDate"]: UTIL.formatDate(new Date()),
  604. applyDate: UTIL.formatDate(new Date()),
  605. })
  606. }
  607. })
  608. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  609. success: (res) => {
  610. if (res.code == API.SUCCESS_CODE) {
  611. that.setData({
  612. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  613. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  614. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  615. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  616. })
  617. }
  618. }
  619. })
  620. }
  621. },
  622. onChangeBox(event) {
  623. console.log(event);
  624. this.setData({
  625. activeNames: event.detail,
  626. });
  627. },
  628. onChangePayee(event) {
  629. console.log(event);
  630. this.setData({
  631. ["form.activeName"]:event.detail
  632. });
  633. },
  634. onClosePayee(event){
  635. console.log("aaa");
  636. this.setData({
  637. ["form.activeName"]:''
  638. });
  639. },
  640. onChangeSteps(event) {
  641. console.log(event);
  642. this.setData({
  643. activeStepsNames:event.detail
  644. });
  645. },
  646. onCloseSteps(event){
  647. console.log("aaa");
  648. this.setData({
  649. activeStepsNames:''
  650. });
  651. },
  652. /**
  653. * 生命周期函数--监听页面初次渲染完成
  654. */
  655. onReady() {
  656. },
  657. /**
  658. * 生命周期函数--监听页面显示
  659. */
  660. onShow() {
  661. },
  662. openBox(even){
  663. console.log(even.currentTarget.dataset.name);
  664. this.setData({
  665. [even.currentTarget.dataset.name]:true
  666. })
  667. },
  668. closeBox(even){
  669. console.log(even);
  670. this.setData({
  671. [even.currentTarget.dataset.name]:false
  672. })
  673. },
  674. onConfirm(event) {
  675. this.setData({
  676. [event.currentTarget.dataset.name]: false,
  677. [event.currentTarget.dataset.value]: UTIL.formatDate(event.detail),
  678. });
  679. },
  680. onConfirmPick(event) {
  681. console.log(event);
  682. this.setData({
  683. [event.currentTarget.dataset.name]: false,
  684. [event.currentTarget.dataset.value]: event.detail.value.dictValue,
  685. [event.currentTarget.dataset.value+'Text']: event.detail.value.dictLabel,
  686. });
  687. },
  688. onConfirmPickApproval(event) {
  689. console.log(event);
  690. var that = this;
  691. this.setData({
  692. showApprovalTemplateName: false,
  693. ["form.approvalTemplateName"]: event.detail.value.name,
  694. ["form.approvalTemplateId"]: event.detail.value.id,
  695. });
  696. // 审批模板
  697. UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+event.detail.value.id , {method:'GET'}, {
  698. success: (rres) => {
  699. that.setData({
  700. steps:rres.approvalDetails
  701. })
  702. }
  703. })
  704. },
  705. onConfirmAccount(event) {
  706. console.log(event);
  707. var that = this;
  708. // 所属银行字典查询
  709. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  710. success: (res) => {
  711. this.setData({
  712. [event.currentTarget.dataset.name]: false,
  713. [event.currentTarget.dataset.value+'.payer']: event.detail.value.accountName,
  714. [event.currentTarget.dataset.value+'.cashierId']: event.detail.value.id,
  715. [event.currentTarget.dataset.value+'.bankAccountNumber']: event.detail.value.bankAccountNumber,
  716. [event.currentTarget.dataset.value+'.bankTypeText']: UTIL.getTransform(event.detail.value.bankType,that.data.bankTypeOptions),
  717. [event.currentTarget.dataset.value+'.bankType']: event.detail.value.bankType,
  718. [event.currentTarget.dataset.value+'.payerAccount']:event.detail.value.bankAccountNumber,
  719. [event.currentTarget.dataset.value+'.balance']:event.detail.value.balance,
  720. [event.currentTarget.dataset.value+'.isPeers']:"N",
  721. [event.currentTarget.dataset.value+'.payeeList'] : [{//收款方账户集合
  722. payeeId:'0',//收款方id
  723. payee:'',//收款方
  724. bankDeposit:'',//开户行
  725. incomeAmount:'',//收入金额
  726. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  727. payeeAccount:'',//收款账户
  728. }]
  729. });
  730. }
  731. })
  732. },
  733. onConfirmaTransfer(event) {
  734. console.log(event);
  735. var that = this;
  736. let perames = {};
  737. this.setData({
  738. [event.currentTarget.dataset.value+'.payer']: '',
  739. [event.currentTarget.dataset.value+'.payerAccount']: '',
  740. [event.currentTarget.dataset.value+'.bankTypeText']: '',
  741. [event.currentTarget.dataset.value+'.bankType']: '',
  742. [event.currentTarget.dataset.value+'.bankAccountType']: '2',
  743. [event.currentTarget.dataset.value+'.isPeers']: '',
  744. [event.currentTarget.dataset.value+'.paymentPattern']: event.detail.value.dictValue,
  745. [event.currentTarget.dataset.value+'.amountReadonly']:false,
  746. [event.currentTarget.dataset.value+'.payeeList']:[{//收款方账户集合
  747. payeeId:'0',//收款方id
  748. payee:'',//收款方
  749. bankDeposit:'',//开户行
  750. incomeAmount:'',//收入金额
  751. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  752. payeeAccount:'',//收款账户
  753. }],
  754. balance:0,
  755. });
  756. console.log(event.detail.value.dictValue);
  757. if(event.detail.value.dictValue == 1 || event.detail.value.dictValue == 2 || event.detail.value.dictValue == 4 || event.detail.value.dictValue == 6 || event.detail.value.dictValue == 7 ){event.detail.value.dictValue = 1 ;}
  758. else if(event.detail.value.dictValue == 3){event.detail.value.dictValue = 2 ;}
  759. else if(event.detail.value.dictValue == 5){event.detail.value.dictValue = 12 ;}
  760. else if(event.detail.value.dictValue == 8){event.detail.value.dictValue = 11 ;}
  761. if(event.detail.value.dictValue == 1){//村账户查询参数
  762. perames = {
  763. pageNum:1,
  764. pageSize:999,
  765. accountType:'102',
  766. method:'post',
  767.   params: {
  768.          "townAccountType":"0"
  769.     }
  770. }
  771. // 付款方列表
  772. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  773. success: (res) => {
  774. that.setData({
  775. accountOptions:res.rows,
  776. })
  777. }
  778. })
  779. }
  780. if(event.detail.value.dictValue == 2 || event.detail.value.dictValue == 10){//公务卡和现金提现查询参数
  781. perames = {
  782. pageNum:1,
  783. pageSize:999,
  784. accountType:'102',
  785. method:'GET',
  786. villageAccountType:''
  787. }
  788. // 付款方列表
  789. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  790. success: (res) => {
  791. that.setData({
  792. accountOptions:res.rows,
  793. })
  794. }
  795. })
  796. }
  797. if(event.detail.value.dictValue == 11){//现金使用查询参数
  798. perames = {
  799. pageNum:1,
  800. pageSize:999,
  801. accountType:'101',
  802. method:'GET'
  803. }
  804. // 付款方列表
  805. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  806. success: (res) => {
  807. that.setData({
  808. accountOptions:res.rows
  809. })
  810. }
  811. })
  812. }
  813. if(event.detail.value.dictValue == 4){//代管账户查询参数
  814. perames = {
  815. pageNum:1,
  816. pageSize:999,
  817. accountType:'102',
  818. method:'GET',
  819. villageAccountType:'1'
  820. }
  821. // 付款方列表
  822. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  823. success: (res) => {
  824. that.setData({
  825. accountOptions:res.rows,
  826. })
  827. }
  828. })
  829. }
  830. if(event.detail.value.dictValue == 12){//汇票支出查询参数
  831. perames = {
  832. pageNum:1,
  833. pageSize:999,
  834. }
  835. // 付款方列表
  836. UTIL.httpRequest(API.URL_GET_MONEYORDERLIST , perames, {
  837. success: (res) => {
  838. that.setData({
  839. moneyorderOptions:res.rows,
  840. [event.currentTarget.dataset.value+'.amountReadonly']:true
  841. })
  842. }
  843. })
  844. }
  845. this.setData({
  846. [event.currentTarget.dataset.name]: false,
  847. [event.currentTarget.dataset.value+'.transferType']: event.detail.value.dictValue,
  848. [event.currentTarget.dataset.value+'.transferTypeText']: event.detail.value.dictLabel,
  849. });
  850. },
  851. onConfirmProject(event) {
  852. console.log(event);
  853. this.setData({
  854. [event.currentTarget.dataset.name]: false,
  855. [event.currentTarget.dataset.value+'.projectName']: event.detail.value.projectName,
  856. [event.currentTarget.dataset.value+'.projectId']: event.detail.value.id,
  857. [event.currentTarget.dataset.value+'.projectContractor']: event.detail.value.projectContractor,
  858. [event.currentTarget.dataset.value+'.projectAmount']: event.detail.value.projectAmount,
  859. });
  860. },
  861. onConfirmContraction(event) {
  862. console.log(event);
  863. this.setData({
  864. [event.currentTarget.dataset.name]: false,
  865. [event.currentTarget.dataset.value+".name"]: event.detail.value.name,
  866. [event.currentTarget.dataset.value+'.code']: event.detail.value.code,
  867. [event.currentTarget.dataset.value+'.totalAmount']: event.detail.value.totalAmount,
  868. [event.currentTarget.dataset.value+'.contractionId']: event.detail.value.id,
  869. });
  870. },
  871. onConfirmMoneyOrder(event) {
  872. console.log(event);
  873. var that = this ;
  874. this.setData({
  875. [event.currentTarget.dataset.name]: false,
  876. [event.currentTarget.dataset.value+'.moneyOrderForm']: event.detail.value,
  877. [event.currentTarget.dataset.value+'.expenditureAmount']: event.detail.value.orderAmount,
  878. [event.currentTarget.dataset.value+".payeeList[0].incomeAmount"]: event.detail.value.orderAmount,
  879. [event.currentTarget.dataset.value+'.payer']:event.detail.value.billPayUnit,
  880. [event.currentTarget.dataset.value+'.payerAccount'] : event.detail.value.orderNum,
  881. [event.currentTarget.dataset.value+'.cashierId'] : event.detail.value.id,
  882. [event.currentTarget.dataset.value+'.startTime'] : event.detail.value.startTime,
  883. [event.currentTarget.dataset.value+'.endTime'] : event.detail.value.endTime,
  884. [event.currentTarget.dataset.value+'.orderType'] : event.detail.value.orderType
  885. });
  886. var moneyCount = 0 ;
  887. for (let i = 0; i < that.data.form.transfers.length; i++) {
  888. const element = that.data.form.transfers[i];
  889. for (let j = 0; j < element.payeeList.length; j++) {
  890. const element2 = element.payeeList[j];
  891. var allCount = 0 ;
  892. moneyCount = parseFloat(moneyCount)+parseFloat(element2.incomeAmount);
  893. // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount);
  894. // this.setData({
  895. // ["form.transfers["+i+"].expenditureAmount"]:allCount,
  896. // })
  897. }
  898. }
  899. console.log(moneyCount.toFixed(2));
  900. this.setData({
  901. ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2),
  902. })
  903. },
  904. goPayeeList(event){
  905. console.log(event)
  906. if(event.currentTarget.dataset.payer == null || event.currentTarget.dataset.payer == ''){
  907. UTIL.showToastNoneIcon('请先选择付款方!');
  908. return;
  909. }
  910. if(this.data.form.payeeList.length>10){
  911. return;
  912. }
  913. if(event.currentTarget.dataset.accounttype == null ){
  914. event.currentTarget.dataset.accounttype = ''
  915. }
  916. // '/pages/payee/index?isPeers='+event.currentTarget.dataset.ispeers+'&bankType='+event.currentTarget.dataset.banktype+'&accountType='+event.currentTarget.dataset.accounttype+'&transferType='+event.currentTarget.dataset.transfertype + '&index='+event.currentTarget.dataset.index+'&money='+this.data.form.transfers
  917. wx.navigateTo({
  918. url: '/pages/payee/index?transferType='+event.currentTarget.dataset.transfertype+'&money='+this.data.form.expenditureAmount + '&index='+event.currentTarget.dataset.index + '&isPeers='+this.data.form.isPeers+'&bankType='+event.currentTarget.dataset.banktype,
  919. })
  920. },
  921. goPayee(event){
  922. wx.navigateTo({
  923. url: '/pages/pay/payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option)
  924. })
  925. },
  926. onChange(event){
  927. console.log(event);
  928. this.setData({
  929. [event.currentTarget.dataset.value]: event.detail,
  930. })
  931. },
  932. onChangeZZFY(event){
  933. console.log(event);
  934. this.setData({
  935. [event.currentTarget.dataset.value]: event.detail,
  936. })
  937. },
  938. onChangeHnzz(event){
  939. console.log(event);
  940. this.setData({
  941. [event.currentTarget.dataset.value]: event.detail,
  942. ["form.payeeList"]: [{//收款方账户集合
  943. payeeId:'0',//收款方id
  944. payee:'',//收款方
  945. bankDeposit:'',//开户行
  946. incomeAmount:'',//收入金额
  947. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  948. payeeAccount:'',//收款账户
  949. }],
  950. })
  951. },
  952. onChangeTime(event){
  953. console.log(event);
  954. this.setData({
  955. applyDate: event.detail,
  956. })
  957. },
  958. onConfirmTime(event){
  959. this.setData({
  960. [event.currentTarget.dataset.name]: false,
  961. applyDate: UTIL.formatDate(event.detail),
  962. });
  963. this.setData({
  964. ["form.applyDate"]:UTIL.formatDate(event.detail),
  965. })
  966. },
  967. onChangeMoneyOut(event){
  968. console.log(event);
  969. var that = this;
  970. if( !(event.detail.value > -1)){
  971. this.setData({
  972. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:'',
  973. })
  974. return;
  975. }
  976. if( event.detail.value.indexOf('.')>0 && event.detail.value.toString().split(".")[1].length>2){
  977. this.setData({
  978. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.value.toString().split(".")[0] + '.' + event.detail.value.toString().split(".")[1].substr(0,2),
  979. })
  980. return;
  981. }
  982. this.setData({
  983. // ["form.transfers["+event.currentTarget.dataset.index+"].payeeList["+event.currentTarget.dataset.childrenindex+"].incomeAmount"]: event.detail,
  984. ["form.transfers["+event.currentTarget.dataset.index+"].payeeList[0].incomeAmount"]: event.detail.value,
  985. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.value,
  986. // ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail,
  987. })
  988. if(event.detail.value == ''){
  989. that.data.form.transfers[event.currentTarget.dataset.index].payeeList[0].incomeAmount = parseFloat(0).toFixed(2);
  990. that.data.form.transfers[event.currentTarget.dataset.index].expenditureAmount = parseFloat(0).toFixed(2);
  991. }
  992. var moneyCount = 0 ;
  993. for (let i = 0; i < that.data.form.transfers.length; i++) {
  994. const element = that.data.form.transfers[i];
  995. for (let j = 0; j < element.payeeList.length; j++) {
  996. const element2 = element.payeeList[j];
  997. console.log(element2.incomeAmount);
  998. var allCount = 0 ;
  999. moneyCount = parseFloat(moneyCount) + parseFloat(element2.incomeAmount);
  1000. // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount);
  1001. // this.setData({
  1002. // ["form.transfers["+i+"].expenditureAmount"]:allCount,
  1003. // })
  1004. }
  1005. }
  1006. this.setData({
  1007. ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2),
  1008. })
  1009. },
  1010. onChangeMoney(event){
  1011. console.log(event);
  1012. var that = this;
  1013. if( !(event.detail > -1)){
  1014. this.setData({
  1015. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:'',
  1016. })
  1017. return;
  1018. }
  1019. if( event.detail.indexOf('.')>0 && event.detail.toString().split(".")[1].length>2){
  1020. this.setData({
  1021. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail.toString().split(".")[0] + '.' + event.detail.toString().split(".")[1].substr(0,2),
  1022. })
  1023. return;
  1024. }
  1025. this.setData({
  1026. // ["form.transfers["+event.currentTarget.dataset.index+"].payeeList["+event.currentTarget.dataset.childrenindex+"].incomeAmount"]: event.detail,
  1027. ["form.transfers["+event.currentTarget.dataset.index+"].payeeList[0].incomeAmount"]: event.detail,
  1028. ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail,
  1029. // ["form.transfers["+event.currentTarget.dataset.index+"].expenditureAmount"]:event.detail,
  1030. })
  1031. if(event.detail == ''){
  1032. that.data.form.transfers[event.currentTarget.dataset.index].payeeList[0].incomeAmount = parseFloat(0).toFixed(2);
  1033. that.data.form.transfers[event.currentTarget.dataset.index].expenditureAmount = parseFloat(0).toFixed(2);
  1034. }
  1035. console.log(that.data.form);
  1036. var moneyCount = 0 ;
  1037. for (let i = 0; i < that.data.form.transfers.length; i++) {
  1038. const element = that.data.form.transfers[i];
  1039. for (let j = 0; j < element.payeeList.length; j++) {
  1040. const element2 = element.payeeList[j];
  1041. var allCount = 0 ;
  1042. moneyCount = parseFloat(moneyCount)+parseFloat(element2.incomeAmount);
  1043. // allCount = parseFloat(allCount)+parseFloat(element2.incomeAmount);
  1044. // this.setData({
  1045. // ["form.transfers["+i+"].expenditureAmount"]:allCount,
  1046. // })
  1047. }
  1048. }
  1049. this.setData({
  1050. ["form.approvalItemTemplate.totalAmount"]:moneyCount.toFixed(2),
  1051. })
  1052. },
  1053. back:function(){
  1054. wx.navigateBack({
  1055. delta: 1
  1056. })
  1057. },
  1058. goSubmitMB(){
  1059. this.setData({
  1060. showDialog:true
  1061. })
  1062. },
  1063. onClose(){
  1064. this.setData({
  1065. showDialog:false
  1066. })
  1067. },
  1068. bindNameInput(even){
  1069. this.setData({
  1070. ["form.approvalItemTemplate.templateName"]:even.detail.value
  1071. })
  1072. },
  1073. goSubmit(e){
  1074. var that = this;
  1075. console.log(that.data.form);
  1076. var list = that.data.form;
  1077. // approvalItems = list.approvalItemTemplate.approvalItems;
  1078. // if(approvalItems == ''){
  1079. // UTIL.showToastNoneIcon('请填写审批事项名称!');
  1080. // that.setData({
  1081. // topInputTirme:true
  1082. // })
  1083. // return;
  1084. // }
  1085. if(list.applyDate == ''){
  1086. UTIL.showToastNoneIcon('请选择申请时间!');
  1087. return;
  1088. }
  1089. if(list.remark == ''){
  1090. UTIL.showToastNoneIcon('请填写转账附言!');
  1091. return;
  1092. }
  1093. if(list.explainSituation == ''){
  1094. UTIL.showToastNoneIcon('请填写说明情况!');
  1095. return;
  1096. }
  1097. if(list.expenditureAmount == ''){
  1098. UTIL.showToastNoneIcon('请检查收款方收款金额!');
  1099. return;
  1100. }
  1101. console.log(parseFloat(list.expenditureAmount).toFixed(2))
  1102. console.log(parseFloat(list.payerAccount).toFixed(2))
  1103. console.log(list.transferType);
  1104. if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){
  1105. UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!');
  1106. return;
  1107. }
  1108. if(list.payer == ''&&list.transferType != 12){
  1109. UTIL.showToastNoneIcon('请选择付款方!');
  1110. return;
  1111. }
  1112. if(list.payeeList[0].payee == ''&&list.transferType!=12){
  1113. UTIL.showToastNoneIcon('请选择收款方!');
  1114. return;
  1115. }
  1116. if((list.payeeList[0].incomeAmount == '' || list.payeeList[0].incomeAmount == undefined)&&list.transferType!=12){
  1117. UTIL.showToastNoneIcon('请填写收款方的收入金额!');
  1118. return;
  1119. }
  1120. if(list.transferType == '12'){
  1121. list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit;
  1122. list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum;
  1123. list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id;
  1124. list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime;
  1125. list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime;
  1126. list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType;
  1127. }
  1128. if(e.currentTarget.dataset.type == 1){
  1129. if(that.data.form.approvalItemTemplate.templateName == ''){
  1130. UTIL.showToastNoneIcon('请输入模板名称!');
  1131. return;
  1132. }
  1133. }
  1134. if(e.currentTarget.dataset.type == 3){
  1135. for (let i = 0; i < that.data.form.transfers.length; i++) {
  1136. that.data.form.transfers[i].approvalMode = '2';
  1137. }
  1138. that.data.form.approvalItemTemplate.dataType = e.currentTarget.dataset.type
  1139. }
  1140. that.data.form.method = 'POST';
  1141. that.data.form.approvalItemTemplate.dataType = e.currentTarget.dataset.type;
  1142. console.log(that.data.form);
  1143. UTIL.httpRequest(API.URL_GET_SAVE, that.data.form, {
  1144. success: (res) => {
  1145. if (res.code == API.SUCCESS_CODE) {
  1146. console.log(res.data.transfers.length);
  1147. for (let j = 0; j < res.data.transfers.length; j++) {
  1148. if(that.data.form.transfers[j].capitalExpenditureType == 2){
  1149. that.data.form.transfers[j].projectForm.ynType = res.data.transfers[j].transferType=='1'||res.data.transfers[j].transferType=='2'||res.data.transfers[j].transferType=='4'?'1':'2';
  1150. that.data.form.transfers[j].projectForm.outId = res.data.transfers[j].id;
  1151. that.data.form.transfers[j].projectForm.method = 'POST';
  1152. // 工程项目提交
  1153. UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.transfers[j].projectForm, {
  1154. success: (res) => {
  1155. }
  1156. })
  1157. }
  1158. if(that.data.form.transfers[j].capitalExpenditureType == 4){
  1159. that.data.form.transfers[j].contractionForm.transferId = res.data.transfers[j].id;
  1160. that.data.form.transfers[j].contractionForm.id = '';
  1161. that.data.form.transfers[j].contractionForm.method = 'POST';
  1162. // 关联合同提交
  1163. UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.transfers[j].contractionForm, {
  1164. success: (res) => {
  1165. }
  1166. })
  1167. }
  1168. // if(that.data.form.transfers[j].fileForm == undefined){continue;}
  1169. that.data.form.transfers[j].id = res.data.transfers[j].id
  1170. console.log(that.data.form.transfers[j])
  1171. that.upDownFile(that.data.form.transfers[j]).then(response=>{
  1172. wx.hideLoading();
  1173. console.log(e.currentTarget.dataset.type);
  1174. if(e.currentTarget.dataset.type == 0){
  1175. wx.navigateTo({
  1176. url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel),
  1177. })
  1178. }
  1179. if(e.currentTarget.dataset.type == 2){
  1180. wx.showToast({
  1181. title: '保存成功',
  1182. icon: 'success',
  1183. duration: 2000,
  1184. })
  1185. }
  1186. if(e.currentTarget.dataset.type == 1){
  1187. console.log("aaa");
  1188. wx.showToast({
  1189. title: '保存成功',
  1190. icon: 'success',
  1191. duration: 2000,
  1192. complete(){
  1193. setTimeout(function(){
  1194. that.back();
  1195. },2000)
  1196. }
  1197. })
  1198. }
  1199. if(e.currentTarget.dataset.type == 3){
  1200. UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, {
  1201. success: (res2) => {
  1202. if (res2.code == API.SUCCESS_CODE) {
  1203. wx.showToast({
  1204. title: '操作成功',
  1205. icon: 'success',
  1206. duration: 2000,
  1207. complete(){
  1208. setTimeout(function(){
  1209. that.back();
  1210. },2000)
  1211. }
  1212. })
  1213. }else{
  1214. wx.showToast({
  1215. title: '操作失败',
  1216. icon: 'error',
  1217. duration: 2000
  1218. })
  1219. }
  1220. }
  1221. })
  1222. }
  1223. }).catch((err) => {
  1224. console.log(err);
  1225. wx.hideLoading();
  1226. if(e.currentTarget.dataset.type == 0){
  1227. wx.navigateTo({
  1228. url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel),
  1229. })
  1230. }
  1231. if(e.currentTarget.dataset.type == 2){
  1232. wx.showToast({
  1233. title: '保存成功',
  1234. icon: 'success',
  1235. duration: 2000,
  1236. })
  1237. }
  1238. if(e.currentTarget.dataset.type == 1){
  1239. console.log("aaa");
  1240. wx.showToast({
  1241. title: '保存成功',
  1242. icon: 'success',
  1243. duration: 2000,
  1244. complete(){
  1245. setTimeout(function(){
  1246. that.back();
  1247. },2000)
  1248. }
  1249. })
  1250. }
  1251. if(e.currentTarget.dataset.type == 3){
  1252. UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, {
  1253. success: (res2) => {
  1254. if (res2.code == API.SUCCESS_CODE) {
  1255. wx.showToast({
  1256. title: '操作成功',
  1257. icon: 'success',
  1258. duration: 2000,
  1259. complete(){
  1260. setTimeout(function(){
  1261. that.back();
  1262. },2000)
  1263. }
  1264. })
  1265. }else{
  1266. wx.showToast({
  1267. title: '操作失败',
  1268. icon: 'error',
  1269. duration: 2000
  1270. })
  1271. }
  1272. }
  1273. })
  1274. }
  1275. })
  1276. }
  1277. }
  1278. }
  1279. })
  1280. },
  1281. goSubmitNew(e){
  1282. var that = this;
  1283. console.log(that.data.form);
  1284. var list = that.data.form;
  1285. if(list.applyDate == ''){
  1286. UTIL.showToastNoneIcon('请选择申请时间!');
  1287. return;
  1288. }
  1289. if(list.remark == ''){
  1290. UTIL.showToastNoneIcon('请填写转账附言!');
  1291. return;
  1292. }
  1293. var p = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1294. if (p.test(list.remark)) {
  1295. UTIL.showToastNoneIcon('‘转账附言’存在非法字符,请尽量简洁并减少标点符号的使用,详情可在‘说明情况’中描述。');
  1296. return;
  1297. }
  1298. // if(list.explainSituation == ''){
  1299. // UTIL.showToastNoneIcon('请填写说明情况!');
  1300. // return;
  1301. // }
  1302. if(list.expenditureAmount == ''){
  1303. UTIL.showToastNoneIcon('请检查收款方收款金额!');
  1304. return;
  1305. }
  1306. if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){
  1307. UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!');
  1308. return;
  1309. }
  1310. if(list.payer == ''&&list.transferType != 12){
  1311. UTIL.showToastNoneIcon('请选择付款方!');
  1312. return;
  1313. }
  1314. if(list.payeeList[0].payee == ''&&list.transferType!=12){
  1315. UTIL.showToastNoneIcon('请选择收款方!');
  1316. return;
  1317. }
  1318. for(let i = 0 ; i < list.payeeList.length ; i++){
  1319. if(list.payeeList[i].payee == ''){
  1320. UTIL.showToastNoneIcon('请选择收款方!');
  1321. return;
  1322. }
  1323. console.log(list.transferType);
  1324. if((list.payeeList[i].incomeAmount == '' || list.payeeList[i].incomeAmount == undefined)){
  1325. UTIL.showToastNoneIcon('请填写收款方的收入金额!');
  1326. return;
  1327. }
  1328. console.log(isNaN(parseFloat(list.payeeList[i].incomeAmount)));
  1329. console.log(!isFinite(list.payeeList[i].incomeAmount));
  1330. if(isNaN(parseFloat(list.payeeList[i].incomeAmount)) || !isFinite(list.payeeList[i].incomeAmount)){
  1331. UTIL.showToastNoneIcon('请填写正确的收款方收入金额!');
  1332. return;
  1333. }
  1334. }
  1335. if(list.capitalExpenditureType == 2){
  1336. if(list.projectForm.projectName==""||list.projectForm.projectName==null){
  1337. UTIL.showToastNoneIcon('请选择项目名称!');
  1338. return;
  1339. }
  1340. if(list.projectForm.projectBillNum==""||list.projectForm.projectBillNum==null){
  1341. UTIL.showToastNoneIcon('请输入工程发票号!');
  1342. return;
  1343. }
  1344. }
  1345. if(list.capitalExpenditureType==4){
  1346. if(list.contractionForm.name==""||list.contractionForm.name==null){
  1347. UTIL.showToastNoneIcon('请选择合同名称!');
  1348. return;
  1349. }
  1350. if(list.contractionForm.code==""||list.contractionForm.code==null){
  1351. UTIL.showToastNoneIcon('请输入合同编码!');
  1352. return;
  1353. }
  1354. if(list.contractionForm.totalAmount==""||list.contractionForm.totalAmount==null){
  1355. UTIL.showToastNoneIcon('请输入合同价款!');
  1356. return;
  1357. }
  1358. }
  1359. if(list.transferType == '12'){
  1360. list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit;
  1361. list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum;
  1362. list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id;
  1363. list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime;
  1364. list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime;
  1365. list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType;
  1366. }
  1367. that.data.form.method = 'POST';
  1368. console.log(that.data.form);
  1369. UTIL.httpRequest(API.URL_GET_TRANSFERADD, that.data.form, {
  1370. success: (res) => {
  1371. if (res.code == API.SUCCESS_CODE) {
  1372. if(that.data.form.capitalExpenditureType == 2){
  1373. that.data.form.projectForm.ynType = res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2';
  1374. that.data.form.projectForm.outId = res.data.id;
  1375. that.data.form.projectForm.method = 'POST';
  1376. // 工程项目提交
  1377. UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.projectForm, {
  1378. success: (res) => {
  1379. }
  1380. })
  1381. }
  1382. if(that.data.form.capitalExpenditureType == 4){
  1383. that.data.form.contractionForm.transferId = res.data.id;
  1384. that.data.form.contractionForm.id = '';
  1385. that.data.form.contractionForm.method = 'POST';
  1386. // 关联合同提交
  1387. UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.contractionForm, {
  1388. success: (res) => {
  1389. }
  1390. })
  1391. }
  1392. // if(that.data.form.fileForm == undefined){continue;}
  1393. that.data.form.id = res.data.id
  1394. that.setData({
  1395. showFile:true
  1396. })
  1397. // console.log(that.data.form)
  1398. }else{
  1399. wx.showToast({
  1400. title: res.msg,
  1401. icon: 'error',
  1402. duration: 2000
  1403. })
  1404. }
  1405. }
  1406. })
  1407. },
  1408. upLoadNew(){
  1409. var that = this;
  1410. that.upDownFile(that.data.form).then(response=>{
  1411. wx.hideLoading();
  1412. console.log(e.currentTarget.dataset.type);
  1413. if(e.currentTarget.dataset.type == 0){
  1414. wx.navigateTo({
  1415. url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel),
  1416. })
  1417. }
  1418. if(e.currentTarget.dataset.type == 2){
  1419. wx.showToast({
  1420. title: '保存成功',
  1421. icon: 'success',
  1422. duration: 2000,
  1423. })
  1424. }
  1425. if(e.currentTarget.dataset.type == 1){
  1426. console.log("aaa");
  1427. wx.showToast({
  1428. title: '保存成功',
  1429. icon: 'success',
  1430. duration: 2000,
  1431. complete(){
  1432. setTimeout(function(){
  1433. that.back();
  1434. },2000)
  1435. }
  1436. })
  1437. }
  1438. if(e.currentTarget.dataset.type == 3){
  1439. UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, {
  1440. success: (res2) => {
  1441. if (res2.code == API.SUCCESS_CODE) {
  1442. wx.showToast({
  1443. title: '操作成功',
  1444. icon: 'success',
  1445. duration: 2000,
  1446. complete(){
  1447. setTimeout(function(){
  1448. that.back();
  1449. },2000)
  1450. }
  1451. })
  1452. }else{
  1453. wx.showToast({
  1454. title: '操作失败',
  1455. icon: 'error',
  1456. duration: 2000
  1457. })
  1458. }
  1459. }
  1460. })
  1461. }
  1462. }).catch((err) => {
  1463. console.log(err);
  1464. wx.hideLoading();
  1465. if(e.currentTarget.dataset.type == 0){
  1466. wx.navigateTo({
  1467. url: '/pages/apply/approval/approval?id='+res.data.approvalItemTemplate.id+'&deptId='+res.data.approvalItemTemplate.deptId+'&form='+JSON.stringify(res.data)+'&type='+that.data.formType+'&applyOptions='+JSON.stringify(that.data.templateModel),
  1468. })
  1469. }
  1470. if(e.currentTarget.dataset.type == 2){
  1471. wx.showToast({
  1472. title: '保存成功',
  1473. icon: 'success',
  1474. duration: 2000,
  1475. })
  1476. }
  1477. if(e.currentTarget.dataset.type == 1){
  1478. console.log("aaa");
  1479. wx.showToast({
  1480. title: '保存成功',
  1481. icon: 'success',
  1482. duration: 2000,
  1483. complete(){
  1484. setTimeout(function(){
  1485. that.back();
  1486. },2000)
  1487. }
  1488. })
  1489. }
  1490. if(e.currentTarget.dataset.type == 3){
  1491. UTIL.httpRequest(API.URL_GET_TOREVIEWSUBMIT+res.data.approvalItemTemplate.id , {method:'POST'}, {
  1492. success: (res2) => {
  1493. if (res2.code == API.SUCCESS_CODE) {
  1494. wx.showToast({
  1495. title: '操作成功',
  1496. icon: 'success',
  1497. duration: 2000,
  1498. complete(){
  1499. setTimeout(function(){
  1500. that.back();
  1501. },2000)
  1502. }
  1503. })
  1504. }else{
  1505. wx.showToast({
  1506. title: '操作失败',
  1507. icon: 'error',
  1508. duration: 2000
  1509. })
  1510. }
  1511. }
  1512. })
  1513. }
  1514. })
  1515. },
  1516. upDownFile(op){
  1517. var that = this;
  1518. console.log(op)
  1519. wx.showLoading({
  1520. title: '正在上传附件',
  1521. mask:true
  1522. })
  1523. return new Promise((resolve, reject) => {
  1524. if(op.fileForm.length > 0){
  1525. for (let i = 0; i < op.fileForm.length; i++) {
  1526. op.fileForm[i].tableId = op.id
  1527. const element = op.fileForm[i];
  1528. console.log(element);
  1529. wx.uploadFile({
  1530. url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD,
  1531. filePath: element.file,
  1532. name: 'file',
  1533. header: {
  1534. "Content-Type": "multipart/form-data",//记得设置
  1535. "chartset":"utf-8",
  1536. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  1537. },
  1538. formData:element,
  1539. success (response){
  1540. if(op.fileForm.length == (i+1)){
  1541. resolve();
  1542. }
  1543. },
  1544. fail(res){
  1545. console.log(res)
  1546. reject();
  1547. }
  1548. })
  1549. }
  1550. }else{
  1551. reject();
  1552. }
  1553. });
  1554. },
  1555. goCustomSubmit(){
  1556. var that = this;
  1557. UTIL.httpRequest(API.URL_GET_TRANSFERCUSTOMSUBMIT2+this.data.form.id, {method : 'POST'}, {
  1558. success: (res) => {
  1559. if (res.code == API.SUCCESS_CODE) {
  1560. wx.showToast({
  1561. title: '提交成功',
  1562. icon: 'success',
  1563. duration: 2000,
  1564. complete(){
  1565. setTimeout(function(){
  1566. that.back();
  1567. },2000)
  1568. }
  1569. })
  1570. }else{
  1571. wx.showToast({
  1572. title: res.msg,
  1573. icon: 'error',
  1574. duration: 2000
  1575. })
  1576. }
  1577. }
  1578. })
  1579. },
  1580. goCustomSubmit2(){
  1581. var that = this;
  1582. wx.showLoading({
  1583. title: '正在提交',
  1584. mask:true
  1585. })
  1586. that.goKeepNew();
  1587. setTimeout(() => {
  1588. UTIL.httpRequest(API.URL_GET_TRANSFERCUSTOMSUBMIT2+this.data.form.id, {method : 'POST'}, {
  1589. success: (res) => {
  1590. if (res.code == API.SUCCESS_CODE) {
  1591. wx.hideLoading();
  1592. wx.showToast({
  1593. title: '提交成功',
  1594. icon: 'success',
  1595. duration: 2000,
  1596. complete(){
  1597. setTimeout(function(){
  1598. that.back();
  1599. },2000)
  1600. }
  1601. })
  1602. }else{
  1603. wx.showToast({
  1604. title: res.msg,
  1605. icon: 'error',
  1606. duration: 2000
  1607. })
  1608. }
  1609. }
  1610. })
  1611. }, 1000);
  1612. },
  1613. bindKeyInput(even){
  1614. console.log(even);
  1615. this.setData({
  1616. ["form.approvalItemTemplate.approvalItems"]: even.detail,
  1617. })
  1618. },
  1619. errorPd(e){
  1620. console.log(e);
  1621. this.setData({
  1622. [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false
  1623. })
  1624. },
  1625. errorJE(e){
  1626. console.log(e);
  1627. this.setData({
  1628. [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false
  1629. })
  1630. },
  1631. errorYY(e){
  1632. console.log(e);
  1633. this.setData({
  1634. [e.currentTarget.dataset.formname+"Tirme"]:e.detail.value == '' ? true:false
  1635. })
  1636. },
  1637. SJtakephoto(e){
  1638. var that = this;
  1639. let fileForm = [];
  1640. wx.chooseMedia({
  1641. mediaType: ['image'],
  1642. sourceType: ['album', 'camera'],
  1643. camera: 'back',
  1644. count: 1,
  1645. success(res) {
  1646. console.log(res);
  1647. res.tempFiles.forEach(item => {
  1648. fileForm.push({
  1649. file: item.tempFilePath,
  1650. fileType:'1',
  1651. bizPath:'transfer',
  1652. tableName:'t_yinnong_transfer',
  1653. tableId:that.data.form.id
  1654. })
  1655. })
  1656. console.log(fileForm);
  1657. let tem = that.data.form.SJimage?that.data.form.SJimage:[];
  1658. res.tempFiles.forEach(r=>{
  1659. tem.push({
  1660. tempFilePath:r.tempFilePath
  1661. })
  1662. })
  1663. console.log(tem);
  1664. that.setData({
  1665. ["form.SJimage"]:tem,
  1666. ["form.fileForm"]:fileForm,
  1667. })
  1668. let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length;
  1669. let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length;
  1670. let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length;
  1671. let SYLGKlength = that.data.form.SYLGKimage == undefined ? 0:that.data.form.SYLGKimage.length;
  1672. let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) + parseInt( SYLGKlength ) ;
  1673. that.setData({
  1674. ["form.fileNum"]:fileNum,
  1675. })
  1676. const element = fileForm[0];
  1677. wx.uploadFile({
  1678. url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD,
  1679. filePath: res.tempFiles[0].tempFilePath,
  1680. name: 'file',
  1681. header: {
  1682. "Content-Type": "multipart/form-data",//记得设置
  1683. "chartset":"utf-8",
  1684. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  1685. },
  1686. formData:element,
  1687. success (response){
  1688. wx.showToast({
  1689. title: '上传成功',
  1690. icon: 'success',
  1691. duration: 2000,
  1692. })
  1693. },
  1694. fail(res){
  1695. console.log(res)
  1696. }
  1697. })
  1698. },fail(err){
  1699. console.log(err);
  1700. }
  1701. })
  1702. },
  1703. FPtakephoto(e){
  1704. var that = this;
  1705. let fileForm = [];
  1706. console.log(fileForm);
  1707. wx.chooseMedia({
  1708. mediaType: ['image'],
  1709. sourceType: ['album', 'camera'],
  1710. camera: 'back',
  1711. count: 1,
  1712. success(res) {
  1713. console.log(res);
  1714. res.tempFiles.forEach(item => {
  1715. fileForm.push({
  1716. file: item.tempFilePath,
  1717. fileType:'2',
  1718. bizPath:'transfer',
  1719. tableName:'t_yinnong_transfer',
  1720. tableId:that.data.form.id
  1721. })
  1722. })
  1723. let tem = that.data.form.FPimage?that.data.form.FPimage:[];
  1724. res.tempFiles.forEach(r=>{
  1725. tem.push({
  1726. tempFilePath:r.tempFilePath
  1727. })
  1728. })
  1729. console.log(tem);
  1730. that.setData({
  1731. ["form.FPimage"]:tem,
  1732. ["form.fileForm"]:fileForm
  1733. })
  1734. let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length;
  1735. let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length;
  1736. let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length;
  1737. let SYLGKlength = that.data.form.SYLGKimage == undefined ? 0:that.data.form.SYLGKimage.length;
  1738. let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) + parseInt( SYLGKlength ) ;
  1739. that.setData({
  1740. ["form.fileNum"]:fileNum,
  1741. })
  1742. const element = fileForm[0];
  1743. console.log(element);
  1744. wx.uploadFile({
  1745. url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD,
  1746. filePath: res.tempFiles[0].tempFilePath,
  1747. name: 'file',
  1748. header: {
  1749. "Content-Type": "multipart/form-data",//记得设置
  1750. "chartset":"utf-8",
  1751. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  1752. },
  1753. formData:element,
  1754. success (response){
  1755. wx.showToast({
  1756. title: '上传成功',
  1757. icon: 'success',
  1758. duration: 2000,
  1759. })
  1760. },
  1761. fail(res){
  1762. console.log(res)
  1763. }
  1764. })
  1765. },fail(err){
  1766. console.log(err);
  1767. }
  1768. })
  1769. },
  1770. QTtakephoto(e){
  1771. var that = this;
  1772. let fileForm = [];
  1773. wx.chooseMedia({
  1774. mediaType: ['image'],
  1775. sourceType: ['album', 'camera'],
  1776. camera: 'back',
  1777. count: 1,
  1778. success(res) {
  1779. console.log(res);
  1780. res.tempFiles.forEach(item => {
  1781. fileForm.push({
  1782. file: item.tempFilePath,
  1783. fileType:'3',
  1784. bizPath:'transfer',
  1785. tableName:'t_yinnong_transfer',
  1786. tableId:that.data.form.id
  1787. })
  1788. })
  1789. console.log(fileForm);
  1790. let tem = that.data.form.QTimage?that.data.form.QTimage:[];
  1791. res.tempFiles.forEach(r=>{
  1792. tem.push({
  1793. tempFilePath:r.tempFilePath
  1794. })
  1795. })
  1796. that.setData({
  1797. ["form.QTimage"]:tem,
  1798. ["form.fileForm"]:fileForm
  1799. })
  1800. let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length;
  1801. let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length;
  1802. let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length;
  1803. let SYLGKlength = that.data.form.SYLGKimage == undefined ? 0:that.data.form.SYLGKimage.length;
  1804. let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) + parseInt( SYLGKlength ) ;
  1805. that.setData({
  1806. ["form.fileNum"]:fileNum,
  1807. })
  1808. const element = fileForm[0];
  1809. wx.uploadFile({
  1810. url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD,
  1811. filePath: res.tempFiles[0].tempFilePath,
  1812. name: 'file',
  1813. header: {
  1814. "Content-Type": "multipart/form-data",//记得设置
  1815. "chartset":"utf-8",
  1816. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  1817. },
  1818. formData:element,
  1819. success (response){
  1820. wx.showToast({
  1821. title: '上传成功',
  1822. icon: 'success',
  1823. duration: 2000,
  1824. })
  1825. },
  1826. fail(res){
  1827. console.log(res)
  1828. }
  1829. })
  1830. },fail(err){
  1831. console.log(err);
  1832. }
  1833. })
  1834. },
  1835. SYLGKtakephoto(e){
  1836. var that = this;
  1837. let fileForm = [];
  1838. wx.chooseMedia({
  1839. mediaType: ['image'],
  1840. sourceType: ['album', 'camera'],
  1841. camera: 'back',
  1842. count: 1,
  1843. success(res) {
  1844. console.log(res);
  1845. res.tempFiles.forEach(item => {
  1846. fileForm.push({
  1847. file: item.tempFilePath,
  1848. fileType:'4',
  1849. bizPath:'transfer',
  1850. tableName:'t_yinnong_transfer',
  1851. tableId:that.data.form.id
  1852. })
  1853. })
  1854. console.log(fileForm);
  1855. let tem = that.data.form.SYLGKimage?that.data.form.SYLGKimage:[];
  1856. res.tempFiles.forEach(r=>{
  1857. tem.push({
  1858. tempFilePath:r.tempFilePath
  1859. })
  1860. })
  1861. that.setData({
  1862. ["form.SYLGKimage"]:tem,
  1863. ["form.fileForm"]:fileForm
  1864. })
  1865. let SJlength = that.data.form.SJimage == undefined ? 0:that.data.form.SJimage.length;
  1866. let FPlength = that.data.form.FPimage == undefined ? 0:that.data.form.FPimage.length;
  1867. let QTlength = that.data.form.QTimage == undefined ? 0:that.data.form.QTimage.length;
  1868. let SYLGKlength = that.data.form.SYLGKimage == undefined ? 0:that.data.form.SYLGKimage.length;
  1869. let fileNum = parseInt( SJlength ) + parseInt( FPlength ) + parseInt( QTlength ) + parseInt( SYLGKlength ) ;
  1870. that.setData({
  1871. ["form.fileNum"]:fileNum,
  1872. })
  1873. const element = fileForm[0];
  1874. wx.uploadFile({
  1875. url: wx.getStorageSync('dressCode')+API.URL_GET_UPLOAD,
  1876. filePath: res.tempFiles[0].tempFilePath,
  1877. name: 'file',
  1878. header: {
  1879. "Content-Type": "multipart/form-data",//记得设置
  1880. "chartset":"utf-8",
  1881. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  1882. },
  1883. formData:element,
  1884. success (response){
  1885. wx.showToast({
  1886. title: '上传成功',
  1887. icon: 'success',
  1888. duration: 2000,
  1889. })
  1890. },
  1891. fail(res){
  1892. console.log(res)
  1893. }
  1894. })
  1895. },fail(err){
  1896. console.log(err);
  1897. }
  1898. })
  1899. },
  1900. addList(){
  1901. var that = this;
  1902. let transList = this.data.form.transfers;
  1903. console.log(this.data.form);
  1904. for (let i = 0; i < transList.length; i++) {
  1905. const element = transList[i];
  1906. if(element.applyDate == '' || element.remark == '' || element.expenditureAmount == '' || element.payer == '' || element.payeeList[0].payee == '' || element.payeeList[0].incomeAmount == '' || element.payeeList[0].incomeAmount == undefined){
  1907. UTIL.showToastNoneIcon('事项'+UTIL.convertToChinaNum(i+1)+'的信息填写不完整,检查后重试!');
  1908. return;
  1909. }
  1910. }
  1911. transList.push({
  1912. num:UTIL.convertToChinaNum(transList.length+1),
  1913. expenditureAmountTirme:false,
  1914. remarkTirme:false,
  1915. showCapitalExpenditureType:false,
  1916. showApplyDate:false,
  1917. showTransferType:false,
  1918. showProject:false,
  1919. showProjectFundType:false,
  1920. showAccount:false,
  1921. showDialog:false,
  1922. showContraction:false,
  1923. SJimage:[],
  1924. FPimage:[],
  1925. QTimage:[],
  1926. activeName:0,
  1927. cashForm:{
  1928. payee:'',
  1929. phone:'',
  1930. unit:'',
  1931. leader:'',
  1932. remark:'',
  1933. },
  1934. showTitle:true,
  1935. capitalExpenditureType:'1',//资金支出类别
  1936. capitalExpenditureTypeText:'结算类',//资金支出类别(展示用)
  1937. succeedAmount:'',//成功支付金额
  1938. payer:'',//付款方
  1939. payerAccount:'',//付款方账户
  1940. bankType:'',//所属银行
  1941. bankTypeText:'',//所属银行(展示用)
  1942. isPeers:'N',//是否同行
  1943. operatorCode:'',//操作员代码
  1944. enterpriseCode:'',//企业编码
  1945. expenditureAmount:'',//支出总金额
  1946. applyDate:that.data.applyDate,//申请时间
  1947. transferStatus:'',//转账状态
  1948. auditStatus:'0',//审批状态
  1949. paymentState:'',//支付状态
  1950. approvalMode:'1',//审批模式
  1951. paymentTime:'',//支付时间
  1952. bankPriority:'',//银行处理优先级
  1953. clientPriority:'',//客户处理优先级
  1954. paymentPattern:'1',
  1955. transferType:'1',//付款方式
  1956. transferTypeText:'垫付报销:电子支付',//付款方式(展示用)
  1957. requiredTransferTime:'',//要求转账时间
  1958. remark:'',//付款事由
  1959. startTime:'',//开票日期
  1960. endTime:'',//到期日期
  1961. orderType:'',//汇票类型
  1962. bankAccountType:'2',//账户类别1 公户2私户
  1963. villageAccountType:'',//账户分类
  1964. payeeList:[{//收款方账户集合
  1965. payeeId:'0',//收款方id
  1966. payee:'',//收款方
  1967. bankDeposit:'',//开户行
  1968. incomeAmount:'0.00',//收入金额
  1969. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  1970. payeeAccount:'',//收款账户
  1971. }],
  1972. projectForm:{
  1973. projectId:'',
  1974. projectName:'',
  1975. projectContractor:'',
  1976. projectAmount:'',
  1977. projectBillNum:'',
  1978. projectFundType:'',
  1979. outId:'',
  1980. ynType:'1',
  1981. },
  1982. contractionForm:{
  1983. contractionId:'',
  1984. name:'',
  1985. code:'',
  1986. totalAmount:'',
  1987. },
  1988. });
  1989. //村账户查询参数
  1990. var perames = {
  1991. pageNum:1,
  1992. pageSize:999,
  1993. accountType:'102',
  1994. method:'post',
  1995.   params: {
  1996.          "townAccountType":"0"
  1997.     }
  1998. }
  1999. // 付款方列表
  2000. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  2001. success: (res) => {
  2002. that.setData({
  2003. accountOptions:res.rows,
  2004. ["form.transfers[0].applyDate"]: UTIL.formatDate(new Date()),
  2005. applyDate: UTIL.formatDate(new Date()),
  2006. })
  2007. }
  2008. })
  2009. this.setData({
  2010. ["form.transfers"] : transList,
  2011. activeNames:transList.length-1
  2012. })
  2013. for (let i = 0; i < this.data.form.transfers.length; i++) {
  2014. const element = this.data.form.transfers[i];
  2015. this.setData({
  2016. ["form.transfers["+i+"].showTitle"] : false,
  2017. })
  2018. }
  2019. this.setData({
  2020. ["form.transfers["+(transList.length-1)+"].showTitle"] : true,
  2021. })
  2022. console.log(this.data.form);
  2023. },
  2024. openPreview(e){
  2025. let array = [];
  2026. console.log(e);
  2027. e.currentTarget.dataset.option.forEach(item=>{
  2028. array.push(item.tempFilePath)
  2029. })
  2030. console.log(array);
  2031. wx.previewImage({
  2032. urls: array,
  2033. showmenu:true,
  2034. current:array[e.currentTarget.dataset.index]
  2035. })
  2036. },
  2037. goKeep(){
  2038. var that = this;
  2039. let pages = getCurrentPages();
  2040. let currentPage = null; //当前页面
  2041. let prevPage = null; //上一个页面
  2042. currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
  2043. prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
  2044. console.log(that.data.form);
  2045. if (prevPage) {
  2046. prevPage.setData({
  2047. form : that.data.form,//将想要传的信息赋值给上一个页面data中的值
  2048. })
  2049. that.back()
  2050. }
  2051. },
  2052. goKeepNew(e){
  2053. var that = this;
  2054. console.log(that.data.form);
  2055. var list = that.data.form;
  2056. if(list.applyDate == ''){
  2057. UTIL.showToastNoneIcon('请选择申请时间!');
  2058. return;
  2059. }
  2060. if(list.remark == ''){
  2061. UTIL.showToastNoneIcon('请填写转账附言!');
  2062. return;
  2063. }
  2064. var p = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  2065. if (p.test(list.remark)) {
  2066. UTIL.showToastNoneIcon('‘转账附言’存在非法字符,请尽量简洁并减少标点符号的使用,详情可在‘说明情况’中描述。');
  2067. return;
  2068. }
  2069. // if(list.explainSituation == ''){
  2070. // UTIL.showToastNoneIcon('请填写说明情况!');
  2071. // return;
  2072. // }
  2073. if(list.expenditureAmount == ''){
  2074. UTIL.showToastNoneIcon('请检查收款方收款金额!');
  2075. return;
  2076. }
  2077. if((parseFloat(list.expenditureAmount).toFixed(2) - parseFloat(list.payerAccount).toFixed(2) >0) && list.transferType == 11){
  2078. UTIL.showToastNoneIcon('支出金额不能超过付款账户余额!');
  2079. return;
  2080. }
  2081. if(list.payer == ''&&list.transferType != 12){
  2082. UTIL.showToastNoneIcon('请选择付款方!');
  2083. return;
  2084. }
  2085. for(let i = 0 ; i < list.payeeList.length ; i++){
  2086. if(list.payeeList[i].payee == ''){
  2087. UTIL.showToastNoneIcon('请选择收款方!');
  2088. return;
  2089. }
  2090. console.log(list.transferType);
  2091. if((list.payeeList[i].incomeAmount == '' || list.payeeList[i].incomeAmount == undefined)){
  2092. UTIL.showToastNoneIcon('请填写收款方的收入金额!');
  2093. return;
  2094. }
  2095. console.log(isNaN(parseFloat(list.payeeList[i].incomeAmount)));
  2096. console.log(!isFinite(list.payeeList[i].incomeAmount));
  2097. if(isNaN(parseFloat(list.payeeList[i].incomeAmount)) || !isFinite(list.payeeList[i].incomeAmount)){
  2098. UTIL.showToastNoneIcon('请填写正确的收款方收入金额!');
  2099. return;
  2100. }
  2101. }
  2102. if(list.capitalExpenditureType == 2){
  2103. if(list.projectForm.projectName==""||list.projectForm.projectName==null){
  2104. UTIL.showToastNoneIcon('请选择项目名称!');
  2105. return;
  2106. }
  2107. if(list.projectForm.projectBillNum==""||list.projectForm.projectBillNum==null){
  2108. UTIL.showToastNoneIcon('请输入工程发票号!');
  2109. return;
  2110. }
  2111. }
  2112. if(list.capitalExpenditureType==4){
  2113. if(list.contractionForm.name==""||list.contractionForm.name==null){
  2114. UTIL.showToastNoneIcon('请选择合同名称!');
  2115. return;
  2116. }
  2117. if(list.contractionForm.code==""||list.contractionForm.code==null){
  2118. UTIL.showToastNoneIcon('请输入合同编码!');
  2119. return;
  2120. }
  2121. if(list.contractionForm.totalAmount==""||list.contractionForm.totalAmount==null){
  2122. UTIL.showToastNoneIcon('请输入合同价款!');
  2123. return;
  2124. }
  2125. }
  2126. if(list.transferType == '12'){
  2127. list.transfers[i].payer = list.transfers[i].moneyOrderForm.billPayUnit;
  2128. list.transfers[i].payerAccount = list.transfers[i].moneyOrderForm.orderNum;
  2129. list.transfers[i].cashierId = list.transfers[i].moneyOrderForm.id;
  2130. list.transfers[i].startTime = list.transfers[i].moneyOrderForm.startTime;
  2131. list.transfers[i].endTime = list.transfers[i].moneyOrderForm.endTime;
  2132. list.transfers[i].orderType = list.transfers[i].moneyOrderForm.orderType;
  2133. }
  2134. that.data.form.method = 'POST';
  2135. console.log(that.data.form);
  2136. UTIL.httpRequest(API.URL_GET_TRANSFEREDIT, that.data.form, {
  2137. success: (res) => {
  2138. if (res.code == API.SUCCESS_CODE) {
  2139. if(that.data.form.capitalExpenditureType == 2){
  2140. that.data.form.projectForm.ynType = that.data.form.transferType=='1'||that.data.form.transferType=='2'||that.data.form.transferType=='4'?'1':'2';
  2141. that.data.form.projectForm.outId = that.data.form.id;
  2142. that.data.form.projectForm.method = 'POST';
  2143. // 工程项目提交
  2144. UTIL.httpRequest(API.URL_GET_ADDPROJECTTO , that.data.form.projectForm, {
  2145. success: (res) => {
  2146. }
  2147. })
  2148. }
  2149. if(that.data.form.capitalExpenditureType == 4){
  2150. that.data.form.contractionForm.transferId = that.data.form.id;
  2151. that.data.form.contractionForm.id = '';
  2152. that.data.form.contractionForm.method = 'POST';
  2153. // 关联合同提交
  2154. UTIL.httpRequest(API.URL_GET_GETRELATIONADD , that.data.form.contractionForm, {
  2155. success: (res) => {
  2156. }
  2157. })
  2158. }
  2159. wx.showToast({
  2160. title: '保存成功',
  2161. icon: 'success',
  2162. duration: 2000,
  2163. complete(){
  2164. setTimeout(function(){
  2165. that.back();
  2166. },2000)
  2167. }
  2168. })
  2169. }else{
  2170. wx.showToast({
  2171. title: res.msg,
  2172. icon: 'error',
  2173. duration: 2000
  2174. })
  2175. }
  2176. }
  2177. })
  2178. },
  2179. deleteTransfers(e){
  2180. var that = this ;
  2181. console.log(e.currentTarget.dataset.index);
  2182. // that.data.form.collapseDis = true;
  2183. that.setData({
  2184. ["form.collapseDis"]:true
  2185. })
  2186. if(that.data.form.transfers.length<2){
  2187. UTIL.showToastNoneIcon('最少保留一条事项');
  2188. return;
  2189. }
  2190. that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount = that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount == '' ? '0' : that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount;
  2191. that.data.form.approvalItemTemplate.totalAmount = parseFloat(parseFloat(that.data.form.approvalItemTemplate.totalAmount)- parseFloat(that.data.form.transfers[e.currentTarget.dataset.index].expenditureAmount)).toFixed(2);
  2192. that.data.form.transfers.splice(e.currentTarget.dataset.index,1);
  2193. for (let i = 0; i < that.data.form.transfers.length; i++) {
  2194. that.data.form.transfers[i].num = UTIL.convertToChinaNum(i+1)
  2195. }
  2196. console.log(that.data.form);
  2197. that.setData({
  2198. form:that.data.form,
  2199. })
  2200. UTIL.httpRequest(API.URL_GET_TRANSFERREMOVE+e.currentTarget.dataset.id , {method:'GET'}, {
  2201. success: (res) => {
  2202. }
  2203. })
  2204. },
  2205. disabledNone(e){
  2206. console.log("b");
  2207. var that = this ;
  2208. that.setData({
  2209. ["form.transfers["+e.currentTarget.dataset.index+"].collapseDis"]:true
  2210. })
  2211. },
  2212. disabledBlock(e){
  2213. console.log("a");
  2214. var that = this ;
  2215. that.setData({
  2216. ["form.transfers["+e.currentTarget.dataset.index+"].collapseDis"]:false
  2217. })
  2218. },
  2219. onOpen(e){
  2220. var that = this ;
  2221. console.log(that.data.activeNames);
  2222. console.log(e);
  2223. for (let i = 0; i < this.data.form.transfers.length; i++) {
  2224. const element = this.data.form.transfers[i];
  2225. this.setData({
  2226. ["form.transfers["+i+"].showTitle"] : false,
  2227. })
  2228. }
  2229. that.setData({
  2230. ["form.transfers["+e.detail+"].showTitle"]:true
  2231. })
  2232. },
  2233. onCloseSecond(e){
  2234. var that = this ;
  2235. console.log(e);
  2236. that.setData({
  2237. ["form.transfers["+e.detail+"].showTitle"]:false
  2238. })
  2239. },
  2240. deleteimg(e){
  2241. let options = e.currentTarget.dataset.options;
  2242. console.log(options);
  2243. let file = this.data.form.fileForm;
  2244. for (let i = 0; i < file.length; i++) {
  2245. const element = file[i];
  2246. if(element.file == options[e.currentTarget.dataset.index].tempFilePath){
  2247. file.splice(i,1);
  2248. }
  2249. }
  2250. options.splice(e.currentTarget.dataset.index,1);
  2251. let length = this.data.form.fileNum - 1;
  2252. this.setData({
  2253. [e.currentTarget.dataset.name]:options,
  2254. ["form.fileNum"]:length,
  2255. ["form.fileForm"]:file,
  2256. })
  2257. UTIL.httpRequest(API.URL_GET_GETFILEREMOVE+e.currentTarget.dataset.id , {method:'GET'}, {
  2258. success: (res) => {
  2259. wx.showToast({
  2260. title: '删除成功!',
  2261. icon: 'success',
  2262. duration: 2000,
  2263. })
  2264. }
  2265. })
  2266. },
  2267. uploadFile(e){
  2268. var that = this;
  2269. if(e.currentTarget.dataset.payer == null || e.currentTarget.dataset.payer == ''){
  2270. UTIL.showToastNoneIcon('请先选择付款方!');
  2271. return;
  2272. }
  2273. console.log(e);
  2274. let moneyParents = e.currentTarget.dataset.totalamount == ''?'0.00':e.currentTarget.dataset.totalamount;
  2275. let moneyChildren = e.currentTarget.dataset.expenditureamount == ''?'0.00':e.currentTarget.dataset.expenditureamount
  2276. let totalAmount = parseFloat(moneyParents) - parseFloat(moneyChildren);
  2277. console.log(moneyParents);
  2278. console.log(moneyChildren);
  2279. wx.navigateTo({
  2280. url: '../add/upLoad/upLoad?bankType='+e.currentTarget.dataset.banktype+'&index='+e.currentTarget.dataset.index+'&totalAmount='+totalAmount+'&isPeers='+e.currentTarget.dataset.ispeers
  2281. })
  2282. return;
  2283. wx.chooseMessageFile({
  2284. count: 1,
  2285. type: 'file',
  2286. success (res) {
  2287. console.log(res);
  2288. // tempFilePath可以作为 img 标签的 src 属性显示图片
  2289. const tempFilePaths = res.tempFiles
  2290. wx.uploadFile({
  2291. url: API.URL_GET_UPLOADFILE,
  2292. filePath: tempFilePaths[0].path,
  2293. name: 'file',
  2294. header: {
  2295. "Content-Type": "multipart/form-data",//记得设置
  2296. "chartset":"utf-8",
  2297. 'Authorization':'Bearer '+getApp().globalData.userInfo.token
  2298. },
  2299. formData:{
  2300. bankType:'2',
  2301. accountType:'1',
  2302. isPeers:'Y'
  2303. },
  2304. success (response){
  2305. console.log(response);
  2306. let list = JSON.parse(response.data);
  2307. console.log(list);
  2308. that.setData({
  2309. ['form.transfers[0].payeeList']:list.rows
  2310. })
  2311. },
  2312. fail(res){
  2313. }
  2314. })
  2315. }
  2316. })
  2317. },
  2318. downLoad(){
  2319. wx.downloadFile({
  2320. url: API.URL_GET_DOWNFILE, //仅为示例,并非真实的资源
  2321. success (res) {
  2322. console.log(res);
  2323. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  2324. if (res.statusCode === 200) {
  2325. var fs = wx.getFileSystemManager();
  2326. fs.saveFile({
  2327. tempFilePath:res.tempFilePath,
  2328. success:function(response){
  2329. console.log(response);
  2330. }
  2331. })
  2332. // wx.saveFile({
  2333. // tempFilePath: res.tempFilePath,
  2334. // success:function(response){
  2335. // console.log(response);
  2336. // }
  2337. // })
  2338. // wx.playVoice({
  2339. // filePath: res.tempFilePath
  2340. // })
  2341. }
  2342. }
  2343. })
  2344. },
  2345. addPayee(){
  2346. console.log(this.data.form.payeeList);
  2347. for(let i = 0 ; i < this.data.form.payeeList.length ; i++ ){
  2348. if(!this.data.form.payeeList[i].payee && !this.data.form.payeeList[i].payeeAccount && !this.data.form.payeeList[i].bankDeposit && !this.data.form.payeeList[i].bankTypeText){
  2349. UTIL.showToastNoneIcon('请勿添加多个空付款人');
  2350. return;
  2351. }
  2352. if(!this.data.form.payeeList[i].incomeAmount || this.data.form.payeeList[i].incomeAmount == "" || this.data.form.payeeList[i].incomeAmount == undefined || this.data.form.payeeList[i].incomeAmount == null){
  2353. UTIL.showToastNoneIcon('请完善收入金额');
  2354. return;
  2355. }
  2356. }
  2357. this.data.form.payeeList.push({});
  2358. this.setData({
  2359. ["form.payeeList"]:this.data.form.payeeList,
  2360. })
  2361. },
  2362. removePayer(e){
  2363. console.log(e);
  2364. let i = e.currentTarget.dataset.index;
  2365. let list = this.data.form.payeeList;
  2366. list.splice(i,1);
  2367. this.setData({
  2368. ["form.payeeList"]:list,
  2369. })
  2370. },
  2371. onChangePayeeMoney(event){
  2372. console.log(event);
  2373. this.setData({
  2374. [event.currentTarget.dataset.value]: event.detail,
  2375. })
  2376. let moneyCount = parseFloat(0);
  2377. for(let i = 0 ; i < this.data.form.payeeList.length ; i++){
  2378. moneyCount += parseFloat(this.data.form.payeeList[i].incomeAmount==""?0:this.data.form.payeeList[i].incomeAmount)
  2379. }
  2380. this.setData({
  2381. ["form.expenditureAmount"]: moneyCount.toFixed(2),
  2382. })
  2383. },
  2384. /**
  2385. * 生命周期函数--监听页面隐藏
  2386. */
  2387. onHide() {
  2388. },
  2389. /**
  2390. * 生命周期函数--监听页面卸载
  2391. */
  2392. onUnload() {
  2393. },
  2394. /**
  2395. * 页面相关事件处理函数--监听用户下拉动作
  2396. */
  2397. onPullDownRefresh() {
  2398. },
  2399. /**
  2400. * 页面上拉触底事件的处理函数
  2401. */
  2402. onReachBottom() {
  2403. },
  2404. /**
  2405. * 用户点击右上角分享
  2406. */
  2407. onShareAppMessage() {
  2408. }
  2409. })