微信小程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

detail.js 14 KiB

3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. // pages/handle/expenditureAudit/expenditureAudit.js
  2. import * as UTIL from '../../utils/util.js';
  3. import * as API from '../../utils/API.js';
  4. let EVN_CONFIG = require('../../env/env');
  5. const DISTRIBUTE_ENVIROMENT = 'IMGURL';
  6. let {
  7. URL_PREFIX,
  8. } = EVN_CONFIG[DISTRIBUTE_ENVIROMENT];
  9. const app = getApp();
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. isIPX: app.globalData.isIPX,
  16. active:0,
  17. spsxOptions:[],
  18. paymentPatternOptions:[],
  19. nickName:'',
  20. comment:'',
  21. activeNames: 0,
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad: function (options) {
  27. var that = this;
  28. that.setData({
  29. taskId:options.taskId,
  30. pageType:options.type
  31. })
  32. wx.showLoading({
  33. title: '正在加载模板',
  34. mask:true
  35. })
  36. //所属银行
  37. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  38. success: (res) => {
  39. this.setData({
  40. bankTypeOptions:res.data
  41. });
  42. }
  43. })
  44. // 资金支出类别字典查询
  45. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  46. success: (res) => {
  47. that.setData({
  48. capitalExpenditureTypeOptions:res.data,
  49. })
  50. }
  51. })
  52. // 付款方式类型字典查询
  53. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_type', {method:'GET'}, {
  54. success: (res) => {
  55. that.setData({
  56. transferTypeOptions:res.data,
  57. })
  58. }
  59. })
  60. // 项目工程列表
  61. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  62. success: (res) => {
  63. that.setData({
  64. projectOptions:res.rows,
  65. })
  66. }
  67. })
  68. // 工程款类型字典查询
  69. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  70. success: (res) => {
  71. that.setData({
  72. projectFundTypeOptions:res.data,
  73. })
  74. }
  75. })
  76. // 支付方式
  77. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, {
  78. success: (res) => {
  79. that.setData({
  80. paymentPatternOptions:res.data,
  81. })
  82. }
  83. })
  84. // 转账状态
  85. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_status', {method:'GET'}, {
  86. success: (res) => {
  87. that.setData({
  88. transferStatusOptions:res.data,
  89. })
  90. }
  91. })
  92. // 获取合同信息列表
  93. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET'}, {
  94. success: (res) => {
  95. that.setData({
  96. contractionOptions:res.rows,
  97. })
  98. }
  99. })
  100. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  101. success: (res) => {
  102. if (res.code == API.SUCCESS_CODE) {
  103. that.setData({
  104. nickName:res.user.nickName
  105. })
  106. }
  107. }
  108. })
  109. setTimeout(function(){
  110. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  111. success: (res) => {
  112. if (res.code == API.SUCCESS_CODE) {
  113. console.log(that.data.capitalExpenditureTypeOptions);
  114. if(res.data.approvalItemTemplate == null){return;}
  115. res.data.approvalItemTemplate.totalAmount = parseFloat(res.data.approvalItemTemplate.totalAmount).toFixed(2)
  116. res.data.transfers = res.data.transfers.filter(function (e) { return e.id == options.ids; });
  117. console.log(options.ids);
  118. console.log(res.data.transfers.filter(function (e) { return e.id == options.ids; }));
  119. res.data.transfers.forEach( (item,index) => {
  120. res.data.transfers[index].capitalExpenditureTypeText = UTIL.getTransform(item.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  121. res.data.transfers[index].transferTypeText = UTIL.getTransform(item.transferType,that.data.transferTypeOptions);
  122. res.data.transfers[index].bankTypeText = UTIL.getTransform(item.bankType,that.data.bankTypeOptions);
  123. res.data.transfers[index].paymentPatternText = UTIL.getTransform(item.paymentPattern,that.data.paymentPatternOptions);
  124. res.data.transfers[index].num = UTIL.convertToChinaNum(index+1),
  125. res.data.transfers[index].expenditureAmount = parseFloat(res.data.transfers[index].expenditureAmount).toFixed(2)
  126. res.data.transfers[index].showTitle = false;
  127. res.data.transfers[index].activeName = '';
  128. res.data.transfers[index].payeeList.forEach( (response,i) => {
  129. res.data.transfers[index].payeeList[i].bankTypeText = UTIL.getTransform(response.bankType,that.data.bankTypeOptions);
  130. res.data.transfers[index].payeeList[i].transferStatusText = UTIL.getTransform(response.transferStatus,that.data.transferStatusOptions);
  131. })
  132. console.log(res.data.transfers[index].capitalExpenditureType);
  133. if(res.data.transfers[index].capitalExpenditureType == 2){
  134. let prames = {
  135. outId:res.data.transfers[index].id,
  136. ynType: res.data.transfers[index].transferType=='1'||res.data.transfers[index].transferType=='2'||res.data.transfers[index].transferType=='4'?'1':'2'
  137. }
  138. // 工程项目查询
  139. UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, {
  140. success: (res) => {
  141. res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions);
  142. that.setData({
  143. ["form.transfers["+index+"].projectForm"]:res.data,
  144. })
  145. }
  146. })
  147. }
  148. if(res.data.transfers[index].capitalExpenditureType == 4){
  149. let prames = {
  150. transferId:res.data.transfers[index].id,
  151. }
  152. // 关联合同查询
  153. UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, {
  154. success: (res) => {
  155. that.setData({
  156. ["form.transfers["+index+"].contractionForm"]:res.data,
  157. })
  158. }
  159. })
  160. }
  161. if(res.data.transfers[index].transferType == '12'){
  162. var transferTimer = setTimeout(function(){
  163. that.setData({
  164. ["form.transfers["+index+"].moneyOrderForm"]:{
  165. billPayUnit : res.data.transfers[index].payer,
  166. orderNum : res.data.transfers[index].payerAccount,
  167. id : res.data.transfers[index].cashierId,
  168. startTime : res.data.transfers[index].startTime,
  169. endTime : res.data.transfers[index].endTime,
  170. orderType : res.data.transfers[index].orderType,
  171. orderAmount:res.data.transfers[index].expenditureAmount
  172. },
  173. ["form.transfers["+index+"].amountReadonly"]:true
  174. })
  175. },1000)
  176. }
  177. UTIL.httpRequest(
  178. API.URL_GET_FINDLIST,
  179. {
  180. method:'GET',
  181. tableName:'t_yinnong_transfer',
  182. tableId:item.id,
  183. fileType:1
  184. },
  185. {
  186. success: (res) => {
  187. let list = [];
  188. res.data.forEach((item2,index2)=>{
  189. list.push({
  190. tempFilePath:URL_PREFIX+item2.fileUrl
  191. })
  192. that.setData({
  193. ["form.transfers["+index+"].SJimage"]:list,
  194. });
  195. })
  196. }
  197. })
  198. //发票
  199. UTIL.httpRequest(
  200. API.URL_GET_FINDLIST,
  201. {
  202. method:'GET',
  203. tableName:'t_yinnong_transfer',
  204. tableId:item.id,
  205. fileType:2
  206. },
  207. {
  208. success: (res) => {
  209. let list = [];
  210. res.data.forEach((item2,index2)=>{
  211. list.push({
  212. tempFilePath:URL_PREFIX+item2.fileUrl
  213. })
  214. that.setData({
  215. ["form.transfers["+index+"].FPimage"]:list,
  216. });
  217. })
  218. }
  219. })
  220. //其他
  221. UTIL.httpRequest(
  222. API.URL_GET_FINDLIST,
  223. {
  224. method:'GET',
  225. tableName:'t_yinnong_transfer',
  226. tableId:item.id,
  227. fileType:3
  228. },
  229. {
  230. success: (res) => {
  231. let list = [];
  232. res.data.forEach((item2,index2)=>{
  233. list.push({
  234. tempFilePath:URL_PREFIX+item2.fileUrl
  235. })
  236. that.setData({
  237. ["form.transfers["+index+"].QTimage"]:list,
  238. });
  239. })
  240. }
  241. })
  242. })
  243. that.setData({
  244. form:res.data,
  245. activeNames:null
  246. })
  247. wx.hideLoading();
  248. }
  249. }
  250. })
  251. // 查询审批事项流转进度
  252. // UTIL.httpRequest(API.URL_GET_GETPROCESS+options.id , {method:'GET'}, {
  253. // success: (res) => {
  254. // console.log(res);
  255. // if(res.data.processSchedule != null){
  256. // that.setData({spsxOptions:res.data.processSchedule.spsx})
  257. // }
  258. // that.setData({instanceId:res.data.instanceId})
  259. // if(options.business == 'xj'){
  260. // console.log(that.data.instanceId)
  261. // // 查询现金审批事项流转进度
  262. // UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, {
  263. // success: (res) => {
  264. // console.log(res);
  265. // if(res.data.processSchedule.spsx){
  266. // that.setData({spsxOptions:res.data.processSchedule.spsx})
  267. // }
  268. // that.setData({instanceId:res.data.instanceId})
  269. // }
  270. // })
  271. // }
  272. // }
  273. // })
  274. },1000)
  275. },
  276. onChangePayee(event) {
  277. console.log(event);
  278. this.setData({
  279. ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:event.detail
  280. });
  281. },
  282. goPayee(event){
  283. wx.navigateTo({
  284. url: 'payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option)
  285. })
  286. },
  287. goDis(){
  288. var that = this ;
  289. console.log()
  290. let data = {
  291. taskId:that.data.taskId,
  292. instanceId:that.data.instanceId,
  293. variables:JSON.stringify({
  294. comment:that.data.comment == '' ? '驳回':that.data.comment,
  295. pass:false,
  296. }),
  297. method:'POST'
  298. };
  299. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  300. success: (res) => {
  301. console.log(res);
  302. if (res.code == API.SUCCESS_CODE) {
  303. wx.showToast({
  304. title: '审批成功',
  305. icon: 'success',
  306. duration: 2000,
  307. complete(){
  308. setTimeout(function(){
  309. that.back();
  310. },2000)
  311. }
  312. })
  313. }else{
  314. wx.showToast({
  315. title: '操作失败',
  316. icon: 'error',
  317. duration: 2000
  318. })
  319. }
  320. }
  321. })
  322. },
  323. goAgree(){
  324. var that = this ;
  325. let data = {
  326. taskId:that.data.taskId,
  327. instanceId:that.data.instanceId,
  328. variables:JSON.stringify({
  329. "comment":that.data.comment == '' ? '同意':that.data.comment,
  330. "pass":true,
  331. }),
  332. method:'POST'
  333. };
  334. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  335. success: (res) => {
  336. console.log(res);
  337. if (res.code == API.SUCCESS_CODE) {
  338. wx.showToast({
  339. title: '审批成功',
  340. icon: 'success',
  341. duration: 2000,
  342. complete(){
  343. setTimeout(function(){
  344. that.back();
  345. },2000)
  346. }
  347. })
  348. }else{
  349. wx.showToast({
  350. title: '操作失败',
  351. icon: 'error',
  352. duration: 2000
  353. })
  354. }
  355. }
  356. })
  357. },
  358. commentInput(e){
  359. console.log(e);
  360. var that = this;
  361. that.setData({
  362. comment:e.detail.value
  363. })
  364. },
  365. onChangeBox(event) {
  366. console.log(event);
  367. this.setData({
  368. activeNames: event.detail,
  369. });
  370. },
  371. onCloseSecond(e){
  372. var that = this ;
  373. console.log(e);
  374. that.setData({
  375. ["form.transfers["+e.detail+"].showTitle"]:false
  376. })
  377. },
  378. onOpen(e){
  379. var that = this ;
  380. console.log(that.data.activeNames);
  381. console.log(e);
  382. for (let i = 0; i < this.data.form.transfers.length; i++) {
  383. const element = this.data.form.transfers[i];
  384. this.setData({
  385. ["form.transfers["+i+"].showTitle"] : false,
  386. })
  387. }
  388. that.setData({
  389. ["form.transfers["+e.detail+"].showTitle"]:true
  390. })
  391. },
  392. openPreview(e){
  393. let array = [];
  394. console.log(e);
  395. e.currentTarget.dataset.option.forEach(item=>{
  396. array.push(item.tempFilePath)
  397. })
  398. console.log(array);
  399. wx.previewImage({
  400. urls: array,
  401. showmenu:true,
  402. current:array[e.currentTarget.dataset.index]
  403. })
  404. },
  405. /**
  406. * 生命周期函数--监听页面初次渲染完成
  407. */
  408. onReady: function () {
  409. },
  410. /**
  411. * 生命周期函数--监听页面显示
  412. */
  413. onShow: function () {
  414. },
  415. back:function(){
  416. wx.navigateBack({
  417. delta: 1
  418. })
  419. },
  420. /**
  421. * 生命周期函数--监听页面隐藏
  422. */
  423. onHide: function () {
  424. },
  425. /**
  426. * 生命周期函数--监听页面卸载
  427. */
  428. onUnload: function () {
  429. },
  430. /**
  431. * 页面相关事件处理函数--监听用户下拉动作
  432. */
  433. onPullDownRefresh: function () {
  434. },
  435. /**
  436. * 页面上拉触底事件的处理函数
  437. */
  438. onReachBottom: function () {
  439. },
  440. /**
  441. * 用户点击右上角分享
  442. */
  443. onShareAppMessage: function () {
  444. }
  445. })