|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- // pages/payee/index.js
- import * as UTIL from '../../utils/util.js';
- import * as API from '../../utils/API.js';
- const app = getApp();
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- isIPX: app.globalData.isIPX,
- list: {},
- result: "",
- bankTypeOptions:[]
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- console.log(options)
- var that = this;
- that.setData({
- isPeers:options.isPeers,//是否同行
- bankType:options.bankType,//所属银行
- accountType:options.accountType,//账户类型
- payeeType:options.transferType,//申请转帐类型
- index:options.index
- })
- },
- goAdd(){
- wx.navigateTo({
- url: 'add/add',
- })
- },
- goSearch(e){
- var that = this;
- // 获取收款账号列表
- let prames = {
- pageNum:1,
- pageSize:999,
- orderByColumn:'id',
- isAsc:'asc',
- isPeers:that.data.isPeers,//是否同行
- bankType:that.data.bankType,//所属银行
- accountType:that.data.accountType,//账户类型
- payeeType:that.data.payeeType,//申请转帐类型
- status:'0',
- name:e.detail,
- method:'GET'
- }
- console.log(prames);
- UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
- success: (res) => {
- that.setData({
- bankTypeOptions:res.data,
- })
- }
- })
- UTIL.httpRequest(API.URL_GET_PAYEESELECTLIST , prames, {
- success: (res) => {
- let array = res.rows ;
- for (let i = 0; i < array.length; i++) {
- array[i].payeeAccountText = array[i].payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
- array[i].bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == array[i].bankType; }))[0].dictLabel;
- }
- that.setData({
- list:array,
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- var that = this;
- setTimeout(function(){
- // 获取收款账号列表
- let prames = {
- pageNum:1,
- pageSize:999,
- orderByColumn:'id',
- isAsc:'asc',
- isPeers:that.data.isPeers,//是否同行
- bankType:that.data.bankType,//所属银行
- accountType:that.data.accountType,//账户类型
- payeeType:that.data.payeeType,//申请转帐类型
- status:'0',
- method:'GET'
- }
- console.log(prames);
- UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
- success: (res) => {
- that.setData({
- bankTypeOptions:res.data,
- })
- }
- })
- UTIL.httpRequest(API.URL_GET_SELECTLIST , prames, {
- success: (res) => {
- let array = res.rows ;
- for (let i = 0; i < array.length; i++) {
- array[i].payeeAccountText = array[i].payeeAccount.replace(/^(.{6})(?:\d+)(.{4})$/,"\$1****\$2");
- array[i].bankTypeText = (that.data.bankTypeOptions.filter(function (e) { return e.dictValue == array[i].bankType; }))[0].dictLabel;
- }
- that.setData({
- list:array,
- })
- }
- })
- },1000)
- },
- onChange(event) {
- console.log(event);
- this.setData({
- result: event.detail,
- });
- },
-
- toggle(event) {
- const { index } = event.currentTarget.dataset;
- const checkbox = this.selectComponent(`.checkboxes-${index}`);
- checkbox.toggle();
- },
- back:function(){
- wx.navigateBack({
- delta: 1
- })
- },
- noop() {},
- goSubmit(){
- var that = this;
- if(that.data.result == ''){
- UTIL.showToastNoneIcon('请选择一个收款人!');
- return;
- }
- let array = that.data.list.filter(function (e) { return e.id == that.data.result; });
- console.log(array);
- let pages = getCurrentPages();
- let currentPage = null; //当前页面
- let prevPage = null; //上一个页面
- currentPage = pages[pages.length - 1]; //获取当前页面,将其赋值
- prevPage = pages[pages.length - 2]; //获取上一个页面,将其赋值
- if (prevPage) {
- prevPage.setData({
- ["form.transfers["+that.data.index+"].payeeList[0]"]: array[0]//将想要传的信息赋值给上一个页面data中的值
- })
- that.back()
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
- })
|