<template>
  <div class="pop" v-loading.body.fullscreen="fullscreenLoading" element-loading-background="rgba(255, 255, 255, 0)">
    <div class="line-box flex">
      <div class="line"></div>
    </div>
    <div class="sub">
      <!-- 收款人货币 -->
      {{ title || $t('fund.l7') }}
    </div>
    <div class="item flex" :class="{active: currency == li.symbol}" v-for="li in list" :key="li.id" @click="selectPay(li)">
      <div>
        {{ li.symbol }}
      </div>
      <img v-if="currency == li.symbol" class="check" src="/img/user/check.png" alt="极度证券">
    </div>
  </div>
</template>
<script>
import { getCurrencyList } from "@/api/product";
export default {
  props: {
    currency: {
      default: ''
    },
    type: {
      default: ''
    },
    pay: {
      default: ''
    },
    title: {
      default: ''
    }
  },
  data () {
    return {
      list: []
    }
  },
  created () {
    this.getCurrencyList()
  },
  methods: {
    getCurrencyList() {
      this.fullscreenLoading = true
      getCurrencyList({
        type: this.type,
        pay: this.pay
      }).then(res => {
        var list = res.list || []
        this.list = list.sort((a, b) => (a.symbol+'').localeCompare(b.symbol+''))
      }).catch(() => {}).finally(() => {
        this.fullscreenLoading = false
      })
    },
    selectPay(item) {
      this.$emit('success', item)
    },
    cancel() {
      this.$emit('cancel')
    }
  }
}
</script>
<style lang="less" scoped>
.pop {
  padding: 11px 11px 56px;
}
.line-box {
  justify-content: center;
  margin-bottom: 28px;
  .line {
    width: 36px;
    height: 4px;
    background: #E7E7E7;
    border-radius: 2px;
  }
}
.sub {
  font-weight: 500;
  color: #000000;
  font-size: 16px;
  padding-bottom: 18px;
  padding-left: 8px;
}
.item {
  cursor: pointer;
  justify-content: space-between;
  margin-top: 6px;
  height: 50px;
  font-size: 15px;
  color: #000000;
  padding: 0 20px;
  &.active {
    border-radius: 6px;
    border: 1px solid #858585;
  }
  .check {
    width: 13px;
  }
}
</style>