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

371 righe
10 KiB

  1. // pages/apply/paymentTemplate/add/add.js
  2. import * as UTIL from '../../../../utils/util.js';
  3. import * as API from '../../../../utils/API.js';
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isIPX: app.globalData.isIPX,
  11. radio:'1',
  12. active:0,
  13. projectText:'',
  14. balance:0,
  15. showCapitalExpenditureType:false,
  16. showApplyDate:false,
  17. showTransferType:false,
  18. showProject:false,
  19. showProjectFundType:false,
  20. showAccount:false,
  21. capitalExpenditureTypeOptions:[],
  22. transferTypeOptions:[],
  23. projectOptions:[],
  24. projectFundTypeOptions:[],
  25. contractionOptions:[],
  26. accountOptions:[],
  27. form:{
  28. approvalItemTemplate:{
  29. approvalItems:'',//审批事项
  30. submitCompany:'',//提交单位
  31. submitDate:'',//提交日期
  32. submitter:'',//提交人
  33. telephone:'',//联系方式
  34. totalAmount:'',//合计金额
  35. templateName:'',//模板名称 选择保存模板的时候添加
  36. dataType:'',//数据类型
  37. transfers:[{//事项信息集合以下是List对象信息
  38. capitalExpenditureType:'',//资金支出类别
  39. capitalExpenditureTypeText:'',//资金支出类别(展示用)
  40. succeedAmount:'',//成功支付金额
  41. payer:'',//付款方
  42. payerAccount:'',//付款方账户
  43. bankType:'',//所属银行
  44. bankTypeText:'',//所属银行(展示用)
  45. isPeers:'',//是否同行
  46. operatorCode:'',//操作员代码
  47. enterpriseCode:'',//企业编码
  48. expenditureAmount:'',//支出总金额
  49. applyDate:'',//申请时间
  50. transferStatus:'',//转账状态
  51. auditStatus:'',//审批状态
  52. paymentState:'',//支付状态
  53. approvalMode:'',//审批模式
  54. paymentTime:'',//支付时间
  55. bankPriority:'',//银行处理优先级
  56. clientPriority:'',//客户处理优先级
  57. transferType:'',//付款方式
  58. transferTypeText:'',//付款方式(展示用)
  59. requiredTransferTime:'',//要求转账时间
  60. remark:'',//付款事由
  61. startTime:'',//开票日期
  62. endTime:'',//到期日期
  63. orderType:'',//汇票类型
  64. bankAccountType:'',//账户类别
  65. villageAccountType:'',//账户分类
  66. }],
  67. bankAccountType:'1',//账户类别1 公户2私户
  68. payeeList:[{//收款方账户集合
  69. payeeId:'',//收款方id
  70. payee:'',//收款方
  71. bankDeposit:'',//开户行
  72. incomeAmount:'',//收入金额
  73. bankType:'',//所属银行0其他银行1中国银行2农商行(山东省)3农业银行4建设银行5工商银行
  74. payeeAccount:'',//收款账户
  75. }],
  76. }
  77. },
  78. projectForm:{
  79. projectId:'',
  80. projectName:'',
  81. projectContractor:'',
  82. projectAmount:'',
  83. projectBillNum:'',
  84. projectFundType:'',
  85. outId:'',
  86. ynType:'1',
  87. },
  88. contractionForm:{
  89. id:'',
  90. name:'',
  91. code:'',
  92. totalAmount:'',
  93. },
  94. accountForm:{}
  95. },
  96. /**
  97. * 生命周期函数--监听页面加载
  98. */
  99. onLoad(options) {
  100. },
  101. /**
  102. * 生命周期函数--监听页面初次渲染完成
  103. */
  104. onReady() {
  105. },
  106. /**
  107. * 生命周期函数--监听页面显示
  108. */
  109. onShow() {
  110. var that = this;
  111. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  112. success: (res) => {
  113. if (res.code == API.SUCCESS_CODE) {
  114. that.setData({
  115. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  116. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  117. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  118. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  119. })
  120. }
  121. }
  122. })
  123. // 资金支出类别字典查询
  124. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  125. success: (res) => {
  126. that.setData({
  127. capitalExpenditureTypeOptions:res.data,
  128. })
  129. }
  130. })
  131. // 付款方式类型字典查询
  132. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_type', {method:'GET'}, {
  133. success: (res) => {
  134. that.setData({
  135. transferTypeOptions:res.data,
  136. })
  137. }
  138. })
  139. // 项目工程列表
  140. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  141. success: (res) => {
  142. that.setData({
  143. projectOptions:res.rows,
  144. })
  145. }
  146. })
  147. // 工程款类型字典查询
  148. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  149. success: (res) => {
  150. that.setData({
  151. projectFundTypeOptions:res.data,
  152. })
  153. }
  154. })
  155. // 获取合同信息列表
  156. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET'}, {
  157. success: (res) => {
  158. that.setData({
  159. contractionOptions:res.rows,
  160. })
  161. }
  162. })
  163. // 获取合同信息列表
  164. let prames = {
  165. pageNum:1,
  166. pageSize:999,
  167. isPeers:'',
  168. orderByColumn:'id',
  169. isAsc:'asc',
  170. status:'0'
  171. }
  172. UTIL.httpRequest(API.URL_GET_SELECTLIST , {method:'GET'}, {
  173. success: (res) => {
  174. that.setData({
  175. contractionOptions:res.rows,
  176. })
  177. }
  178. })
  179. },
  180. openBox(even){
  181. this.setData({
  182. [even.currentTarget.dataset.name]:true
  183. })
  184. },
  185. closeBox(even){
  186. console.log(even.currentTarget.dataset.name);
  187. this.setData({
  188. [even.currentTarget.dataset.name]:false
  189. })
  190. },
  191. onConfirm(event) {
  192. this.setData({
  193. [event.currentTarget.dataset.name]: false,
  194. [event.currentTarget.dataset.value]: UTIL.formatDate(event.detail),
  195. });
  196. },
  197. onConfirmPick(event) {
  198. console.log(event);
  199. this.setData({
  200. [event.currentTarget.dataset.name]: false,
  201. [event.currentTarget.dataset.value]: event.detail.value.dictValue,
  202. [event.currentTarget.dataset.value+'Text']: event.detail.value.dictLabel,
  203. });
  204. },
  205. onConfirmAccount(event) {
  206. console.log(event);
  207. var that = this;
  208. // 所属银行字典查询
  209. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  210. success: (res) => {
  211. let array = res.data.filter(function (e) { return e.dictValue == event.detail.value.bankType; });
  212. this.setData({
  213. [event.currentTarget.dataset.name]: false,
  214. [event.currentTarget.dataset.value+'.payer']: event.detail.value.accountName,
  215. [event.currentTarget.dataset.value+'.payerAccount']: event.detail.value.bankAccountNumber,
  216. [event.currentTarget.dataset.value+'.bankTypeText']: array[0].dictLabel,
  217. [event.currentTarget.dataset.value+'.bankType']: event.detail.value.bankType,
  218. balance:event.detail.value.balance,
  219. });
  220. }
  221. })
  222. },
  223. onConfirmaTransfer(event) {
  224. console.log(event);
  225. var that = this;
  226. let perames = {};
  227. this.setData({
  228. [event.currentTarget.dataset.value+'.payer']: '',
  229. [event.currentTarget.dataset.value+'.payerAccount']: '',
  230. [event.currentTarget.dataset.value+'.bankTypeText']: '',
  231. [event.currentTarget.dataset.value+'.bankType']: '',
  232. balance:0,
  233. });
  234. if(event.detail.value.dictValue == 1){//村账户查询参数
  235. perames = {
  236. pageNum:1,
  237. pageSize:999,
  238. accountType:'102',
  239. method:'post',
  240.   params: {
  241.          "townAccountType":"0"
  242.     }
  243. }
  244. // 付款方列表
  245. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  246. success: (res) => {
  247. that.setData({
  248. accountOptions:res.rows,
  249. })
  250. }
  251. })
  252. }
  253. if(event.detail.value.dictValue == 2 || event.detail.value.dictValue == 10){//公务卡和现金提现查询参数
  254. perames = {
  255. pageNum:1,
  256. pageSize:999,
  257. accountType:'102',
  258. method:'GET',
  259. villageAccountType:''
  260. }
  261. // 付款方列表
  262. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  263. success: (res) => {
  264. that.setData({
  265. accountOptions:res.rows,
  266. })
  267. }
  268. })
  269. }
  270. if(event.detail.value.dictValue == 11){//现金使用查询参数
  271. perames = {
  272. pageNum:1,
  273. pageSize:999,
  274. accountType:'101',
  275. method:'GET'
  276. }
  277. // 付款方列表
  278. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  279. success: (res) => {
  280. that.setData({
  281. accountOptions:res.rows
  282. })
  283. }
  284. })
  285. }
  286. if(event.detail.value.dictValue == 4){//代管账户查询参数
  287. perames = {
  288. pageNum:1,
  289. pageSize:999,
  290. accountType:'102',
  291. method:'GET',
  292. villageAccountType:'1'
  293. }
  294. // 付款方列表
  295. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , perames, {
  296. success: (res) => {
  297. that.setData({
  298. accountOptions:res.rows,
  299. })
  300. }
  301. })
  302. }
  303. this.setData({
  304. [event.currentTarget.dataset.name]: false,
  305. [event.currentTarget.dataset.value+'.transferType']: event.detail.value.dictValue,
  306. [event.currentTarget.dataset.value+'.transferTypeText']: event.detail.value.dictLabel,
  307. });
  308. },
  309. onConfirmProject(event) {
  310. console.log(event);
  311. this.setData({
  312. [event.currentTarget.dataset.name]: false,
  313. [event.currentTarget.dataset.value]: event.detail.value.projectName,
  314. ['projectForm.projectId']: event.detail.value.id,
  315. ['projectForm.projectContractor']: event.detail.value.projectContractor,
  316. ['projectForm.projectAmount']: event.detail.value.projectAmount,
  317. });
  318. },
  319. onConfirmContraction(event) {
  320. console.log(event);
  321. this.setData({
  322. [event.currentTarget.dataset.name]: false,
  323. [event.currentTarget.dataset.value]: event.detail.value.name,
  324. ['contractionForm.code']: event.detail.value.code,
  325. ['contractionForm.totalAmount']: event.detail.value.totalAmount,
  326. ['contractionForm.id']: event.detail.value.id,
  327. });
  328. },
  329. /**
  330. * 生命周期函数--监听页面隐藏
  331. */
  332. onHide() {
  333. },
  334. /**
  335. * 生命周期函数--监听页面卸载
  336. */
  337. onUnload() {
  338. },
  339. /**
  340. * 页面相关事件处理函数--监听用户下拉动作
  341. */
  342. onPullDownRefresh() {
  343. },
  344. /**
  345. * 页面上拉触底事件的处理函数
  346. */
  347. onReachBottom() {
  348. },
  349. /**
  350. * 用户点击右上角分享
  351. */
  352. onShareAppMessage() {
  353. }
  354. })