微信小程序
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.

360 lines
9.8 KiB

  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. nickName:app.globalData.user,
  19. comment:''
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. var that = this;
  26. console.log(options);
  27. that.setData({
  28. taskId:options.taskId,
  29. pageType:options.type
  30. })
  31. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  32. success: (res) => {
  33. if (res.code == API.SUCCESS_CODE) {
  34. that.setData({
  35. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  36. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  37. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  38. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  39. nickName:res.user.nickName
  40. })
  41. }
  42. }
  43. })
  44. //所属银行
  45. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  46. success: (res) => {
  47. this.setData({
  48. bankTypeOptions:res.data
  49. });
  50. }
  51. })
  52. // 资金支出类别字典查询
  53. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  54. success: (res) => {
  55. that.setData({
  56. capitalExpenditureTypeOptions:res.data,
  57. })
  58. }
  59. })
  60. // 付款方式类型字典查询
  61. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_type', {method:'GET'}, {
  62. success: (res) => {
  63. that.setData({
  64. transferTypeOptions:res.data,
  65. })
  66. }
  67. })
  68. // 项目工程列表
  69. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  70. success: (res) => {
  71. that.setData({
  72. projectOptions:res.rows,
  73. })
  74. }
  75. })
  76. // 工程款类型字典查询
  77. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  78. success: (res) => {
  79. that.setData({
  80. projectFundTypeOptions:res.data,
  81. })
  82. }
  83. })
  84. // 获取合同信息列表
  85. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET'}, {
  86. success: (res) => {
  87. that.setData({
  88. contractionOptions:res.rows,
  89. })
  90. }
  91. })
  92. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  93. success: (res) => {
  94. if (res.code == API.SUCCESS_CODE) {
  95. console.log(that.data.capitalExpenditureTypeOptions);
  96. if(res.data.approvalItemTemplate == null){return;}
  97. res.data.transfers.forEach( (item,index) => {
  98. res.data.transfers[index].capitalExpenditureTypeText = UTIL.getTransform(item.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  99. res.data.transfers[index].transferTypeText = UTIL.getTransform(item.transferType,that.data.transferTypeOptions);
  100. res.data.transfers[index].bankTypeText = UTIL.getTransform(item.bankType,that.data.bankTypeOptions);
  101. res.data.transfers[index].payeeList.forEach( (response,i) => {
  102. res.data.transfers[index].payeeList[i].bankTypeText = UTIL.getTransform(response.bankType,that.data.bankTypeOptions);
  103. })
  104. console.log(res.data.transfers[index].capitalExpenditureType);
  105. if(res.data.transfers[index].capitalExpenditureType == 2){
  106. let prames = {
  107. outId:res.data.transfers[index].id,
  108. ynType: res.data.transfers[index].transferType=='1'||res.data.transfers[index].transferType=='2'||res.data.transfers[index].transferType=='4'?'1':'2'
  109. }
  110. // 工程项目查询
  111. UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, {
  112. success: (res) => {
  113. res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions);
  114. that.setData({
  115. ["form.transfers["+index+"].projectForm"]:res.data,
  116. })
  117. }
  118. })
  119. }
  120. UTIL.httpRequest(
  121. API.URL_GET_FINDLIST,
  122. {
  123. method:'GET',
  124. tableName:'t_yinnong_transfer',
  125. tableId:item.id,
  126. fileType:1
  127. },
  128. {
  129. success: (res) => {
  130. let list = [];
  131. res.data.forEach((item2,index2)=>{
  132. list.push({
  133. tempFilePath:URL_PREFIX+item2.fileUrl
  134. })
  135. that.setData({
  136. ["form.transfers["+index+"].SJimage"]:list,
  137. });
  138. })
  139. }
  140. })
  141. //发票
  142. UTIL.httpRequest(
  143. API.URL_GET_FINDLIST,
  144. {
  145. method:'GET',
  146. tableName:'t_yinnong_transfer',
  147. tableId:item.id,
  148. fileType:2
  149. },
  150. {
  151. success: (res) => {
  152. let list = [];
  153. res.data.forEach((item2,index2)=>{
  154. list.push({
  155. tempFilePath:URL_PREFIX+item2.fileUrl
  156. })
  157. that.setData({
  158. ["form.transfers["+index+"].FPimage"]:list,
  159. });
  160. })
  161. }
  162. })
  163. //其他
  164. UTIL.httpRequest(
  165. API.URL_GET_FINDLIST,
  166. {
  167. method:'GET',
  168. tableName:'t_yinnong_transfer',
  169. tableId:item.id,
  170. fileType:3
  171. },
  172. {
  173. success: (res) => {
  174. let list = [];
  175. res.data.forEach((item2,index2)=>{
  176. list.push({
  177. tempFilePath:URL_PREFIX+item2.fileUrl
  178. })
  179. that.setData({
  180. ["form.transfers["+index+"].QTimage"]:list,
  181. });
  182. })
  183. }
  184. })
  185. })
  186. that.setData({
  187. form:res.data
  188. })
  189. }
  190. }
  191. })
  192. // 查询审批事项流转进度
  193. UTIL.httpRequest(API.URL_GET_GETPROCESS+options.id , {method:'GET'}, {
  194. success: (res) => {
  195. console.log(res);
  196. if(res.data.processSchedule != null){
  197. that.setData({spsxOptions:res.data.processSchedule.spsx})
  198. }
  199. that.setData({instanceId:res.data.instanceId})
  200. if(options.business == 'xj'){
  201. console.log(that.data.instanceId)
  202. // 查询现金审批事项流转进度
  203. UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, {
  204. success: (res) => {
  205. console.log(res);
  206. if(res.data.processSchedule.spsx){
  207. that.setData({spsxOptions:res.data.processSchedule.spsx})
  208. }
  209. that.setData({instanceId:res.data.instanceId})
  210. }
  211. })
  212. }
  213. }
  214. })
  215. },
  216. goDis(){
  217. var that = this ;
  218. console.log()
  219. let data = {
  220. taskId:that.data.taskId,
  221. instanceId:that.data.instanceId,
  222. variables:JSON.stringify({
  223. comment:that.data.comment == '' ? '驳回':that.data.comment,
  224. pass:false,
  225. }),
  226. method:'POST'
  227. };
  228. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  229. success: (res) => {
  230. console.log(res);
  231. if (res.code == API.SUCCESS_CODE) {
  232. wx.showToast({
  233. title: '审批成功',
  234. icon: 'success',
  235. duration: 2000,
  236. complete(){
  237. setTimeout(function(){
  238. that.back();
  239. },2000)
  240. }
  241. })
  242. }else{
  243. wx.showToast({
  244. title: '操作失败',
  245. icon: 'error',
  246. duration: 2000
  247. })
  248. }
  249. }
  250. })
  251. },
  252. goAgree(){
  253. var that = this ;
  254. let data = {
  255. taskId:that.data.taskId,
  256. instanceId:that.data.instanceId,
  257. variables:JSON.stringify({
  258. "comment":that.data.comment == '' ? '同意':that.data.comment,
  259. "pass":true,
  260. }),
  261. method:'POST'
  262. };
  263. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  264. success: (res) => {
  265. console.log(res);
  266. if (res.code == API.SUCCESS_CODE) {
  267. wx.showToast({
  268. title: '审批成功',
  269. icon: 'success',
  270. duration: 2000,
  271. complete(){
  272. setTimeout(function(){
  273. that.back();
  274. },2000)
  275. }
  276. })
  277. }else{
  278. wx.showToast({
  279. title: '操作失败',
  280. icon: 'error',
  281. duration: 2000
  282. })
  283. }
  284. }
  285. })
  286. },
  287. commentInput(e){
  288. console.log(e);
  289. var that = this;
  290. that.setData({
  291. comment:e.detail.value
  292. })
  293. },
  294. /**
  295. * 生命周期函数--监听页面初次渲染完成
  296. */
  297. onReady: function () {
  298. },
  299. /**
  300. * 生命周期函数--监听页面显示
  301. */
  302. onShow: function () {
  303. },
  304. back:function(){
  305. wx.navigateBack({
  306. delta: 1
  307. })
  308. },
  309. /**
  310. * 生命周期函数--监听页面隐藏
  311. */
  312. onHide: function () {
  313. },
  314. /**
  315. * 生命周期函数--监听页面卸载
  316. */
  317. onUnload: function () {
  318. },
  319. /**
  320. * 页面相关事件处理函数--监听用户下拉动作
  321. */
  322. onPullDownRefresh: function () {
  323. },
  324. /**
  325. * 页面上拉触底事件的处理函数
  326. */
  327. onReachBottom: function () {
  328. },
  329. /**
  330. * 用户点击右上角分享
  331. */
  332. onShareAppMessage: function () {
  333. }
  334. })