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

expenditureAudit.js 14 KiB

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