微信小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

502 řádky
12 KiB

  1. // pages/regular/index.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. option1: [],
  13. option2: [],
  14. option3: [],
  15. value1: '',
  16. value2: '',
  17. value3: '',
  18. showPopup:false,
  19. result1:'',
  20. result2:'',
  21. result3:'',
  22. beginApplyDate:'' , //申请开始时间
  23. endApplyDate: '' , //申请结束时间
  24. txnamtMin: '' , //金额范围 最小
  25. xnamtMax: '' , //金额范围最大
  26. showDialog:false,
  27. beforeClose(action) {
  28. return new Promise((resolve) => {
  29. setTimeout(() => {
  30. if (action === 'confirm') {
  31. // 拦截确认操作
  32. resolve(false);
  33. } else {
  34. resolve(true);
  35. }
  36. }, 0);
  37. });
  38. },
  39. projectId:'',
  40. projectValue:''
  41. },
  42. /**
  43. * 生命周期函数--监听页面加载
  44. */
  45. onLoad(options) {
  46. var that = this;
  47. // 对账状态字典查询
  48. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'check_status', {method:'GET'}, {
  49. success: (res) => {
  50. that.setData({
  51. checkStatusOptions:res.data,
  52. })
  53. }
  54. })
  55. // 业务类型字典查询
  56. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'trans_type', {method:'GET'}, {
  57. success: (res) => {
  58. let option2 = [{
  59. text: '业务类型', value: ''
  60. }];
  61. res.data.map(rr=>{
  62. option2.push({
  63. text: rr.dictLabel, value: rr.dictValue
  64. })
  65. })
  66. that.setData({
  67. option2:option2,
  68. transTypeOptions:res.data,
  69. })
  70. }
  71. })
  72. // 来往账标识字典查询
  73. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'direction', {method:'GET'}, {
  74. success: (res) => {
  75. let option3 = [];
  76. res.data.map(rr=>{
  77. option3.push({
  78. text: rr.dictLabel, value: rr.dictValue
  79. })
  80. })
  81. option3[0].text = '来往账标识';
  82. that.setData({
  83. option3:option3,
  84. value3:res.data[0].dictValue,
  85. result3:res.data[0].dictValue,
  86. directionOptions:res.data,
  87. })
  88. }
  89. })
  90. var sendData = {
  91. pageNum:'1',
  92. pageSize:'100',
  93. accountName:'',
  94. bankAccountNumber:'',
  95. status:'N',
  96. method:'GET',
  97. accountType:102
  98. }
  99. UTIL.httpRequest(API.URL_GET_ACCOUNTLIST, sendData,{
  100. success: (res) => {
  101. console.log(res.rows)
  102. let option1 = [];
  103. res.rows.map(rr=>{
  104. console.log(rr);
  105. option1.push({
  106. text: rr.accountName, value: rr.bankAccountNumber
  107. })
  108. })
  109. that.setData({
  110. option1:option1,
  111. value1:res.rows[0].bankAccountNumber,
  112. result1:res.rows[0].bankAccountNumber,
  113. accountList:res.rows
  114. })
  115. let perames = {method:'POST',actacn:res.rows[0].bankAccountNumber}
  116. //转账列表
  117. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , perames, {
  118. success: (res) => {
  119. res.rows.map(rrr=>{
  120. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  121. })
  122. that.setData({
  123. list:res.rows
  124. })
  125. }
  126. })
  127. }
  128. })
  129. },
  130. goSearch(e){
  131. var that = this;
  132. console.log(e);
  133. let form = {
  134. actacn:that.data.result1 , //付款账户
  135. transtype:that.data.result2 ,// 业务类型 数据字典:trans_type
  136. direction:that.data.result3 ,// 来往账标识 数据字典:direction
  137. queryKey:e.detail,
  138. method:'POST',
  139. }
  140. console.log(form);
  141. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , form, {
  142. success: (res) => {
  143. res.rows.map(rrr=>{
  144. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  145. })
  146. that.setData({
  147. list:res.rows,
  148. showPopup:false
  149. })
  150. }
  151. })
  152. },
  153. goSubmit(){
  154. var that = this ;
  155. let form = {
  156. actacn:that.data.result1 , //付款账户
  157. payeeActacn: '' , //收款账号
  158. payeeToname:'' , //收款人
  159. transtype:that.data.result2 ,// 业务类型 数据字典:trans_type
  160. direction:that.data.result3 ,// 来往账标识 数据字典:direction
  161. params:{
  162. beginApplyDate:that.data.beginApplyDate,
  163. endApplyDate:that.data.endApplyDate,
  164. txnamtMin:that.data.txnamtMin,
  165. xnamtMax:that.data.xnamtMax,
  166. },
  167. method:'POST',
  168. }
  169. console.log(form);
  170. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , form, {
  171. success: (res) => {
  172. res.rows.map(rrr=>{
  173. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  174. })
  175. that.setData({
  176. value1:that.data.result1,
  177. value2:that.data.result2,
  178. value3:that.data.result3,
  179. list:res.rows,
  180. showPopup:false
  181. })
  182. }
  183. })
  184. },
  185. bindDateBeginChange: function(e) {
  186. console.log('picker发送选择改变,携带值为', e.detail.value)
  187. this.setData({
  188. beginApplyDate: e.detail.value
  189. })
  190. },
  191. bindDateEndChange: function(e) {
  192. console.log('picker发送选择改变,携带值为', e.detail.value)
  193. this.setData({
  194. endApplyDate: e.detail.value
  195. })
  196. },
  197. reset(){
  198. this.setData({
  199. result2:'',
  200. txnamtMin:'',
  201. xnamtMax:'',
  202. beginApplyDate:'',
  203. endApplyDate:''
  204. })
  205. this.onLoad();
  206. },
  207. back:function(){
  208. wx.navigateBack({
  209. delta: 1
  210. })
  211. },
  212. showPopup(){
  213. var that = this;
  214. that.setData({
  215. showPopup:true
  216. })
  217. },
  218. onClose() {
  219. this.setData({ showPopup: false });
  220. },
  221. onChangeZH(event) {
  222. console.log(event.detail);
  223. this.setData({
  224. result1: event.detail,
  225. });
  226. },
  227. onChangeLX(event) {
  228. console.log(event.detail);
  229. this.setData({
  230. result2: event.detail,
  231. });
  232. },
  233. onChangeBS(event) {
  234. console.log(event.detail);
  235. this.setData({
  236. result3: event.detail,
  237. });
  238. },
  239. changeTab1(event){
  240. this.setData({
  241. result1: event.detail,
  242. value1: event.detail
  243. });
  244. var that = this ;
  245. let form = {
  246. actacn:that.data.result1 , //付款账户
  247. transtype:that.data.result2 ,// 业务类型 数据字典:trans_type
  248. direction:that.data.result3 ,// 来往账标识 数据字典:direction
  249. method:'POST',
  250. }
  251. console.log(form);
  252. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , form, {
  253. success: (res) => {
  254. res.rows.map(rrr=>{
  255. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  256. })
  257. that.setData({
  258. list:res.rows,
  259. showPopup:false
  260. })
  261. }
  262. })
  263. },
  264. changeTab2(event){
  265. this.setData({
  266. result2: event.detail,
  267. value2: event.detail
  268. });
  269. var that = this ;
  270. let form = {
  271. actacn:that.data.result1 , //付款账户
  272. transtype:that.data.result2 ,// 业务类型 数据字典:trans_type
  273. direction:that.data.result3 ,// 来往账标识 数据字典:direction
  274. method:'POST',
  275. }
  276. console.log(form);
  277. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , form, {
  278. success: (res) => {
  279. res.rows.map(rrr=>{
  280. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  281. })
  282. that.setData({
  283. list:res.rows,
  284. showPopup:false
  285. })
  286. }
  287. })
  288. },
  289. changeTab3(event){
  290. this.setData({
  291. result3: event.detail,
  292. value3: event.detail
  293. });
  294. var that = this ;
  295. let form = {
  296. actacn:that.data.result1 , //付款账户
  297. transtype:that.data.result2 ,// 业务类型 数据字典:trans_type
  298. direction:that.data.result3 ,// 来往账标识 数据字典:direction
  299. method:'POST',
  300. }
  301. console.log(form);
  302. UTIL.httpRequest(API.URL_GET_GETRECONCILIATIONMOBILE , form, {
  303. success: (res) => {
  304. res.rows.map(rrr=>{
  305. rrr.checkStatusText = UTIL.getTransform(rrr.checkStatus,that.data.checkStatusOptions);
  306. })
  307. that.setData({
  308. list:res.rows,
  309. showPopup:false
  310. })
  311. }
  312. })
  313. },
  314. minInput(e){
  315. var that = this ;
  316. that.setData({
  317. txnamtMin: e.detail.value, //金额范围 最小
  318. })
  319. },
  320. maxInput(e){
  321. var that = this ;
  322. that.setData({
  323. xnamtMax: e.detail.value, //金额范围最大
  324. })
  325. },
  326. openDZ(e){
  327. var that = this;
  328. that.setData({
  329. projectId:'',
  330. projectValue:''
  331. })
  332. var id = e.currentTarget.dataset.id;
  333. that.setData({
  334. showDialog:true,
  335. projectId:id
  336. })
  337. },
  338. goDZ(e){
  339. var that = this ;
  340. var form = {
  341. manualRemark:that.data.projectValue,
  342. id:that.data.projectId,
  343. method:'POST'
  344. }
  345. console.log(form);
  346. UTIL.httpRequest(API.URL_GET_GETTRANSFEREDIT , form, {
  347. success: (res) => {
  348. that.setData({
  349. showDialog:false
  350. })
  351. wx.showToast({
  352. title: '保存成功',
  353. icon: 'success',
  354. duration: 2000,
  355. })
  356. }
  357. })
  358. },
  359. bindNameInput(e){
  360. var that = this;
  361. var value = e.detail.value;
  362. that.setData({
  363. projectValue:value
  364. })
  365. },
  366. toPayDetail(e){
  367. wx.navigateTo({
  368. url: '/pages/pay/detail?id='+e.currentTarget.dataset.id+'&&ids='+e.currentTarget.dataset.ids,
  369. })
  370. },
  371. goMX(e){
  372. var id = e.currentTarget.dataset.id;
  373. if (id == null) {
  374. UTIL.showToastNoneIcon('暂无交易明细!');
  375. return;
  376. }
  377. wx.navigateTo({
  378. url: '/pages/transaction/transactionDetail/transactionDetail?id='+id,
  379. })
  380. },
  381. goHD(e){
  382. let url = e.currentTarget.dataset.url;
  383. let alternateField1 = e.currentTarget.dataset.field1;
  384. let alternateField4 = e.currentTarget.dataset.field4;
  385. let alternateField9 = e.currentTarget.dataset.field9;
  386. let id = e.currentTarget.dataset.id;
  387. console.log(alternateField1);
  388. console.log(alternateField4);
  389. console.log(alternateField9);
  390. if (alternateField1=='3') {
  391. if (url==null) {
  392. UTIL.httpRequest(API.URL_GET_GETDIANZIHUIDAN1 + id , {method:'GET'}, {
  393. success: (res) => {
  394. console.log(res);
  395. url = res.data.alternateField2;
  396. wx.navigateTo({
  397. url: 'receipt/receipt?url='+url,
  398. })
  399. }
  400. })
  401. }else if(url.indexOf('失败')>-1){
  402. UTIL.showToastNoneIcon(url);
  403. }else{
  404. wx.navigateTo({
  405. url: 'receipt/receipt?url='+url,
  406. })
  407. }
  408. }
  409. if (alternateField4!=null) {
  410. if (url==null) {
  411. UTIL.httpRequest(API.URL_GET_GETDIANZIHUIDAN2 + id , {method:'GET'}, {
  412. success: (res) => {
  413. console.log(res);
  414. url = res.data.alternateField2;
  415. wx.navigateTo({
  416. url: 'receipt/receipt?url='+url,
  417. })
  418. }
  419. })
  420. }else if(url.indexOf('失败')>-1){
  421. UTIL.showToastNoneIcon(url);
  422. }else{
  423. wx.navigateTo({
  424. url: 'receipt/receipt?url='+url,
  425. })
  426. }
  427. }
  428. if (alternateField1=='2' && alternateField9!='' && alternateField9!=null) {
  429. if (url==null) {
  430. UTIL.httpRequest(API.URL_GET_GETDIANZIHUIDAN3 + id , {method:'GET'}, {
  431. success: (res) => {
  432. console.log(res);
  433. url = res.data.alternateField2;
  434. wx.navigateTo({
  435. url: 'receipt/receipt?url='+url,
  436. })
  437. }
  438. })
  439. }else if(url.indexOf('失败')>-1){
  440. UTIL.showToastNoneIcon(url);
  441. }else{
  442. wx.navigateTo({
  443. url: 'receipt/receipt?url='+url,
  444. })
  445. }
  446. }
  447. },
  448. /**
  449. * 生命周期函数--监听页面初次渲染完成
  450. */
  451. onReady() {
  452. },
  453. /**
  454. * 生命周期函数--监听页面显示
  455. */
  456. onShow() {
  457. },
  458. /**
  459. * 生命周期函数--监听页面隐藏
  460. */
  461. onHide() {
  462. },
  463. /**
  464. * 生命周期函数--监听页面卸载
  465. */
  466. onUnload() {
  467. },
  468. /**
  469. * 页面相关事件处理函数--监听用户下拉动作
  470. */
  471. onPullDownRefresh() {
  472. },
  473. /**
  474. * 页面上拉触底事件的处理函数
  475. */
  476. onReachBottom() {
  477. },
  478. /**
  479. * 用户点击右上角分享
  480. */
  481. onShareAppMessage() {
  482. }
  483. })