import { API } from './../../../utils/network/api'
const api = new API()
const app = getApp()
Page({
  data: {
    navbarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '我的银行卡', //导航栏 中间的标题
    },
    height: app.globalData.height, 
    banklist_empty: true,
    bank_card_id: "",
    bank_img_path: "",
    bank_name: "",
    bank_card_code_mask: "",
    static_host: api.getStaticHost()
  },
  onShow(){

    api.getDoctorBank().then(response => {
      if(response.data.bank_card_id){
        this.setData({
          banklist_empty: false,
          bank_card_code_mask: response.data.bank_card_code_mask,
          bank_card_id: response.data.bank_card_id,
          bank_img_path: response.data.bank_img_path,
          bank_name: response.data.bank_name
        })
      }
      
      this.setData({
        bank_card_id: response.data.bank_card_id,
        bank_img_path: response.data.bank_img_path,
        bank_name: response.data.bank_name,
        bank_card_code_mask: response.data.bank_card_code_mask
      })  
    }).catch(errors => {
      console.error(errors);
    })
  },
  go(e){
    console.log(e)
    let url = e.currentTarget.dataset.url;
    app.go(url+"?bank_card_id="+this.data.bank_card_id);
  }
  
})