<template>
  <div class="">
    <div class="header-title">
      <span class="header-title-return-back" @click="returnClick"><van-icon name="arrow-left" /></span>
      <div class="header-title-name-search">查商机</div>
    </div>
    <div v-if="!isGetResult" class="search-result-box">
      <div class="more-screen-content-right">
        <div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">企业注册地址区域</div>
              <div class="select-slider-show"></div>
            </div>
            <div>
              <van-field v-model="businessInformation.region" is-link readonly placeholder="选择城市"
                @click="showAddressPicker = true" />
              <van-popup v-model:show="showAddressPicker" round position="bottom">
                <van-picker show-toolbar :columns="areaList" cancel-button-text="取消" @cancel="onRegionCancel"
                  @confirm="onRegionConfirm" />
              </van-popup>
            </div>
          </div>
          <div class="divider-box">
            <div class="divider-line"></div>
            <div class="divider-title">客户情况</div>
            <div class="divider-line"></div>
          </div>

          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">是否我行开户</div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li
                v-for=" (businessAbnormalitiesItem, businessAbnormalitiesIndex) in businessInformation.universalUnlimitedList "
                @click="openingAnAccountWithOurBankSelect(businessAbnormalitiesItem)"
                :class="[businessInformation.openingAnAccountWithOurBank == businessAbnormalitiesItem ? 'select-item-active' : '']"
                :key="businessAbnormalitiesItem" class="select-item">{{ businessAbnormalitiesItem }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">是否我行有贷</div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li
                v-for=" (businessAbnormalitiesItem, businessAbnormalitiesIndex) in businessInformation.universalUnlimitedList "
                @click="ourBankHasLoanSelect(businessAbnormalitiesItem)"
                :class="[businessInformation.ourBankHasLoan == businessAbnormalitiesItem ? 'select-item-active' : '']"
                :key="businessAbnormalitiesItem" class="select-item">{{ businessAbnormalitiesItem }}
              </li>
            </ul>
          </div>

          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">是否有联系方式</div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li
                v-for=" (businessAbnormalitiesItem, businessAbnormalitiesIndex) in businessInformation.universalUnlimitedList "
                @click="contactInfoSelect(businessAbnormalitiesItem)"
                :class="[businessInformation.contactInfo == businessAbnormalitiesItem ? 'select-item-active' : '']"
                :key="businessAbnormalitiesItem" class="select-item">{{ businessAbnormalitiesItem }}
              </li>
            </ul>
          </div>
        </div>
        <div class="divider-box">
          <div class="divider-line"></div>
          <div class="divider-title">企业商机</div>
          <div class="divider-line"></div>
        </div>
        <div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2" @click="businessTopDialog()">全部商机<van-icon name="question-o ml-10" /></div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.businessTopList "
                @click="multipleChoiceFiltering('businessTop', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}

              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">经营扩张需求</div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.businessExpansionList "
                @click="multipleChoiceFiltering('businessExpansion', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">企业信贷需求</div>
              <div class="select-slider-show"></div>
            </div>
            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.corporateCreditList "
                @click="multipleChoiceFiltering('corporateCredit', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">法人资金需求</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.corporateFundsList "
                @click="multipleChoiceFiltering('corporateFunds', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">企业优质客户</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.highQualityCustomList "
                @click="multipleChoiceFiltering('highQualityCustom', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>



          <div class="divider-box">
            <div class="divider-line"></div>
            <div class="divider-title">个体工商户商机</div>
            <div class="divider-line"></div>
          </div>


          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2" @click="businessBottomDialog()">全部商机<van-icon name="question-o ml-10" /></div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.businessBottomList "
                @click="multipleChoiceFiltering('businessBottom', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">商户经营扩张需求</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.merchantBusinessExpansionList "
                @click="multipleChoiceFiltering('merchantBusinessExpansion', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">商户信贷需求</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.merchantCreditDemandList "
                @click="multipleChoiceFiltering('merchantCreditDemand', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">商户消费需求</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box">
              <li v-for=" (item, index) in businessInformation.merchantConsumptionList "
                @click="multipleChoiceFiltering('merchantConsumption', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>
          <div class="more-screen-content-cell">
            <div class="more-title-box">
              <div class="more-title-h2">商户价值</div>
              <div class="select-slider-show"></div>
            </div>

            <ul class="select-item-box mb-50">
              <li v-for=" (item, index) in businessInformation.merchantValueList "
                @click="multipleChoiceFiltering('merchantValue', index)"
                :class="[item.isSelect ? 'select-item-active' : '']" :key="item.title" class="select-item">{{ item.title
                }}
              </li>
            </ul>
          </div>


        </div>
      </div>
      <van-row class="more-screen-bottom-botton" gutter="16">
        <van-col span="12"><van-button type="primary" size="small" plain block
            @click="moreScreenCancel()">重置</van-button></van-col>
        <van-col span="12"><van-button type="primary" size="small" block @click="moreScreenOk()">确定</van-button></van-col>
      </van-row>
    </div>
    <div v-else>
      <div v-if="pageLoading == true">
        <ul class="company-box" v-if="searchResultList.length > 0">
          <div class="search-btn-box">
            <div>共检索 <span class="color-2372eb"> {{ totalDatas > 999 ? '999+' : totalDatas }} </span>条数据</div>
            <div class="search-right-btn-box">
              <div @click="positiveTime()" v-if="timeShow"><van-icon name="descending" />发布时间</div>
              <div @click="flashbackTime()" v-if="!timeShow" class="icon_blur"><van-icon name="descending" />发布时间</div>
              <div @click="prioritySort()" class="ml-10 " v-if="sortShow"><van-icon name="descending" />优先级</div>
              <div @click="flashbackSort()" class="ml-10 icon_blur" v-if="!sortShow"><van-icon name="descending"
                  class="" />优先级</div>
              <van-icon @click="priorityDialogIsShow = true" name="question-o" />
            </div>
          </div>
          <li class="company-item" v-for="(resultItem, resultIndex) in searchResultList" :key="resultItem.companyName">
            <div class="company-item-right-title-box">
              <div class="company-item-right-title">
                {{ resultItem.class2nd }}
                <span class="company-item-right-small-title">{{ resultItem.opportRuleEdate }}</span>
              </div>
              <div>
                <van-tag round class="mr-6" color="#fce9e9" text-color="#db2f2f">优先级：{{ resultItem.opportPriority
                }}</van-tag>
              </div>
            </div>
            <div class="mb-10">
              <van-tag class="mr-6" color="#e8f1fd" text-color="#2372eb" v-for="(item, index) in resultItem.opportLabel"
                :key="index">{{ item }}</van-tag>
            </div>

            <div class="company-middle-item">
              <div class="company-item-left bg-2372eb" v-if="resultItem.colorNum == 1">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-ee8c15" v-else-if="resultItem.colorNum == 2">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-11c95f" v-else-if="resultItem.colorNum == 3">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-e21183" v-else-if="resultItem.colorNum == 4">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-fde809" v-else-if="resultItem.colorNum == 5">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-17b9d7" v-else-if="resultItem.colorNum == 6">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-db2c2c" v-else-if="resultItem.colorNum == 7">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-9232db" v-else-if="resultItem.colorNum == 8">
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-left bg-8c8c8c" v-else>
                <img name="wap-home" src="../../../images/part_one/icon_company.png" alt="">
              </div>
              <div class="company-item-right">
                <div class="mb-10" style="font-weight: bold">{{ resultItem.entName }}</div>
                <div class="mb-10">统一信用码：{{ resultItem.uniscid }}</div>
              </div>
            </div>
            <div class="mb-10">
              <van-tag
                style="width: 100%;text-align: center;display: block;text-align: center;padding: 6px;font-size: 14px"
                color="#f2f3f5" text-color="#666666">商机说明：{{ resultItem.busiDesc }}</van-tag>
            </div>

            <div class="company-item-bottom-btn-box">
              <!-- <div @click="guanzhuShow(resultIndex)" class="company-item-bottom-btn"><van-icon class="color-2372eb"
                  name="star-o" /> 加关注</div> -->
              <div class="fs-15 fw-bold cl-blue concern company-item-bottom-btn"
                @click="guanzhuShow(resultItem, resultIndex)">
                <van-icon class="mg-rt-5" :name="resultItem.attentionFlag == true ? 'star' : 'star-o'" />{{
                  resultItem.attentionFlag == true ?
                  '已关注' :
                  '关注' }}
              </div>
              <div class="company-item-bottom-line"></div>
              <van-button :disabled="resultItem.cstType == 'mer'" @click="goUrlDetails(resultItem)"
                class="company-item-bottom-btn"><van-icon class="color-2372eb" name="newspaper-o" /> 看详情</van-button>
            </div>

          </li>
        </ul>
        <div style="margin-top: 10px" v-else>
          <div class="search-btn-box" style="padding: 0 10px">
            <div>共检索 <span class="color-2372eb"> {{ totalDatas > 999 ? '999+' : totalDatas }} </span>条数据</div>
            <div class="search-right-btn-box">
              <div @click="positiveTime()"><van-icon name="descending" />发布时间</div>
              <div @click="prioritySort()" class="ml-10"><van-icon name="descending" />优先级</div>
              <van-icon @click="priorityDialogIsShow = true" name="question-o" />
            </div>
          </div>
          <van-empty />
        </div>
      </div>
      <van-loading style="text-align: center;margin-top: 50%" v-if="pageLoading == false" color="#1989fa">加载中...</van-loading>
    </div>


    <van-popup v-model="businessTopDialogIsShow" :style="{ width: '300px', borderRadius: '8px' }">
      <div style="height: 40px;line-height: 40px;text-align: center;font-size: 16px;font-weight: bold">企业商机</div>
      <div style="padding: 12px 20px 20px;font-size: 14px;color: #666666;border-bottom: solid 1px #dddddd">
        商机线索根据我行特色营销客群进行划分，包括企业和个体工商户。企业商机线索综合企业资质、综合评分、近一年经营情况、法人情况判断。</div>
      <div @click="businessTopDialogIsShow = false"
        style="height: 42px;line-height: 42px;text-align: center;font-size: 16px;color: #2372eb">关闭</div>
    </van-popup>

    <van-popup v-model="businessBottomDialogIsShow" :style="{ width: '300px', borderRadius: '8px' }">
      <div style="height: 40px;line-height: 40px;text-align: center;font-size: 16px;font-weight: bold">个体工商户商机</div>
      <div style="padding: 12px 20px 20px;font-size: 14px;color: #666666;border-bottom: solid 1px #dddddd">
        个体工商户商机线索综合根据法人资产、负债、家庭情况及近6个月~2年的经营情况判断。</div>
      <div @click="businessBottomDialogIsShow = false"
        style="height: 42px;line-height: 42px;text-align: center;font-size: 16px;color: #2372eb">关闭</div>
    </van-popup>

    <van-popup v-model="priorityDialogIsShow" :style="{ width: '300px', borderRadius: '8px' }">
      <div style="height: 40px;line-height: 40px;text-align: center;font-size: 16px;font-weight: bold">优先级</div>
      <div style="padding: 12px 20px 20px;font-size: 14px;color: #666666;border-bottom: solid 1px #dddddd">
        商机优先级按照客群划分命中规则强度，分为强中弱。</div>
      <div @click="priorityDialogIsShow = false"
        style="height: 42px;line-height: 42px;text-align: center;font-size: 16px;color: #2372eb">关闭</div>
    </van-popup>



    <van-action-sheet v-model="sheetShow" title="选择分组">
      <div class="add-fenzu-btn" @click="addGroup">+ 新建分组</div>
      <van-radio-group v-model="updateResult">
        <van-cell-group class="fenzu-box">
          <van-cell v-for="(item, index) in groupList" clickable :key="index" style="padding-bottom: 20px">
            <template #title>
              <div style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{ item.groupName }}</div>
            </template>
            <template #right-icon>
              <van-radio :name="index" />
            </template>
          </van-cell>
        </van-cell-group>
        <van-button plain color="#2372eb" @click="updateSure"
          style="width: 90%;border-radius: 5px;margin-left: 5%;">确定</van-button>
      </van-radio-group>
    </van-action-sheet>


    <van-popup :closeOnClickOverlay=false v-model="addFenzuShow" :style="{ width: '260px' }">
      <div class="dialog-title-box">新建分组</div>
      <div class="dialog-content-box">
        <input maxlength="12" v-model="groupName" type="text" placeholder="请输入分组名称">
      </div>
      <div class="dialog-footer-box">
        <div class="cancel-btn" @click="addFenzuCancel">取消</div>
        <div class="ok-btn" @click="addFenzuOk">确定</div>
      </div>
    </van-popup>


  </div>
</template>

<script>
import { ref } from 'vue';
import navbar from '../../../components/navbar/navbar.vue';
import {
  Icon,
  Search,
  DropdownMenu,
  DropdownItem,
  Area,
  Picker,
  Button,
  Col,
  Row,
  Sidebar,
  SidebarItem,
  Field,
  Tag,
  Empty,
  Toast, Popup,
  ActionSheet, RadioGroup, Radio
} from 'vant';
import { addGroupInfo, getQueryOpportyPage } from "@/service/api/home";
import { postCancelGuanzhu, postQueryByName, postAddAttentionCompany } from "@/service/api/category";
//button组件

export default {
  name: "searchRefult",
  data() {
    return {
      isGetResult: false,
      timeShow: true,
      sort: '',
      sortShow: true,
      order: '',
      areaList: [
        {
          text: '浙江省',
          value: 'Zhejiang',
          children: [
            {
              text: '杭州市', value: '330100',
              children: [
                { text: '滨江区', value: '3301001' },
                { text: '淳安县', value: '3301002' },
                { text: '富阳区', value: '3301003' },
                { text: '拱墅区', value: '3301004' },
                { text: '建德市', value: '3301005' },
                { text: '临安区', value: '3301006' },
                { text: '临平区', value: '3301007' },
                { text: '钱塘区', value: '3301008' },
                { text: '上城区', value: '3301009' },
                { text: '桐庐县', value: '33010010' },
                { text: '萧山区', value: '33010011' },
                { text: '西湖区', value: '33010012' },
                { text: '余杭区', value: '33010013' },
              ]
            },
            {
              text: '宁波市', value: '330200',
              children: [
                { text: '北仑区', value: '3302001' },
                { text: '慈溪市', value: '3302002' },
                { text: '奉化区', value: '3302003' },
                { text: '高新科技开发区', value: '3302004' },
                { text: '海曙区', value: '3302005' },
                { text: '江北区', value: '3302006' },
                { text: '江东区', value: '3302007' },
                { text: '宁海县', value: '3302008' },
                { text: '象山县', value: '3302009' },
                { text: '鄞州区', value: '33020010' },
                { text: '余姚市', value: '33020011' },
                { text: '镇海区', value: '33020012' },
              ]
            },
            {
              text: '温州市', value: '330300',
              children: [
                { text: '茶山高教园区', value: '3303001' },
                { text: '苍南县', value: '3303002' },
                { text: '洞头区', value: '3303003' },
                { text: '龙湾区', value: '3303004' },
                { text: '鹿城区', value: '3303005' },
                { text: '龙港市', value: '3303006' },
                { text: '瓯海区', value: '3303007' },
                { text: '平阳县', value: '3303008' },
                { text: '瑞安市', value: '3303009' },
                { text: '泰顺县', value: '33030010' },
                { text: '文成县', value: '33030011' },
                { text: '乐清市', value: '33030012' },
                { text: '永嘉市', value: '33030013' },
              ]
            },
            {
              text: '嘉兴市', value: '330400',
              children: [
                { text: '海宁市', value: '3304002' },
                { text: '海盐县', value: '3304003' },
                { text: '嘉善县', value: '3304004' },
                { text: '南湖区', value: '3304005' },
                { text: '平湖市', value: '3304006' },
                { text: '桐乡市', value: '3304007' },
                { text: '秀洲区', value: '3304008' },
              ]
            },
            {
              text: '湖州市', value: '330500',
              children: [
                { text: '安吉县', value: '3305002' },
                { text: '德清县', value: '3305003' },
                { text: '南浔区', value: '3305004' },
                { text: '吴兴区', value: '3305005' },
                { text: '长兴县', value: '3305006' },
              ]
            },
            {
              text: '绍兴市', value: '330600',
              children: [
                { text: '柯桥区', value: '3306002' },
                { text: '嵊州市', value: '3306003' },
                { text: '上虞区', value: '3306004' },
                { text: '新昌县', value: '3306005' },
                { text: '越城区', value: '3306006' },
                { text: '诸暨市', value: '3306007' },
              ]
            },
            {
              text: '金华市', value: '330700',
              children: [
                { text: '东阳市', value: '3307001' },
                { text: '金华区', value: '3307002' },
                { text: '兰溪市', value: '3307003' },
                { text: '磐安县', value: '3307004' },
                { text: '浦江县', value: '3307005' },
                { text: '婺城区', value: '3307006' },
                { text: '武义县', value: '3307007' },
                { text: '义乌市', value: '3307008' },
                { text: '永康市', value: '3307009' },
              ]
            },
            {
              text: '衢州市', value: '330800',
              children: [
                { text: '常山县', value: '3308001' },
                { text: '江山市', value: '3308002' },
                { text: '开化县', value: '3308003' },
                { text: '柯城区', value: '3308004' },
                { text: '龙游县', value: '3308005' },
                { text: '衢江区', value: '3308006' },
              ]
            },
            {
              text: '舟山市', value: '330900',
              children: [
                { text: '岱山县', value: '3309001' },
                { text: '定海区', value: '3309002' },
                { text: '普陀区', value: '3309003' },
                { text: '嵊泗县', value: '3309004' },
              ]
            },
            {
              text: '台州市', value: '331e3',
              children: [
                { text: '黄岩区', value: '331e301' },
                { text: '椒江区', value: '331e302' },
                { text: '临海市', value: '331e303' },
                { text: '路桥区', value: '331e304' },
                { text: '三门县', value: '331e305' },
                { text: '天台县', value: '331e306' },
                { text: '温岭市', value: '331e307' },
                { text: '仙居县', value: '331e308' },
                { text: '玉环市', value: '331e309' },
              ]
            },
            {
              text: '丽水市', value: '331100',
              children: [
                { text: '缙云县', value: '3311001' },
                { text: '景宁畲族自治县', value: '3311002' },
                { text: '莲都区', value: '3311003' },
                { text: '龙泉市', value: '3311004' },
                { text: '庆元县', value: '3311005' },
                { text: '青田县', value: '3311006' },
                { text: '遂昌县', value: '3311007' },
                { text: '松阳县', value: '3311008' },
                { text: '云和县', value: '3311009' },
              ]
            },
          ],
        },
      ],// 区域数据

      showAddressPicker: false,// 区域弹窗是否显示
      showIndustryPicker: false,// 行业弹窗是否显示
      companyNeed: [],
      shopNeed: [],
      // 更多筛选筛选值
      businessInformation: {
        region: '',
        regionValue: '',

        universalUnlimitedList: ['不限', '是', '否'],// 不限，是，否选择列表
        openingAnAccountWithOurBank: '',// 是否我行开户
        ourBankHasLoan: '',// 是否我行有贷
        contactInfo: '',// 是否有联系方式

        businessTopValue: [],// 全部商机（企业商机）
        businessTopList: [
          { title: '全部商机', isSelect: false },
        ],// 全部商机选择列表

        businessExpansionValue: [],// 经营扩张需求
        businessExpansionList: [
          { title: '经营规模增长', isSelect: false },
          { title: '注册规模扩张', isSelect: false },
        ],// 经营扩张需求选择列表

        corporateCreditValue: [],// 企业信贷需求
        corporateCreditList: [
          { title: '征信记录活跃', isSelect: false }, 
          { title: '经营活动活跃', isSelect: false },
        ],// 企业信贷需求选择列表

        corporateFundsValue: [],// 法人资金需求
        corporateFundsList: [
          { title: '法人信用卡消费活跃', isSelect: false },
          { title: '法人信贷活跃', isSelect: false },
          // { title: '近期大量个人支出', isSelect: false },
        ],// 法人资金需求选择列表

        highQualityCustomValue: [],// 企业优质客户
        highQualityCustomList: [
          { title: '政府认定优质', isSelect: false },
          // { title: '项目投资', isSelect: false },
          { title: '法人有贷', isSelect: false },
          // { title: '优质新成立企业', isSelect: false },
          { title: '高资产价值', isSelect: false },
        ],// 企业优质客户选择列表


        businessBottomValue: [],// 全部商机（个体工商户）
        businessBottomList: [
          { title: '全部商机', isSelect: false },
        ],// 全部商机选择列表
        merchantBusinessExpansionValue: [],// 商户经营扩张需求
        merchantBusinessExpansionList: [
          { title: '经营规模增长', isSelect: false },
          { title: '注册规模扩张', isSelect: false },
          // { title: '跨行业经营', isSelect: false },
          // { title: '二次开业', isSelect: false },
          { title: '五险一金信息优质', isSelect: false },
        ],// 商户经营扩张需求选择列表
        merchantCreditDemandValue: [],// 商户信贷需求
        merchantCreditDemandList: [
          { title: '行内信贷活跃', isSelect: false },
          { title: '征信记录活跃', isSelect: false },
          { title: '征信贷款活跃', isSelect: false },
          { title: '征信近期查询活跃', isSelect: false },
        ],// 商户信贷需求选择列表
        merchantConsumptionValue: [],// 商户消费需求
        merchantConsumptionList: [
          { title: '信用卡消费活跃', isSelect: false },
          { title: '近期大量个人支出', isSelect: false },
        ],// 商户消费需求选择列表
        merchantValueValue: [],// 商户价值
        merchantValueList: [
          { title: '经营活动活跃', isSelect: false },
          { title: '资金周转高效', isSelect: false },
          { title: '流水呈周期性', isSelect: false },
          { title: '高资产价值', isSelect: false },
        ],// 商户价值选择列表


      },
      searchResultList: [],
      currentPage: 1,
      totalDatas: 0,
      loading: false,
      isEndLoading: false,
      startDate: '',
      endDate: '',
      pageLoading: true,


      businessTopDialogIsShow: false,
      businessBottomDialogIsShow: false,
      priorityDialogIsShow: false,

      sheetShow: false,
      updateResult: '',
      groupList: [],
      currentOperateIndex: -1,
      addFenzuShow: false,
      groupName: '',
      count: 0,
      enCount: 0
    }
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    }
  },
  mounted() {
    sessionStorage.removeItem('dashboardType');
    window.addEventListener('scroll', this.scrollBottom);
    if (sessionStorage.getItem('getResult') && sessionStorage.getItem('getResult') == 'true') {
      this.isGetResult = true;
    
      window.scrollTo(0, 0)
      sessionStorage.removeItem('getResult');
    }
    this.postGroupList()
  },
  destroyed() {
    window.removeEventListener('scroll', this.scrollBottom)
  },
  methods: {
    // 是否我行开户
    openingAnAccountWithOurBankSelect(item) {
      console.log(item)
      this.businessInformation.openingAnAccountWithOurBank = item;
    },

    // 是否我行有贷
    ourBankHasLoanSelect(item) {
      this.businessInformation.ourBankHasLoan = item;
    },

    // 是否有联系方式
    contactInfoSelect(item) {
      this.businessInformation.contactInfo = item;
    },


    // 多选筛选
    multipleChoiceFiltering(type, index) {
      let allSelectList = this.businessInformation.businessExpansionList.concat(this.businessInformation.corporateCreditList, this.businessInformation.corporateFundsList, this.businessInformation.highQualityCustomList,)
      let entitySelectList = this.businessInformation.merchantBusinessExpansionList.concat(this.businessInformation.merchantCreditDemandList, this.businessInformation.merchantConsumptionList, this.businessInformation.merchantValueList)
      console.log(type)
      if (type == 'businessTop') {
        this.businessInformation.businessTopList[index].isSelect = !this.businessInformation.businessTopList[index].isSelect;
        if (this.businessInformation.businessTopList[index].isSelect == false) {
          this.businessInformation.businessExpansionList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.corporateCreditList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.corporateFundsList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.highQualityCustomList.forEach(item => {
            item.isSelect = false
          })
        } else {
          this.businessInformation.businessExpansionList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.corporateCreditList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.corporateFundsList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.highQualityCustomList.forEach(item => {
            item.isSelect = true
          })
        }
      } else if (type == 'businessExpansion') {
        if (this.businessInformation.businessTopList[0].isSelect) {
          this.businessInformation.businessTopList[0].isSelect = false
          this.businessInformation.businessExpansionList[index].isSelect = false
        } else {
          this.businessInformation.businessExpansionList[index].isSelect = !this.businessInformation.businessExpansionList[index].isSelect;
          let isSelectList = allSelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessTopList[0].isSelect = false
          } else {
            this.businessInformation.businessTopList[0].isSelect = true
          }
        }
      } else if (type == 'corporateCredit') {
        if (this.businessInformation.businessTopList[0].isSelect) {
          this.businessInformation.businessTopList[0].isSelect = false
          this.businessInformation.corporateCreditList[index].isSelect = false
        } else {
          this.businessInformation.corporateCreditList[index].isSelect = !this.businessInformation.corporateCreditList[index].isSelect;
          let isSelectList = allSelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessTopList[0].isSelect = false
          } else {
            this.businessInformation.businessTopList[0].isSelect = true
          }
        }
      } else if (type == 'corporateFunds') {
        if (this.businessInformation.businessTopList[0].isSelect) {
          this.businessInformation.businessTopList[0].isSelect = false
          this.businessInformation.corporateFundsList[index].isSelect = false
        } else {
          this.businessInformation.corporateFundsList[index].isSelect = !this.businessInformation.corporateFundsList[index].isSelect;
          let isSelectList = allSelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessTopList[0].isSelect = false
          } else {
            this.businessInformation.businessTopList[0].isSelect = true
          }
        }
      } else if (type == 'highQualityCustom') {
        if (this.businessInformation.businessTopList[0].isSelect) {
          this.businessInformation.businessTopList[0].isSelect = false
          this.businessInformation.highQualityCustomList[index].isSelect = false
        } else {
          this.businessInformation.highQualityCustomList[index].isSelect = !this.businessInformation.highQualityCustomList[index].isSelect;
          let isSelectList = allSelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessTopList[0].isSelect = false
          } else {
            this.businessInformation.businessTopList[0].isSelect = true
          }
        }
      } else if (type == 'businessBottom') {
        this.businessInformation.businessBottomList[index].isSelect = !this.businessInformation.businessBottomList[index].isSelect;
        if (this.businessInformation.businessBottomList[index].isSelect == false) {
          this.businessInformation.merchantBusinessExpansionList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.merchantCreditDemandList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.merchantConsumptionList.forEach(item => {
            item.isSelect = false
          })
          this.businessInformation.merchantValueList.forEach(item => {
            item.isSelect = false
          })
        } else {
          this.businessInformation.merchantBusinessExpansionList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.merchantCreditDemandList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.merchantConsumptionList.forEach(item => {
            item.isSelect = true
          })
          this.businessInformation.merchantValueList.forEach(item => {
            item.isSelect = true
          })
        }
      } else if (type == 'merchantBusinessExpansion') {
        if (this.businessInformation.businessBottomList[0].isSelect) {
          this.businessInformation.businessBottomList[0].isSelect = false
          this.businessInformation.merchantBusinessExpansionList[index].isSelect = false
        } else {
          this.businessInformation.merchantBusinessExpansionList[index].isSelect = !this.businessInformation.merchantBusinessExpansionList[index].isSelect
          let isSelectList = entitySelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessBottomList[0].isSelect = false
          } else {
            this.businessInformation.businessBottomList[0].isSelect = true
          }
        }
      } else if (type == 'merchantCreditDemand') {
        if (this.businessInformation.businessBottomList[0].isSelect) {
          this.businessInformation.businessBottomList[0].isSelect = false
          this.businessInformation.merchantCreditDemandList[index].isSelect = false
        } else {
          this.businessInformation.merchantCreditDemandList[index].isSelect = !this.businessInformation.merchantCreditDemandList[index].isSelect;
          let isSelectList = entitySelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessBottomList[0].isSelect = false
          } else {
            this.businessInformation.businessBottomList[0].isSelect = true
          }
        }
      } else if (type == 'merchantConsumption') {
        if (this.businessInformation.businessBottomList[0].isSelect) {
          this.businessInformation.businessBottomList[0].isSelect = false
          this.businessInformation.merchantConsumptionList[index].isSelect = false
        } else {
          this.businessInformation.merchantConsumptionList[index].isSelect = !this.businessInformation.merchantConsumptionList[index].isSelect;
          let isSelectList = entitySelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessBottomList[0].isSelect = false
          } else {
            this.businessInformation.businessBottomList[0].isSelect = true
          }
        }
      } else if (type == 'merchantValue') {
        if (this.businessInformation.businessBottomList[0].isSelect) {
          this.businessInformation.businessBottomList[0].isSelect = false
          this.businessInformation.merchantValueList[index].isSelect = false
        } else {
          this.businessInformation.merchantValueList[index].isSelect = !this.businessInformation.merchantValueList[index].isSelect;
          let isSelectList = entitySelectList.map(item => { return item.isSelect })
          if (isSelectList.includes(false)) {
            this.businessInformation.businessBottomList[0].isSelect = false
          } else {
            this.businessInformation.businessBottomList[0].isSelect = true
          }
        }
      }
    },


    // 去详情页
    goUrlDetails(resultItem) {
      sessionStorage.setItem('companyId', resultItem.companyId);
      sessionStorage.setItem('companyName', resultItem.entName);
      sessionStorage.setItem('tabBarActiveIndex', '1');
      sessionStorage.setItem('dashboardType', 'search');
      this.$router.push('/dashboard/CustomerDashboard');
    },

    // 区域取消
    onRegionCancel() {
      this.showAddressPicker = false;
      this.businessInformation.region = '';
      this.businessInformation.regionValue = '';
    },

    // 区域选中
    onRegionConfirm(selectedValues) {
      this.showAddressPicker = false;
      this.businessInformation.region = selectedValues.join(',');
      this.businessInformation.regionValue = selectedValues.join(',');
    },


    // 更多筛选确定
    moreScreenOk() {
      this.processMultipleSelectionFiltering();
      this.pageLoading = false;
      this.currentPage = 1;
      this.getQueryCompanyPageData();
      this.isGetResult = !this.isGetResult;
      window.scrollTo(0, 0)
      // this.getQueryCompanyPageData();
    },

    // 更多筛选重置
    moreScreenCancel() {
      this.businessInformation.region = '';// 区域
      this.businessInformation.regionValue = ''; // 区域值

      this.businessInformation.openingAnAccountWithOurBank = '';// 是否我行开户
      this.businessInformation.ourBankHasLoan = '';// 是否我行有贷
      this.businessInformation.contactInfo = '';// 是否有联系方式

      this.businessInformation.businessTopValue = [];// 全部商机（企业商机）
      this.businessInformation.businessExpansionValue = [];// 经营扩张需求
      this.businessInformation.corporateCreditValue = [];// 企业信贷需求
      this.businessInformation.corporateFundsValue = [];// 法人资金需求
      this.businessInformation.highQualityCustomValue = [];// 企业优质客户


      this.businessInformation.businessBottomValue = [];// 全部商机（个体工商户）
      this.businessInformation.merchantBusinessExpansionValue = [];// 商户经营扩张需求
      this.businessInformation.merchantCreditDemandValue = [];// 商户信贷需求
      this.businessInformation.merchantConsumptionValue = [];// 商户消费需求
      this.businessInformation.merchantValueValue = [];// 商户价值


      for (let i = 0; i < this.businessInformation.businessTopList.length; i++) {
        this.businessInformation.businessTopList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.businessExpansionList.length; i++) {
        this.businessInformation.businessExpansionList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.corporateCreditList.length; i++) {
        this.businessInformation.corporateCreditList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.corporateFundsList.length; i++) {
        this.businessInformation.corporateFundsList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.highQualityCustomList.length; i++) {
        this.businessInformation.highQualityCustomList[i].isSelect = false;
      }


      for (let i = 0; i < this.businessInformation.businessBottomList.length; i++) {
        this.businessInformation.businessBottomList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.merchantBusinessExpansionList.length; i++) {
        this.businessInformation.merchantBusinessExpansionList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.merchantCreditDemandList.length; i++) {
        this.businessInformation.merchantCreditDemandList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.merchantConsumptionList.length; i++) {
        this.businessInformation.merchantConsumptionList[i].isSelect = false;
      }
      for (let i = 0; i < this.businessInformation.merchantValueList.length; i++) {
        this.businessInformation.merchantValueList[i].isSelect = false;
      }

      this.currentPage = 1;
      this.pageLoading = false;
      this.companyNeed = []
      this.shopNeed = []

    },

    // 获取企业热搜榜
    async getQueryCompanyPageData() {
      let areaList = this.businessInformation.regionValue ? this.businessInformation.regionValue.split(',') : null
      console.log(areaList, 'areaList')
      let params = {
        "city": areaList ? areaList[1] : '', //城市
        "county": areaList ? areaList[2] : '',//区县
        "opencstFlg": this.formatParams(this.businessInformation.openingAnAccountWithOurBank),// 是否我行开户(行社)
        "loanFlg": this.formatParams(this.businessInformation.ourBankHasLoan),// 是否我行有贷
        "phoneFlg": this.formatParams(this.businessInformation.contactInfo),// 是否有联系方式

        "businessTopValue": this.businessInformation.businessTopValue.length > 0 ? this.businessInformation.businessTopValue : null, // 全部商机（企业商机）
        "companyNeed": this.companyNeed.length == 0 ? null : this.companyNeed, // 经营扩张需求
        "shopNeed": this.shopNeed.length == 0 ? null : this.shopNeed,
        "pageNum": this.currentPage,
        "pageSize": 10,
        "sort": this.sort,
        "order": this.order,
      }
      console.log(params, 'paramsparams')
      let result = await getQueryOpportyPage(params);
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          let list = result.records.map((item, index) => {
            return {
              class2nd: item.class2nd,
              startDate: item.startDate,
              opportPriority: item.opportPriority,
              opportLabel: item.opportLabel.length === 0 ? [] : item.opportLabel.split(';'),
              colorNum: item.colorNum,
              entName: item.entName,
              uniscid: item.uniscid,
              busiDesc: item.busiDesc,
              busiDesc: item.busiDesc,
              cstType: item.cstType,
              opportRuleEdate: item.opportRuleEdate,
              attentionFlag: item.attentionFlag,
              companyId:item.companyId
            }
          });
          this.searchResultList = this.searchResultList.concat(list);
        } else {
          this.searchResultList = result.records.map((item, index) => {

            return {
              class2nd: item.class2nd,
              startDate: item.startDate,
              opportPriority: item.opportPriority,
              opportLabel: item.opportLabel.length === 0 ? [] : item.opportLabel.split(';'),
              colorNum: item.colorNum,
              entName: item.entName,
              uniscid: item.uniscid,
              busiDesc: item.busiDesc,
              busiDesc: item.busiDesc,
              cstType: item.cstType,
              opportRuleEdate: item.opportRuleEdate,
              attentionFlag: item.attentionFlag,
              companyId:item.companyId
            }
          });
        }
        this.totalDatas = result.total;
        if (this.searchResultList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },

    // 格式化需要传入的数据
    formatParams(value) {
      if (value == '是') {
        return value = 1;
      } else if (value == '否') {
        return value = 0;
      } else {
        return value = null;
      }
    },


    // 滚动到页面底部时，请求内容
    scrollBottom() {
      let scrollTop = document.documentElement.scrollTop || document.body.scrollTop  //页面滚动的高度
      let clientHeight = document.documentElement.clientHeight  //可视区域高度
      let scrollHeight = document.documentElement.scrollHeight  //可滚动内容的高度
      let bottomOfWindow = scrollTop + clientHeight + 1000 >= scrollHeight    //是否滚动到底部

      //loading 和 this.tableData.length和this.total是自己的判断条件
      if (scrollTop !== 0 && bottomOfWindow && !this.loading && !this.isEndLoading&& this.isGetResult) {
        this.loading = true;
        this.currentPage += 1;
        this.getQueryCompanyPageData();
      }
    },

    // 多选的筛选，需要进一步进行处理
    processMultipleSelectionFiltering() {

      this.businessInformation.businessTopValue = [];// 全部商机（企业商机）
      this.businessInformation.businessExpansionValue = [];// 经营扩张需求
      this.businessInformation.corporateCreditValue = [];// 企业信贷需求
      this.businessInformation.corporateFundsValue = [];// 法人资金需求
      this.businessInformation.highQualityCustomValue = [];// 企业优质客户


      for (let i = 0; i < this.businessInformation.businessTopList.length; i++) {
        if (this.businessInformation.businessTopList[i].isSelect) {
          this.businessInformation.businessTopValue.push(this.businessInformation.businessTopList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.businessExpansionList.length; i++) {
        if (this.businessInformation.businessExpansionList[i].isSelect) {
          this.businessInformation.businessExpansionValue.push(this.businessInformation.businessExpansionList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.corporateCreditList.length; i++) {
        if (this.businessInformation.corporateCreditList[i].isSelect) {
          this.businessInformation.corporateCreditValue.push(this.businessInformation.corporateCreditList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.corporateFundsList.length; i++) {
        if (this.businessInformation.corporateFundsList[i].isSelect) {
          this.businessInformation.corporateFundsValue.push(this.businessInformation.corporateFundsList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.highQualityCustomList.length; i++) {
        if (this.businessInformation.highQualityCustomList[i].isSelect) {
          this.businessInformation.highQualityCustomValue.push(this.businessInformation.highQualityCustomList[i].title)
        }
      }

      this.companyNeed = this.businessInformation.businessTopValue.concat(
        this.businessInformation.businessExpansionValue,
        this.businessInformation.corporateCreditValue,
        this.businessInformation.corporateFundsValue,
        this.businessInformation.highQualityCustomValue
      )
      this.businessInformation.businessBottomValue = [];// 全部商机（个体工商户）
      this.businessInformation.merchantBusinessExpansionValue = [];// 商户经营扩张需求
      this.businessInformation.merchantCreditDemandValue = [];// 商户信贷需求
      this.businessInformation.merchantConsumptionValue = [];// 商户消费需求
      this.businessInformation.merchantValueValue = [];// 商户价值


      for (let i = 0; i < this.businessInformation.businessBottomList.length; i++) {
        if (this.businessInformation.businessBottomList[i].isSelect) {
          this.businessInformation.businessBottomValue.push(this.businessInformation.businessBottomList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.merchantBusinessExpansionList.length; i++) {
        if (this.businessInformation.merchantBusinessExpansionList[i].isSelect) {
          this.businessInformation.merchantBusinessExpansionValue.push(this.businessInformation.merchantBusinessExpansionList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.merchantCreditDemandList.length; i++) {
        if (this.businessInformation.merchantCreditDemandList[i].isSelect) {
          this.businessInformation.merchantCreditDemandValue.push(this.businessInformation.merchantCreditDemandList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.merchantConsumptionList.length; i++) {
        if (this.businessInformation.merchantConsumptionList[i].isSelect) {
          this.businessInformation.merchantConsumptionValue.push(this.businessInformation.merchantConsumptionList[i].title)
        }
      }
      for (let i = 0; i < this.businessInformation.merchantValueList.length; i++) {
        if (this.businessInformation.merchantValueList[i].isSelect) {
          this.businessInformation.merchantValueValue.push(this.businessInformation.merchantValueList[i].title)
        }
      }

      this.shopNeed = this.businessInformation.businessBottomValue.concat(
        this.businessInformation.merchantBusinessExpansionValue,
        this.businessInformation.merchantCreditDemandValue,
        this.businessInformation.merchantConsumptionValue,
        this.businessInformation.merchantValueValue
      )
    },


    returnClick() {
      sessionStorage.setItem('tabBarActiveIndex', '0');
      if (this.isGetResult == true) {
        this.isGetResult = !this.isGetResult;
      } else {
        this.$router.push({ path: '/dashboard/home' });
      }
    },


    businessTopDialog() {
      this.businessTopDialogIsShow = true;
    },

    businessBottomDialog() {
      this.businessBottomDialogIsShow = true;
    },


    priorityDialog() {
      this.priorityDialogIsShow = true;
    },
    async postGroupList() {
      let result = await postQueryByName({ pageSize: 999, pageNum: 1 });
      if (result) {
        this.groupList = result.records;
      }
    },
    async guanzhuShow(resultItem, guanzhuIndex) {
      if (resultItem.attentionFlag == true) {
        let params = { companyId: resultItem.companyId, };
        let result = await postCancelGuanzhu(params);
        Toast.success('取关成功');
        this.getQueryCompanyPageData();
      } else {
        this.sheetShow = true;
        this.currentOperateIndex = guanzhuIndex
      }
    },

    async updateSure() {
      let params = {
        groupName: this.groupList[this.updateResult].groupName,
        groupId: this.groupList[this.updateResult].groupId,
        companyId: this.searchResultList[this.currentOperateIndex].companyId == null ||
          this.searchResultList[this.currentOperateIndex].companyId == ''
          ? this.searchResultList[this.currentOperateIndex].uniscid : this.searchResultList[this.currentOperateIndex].companyId,
        companyName: this.searchResultList[this.currentOperateIndex].entName,
        cstType: this.searchResultList[this.currentOperateIndex].cstType,
      }
      console.log(params)
      let result = await postAddAttentionCompany(params);
      if (result) {
        this.sheetShow = false;
        Toast.success('关注成功！');
        this.getQueryCompanyPageData();
      }
    },

    // 新建分组取消
    addFenzuCancel() {
      this.groupName = '';
      this.addFenzuShow = false;
    },

    addGroup() {
      this.addFenzuShow = true;
      this.groupName = '';
    },


    // 新建分组确定
    async addFenzuOk() {
      let params = {
        groupName: this.groupName,
      }
      if (this.groupName == '') {
        Toast.fail('请输入分组名称')
      } else {
        let result = await addGroupInfo(params);
        if (result) {
          this.postGroupList();
          this.addFenzuCancel();
          Toast.success('新建分组成功！');
        }
      }
    },

    // 取消关注
    async cancelGuanzhu(companyId) {
      let params = { companyId: companyId };
      let result = await postCancelGuanzhu(params);
      Toast.success('取关成功');
    },

    // 按日期排序
    positiveTime() {
      this.timeShow = false
      this.sort = 'start_date desc'
      this.getQueryCompanyPageData()
    },
    flashbackTime() {
      this.timeShow = true
      this.sort = ''
      this.getQueryCompanyPageData()
    },
    prioritySort() {
      this.sortShow = false
      this.order = 'opport_priority desc'
      this.getQueryCompanyPageData()
    },
    flashbackSort() {
      this.sortShow = true
      this.order = ''
      this.getQueryCompanyPageData()
    },
  },
  components: {
    navbar: navbar,
    VanIcon: Icon,
    VanSearch: Search,
    VanDropdownMenu: DropdownMenu,
    VanDropdownItem: DropdownItem,
    VanArea: Area,
    VanPicker: Picker,
    VanButton: Button,
    VanCol: Col,
    VanRow: Row,
    VanSidebar: Sidebar,
    VanSidebarItem: SidebarItem,
    VanField: Field,
    VanTag: Tag,
    VanEmpty: Empty,
    VanPopup: Popup,
    VanActionSheet: ActionSheet,
    VanRadioGroup: RadioGroup,
    VanRadio: Radio,
  },
}
</script>

<style scoped>
.van-cell {
  padding: 10px 16px !important;
}

.van-dropdown-menu /deep/ .van-dropdown-menu__bar {
  box-shadow: none;
}

.search-result-box {
  /*padding-top: 46px;*/
  position: relative;
  background: #ffffff;
}

.more-screen-bottom-botton {
  border-top: solid 1px #f2f2f2;
  /*height: 60px;*/
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  width: 100%;
  padding: 10px 1rem 26px;
  background: #ffffff;
  position: fixed;
  bottom: 0;
  left: 0;
}

.van-sidebar-item--select::before {
  background: #2372eb !important;
}

.more-screen-content-right {
  padding: 0.8rem 1rem 4rem 0.6rem;
}

.more-screen-content-cell {
  margin-bottom: 20px;
}

.more-title-box {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.more-title-h2 {
  font-size: 0.9rem;
  font-weight: 700;
}

.select-slider-show {
  font-size: 1rem;
  color: #2372eb;
  font-weight: bold;
}

.color-2372eb {
  color: #2372eb;
  font-size: 16px;
}

.van-search {
  padding: 0;
}

.chengli-input {
  width: 100%;
  background: #f2f2f2;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 14px;
  height: 30px;
  line-height: 30px;
}

.chengli-input-line {
  text-align: center;
}

.chengli-input-box {
  margin-bottom: 10px;
}

.select-item-box {
  display: flex;
  justify-content: start;
  align-items: self-start;
  flex-wrap: wrap;
  width: 100%;
}

.select-item {
  padding: 2px 10px;
  background: #f2f2f2;
  font-size: 0.8rem;
  color: #333333;
  margin: 0 10px 10px 0;
  border-radius: 4px;
}

.select-item-active {
  color: #ffffff;
  background: #2372eb;
}

.company-box {
  background: #ffffff;
  width: 100%;
  min-height: 100vh;
  padding: 10px 1rem 1rem;

  /deep/ .van-button--default {
    border: none;
  }
}

.company-item {
  border: solid 1px #f2f2f2;
  border-radius: 10px;
  padding: 0.6rem;
  margin-bottom: 16px;
}

.company-middle-item {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.company-item-left {
  width: 32px;
  height: 32px;
  background: #2372eb;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
}

.company-item-left img {
  width: 20px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mr-6 {
  margin-right: 6px;
}

.company-item-right {
  width: calc(100% - 44px);
  font-size: 0.8rem;
}

.company-item-right-title-box {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.company-item-right-title {
  font-size: 1rem;
  font-weight: bold;
}

.company-item-right-small-title {
  font-size: 0.8rem;
  margin-left: 6px;
  color: #666666;
}

.company-item-tag-box {
  margin-bottom: 12px;
}

.popup-box {
  height: 27rem;
  padding: 1rem 1rem 3rem 1rem;
}

.divider-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}

.divider-line {
  width: 90px;
  height: 2px;
  background: #2372eb;
}

.divider-title {
  font-size: 1rem;
  color: #2372eb;
  margin: 0 6px;
  font-weight: 700;
}

.search-btn-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #666666;
  margin-bottom: 16px;
}

.search-right-btn-box {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 14px;
  color: #666666;
}

.mt-60 {
  margin-top: 60px;
}

.van-button--small {
  font-size: 16px;
  height: 40px !important;
  line-height: 40px !important;
}


.bg-2372eb {
  background: #2372EB;
}

.bg-ee8c15 {
  background: #ee8c15;
}

.bg-11c95f {
  background: #11c95f;
}

.bg-e21183 {
  background: #e21183;
}

.bg-fde809 {
  background: #fde809;
}

.bg-17b9d7 {
  background: #17b9d7;
}

.bg-db2c2c {
  background: #db2c2c;
}

.bg-9232db {
  background: #9232db;
}

.bg-8c8c8c {
  background: #8c8c8c;
}

.header-title {
  height: 46px;
  width: 100%;
  background-color: #fff;
  text-align: center;
}

.header-title-return-back {
  height: 100%;
  width: 2rem;
  line-height: 46px;
  float: left;
  font-size: 15px;
}

.header-title-name-search {
  line-height: 46px;
  margin-right: 2rem;
  align-items: center;
  justify-content: center;
  display: inline-flex;
}

.mb-50 {
  margin-bottom: 50px;
}

.ml-10 {
  margin-left: 10px;
}

.company-item-bottom-btn-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: solid 1px #e9e9e9;
  padding-top: 10px;
  font-size: 14px;
  color: #333333;
}

.company-item-bottom-btn {
  width: 46%;
  text-align: center;
  border: none;
}

.company-item-bottom-line {
  width: 1px;
  height: 20px;
  background: #e9e9e9;
}


.guanzhu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #666666;
  padding-bottom: 16px;
  border-bottom: solid 1px #f2f2f2;
}

.guanzhu-button {
  color: #2372eb;
}

.fenzu-box {
  padding-bottom: 10px;
  max-height: 50vh;
  overflow: scroll;
}

.add-fenzu-btn {
  padding: 1rem;
  font-size: 0.9rem;
  color: #2372eb;
  border-bottom: solid 1px #f2f2f2;
}

.dialog-title-box {
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  margin: 16px 0 20px;
}

.dialog-content-box {
  padding: 0 1rem;
  margin-bottom: 16px;
}

.dialog-content-box input {
  width: 100%;
  background: #f2f2f2;
  border: none;
  height: 36px;
  line-height: 36px;
  padding-left: 6px;
  font-size: 0.8rem;
}

.dialog-footer-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
  border-top: solid 1px #dddddd;
}

.dialog-footer-box .cancel-btn {
  font-size: 0.9rem;
  color: #999999;
  border-right: solid 1px #dddddd;
  text-align: center;
  width: 50%;
}


.dialog-footer-box .ok-btn {
  width: 50%;
  font-size: 0.9rem;
  color: #2372EB;
  text-align: center;
}

.hot-item-cell-guanzhu {
  font-size: 0.8rem;
  color: #2372eb;
}


.icon_blur {
  color: #2372eb
}</style>
