123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134 |
- var entSearch = new Vue({
- el: '.vue-search-container',
- delimiters: ['${', '}'],
- components: {
- areaCityComponent: areaCityComponent,
- selectListComponent: selectListComponent,
- priceComponent: priceComponent,
- noData: noDataComponent
- },
- data: function () {
- return {
- isFree: true,
- 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 ''
- }
- }
- },
- company_phone_show :function (){
- return this.isLogin && !this.isFree
- },
- 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 getPowerComplete () {
- entSearch.isFree = window.isFree
- }
- ;(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('未初始化百度统计')
- }
- }
|