<template>
  <div id="steps-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-steps :active="active" align-center finish-status="success">
          <el-step title="买家已申请仅退款"> </el-step>
          <el-step title="审核"> </el-step>
          <el-step title="售后结束"> </el-step>
        </el-steps>
        <el-col :span="24" style="text-align: center">
          <el-col v-if="active == '0'"> 买家已申请仅退款 </el-col>
          <el-col v-if="active == '1'" style="text-align: center; margin: 15px 0; font-size: 18px">
            <el-form :model="form" ref="form" label-width="100px">
              <el-form-item label="退款金额" prop="money">
                <el-input v-model="form.money" placeholder="请输入退款金额" size="small" type="Number" @input="toMoney"></el-input>
                <p class="p1">
                  用于部分退款，退款金额不得超过<span>{{ info.money || '退款最大金额' }}元</span>
                </p>
              </el-form-item>
              <el-form-item>
                <el-col>
                  <el-button type="primary" @click="exam('1')">同意售后，处理退款</el-button>
                  <el-button type="primary" @click="exam('!1')">拒绝</el-button>
                </el-col>
              </el-form-item>
            </el-form>
          </el-col>
          <el-col v-if="active == 3">
            <el-col style="text-align: center; margin: 15px 0"><i class="el-icon-success"></i></el-col>
            <el-col style="text-align: center; margin: 15px 0; font-size: 18px">已退款成功</el-col>
          </el-col>
          <el-col v-if="active == 4">
            <el-col style="text-align: center; margin: 15px 0"><i class="el-icon-error"></i></el-col>
            <el-col style="text-align: center; margin: 15px 0; font-size: 18px">已拒绝</el-col>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'steps-1',
  props: { active: { type: Number }, form: { type: Object }, info: { type: Object } },
  components: {},
  data: function () {
    return {
      status: '0',
    };
  },

  created() {},
  methods: {
    exam(status) {
      this.$emit('exam', status, this.form);
    },
    toMoney(val) {
      if (val > this.info.money) {
        this.$message.error('超过退款最大金额');
        this.$set(this.form, `money`, '');
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.p1 {
  span {
    color: red;
  }
}
.el-icon-success {
  font-size: 60px;
  color: green;
}
.el-icon-error {
  font-size: 60px;
  color: red;
}
</style>
