<template>
  <div>
    <el-dialog
      title="提现申请"
      :visible.sync="dialogShow"
      width="800px"
      :before-close="close"
    >
      <el-form label-width="130px">
        <div class="form-flex">
          <el-form-item label="渠道/门店名称：">
            <span>{{ info.name || "--" }}</span>
          </el-form-item>
          <el-form-item label="手机号码：">
            <span>{{ info.mobile || "--" }}</span>
          </el-form-item>
        </div>
        <div class="form-flex">
          <el-form-item label="渠道类型：">
            <span>{{ info.level == 0 ? "门店" : "渠道" }}</span>
          </el-form-item>
          <el-form-item label="提现状态：">
            <span>{{ JSON.parse(info.status).desc || "--" }}</span>
          </el-form-item>
        </div>
        <div class="form-flex">
          <el-form-item label="申请时间：">
            <span>{{ parseTime(info.createTime) || "--" }}</span>
          </el-form-item>
          <el-form-item label="处理时间：">
            <span>{{ parseTime(info.transferTime) || "--" }}</span>
          </el-form-item>
        </div>
        <div class="form-flex">
          <el-form-item label="提现金额：">
            <span>￥{{ $numberFormat(info.money) || "--" }}</span>
          </el-form-item>
          <el-form-item label="银行卡号：">
            <span>{{ info.cardNo || "--" }}</span>
          </el-form-item>
        </div>
        <div class="form-flex">
          <el-form-item label="持卡人：">
            <span>{{ info.userName || "--" }}</span>
          </el-form-item>
          <el-form-item label="银行：">
            <span>{{ info.bankName || "--" }}</span>
          </el-form-item>
        </div>
        <div class="form-flex">
          <el-form-item label="开户行：">
            <span>{{ info.branchName || "--" }}</span>
          </el-form-item>
        </div>
      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
        v-if="JSON.parse(info.status).value == 1"
      >
        <el-button :disabled="loading" @click="toWithdrawal(3)"
          >提现失败</el-button
        >
        <el-button type="primary" :disabled="loading" @click="toWithdrawal(2)"
          >提现成功</el-button
        >
      </div>
      <div slot="footer" class="dialog-footer" v-else>
        <el-button @click="close">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { withdrawVerify } from "@/api/finance/withdraw";
export default {
  props: {
    // 弹框显示
    dialogShow: {
      type: Boolean,
      default: false,
    },
    // 提现id
    info: {
      type: Object,
      default: {},
    },
  },
  mounted() {
    this.getDetail;
  },
  data() {
    return {
      loading: false,
    };
  },
  methods: {
    // 订单详情
    getDetail() {
      withdrawDetail({ id: this.detailId }).then((res) => {
        console.log("res", res);
      });
    },

    // 关闭弹框
    close() {
      this.$emit("close");
    },

    toWithdrawal(status) {
      this.loading = true;
      withdrawVerify({
        id: this.info.id,
        status,
        verifyContent: "",
      })
        .then((res) => {
          this.loading = false;
          if (res.code == 0) {
            if (status == 2) {
              this.msgSuccess("操作成功");
              this.close();
            } else {
              this.msgSuccess("操作成功");
              this.close();
            }
          }
        })
        .catch(() => {
          this.loading = false;
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.form-flex {
  padding: 0 50px;
  display: flex;
  align-items: center;
  // justify-content: space-between;
  span {
    display: inline-block;
    width: 200px;
  }
}
</style>
