微信小程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

196 líneas
4.6 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. // 可优化:数据请求放到 onload中 新增后在子页面修改父页面数据
  21. var that = this;
  22. that.setData({
  23. index:options.index
  24. })
  25. var that = this;
  26. // 获取收款账号列表
  27. let prames = {
  28. pageNum:1,
  29. pageSize:999,
  30. orderByColumn:'id',
  31. isAsc:'desc',
  32. status:'0',
  33. method:'GET'
  34. }
  35. console.log(prames);
  36. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  37. success: (res) => {
  38. that.setData({
  39. bankTypeOptions:res.data,
  40. })
  41. }
  42. })
  43. UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, {
  44. success: (res) => {
  45. let array = res.rows ;
  46. var payeeType = that.data.payeeType;
  47. var list = [];
  48. array.map(res=>{
  49. res.payeeAccountText = res.payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
  50. console.log(that.data.bankTypeOptions);
  51. res.bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == res.bankType; }))[0].dictLabel;
  52. console.log(res);
  53. list.push(res)
  54. })
  55. that.setData({
  56. list:list,
  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. var payeeType = that.data.payeeType;
  94. var list = [];
  95. array.map(res=>{
  96. res.payeeAccountText = res.payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
  97. res.bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == res.bankType; }))[0].dictLabel;
  98. list.push(res)
  99. })
  100. that.setData({
  101. list:list,
  102. })
  103. }
  104. })
  105. },
  106. /**
  107. * 生命周期函数--监听页面初次渲染完成
  108. */
  109. onReady() {
  110. },
  111. /**
  112. * 生命周期函数--监听页面显示
  113. */
  114. onShow() {
  115. },
  116. onChange(event) {
  117. console.log(event);
  118. this.setData({
  119. result: event.detail,
  120. });
  121. },
  122. toggle(event) {
  123. const { index } = event.currentTarget.dataset;
  124. const checkbox = this.selectComponent(`.checkboxes-${index}`);
  125. checkbox.toggle();
  126. },
  127. back:function(){
  128. wx.navigateBack({
  129. delta: 1
  130. })
  131. },
  132. noop() {},
  133. goSubmit(){
  134. var that = this;
  135. if(that.data.result == ''){
  136. UTIL.showToastNoneIcon('请选择一个收款人!');
  137. return;
  138. }
  139. let array = that.data.list.filter(function (e) { return e.id == that.data.result; });
  140. array[0].incomeAmount = that.data.money;
  141. console.log(array);
  142. let pages = getCurrentPages();
  143. let currentPage = null; //当前页面
  144. let prevPage = null; //上一个页面
  145. currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
  146. prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
  147. if (prevPage) {
  148. prevPage.setData({
  149. ["form.transfers["+that.data.index+"].payeeList[0]"]: array[0]//将想要传的信息赋值给上一个页面data中的值
  150. })
  151. that.back()
  152. }
  153. },
  154. /**
  155. * 生命周期函数--监听页面隐藏
  156. */
  157. onHide() {
  158. },
  159. /**
  160. * 生命周期函数--监听页面卸载
  161. */
  162. onUnload() {
  163. },
  164. /**
  165. * 页面相关事件处理函数--监听用户下拉动作
  166. */
  167. onPullDownRefresh() {
  168. },
  169. /**
  170. * 页面上拉触底事件的处理函数
  171. */
  172. onReachBottom() {
  173. },
  174. /**
  175. * 用户点击右上角分享
  176. */
  177. onShareAppMessage() {
  178. }
  179. })