<template>
  <div style="background-color:#f7f7f7;padding:10px 10px;">
    <div class="zhuti" v-if="ggXin == false && detbox==false && genjinShow==false && tanpanShow ==false">
      <div style="height:58px;line-height:58px;">
        <div style="color:#0006"> <span>商户意向管理</span> <span style="padding:0 5px;">></span> <span
            style="color:#000000e6">寻租申请管理</span></div>
      </div>
      <div>
        <!-- 搜索 -->
        <div class="formSearch">
          <el-form :inline="true" :model="formSel">
            <el-form-item label="意向客户名称">
              <el-input v-model="formSel.intentCustomerName" placeholder="请输入" class="moren" style="width:168px" />
            </el-form-item>
            <el-form-item label="意向资源类型">
              <el-select v-model="formSel.leaseType" placeholder="请选择" style="width:168px">
                <el-option label="商铺" value="商铺" />
                <el-option label="广告位" value="广告位" />
                <el-option label="场地" value="场地" />
              </el-select>
            </el-form-item>

          </el-form>
          <div style="width: 18%;">
            <el-button style="background-color: #3F9B6A;color: #fff" @click="onSubmit">查询
            </el-button>
            <el-button class="buttonHover" style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;"
              @click="resetting">重置
            </el-button>
          </div>

        </div>
        <div style="margin-bottom:20px;">
          <el-button style="background-color: #3F9B6A;color: #fff;padding:8px 15px;" icon="el-icon-circle-plus-outline"
            @click="addbuss">新增</el-button>
        </div>
        <!-- 表格 -->
        <el-table :data="
            tableData.slice(
              (currentPage - 1) * pageSize,
              currentPage * pageSize
            )
          " :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}">
          <el-table-column label="序号" min-width="80">
            <template slot-scope="scope">
              {{scope.$index+1}}
            </template>
          </el-table-column>
          <el-table-column label="意向客户名称" prop="intentCustomerName" min-width="150" />
          <el-table-column label="手机号" prop="phone" min-width="180" />
          <el-table-column label="意向租赁类型" prop="leaseType" min-width="120" />
          <el-table-column label="意向租赁周期" prop="leaseCycle" min-width="120" />
          <el-table-column label="意向租金(月)" prop="rentalRent" min-width="120" />
          <el-table-column label="意向区域" prop="intentionRegion" min-width="120" />
<el-table-column label="审核状态" min-width="120">
            <template slot-scope="scope">
              {{scope.row.auditStatus == 1?'已通过':scope.row.auditStatus == 2?'未通过':'待审核'}}
            </template>
          </el-table-column>
          <el-table-column label="操作" min-width="270" fixed="right">
            <template slot-scope="scope">
              <div class="tableBtn greens" @click="handleEditForm(scope.row)">
                查看
              </div>
              <div class="tableBtn greens" @click="bianjilist(scope.row)">
                编辑
              </div>
              <!-- v-if="scope.row.auditStatus =='1'" -->
              <div class="tableBtn greens" @click="delGuan(scope.row)">
                删除
              </div>
              <!--  <div class="tableBtn greens" @click="chehui(scope.row)" v-if="scope.row.auditStatus =='2'">
                撤回
              </div>
              <div class="tableBtn greens" @click="getshen(scope.row)" v-if="scope.row.auditStatus =='1'">
                提交审核
              </div> -->
              <div class="tableBtn greens" @click="shengRenwu(scope.row)">
                跟进日志
              </div>
              <div class="tableBtn greens" @click="tanRenwu(scope.row)">
                谈判日志
              </div>
              <!-- <div class="tableBtn greens" @click="pipei(scope.row)" v-if="scope.row.auditStatus =='1'">
                一键匹配
              </div> -->
            </template>
          </el-table-column>
        </el-table>
        <!-- <div class="fenye">
          <el-pagination class="pagination" :hide-on-single-page="flag" background small :current-page="currentPage"
            layout="prev, pager, next,total" :total="total" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
        </div> -->
        <div style="display: flex;justify-content: space-between;" class="bom">
          <div style="font-size: 14px;">共 <span style="color: #3F9B6A;">{{total}}</span> 条</div>
          <el-pagination :current-page="currentPage" :page-sizes="[10, 20, 50, 100]"
            background small layout="prev, pager, next" :total="total" @size-change="handleSizeChange"
            @current-change="handleCurrentChange">
          </el-pagination>
        </div>
      </div>
    </div>

    <!-- 一键匹配 -->
    <el-dialog :visible.sync="pip" custom-class="tongyong_css" style="padding: 0" width="55%" center
      :close-on-click-modal="false" class="dialog_css_Xq">
      <div style="
              background-color: #fafafa;
              border: 1px solid #eaeaea;
              height: 42px;
              width: 100%;
              padding: 0 20px;
              line-height: 42px;
            ">
        匹配记录
      </div>
      <div style="padding: 0 20px">
        <div style="
                display: flex;
                justify-content: space-between;
                font-size: 14px;

              ">
          <el-form ref="form" :inline="true" :model="pipeiSel" style="padding-top: 10px;">
            <el-form-item label="意向资源类型">
              <el-select v-model="pipeiSel.resources.cereRentalPolicies.businessType" placeholder="请选择"
                style="width:168px">
                <el-option label="商铺" value="sp" />
                <el-option label="广告位" value="gg" />
                <el-option label="场地" value="cd" />
              </el-select>

            </el-form-item>
            <el-form-item label="租期">
              <el-select v-model="pipeiSel.resources.cereRentalPolicies.leaseTerm" style="width:168px">
                <el-option label="年" value="年" />
                <el-option label="月" value="月" />
                <el-option label="日" value="日" />
              </el-select>
            </el-form-item>
            <el-form-item label="租金范围">
              <el-select v-model="pipeiSel.resources.cereRentalPolicies.rentalPrice" placeholder="请选择"
                style="width:168px">
                <el-option label="0-10000" value="0-10000" />
                <el-option label="10000-20000" value="10000-20000" />
                <el-option label="20000-50000" value="20000-50000" />
                <el-option label="50000-100000" value="50000-100000" />
              </el-select>
            </el-form-item>
          </el-form>
          <div style="
                    padding-top: 15px;
                  ">
            <el-button style="background-color: #3F9B6A;color: #fff" @click="pipeiBtn">查询</el-button>
            <el-button class="buttonHover" style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;"
              @click="pipeiClose">重置</el-button>
          </div>
        </div>
        <!-- <div style="margin-bottom:20px;">
              <el-button style="background-color: #3F9B6A;color: #fff"
              >导出</el-button>
            </div> -->
        <el-table :data="
                pipData.slice(
                  (currentPage - 1) * pageSize,
                  currentPage * pageSize
                )
              " :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}">
          <el-table-column label="序号" min-width="80">
            <template slot-scope="scope">
              {{scope.$index+1}}
            </template>
          </el-table-column>
          <el-table-column label="资源名称" prop="intentCustomerName" min-width="150" />
          <el-table-column label="编号" prop="resourcesId" min-width="150" />
          <el-table-column label="意向资源类型" prop="shopName" min-width="150" />
          <el-table-column label="最近释放日期" prop="businessStartTime" min-width="150" />
          <el-table-column label="最短租期" prop="contactInformation" min-width="150" />
          <el-table-column label="意向租金单价(元/平方)" prop="contactInformation" min-width="250" />
          <el-table-column prop="auditStatus" label="资源状态" min-width="150">
            <template slot-scope="scope">

            </template>
          </el-table-column>

        </el-table>
      </div>
    </el-dialog>

    <!-- 查看 -->
    <div class="zhuti" v-if='detbox'>
      <div style="height:58px;line-height:58px;">
        <div style="color:#0006"> <span>商户寻租管理</span> <span style="padding:0 5px;">></span> <span
            style="color:#000000e6">查看</span></div>
      </div>

      <div style="margin-top: 30px;" class="editcss">
        <TitleWithCircle title="意向信息"></TitleWithCircle>
        <div style="padding: 20px;">
          <el-form :model="secondData" ref="ruleForm" label-width="150px" class="demo-ruleForm">
            <el-row :gutter="20">
              <el-col :span="12">



                <el-form-item label="意向租赁类型" prop="leaseType">
                  <div class="duiqi">{{secondData.leaseType}}</div>

                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="意向租赁周期" prop="leaseCycle">
                  <div class="duiqi">{{secondData.leaseCycle}}</div>

                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="意向租金(月)" prop="rentalRent">
                  <div class="duiqi">{{secondData.rentalRent}}</div>

                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="意向经营类型" prop="operationType">
                  <div class="duiqi">{{secondData.operationType}}</div>

                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="意向区域" prop="intentionRegion">
                  <div class="duiqi">{{secondData.intentionRegion}}</div>
                </el-form-item>
              </el-col>

            </el-row>
            <TitleWithCircle title="商家信息"></TitleWithCircle>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="姓名" prop="intentCustomerName">
                  <div class="duiqi">{{secondData.intentCustomerName}}</div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="手机号" prop="phone">
                  <div class="duiqi">{{secondData.phone}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证号码" prop="idCardNumber">
                  <div class="duiqi">{{secondData.idCardNumber}}</div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="身份证有效期">
                  <div class="duiqi">{{secondData.idCardValidStart}}-{{secondData.idCardValidEnd}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证照片(正面)" prop="idCardPhotoFront">
                  <div style="display: flex;">
                    <allimg :src="secondData.idCardPhotoFront" fit="contain"
                      style="width: 112px;height: 112px;border: 1px dotted #dcdfe6;border-radius: 2px;overflow: hidden;margin: 0 10px 10px 0;" />
                  </div>
                  <!-- {{idCardPhotoFront}} -->
                  <!-- <el-image :src="$baseURL +secondData.idCardPhotoFront" style="width:140px;height:140px;"></el-image> -->
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证照片(反面)" prop="idCardPhotoBack">
                  <div style="display: flex;">
                    <allimg :src="secondData.idCardPhotoBack" fit="contain"
                      style="width: 112px;height: 112px;border: 1px dotted #dcdfe6;border-radius: 2px;overflow: hidden;margin: 0 10px 10px 0;" />
                  </div>
                  <!-- idCardPhotoBack -->
                  <!-- <el-image :src="$baseURL +secondData.idCardPhotoBack" style="width:140px;height:140px;"></el-image> -->
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
      <el-row :gutter="20">
        <el-col :span="12">
          <div style="padding-left:160px;">
            <el-button class="buttonHover" style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;"
              @click="detbox = false">取消</el-button>
          </div>

        </el-col>
      </el-row>
    </div>
    <!-- 新增 -->
    <div class="zhuti" v-if="ggXin">
      <div style="height:58px;line-height:58px;">
        <div style="color:#0006"> <span>商户寻租管理</span> <span style="padding:0 5px;">></span> <span
            style="color:#000000e6">{{edit?'新增':'编辑'}}</span></div>
      </div>
      <div style="margin-top: 30px;">
        <TitleWithCircle title="意向信息"></TitleWithCircle>
        <div style="padding: 20px 20px 20px 0;">
          <el-form ref="AddFromOne" :model="ruleForm" :rules="rulesOne" label-width="150px">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="意向租赁类型" prop="leaseType">
                  <el-select v-model="ruleForm.leaseType" placeholder="请选择" style="width:100%">
                    <el-option label="商铺" value="商铺" />
                    <el-option label="场地" value="场地" />
                    <el-option label="广告位" value="广告位" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="意向租赁周期" prop="leaseCycle">
                  <el-input v-model="ruleForm.leaseCycle" placeholder="请输入" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="意向租金(月)" prop="rentalRent" :rules="getCoordinateRules('rentalRent')">
                  <el-input v-model.number="ruleForm.rentalRent" placeholder="请输入" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="意向经营类型" prop="operationType">
                  <el-input v-model="ruleForm.operationType" placeholder="请输入" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="意向区域" prop="intentionRegion">
                  <el-input v-model="ruleForm.intentionRegion" placeholder="请输入" />

                </el-form-item>
              </el-col>
            </el-row>
            <TitleWithCircle title="商家信息"></TitleWithCircle>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="姓名" prop="intentCustomerName">
                  <el-input v-model="ruleForm.intentCustomerName" placeholder="请输入" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="手机号" prop="phone">
                  <el-input v-model.number="ruleForm.phone" placeholder="请输入" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证号码" prop="idCardNumber">
                  <el-input v-model="ruleForm.idCardNumber" placeholder="请输入" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="身份证有效期" prop="idCardValidStart">
                  <el-date-picker v-model="ruleForm.idTime" type="daterange" range-separator="至"
                    start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd" style="width:100%"
                    @change="idCardchange" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证照片(正面)" prop="idCardPhotoFront">
                  <upimg filePath="yixiang" inputtype="idCardPhotoFront" :value="ruleForm.idCardPhotoFront"
                    @changimg="e=>changimg(e,'idCardPhotoFront')" :limit="1"></upimg>

                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证照片(反面)" prop="idCardPhotoBack">
                  <upimg filePath="yixiang" inputtype="idCardPhotoBack" :value="ruleForm.idCardPhotoBack"
                    @changimg="e=>changimg(e,'idCardPhotoBack')" :limit="1"></upimg>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item>
                  <div style="margin-top: 20px">
					  <el-button class="buttonHover"
					    style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="closeFn">取
					    消</el-button>
                    <el-button style="background-color: #3F9B6A;color: #fff" @click="addCheck">确 定</el-button>
                    

                  </div>

                </el-form-item>
              </el-col>
            </el-row>

          </el-form>
        </div>
      </div>
    </div>
    <genjin v-if="genjinShow" @cancel="cancel" :message="genjinId"></genjin>
    <tanpan v-if="tanpanShow" @cancel="tancel" :message="genjinId"></tanpan>
  </div>
</template>

<script>
  import {
    uploadUrl,
    token
  } from '@/utils/request'
  import {
    rsaManAll,
    rsaManAdd,
    rsaManEdit,
    rsaManDel,
    ziyuanduiy,
  } from '../../../api/rsaManagement'
  import {
    icManAdd,
  } from '../../../api/icManagement';
  import {
    genAdd,
  } from '../../../api/followup.js'
  import {
    getAlls
  } from '../../../api/information.js'
  import {
    getAlls as map1
  } from '../../../api/map1'
  import upimg from "@/components/ImageUpload/index"
  import TitleWithCircle from '@/components/top/index';
  import genjin from './genjin';
  import tanpan from './tanpan';
  import allimg from '@/components/chakan/allimg.vue';
  export default {
    components: {
      upimg,
      TitleWithCircle,
      genjin,
      tanpan,
      allimg
    },

    data() {
      return {
        detbox: false, // 详情
        edit: true, // 编辑
        addMing: false, //资源
        selshop: [], //意向资源列表
        action: uploadUrl, // 上传图片
        myHeaders: {
          'Authorization-admin': token
        },
        ggXin: false, // 新增
        sel: [], // 选择资源
        stepNum: 0, // 切换
        formSel: {
          intentCustomerName: '',
          leaseType: '',
          pageNumber: 0,
          pageSize: 10,
		  auditStatus:'1'
        },
        ruleForm: {
          intentCustomerName: '', //意向客户名称
          leaseType: '', //租赁类型
          leaseCycle: '', //租赁周期
          rentalRent: null, //意向租金
          operationType: '', //经营类型
          intentionRegion: '', //意向区域
          idCardNumber: '', //身份证号
          idCardType: '', //证件类型
          phone: null, //手机号
          idTime: [],
          idCardValidStart: '', //身份证有效开始时间
          idCardValidEnd: '', //身份证有效结束时间
          idCardPhotoFront: '', //身份证照片(正面)
          idCardPhotoBack: '', //身份证照片(反面)
          source: 0
        },

        secondData: {},
        currentPage: 1,
        total: 0,
        flag: false,
        pageSize: 10,
        tableData: [],
        pageindex: {
          pageNumber: 0,
          pageSize: 10,
		  auditStatus:'1'
        },
        ziyuanData: [],
        multipleSelection: [],
        pip: false,
        pipData: [],
        pipeiSel: {
          resources: {
            cereRentalPolicies: {
              businessType: '',
              leaseTerm: '',
              rentalPrice: ''
            }
          },
          pageNumber: 0,
          pageSize: 10,
        },

        rulesOne: {

          intentCustomerName: [{
            required: true,
            message: '请输入姓名',
            trigger: 'blur'
          }, ],
          leaseType: [{
            required: true,
            message: '请选择租赁类型',
            trigger: 'change'
          }],
          leaseCycle: [{
            required: true,
            message: '请输入租赁周期',
            trigger: 'blur'
          }, ],
          // rentalRent: [{
          //   required: true,
          //   message: '请输入意向租金(月)',
          //   trigger: 'blur'
          // }, ],
          operationType: [{
            required: true,
            message: '请输入经营类型',
            trigger: 'blur'
          }, ],
          intentionRegion: [{
            required: true,
            message: '请输入意向区域',
            trigger: 'blur'
          }, ],
          idCardNumber: [{
            required: true,
            message: '请输入身份证号',
            trigger: 'blur'
          }, ],
          phone: [{
            required: true,
            message: '请输入手机号',
            trigger: 'blur'
          }, {
            pattern: /^[0-9]+$/,
            message: '手机号只能包含数字',
            trigger: 'blur',
          }],
          idCardValidStart: [{
            required: true,
            message: '请选择身份证有效时间',
            trigger: 'change'
          }, ],
          idCardPhotoFront: [{
            required: true,
            message: '请输入身份证照片(正面)',
            trigger: 'change'
          }, ],
          idCardPhotoBack: [{
            required: true,
            message: '请选择身份证照片(反面)',
            trigger: 'change'
          }, ],
        },
        genjinId: '',
        genjinShow: false,
        tanpanShow: false,
      }
    },

    created() {
      this.getAll();
    },
    mounted() {},
    // beforeDestroy() {
    //   const editor = this.editor
    //   if (editor == null) return
    //   editor.destroy() // 组件销毁时，及时销毁编辑器
    // },
    methods: {
      getCoordinateRules(coord) {
        return [{
            required: true,
            message: `意向租金不能为空且必须是数字`,
            trigger: 'blur'
          },
          {
            pattern: /^(\d+|\d*\.\d{1,10})$/,
            message: `意向租金为整数或最多三位小数,`,
            trigger: 'blur'
          },

        ]
      },
      changimg(e, type) {
        this.ruleForm[type] = e
      },
      // 获取当前时间
      updateCurrentTime() {
        const now = new Date();
        const year = now.getFullYear();
        const month = (now.getMonth() + 1).toString().padStart(2, '0');
        const day = now.getDate().toString().padStart(2, '0');
        const hours = now.getHours().toString().padStart(2, '0');
        const minutes = now.getMinutes().toString().padStart(2, '0');
        const seconds = now.getSeconds().toString().padStart(2, '0');

        return `${year}-${month}-${day} ${hours}:${minutes}`;
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      lextStep(val) {
        if (val == 0) {
          this.stepNum = this.stepNum - 1;
        } else {
          this.stepNum = this.stepNum + 1;
        }
      },
      // 查询全数据
      async getAll() {
        const res = await rsaManAll(this.pageindex);
        this.tableData = res.data.content;
        this.total = res.data.content.length
        const ziyuan = await getAlls(this.pageindex)
        const ggw = await map1(this.pageindex)
        this.ziyuanData = [...ziyuan.data.content, ...ggw.data.content]
      },
      // 编辑确认
      async msgeditS() {
        await rsaManEdit(this.ruleForm);
        this.ggXin = false
        this.getAll()
      },
      // 编辑
      bianjilist(item) {
        this.ruleForm = item
        this.ruleForm.idTime = []
        this.ruleForm.idTime[0] = item.idCardValidStart
        this.ruleForm.idTime[1] = item.idCardValidEnd
        if (this.edit) {
          this.edit = false
        }
        this.ggXin = true
      },
      async chehui(item) {
        await rsaManEdit({
          id: item.id,
          auditStatus: '1'
        })
        this.getAll()
      },
      async getshen(item) {
        await rsaManEdit({
          id: item.id,
          auditStatus: '2'
        })
        this.getAll()
      },


      // 详情点击
      handleEditForm(item) {
        this.secondData = item
        this.detbox = true
      },
      // 新增
      addbuss() {
        this.ruleForm = {
          intentCustomerName: '', //意向客户名称
          leaseType: '', //租赁类型
          leaseCycle: '', //租赁周期
          rentalRent: null, //意向租金
          operationType: '', //经营类型
          intentionRegion: '', //意向区域
          idCardNumber: '', //身份证号
          idCardType: '', //证件类型
          phone: null, //手机号
          idTime: [],
          idCardValidStart: '', //身份证有效开始时间
          idCardValidEnd: '', //身份证有效结束时间
          idCardPhotoFront: '', //身份证照片(正面)
          idCardPhotoBack: '', //身份证照片(反面)
          source: 0
        }
        this.edit = true
        this.ggXin = true
        this.getAll();
      },
      idCardchange(e) {

        this.ruleForm.idCardValidStart = e[0]
        this.ruleForm.idCardValidEnd = e[1]

      },
      // 新增确定
      addCheck() {

        this.$refs.AddFromOne.validate((valid) => {
          if (valid) {
            if (this.edit) {
              rsaManAdd(this.ruleForm).then(res => {
                icManAdd(this.ruleForm).then(res => {
                  this.$message({
                    message: '保存成功',
                    type: 'success'
                  })
                  this.getAll();
                  this.ggXin = false
                  this.$refs.AddFrom.resetFields()
                })

              })
            } else {
              rsaManEdit(this.ruleForm).then(res => {
                this.$message({
                  message: '修改成功',
                  type: 'success'
                })
                this.getAll();
                this.ggXin = false
                this.$refs.AddFrom.resetFields()
              })
            }

          } else {
            this.$message({
              message: '请填写完整信息',
              type: 'error'
            })

          }
        })
      },
      handleCurrentChange(val) {
        this.currentPage = val;
      },
      handleSizeChange(val) {
        this.pageSize = val;
      },
      // 取消
      closeFn(val) {
        this.getAll()
        this.ggXin = false;

      },
      //删除管理列表
      async delGuan(item) {
        const h = this.$createElement;
        this.$msgbox({
          title: '消息',
          message: h('p', null, [
            h('span', null, '是否删除 '),
          ]),
          showCancelButton: true,
          showClose: false,
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          customClass: 'oe-dialog-btn',
          beforeClose: (action, instance, done) => {
            if (action === 'confirm') {
              rsaManDel({
                id: item.id
              }).then(res => {
                this.$message({
                  message: '删除成功',
                  type: 'success'
                })
                this.getAll()
                done();
              })
            } else {
              done();
            }
          }
        })

      },

      // 重置按钮
      resetting() {
        this.formSel = {
          intentCustomerName: '',
          leaseType: '',
          pageNumber: 0,
          pageSize: 10,
		  auditStatus:'1'
        }
        this.currentPage = 1
        this.getAll()
      },
      // 查询
      async onSubmit() {
        const res = await rsaManAll(this.formSel)
        this.currentPage = 1
        this.tableData = res.data.content
        this.total = res.data.content.length
      },
      mingClose() {
        this.multipleSelection = []
        this.addMing = false

      },
      minSev() {
        this.selshop = this.multipleSelection
        this.addMing = false
        this.multipleSelection = []
      },
      pipei(item) {
        this.pip = true
        this.pipData = []
      },
      shengRenwu(item) {
        this.genjinId = item.id
        this.genjinShow = true
        // genAdd({
        //   potentialCustomer: item.id,
        //   status: '1'
        // }).then(res => {
        //   this.$message({
        //     message: '生成成功',
        //     type: 'success'
        //   })
        // })

      },
      tanRenwu(item) {
        this.genjinId = item.id
        this.tanpanShow = true
      },
      pipeiBtn() {
        if (this.pipeiSel.resources.cereRentalPolicies.businessType == 'sp') {
          this.pipeiSel.resourcesId = 'sp'
        } else if (this.pipeiSel.resources.cereRentalPolicies.businessType == 'cd') {
          this.pipeiSel.resourcesId = 'cd'
        } else {
          this.pipeiSel.resourcesId = 'gg'
        }
        ziyuanduiy(this.pipeiSel).then(res => {
          this.pipData = res.data.content
        })
      },
      pipeiClose() {
        this.pipeiSel = {
            resources: {
              cereRentalPolicies: {
                businessType: '',
                leaseTerm: '',
                rentalPrice: ''
              }
            },
            resourcesId: '',
            pageNumber: 1,
            pageSize: 10,
          },
          this.pipData = []
      },
      cancel(e) {
        this.genjinShow = e
        this.getAll()
      },
      tancel(e) {
        this.tanpanShow = e
        this.getAll()
      },
    }
  }
</script>
<style scoped>
  .zhuti {
    padding: 0 20px 20px 20px;
    min-height: calc(100vh - 50px - 20px);
    background-color: #Fff;

  }
  .chengeXia {
    border-bottom: 6px solid #3F9B6A;
    padding-bottom: 4px;
    color: #3F9B6A;
  }


  .formSearch {
    display: flex;
    width: 100%;
    font-size: 14px;
    justify-content: space-between;
  }
  .greens {
    color: #3F9B6A;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }

  .bg-purple {
    background: #d3dce6;
  }

  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

</style>
<style lang="scss" scoped>
  ::v-deep .el-dialog__body {
    padding: 0 0 !important;
  }
  .el-dialog__header{
    padding: 0;
    display: none;
  }
</style>
