<template>
    <div>
        <navbar title="查融资"></navbar>
      <van-popup position="bottom" :style="{ height: '50%' }" v-model="isShowDatePicker">
        <van-datetime-picker :min-date="minDate" @confirm="onConfirmStartDate" @cancel="startDateCancel"
                             v-if="startDateShow"></van-datetime-picker>
        <van-datetime-picker :min-date="minDate" @confirm="onConfirmEndDate" @cancel="endDateCancel"
                             v-if="endDateShow"></van-datetime-picker>
      </van-popup>
        <div v-if="pageLoading == true" class="wrapper">
            <div class="search-header-box">
                <div class="search-input">
                    <van-search type="text" v-model="searchValue" show-action placeholder="请输入搜索关键词" @search="onSearch"
                        @cancel="onCancel" />
                </div>

                <van-dropdown-menu :closeOnClickOutside=false active-color="#2372eb">
                    <van-dropdown-item ref="areaDrop" title="地区">
                        <van-picker show-toolbar :columns="areaList" @confirm="areaOk" @cancel="areaCancel" />
                    </van-dropdown-item>
                    <van-dropdown-item ref="industryDrop" title="行业">
                        <div class="popup-box">
                            <ul class="select-item-box">
                                <li v-for=" (industryItem, industryIndex) in industryList "
                                    @click="industrySelect(industryIndex)"
                                    :class="[industryItem.isSelect ? 'select-item-active' : '']" :key="industryItem.value"
                                    class="select-item">{{ industryItem.text }}</li>
                            </ul>
                            <van-row class="more-screen-bottom-botton" gutter="16">
                                <van-col span="12"><van-button type="primary" size="small" plain block
                                        @click="onIndustryCancel()">重置</van-button></van-col>
                                <van-col span="12"><van-button type="primary" size="small" block
                                        @click="onIndustryConfirm()">确定</van-button></van-col>
                            </van-row>
                        </div>
                    </van-dropdown-item>
                    <van-dropdown-item ref="financingDrop" title="融资轮次">
                        <div class="popup-box">
                            <ul class="select-item-box">
                                <li v-for=" (financingItem, financingIndex) in financingList "
                                    @click="financingSelect(financingIndex)"
                                    :class="[financingItem.isSelect ? 'select-item-active' : '']" :key="financingItem.name"
                                    class="select-item">{{ financingItem.name }}</li>
                            </ul>
                            <van-row class="more-screen-bottom-botton" gutter="16">
                                <van-col span="12"><van-button type="primary" size="small" plain block
                                        @click="onfinancingCancel()">重置</van-button></van-col>
                                <van-col span="12"><van-button type="primary" size="small" block
                                        @click="onfinancingConfirm()">确定</van-button></van-col>
                            </van-row>
                        </div>
                    </van-dropdown-item>
                    <van-dropdown-item ref="financingTimeDrop" title="融资时间">
                        <div class="popup-box">
                            <ul class="select-date-item-box border-bottom-f2f2f2">
                                <li v-for=" (financingTimeItem, financingTimeIndex) in financingTimeList "
                                    @click="financingTimeSelect(financingTimeItem)"
                                    :class="[financingTime == financingTimeItem.value ? 'select-item-active' : '']"
                                    :key="financingTimeItem.value" class="select-item">{{ financingTimeItem.value }}
                                </li>
                            </ul>

                            <div class="data-picker-box">
                                <van-cell title="选择开始日期" :value="financingTimeMinDate" is-link @click="startDateShowDialog" />
                                <van-cell title="选择结束日期" :value="financingTimeMaxDate" is-link @click="endDateShowDialog" />
                            </div>

                            <van-row class="more-screen-bottom-botton" gutter="16">
                                <van-col span="12"><van-button type="primary" size="small" plain block
                                        @click="onfinancingTimeCancel()">重置</van-button></van-col>
                                <van-col span="12"><van-button type="primary" size="small" block
                                        @click="onfinancingTimeConfirm()">确定</van-button></van-col>
                            </van-row>
                        </div>
                    </van-dropdown-item>


                </van-dropdown-menu>
            </div>


            <div class="total-font-title">
                共检索到<span class="color-red">{{ totalDatas }}</span>条信息
            </div>

            <div class="search-content-box">
                <ul>
                    <li v-for="(financingDataItem, financingDataIndex) in financingDataList" :key="financingDataIndex"
                        class="search-content-item">
                        <div class="search-content-item-title">
                            <div class="search-content-item-title-h4">{{ financingDataItem.productName }}</div>
                            <van-button @click="goUrl(financingDataItem)" plain class="height-30" round
                                type="primary">详情</van-button>
                        </div>
                        <div class="search-content-item-gongsi">{{ financingDataItem.companyName }}</div>
                        <div class="search-content-financing-box">
                            <div class="search-content-financing-info">
                                <div class="search-content-financing-info-content">{{ financingDataItem.round }}</div>
                                <div class="search-content-financing-info-title">融资轮次</div>
                            </div>
                            <div class="search-content-financing-line"></div>
                            <div class="search-content-financing-info">
                                <div class="search-content-financing-info-content">{{ financingDataItem.amount }}</div>
                                <div class="search-content-financing-info-title">融资金额</div>
                            </div>
                            <div class="search-content-financing-line"></div>
                            <div class="search-content-financing-info">
                                <div class="search-content-financing-info-content">{{ financingDataItem.date }}</div>
                                <div class="search-content-financing-info-title">融资日期</div>
                            </div>
                        </div>

                        <div class="search-content-invest-box"
                            v-if="financingDataItem.investment && financingDataItem.investment.length > 0">
                            <div>投资方：</div>
                            <ul>
                                <li v-for="(investItem, investIndex) in financingDataItem.investment" :key="investIndex"
                                    class="invest-name">{{ investItem }}</li>
                            </ul>
                        </div>

                    </li>
                </ul>
            </div>
        </div>
      <van-loading style="text-align: center;margin-top: 50%" v-if="pageLoading == false" />




    </div>
</template>

<script>
import { Icon, Search, DropdownMenu, DropdownItem, Area, Picker, Button, Col, Row, Tag, Empty, Calendar } from 'vant';//button组件
import navbar from '../../../components/navbar/navbar.vue';
import { getQueryFinancing } from "@/service/api/home";
export default {
    inject: ['reload'],
    name: "Search",
    components: {
        navbar: navbar,
        VanIcon: Icon,
        VanSearch: Search,
        VanDropdownMenu: DropdownMenu,
        VanDropdownItem: DropdownItem,
        VanArea: Area,
        VanPicker: Picker,
        VanButton: Button,
        VanCol: Col,
        VanRow: Row,
        VanTag: Tag,
        VanEmpty: Empty,
        VanCalendar: Calendar,
    },
    data() {
        return {
          pageLoading: true,
            minDate: new Date(2000, 0, 1),
            searchValue: '',
            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' },
                            ]
                        },
                    ],
                },
            ],// 区域数据
            cityValue: '', // 选中的市
            areaValue: '', // 选中的区


            industry: '',// 行业
            industryValue: [],// 行业值
            industryList: [
                { text: '农、林、牧、渔业', value: 'A', isSelect: false },
                { text: '采矿业', value: 'B', isSelect: false },
                { text: '制造业', value: 'C', isSelect: false },
                { text: '电力、热力、燃气及水生产和供应业', value: 'D', isSelect: false },
                { text: '建筑业', value: 'E', isSelect: false },
                { text: '批发和零售业', value: 'F', isSelect: false },
                { text: '交通运输、仓储和邮政业', value: 'G', isSelect: false },
                { text: '住宿和餐饮业', value: 'H', isSelect: false },
                { text: '信息传输、软件和信息技术服务业', value: 'I', isSelect: false },
                { text: '金融业', value: 'J', isSelect: false },
                { text: '房地产业', value: 'K', isSelect: false },
                { text: '租赁和商务服务业', value: 'L', isSelect: false },
                { text: '科学研究和技术服务业', value: 'M', isSelect: false },
                { text: '水利、环境和公共设施管理业', value: 'N', isSelect: false },
                { text: '居民服务、修理和其他服务业', value: 'O', isSelect: false },
                { text: '教育', value: 'P', isSelect: false },
                { text: '卫生和社会工作', value: 'Q', isSelect: false },
                { text: '文化、体育和娱乐业', value: 'R', isSelect: false },
                { text: '公共管理、社会保障和社会组织', value: 'S', isSelect: false },
                { text: '国际组织', value: 'T', isSelect: false },
            ],

            financing: '',// 融资轮次
            financingValue: [],// 融资轮次值
            financingList: [
                { name: 'A+', isSelect: false },
                { name: 'A++', isSelect: false },
                { name: 'A+++', isSelect: false },
                { name: 'A++轮', isSelect: false },
                { name: 'A+轮', isSelect: false },
                { name: 'A2', isSelect: false },
                { name: 'A轮', isSelect: false },
                { name: 'B+', isSelect: false },
                { name: 'B++', isSelect: false },
                { name: 'B+轮', isSelect: false },
                { name: 'B轮', isSelect: false },
                { name: 'C+', isSelect: false },
                { name: 'C++', isSelect: false },
                { name: 'C+轮', isSelect: false },
                { name: 'C轮', isSelect: false },
                { name: 'D+', isSelect: false },
                { name: 'D++', isSelect: false },
                { name: 'D轮', isSelect: false },
                { name: 'E+', isSelect: false },
                { name: 'E轮', isSelect: false },
                { name: 'E轮及以上', isSelect: false },

                { name: 'IPO', isSelect: false },
                { name: 'Pre-A', isSelect: false },
                { name: 'Pre-A+', isSelect: false },
                { name: 'Pre-A++', isSelect: false },
                { name: 'Pre-A轮', isSelect: false },
                { name: 'Pre-B', isSelect: false },
                { name: 'Pre-B+', isSelect: false },
                { name: 'Pre-B轮', isSelect: false },
                { name: 'Pre-C', isSelect: false },
                { name: 'Pre-C+', isSelect: false },
                { name: 'Pre-D', isSelect: false },
                { name: 'Pre-IPO', isSelect: false },
                { name: '其他', isSelect: false },
                { name: '天使+', isSelect: false },
                { name: '天使投资', isSelect: false },
                { name: '天使轮', isSelect: false },
                { name: '定向增发', isSelect: false },
                { name: '并购', isSelect: false },
                { name: '战略投资', isSelect: false },
                { name: '战略融资', isSelect: false },
                { name: '新三板', isSelect: false },
                { name: '新四板', isSelect: false },
                { name: '未披露', isSelect: false },
                { name: '私有化', isSelect: false },
                { name: '种子+', isSelect: false },
                { name: '种子轮', isSelect: false },
                { name: '股权融资', isSelect: false },
            ],


            financingTime: '',// 融资时间
            financingTimeValue: '',// 融资时间值

            financingTimeMin: '开始时间',// 融资时间最低年限
            financingTimeMax: '结束时间',// 融资时间最高年限
          financingTimeMinDate: '开始时间',// 融资时间最低年限
          financingTimeMaxDate: '结束时间',// 融资时间最高年限
            financingTimeMinValue: '',// 融资时间最低年限最终值
            financingTimeMaxValue: '',// 融资时间最高年限最终值

            financingTimeList: [
                { key: 'A', value: '不限' },
                { key: 'B', value: '近一周' },
                { key: 'C', value: '近一月' },
                { key: 'D', value: '近一年' },
            ],
            isShowDatePicker: false,
            startDateShow: false,//开始时间弹窗
            endDateShow: false,//结束时间弹窗

            financingDataList: [],

            currentPage: 1,
            loading: false,
            isEndLoading: false,
            totalDatas: '',

        }
    },

    beforeRouteEnter(to, from, next) {
        to.meta.keepAlive = true;
        if (from.path !== '/dashboard/home/searchFinancing/details') {
            next(vm => {
                vm.reload()
            })
        } else {
            next()
        }
    },

    beforeRouteLeave(to, from, next) {
        if (to.path == '/dashboard/home/searchFinancing/details') {
            from.meta.keepAlive = true;
            next()
        } else {
            from.meta.keepAlive = false;
            next()
        }
    },
   created() {
     window.scrollTo(0, 0);
   },

    mounted() {
        window.addEventListener('scroll', this.scrollBottom);
        this.getQueryFinancingData();
    },
    destroyed() {
        window.removeEventListener('scroll', this.scrollBottom)
    },
    methods: {
        // 搜索关键字
        onSearch() {
            this.userIsSearch = true;
            console.log('搜索关键字', this.searchValue)
          this.pageLoading = false;
            this.getQueryFinancingData();
        },

        // 搜索取消
        onCancel() {
            history.back();
        },

        // 跳转详情页
        goUrl(value) {
            sessionStorage.setItem('detailsShowDatas', JSON.stringify(value))
            this.$router.push('/dashboard/home/searchFinancing/details');
        },

        // 省市区选择确认
        areaOk(selectedValues) {
            this.cityValue = selectedValues[1];
            this.areaValue = selectedValues[2];
            this.$refs.areaDrop.toggle(false);
          this.pageLoading = false;
            this.getQueryFinancingData();
        },

        // 省市区取消
        areaCancel() {
            this.cityValue = '';
            this.areaValue = '';
            this.$refs.areaDrop.toggle(false);
        },

        // 行业重置
        onIndustryCancel() {
            this.industry = '';
            this.industryValue = [];
            for (let i = 0; i < this.industryList.length; i++) {
                this.industryList[i].isSelect = false;
            }
        },

        // 行业确定
        onIndustryConfirm() {
            let industry = [];
            let industryValue = [];
            for (let i = 0; i < this.industryList.length; i++) {
                if (this.industryList[i].isSelect) {
                    industry.push(this.industryList[i].text);
                    industryValue.push(this.industryList[i].value);
                }
            }
            this.industry = industry.join(',');
            this.industryValue = industryValue;
            this.$refs.industryDrop.toggle(false);
          this.pageLoading = false;
            this.getQueryFinancingData();
        },

        // 行业选择
        industrySelect(index) {
            this.industryList[index].isSelect = !this.industryList[index].isSelect;
        },

        // 融资轮次重置
        onfinancingCancel() {
            this.financing = '';
            this.financingValue = [];
            for (let i = 0; i < this.financingList.length; i++) {
                this.financingList[i].isSelect = false;
            }
        },

        // 融资轮次确定
        onfinancingConfirm() {
            this.$refs.financingDrop.toggle(false);
            for (let i = 0; i < this.financingList.length; i++) {
                if (this.financingList[i].isSelect) {
                    this.financingValue.push(this.financingList[i].name)
                }
            }
          this.pageLoading = false;
            this.getQueryFinancingData();
        },

        // 融资轮次选择
        financingSelect(index) {
            this.financingList[index].isSelect = !this.financingList[index].isSelect;
        },

        // 融资时间重置
        onfinancingTimeCancel() {
            this.financingTime = '';
            this.financingTimeValue = '';// 融资时间值
            this.financingTimeMinDate = '开始时间';// 融资时间最低年限
            this.financingTimeMaxDate = '结束时间';// 融资时间最高年限
            this.financingTimeMinValue = '';// 融资时间最低年限最终值
            this.financingTimeMaxValue = '';// 融资时间最高年限最终值
        },

        // 融资时间确定
        onfinancingTimeConfirm() {
            this.$refs.financingTimeDrop.toggle(false);
            if( !this.financingTimeMaxValue && !this.financingTimeMinValue ){
              this.financingTimeMaxValue = this.geshiTime(new Date());
              this.financingTimeMinDate = '开始时间';
              this.financingTimeMaxDate = '结束时间';
              const timestamp = Date.now();
              if (this.financingTime == '近一周') {
                this.financingTimeMinValue = this.geshiTime(timestamp - 24 * 60 * 60 * 7 * 1000);
              } else if (this.financingTime == '近一月') {
                this.financingTimeMinValue = this.geshiTime(timestamp - 24 * 60 * 60 * 30 * 1000);
              } else if (this.financingTime == '近一年') {
                this.financingTimeMinValue = this.geshiTime(timestamp - 24 * 60 * 60 * 365 * 1000);
              } else {
                this.financingTimeMinValue = '';
                this.financingTimeMaxValue = '';
              }
            }
          this.pageLoading = false;
            this.getQueryFinancingData();
        },

        // 融资时间选择
        financingTimeSelect(financingTimeItem) {
            this.financingTime = financingTimeItem.value;
            this.financingTimeMinDate = '开始时间';// 融资时间最低年限
            this.financingTimeMaxDate = '结束时间';// 融资时间最高年限
            this.financingTimeMinValue = '';// 融资时间最低年限最终值
            this.financingTimeMaxValue = '';// 融资时间最高年限最终值
        },

        // 格式化时间
        geshiTime(time) {
            const date = new Date(time);
            const year = date.getFullYear();
            const month = date.getMonth() + 1;
            const day = date.getDate();
            if (month < 10) {
              if (day < 10) {
                return time = `${year}0${month}0${day}`
              } else {
                return time = `${year}0${month}${day}`
              }
            } else {
              if (day < 10) {
                return time = `${year}${month}0${day}`
              } else {
                return time = `${year}${month}${day}`
              }
            }
            // return time = `${year}${month}${day}`
        },

      startDateShowDialog(){
        this.startDateShow = true;
        this.isShowDatePicker = true;
      },

      formatDate(date) {
        if (date.getMonth()+1 < 10) {
          return `${date.getYear()+1900}-0${date.getMonth()+1}-${date.getDate()}`;
        } else {
          return `${date.getYear()+1900}-${date.getMonth()+1}-${date.getDate()}`;
        }
      },

      formatUpdateDate(date) {
        if (date.getMonth()+1 < 10) {
          if (date.getDate() < 10) {
            return `${date.getFullYear()}0${date.getMonth()+1}0${date.getDate()}`;
          } else {
            return `${date.getFullYear()}0${date.getMonth()+1}${date.getDate()}`;
          }
        } else {
          if (date.getDate() < 10) {
            return `${date.getFullYear()}${date.getMonth()+1}0${date.getDate()}`;
          } else {
            return `${date.getFullYear()}${date.getMonth()+1}${date.getDate()}`;
          }
        }
      },


        // 融资时间开始日期
        onConfirmStartDate(value) {
          this.financingTime = '';
          // const formatDate = (date) => `${date.getFullYear()}${date.getMonth() + 1}${date.getDate()}`;
          this.financingTimeMinDate = this.formatDate(value);
          this.financingTimeMin = this.formatUpdateDate(value);
          this.financingTimeMinValue = this.financingTimeMin;
          this.startDateShow = false;
          this.isShowDatePicker = false;
        },

      // 开始时间取消
      startDateCancel() {
        this.financingTimeMinDate = '开始时间';
        this.financingTimeMinValue = '';
        this.startDateShow = false;
        this.endDateShow = false;
        this.isShowDatePicker = false;
      },


      endDateShowDialog(){
        this.endDateShow = true;
        this.isShowDatePicker = true;
      },

        // 融资时间结束日期
        onConfirmEndDate(value) {
          this.financingTime = '';
            this.financingTimeMax = this.formatUpdateDate(value);
          this.financingTimeMaxDate = this.formatDate(value);
            this.financingTimeMaxValue = this.financingTimeMax;
            this.endDateShow = false;
            this.isShowDatePicker = false;
        },

      // 结束时间取消
      endDateCancel() {
        this.financingTimeMaxDate = '结束时间';
        this.financingTimeMaxValue = '';
        this.startDateShow = false;
        this.endDateShow = false;
        this.isShowDatePicker = false;
      },


        async getQueryFinancingData() {
            let params = {
                "keyword": this.searchValue,// 搜索关键词
                "city": this.cityValue,// 市
                "county": this.areaValue,// 区
                "rounds": this.financingValue,// 融资轮次
                "industryCodes": this.industryValue,// 行业
                "begindate": this.financingTimeMinValue,// 开始日期
                "enddate": this.financingTimeMaxValue,// 截止日期
                "pageNum": this.currentPage,
                "pageSize": 10,
            }
            let result = await getQueryFinancing(params);
            if (result) {
              this.financingValue = [];
              this.pageLoading = true;
              if (this.loading) {
                this.financingDataList = this.financingDataList.concat(result.records);
              } else {
                this.financingDataList = result.records;
              }
              this.totalDatas = result.total;
              if (this.financingDataList.length < result.total) {
                this.isEndLoading = false;
              } else {
                this.isEndLoading = true;
              }
              this.loading = false;
            }
        },


        // 滚动到页面底部时，请求内容
        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.loading = true;
                this.currentPage += 1;
                this.getQueryFinancingData();
            }
        },


    }
}
</script>

<style lang="less" scoped>
.wrapper {
    min-height: 100vh;
    padding-top: 46px;
}

.search-header-box {
    width: 100vw;
    padding: 1rem 1rem 0;
    background: #ffffff;
    position: sticky;
    z-index: 100;
    top: 46px;
    left: 0;
}

.search-input {
    margin-bottom: 10px;
}

.van-search {
    padding: 0;
}

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

.select-item-box {
    display: flex;
    justify-content: start;
    align-items: self-start;
    flex-wrap: wrap;
    width: 100%;
    height: 248px;
    overflow: scroll;
    padding: 0 1rem;
    margin-top: 10px;
}

.select-date-item-box {
    padding: 1rem;
    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;
}

.popup-box {
    height: 308px;
    padding-bottom: 3rem;
    position: relative;
}



.more-screen-bottom-botton {
    border-top: solid 1px #f2f2f2;
    height: 60px;
    width: 100%;
    padding: 10px 1rem;
    background: #ffffff;
    position: absolute;
    bottom: 0;
    left: 0;
}

.border-bottom-f2f2f2 {
    border-bottom: solid 1px #f2f2f2;
}

.data-picker-box {
    margin-top: 10px;
}

.total-font-title {
    padding: 0 1rem;
    font-size: 0.9rem;
    color: #666666;
    height: 40px;
    line-height: 40px;
    background: #f2f2f2;
}

.color-red {
    color: red;
}

.search-content-item {
    background: #ffffff;
    padding: 1rem 0;
    margin-bottom: 10px;
}

.search-content-item-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 1rem;
}

.search-content-item-title-h4 {
    font-size: 0.9rem;
    font-weight: bold;
}

.height-30 {
    height: 30px !important;
}

.search-content-item-gongsi {
    font-size: 0.8rem;
    color: #2372eb;
    margin-bottom: 16px;
    padding: 0 1rem;
}

.search-content-financing-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 0 1rem;
    margin-bottom: 10px;
}

.search-content-financing-info {
    text-align: center;
    font-size: 0.8rem;
}

.search-content-financing-info-content {
    font-weight: bold;
    margin-bottom: 10px;
}

.search-content-financing-line {
    width: 1px;
    height: 40px;
    background: #dfdfdf;
}

.search-content-invest-box {
    display: flex;
    justify-content: start;
    align-items: start;
    font-size: 0.8rem;
    background: #f2f2f2;
    padding: 1rem;
}

.invest-name:not(:last-child) {
    margin-bottom: 6px;
}
</style>
