var vm = new Vue({ el: '.vue-search-container', delimiters: ['${', '}'], components: { areaCityComponent: areaCityComponent, selectListComponent: selectListComponent, priceComponent: priceComponent, noData: noDataComponent }, data: function () { return { provinceMap: provinceMap, searchContent: '', tabActive: 'qy', filterShow: true, searchTypeList: [ { label: '企业名称', value: 'A' }, { label: '法定代表人', value: 'B' }, { label: '股东', value: 'C' }, { label: '高管', value: 'D' }, { label: '中标项目/标的物', value: 'E' } ], entTypeList: [ { label: '有限责任公司', value: 'A' }, { label: '股份有限公司', value: 'B' }, { label: '有限合伙', value: 'C' }, { label: '普通合伙', value: 'D' } ], entStateList: [ { label: '存续(在营、开业、在业)', value: 'A' }, { label: '吊销', value: 'B' }, { label: '注销', value: 'C' }, { label: '撤销', value: 'D' } ], priceList: [ { label: '100万以内', value: '0-100' }, { label: '100-500万', value: '100-500' }, { label: '500-1000万', value: '500-1000' }, { label: '1000-5000万', value: '1000-5000' }, { label: '5000万以上', value: '5000-' }, ], zblyFilterOption: { zbAreaOptions: [ // { // label: '北京', // value: '北京' // } ], dwlxOptions: [ { label: '采购单位', value: '1' }, { label: '投标企业', value: '2' }, { label: '招标代理机构', value: '3' }, { label: '厂商', value: '4' } ], lxfsOptions: [ { label: '固定电话', value: '1' }, { label: '手机号', value: '2' }, { label: '电子邮箱', value: '3' }, { label: '不存在', value: '4' } ], }, filterState: { searchType: [], entArea: [], entCity: [], entType: [], entStatus: [], entCapital: [], biddingArea: '', // 中标区域 entClass: '', // 单位类型 entContact: '' // 联系方式 }, listState: { loaded: false, // 是否已经搜索过 loading: false, pageNum: 1, // 当前页, 从0开始 pageSize: 10, // 每页多少条数据 total: 0, // 一共多少条数据 list: [] // 查询请求返回的数据 }, preSearch: { hover: false, focus: false, list: [] }, powerInfo: { entniche: '', member: '', vip: '' }, power: false, powerLoaded: false, powerDialogShow: false, } }, watch: { tabActive: function (newVal, oldVal) { if (newVal === 'zb') { if (this.searchContent) { location.href = '/jylab/supsearch/index.html?keywords=' + this.searchContent } else { location.href = '/jylab/supsearch/index.html' } } } }, computed: { preSearchListShow: function () { return this.searchContent.trim().length > 2 && this.preSearch.list.length && (this.preSearch.focus || this.preSearch.hover) }, buttonText: function () { if (this.power) { return '升级' } else { if (this.powerInfo.vip === 0) { return '开通' } else if (this.powerInfo.vip === 1) { return '升级' } else { return '升级' } } } }, created: function () { this.getPower() this.initPageData() this.initProvinceMapList() }, mounted: function () { this.initDOMEvents() // this.checkLogin() }, methods: { checkLogin: function () { var moduleOpen = $('body').hasClass('modal-open') if (moduleOpen) return if (!loginflag) { $("#bidLogin").modal("show"); } }, getPower: function (callback) { $.ajax({ url: '/publicapply/bidcoll/power', type: 'POST', success: function (res) { if (res.error_code === 0 && res.data) { Object.assign(this.powerInfo, res.data) this.checkPower() } else { this.checkLogin() } }.bind(this), complete: function () { this.powerLoaded = true callback && callback() }.bind(this) }) }, checkPower: function () { this.power = this.powerInfo.member || this.powerInfo.vip !== 0 }, initPageData: function () { if (pageInfo.searchContent) { this.searchContent = pageInfo.searchContent } }, initProvinceMapList: function () { var provinceMapList = [] for (var key in this.provinceMap) { this.provinceMap[key].forEach(function (item) { provinceMapList.push({ label: item, value: item }) }) } this.zblyFilterOption.zbAreaOptions = provinceMapList }, initDOMEvents: function () { ewmMoveHover() refreshEwmText(this.searchContent) }, isFilterShow: function () { if (this.filterShow) { $('.search-filters').slideUp() } else { $('.search-filters').slideDown() } this.filterShow = !this.filterShow }, searchTypeChange: function (t) { var eIndex = t.indexOf('E') if (!this.power && eIndex !== -1) { this.powerDialogShow = true t.splice(eIndex, 1) this.$refs.searchType.setState(t) return } this.filterState.searchType = t this.doSearch() }, areaCityChange: function (area) { var city = [] for (var key in area) { city = city.concat(area[key]) } this.filterState.entArea = Object.keys(area) this.filterState.entCity = city this.doSearch() }, entTypeChange: function (e) { this.filterState.entType = e this.doSearch() }, entStateChange: function (e) { this.filterState.entStatus = e this.doSearch() }, // 标准金额区间 inexactPriceChange: function (p) { this.filterState.entCapital = p this.doSearch() }, // 输入金额区间 exactPriceChange: function (p) { this.$refs.entCapital.setState() this.filterState.entCapital = [p.min + '-' + p.max] this.doSearch() }, zbFilterChange: function () { if (this.power) { this.doSearch() } else { this.filterState.biddingArea = '' this.filterState.entClass = '' this.filterState.entContact = '' this.powerDialogShow = true } }, doSearch: function () { this.resetListState() this.getList() }, resetListState: function () { var state = { loaded: false, loading: false, pageNum: 1, total: 0, list: [] } Object.assign(this.listState, state) }, getPreSearchList: utils.debounce(function () { var data = { name: this.searchContent.trim() } if (data.name.length <= 2) return $.ajax({ url: '/bigmember/search/ent/association', method: 'POST', data: data, success: function (res) { if (res.error_code === 0) { if (res.data) { this.preSearch.list = res.data.list || [] } } else { this.checkLogin() } }.bind(this) }) }, 200), getList: function () { var data = { match: this.searchContent, matchType: this.filterState.searchType.join(','), entArea: this.filterState.entArea.join(','), entCity: this.filterState.entCity.join(','), entCapital: this.filterState.entCapital.join(','), entType: this.filterState.entType.join(','), entStatus: this.filterState.entStatus.join(','), biddingArea: this.filterState.biddingArea, entClass: this.filterState.entClass, entContact: this.filterState.entContact, pageSize: this.listState.pageSize, pageNum: this.listState.pageNum - 1, // 当前页, 从0开始 } // return console.info(JSON.stringify(data, null, 2)) if (!data.match.replace(/\s+/g, '')) return this.listState.loading = true this.listState.loaded = false $.ajax({ url: '/publicapply/enterpriseSearch/doQuery', method: 'POST', data: data, success: function (res) { if (res.error_code === 0) { if (res.data) { if (res.data.total) { if (this.power) { this.listState.total = res.data.total } else { this.listState.total = 9 } } if (res.data.list) { if (this.power) { this.listState.list = res.data.list || [] } else { if (res.data.list.length > 4) { res.data.list.length = 4 res.data.list.push({ company_address: 'xxx', company_name: 'xxx', company_status: 'xxx', legal_person: 'xxx', id: 'xxx', showMask: true }) } this.listState.list = res.data.list || [] } } } else { this.listState.total = 0 this.listState.list = [] } } else { this.checkLogin() } }.bind(this), complete: function () { this.listState.loading = false this.listState.loaded = true }.bind(this) }) }, onPageChange: function (p) { this.listState.pageNum = p this.getList() }, openVipPage: function () { window.open('/front/subscribe.html') }, toDetail: function (id) { window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id) }, calcListItemForCap: function (p) { if (p) { return p + '万元' } else { return '-' } }, } }) function refreshEwmText (text) { if (text && text.trim().length > 0) { $(".wx-inner-title").html("扫码关注企业"); $(".wx-inner-bottom").html('扫码即可实时接收'+'"'+text+'"'+'的中标信息!'); } } function ewmMoveHover() { var $div = $(".search-right-wx .search-right-wx-inner"), $parent = $(".search-right-wx"); $parent.on("mouseover",function(){ $div.css({ "transform":"scale(1)", "transition":"transform 0.8s" }) }) $parent.on("mouseout",function(){ $div.css({ "transform":"scale(0)", "transition":"transform 0.2s" }) }) }