<template>
  <div>
    <el-card>
      手机号：<el-input v-model="repayCallbackParams.phoneNo" placeholder="请输入手机号" maxlength="11"></el-input>
      还款结果： <el-select v-model="repayCallbackParams.result" placeholder="请选择还款结果">
        <el-option v-for="item in repayResult" :key="item.value" :label="item.label" :value="item.value">
        </el-option>
      </el-select>
      <el-button type="primary" @click="doRepayCallback">开始回调</el-button>
    </el-card>
  </div>
</template>

<script>
import { vccRepayCallback } from '@/api/genVccData'
export default {
  data() {
    return {
      repayCallbackParams: {
        namespace: window.sessionStorage.getItem('env'),
        phoneNo: '',
        result: ''
      },
      repayResult: [{ label: '还款成功', value: 1 }, { label: '还款失败', value: 2 }]
    }
  },
  methods: {
    // 还款回调
    doRepayCallback() {
      vccRepayCallback(this.repayCallbackParams).then((resp) => {
        if (resp.data.data.content === 'SUCCESS') {
          return this.$message.success('还款通知回调成功！')
        } else {
          return this.$message.error('还款通知回调失败！')
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.el-input {
  width: 200px;
  margin-right: 20px;
}
.el-select {
  margin-right: 20px;
}
</style>
