微信小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

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