12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124 |
- var vm = new Vue({
- el: '.vue-search-container',
- delimiters: ['${', '}'],
- components: {
- areaCityComponent: areaCityComponent,
- selectListComponent: selectListComponent,
- priceComponent: priceComponent,
- noData: noDataComponent
- },
- data: function () {
- return {
- foundingTime:'',//成立时间
- provinceMap: provinceMap,
- searchContent: pageInfo.searchContent,
- tabActive: 'qy',
- filterShow: true,
- query: {},
- searchTypeList: [
- {
- label: '企业名称',
- value: 'A'
- },
- {
- label: '法定代表人',
- value: 'B'
- },
- // {
- // label: '股东',
- // value: 'C'
- // },
- // {
- // label: '高管',
- // value: 'D'
- // },
- {
- label: '经营范围',
- needVip: true,
- value: 'F'
- },
- {
- label: '中标项目/标的物',
- needVip: true,
- 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'
- }
- ],
- entTimeList:[
- {
- label: '近1年内',
- value: 'A'
- },
- {
- label: '1-3年',
- value: 'B'
- },
- {
- label: '3-5年',
- value: 'C'
- },
- {
- label: '5-10年',
- value: 'D'
- },
- {
- label: '10年以上',
- value: 'E'
- },
- ],
- 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: '', // 联系方式
- establish:[],//成立时间
- },
- listState: {
- loaded: false, // 是否已经搜索过
- loading: false,
- pageNum: 1, // 当前页, 从0开始
- pageSize: 10, // 每页多少条数据
- total: 0, // 一共多少条数据
- list: [], // 查询请求返回的数据
- pageTotal: 1 // 一共多少页(计算出来)
- },
- preSearch: {
- hover: false,
- focus: false,
- list: []
- },
- entUseInfo: {
- used: 0,
- total: 0,
- province: 0
- },
- powerInfo: {
- entniche: '',
- member: '',
- vip: ''
- },
- power: false,
- powerLoaded: false,
- powerDialogShow: false,
- baiduName: '',
- inputStatus: false,
- inIframe: false,
- isLogin: false,
- buttonType:false,//成立时间自定义区间确定按钮的显示状态
- focusColor:false,//改变获取焦点输入框的背景颜色
- startDate:'',
- endDate:'',
- thisStartTime:'',
- thisEndTime:'',
- indusShow: false,
- employInfo: []
- }
- },
- watch: {
- tabActive: function (newVal, oldVal) {
- if (newVal === 'zb') {
- if (this.searchContent) {
- location.href = '/jylab/supsearch/index.html?keywords=' + this.searchContent + '&publishtime=thisyear'
- } else {
- location.href = '/jylab/supsearch/index.html'
- }
- } else if (newVal === 'cgdw') {
- if (this.searchContent) {
- location.href = '/jylab/purSearch/index.html?keywords=' + this.searchContent
- } else {
- location.href = '/jylab/purSearch/index.html'
- }
- } else if (newVal === 'gy') {
- if (this.searchContent) {
- location.href = '/swordfish/page_web_pc/search/issued?keywords=' + this.searchContent
- } else {
- location.href = '/swordfish/page_web_pc/search/issued'
- }
- }
- }
- },
- computed: {
- getInputStatus: function () {
- return this.inputStatus
- },
- 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 '升级'
- }
- }
- },
- showEntUsage: function () {
- return !this.powerInfo.member && this.powerInfo.vip > 1
- },
- searchTypeListComputed: function () {
- if (this.isLogin) {
- return this.searchTypeList
- } else {
- var arr = []
- this.searchTypeList.forEach(function (item) {
- if (!item.needVip) {
- arr.push(item)
- }
- })
- return arr
- }
- },
- getVipSubText: function () {
- var count = this.entUseInfo.province
- if (count == -1) {
- return '全国'
- } else {
- if (count) {
- return count + '个省'
- } else {
- return ''
- }
- }
- },
- getBIParams () {
- const urlParams = new URLSearchParams(window.location.search)
- return urlParams.get('resource')
- }
- },
- created: function () {
- var params = goTemplateData.params
- this.inIframe = goTemplateData.inIframe
- this.isLogin = !!params.isLogin
- if (this.isLogin) {
- this.getPower()
- } else {
- this.doSearch()
- }
- this.getQuery()
- this.initPageData()
- this.initProvinceMapList()
- },
- mounted: function () {
- this.initDOMEvents()
- // 默认选中搜索范围
- this.$refs.searchType.setState(this.filterState.searchType)
- // 全选按钮逻辑
- // this.searchTypeChange([], true)
- this.industryTab()
- /**
- * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
- * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
- */
- // if (goTemplateData.inIframe) {
- // this._$SearchEvent = initSearchPageEvent({
- // type: 'company',
- // el: '.search-header-top .input-container',
- // submitSelector: '.search-button',
- // change: function(val) {
- // this.searchContent = val
- // }
- // })
- // }
- },
- methods: {
- // 查询收录情况
- getEmployData (ids) {
- const url = '/jyapi/crmApplication/employ/info'
- const params = {
- employType: 2,
- idArr: ids ? ids.join(',') : ''
- }
- $.ajax({
- url: url,
- type: 'POST',
- data: JSON.stringify(params),
- contentType: 'application/json',
- success: function (res) {
- if (res.error_code === 0) {
- this.employInfo = res.data
- res.data.forEach((r) => {
- this.listState.list.forEach(m => {
- if(m.id === r.id) {
- m.active = r.isEmploy ? 1 : 0
- }
- })
- })
- this.$forceUpdate()
- console.info(this.listState.list)
- }
- }.bind(this)
- })
- },
- // 收录操作
- setEmployEvent (item) {
- const _this = this
- const url = '/jyapi/crmApplication/employ/operate'
- const params = {
- idArr: item.id,
- isEmploy: !item.active,
- employType: 2
- }
- $.ajax({
- url: url,
- type: 'POST',
- data: JSON.stringify(params),
- contentType: 'application/json',
- success: function (res) {
- if(res.error_code === 0) {
- if (res.data.status) {
- item.active = !item.active ? 1 : 0
- } else {
- _this.toastFn(res.data.msg, 800)
- }
- }
- this.$forceUpdate()
- }.bind(this),
- complete: function () {
- }.bind(this)
- })
- },
- getQuery: function () {
- this.query.from = getParam('from')
- this.query.point = getParam('point')
- },
- industryTab: function() {
- $.ajax({
- type:'POST',
- url:'/entnicheNew/buy/whetherbuy',
- success:function (res) {
- if (res && res.error_code == 1001 || res.error_msg.indexOf('登录') >- 1) {
- $('#tab-cgdw').css('display', 'none')
- }
- if (res && res.data && res.data.isNew) {
- $('#tab-cgdw').css('display', 'inline-block')
- } else {
- $('#tab-cgdw').css('display', 'none')
- }
- }
- })
- },
- getSearchForValues: function () {
- return this.searchTypeList.map(function (v) {
- return v.value
- })
- },
- 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()
- if (this.showEntUsage) {
- this.getEntProtUsage()
- }
- } 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
- return this.power
- },
- initPageData: function () {
- console.info(pageInfo)
- 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)
- insertVipIcon($('.search-type .el-checkbox:nth-of-type(4)'))
- insertVipIcon($('.search-type .el-checkbox:nth-of-type(5)'))
- setTimeout(function () {
- tabHover()
- }, 300)
- },
- isFilterShow: function () {
- if (this.filterShow) {
- $('.search-filters').slideUp()
- } else {
- $('.search-filters').slideDown()
- }
- this.filterShow = !this.filterShow
- },
- searchTypeChange: function (t, hideTip) {
- // 全选逻辑隐藏
- // var tempRef = this.$refs.searchType
- // var tempList = this.getSearchForValues()
- // if (t.length === 0) {
- // if (tempRef && tempRef.$data.selectList[0].selected) {
- // t = tempList
- // }
- // } else if (tempList.join('') === t.join('')) {
- // tempRef && tempRef.setState()
- // }
- console.info(t);
- console.info(hideTip);
- var eIndex = t.indexOf('E')
- if (!this.power && eIndex !== -1) {
- t.splice(eIndex, 1)
- this.$refs.searchType.setState(t)
- if (!hideTip) {
- this.powerDialogShow = true
- return
- }
- }
- var eIndex1 = t.indexOf('F')
- if (!this.power && eIndex1 !== -1) {
- t.splice(eIndex1, 1)
- this.$refs.searchType.setState(t)
- if (!hideTip) {
- this.powerDialogShow = true
- return
- }
- }
- this.filterState.searchType = t
- this.doSearch()
- },
- areaCityChange: function (area) {
- var city = []
- var area_arr = []
- for (var key in area) {
- if(area[key].length>0){
- city = city.concat(area[key])
- }else{
- area_arr = area_arr.concat(key)
- }
- }
- this.filterState.entArea = area_arr//Object.keys(area)
- this.filterState.entCity = city
- this.doSearch()
- },
- entTypeChange: function (e) {
- if (!e.length) {
- this.$refs.entType.$data.selectList[0].selected = true
- }
- this.filterState.entType = e
- this.doSearch()
- },
- entStateChange: function (e) {
- if (!e.length) {
- this.$refs.entState.$data.selectList[0].selected = true
- }
- this.filterState.entStatus = e
- this.doSearch()
- },
- //计算几年前的时间戳
- getTimeDate: function(year){
- let time = Number(year);
- let date = new Date();
- let lastYear = Number(date.getFullYear()-time)+'-'+Number(date.getMonth()+1)+'-'+date.getDate();
- let lastYearDate = new Date(lastYear);
- lastYearDate = lastYearDate.getTime();//一年前时间戳;
- return lastYearDate;
- },
- //成立时间多选
- entTimeChange: function (e) {
- let _this = this;
- // console.info('成立时间多选',e);
- _this.focusColor = false;
- if (!e.length) {
- _this.$refs.entTime.$data.selectList[0].selected = true;
- _this.filterState.establish = [];
- }else{
- let thisList = [];
- e.forEach(function (item) {
- // console.info(item);
- switch (item) {
- case 'A':
- // thisList.push(_this.getTimeDate(0)+'-'+_this.getTimeDate(1))
- thisList.push('-1y')
- break;
- case 'B':
- // thisList.push(_this.getTimeDate(1)+'-'+_this.getTimeDate(3))
- thisList.push('1y-3y')
- break;
- case 'C':
- // thisList.push(_this.getTimeDate(3)+'-'+_this.getTimeDate(5))
- thisList.push('3y-5y')
- break;
- case 'D':
- // thisList.push(_this.getTimeDate(5)+'-'+_this.getTimeDate(10))
- thisList.push('5y-10y')
- break;
- case 'E':
- // thisList.push(_this.getTimeDate(10)+'-'+_this.getTimeDate(1))
- thisList.push('10y-')
- break;
- default:
- break;
- }
- _this.filterState.establish = thisList;
- })
- // if (_this.foundingTime) {
- // // console.info(_this.foundingTime)
- // _this.filterState.establish.push(_this.foundingTime[0]+'-'+_this.foundingTime[1])
- // }
- }
- console.info(_this.filterState.establish);
- _this.doSearch()
- },
- //时间戳转换yyyy-mm-dd
- getThisDate:function(time){
- var date = new Date(time);
- var YY = date.getFullYear() + '年';
- var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
- var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日';
- return YY + MM + DD
- },
- //成立时间区间
- foundingTimeChange:function(e){
- if (e) {
- let time = e[0]+'-'+e[1];
- console.info('成立时间',time);
- console.info('成立时间',e);
- this.startDate = this.getThisDate(e[0]);
- this.endDate = this.getThisDate(e[1]);
- }
- },
- startTimeChange:function(e){
- if (e) {
- console.info('startTimeChange',e);
- this.startDate = this.getThisDate(e);
- }
- },
- endTimeChange:function(e){
- if (e) {
- console.info('endTimeChange',e);
- if (e < this.thisStartTime && this.thisStartTime) {
- // alert('结束日期不能小于开始日期,请重新选择')
- this.endDate = '';
- this.thisEndTime = '';
- this.$notify.error({
- title: '错误',
- message: '结束日期不能小于开始日期,请重新选择'
- });
- }else{
- this.endDate = this.getThisDate(e);
- }
- }
- },
- //成立时间自定义区间搜索按钮
- establishSearch:function () {
- let _this = this;
- let thisList = [];
- // console.info(_this.foundingTime);
- // if (_this.foundingTime) {
- // thisList.push(_this.foundingTime[0]/1000+'-'+_this.foundingTime[1]/1000)
- // _this.$refs.entTime.$data.selectList.forEach(function (item) {
- // // console.info(item);
- // item.selected = false;
- // })
- // _this.filterState.establish = thisList;
- // }else{
- // _this.$refs.entTime.$data.selectList.forEach(function (item) {
- // // console.info(item);
- // item.selected = false;
- // })
- // _this.$refs.entTime.$data.selectList[0].selected = true;
- // _this.filterState.establish = [];
- // }
- if (_this.thisStartTime && _this.thisEndTime) {
- thisList.push(_this.thisStartTime/1000+'-'+_this.thisEndTime/1000)
- _this.$refs.entTime.$data.selectList.forEach(function (item) {
- // console.info(item);
- item.selected = false;
- })
- _this.filterState.establish = thisList;
- }else{
- _this.$refs.entTime.$data.selectList.forEach(function (item) {
- // console.info(item);
- item.selected = false;
- })
- _this.$refs.entTime.$data.selectList[0].selected = true;
- _this.filterState.establish = [];
- }
- _this.doSearch();
- _this.buttonType = false;
- },
- showButton:function () {
- let _this = this;
- _this.buttonType = true;
- },
- hiddenButton:function () {
- // let _this = this;
- // _this.buttonType = false;
- },
- changeColor:function() {
- let _this = this;
- _this.focusColor = true;
- },
- // 标准金额区间
- inexactPriceChange: function (p) {
- if (!p.length) {
- this.$refs.entCapital.$data.selectList[0].selected = true
- }
- this.filterState.entCapital = p
- this.inputStatus = false
- this.doSearch()
- },
- // 输入金额区间
- exactPriceChange: function (p) {
- this.$refs.entCapital.setState()
- if (p.min === '' && p.max === '') {
- this.filterState.entCapital = ['']
- this.$refs.entCapital.$data.selectList[0].selected = true
- this.inputStatus = false
- } else {
- this.$refs.entCapital.$data.selectList[0].selected = false
- this.filterState.entCapital = [p.min + '-' + p.max]
- this.inputStatus = true
- }
- 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
- }
- },
- getEntProtUsage: function () {
- $.ajax({
- url: '/bigmember/portrait/subVipPortrait/usage',
- method: 'POST',
- success: function (res) {
- if (res.error_code === 0) {
- if (res.data.total) {
- this.entUseInfo.total = res.data.total
- }
- if (res.data.provin) {
- this.entUseInfo.province = res.data.provin
- }
- if (res.data.usage) {
- this.entUseInfo.used = res.data.usage
- }
- }
- }.bind(this)
- })
- },
- setPageTdk () {
- var name = this.searchContent.trim()
- if (name) {
- setPageTdkToView({
- title: name + '相关搜索结果 - 剑鱼标讯',
- keywords: name + ',' + name + '中标信息,' + name + '项目动态,剑鱼标讯',
- description: '剑鱼标讯企业搜索是国内专业的中标企业信息查询平台,为您提供' + name + '相关的中标企业信息详情,帮助您全面了解中标企业最新动态,获取更多' + name + '相关搜索结果就上剑鱼标讯!'
- })
- } else {
- setPageTdkToView({
- title: '企业工商信息查询_公司招投标查询_中标企业查询 - 剑鱼标讯',
- keywords: '企业信息查询,工商查询,招投标公司查询,中标企业查询,中标单位,中标企业画像,剑鱼标讯',
- description: '剑鱼标讯企业搜索为您精准提供全国工商企业信息、招投标公司及中标企业信息查询服务,涵盖企业信息查询,工商查询,招投标公司查询,中标企业搜索,中标企业画像查看等多维度服务,帮您快速了解企业招投标情况,提前预判风险,拓展合作商机。'
- })
- }
- },
- doSearch: function () {
- this.setPageTdk()
- 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 () {
- /**
- * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
- * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
- */
- if (this._$SearchEvent) {
- this._$SearchEvent.syncInput()
- }
- 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(','),
- establish: this.filterState.establish.join(','),//成立时间筛选条件
- biddingArea: this.filterState.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) {
- this.listState.total = res.data.total
- this.listState.pageTotal = Math.ceil(res.data.total / this.listState.pageSize)
- }
- if (res.data.list) {
- res.data.list.forEach(function (d) {
- d.company_shortname = _this.getShortName(d.company_name)
- d.randomBgc = _this.randomBgc()
- try {
- d.visited = visitedPath.pathVisited(
- new VisitedPathItem(
- '/ent_portrait/*',
- 'id=' + d.id
- )
- )
- } catch (error) {}
- })
- this.listState.list = res.data.list || []
- const resultIds = res.data.list.map(v => v.id)
- this.getEmployData(resultIds)
- // 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) {
- console.log(p, this.listState.total, this.listState.pageTotal);
- if (p > this.listState.pageTotal) {
- return this.toastFn('超出页码', 3000)
- }
- this.listState.pageNum = p
- this.getList()
- },
- openVipPage: function (param) {
- // 企业搜索中标区域-去开通
- // 企业搜索单位类型-去开通
- // 企业搜索联系方式-去开通
- // 企业搜索底部第五条-去开通
- // 企业搜索popover-去开通
- if (param === 'more') {
- this.baiduName = '底部第五条'
- } else if (param === 'popover-link') {
- this.baiduName = '-超级订阅用户-当月已使用hover'
- }
- var str = '企业搜索' + this.baiduName + '-去开通'
- baiduEvent(str) // 去开通按钮百度统计
- window.open('/swordfish/page_big_pc/free/svip/buy')
- },
- openEntHistory: function () {
- baiduEvent('企业画像查看历史记录')
- window.open('/swordfish/frontPage/seeHistory/sess/index')
- },
- openCustomerService: function () {
- $('#go-customer-4').trigger('click')
- },
- toDetail: function (item) {
- var id = item.id || item.entId
- let BIPage = ''
- if (this.getBIParams) {
- BIPage = '?resource=BI'
- } else {
- BIPage = ''
- }
- // 去超级订阅画像
- var svipLink = '/swordfish/page_big_pc/svip/ent_ser_portrait/' + id + BIPage
- // 大会员画像
- var memberLink = '/swordfish/page_big_pc/ent_portrait/' + id + BIPage
- // 是渠道合作页面需要登录后重定向
- if(cooperateCode) {
- openLoginDig(null, svipLink)
- return
- }
- try {
- item.visited = true
- visitedPath.pathVisiting(
- new VisitedPathItem(
- '/ent_portrait/*',
- 'id=' + id
- )
- )
- } catch (error) {}
- if (this.powerInfo.member) {
- // 如果是专家版、智慧版 跳大会员页面
- if (window.memberPower && window.memberPower.indexOf(4) !== -1) {
- window.open(memberLink)
- } else {
- // 如果是商机版、自定义版
- // 如果同时是超级订阅 判断有没有画像查看次数
- if (this.powerInfo.vip > 0) {
- $.ajax({
- type: "POST",
- url: "/bigmember/portrait/subVipPortrait/usage",
- data: {
- entId: id
- },
- success: function(r){
- // 如果次数已用完 跳大会员企业画像页面
- if (r.data.usage >= r.data.total) {
- window.open(memberLink)
- } else {
- // 没用完 超级订阅跳企业画像页面
- window.open(svipLink)
- }
- }
- });
- } else {
- window.open(memberLink)
- }
- }
- } else {
- window.open(svipLink)
- }
- },
- 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
- },
- onSizeChange: function (val) {
- this.listState.pageSize = val
- this.listState.pageNum = 1
- this.onPageChange(this.listState.pageNum)
- },
- toastFn: function (text, duration) {
- if (!duration) {
- duration = 2000
- }
- var _html = ""
- _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
- _html+='<span>' + text + '</span></div></div>'
- $('body').append(_html)
- setTimeout(function(){
- $(".custom-toast").fadeOut().remove();
- },duration)
- }
- }
- })
- ;(function () {
- var backUpLoginCallback = logic
- logic = function (data, num) {
- // do something
- // 如果是当前页面已经使用过了,则只需要刷新power即可
- if (data.result === 'ok') {
- vm.getPower()
- }
- backUpLoginCallback(data, num)
- }
- })()
- function insertVipIcon (target) {
- $(target).append('<span class="icon-hot-vip"></span>')
- }
- function tabHover () {
- $('#tab-zb, #tab-cgdw, #tab-gy').on('mouseover', function () {
- var left = $(this).position().left
- var offset = 0
- if (left < 40) {
- offset = ($(this).width() - 56) / 2
- } else {
- offset = ($(this).width() + 40 - 56) / 2
- }
- $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX('+ (left + offset) +'px)'})
- }).on('mouseout', function () {
- $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX(124px)'})
- })
- }
- 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('未初始化百度统计')
- }
- }
|