<template>
  <div>
    <div class="sty">
      <el-page-header @back="goBack"> </el-page-header>
    </div>
    <br />
    <span>基本信息</span>
    <el-divider></el-divider>
    <!-- 表头 -->
    <div>
      <el-form
        ref="searchForm"
        :model="searchForm"
        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
                disabled
                v-model="searchForm.billType"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="单据编号" prop="">
              <el-input
                disabled
                v-model="searchForm.code"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="单据来源" prop="">
              <el-input
                disabled
                v-model="searchForm.source"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="单据状态" prop="">
              <el-input
                disabled
                v-model="searchForm.examineStatus"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="业务日期" prop="">
              <el-input
                disabled
                v-model="searchForm.theTime"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="到期日" prop="">
              <el-input
                disabled
                v-model="searchForm.endTime"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="总金额" prop="">
              <el-input
                disabled
                v-model="searchForm.totalAmount"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="备注" prop="">
              <el-input
                disabled
                v-model="searchForm.remark"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <span>明细</span>
    <el-divider></el-divider>
    <!-- 列表 -->
    <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"
            type="index"
            width="100"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="经销商编号"
            prop="customerNumber"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="经销商名称"
            prop="customerName"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="*费用项目编码"
            prop="projectCode"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="项目费用名称"
            prop="projectName"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="*费用承担部门"
            prop="departmentId"
            min-width="160"
            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="invoiceType"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="不含税金额"
            prop="afterTaxAmount"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="税额"
            prop="tax"
            min-width="160"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column
            align="center"
            label="总金额"
            prop="totalAmount"
            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>

    <span>审批记录</span>
    <el-divider></el-divider>
    <div class="diy-table-1">
      <el-row :gutter="0">
        <el-col :span="8" class="item">
          <div class="label">审批人</div>
          <div class="value">{{ this.examineBy }}</div>
        </el-col>
        <el-col :span="8" class="item">
          <div class="label">审批结果</div>
          <div class="value">
            <el-radio-group v-model="examineStatus">
              <el-radio disabled label="OK">通过</el-radio>
              <el-radio disabled label="FAIL">驳回</el-radio>
            </el-radio-group>
          </div>
        </el-col>
        <el-col :span="8" class="item">
          <div class="label">审批时间</div>
          <div class="value">{{ this.examineTime }}</div>
        </el-col>
        <el-col :span="24" class="item">
          <div class="label">审批说明</div>
          <div class="value">
            {{ this.examineRemark }}
          </div>
        </el-col>
      </el-row>
    </div>
    <br />
  </div>
</template>

<script>
import { getFinanceOtherReceDetail } from "@/api/finance/receivable_list";
export default {
  props: {
    approvalId: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      dataList: [],
      listLoading: false, // 列表加载loading
      examineBy: "", //审核人
      examineTime: "", //审核时间
      examineStatus: null, //审核状态
      examineRemark: "", //审核备注
      searchForm: {
        billType: "",
        code: "",
        source: "",
        theTime: "",
        endTime: "",
        totalAmount: "",
        examineStatus: "",
        remark: "",
      },
    };
  },
  created() {
    this.getDataList();
  },
  methods: {
    async getDataList() {
      const res = await getFinanceOtherReceDetail({ id: this.approvalId });
      console.log(res);
      this.examineBy = res.data.examineBy;
      this.examineTime = res.data.examineTime;
      this.examineStatus = res.data.examineStatus;
      this.examineRemark = res.data.examineRemark;
      this.searchForm = {
        billType: res.data.billType,
        code: res.data.code,
        source: res.data.source,
        theTime: res.data.theTime,
        endTime: res.data.endTime,
        totalAmount: res.data.totalAmount,
        examineStatus: res.data.examineStatus == "OK" ? "已通过" : "驳回",
        remark: res.data.remark,
      };
      this.dataList = res.data.items;
    },
    goBack() {
      this.$parent.showPage = 1;
    },
  },
};
</script>

<style></style>
