<template>
  <div class="main-contain">
    <div class="position">
      <bread-crumb :crumbs="crumbs"></bread-crumb>
    </div>
    <div class="app-container" v-loading="loading">
      <div
        style="
          justify-content: space-between;
          margin: 0px 0 12px 0;
          display: flex;
          align-items: center;
        "
      >
        <div>
          <span style="color: red">*</span><span>供应商:</span>
          <el-select
            v-model="supplier_name"
            style="width: 220px; margin-right: 10px"
            placeholder="请选择"
            :disabled="disabled"
          >
            <el-option
              v-for="item in supplyList"
              :key="item.id"
              :label="item.supplier_name"
              :value="item.id"
            >
            </el-option>
          </el-select>
          <span>单据日期:</span>
          <el-date-picker
            size="small"
            v-model="start_time"
            prefix-icon="el-icon-date"
            :editable="false"
            style="width: 196px"
            type="date"
            placeholder="选择日期时间"
            align="right"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            :disabled="disabled"
          ></el-date-picker>

          <span>单据编码:{{ number }}</span>
        </div>
        <div>
          <el-button
            size="small"
            type="primary"
            @click="saveGoodReturn"
            v-show="showOne"
            >保存</el-button
          >
          <el-button
            size="small"
            type="primary"
            @click="updateGoodReturn"
            v-show="showTwo"
            >保存</el-button
          >
          <el-button
            size="small"
            type="primary"
            @click="toPrint"
            v-show="showSix"
            >打印</el-button
          >
          <el-button
            size="small"
            type="primary"
            v-if="is_check == 2"
            @click="checkReturnOrder"
            >审核</el-button
          >
          <el-button
            size="small"
            type="primary"
            v-if="is_check == 1"
            @click="modefyReturnOrder"
            >反审核</el-button
          >
        </div>
      </div>

      <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
        <el-table
          :row-style="{ color: '#303133' }"
          :header-cell-style="{
            backgroundColor: 'rgb(245, 247, 250)',
            color: '#606266',
          }"
          :data="recordInfo.tableList"
          :class="signAndWeighBoxPatients"
          border
          style="width: 100%"
          max-height="450"
        >
          <el-table-column align="center" width="200px">
            <template slot="header" slot-scope="scope">
              <span>商品<span style="color: red">*</span></span>
            </template>
            <template slot-scope="scope">
              <el-form-item
                :prop="'tableList.' + scope.$index + '.name'"
                :rules="tableRules.name"
              >
                <el-select
                  v-model="scope.row.name"
                  style="width: 160px"
                  filterable
                  placeholder="请选择商品"
                  @change="changeName"
                  @input="changeGoodName(scope.$index)"
                  :disabled="disabled"
                >
                  <el-option
                    v-for="(item, index) in tabList"
                    :key="index"
                    :label="item.supply_name"
                    :value="item"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column align="center" width="150px">
            <template slot="header" slot-scope="scope">
              <span>商品类别</span>
            </template>
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_type"
                style="width: 120px"
                :disabled="true"
                placeholder="商品类别"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>
          <el-table-column label="规格&单位" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_specification_name"
                style="width: 150px"
                :disabled="true"
                placeholder="规格&单位"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="批号" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_batch_number"
                style="width: 150px"
                :disabled="true"
                placeholder="批号"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="单位" align="center" width="120px">
            <template slot="header" slot-scope="scope">
              <span>单位<span style="color: red">*</span></span>
            </template>
            <template slot-scope="scope">
              <el-form-item
                :prop="'tableList.' + scope.$index + '.supply_unit'"
                :rules="tableRules.supply_unit"
              >
                <el-select
                  v-model="scope.row.supply_unit"
                  style="width: 100px"
                  filterable
                  placeholder="请选择"
                  :disabled="disabled"
                >
                  <el-option
                    v-for="(item, index) in scope.row.unitList"
                    :key="index"
                    :label="item.name"
                    :value="item.name"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column label="可用库存" align="center" width="130px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_total"
                style="width: 100px"
                :disabled="true"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>
          <el-table-column label="可退数量" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.count"
                style="width: 150px"
                :disabled="true"
                placeholder="可退数量"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>
          <el-table-column label="数量" align="center" width="120px">
            <template slot="header" slot-scope="scope">
              <span>数量<span style="color: red">*</span></span>
            </template>
            <template slot-scope="scope">
              <el-form-item
                :prop="'tableList.' + scope.$index + '.supply_count'"
                :rules="tableRules.supply_count"
              >
                <el-input
                  @input="
                    getSupplyCount(
                      scope.row.supply_count,
                      scope.row.sum_count,
                      scope.row.supply_unit,
                      scope.row.type,
                      scope.row.min_number,
                      scope.row.max_unit,
                      scope.row.min_unit,
                      scope.$index
                    )
                  "
                  v-model="scope.row.supply_count"
                  style="width: 80px"
                  :disabled="disabled"
                ></el-input>
              </el-form-item>
            </template>
          </el-table-column>

          <el-table-column label="采购单价" align="center" width="180px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_price"
                style="width: 140px"
                :disabled="disabled"
                placeholder="请输入采购单价"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="折扣率(%)" align="center" width="120px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.deposit_rate"
                style="width: 80px"
                :disabled="disabled"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="折扣金额" align="center" width="120px">
            <template slot-scope="scope">
              {{
                calculate(
                  scope.row.supply_count *
                    scope.row.supply_price *
                    (scope.row.deposit_rate / 100)
                )
              }}
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="采购金额" align="center" width="120px">
            <template slot-scope="scope">
              {{
                calculate(
                  scope.row.supply_count * scope.row.supply_price -
                    scope.row.supply_count *
                      scope.row.supply_price *
                      (scope.row.deposit_rate / 100)
                )
              }}
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="生产厂家" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_manufacturer"
                style="width: 160px"
                :disabled="true"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="关联采购订单号" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.order_number"
                style="width: 160px"
                :disabled="true"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="关联采购单号" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.good_number"
                style="width: 160px"
                :disabled="true"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column label="备注" align="center" width="200px">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.supply_remake"
                style="width: 160px"
                :disabled="disabled"
                placeholder="请输入备注"
              ></el-input>
              <div style="visibility: hidden">/</div>
            </template>
          </el-table-column>

          <el-table-column
            label="操作"
            align="center"
            width="150px"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-tooltip
                class="item"
                effect="dark"
                content="新增"
                placement="top"
              >
                <el-button
                  size="mini"
                  type="primary"
                  icon="el-icon-circle-plus-outline"
                  @click="handleEdit(scope.$index, scope.row)"
                >
                </el-button>
              </el-tooltip>
              <el-tooltip
                class="item"
                effect="dark"
                content="删除"
                placement="top"
              >
                <el-button
                  size="mini"
                  type="danger"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.$index, scope.row)"
                >
                </el-button>
              </el-tooltip>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div style="margin-top: 10px">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="备注信息"
          v-model="return_remark"
        >
        </el-input>
      </div>
      <!-- 审核水印 -->
      <img
        src="@/assets/purchase/Reviewed.png"
        alt="正在加载..."
        class="reviewImg"
        v-show="Reviewed == true"
      />
      <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
      <div style="margin-top: 10px">
        <span
          >优惠率:<el-input
            style="width: 100px"
            v-model="rate_of_concession"
            @input="addressChange"
            placeholder="请输入优惠率"
            :disabled="disabled"
          ></el-input
          >%</span
        >

        <span
          >优惠金额:<el-input
            style="width: 100px"
            v-model="discount_amount"
            @input="count_discount"
            placeholder="请输入优惠金额"
            :disabled="disabled"
          ></el-input
        ></span>

        <span
          >本次退款:<el-input
            style="width: 100px"
            v-model="payment"
            @input="count_payment"
            placeholder="请输入本次退款"
            :disabled="disabled"
          ></el-input
        ></span>

        <span
          >本次欠款:<el-input
            style="width: 100px"
            v-model="arrearage"
            @input="count_arrearage"
            placeholder="请输入本次欠款"
            :disabled="disabled"
          ></el-input
        ></span>
      </div>
    </div>
  </div>
</template>

<script>
import BreadCrumb from "@/xt_pages/components/bread-crumb";
import { uParseTime } from "@/utils/tools";
import {
  getInitOrder,
  getGoodOrderDetailList,
  saveGoodReturnOrder,
  checkReturnOrder,
  updateGoodReturn,
  modefyReturnOrder,
  deleteReturnOrderById,
} from "@/api/supply";
export default {
  name: "addPurchaseOrder",
  components: {
    BreadCrumb,
  },
  data() {
    return {
      tipsInfo: "",
      crumbs: [
        { path: false, name: "退货单" },
        { path: "/good/return/add", name: "新增退货单" },
      ],
      showTwo: false,
      showOne: true,
      recordInfo: { tableList: [] },
      keywords: "",
      total: 0,
      multipleSelection: [],
      signAndWeighBoxPatients: "sign-and-weigh-box-patients",
      start_time: "",
      end_time: "",
      page: 1,
      limit: 10,
      goodType: [],
      AllPrice: 0,
      goodInfo: [],
      org_id: 0,
      types: [],
      tyep_name: "",
      form: {
        manufacturer_id: "",
      },
      tabList: [],
      manufactuerList: [],
      currentIndex: 0,
      goodTypeList: [],
      drugTypeList: [],
      supplier_name: "",
      supplyList: [],
      rate_of_concession: "",
      arrearage: "",
      payment: "",
      total_price: 0,
      discount_amount: "",
      tableRules: {
        name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
        supply_count: [
          { required: true, message: "数量不能为空", trigger: "blur" },
        ],
      },
      warehousing_id: 0,
      number: "",
      loading: false,
      drugList: [],
      goodList: [],
      id: 0,
      disabled: false,
      is_check: 0,
      dialogVisible: false,
      return_remark: "",
      warehouse_out_id: 0,
      showThree: false,
      tableDataList: [],
      Reviewed: false,
      showSix: false,
    };
  },
  watch: {
    total_price: function (newval, oldval) {
      if (this.rate_of_concession != "") {
        // console.log('00')
        this.addressChange();
        this.count_payment();
      }
    },
  },

  methods: {
    getInitOrder() {
      getInitOrder().then((response) => {
        if (response.data.state == 1) {
          var drugList = response.data.data.drugList;
          this.manufactuerList = response.data.data.manufactuerList;
          this.goodTypeList = response.data.data.goodTypeList;
          this.drugTypeList = response.data.data.drugTypeList;
          this.supplyList = response.data.data.supplyList;
          for (let i = 0; i < drugList.length; i++) {
            for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
              if (
                drugList[i].max_unit ==
                drugList[i].drug_warehouse_info[z].max_unit
              ) {
                drugList[i].drug_warehouse_info[z].stock_max_number =
                  drugList[i].drug_warehouse_info[z].stock_max_number *
                  drugList[i].min_number;
              }
            }
            for (let j = 0; j < this.manufactuerList.length; j++) {
              if (drugList[i].manufacturer == this.manufactuerList[j].id) {
                drugList[i].manufacturer =
                  this.manufactuerList[j].manufacturer_name;
              }
            }
            for (let y = 0; y < this.drugTypeList.length; y++) {
              if (drugList[i].drug_type == this.drugTypeList[y].value) {
                drugList[i].drug_type = this.drugTypeList[y].name;
              }
            }
            drugList[i].supply_name =
              drugList[i].drug_name +
              " " +
              drugList[i].dose +
              drugList[i].dose_unit +
              "*" +
              drugList[i].min_number +
              drugList[i].min_unit +
              "/" +
              drugList[i].max_unit +
              " " +
              drugList[i].manufacturer;
            drugList[i].supply_type = drugList[i].drug_type;
            drugList[i].supply_specification_name =
              drugList[i].dose +
              drugList[i].dose_unit +
              "*" +
              drugList[i].min_number +
              drugList[i].min_unit +
              "/" +
              drugList[i].max_unit;
            drugList[i].supply_total = this.getWarehoseInfo(
              drugList[i].drug_warehouse_info,
              drugList[i].max_unit,
              drugList[i].min_unit,
              drugList[i].min_number
            );
            drugList[i].supply_count = "";
            drugList[i].supply_total_price = "";
            drugList[i].supply_manufacturer = drugList[i].manufacturer;
            drugList[i].supply_license_number = drugList[i].number;
            drugList[i].supply_remake = "";
            drugList[i].type = 1;
            drugList[i].supply_price = drugList[i].last_price;
            drugList[i].name = drugList[i].drug_name;
            drugList[i].count = this.getWarehoseInfo(
              drugList[i].drug_warehouse_info,
              drugList[i].max_unit,
              drugList[i].min_unit,
              drugList[i].min_number
            );
            drugList[i].unitList = [
              { id: 1, name: "" },
              { id: 2, name: "" },
            ];
            drugList[i].supply_unit = drugList[i].max_unit;
            for (let j = 0; j < drugList[i].unitList.length; j++) {
              drugList[i].unitList[0].name = drugList[i].max_unit;
              drugList[i].unitList[1].name = drugList[i].min_unit;
            }
            drugList[i].sum_count = this.getWarehoseInfoTwo(
              drugList[i].drug_warehouse_info,
              drugList[i].max_unit,
              drugList[i].min_unit,
              drugList[i].min_number
            );
            this.tabList.push(drugList[i]);
          }
          this.drugList = drugList;
          var goodList = response.data.data.goodList;
          for (let i = 0; i < goodList.length; i++) {
            for (let j = 0; j < this.manufactuerList.length; j++) {
              if (goodList[i].manufacturer == this.manufactuerList[j].id) {
                goodList[i].manufacturer =
                  this.manufactuerList[j].manufacturer_name;
              }
            }
            for (let y = 0; y < this.goodTypeList.length; y++) {
              if (goodList[i].good_type_id == this.goodTypeList[y].id) {
                goodList[i].good_type_id = this.goodTypeList[y].type_name;
              }
            }
            goodList[i].supply_name =
              goodList[i].good_name +
              " " +
              goodList[i].specification_name +
              " " +
              goodList[i].manufacturer;
            goodList[i].supply_type = goodList[i].good_type_id;
            goodList[i].supply_specification_name =
              goodList[i].specification_name;
            goodList[i].supply_price = goodList[i].buy_price;
            goodList[i].supply_total = this.getTotalStockCount(
              goodList[i].good_warehouse_info
            );
            goodList[i].count = this.getTotalStockCount(
              goodList[i].good_warehouse_info
            );
            goodList[i].supply_count = "";
            goodList[i].supply_total_price = "";
            goodList[i].supply_manufacturer = goodList[i].manufacturer;
            goodList[i].supply_license_number = goodList[i].number;
            goodList[i].supply_remake = "";
            goodList[i].type = 2;
            goodList[i].name = goodList[i].good_name;
            goodList[i].unitList = [
              { id: 1, name: "" },
              { id: 2, name: "" },
            ];
            goodList[i].supply_unit = goodList[i].packing_unit;
            for (let j = 0; j < goodList[i].unitList.length; j++) {
              goodList[i].unitList[0].name = goodList[i].packing_unit;
            }

            goodList[i].sum_count = this.getTotalStockCountTwo(
              goodList[i].good_warehouse_info
            );
            this.tabList.push(goodList[i]);
          }
          this.goodList = goodList;
        }
      });
    },
    changeGoodName(val) {
      this.currentIndex = val;
    },
    changeName(val) {
      for (let i = 0; i < this.recordInfo.tableList.length; i++) {
        if (this.currentIndex == i) {
          this.recordInfo.tableList[i].project_id = val.id;
          this.recordInfo.tableList[i].type = val.type;
          this.recordInfo.tableList[i].name = val.name;
          this.recordInfo.tableList[i].supply_name = val.supply_name;
          this.recordInfo.tableList[i].supply_type = val.supply_type;
          this.recordInfo.tableList[i].supply_specification_name =
            val.supply_specification_name;
          this.recordInfo.tableList[i].supply_total = val.supply_total;
          if (val.supply_count == NaN) {
            this.recordInfo.tableList[i].supply_count = "";
          } else {
            this.recordInfo.tableList[i].supply_count = val.supply_count
              ? val.supply_count
              : "";
          }

          this.recordInfo.tableList[i].supply_price = val.supply_price
            ? val.supply_price
            : "";
          this.recordInfo.tableList[i].supply_total_price =
            val.supply_total_price ? val.supply_total_price : "";
          this.recordInfo.tableList[i].supply_manufacturer =
            val.supply_manufacturer;
          this.recordInfo.tableList[i].supply_license_number =
            val.supply_license_number;
          this.recordInfo.tableList[i].supply_remake = val.supply_remake;
          this.recordInfo.tableList[i].is_total = val.is_total;
          this.recordInfo.tableList[i].supply_unit = val.supply_unit;
          this.recordInfo.tableList[i].unitList = val.unitList;
          this.recordInfo.tableList[i].count = val.count;
          this.recordInfo.tableList[i].sum_count = val.sum_count;
          if (val.type == 1) {
            this.recordInfo.tableList[i].min_number = val.min_number;
            this.recordInfo.tableList[i].max_unit = val.max_unit;
            this.recordInfo.tableList[i].min_unit = val.min_unit;
          } else {
            this.recordInfo.tableList[i].max_unit = "";
            this.recordInfo.tableList[i].min_unit = "";
            this.recordInfo.tableList[i].min_number = "";
          }
        }
      }
    },
    handleEdit() {
      const tempObj = {};
      tempObj["id"] = 0;
      tempObj["name"] = "";
      tempObj["supply_name"] = "";
      tempObj["supply_type"] = "";
      tempObj["supply_specification_name"] = "";
      tempObj["supply_total"] = "";
      tempObj["count"] = 0;
      tempObj["supply_count"] = "";
      tempObj["supply_price"] = "";
      tempObj["supply_total_price"] = "";
      tempObj["supply_manufacturer"] = "";
      tempObj["supply_license_number"] = "";
      tempObj["supply_remake"] = "";
      tempObj["type"] = 0;
      tempObj["is_total"] = 1;
      tempObj["project_id"] = 0;
      tempObj["supply_unit"] = "";
      tempObj["order_number"] = "";
      tempObj["supply_batch_number"] = "";
      tempObj["supply_product_date"] = "";
      tempObj["supply_expiry_date"] = "";
      tempObj["warehousing_id"] = 0;
      tempObj["warehouse_info_id"] = 0;
      tempObj["good_number"] = "";
      tempObj["min_price"] = "";
      tempObj["deposit_rate"] = "";
      tempObj["sum_count"] = 0;
      tempObj["min_number"] = 0;
      tempObj["max_unit"] = "";
      tempObj["min_unit"] = "";
      this.recordInfo.tableList.push(tempObj);
    },
    handleDelete: function (index, row) {
      if (row.id == 0) {
        if (this.recordInfo.tableList.length <= 1) {
          this.$message.error("只有一条记录的时候无法删除");
          return;
        } else {
          this.recordInfo.tableList.splice(index, 1);
        }
      }

      if (row.id > 0) {
        const params = {
          id: row.id,
        };
        this.$confirm("确认删除吗?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            deleteReturnOrderById(params).then((response) => {
              if (response.data.state == 0) {
                this.$message.error(response.data.msg);
                return false;
              } else {
                var msg = response.data.data.msg;
                this.recordInfo.tableList.splice(index, 1);
                this.$message.success("删除成功");
              }
            });
          })
          .catch(() => {});
      }
    },
    getWarehoseInfo(arr, max_unit, min_unit, min_number) {
      var total = 0;
      var max_str = "";
      var min_str = "";
      if (arr.length > 0) {
        for (let i = 0; i < arr.length; i++) {
          total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
        }
      }

      if (total < min_number) {
        min_str = total + min_unit;
      }
      if (total == 0) {
        min_str = "";
        max_str = "";
      }
      if (total >= min_number) {
        if (parseInt(total / min_number) != 0) {
          max_str = parseInt(total / min_number) + max_unit;
        }
        if (total % min_number != 0) {
          min_str = (total % min_number) + min_unit;
        }
      }
      // console.log("hh2332232332",max_str + min_str)
      return max_str + min_str;
    },
    getWarehoseInfoTwo(arr, max_unit, min_unit, min_number) {
      var total = 0;
      if (arr.length > 0) {
        for (let i = 0; i < arr.length; i++) {
          total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
        }
      }
      return total;
    },
    getTotalStockCount(arr) {
      var total_count = 0;
      for (let i = 0; i < arr.length; i++) {
        total_count += arr[i].stock_count;
      }
      if (total_count > 0) {
        return total_count;
      } else {
        return "";
      }
    },
    getTotalStockCountTwo(arr) {
      var total_count = 0;
      for (let i = 0; i < arr.length; i++) {
        total_count += arr[i].stock_count;
      }
      return total_count;
    },
    calculate: function (val) {
      if (isNaN(val)) {
        return "";
      }
      if (val == 0) {
        return "";
      }
      return Math.round(parseFloat(val) * 100) / 100;
    },
    getTimes(time) {
      if (time === "") {
        return "";
      }
      return uParseTime(time, "{y}-{m}-{d}");
    },
    getAllPrice() {
      var total_price = 0;
      let table = this.recordInfo.tableList;
      console.log(this.recordInfo.tableList, "this.recordInfo.tableList");
      for (let i = 0; i < this.recordInfo.tableList.length; i++) {
        if (this.recordInfo.tableList[i].supply_count == "") {
          total_price = 0;
        } else {
          total_price +=
            this.recordInfo.tableList[i].supply_price *
              this.recordInfo.tableList[i].supply_count -
            this.recordInfo.tableList[i].supply_price *
              this.recordInfo.tableList[i].supply_count *
              (this.recordInfo.tableList[i].deposit_rate / 100);
          console.log(total_price, "this.total_price");
        }
      }

      this.total_price = total_price;
      // this.discount_amount = (this.total_price * this.rate_of_concession * 0.01).toFixed(2);
      if (total_price > 0) {
        return total_price.toFixed(2);
      } else {
        return 0;
      }
    },
    addressChange() {
      var discount_amount = 0;
      if (this.rate_of_concession > 0) {
        discount_amount = (
          (this.rate_of_concession / 100) *
          this.total_price
        ).toFixed(2);
      }
      this.discount_amount = discount_amount;
      if (this.payment > 0) this.count_payment();
    },
    count_discount() {
      this.rate_of_concession = (
        this.discount_amount /
        (this.total_price * 0.01)
      ).toFixed(2);
      if (this.payment > 0) this.count_payment();
    },
    count_payment() {
      let arrearage_1 = (
        this.total_price -
        this.discount_amount -
        this.payment
      ).toFixed(2);
      if (arrearage_1 > 0) {
        this.arrearage = arrearage_1;
      } else {
        this.arrearage = 0;
      }
    },

    count_arrearage() {
      this.payment = this.total_price - this.arrearage;
    },

    checkPurchaseOrder(id, index) {
      this.$confirm("是否审核?", {
        confirmButtonText: "确 定",
        cancelButtonText: "取 消",
        type: "warning",
      })
        .then(() => {
          checkPurchaseOrder(this.id).then((response) => {
            if (response.data.state == 1) {
              var info = response.data.data.info;
              this.disabled = true;
              this.$message.success("审核成功!");
              this.getPurchaseOrderDetail();
            }
          });
        })
        .catch(() => {});
    },
    getGoodOrderDetail() {
      var id = this.$route.query.id;
      var ids = this.$route.query.ids;
      getGoodOrderDetailList(id, ids).then((response) => {
        if (response.data.state == 1) {
          // console.log(response.data.data.list,'oooresponse.data.data.list')
          var out = response.data.data.out;
          this.id = out.id;
          this.supplier_name = out.supplier_id;
          this.rate_of_concession = out.rate_of_concession;
          this.discount_amount = out.discount_amount;
          this.start_time = this.getTimes(out.document_date);
          var orderInfo = response.data.data.list;
          // console.log("orderINFO233232232332", orderInfo);
          var drugList = response.data.data.drugList;
          var goodList = response.data.data.goodList;
          for (let i = 0; i < orderInfo.length; i++) {
            if (orderInfo[i].is_source == 1) {
              for (
                let j = 0;
                j < orderInfo[i].drug_warehouse_info.length;
                j++
              ) {
                if (
                  orderInfo[i].drug_warehouse_info[j].max_unit ==
                  orderInfo[i].drug.max_unit
                ) {
                  orderInfo[i].drug_warehouse_info[j].stock_max_number =
                    orderInfo[i].drug_warehouse_info[j].stock_max_number *
                    orderInfo[i].drug.min_number;
                }
              }
              orderInfo[i].supply_total = this.getWarehoseInfo(
                orderInfo[i].drug_warehouse_info,
                orderInfo[i].drug.max_unit,
                orderInfo[i].drug.min_unit,
                orderInfo[i].drug.min_number
              );
              // orderInfo[i].count =this.getWarehoseInfo(orderInfo[i].drug_warehouse_info,orderInfo[i].drug.max_unit,orderInfo[i].drug.min_unit,orderInfo[i].drug.min_number)
            }
            if (orderInfo[i].is_source == 2) {
              orderInfo[i].supply_total = this.getTotalStockCount(
                orderInfo[i].good_warehouse_info
              );

              // orderInfo[i].count = this.getTotalStockCount(orderInfo[i].good_warehouse_info)
            }
            orderInfo[i].id = orderInfo[i].id;
            orderInfo[i].supply_count = orderInfo[i].supply_count;

            orderInfo[i].supply_price = orderInfo[i].price;
            orderInfo[i].supply_remake = orderInfo[i].remark;
            orderInfo[i].type = orderInfo[i].is_source;
            orderInfo[i].project_id = orderInfo[i].project_id;
            orderInfo[i].supply_unit = orderInfo[i].supply_unit;
            orderInfo[i].order_number = orderInfo[i].order_number;
            orderInfo[i].good_number = orderInfo[i].good_number;
            orderInfo[i].supply_total_price = (
              orderInfo[i].count * orderInfo[i].price
            ).toFixed(2);
            orderInfo[i].supply_expiry_date = orderInfo[i].supply_expiry_date;
            orderInfo[i].supply_product_date = orderInfo[i].supply_product_date;
            orderInfo[i].supply_batch_number = orderInfo[i].supply_batch_number;
            orderInfo[i].warehousing_id = orderInfo[i].warehousing_id;
            orderInfo[i].warehouse_info_id = orderInfo[i].warehouse_info_id;
            orderInfo[i].deposit_rate = "";

            if (orderInfo[i].is_source == 1) {
              for (let j = 0; j < drugList.length; j++) {
                if (orderInfo[i].project_id == drugList[j].id) {
                  if (drugList[j].max_unit != drugList[j].min_unit) {
                    orderInfo[i].unitList = [
                      { id: 1, name: "" },
                      { id: 2, name: "" },
                    ];
                    orderInfo[i].unitList[0].name = drugList[j].max_unit;
                    orderInfo[i].unitList[1].name = drugList[j].min_unit;
                  }
                  if (drugList[j].max_unit == drugList[j].min_unit) {
                    orderInfo[i].unitList = [{ id: 1, name: "" }];
                    orderInfo[i].unitList[0].name = drugList[j].max_unit;
                  }
                  //用来统计数量比大小
                  if (orderInfo[i].supply_unit == drugList[j].max_unit) {
                    orderInfo[i].sum_count =
                      orderInfo[i].count * drugList[j].min_number;
                  }
                  if (orderInfo[i].supply_unit == drugList[j].min_unit) {
                    orderInfo[i].sum_count = orderInfo[i].count;
                  }
                  orderInfo[i].min_number = drugList[j].min_number;
                  orderInfo[i].max_unit = drugList[j].max_unit;
                  orderInfo[i].min_unit = drugList[j].min_unit;
                }
              }
              orderInfo[i].count = this.getWarehoseInfoSix(
                orderInfo[i].drug_warehouse_info,
                orderInfo[i].drug.max_unit,
                orderInfo[i].drug.min_unit,
                orderInfo[i].drug.min_number,
                orderInfo[i].warehouse_out_id
              );
              // orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
            }

            if (orderInfo[i].is_source == 2) {
              for (let j = 0; j < goodList.length; j++) {
                if (orderInfo[i].project_id == goodList[j].id) {
                  orderInfo[i].unitList = [{ id: 1, name: "" }];
                  orderInfo[i].unitList[0].name = goodList[j].packing_unit;
                  orderInfo[i].count = this.getTotalStockCountSix(
                    orderInfo[i].good_warehouse_info,
                    orderInfo[i].warehouse_out_id
                  );
                }
              }
              orderInfo[i].sum_count = orderInfo[i].count;
              orderInfo[i].min_number = 0;

              // orderInfo[i].count = orderInfo[i].count;
              orderInfo[i].max_unit = "";
              orderInfo[i].min_unit = "";
            }
          }

          this.recordInfo.tableList = [];
          console.log("相亲233232322332323223322323", orderInfo);
          this.recordInfo.tableList = orderInfo;
          this.tableDataList = [];
          this.tableDataList = orderInfo;
          this.$nextTick(() => {
            this.getAllPrice();
          });
        }
      });
    },
    saveGoodReturn() {
      this.loading = true;
      if (this.supplier_name == 0 || this.supplier_name == "") {
        this.$message.error("供应商不能为空!");
        this.loading = false;
        return false;
      }
      var warehouse_out_id = this.$route.query.id;
      this.$refs["tableForm"].validate((valid) => {
        if (valid) {
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (this.recordInfo.tableList[i].count == "") {
              this.$message.error(
                this.recordInfo.tableList[i].name + "无可退库数量,保存失败!"
              );
              this.loading = false;
              return false;
            }
            this.recordInfo.tableList[i].supply_count = parseInt(
              this.recordInfo.tableList[i].supply_count
            );
            this.recordInfo.tableList[i].supply_price =
              this.recordInfo.tableList[i].supply_price.toString();
            this.recordInfo.tableList[i].supply_total =
              this.recordInfo.tableList[i].supply_total.toString();
            this.recordInfo.tableList[i].count =
              this.recordInfo.tableList[i].count.toString();
            this.recordInfo.tableList[i].deposit_rate =
              this.recordInfo.tableList[i].deposit_rate.toString();
            if (this.recordInfo.tableList[i].supply_product_date == "") {
              this.recordInfo.tableList[i].supply_product_date = 0;
            }
            if (this.recordInfo.tableList[i].supply_expiry_date == "") {
              this.recordInfo.tableList[i].supply_expiry_date = 0;
            }
            for (let j = 0; j < this.manufactuerList.length; j++) {
              if (
                this.recordInfo.tableList[i].supply_manufacturer ==
                this.manufactuerList[j].manufacturer_name
              ) {
                this.recordInfo.tableList[i].manufacturer_id =
                  this.manufactuerList[j].id;
              }
              if (
                this.recordInfo.tableList[i].supply_manufacturer ==
                this.manufactuerList[j].id
              ) {
                this.recordInfo.tableList[i].supply_manufacturer =
                  this.manufactuerList[j].manufacturer_name;
              }
            }
          }
          //判断是否在采购单数据中做了删除,如果长度相等则代表没有删除，如果不等则代表做了删除或者新增
          if (this.recordInfo.tableList.length < this.tableDataList.length) {
            warehouse_out_id = 0;
            for (let i = 0; i < this.recordInfo.tableList.length; i++) {
              this.recordInfo.tableList[i].id = 0;
              this.recordInfo.tableList[i].warehouse_info_id = 0;
              this.recordInfo.tableList[i].warehouse_out_id = 0;
              this.recordInfo.tableList[i].warehousing_id = 0;
              this.recordInfo.tableList[i].good_number = "";
              this.recordInfo.tableList[i].order_number = "";
            }
          }
          var params = {
            stockIn: this.recordInfo.tableList,
            return_marke: this.return_remark,
          };
          //  console.log("2323323232",params)

          saveGoodReturnOrder(
            params,
            warehouse_out_id,
            this.start_time,
            this.rate_of_concession,
            this.discount_amount,
            this.arrearage,
            this.payment,
            this.supplier_name
          ).then((response) => {
            if (response.data.state == 1) {
              this.loading = false;
              this.showOne = false;
              this.showTwo = true;
              this.showSix = true;
              this.is_check = 2;
              this.$message.success("保存成功!");
              var warehouseCancel = response.data.data.warehouseCancel;
              var out = response.data.data.cancelOrder;
              this.id = out.id;
              this.warehouse_out_id = out.warehouse_out_id;
              this.supplier_name = out.supplier_id;
              if (out.rate_of_concession == 0) {
                this.rate_of_concession = "";
              } else {
                this.rate_of_concession = out.rate_of_concession;
              }
              if (out.discount_amount == 0) {
                this.discount_amount = "";
              } else {
                this.discount_amount = out.discount_amount;
              }
              if (this.payment == 0) {
                this.payment = "";
              } else {
                this.payment = out.payment;
              }

              if (out.arrearage == 0) {
                this.arrearage = "";
              } else {
                this.arrearage = out.arrearage;
              }

              this.start_time = this.getTimes(out.document_date);
              var orderInfo = response.data.data.list;

              for (let i = 0; i < orderInfo.length; i++) {
                orderInfo[i].id = orderInfo[i].id;
                orderInfo[i].name = orderInfo[i].name;
                orderInfo[i].id = orderInfo[i].id;
                orderInfo[i].supply_count = orderInfo[i].supply_count;
                orderInfo[i].supply_price = orderInfo[i].price;
                orderInfo[i].supply_remake = orderInfo[i].remark;
                orderInfo[i].type = orderInfo[i].is_source;
                orderInfo[i].project_id = orderInfo[i].project_id;
                orderInfo[i].supply_unit = orderInfo[i].supply_unit;
                orderInfo[i].order_number = orderInfo[i].order_number;
                orderInfo[i].good_number = orderInfo[i].good_number;
                orderInfo[i].supply_total_price = (
                  orderInfo[i].supply_count * orderInfo[i].price
                ).toFixed(2);
                orderInfo[i].supply_expiry_date = this.getTimes(
                  orderInfo[i].supply_expiry_date
                );
                orderInfo[i].supply_product_date = this.getTimes(
                  orderInfo[i].supply_product_date
                );
                orderInfo[i].deposit_rate = orderInfo[i].deposit_rate;
                orderInfo[i].count = orderInfo[i].count;
                orderInfo[i].supply_total = orderInfo[i].supply_total;
                orderInfo[i].supply_specification_name =
                  orderInfo[i].supply_specification_name;
                if (orderInfo[i].is_source == 1) {
                  for (let j = 0; j < this.drugList.length; j++) {
                    if (orderInfo[i].project_id == this.drugList[j].id) {
                      if (
                        this.drugList[j].max_unit != this.drugList[j].min_unit
                      ) {
                        orderInfo[i].unitList = [
                          { id: 1, name: "" },
                          { id: 2, name: "" },
                        ];
                        orderInfo[i].unitList[0].name =
                          this.drugList[j].max_unit;
                        orderInfo[i].unitList[1].name =
                          this.drugList[j].min_unit;
                      }

                      if (
                        this.drugList[j].max_unit == this.drugList[j].min_unit
                      ) {
                        orderInfo[i].unitList = [{ id: 1, name: "" }];
                        orderInfo[i].unitList[0].name =
                          this.drugList[j].max_unit;
                      }
                    }
                  }
                }
                if (orderInfo[i].is_source == 2) {
                  for (let j = 0; j < this.goodList.length; j++) {
                    if (orderInfo[i].project_id == this.goodList[j].id) {
                      orderInfo[i].unitList = [{ id: 1, name: "" }];
                      orderInfo[i].unitList[0].name =
                        this.goodList[j].packing_unit;
                    }
                  }
                }
              }
              this.recordInfo.tableList = [];
              this.recordInfo.tableList = orderInfo;
            }
          });
        }
      });
    },
    updateGoodReturn() {
      this.loading = true;
      if (this.supplier_name == 0 || this.supplier_name == "") {
        this.$message.error("供应商不能为空!");
        this.loading = false;
        return false;
      }
      var warehouse_out_id = this.id;
      this.$refs["tableForm"].validate((valid) => {
        if (valid) {
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (this.recordInfo.tableList[i].count == "") {
              this.$message.error(
                this.recordInfo.tableList[i].name + "无可退库数量,保存失败!"
              );
              this.loading = false;
              return false;
            }
            this.recordInfo.tableList[i].supply_count = parseInt(
              this.recordInfo.tableList[i].supply_count
            );
            this.recordInfo.tableList[i].supply_price =
              this.recordInfo.tableList[i].supply_price.toString();
            this.recordInfo.tableList[i].supply_total =
              this.recordInfo.tableList[i].supply_total.toString();
            this.recordInfo.tableList[i].count =
              this.recordInfo.tableList[i].count.toString();
            this.recordInfo.tableList[i].deposit_rate =
              this.recordInfo.tableList[i].deposit_rate.toString();
            for (let j = 0; j < this.manufactuerList.length; j++) {
              if (
                this.recordInfo.tableList[i].supply_manufacturer ==
                this.manufactuerList[j].manufacturer_name
              ) {
                this.recordInfo.tableList[i].manufacturer_id =
                  this.manufactuerList[j].id;
              }
              if (
                this.recordInfo.tableList[i].supply_manufacturer ==
                this.manufactuerList[j].id
              ) {
                this.recordInfo.tableList[i].supply_manufacturer =
                  this.manufactuerList[j].manufacturer_name;
              }
            }
          }
          var params = {
            stockIn: this.recordInfo.tableList,
            return_marke: this.return_remark,
          };
          updateGoodReturn(
            params,
            warehouse_out_id,
            this.start_time,
            this.rate_of_concession,
            this.discount_amount,
            this.arrearage,
            this.payment,
            this.supplier_name,
            this.number
          ).then((response) => {
            if (response.data.state == 1) {
              var msg = response.data.msg;
              var orderInfo = response.data.data.list;
              for (let i = 0; i < orderInfo.length; i++) {
                orderInfo[i].id = orderInfo[i].id;
                orderInfo[i].name = orderInfo[i].name;
                orderInfo[i].id = orderInfo[i].id;
                orderInfo[i].supply_count = orderInfo[i].supply_count;
                orderInfo[i].supply_price = orderInfo[i].price;
                orderInfo[i].supply_remake = orderInfo[i].remark;
                orderInfo[i].type = orderInfo[i].is_source;
                orderInfo[i].project_id = orderInfo[i].project_id;
                orderInfo[i].supply_unit = orderInfo[i].supply_unit;
                orderInfo[i].order_number = orderInfo[i].order_number;
                orderInfo[i].good_number = orderInfo[i].good_number;
                orderInfo[i].supply_total_price = (
                  orderInfo[i].supply_count * orderInfo[i].price
                ).toFixed(2);
                orderInfo[i].supply_expiry_date = this.getTimes(
                  orderInfo[i].supply_expiry_date
                );
                orderInfo[i].supply_product_date = this.getTimes(
                  orderInfo[i].supply_product_date
                );
                orderInfo[i].deposit_rate = orderInfo[i].deposit_rate;
                orderInfo[i].count = orderInfo[i].count;
                orderInfo[i].supply_total = orderInfo[i].supply_total;
                orderInfo[i].supply_specification_name =
                  orderInfo[i].supply_specification_name;
              }
              this.recordInfo.tableList = orderInfo;
              this.loading = false;
              this.$message.success("保存成功!");
            }
          });
        }
      });
    },
    checkReturnOrder() {
      this.loading = true;
      var params = {
        warehouse_out_id: this.warehouse_out_id,
        id: this.id,
      };
      //  console.log("审核2322323232323",params)

      checkReturnOrder(params).then((response) => {
        if (response.data.state == 1) {
          this.loading = false;
          var msg = response.data.data.msg;
          if (msg == 1) {
            this.loading = false;
            this.showThree = false;
            this.disabled = true;
            this.is_check = 1;
            this.Reviewed = true;
            this.$message.success("审核成功!");
          }

          if (msg == 2) {
            var good_name = response.data.data.good_name;
            var specification_name = response.data.data.specification_name;
            var str =
              good_name + "*" + specification_name + "库存不足,审核失败!";
            this.$message.error(str);
            this.loading = false;
          }
          if (msg == 3) {
            var drug_name = response.data.data.drug_name;
            var dose = response.data.data.dose;
            var dose_unit = response.data.data.dose_unit;
            var min_number = response.data.data.min_number;
            var min_unit = response.data.data.min_unit;
            var max_unit = response.data.data.max_unit;
            var str =
              drug_name +
              " " +
              dose +
              dose_unit +
              "*" +
              min_number +
              min_unit +
              "/" +
              max_unit;
            this.$message.error(str + "库存不足,审核失败!");
            this.loading = false;
          }
        }
      });
    },
    modefyReturnOrder() {
      this.loading = true;
      var params = {
        warehouse_out_id: this.warehouse_out_id,
        id: this.id,
      };
      modefyReturnOrder(params).then((response) => {
        if (response.data.state == 1) {
          this.loading = false;
          var msg = response.data.data.msg;
          this.$message.success("反审核成功!");
          this.disabled = false;
          this.is_check = 2;
          this.Reviewed = false;
        }
      });
    },
    getSupplyCount(
      supply_count,
      sum_count,
      supply_unit,
      type,
      min_number,
      max_unit,
      min_unit,
      index
    ) {
      //  console.log("val23322323",supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit)
      var total_count = 0;
      console.log(type);
      console.log(sum_count, "可退数量");
      if (type == 1) {
        if (supply_unit == max_unit) {
          total_count = supply_count * min_number;
        }
        if (supply_unit == min_unit) {
          total_count = supply_count;
        }
        if (total_count > sum_count) {
          this.$message.error("数量不能大于可退数量!");
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (index == i) {
              this.recordInfo.tableList[i].supply_count = "";
            }
          }
        } else {
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (index == i) {
              this.recordInfo.tableList[i].supply_count = supply_count;
            }
          }
        }
      }

      if (type == 2) {
        if (supply_count > sum_count) {
          this.$message.error("数量不能大于可退数量!");
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (index == i) {
              this.recordInfo.tableList[i].supply_count = "";
            }
          }
        } else {
          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
            if (index == i) {
              this.recordInfo.tableList[i].supply_count = supply_count;
            }
          }
        }
      }
    },
    toPrint() {
      this.$router.push({ path: "/good/return/print?&id=" + this.id });
    },

    getWarehoseInfoSix(arr, max_unit, min_unit, min_number, warehouse_out_id) {
      var total = 0;
      var max_str = "";
      var min_str = "";
      var newArr = [];
      if (arr.length > 0) {
        for (let i = 0; i < arr.length; i++) {
          if (warehouse_out_id == arr[i].supply_warehouse_id) {
            newArr.push(arr[i]);
          }
        }
      }

      if (newArr.length > 0) {
        for (let i = 0; i < newArr.length; i++) {
          total += parseInt(
            newArr[i].stock_max_number + newArr[i].stock_min_number
          );
        }
      }
      //  console.log("total232323232",total)
      if (total < min_number) {
        min_str = total + min_unit;
      }
      if (total == 0) {
        min_str = "";
        max_str = "";
      }
      if (total >= min_number) {
        if (parseInt(total / min_number) != 0) {
          max_str = parseInt(total / min_number) + max_unit;
        }
        if (total % min_number != 0) {
          min_str = (total % min_number) + min_unit;
        }
      }
      // console.log("hh2332232332",max_str + min_str)
      return max_str + min_str;
    },
    getTotalStockCountSix(arr, warehouse_out_id) {
      var total_count = 0;
      var newArr = [];
      for (let i = 0; i < arr.length; i++) {
        if (arr[i].supply_warehouse_id == warehouse_out_id) {
          newArr.push(arr[i]);
        }
      }
      // console.log("232323232332",newArr)
      if (newArr.length > 0) {
        for (let i = 0; i < newArr.length; i++) {
          total_count += newArr[i].stock_count;
        }
      }
      // console.log("total_count2323223",total_count)
      if (total_count > 0) {
        return total_count;
      } else {
        return "";
      }
    },
  },
  created() {
    const tempObj = {};
    tempObj["id"] = 0;
    tempObj["name"] = "";
    tempObj["supply_name"] = "";
    tempObj["supply_type"] = "";
    tempObj["supply_specification_name"] = "";
    tempObj["supply_total"] = "";
    tempObj["supply_count"] = "";
    tempObj["supply_price"] = "";
    tempObj["supply_total_price"] = "";
    tempObj["supply_manufacturer"] = "";
    tempObj["supply_license_number"] = "";
    tempObj["supply_remake"] = "";
    tempObj["type"] = 0;
    tempObj["is_total"] = 1;
    tempObj["project_id"] = 0;
    tempObj["supply_unit"] = "";
    tempObj["order_number"] = "";
    tempObj["supply_batch_number"] = "";
    tempObj["supply_product_date"] = "";
    tempObj["supply_expiry_date"] = "";
    tempObj["warehousing_id"] = 0;
    tempObj["warehouse_info_id"] = 0;
    tempObj["count"] = "";
    tempObj["good_number"] = "";
    tempObj["min_price"] = "";
    tempObj["deposit_rate"] = "";
    tempObj["sum_count"] = 0;
    tempObj["min_number"] = 0;
    tempObj["max_unit"] = "";
    tempObj["min_unit"] = "";
    this.recordInfo.tableList.push(tempObj);

    this.getInitOrder();
    if (parseInt(this.$route.query.id) > 0) {
      //获取购货单列表
      this.getGoodOrderDetail();
    }
    this.start_time = this.getTimes(new Date());
  },
};
</script>

<style rel="stylesheet/css" lang="scss" scoped>
.reviewImg {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 30%;
}
.information {
  border: 1px #dcdfe6 solid;
  padding: 30px 20px 30px 20px;

  .border {
    border-bottom: 1px #dcdfe6 solid;
    margin: 0px 0 20px 0;
  }
}

.title {
  background: #409eff;
  height: 44px;
  line-height: 44px;
  padding: 0 0 0 10px;
  color: #fff;
  margin: 0 0 10px 0;
}

.edit_separater {
  border-top: 1px solid rgb(233, 233, 233);
  margin-top: 15px;
  margin-bottom: 15px;
}

/deep/ .el-table--scrollable-x .el-table__body-wrapper {
  overflow: auto;
}
/deep/ .gutter {
  width: 15px !important;
  display: inline-block !important;
}
/deep/ .el-table__fixed-right-patch {
  width: 15px !important;
}

/deep/ .el-table__fixed-right {
  bottom: 0 !important;
  left: auto;
  right: 0;
}
/deep/ .el-table__body-wrapper::-webkit-scrollbar {
  width: 15px !important;
  height: 15px !important;
}
</style>

<style>
.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  font-size: 12px;
}

.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  background: #6fb5fa;
}

.count {
  color: #bd2c00;
}
.el-table td,
.el-table th.is-leaf,
.el-table--border,
.el-table--group {
  border-color: #d0d3da;
}
.el-table--border::after,
.el-table--group::after,
.el-table::before {
  background-color: #d0d3da;
}
/* .el-table__fixed-right {
  width: 150px;
  bottom: 20px;
  height: 100%;
}
 */
</style>
