const _Http = getApp().globalData.http;
Page({
  data: {
    "content": {
      nocache: true,
      pageNumber: 1,
      pageTotal: 1,
      "where": {
        "condition": "",
        "workaddress": 1
      }
    }
  },
  onLoad(options) {
    this.getList(true);
  },
  /* 获取产品 */
  getList(init = false) {
    if (init.detail != undefined) init = init.detail;
    let content = this.data.content;
    if (init) content.pageNumber = 1;
    if (content.pageNumber > content.pageTotal) return;
    _Http.basic({
      "id": "20221022165803",
      content
    }).then(res => {
      console.log("账户列表", res)
      this.selectComponent('#ListBox').RefreshToComplete();
      if (res.msg != '成功') return wx.showToast({
        title: res.msg,
        icon: "none",
        mask: true
      });
      content.pageNumber = res.pageNumber + 1;
      content.pageTotal = res.pageTotal;
      this.setData({
        list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
      })
    })
  },
  /* 单击卡号 */
  onClick({
    detail
  }) {
    if (getApp().globalData.handleSelect) return getApp().globalData.handleSelect(detail);
    wx.navigateTo({
      url: `/pages/bankAccount/update?item=${JSON.stringify(detail)}`,
    })
  },
  /* 开始搜索 */
  onSearch({
    detail
  }) {
    if (detail == this.data.content.where.condition) return;
    this.data.content.where.condition = detail;
    this.getList(true);
  },
  onClear(e) {
    this.data.content.where.condition = "";
    this.getList(true);
  },
  onReady() {
    this.selectComponent("#ListBox").setHeight(".top", this);
  },
  deleteItem() {
    _Http.basic({
      "id": "20221022165903",
      "content": {
        "sys_enterprise_bankids": [7]
      }
    })
  }
})