微信小程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

detail.js 14 KiB

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