<template>
  <div class="com">
    <div class="title">
      <!-- 汇款凭证 -->
      {{ $t('fund.l81') }}
    </div>
    <el-upload class="avatar-uploader" :action="$uploadUrl" :show-file-list="false" :on-success="handleAvatarSuccess">
      <van-image width="88px" height="88px" fit="contain" :src="file">
        <template v-slot:error>
          <van-icon name="plus" />
        </template>
      </van-image>
    </el-upload>
  </div>
</template>
<script>
export default {
  data () {
    return {
      file: '',
    }
  },
  methods: {
    submit() {
      if (!this.file) {
        // this.$toast('请上传汇款凭证');
        this.$toast(this.$t('fund.l82'));
        return false
      }
      return JSON.stringify({
        file: this.file
      })
    },
    handleAvatarSuccess(data) {
      if (data.msg != 'ok') {
        // 上传失败
        this.$toast(data.msg || this.$t('fund.l83'));
        return
      }
      this.file = data.data
    },
  }
}
</script>
<style lang="less" scoped>
.com {
  border-radius: 6px;
  border: 1px solid #E6E6E6;
  padding: 18px 11px 17px;
}
.title {
  font-size: 16px;
  color: #000000;
  margin-bottom: 17px;
}
.label {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--color-1-);
}
::v-deep {
  .el-input__inner {
    border: none;
    background-color: #F4F8F9;
    border-radius: 6px;
    height: 38px;
    line-height: 38px;
    padding: 0 12px;
  }
}
</style>