<!-- <!--收购管理新增-->
<template>
  <el-container class="container">
    <!-- <div class="type">{{type}}</div> -->
    <el-header class="header">
      <img class="head-icon" src="../../../public/img/icons/acquisition6.png" alt="">
      <div class="head-title">{{baseInfoForm.warehouseName}}</div>
    </el-header>
    <el-main v-show="isCountShow">
      <el-form ref="baseInfoForm" label-position="left" :model="baseInfoForm" label-width="120px">
        <el-row class="base-info">
          基本信息
        </el-row>
        <div class="row1">
          <div class="grid-content">
            <el-form-item label="货名">
              <el-select v-model="selectVal" placeholder="请选择" @change="goodsChange" :disabled="!isEdit">
                <el-option v-for="item in goodnameList" :key="item.constValue" :label="item.constValue"
                  :value="item.constValue">
                </el-option>
              </el-select>
            </el-form-item>
          </div>
          <div class="grid-content">
            <el-form-item label="基准水分(%)">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.waterBase" @input="changeBaseWater" :disabled="!isEdit"></el-input>
            </el-form-item>
          </div>
          <!-- <div v-if="baseInfoForm.paramType != '1'" class="grid-content"> -->
          <div class="grid-content">
            <el-form-item label="扣重比">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.deductWeight" :disabled="!isEdit"></el-input>
            </el-form-item>
          </div>
          <div class="grid-content">
            <el-form-item label="干粮收购价格（元/公斤）"  label-width="180px">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.dryGrainPrice" :disabled="!isEdit"></el-input>
            </el-form-item>
          </div>
        </div>
        <div class="row2">
          <div class="grid-content">
            <el-form-item label="干粮水分(%)">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.waterMin" @input="changeMinWater" :disabled="!isEdit" id="aaa"></el-input>
            </el-form-item>
          </div>
          <div class="grid-content">
            <el-form-item label="水分上限(%)">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.waterMax" @input="changeMaxWater" :disabled="!isEdit"></el-input>
            </el-form-item>
          </div>
          <div class="grid-content">
            <el-form-item label="销售上限(吨/年)">
              <el-input type="number" @mousewheel.native.prevent v-model="baseInfoForm.saleLimit" :disabled="!isEdit"></el-input>
            </el-form-item>
          </div>
          <div class="grid-content">
            <el-form-item label="参数类型">
              <el-radio-group
                @change="paramTypeChange"
                v-model="baseInfoForm.paramType"
                :disabled="!isEdit"
              >
                <el-radio label="1" >升水扣重</el-radio>
                <el-radio label="2">升水扣钱</el-radio>
              </el-radio-group>
            </el-form-item>
          </div>
          
        </div>
      </el-form>
      <el-row class="row3">
        <div class="top">
          <div class="title">粮价设置</div>
          <el-button v-if="checkList.length<4" class="btn" @click="newSetPrice" :disabled="!isEdit">新增</el-button>
        </div>
        <div class="content" v-for="(item,index) in priceList" :key="index">
          <div class="top">
            <div  class="left">
              <div v-if="baseInfoForm.paramType == '2'"class="text">基准单价（元/公斤）</div>
              <el-input v-if="baseInfoForm.paramType == '2'"type="number" @mousewheel.native.prevent v-model="item.basicUnitPrice" :disabled="!isEdit"></el-input>
            </div>
            <el-button @click="delSetPrice(item,index)" :disabled="!isEdit">删除</el-button>
          </div>
          <div class="level">
            <el-checkbox-group v-model="item.checkList" @change="changeLevel($event,index)">
              <el-checkbox label="一等" :disabled="!isEdit"></el-checkbox>
              <el-checkbox label="二等" :disabled="!isEdit"></el-checkbox>
              <el-checkbox label="三等" :disabled="!isEdit"></el-checkbox>
              <el-checkbox label="等外" :disabled="!isEdit"></el-checkbox>
            </el-checkbox-group>
          </div>
          <div class="count">
            <div class="left">
              <div>水分（%）</div>
              <div v-if="baseInfoForm.paramType == '2'">降幅（元/0.1%）</div>
              <div v-else>扣重比</div>
            </div>
            <div class="right">
              <div class="line"></div>
              <div class="jt-style"></div>

              <div v-for="(item1,index) in item.detailList">
                <div class="item-style">
                  <div v-if="item1.type!=4" class="item-style-title">
                    <span>{{item1.name}}{{item1.index}}</span>
                    <el-button class="add" @click="add(item,item1,index)" v-if="item1.type!=3" :disabled="!isEdit">+
                    </el-button>
                    <el-button class="reduce" @click="reduce(item,item1,index)"
                      v-show="item1.type!=1&&item1.type!=2&&item1.type!=3" :disabled="!isEdit">-</el-button>
                  </div>
                  <div v-show="item1.type!=4">
                    <input v-if='item1.type==1' class="water-price"  :class="item1.isWrite?'white-bgc':''" v-model="baseInfoForm.waterMin"
                      :disabled="item1.isWrite?false:true"></input>
                    <input v-if='item1.type==2' class="water-price"  :class="item1.isWrite?'white-bgc':''" v-model="baseInfoForm.waterBase"
                      :disabled="item1.isWrite?false:true"></input>
                    <input v-if='item1.type==3' class="water-price"  :class="item1.isWrite?'white-bgc':''" v-model="baseInfoForm.waterMax"
                      :disabled="item1.isWrite?false:true"></input>
                    <input v-if='item1.type==5' class="water-price"  :class="item1.isWrite?'white-bgc':''" v-model="item1.water"
                      :disabled="isEdit?false:true"></input>
                  </div>
                  <div class="circle" v-if="item1.type!=4"></div>
                </div>
                <div class="bottom-price">
                  <input v-if="item1.type==4" class="water-price" :class="isEdit?'white-bgc':''" v-model="item1.jfprice" :disabled="!isEdit"></input>
                </div>
              </div>
            </div>
          </div>
        </div>
        <el-button class="submit" @click="submit">{{submitName}}</el-button>
      </el-row>
    </el-main>
    <el-main v-show="!isCountShow">
      <div class="page2-content">
        <div class="titel">
          {{selectVal}}价格对照表（按水分）
        </div>
        <el-table :data="tableData" style="width: 100%" :row-class-name="tableRowClassName">
          <el-table-column prop="waterMin" label="水分下限(%)">
          </el-table-column>
          <el-table-column prop="waterMax" label="水分上限(%)">
          </el-table-column>
          <el-table-column prop="price1" label="一等单价">
          </el-table-column>
          <el-table-column prop="price2" label="二等单价">
          </el-table-column>
          <el-table-column prop="price3" label="三等单价">
          </el-table-column>
          <el-table-column prop="priceOther" label="等外单价">
          </el-table-column>
        </el-table>
      </div>
      <div class="bottom-btn">
        <div v-if="baseInfoForm.status=='审核中'" class="left">当前价格尚未通过审核，建议审核通过后进行打印</div>
        <div class="right">
          <el-button class="submit" @click="closeCount">关闭</el-button>
          <el-button class="submit" @click="print">打印</el-button>
        </div>
      </div>
    </el-main>
  </el-container>
</template>
<script>
  import {
    purchasePriceAdd,
    purchasePriceLook,
    purchasePriceEdit
  } from '@/model/houseSelfCollect/index'
  import {
    packList,
  } from '@/model/contarct/index'
  import {
    posthandle
  } from '@/model/purchasingManagement/index'
  export default {

    components: {

    },
    watch: {

    },
    data() {
      return {
        isShowTip:false,
        price: 0,
        left: [],
        right: [],
        selectVal: '',
        goodnameList: [],
        tableData: [],
        submitName: '提交',
        isCountShow: true,
        priceList: [{
          index: 0,
          checkList: [],
          basicUnitPrice: '',
          detailList: [{
              type: 1,
              name: '干粮',
              water: '',
              isWrite: false
            },
            {
              type: 4,
              jfprice: ''
            },
            {
              type: 2,
              name: '基准',
              water: '',
              isWrite: false
            },
            {
              type: 4,
              jfprice: ''
            },
            {
              type: 3,
              name: '上限',
              water: '',
              isWrite: false
            },
          ],
        }],
        splitPriceList: [],
        baseInfoForm: {
          warehouseId: '',
          warehouseName: '',
          compId: '',
          goodsNameKey: '',
          goodsName: '',
          waterBase: '',
          deductWeight: '',
          waterMin: '',
          waterMax: '',
          saleLimit: '',
          statusFlag: '',
          status: '',
          workflowId: '',
          approveStatus: '',
          passDate: '',
          dryGrainPrice: '',
          details: [],
          detailPrints: []
        },
        index: 0,
        type: '',
        isEdit: true,
        isSHowNewBtn: true,
        checkList: [],
        checkList1: [],
        checkList2: [],
        checkList3: [],
        checkList4: []
      }
    },
    activated() {
      // 货名
      let _goodsNameList = []
      _goodsNameList = this.$route.query.goodsNameList
      if (_goodsNameList == undefined) {
        _goodsNameList = []
      }
      packList({
          constId: 'CON2'
        })
        .toPromise()
        .then((response) => {
          let _list = []
          for (let i = 0; i < response.length; i++) {
            let _isAll = true
            for (let j = 0; j < _goodsNameList.length; j++) {
              if (response[i].constValue != _goodsNameList[j]) {
                if (j == _goodsNameList.length - 1 && _isAll) {
                  _list.push(response[i])
                }
              } else {
                _isAll = false
              }
            }
          }
          if (_goodsNameList.length == 0) {
            this.goodnameList = response
            this.selectVal = response[0].constValue
          } else {
            this.goodnameList = _list
            if (_list.length != 0) {
              this.selectVal = _list[0].constValue
            }
          }
        })
      this.isCountShow = true
     
      switch (this.$route.query.type) {
        case '新增':
          this.submitName = '提交'
          this.isCountShow = true
          this.checkList=[]
          this.baseInfoForm = {
            warehouseId: '',
            warehouseName: '',
            compId: '',
            goodsNameKey: '',
            goodsName: '',
            waterBase: '',
            deductWeight: '',
            waterMin: '',
            waterMax: '',
            saleLimit: 2000,
            statusFlag: '',
            status: '',
            workflowId: '',
            approveStatus: '',
            passDate: '',
            dryGrainPrice: '',
            details: [],
            detailPrints: [],
            paramType:'1'
          }
          this.baseInfoForm.warehouseId = this.$route.query.warehouseId
          this.baseInfoForm.warehouseName = this.$route.query.warehouseName
          this.baseInfoForm.compId = this.$route.query.compId
          this.type = this.$route.query.type

          this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
          this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
          this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
          this.isEdit = true
          this.priceList = [{
            index: 0,
            checkList: [],
            basicUnitPrice: '',
            detailList: [{
                type: 1,
                name: '干粮',
                water: '',
                isWrite: false
              },
              {
                type: 4,
                jfprice: ''
              },
              {
                type: 2,
                name: '基准',
                water: '',
                isWrite: false
              },
              {
                type: 4,
                jfprice: ''
              },
              {
                type: 3,
                name: '上限',
                water: '',
                isWrite: false
              },
            ],
          }]
          break;
        case '编辑':
          this.isEdit = true;
          this.submitName = '提交'
          this.getData()
          break;
        case '审核中':
          this.isEdit = true;
          this.submitName = '通过'
          this.getData()
          break;
        case '查看':
          this.isEdit = false;
          this.submitName = '计算'
          this.getData()
          break;
        default:
          break
      }
    },
    mounted() {},
    methods: {
      paramTypeChange(e){
        // this.makeTableList()
      },
      // 查看/编辑获取数据
      getData() {
        this.type = this.$route.query.type
        this.baseInfoForm = JSON.parse(this.$route.query.data)
        purchasePriceLook({
          id: this.baseInfoForm.id
        }).toPromise().then((response) => {
          this.baseInfoForm = response
          //构造查看priceList数据
          this.priceList = []
          this.makeLookPriceList()
          if(this.$route.query.type != '新增'){
               let _data = this.priceList
              this.checkList1 = []
              this.checkList2 = []
              this.checkList3 = []
              this.checkList4 = []
              for (let i = 0; i < _data.length; i++) {
                if (i == 0) this.checkList1 = _data[i].checkList
                if (i == 1) this.checkList2 = _data[i].checkList
                if (i == 2) this.checkList3 = _data[i].checkList
                if (i == 3) this.checkList4 = _data[i].checkList
              }
               this.checkList = [...new Set([...this.checkList1, ...this.checkList2, ...this.checkList3, ...this.checkList4])]
          }
        })
      },
      goodsChange(e) {
        
      },
      changeBaseWater(val) {
        for (let i = 0; i < this.priceList.length; i++) {
          for (let k = 0; k < this.priceList[i].detailList.length; k++) {
            if (this.priceList[i].detailList[k].type == 2) {
              this.priceList[i].detailList[k].water = val
            }
          }
        }
      },
      changeMinWater(val) {
        for (let i = 0; i < this.priceList.length; i++) {
          for (let k = 0; k < this.priceList[i].detailList.length; k++) {
            if (this.priceList[i].detailList[k].type == 1) {
              this.priceList[i].detailList[k].water = val
            }
          }
        }
      },
      changeMaxWater(val) {
        for (let i = 0; i < this.priceList.length; i++) {
          for (let k = 0; k < this.priceList[i].detailList.length; k++) {
            if (this.priceList[i].detailList[k].type == 3) {
              this.priceList[i].detailList[k].water = val
            }
          }
        }
      },
      // 设置表格颜色
      tableRowClassName({
        row,
        rowIndex
      }) {
        if ((rowIndex + 1) % 2 === 0) {
          return 'double';
        } else {
          return 'single';
        }
      },
      getRowClass({
        rowIndex
      }) {
        if (rowIndex == 0) {
          return 'background:#ebeaef'
        } else {
          return ''
        }
        //   return '';
      },
      // 增加分界
      add(item, item1, index) {
        // let _data = this.detailList;
        if (item.index > 2) {
          this.$message({
            message: '最多插入3个分界值',
            type: 'warning'
          });
        } else {
          item.index++
          item.detailList.splice(index + 1, 0, {
            name: '分界',
            water: '',
            type: 5,
            index: 1,
            isWrite: true
          });
          item.detailList.splice(index + 1, 0, {
            jfprice: '',
            type: 4
          });
          this.makeSpliceIndex(item, item1, index)
        }
      },
      // 减少分界
      reduce(item, item1, index) {
        item.index--
        item.detailList.splice(index, 2);
      },
      // 设置分界索引排序
      makeSpliceIndex(item, item1) {
        let _index = 0
        for (let j = 0; j < item.detailList.length; j++) {
          if (item.detailList[j].type == 5) {
            _index++
            item.detailList[j].index = _index;
          }
        }
      },
      // 复选框变化监听
      changeLevel(val, index) {
        let _data = this.priceList
        
        this.checkList1 = []
        this.checkList2 = []
        this.checkList3 = []
        this.checkList4 = []
        for (let i = 0; i < _data.length; i++) {
          let _childData = _data[i].checkList
          for (let k = 0; k < _childData.length; k++) {
            for (let j = 0; j < val.length; j++) {
              if (val[j] == _childData[k] && i != index) {
                _childData.splice(k, 1)
              }
            }
          }
          if (i == 0) this.checkList1 = _data[i].checkList
          if (i == 1) this.checkList2 = _data[i].checkList
          if (i == 2) this.checkList3 = _data[i].checkList
          if (i == 3) this.checkList4 = _data[i].checkList
        }
        this.checkList = [...new Set([...this.checkList1, ...this.checkList2, ...this.checkList3, ...this.checkList4])]
      },
      // 算价格纠正精度不准
      accMul(arg1, arg2) {
        var m = 0,
          s1 = arg1.toString(),
          s2 = arg2.toString();
        try {
          m += s1.split('.')[1].length
        } catch (e) {}
        try {
          m += s2.split('.')[1].length
        } catch (e) {}
        return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
      },
      //保留两位小数
      keepTwoDecimal(num) {
        var result = parseFloat(num);
        if (isNaN(result)) {
          return false;
        }
        result = Math.round(result * 10000) / 10000;
        return result;
      },
      //保留两位小数
      keepOneDecimal(num) {
        var result = parseFloat(num);
        if (isNaN(result)) {
          return false;
        }
        result = Math.round(result * 100) / 100;
        return result;
      },
      // 添加粮价设置
      newSetPrice() {
        let _newObj = {
          index: 0,
          checkList: [],
          detailList: [{
              type: 1,
              name: '干粮',
              water: this.baseInfoForm.waterMin,
              isWrite: false
            },
            {
              type: 4,
              jfprice: ''
            },
            {
              type: 2,
              name: '基准',
              water: this.baseInfoForm.waterBase,
              isWrite: false
            },
            {
              type: 4,
              jfprice: ''
            },
            {
              type: 3,
              name: '上限',
              water: this.baseInfoForm.waterMax,
              isWrite: false
            },
          ],
        }
        this.priceList.push(_newObj)
      },
      // 删除价格组
      delSetPrice(item, index) {
        let that = this
        this.checkList1 = []
        this.checkList2 = []
        this.checkList3 = []
        this.checkList4 = []
        for (let i = 0; i < item.checkList.length; i++) {
          for (let j = 0; j < this.checkList.length; j++) {
            if (item.checkList[i] == this.checkList[j]) {
              this.checkList.splice(j, 1)
            }
          }
        }
        this.$confirm(
            '确认删除本组设置？',
            '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning',
            }
          )
          .then(() => {
            if (that.priceList.length == 1) {
              that.$message({
                message: '至少保留一组粮价设置',
                type: 'warning'
              });
            } else {
              that.priceList.splice(index, 1)
              that.baseInfoForm.details.split(index, 1)
            }
          })
          .catch(() => {
            return false
          })
      },
      //构造新增价格数据
      makePriceDataList() {
        for (let k = 0; k < this.priceList.length; k++) {
          // 新增
          let _detailsObj = {
            compId: this.baseInfoForm.warehouseId,
            basePrice: this.priceList[k].basicUnitPrice,
            level: '',
            point: '',
            pointPrice: ''
          }
          for (let j = 0; j < this.priceList[k].checkList.length; j++) {
            if (j == 0) {
              _detailsObj.level += this.priceList[k].checkList[j]
            } else {
              _detailsObj.level += ',' + this.priceList[k].checkList[j]
            }
          }
          let _index = 0
          let _index1 = 0
          for (let i = 0; i < this.priceList[k].detailList.length; i++) {
            if (this.priceList[k].detailList[i].type == 4) {
              if (_index == 0) {
                _index++
                _detailsObj.pointPrice += this.priceList[k].detailList[i].jfprice

              } else {
                _detailsObj.pointPrice += ',' + this.priceList[k].detailList[i].jfprice
              }
            } else if (_index1 == 0) {
              _index1++
              _detailsObj.point += this.priceList[k].detailList[i].water
            } else {
              _detailsObj.point += ',' + this.priceList[k].detailList[i].water
            }
          }
          this.baseInfoForm.details.push(_detailsObj)

        }
      },
      //打印
      print() {
        localStorage.setItem('pricePrintList', JSON.stringify(this.baseInfoForm.detailPrints));
        window.open('../../../static/print.html?name=' + this.baseInfoForm.goodsName)
      },
      validate() {
        let that = this

        function _baseWaterValidate(min, max, saveNum, point, type, inputVal) {
          let _val1 = inputVal
          let _pointVal1 = _val1.toString().split('.')[1]
          if (_pointVal1 == undefined) _pointVal1 = 0
          if (typeof(_pointVal1) == 'string') _pointVal1 = _pointVal1.length
          let _tobeVal1 = _val1 % point
          if (type == 'waterBase') {
            if (_val1 <= max && _val1 >= min && _pointVal1 <= saveNum ) {
              return false
            }
          }
          if (type == 'deductWeight') {
            if (_val1 <= max && _val1 >= min && _pointVal1 <= saveNum) {
              return false
            }
          }
          if (type == 'saleLimit') {
            if (_val1 <= max && _val1 >= min) {
              // Number.isInteger(that.baseInfoForm.saleLimit)
              return false
            }
          }
          return true
        }
        if (this.baseInfoForm.waterBase == '' || _baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this
            .baseInfoForm.waterBase))) {
          if (_baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this.baseInfoForm.waterBase))) {
            that.$message.error('水分基准输入错误,最多保留1位小数，基准水分须可被0.1整除！');
          } else {
            this.$message.error('基准水分不能为空！');
          }
          return false
        }
        if(this.baseInfoForm.paramType == '2'){
          if (this.baseInfoForm.deductWeight == '' || _baseWaterValidate(0, 3, 2, '', 'deductWeight', parseFloat(this
              .baseInfoForm.deductWeight))) {
            if (_baseWaterValidate(0, 3, 2, '', 'deductWeight', parseFloat(this.baseInfoForm.deductWeight))) {
              that.$message.error('扣重比输入错误！');
            } else {
              this.$message.error('扣重比不能为空！');
            }
            return false
          }
        }
        if (this.baseInfoForm.dryGrainPrice == '' || _baseWaterValidate(0, 1000, 4, '', 'deductWeight', parseFloat(this
            .baseInfoForm.dryGrainPrice))) {
          if (_baseWaterValidate(0, 1000, 4, '', 'deductWeight', parseFloat(this.baseInfoForm.dryGrainPrice))) {
            that.$message.error('干粮收购价输入错误！');
          } else {
            this.$message.error('干粮收购价格不能为空！');
          }
          return false
        }

        if (this.baseInfoForm.waterMin == '' || _baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this
            .baseInfoForm.waterMin))) {
          if (this.baseInfoForm.waterMin == '') {
            this.$message.error('干粮水分不能为空！')
          }
          if (_baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this.baseInfoForm.waterMin))) {
            that.$message.error('干粮水分输入错误,最多保留1位小数，干粮水分须可被0.1整除！')
          }
          return false
        }
        if (Number(this.baseInfoForm.waterBase)>Number(this.baseInfoForm.waterMax)) {
            this.$message.error('基准水分须小于水分上限！')
          return false
        }
        
        if (Number(this.baseInfoForm.waterMin)>Number(this.baseInfoForm.waterBase)) {
            this.$message.error('干粮水分须小于基准水分！')
          return false
        }

        if (this.baseInfoForm.waterMax == '' || _baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this
            .baseInfoForm.waterMax))) {
          if (_baseWaterValidate(1, 100, 1, 0.1, 'waterBase', parseFloat(this.baseInfoForm.waterMax))) {
            that.$message.error('水分上限输入错误,最多保留1位小数，干粮水分须可被0.1整除！');
          } else {
            this.$message.error('水分上限不能为空！');
          }
          return false
        }
        if (this.baseInfoForm.saleLimit == '' || _baseWaterValidate(100, 100000, '', '', 'saleLimit', parseFloat(this
            .baseInfoForm.saleLimit))) {
          if (_baseWaterValidate(100, 100000, '', '', 'saleLimit', parseFloat(this.baseInfoForm.saleLimit))) {
            that.$message.error('销售上限输入错误!');
          } else {
            that.$message.error('销售上限不能为空！');
          }
          return false
        }
        if (this.checkList.length != 4) {
          this.$message.error('粮价设置为4个等级！');
          return false
        }
        for (let i = 0; i < this.priceList.length; i++) {
          let _item = this.priceList[i]
          if (this.baseInfoForm.paramType == '2' &&(_item.basicUnitPrice == '' || _baseWaterValidate(0, 50, 8, '', 'deductWeight', parseFloat(_item
              .basicUnitPrice)))) {
            if (_item.basicUnitPrice == '') {
              that.$message.error('基准单价不能为空！');
            } else {
              that.$message.error('基准单价输入错误,0-50数字最多保留两位小数！');
            }
            return false
          }
          if (_item.checkList.length == 0) {
            this.$message.error('等级不能为空！');
            return false
          }
          var arr = []
          for (let j = 0; j < _item.detailList.length; j++) {
            let _item1 = _item.detailList[j]
            if (_item1.type == 4) {
              if (_item1.jfprice == '' || _baseWaterValidate(0, 100, 8, '', 'deductWeight', parseFloat(_item1
                  .jfprice))) {
                if (_item1.jfprice == '') {
                  if(this.baseInfoForm.paramType == '1'){
                    that.$message.error('扣重比不能为空！');
                  }
                  else{
                    that.$message.error('降幅价格不能为空！');
                  }
                } else {
                  if(this.baseInfoForm.paramType == '1'){
                    that.$message.error('扣重比输入错误！');
                  }
                  else{
                    that.$message.error('降幅输入错误！');
                  }
                }
                return false
              }
            } else {
              if (_item1.water == '' || _baseWaterValidate(0, 100, 1, 0.1, 'waterBase', parseFloat(_item1.water))) {
                if (_item1.water == '') {
                  that.$message.error('分界水分不能为空！')
                } else {
                  that.$message.error('分界值输入错误！');
                }
                return false
              }
              arr.push(_item1.water)
            }
          }
          if(!this.isIncrease(arr,arr.length)){
            that.$message.error('水分大小排序错误！');
            return false
          }
        }
        return true
      },
      getEditCheckList() {
        let _data = this.baseInfoForm.details
        let _list = []
        for (let k = 0; k < _data.length; k++) {
          let _list1 = []
          _list1 = _data[k].level.split(',')
          _list = _list.concat(_list1)
        }
        this.checkList = [...new Set(_list)];
        console.log(this.checkList)
      },
      isIncrease(arr,len){
        if(len == 1){
          return true
        }
        return (arr[len - 2] <= arr[len - 1]) && this.isIncrease(arr,len - 1)
      },
      // 提交
      submit() {
          let isValidate = false
          isValidate = this.validate()
         
        if (isValidate) {
          debugger
          this.makeTableList()
          this.baseInfoForm.details = []
          this.makePriceDataList()
          this.baseInfoForm.goodsName = this.selectVal
          switch (this.$route.query.type) {
            case '查看':
              this.isCountShow = false;
              break;
            case '新增':
              isValidate = this.validate()
              if (isValidate) {
                purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
                  // this.tableData = response.records
                  this.isCountShow = false
                })
              }
              break;
            case '编辑':
              this.getEditCheckList()
              isValidate = this.validate()
              if (isValidate) {
                purchasePriceEdit(this.baseInfoForm).toPromise().then((response) => {
                  this.isCountShow = false
                })
              }
              break;
            case '审核中':
              // this.makePriceDataList()
              this.getEditCheckList()
              isValidate = this.validate()
              if (isValidate) {
                let that = this
                this.$confirm(`是否确定通过？`, {
                  cancelButtonText: '取消',
                  confirmButtonText: '确定',
                  type: 'warning',
                }).then(() => {
                  purchasePriceEdit(this.baseInfoForm).toPromise().then((response) => {
                    //审核
                    that.audit(this.baseInfoForm, true, 2)
                  })
                })
                
              }
              break;
          }
       }
      },
      //审核
      audit(item, status, status2) {
        posthandle({
            taskId: item.taskId,
            approved: status,
            auditMind: '',
            needReapply: status2 != undefined ? true : false,
          })
          .toPromise()
          .then((response) => {
            this.isCountShow = false
            this.isShowTip = true
             this.getData()
          })
          .catch((req) => {
            this.$message.warning(req.message)
          })
      },
      // 关闭
      closeCount() {
        this.isCountShow = true
        this.splitPriceList = []
        this.$router.push({
          name: 'acquisitionManagement',
        })
      },
      //处理价格表格数据
      makeTableList() {
        // 获取等级对应分界钱数
        this.getSplitPrice()
        // 构造表格等差数列
        let _list = []
        let _obj = {}
        let _waterMin = parseFloat(this.baseInfoForm.waterMin)
        let _waterMax = parseFloat(this.baseInfoForm.waterBase)
        let _count = Number(((_waterMax - _waterMin) / 0.1).toFixed(0)) 
        if(this.baseInfoForm.paramType == '2'){
          for (let i = 0; i < _count; i++) {
            // if (i == 0) {
            //   _waterMax -= 0.1
            // } 
            // else {
            //   _waterMax -= 0.5
            // }
            _waterMax -= 0.1
            let priceList = this.calculatePrice(this.keepOneDecimal(_waterMax ))
            
            _obj = {
              waterMin: this.keepOneDecimal(_waterMax ),
              waterMax: this.keepOneDecimal(_waterMax + 0.09),
              price1: this.keepTwoDecimal(priceList[0]),
              price2: this.keepTwoDecimal(priceList[1]),
              price3: this.keepTwoDecimal(priceList[2]),
              priceOther: this.keepTwoDecimal(priceList[3]),
            }
            _list.unshift(_obj)
          }
          _obj = {}
          _waterMin = parseFloat(this.baseInfoForm.waterBase)
          _waterMax = parseFloat(this.baseInfoForm.waterMax)
          _count = Number(((_waterMax - _waterMin) / 0.1).toFixed(0))
          for (let i = 0; i < _count; i++) {
            // if (i == 0) {
            //   _waterMin += 0.4
            // } else {
            //   _waterMin += 0.5
            // }
            if (i != 0) {
              _waterMin += 0.1
            }
            
            let priceList = this.calculatePriceRight(this.keepOneDecimal(_waterMin ))
            _obj = {
              waterMin: this.keepOneDecimal(_waterMin ),
              waterMax: this.keepOneDecimal(_waterMin + 0.09),
              price1: this.keepTwoDecimal(priceList[0]),
              price2: this.keepTwoDecimal(priceList[1]),
              price3: this.keepTwoDecimal(priceList[2]),
              priceOther: this.keepTwoDecimal(priceList[3]),
            }
            _list.push(_obj)
            console.log('_list', _list)

          }
        }
        else{
          _obj = {}
          _waterMin = parseFloat(this.baseInfoForm.waterMin)
          _waterMax = parseFloat(this.baseInfoForm.waterMax)
          _count = (_waterMax - _waterMin) / 0.1
          for (let i = 0; i < _count; i++) {
            // if (i == 0) {
            //   _waterMin += 0.4
            // } else {
            //   _waterMin += 0.5
            // }
            if (i != 0) {
              _waterMin += 0.1
            }
            
            let priceList = this.calculatePriceRight(this.keepOneDecimal(_waterMin ))
            _obj = {
              waterMin: this.keepOneDecimal(_waterMin ),
              waterMax: this.keepOneDecimal(_waterMin + 0.09),
              price1: this.keepTwoDecimal(priceList[0]),
              price2: this.keepTwoDecimal(priceList[1]),
              price3: this.keepTwoDecimal(priceList[2]),
              priceOther: this.keepTwoDecimal(priceList[3]),
            }
            _list.push(_obj)
            console.log('_list', _list)

          }
        }
        this.baseInfoForm.detailPrints = _list
        this.tableData = _list
      },
      // 获取分界价格数据，构造分界价格区间数据
      getSplitPrice() {
        let that = this;
        this.left = []
        this.right = []
        let _priceList = this.priceList;
        for (let i = 0; i < _priceList.length; i++) {
          for (let k = 0; k < _priceList[i].checkList.length; k++) {
            let _leftObj = {}
            _leftObj.level = _priceList[i].checkList[k]
            _leftObj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
            _leftObj.priceList = []
            _leftObj.haveSplit = false

            let _rightObj = {}
            _rightObj.level = _priceList[i].checkList[k]
            _rightObj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
            _rightObj.priceList = []
            _rightObj.haveSplit = false

            //获取基准在x轴索引

          let index = 0
          for(;index<_priceList[i].detailList.length;index++){
              if(_priceList[i].detailList[index].water==that.baseInfoForm.waterBase){
                break
            }
          }
           console.log(index)
          for (let j = index; j >= 0; j--) {
              if (_priceList[i].detailList[j] && _priceList[i].detailList[j].type != 4) {
                if (_priceList[i].detailList[j].type != 1) {
                  let baseprice = ''
                  if(this.baseInfoForm.paramType == '1'){
                    if (j == index) {
                      baseprice = parseFloat(_priceList[i].basicUnitPrice)
                    } else {
                      baseprice = parseFloat(parseFloat(_priceList[i].basicUnitPrice) + (parseFloat(_priceList[i].detailList[j + 2]
                        .water) - parseFloat(_priceList[i].detailList[j].water)) / 0.1 * (this.baseInfoForm.dryGrainPrice * (parseFloat(_priceList[i].detailList[j].water) 
                              - parseFloat(_priceList[i].detailList[j - 2].water))*parseFloat(_priceList[i].detailList[j - 1].jfprice)/100/((parseFloat(_priceList[i].detailList[j].water) 
                              - parseFloat(_priceList[i].detailList[j - 2].water))/0.1)))
                    }
                    _leftObj.priceList.push({
                      index: j,
                      priceStart: parseFloat(_priceList[i].detailList[j].water),
                      priceEnd: parseFloat(_priceList[i].detailList[j - 2].water),
                      type: parseFloat(_priceList[i].detailList[j].type),
                      water: _priceList[i].detailList[j].water,
                      jfprice: parseFloat(this.baseInfoForm.dryGrainPrice * (parseFloat(_priceList[i].detailList[j].water) 
                              - parseFloat(_priceList[i].detailList[j - 2].water))*parseFloat(_priceList[i].detailList[j - 1].jfprice)/100/((parseFloat(_priceList[i].detailList[j].water) 
                              - parseFloat(_priceList[i].detailList[j - 2].water))/0.1)),
                      baseprice: baseprice,
                      price: (parseFloat(_priceList[i].detailList[j].water) - parseFloat(_priceList[i].detailList[j -
                        2].water)) / 0.1 * parseFloat(_priceList[i].detailList[j - 1].jfprice)
                    })
                  }
                  else{
                    if (j == index) {
                      baseprice = parseFloat(_priceList[i].basicUnitPrice)
                    } else {
                      baseprice = parseFloat(parseFloat(_priceList[i].basicUnitPrice) + (parseFloat(_priceList[i].detailList[j + 2]
                        .water) - parseFloat(_priceList[i].detailList[j].water)) / 0.1 * parseFloat(_priceList[i]
                        .detailList[j + 1].jfprice))
                    }
                    _leftObj.priceList.push({
                      index: j,
                      priceStart: parseFloat(_priceList[i].detailList[j].water),
                      priceEnd: parseFloat(_priceList[i].detailList[j - 2].water),
                      type: parseFloat(_priceList[i].detailList[j].type),
                      water: _priceList[i].detailList[j].water,
                      jfprice: parseFloat(_priceList[i].detailList[j - 1].jfprice),
                      baseprice: baseprice,
                      price: (parseFloat(_priceList[i].detailList[j].water) - parseFloat(_priceList[i].detailList[j -
                        2].water)) / 0.1 * parseFloat(_priceList[i].detailList[j - 1].jfprice)
                    })
                  }
                  
                }
              }
            }
          
            // for (let j = (_priceList[i].detailList.length + 1) / 2 - 1; j > 0; j--) {
            //   if (_priceList[i].detailList[j] && _priceList[i].detailList[j].type != 4) {
            //     if (_priceList[i].detailList[j].type != 1) {
            //       let baseprice = ""
            //       if (j == (_priceList[i].detailList.length + 1) / 2 - 1) {
            //         baseprice = parseFloat(_priceList[i].basicUnitPrice)
            //       } else {
            //         baseprice = parseFloat(_priceList[i].basicUnitPrice + (parseFloat(_priceList[i].detailList[j + 2]
            //           .water) - parseFloat(_priceList[i].detailList[j].water)) / 0.5 * parseFloat(_priceList[i]
            //           .detailList[j + 1].jfprice))
            //       }
            //       _leftObj.priceList.push({
            //         index: j,
            //         priceStart: parseFloat(_priceList[i].detailList[j].water),
            //         priceEnd: parseFloat(_priceList[i].detailList[j - 2].water),
            //         type: parseFloat(_priceList[i].detailList[j].type),
            //         water: _priceList[i].detailList[j].water,
            //         jfprice: parseFloat(_priceList[i].detailList[j - 1].jfprice),
            //         baseprice: baseprice,
            //         price: (parseFloat(_priceList[i].detailList[j].water) - parseFloat(_priceList[i].detailList[j -
            //           2].water)) / 0.5 * parseFloat(_priceList[i].detailList[j - 1].jfprice)
            //       })
            //     }
            //   }
            // }
            this.left.push(_leftObj)
            console.log('this.left', this.left)
            if(this.baseInfoForm.paramType == '2'){
              for (let k = index; k <= _priceList[i].detailList.length; k++) {
                if (_priceList[i].detailList[k] && _priceList[i].detailList[k].type != 4) {
                  if (_priceList[i].detailList[k].type != 3) {
                    let baseprice = ''
                    if (k == index) {
                        baseprice = parseFloat(_priceList[i].basicUnitPrice)
                    } else {
                        baseprice = parseFloat(parseFloat(_priceList[i].basicUnitPrice) - (parseFloat(_priceList[i].detailList[k]
                          .water) - parseFloat(_priceList[i].detailList[k - 2].water)) / 0.1 * parseFloat(_priceList[i]
                          .detailList[k - 1].jfprice))
                    }
                    _rightObj.priceList.push({
                      index: k,
                      priceStart: parseFloat(_priceList[i].detailList[k].water),
                      priceEnd: parseFloat(_priceList[i].detailList[k + 2].water),
                      type: parseFloat(_priceList[i].detailList[k].type),
                      water: _priceList[i].detailList[k].water,
                      jfprice: parseFloat(_priceList[i].detailList[k + 1].jfprice),
                      baseprice: baseprice,
                      price: (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                        k].water)) / 0.1 * parseFloat(_priceList[i].detailList[k + 1].jfprice)
                    })
                  }
                }
              }
            }
            else{
              for (let k = 0; k <= _priceList[i].detailList.length; k++) {
                if (_priceList[i].detailList[k] && _priceList[i].detailList[k].type != 4) {
                  if (_priceList[i].detailList[k].type != 3) {
                    let baseprice = ''
                    if (k == 0) {
                        baseprice = parseFloat(this.baseInfoForm.dryGrainPrice)
                    } else {
                      var waterCount = 0
                      for(var p=0;p<_rightObj.priceList.length;p++){
                        waterCount += (_rightObj.priceList[p].priceEnd - _rightObj.priceList[p].priceStart)*_rightObj.priceList[p].param/100
                      }
                      baseprice = parseFloat(parseFloat(this.baseInfoForm.dryGrainPrice) * ( 1- waterCount))
                    }
                    _rightObj.priceList.push({
                      index: k,
                      priceStart: parseFloat(_priceList[i].detailList[k].water),
                      priceEnd: parseFloat(_priceList[i].detailList[k + 2].water),
                      type: parseFloat(_priceList[i].detailList[k].type),
                      water: _priceList[i].detailList[k].water,
                      param:_priceList[i].detailList[k + 1].jfprice,
                      jfprice: parseFloat(this.baseInfoForm.dryGrainPrice * (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                        k].water))*parseFloat(_priceList[i].detailList[k + 1].jfprice)/100/((parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                        k].water))/0.1)),
                      baseprice: baseprice,
                      price: (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                        k].water)) / 0.1 * parseFloat(_priceList[i].detailList[k + 1].jfprice)
                    })
                  }
                }
              }
            }

            // for (let k = (_priceList[i].detailList.length + 1) / 2 - 1; k <= _priceList[i].detailList.length; k++) {
            //   if (_priceList[i].detailList[k] && _priceList[i].detailList[k].type != 4) {
            //     if (_priceList[i].detailList[k].type != 3) {
            //       let baseprice = ""
            //       if (k == (_priceList[i].detailList.length + 1) / 2 - 1) {
            //         baseprice = parseFloat(_priceList[i].basicUnitPrice)
            //       } else {
            //         baseprice = parseFloat(_priceList[i].basicUnitPrice - (parseFloat(_priceList[i].detailList[k]
            //           .water) - parseFloat(_priceList[i].detailList[k - 2].water)) / 0.5 * parseFloat(_priceList[i]
            //           .detailList[k - 1].jfprice))
            //       }
            //       _rightObj.priceList.push({
            //         index: k,
            //         priceStart: parseFloat(_priceList[i].detailList[k].water),
            //         priceEnd: parseFloat(_priceList[i].detailList[k + 2].water),
            //         type: parseFloat(_priceList[i].detailList[k].type),
            //         water: _priceList[i].detailList[k].water,
            //         jfprice: parseFloat(_priceList[i].detailList[k + 1].jfprice),
            //         baseprice: baseprice,
            //         price: (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
            //           k].water)) / 0.5 * parseFloat(_priceList[i].detailList[k + 1].jfprice)
            //       })
            //     }
            //   }
            // }
            this.right.push(_rightObj)
            console.log('this.right', this.right)
          }
        }
      },
      // 获取当前价格左右价格区间数据
      getOtherPrice(list, water, direction) {},
      calculatePriceRight(_waterMax) {
        //获取每个分界值
        let _listResult = []
        for (let i = 0; i < this.right.length; i++) {
          let _list = this.right[i].priceList
          let tmp = ''
          for (let k = 0; k < _list.length; k++) {
            if (_waterMax < _list[k].priceEnd && _waterMax >= _list[k].priceStart) {
              tmp = parseFloat(_list[k].baseprice - _list[k].jfprice * (((_waterMax) - _list[k].priceStart) / 0.1))
            }
          }
          _listResult.push(tmp)
        }
        return _listResult
      },
      // 计算价格
      calculatePrice(_waterMax) {
        let _listResult = []
        for (let i = 0; i < this.left.length; i++) {
          let _list = this.left[i].priceList
          let tmp = ''
          for (let k = 0; k < _list.length; k++) {
            if (_waterMax >= _list[k].priceEnd && _waterMax < _list[k].priceStart) {
              tmp = parseFloat(_list[k].baseprice + _list[k].jfprice * ((_list[k].priceStart - (_waterMax )) / 0.1))
            }
          }
          _listResult.push(tmp)
        }
        return _listResult
      },
      // 构造查看粮价设置数据
      makeLookPriceList() {
        this.selectVal = this.baseInfoForm.goodsName
        let _priceList = this.baseInfoForm.details
        let _checkList = []
        let _detailList = []
        let _pointPrice = []
        let _basePrice = 0
        for (let i = 0; i < _priceList.length; i++) {
          _checkList = _priceList[i].level.split(',')
          _detailList = _priceList[i].point.split(',')
          _pointPrice = _priceList[i].pointPrice.split(',')
          let _newDetailList = []
          for (let k = 0; k < _detailList.length; k++) {
            let _obj = {}
            if (_detailList[k] == this.baseInfoForm.waterMin) {
              _obj = {
                type: 1,
                name: '干粮',
                water: _detailList[k],
                isWrite: false
              }

            } else if (_detailList[k] == this.baseInfoForm.waterMax) {
              _obj = {
                type: 3,
                name: '上限',
                water: _detailList[k],
                isWrite: false
              }
            } else if (_detailList[k] == this.baseInfoForm.waterBase) {
              _obj = {
                type: 2,
                name: '基准',
                water: _detailList[k],
                isWrite: false
              }
            } else {
              _obj = {
                name: '分界',
                water: _detailList[k],
                type: 5,
                index: k,
                isWrite: true
              }

            }
            _newDetailList.push(_obj)
            if (k != _detailList.length - 1) {
              _newDetailList.push({
                type: 4,
                jfprice: _pointPrice[k]
              })
            }
          }
          let _obj = {
            basicUnitPrice: _priceList[i].basePrice,
            index: i,
            checkList: _checkList,
            detailList: _newDetailList
          }
          this.priceList.push(_obj)
        }
      }
    },
  }
</script>
<style lang="scss">
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }

  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #5878E8;
    border-color: #5878E8;
  }

  .el-checkbox__input.is-checked+.el-checkbox__label {
    color: #5878E8;
  }

  .el-checkbox.is-bordered.is-checked {
    border-color: #5878E8;
  }

  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #5878E8;
  }

  .basic-container {
    overflow: auto;
  }

  .container {
    padding: 20px
  }

  /deep/.el-header {
    padding: 0;
  }

  .header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #E9ECF7;
    padding-bottom: 10px;
    width: 100%;

    .head-icon {
      width: 19px;
      height: 19px;
      margin-right: 10px;
    }

    .head-title {
      font-size: 21px;
      font-weight: 600;
      color: #323233;
    }
  }

  .row1,
  .row2 {
    // background: red;
    display: flex;
    // margin-right: 20px;
  }

  .row3 {
    .top {
      display: flex;

      .btn {
        width: 52px;
        height: 24px;
        background: #5878E8;
        color: white;
        margin-left: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        // text-align: center;
      }
    }

    .title {
      display: flex;
      align-items: center;
      border-left: 4px solid #5473E8;
      font-size: 16px;
      font-weight: 600;
      color: #323233;
      padding-left: 10px;
    }
  }

  .base-info {
    border-left: 4px solid #5473E8;
    font-size: 16px;
    font-weight: 600;
    color: #323233;
    padding-left: 10px;
    margin: 24px 0 10px 0;
  }

  .grid-content {
    margin-right: 20px;
  }

  .content {
    border: 1px solid #D8DCE6;
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;

    .top {
      display: flex;
      justify-content: space-between;

      .left {
        display: flex;
        align-items: center;

        .text {
          width: 220px;
          font-size: 14px;
          font-weight: 400;
          color: #8890B1;
        }
      }
    }

    .level {
      margin: 10px 0;
    }

    .count {
      display: flex;
      margin-bottom: 15px;

      .left {
        width: 10%;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-end;
        line-height: 24px;
      }

      .right {
        width: 85%;
        position: relative;
        padding-bottom: 50px;

        .water-price {
          width: 60px;
          height: 30px;
          background: #F6F7FB;
          border-radius: 4px;
          border: 1px solid #D8DCE6;
          text-align: center
        }

        .add,
        .reduce {
          width: 16px;
          height: 16px;
          background: #5473E8;
          border-radius: 2px;
          color: white;
          background: #5473E8;
          border-radius: 2px;
          color: white;
          padding: 0 !important;
          display: inline-flex;
          justify-content: center;
          align-items: center;
          font-size: 14px;
        }

        .reduce {
          background: white;
          color: #D5D8DE;
          border: 1px solid #D5D8DE;
          display: inline-flex;
          justify-content: center;
          align-items: center;
        }

        .item-style {
          position: relative;

          .item-style-title {
            margin-bottom: 10px;
            text-align: center;
          }
        }

        .line {
          position: absolute;
          top: 72px;
          width: 100%;
          height: 5px;
          background: linear-gradient(39deg, #E6EEFF 0%, #91B0F5 42%, #5878E8 100%);
          border-radius: 3px;
        }

        .bottom-price {
          position: absolute;
          bottom: -10px;
        }

        .jt-style {
          position: absolute;
          top: 64px;
          width: 0px;
          height: 0px;
          right: -15px;
          border-left: 15px solid #5473E8;
          border-top: 10px solid transparent;
          border-bottom: 10px solid transparent;
        }

        display: flex;
        justify-content: space-between;

        .circle {
          position: absolute;
          z-index: 2;
          width: 15px;
          height: 15px;
          background: #FFFFFF;
          border: 3px solid #5473E8;
          border-radius: 50%;
          right: 40%;
          bottom: -22px
        }

      }
    }
  }

  .submit {
    float: right;
    width: 74px;
    height: 32px;
    background: #5473E8;
    color: white;
    border-radius: 4px;
  }

  .page2-content {
    border: 1px solid #D8DCE6;
    margin-top: 20px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
    border-radius: 4px;
    padding-bottom: 20px;
  }

  .titel {
    font-size: 20px;
    font-weight: 500;
    color: #323233;
    margin: 20px;
  }

  .type {
    font-size: 16px;
    font-weight: 500;
    color: #262626;
  }

  .double {
    background: #FEFBF6 !important;
  }

  .single {
    background: #F7FBFF !important;
  }

  .bottom-btn {
    display: flex;

    .left {
      color: red;
    }

    margin: 20px 0;
    justify-content: space-around;
    align-items: center;
  }
  .white-bgc{
    background: white!important;
  }
  #aaa::selection{
    // background: red;
  }
</style>
