123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- 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: ['A'],
- 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,
- baiduName: ''
- }
- },
- 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.$refs.searchType.setState(this.filterState.searchType)
- },
- 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()
- this.doSearch()
- } 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)
- setTimeout(function () {
- tabHover()
- }, 300)
- },
- 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 (name) {
- this.baiduName = name
- 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开始
- }
- 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) {
- this.setListStateAndCheckPower(res)
- } else {
- this.checkLogin()
- }
- }.bind(this),
- complete: function () {
- this.listState.loading = false
- this.listState.loaded = true
- }.bind(this)
- })
- },
- setListStateAndCheckPower: function (res) {
- var _this = this
- if (res.data) {
- if (res.data.total) {
- if (this.power) {
- this.listState.total = res.data.total
- } else {
- this.listState.total = 4
- }
- }
- if (res.data.list) {
- res.data.list.forEach(function (d) {
- d.company_shortname = _this.getShortName(d.company_name)
- d.randomBgc = _this.randomBgc()
- })
- 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_shortname: 'xxx',
- 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 = []
- }
- },
- onPageChange: function (p) {
- this.listState.pageNum = p
- this.getList()
- },
- openVipPage: function (param) {
- // 企业搜索中标区域-去开通
- // 企业搜索单位类型-去开通
- // 企业搜索联系方式-去开通
- // 企业搜索底部第五条-去开通
- if(param === 'more') {
- this.baiduName = '底部第五条'
- }
- var str = '企业搜索' + this.baiduName + '-去开通'
- baiduEvent(str) // 去开通按钮百度统计
- 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 '-'
- }
- },
- getEntStatus: function (status) {
- if (status === '吊销') {
- return 'tag-danger'
- } else if (status === '注销') {
- return 'tag-danger'
- } else if (status === '撤销') {
- return 'tag-disabled'
- } else {
- return ''
- }
- },
- randomBgc: function () {
- var arr = ['default', 'blue', 'orange', 'green']
- var randomIndex = utils.getRandomNumber(0, arr.length - 1)
- return 'bgc-' + arr[randomIndex]
- },
- getShortName: function (comName) {
- var areaMap = chinaMapJSON || []
- var shortname = comName
- // 1. 循环省份城市进行替换
- areaMap.forEach(function (item) {
- var p = item.name.replace(/[省市]/, '')
- if (shortname.indexOf(p) !== -1) {
- shortname = shortname.replace(item.name, '').replace(p, '')
- console.log(p + ' -> \'\'')
- }
- item.city.forEach(function (iitem) {
- var c = iitem.name.replace(/[省市]/, '')
- if (shortname.indexOf(c) !== -1) {
- shortname = shortname.replace(iitem.name, '').replace(c, '')
- console.log(c + ' -> \'\'')
- }
- iitem.area.forEach(function (iiitem) {
- if (shortname.indexOf(iiitem) !== -1) {
- shortname = shortname.replace(iiitem, '')
- console.log(iiitem + ' -> \'\'')
- }
- })
- })
- })
- var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm)
- var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4)
- if (shortname.length < 4) {
- shortname = shortname.slice(0, 4)
- }
- return shortname
- }
- }
- })
- ;(function () {
- var backUpLoginCallback = logic
- logic = function (data, num) {
- // do something
- // 如果是当前页面已经使用过了,则只需要刷新power即可
- if (data.result === 'ok') {
- vm.getPower()
- }
- backUpLoginCallback(data, num)
- }
- })()
- function tabHover () {
- $('#tab-zb').on('mouseover', function () {
- $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX(0)'})
- }).on('mouseout', function () {
- $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX(96px)'})
- })
- }
- function refreshEwmText (text) {
- if (text && text.trim().length > 0) {
- $(".wx-inner-title").html("扫码关注企业");
- $(".wx-inner-bottom").html('扫码即可实时接收<span style="color:#2cb7ca">'+'"'+text+'"'+'</span>的中标信息!');
- }
- }
- 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"
- })
- })
- }
- function baiduEvent(name) {
- console.log(name)
- try {
- _hmt.push(['_trackEvent', '超级订阅-pc', 'click', name]);
- } catch (e) {
- console.log('未初始化百度统计')
- }
- }
|