<template>
  <div>
    <div class="sty">
      <el-page-header @back="goBack" content="审核"> </el-page-header>
    </div>
    <br />
    <br />
    <span>返利互转单</span>
    <el-divider></el-divider>
    <!-- 筛选条件 -->
    <div>
      <el-form label-width="100px" size="small" label-position="left">
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="返利互转单号" prop="">
              <el-input v-model="detailList.id" placeholder="请输入"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="单据日期" prop="">
              <el-input
                v-model="detailList.theTime"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="制单人" prop="">
              <el-input placeholder="请输入"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="经销商编号" prop="">
              <el-input
                v-model="detailList.customerNumber"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="经销商名称" prop="">
              <el-input
                v-model="detailList.customerName"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="备注信息" prop="">
              <el-input
                v-model="detailList.remark"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="审核人" prop="">
              <el-input
                v-model="detailList.examineBy"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="审核日期" prop="">
              <el-input
                v-model="detailList.examineTime"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 列表 -->
    <div class="mymain-container">
      <div class="table">
        <el-table
          v-loading="listLoading"
          :data="dataList"
          element-loading-text="Loading"
          border
          fit
          highlight-current-row
          stripe
        >
          <el-table-column
            label="序号"
            align="center"
            width="100"
            type="index"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="返利类型"
            prop="customerWalletName"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="返利金额"
            prop="amount"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="备注"
            prop="remark"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
        </el-table>
      </div>
    </div>
    <div class="diy-table-1">
      <el-row :gutter="0">
        <el-col :span="12" class="item">
          <div class="label">审批人</div>
          <div class="value">{{ this.name }}</div>
        </el-col>
        <el-col :span="12" class="item">
          <div class="label">审批结果</div>
          <div class="value">
            <el-radio v-model="examineStatus" label="OK">通过</el-radio>
            <el-radio v-model="examineStatus" label="FALL">驳回</el-radio>
          </div>
        </el-col>
        <el-col :span="24" class="item">
          <div class="label">审批说明</div>
          <div class="value">
            <el-input v-model="remark" placeholder="请输入内容"></el-input>
          </div>
        </el-col>
      </el-row>
    </div>
    <br />
    <!-- 按钮 -->
    <div class="btn-group clearfix">
      <div class="fl">
        <el-button type="primary" size="small" @click="btnFn">确定</el-button>
        <el-button type="primary" size="small" @click="resetFn">重置</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { getChangeListExamine } from "@/api/finance/change_list";
import { mapGetters } from "vuex";
export default {
  props: {
    detailList: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      remark: "",
      examineStatus: "",
      dataList: [], // 列表数据
      // searchForm: {}, //搜索表单
      listLoading: false, // 列表加载loading
    };
  },
  computed: { ...mapGetters(["name"]) },
  created() {
    this.dataList = [
      {
        customerWalletName: this.detailList.initiatorCustomerWalletName,
        remark: this.detailList.initiatorRemark,
        amount: -this.detailList.amount,
      },
      {
        customerWalletName: this.detailList.receiverCustomerWalletName,
        remark: this.detailList.receiverRemark,
        amount: this.detailList.amount,
      },
    ];
  },
  methods: {
    //重置
    resetFn() {
      this.remark = "";
      this.examineStatus = "";
    },
    //确定
    async btnFn() {
      // console.log(this.detailList);
      await getChangeListExamine({
        id: this.detailList.id,
        remark: this.remark,
        examineStatus: this.examineStatus,
      });
      this.$message.success("已审核");
    },
    goBack() {
      this.$emit("refresh");

      this.$parent.showPage = 1;
    },
  },
};
</script>

<style>
</style>