<template>
  <div>
    <div>
      <el-page-header @back="goBack" content="审批"> </el-page-header>
    </div>
    <br />
    <br />
    <div>
      <el-form
        ref="screenForm"
        :model="detail"
        label-width="120px"
        size="small"
        label-position="left"
      >
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="单据编号" prop="billId">
              <el-input
                placeholder="请输入"
                disabled
                v-model="detail.billId"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="调价部门" prop="account">
              <el-input placeholder="请输入" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="调价业务员" prop="operatorName">
              <el-input
                disabled
                placeholder="请输入"
                v-model="detail.operatorName"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="销售类型" prop="account">
              <el-select placeholder="请选择活动区域" disabled>
                <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :lg="6">
            <el-form-item label="文件编码" prop="operatorName">
              <el-input
                disabled
                placeholder="请输入"
                v-model="detail.operatorName"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <div class="mymain-container">
          <!-- 列表 -->
          <div class="table">
            <el-table
              :data="detail.items"
              element-loading-text="Loading"
              border
              fit
              highlight-current-row
              stripe
            >
              <el-table-column
                align="center"
                label="销售类型"
                prop="saleTypeId"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="存货编码"
                prop="billId"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="存货名称"
                prop="materialName"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="规格型号"
                prop="model"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="计量单位"
                prop="company"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="批发价"
                prop="batchPrice"
                min-width="160"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                align="center"
                label="零售价"
                prop="retailPrice"
                min-width="160"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column
                align="center"
                label="返利使用比例"
                prop="rebateUseRate"
                min-width="160"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column
                align="center"
                label="生效日期"
                prop="startDate"
                min-width="160"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column
                align="center"
                label="失效日期"
                prop="endDate"
                min-width="160"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column
                align="center"
                label="是否促销价"
                prop="isPromote"
                min-width="160"
                show-overflow-tooltip
              >
                <template slot-scope="scope">
                  <el-tag type="success" v-if="scope.row.isPromote">是</el-tag>
                  <el-tag type="danger" v-else>否</el-tag>
                </template>
              </el-table-column>
              <el-table-column
                align="center"
                label="数量"
                prop="qty"
                min-width="160"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column
                align="center"
                label="发布"
                prop="isPublish"
                min-width="160"
                show-overflow-tooltip
              >
                <template slot-scope="scope">
                  <el-tag type="success" v-if="scope.row.isPublish">是</el-tag>
                  <el-tag type="danger" v-else>否</el-tag>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <el-row>
          <el-col :xs="24" :sm="24" :lg="24">
            <h3>审批</h3>
            <hr />
          </el-col>
        </el-row>
        <div class="diy-table-1">
          <el-row :gutter="0">
            <el-col :xs="12" :sm="12" :lg="12" class="item">
              <div class="label">审批人</div>
              <div class="value">{{ this.$store.getters.name }}</div>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="12" class="item">
              <div class="label">审批结果</div>
              <div class="value">
                <el-radio-group v-model="detail.examineResult">
                  <el-radio :label="true">通过</el-radio>
                  <el-radio :label="false">驳回</el-radio>
                </el-radio-group>
              </div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="24" class="item">
              <div class="label">审批说明</div>
              <div class="value">
                <el-input v-model="detail.examineNote " size="small"></el-input>
              </div>
            </el-col>
          </el-row>
        </div>
        <br />
        <div class="btn-group clearfix">
          <div class="fl">
            <el-button type="primary" size="small" @click="onSubmit"
              >提交审批</el-button
            >
            <!-- <el-button type="primary" size="small" @click="resetScreenForm"
              >重置</el-button
            > -->
          </div>
        </div>
   </el-form>
    </div>
  </div>
</template>

<script>
import { getProductRriceConfirm } from "@/api/basic_data/material";
import Mixin from "@/mixin/index";
export default {
  // mixins: [Mixin],
  props: {
    detail: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      radio: "",
      dataList: [
        {
          SalesType: "*一票机*",
          code: "23022051775",
          name: "夏之凉变频1",
          model: "KFR-26GW",
          company: "套",
          wholesale: "2999",
          retail: "2899",
          rebate: "0.8",
          effectiveDate: "2021-11-02",
          expiryDate: "2021-11-02",
          promotion: "否",
          number: "51",
          release: "是",
        },
      ],
    };
  },
  methods: {
    goBack() {
      console.log(this.$parent);
      this.$parent.show = 1;
    },
    onSubmit() {
      const params = {
        ...this.detail,
      };
      getProductRriceConfirm(params).then((res) => {
         this.$successMsg("已提交审核");
      });
    },
    resetScreenForm() {
      this.detail = {};
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .el-date-editor--date {
  width: 100%;
}
::v-deep .el-select {
  width: 100%;
}
</style>
