<template>
  <div>
    <BaseDialog
      width="500px"
      :isShow.sync="isShow"
      title="详情"
      @submit="submitForm"
      @close="close"
      :confirmStatus="false"
    >
      <div class="box" v-for="(item, index) in formList" :key="index">
        <div class="title">{{ item.label ? item.label + "：" : "" }}</div>
        <template v-if="item.scope === 'select'">
          <template v-for="(items, indexs) in item.options">
            <div v-if="formData[item.value] == items.value" class="text">
              {{ items.label }}
            </div>
          </template>
        </template>
        <template v-else-if="item.scope === 'time'">
          <div class="text">
            <span>{{ $methodsTools.onlyForma(formData[item.value1]) }}</span
            >至<span>{{ $methodsTools.onlyForma(formData[item.value2]) }}</span>
          </div>
        </template>
        <div
          class="text"
          v-else-if="item.scope === 'money'"
          style="color: red; font-size: 16px"
        >
          ￥{{ formData[item.value] }}
        </div>
        <div v-else class="text">{{ formData[item.value] }}</div>
      </div>
    </BaseDialog>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    activeData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      formList: [
        {
          label: "标题",
          value: "title",
        },
        {
          label: "备注",
          value: "remark",
        },
        {
          label: "成本分类",
          value: "costCatName",
        },
        {
          label: "教育类型",
          value: "educationName",
        },
        {
          label: "培训项目",
          value: "businessName",
        },
        {
          label: "签约时间",
          value1: "signStartTime",
          value2: "signEndTime",
          scope: "time",
        },
        {
          label: "成本分摊",
          value: "settleOrderType",
          scope: "select",
          options: [
            {
              label: "不限",
              value: 3,
            },
            {
              label: "代运营订单",
              value: 1,
            },
            {
              label: "独立订单",
              value: 2,
            },
          ],
        },
        {
          label: "结算金额",
          value: "settleMoney",
          scope: "money",
        },
        {
          label: "供应商",
          value: "instName",
        },
        {
          label: "收款信息",
          value: "bankName",
        },
        {
          label: "",
          value: "bank",
        },
        {
          label: "",
          value: "bankAccount",
        },
        {
          label: "审核状态",
          value: "checkStatus",
          scope: "select",
          options: [
            { label: "待提交", value: 1 },
            { label: "待审核", value: 7 },
            { label: "审核中", value: 2 },
            { label: "未通过", value: 3 },
            { label: "待支付", value: 4 },
            { label: "支付失败", value: 5 },
            { label: "已结算", value: 6 },
          ],
        },
        {
          label: "审核意见",
          value: "checkReason",
        },
      ],
      formData: {},
      settleOrderList: [
        {
          label: "不限",
          value: 3,
        },
        {
          label: "代运营订单",
          value: 1,
        },
        {
          label: "独立订单",
          value: 2,
        },
      ], //结算订单类型
    };
  },
  methods: {
    init() {
      this.$api.settletimedetaildata(this.activeData.settleId).then((res) => {
        this.formData = res.data;
      });
    },
    close() {},
    submitForm() {},
  },
  computed: {
    isShow: {
      get() {
        if (this.dialogVisible) {
          this.init();
        }
        return this.dialogVisible;
      },
      set(val) {
        this.$emit("update:dialogVisible", false);
      },
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  .title {
    width: 100px;
    text-align: end;
  }
  .text {
    flex: 1;
    font-weight: bold;
  }
}
</style>
