Page({
  data: {
    item: {},

    tabbarList: [{
      icon: "icon-bodadianhua",
      label: "呼叫",
      alias: "call"
    }, {
      icon: "icon-a-yingxiaowuliaofuzhi",
      label: "复制",
      alias: "copy"
    }, {
      icon: "icon-bianji",
      label: "编辑",
      alias: "edit"
    }, {
      icon: "icon-shanchu",
      label: "删除",
      alias: "delete"
    }]
  },
  onLoad(options) {
    console.log(options)
    if (options.data) {
      let item = JSON.parse(options.data);
      this.initList(item)
      this.setData({
        item
      })
    }
  },
  /* 初始化列表 */
  initList(item) {
    this.setData({
      list: [{
        label: "名称",
        value: item.enterprisename
      }, {
        label: "纳税人识别号",
        value: item.taxno
      }, {
        label: "地址",
        value: item.address
      }, {
        label: "开户行",
        value: item.bank
      }, {
        label: "账号",
        value: item.bankcardno
      }, {
        label: "联系人号码",
        value: item.phonenumber
      }],
    })
  },
  //详情按钮回调
  tabbarOnClick({
    detail
  }) {
    let pages = getCurrentPages();
    pages[pages.length - 2].selectComponent('#Financing').selectComponent('#List').handleItem({
      target: {
        dataset: {
          name: detail.alias,
          item: this.data.item
        }
      }
    });
  },
  //详情单元格单击复制
  clickItem({
    detail
  }) {
    wx.setClipboardData({
      data: detail.value,
      success: () => {
        wx.hideToast();
        wx.showToast({
          title: `已复制${detail.label}`,
          icon: "none"
        })
      }
    })
  },
})