Component({
  props: {
    show: true,
    balance: false,
    // 是否显示余额
    onChange: () => null,
    onClose: () => null,
    defaultList: null
  },
  data: {
    list: [{
      balance: 134.54,
      cardNum: 'A001129002838122'
    }, {
      balance: 234.54,
      cardNum: 'A001129002838122'
    }, {
      balance: 334.54,
      cardNum: 'A001129002838122'
    }, {
      balance: 434.54,
      cardNum: 'A001129002838122'
    }]
  },

  didMount() {},

  didUpdate() {
    if (this.props.defaultList) {
      this.setData({
        list: this.props.defaultList
      });
    }
  },

  methods: {
    onClosePopup() {
      this.props.onClose();
    },

    onTap(e) {
      const {
        item
      } = e.target.dataset;
      this.onClosePopup();
      this.props.onChange(item);
    },

    onOpenPopup() {
      this.setData({
        show: true
      });
    }

  }
});