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

191 lines
4.5 KiB

  1. // pages/payee/index.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. list: {},
  12. result: "",
  13. bankTypeOptions:[]
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. console.log(options)
  20. var that = this;
  21. that.setData({
  22. isPeers:options.isPeers,//是否同行
  23. bankType:options.bankType,//所属银行
  24. accountType:options.accountType,//账户类型
  25. payeeType:options.transferType,//申请转帐类型
  26. })
  27. // 获取收款账号列表
  28. let prames = {
  29. pageNum:1,
  30. pageSize:999,
  31. orderByColumn:'id',
  32. isAsc:'asc',
  33. isPeers:options.isPeers,//是否同行
  34. bankType:options.bankType,//所属银行
  35. accountType:options.accountType,//账户类型
  36. payeeType:options.transferType,//申请转帐类型
  37. status:'0',
  38. method:'GET'
  39. }
  40. console.log(prames);
  41. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  42. success: (res) => {
  43. that.setData({
  44. bankTypeOptions:res.data,
  45. })
  46. }
  47. })
  48. UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, {
  49. success: (res) => {
  50. let array = res.rows ;
  51. for (let i = 0; i < array.length; i++) {
  52. array[i].payeeAccountText = array[i].payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
  53. array[i].bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == array[i].bankType; }))[0].dictLabel;
  54. }
  55. that.setData({
  56. list:array,
  57. })
  58. }
  59. })
  60. },
  61. goAdd(){
  62. wx.navigateTo({
  63. url: 'add/add',
  64. })
  65. },
  66. goSearch(e){
  67. var that = this;
  68. // 获取收款账号列表
  69. let prames = {
  70. pageNum:1,
  71. pageSize:999,
  72. orderByColumn:'id',
  73. isAsc:'asc',
  74. isPeers:that.data.isPeers,//是否同行
  75. bankType:that.data.bankType,//所属银行
  76. accountType:that.data.accountType,//账户类型
  77. payeeType:that.data.payeeType,//申请转帐类型
  78. status:'0',
  79. name:e.detail,
  80. method:'GET'
  81. }
  82. console.log(prames);
  83. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  84. success: (res) => {
  85. that.setData({
  86. bankTypeOptions:res.data,
  87. })
  88. }
  89. })
  90. UTIL.httpRequest(API.URL_GET_PAYEESELECTLIST , prames, {
  91. success: (res) => {
  92. let array = res.rows ;
  93. for (let i = 0; i < array.length; i++) {
  94. array[i].payeeAccountText = array[i].payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
  95. array[i].bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == array[i].bankType; }))[0].dictLabel;
  96. }
  97. that.setData({
  98. list:array,
  99. })
  100. }
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面初次渲染完成
  105. */
  106. onReady() {
  107. },
  108. /**
  109. * 生命周期函数--监听页面显示
  110. */
  111. onShow() {
  112. },
  113. onChange(event) {
  114. console.log(event);
  115. this.setData({
  116. result: event.detail,
  117. });
  118. },
  119. toggle(event) {
  120. const { index } = event.currentTarget.dataset;
  121. const checkbox = this.selectComponent(`.checkboxes-${index}`);
  122. checkbox.toggle();
  123. },
  124. back:function(){
  125. wx.navigateBack({
  126. delta: 1
  127. })
  128. },
  129. noop() {},
  130. goSubmit(){
  131. var that = this;
  132. if(that.data.result == ''){
  133. UTIL.showToastNoneIcon('请选择一个收款人!');
  134. return;
  135. }
  136. let array = that.data.list.filter(function (e) { return e.id == that.data.result; });
  137. console.log(array);
  138. let pages = getCurrentPages();
  139. let currentPage = null; //当前页面
  140. let prevPage = null; //上一个页面
  141. currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
  142. prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
  143. if (prevPage) {
  144. prevPage.setData({
  145. ["form.transfers[0].payeeList[0]"]: array[0]//将想要传的信息赋值给上一个页面data中的值
  146. })
  147. that.back()
  148. }
  149. },
  150. /**
  151. * 生命周期函数--监听页面隐藏
  152. */
  153. onHide() {
  154. },
  155. /**
  156. * 生命周期函数--监听页面卸载
  157. */
  158. onUnload() {
  159. },
  160. /**
  161. * 页面相关事件处理函数--监听用户下拉动作
  162. */
  163. onPullDownRefresh() {
  164. },
  165. /**
  166. * 页面上拉触底事件的处理函数
  167. */
  168. onReachBottom() {
  169. },
  170. /**
  171. * 用户点击右上角分享
  172. */
  173. onShareAppMessage() {
  174. }
  175. })