ent-search-index-pc.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  1. var entSearch = new Vue({
  2. el: '.vue-search-container',
  3. delimiters: ['${', '}'],
  4. mixins: [workspaceDescMixin],
  5. components: {
  6. areaCityComponent: areaCityComponent,
  7. selectListComponent: selectListComponent,
  8. priceComponent: priceComponent,
  9. noData: noDataComponent
  10. },
  11. data: function () {
  12. return {
  13. isFree: true,
  14. foundingTime:'',//成立时间
  15. provinceMap: provinceMap,
  16. searchContent: pageInfo.searchContent,
  17. tabActive: 'qy',
  18. filterShow: true,
  19. query: {},
  20. searchTypeList: [
  21. {
  22. label: '企业名称',
  23. value: 'A'
  24. },
  25. {
  26. label: '法定代表人',
  27. value: 'B'
  28. },
  29. // {
  30. // label: '股东',
  31. // value: 'C'
  32. // },
  33. // {
  34. // label: '高管',
  35. // value: 'D'
  36. // },
  37. {
  38. label: '经营范围',
  39. needVip: true,
  40. value: 'F'
  41. },
  42. {
  43. label: '中标项目/标的物',
  44. needVip: true,
  45. value: 'E'
  46. }
  47. ],
  48. entTypeList: [
  49. {
  50. label: '有限责任公司',
  51. value: 'A'
  52. },
  53. {
  54. label: '股份有限公司',
  55. value: 'B'
  56. },
  57. {
  58. label: '有限合伙',
  59. value: 'C'
  60. },
  61. {
  62. label: '普通合伙',
  63. value: 'D'
  64. }
  65. ],
  66. entStateList: [
  67. {
  68. label: '存续(在营、开业、在业)',
  69. value: 'A'
  70. },
  71. {
  72. label: '吊销',
  73. value: 'B'
  74. },
  75. {
  76. label: '注销',
  77. value: 'C'
  78. },
  79. {
  80. label: '撤销',
  81. value: 'D'
  82. }
  83. ],
  84. entTimeList:[
  85. {
  86. label: '近1年内',
  87. value: 'A'
  88. },
  89. {
  90. label: '1-3年',
  91. value: 'B'
  92. },
  93. {
  94. label: '3-5年',
  95. value: 'C'
  96. },
  97. {
  98. label: '5-10年',
  99. value: 'D'
  100. },
  101. {
  102. label: '10年以上',
  103. value: 'E'
  104. },
  105. ],
  106. priceList: [
  107. {
  108. label: '100万以内',
  109. value: '0-100'
  110. },
  111. {
  112. label: '100-500万',
  113. value: '100-500'
  114. },
  115. {
  116. label: '500-1000万',
  117. value: '500-1000'
  118. },
  119. {
  120. label: '1000-5000万',
  121. value: '1000-5000'
  122. },
  123. {
  124. label: '5000万以上',
  125. value: '5000-'
  126. },
  127. ],
  128. zblyFilterOption: {
  129. zbAreaOptions: [
  130. // {
  131. // label: '北京',
  132. // value: '北京'
  133. // }
  134. ],
  135. dwlxOptions: [
  136. {
  137. label: '采购单位',
  138. value: '1'
  139. },
  140. {
  141. label: '投标企业',
  142. value: '2'
  143. },
  144. {
  145. label: '招标代理机构',
  146. value: '3'
  147. },
  148. {
  149. label: '厂商',
  150. value: '4'
  151. }
  152. ],
  153. lxfsOptions: [
  154. {
  155. label: '固定电话',
  156. value: '1'
  157. },
  158. {
  159. label: '手机号',
  160. value: '2'
  161. },
  162. // {
  163. // label: '电子邮箱',
  164. // value: '3'
  165. // },
  166. // {
  167. // label: '不存在',
  168. // value: '4'
  169. // }
  170. ],
  171. },
  172. filterState: {
  173. searchType: ['A'],
  174. entArea: [],
  175. entCity: [],
  176. entType: [],
  177. entStatus: [],
  178. entCapital: [],
  179. biddingArea: '', // 中标区域
  180. entClass: '', // 单位类型
  181. entContact: '', // 联系方式
  182. establish:[],//成立时间
  183. },
  184. listState: {
  185. loaded: false, // 是否已经搜索过
  186. loading: false,
  187. pageNum: 1, // 当前页, 从0开始
  188. pageSize: 10, // 每页多少条数据
  189. total: 0, // 一共多少条数据
  190. list: [], // 查询请求返回的数据
  191. pageTotal: 1 // 一共多少页(计算出来)
  192. },
  193. preSearch: {
  194. hover: false,
  195. focus: false,
  196. list: []
  197. },
  198. entUseInfo: {
  199. used: 0,
  200. total: 0,
  201. province: 0
  202. },
  203. powerInfo: {
  204. entniche: '',
  205. member: '',
  206. vip: ''
  207. },
  208. power: false,
  209. powerLoaded: false,
  210. powerDialogShow: false,
  211. baiduName: '',
  212. inputStatus: false,
  213. inIframe: false,
  214. isLogin: false,
  215. buttonType:false,//成立时间自定义区间确定按钮的显示状态
  216. focusColor:false,//改变获取焦点输入框的背景颜色
  217. startDate:'',
  218. endDate:'',
  219. thisStartTime:'',
  220. thisEndTime:'',
  221. indusShow: false,
  222. employInfo: []
  223. }
  224. },
  225. watch: {
  226. tabActive: function (newVal, oldVal) {
  227. if (newVal === 'zb') {
  228. if (this.searchContent) {
  229. location.href = '/jylab/supsearch/index.html?keywords=' + this.searchContent + '&publishtime=thisyear'
  230. } else {
  231. location.href = '/jylab/supsearch/index.html'
  232. }
  233. } else if (newVal === 'cgdw') {
  234. if (this.searchContent) {
  235. location.href = '/jylab/purSearch/index.html?keywords=' + this.searchContent
  236. } else {
  237. location.href = '/jylab/purSearch/index.html'
  238. }
  239. } else if (newVal === 'gy') {
  240. if (this.searchContent) {
  241. location.href = '/swordfish/page_web_pc/search/issued?keywords=' + this.searchContent
  242. } else {
  243. location.href = '/swordfish/page_web_pc/search/issued'
  244. }
  245. }
  246. }
  247. },
  248. computed: {
  249. getInputStatus: function () {
  250. return this.inputStatus
  251. },
  252. preSearchListShow: function () {
  253. return this.searchContent.trim().length >= 2 && this.preSearch.list.length && (this.preSearch.focus || this.preSearch.hover)
  254. },
  255. buttonText: function () {
  256. if (this.power) {
  257. return '升级'
  258. } else {
  259. if (this.powerInfo.vip === 0) {
  260. return '开通'
  261. } else if (this.powerInfo.vip === 1) {
  262. return '升级'
  263. } else {
  264. return '升级'
  265. }
  266. }
  267. },
  268. showEntUsage: function () {
  269. return !this.powerInfo.member && this.powerInfo.vip > 1
  270. },
  271. searchTypeListComputed: function () {
  272. if (this.isLogin) {
  273. var arr = []
  274. this.searchTypeList.forEach(function (item) {
  275. if (!item.needVip) {
  276. arr.push(item)
  277. } else if(goTemplateData.inIframe) {
  278. arr.push(item)
  279. }
  280. })
  281. return arr
  282. } else {
  283. var arr = []
  284. this.searchTypeList.forEach(function (item) {
  285. if (!item.needVip) {
  286. arr.push(item)
  287. }
  288. })
  289. return arr
  290. }
  291. },
  292. getVipSubText: function () {
  293. var count = this.entUseInfo.province
  294. if (count == -1) {
  295. return '全国'
  296. } else {
  297. if (count) {
  298. return count + '个省'
  299. } else {
  300. return ''
  301. }
  302. }
  303. },
  304. company_phone_show :function (){
  305. return this.isLogin && !this.isFree
  306. },
  307. getBIParams () {
  308. const urlParams = new URLSearchParams(window.location.search)
  309. return urlParams.get('resource')
  310. }
  311. },
  312. created: function () {
  313. var params = goTemplateData.params
  314. this.inIframe = goTemplateData.inIframe
  315. this.isLogin = !!params.isLogin
  316. if (this.isLogin) {
  317. this.getPower()
  318. } else {
  319. this.doSearch()
  320. }
  321. },
  322. mounted: function () {
  323. const entdata = sessionStorage.getItem('entdata')
  324. if(entdata) {
  325. const {filterState, listState, searchContent} = JSON.parse(entdata)
  326. this.filterState = filterState
  327. this.listState = listState
  328. this.searchContent = searchContent
  329. const proviceCity = {
  330. province: this.filterState.entArea,
  331. city: this.filterState.entCity,
  332. }
  333. this.$refs.areaCityFilter.setStateData(proviceCity)
  334. sessionStorage.removeItem('entdata')
  335. } else {
  336. this.getQuery()
  337. this.initPageData()
  338. this.initProvinceMapList()
  339. }
  340. this.initDOMEvents()
  341. this.filterEcho(this.filterState)
  342. // 全选按钮逻辑
  343. // this.searchTypeChange([], true)
  344. this.industryTab()
  345. /**
  346. * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
  347. * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
  348. */
  349. // if (this.inIframe) {
  350. // this._$SearchEvent = initSearchPageEvent({
  351. // type: 'company',
  352. // el: '.search-header-top .input-container',
  353. // submitSelector: '.search-button',
  354. // change: function(val) {
  355. // this.searchContent = val
  356. // }
  357. // })
  358. // }
  359. },
  360. methods: {
  361. // 引导文案点击事件
  362. guideGoWorkSpace: function () {
  363. if (!this.isLogin) {
  364. return openLoginDig()
  365. }
  366. this.goWorkSpace()
  367. },
  368. goBack () {
  369. var back = function () {
  370. window.top.history.back()
  371. }
  372. var goHome = function () {
  373. // 判断是否在iframe,如果在iframe,则用父级返回
  374. window.top.location.href = '/'
  375. }
  376. var referer = document.referer
  377. if(referer) {
  378. var inJianyuWebSite = referer.indexOf('jianyu360.cn') > 0
  379. if (inJianyuWebSite) {
  380. // 本站的,判断是否是新窗口打开的页面
  381. // 1.window.open可以通过判断window.opener
  382. // 2.a target='_black'可以通过判断history.length
  383. var opener = window.opener && window.opener !== window
  384. var target_blank = history.length <= 1
  385. // 是否新窗口打开
  386. var isNewWindow = opener || target_blank
  387. if (isNewWindow) {
  388. try {
  389. window.parent && window.parent.close()
  390. } catch (error) {
  391. window.close()
  392. }
  393. back()
  394. } else {
  395. back()
  396. }
  397. } else {
  398. goHome()
  399. }
  400. } else {
  401. goHome()
  402. }
  403. },
  404. // 筛选条件回显
  405. filterEcho: function (data) {
  406. const filterLabel = [
  407. 'searchType',
  408. 'entCapital',
  409. 'entType',
  410. 'entState',
  411. 'entTime',
  412. ]
  413. filterLabel.forEach(item => {
  414. if (data[item] && data[item].length) {
  415. if(item ==='entCapital') {
  416. // 注册资本输入框是否有值
  417. const writePrice = this.priceList.filter(f => {
  418. return data[item].some(v => f.value === v);
  419. });
  420. if(!writePrice.length) {
  421. console.info(data[item][0])
  422. const priceData = data[item][0].split('-')
  423. priceData.sort((a, b) => a - b)
  424. const min = priceData[0]
  425. const max = priceData[1]
  426. this.$refs.priceRef.setState(min, max)
  427. this.inputStatus = true
  428. this.$refs[item].setState([0])
  429. } else {
  430. this.$refs[item].setState(data[item])
  431. }
  432. } else {
  433. this.$refs[item].setState(data[item])
  434. }
  435. }
  436. if(item === 'entTime') {
  437. const thisList = []
  438. data['establish'].forEach(item => {
  439. if (item === '-1y') {
  440. thisList.push('A');
  441. } else if (item === '1y-3y') {
  442. thisList.push('B');
  443. } else if (item === '3y-5y') {
  444. thisList.push('C');
  445. } else if (item === '5y-10y') {
  446. thisList.push('D');
  447. } else if (item === '10y-') {
  448. thisList.push('E');
  449. } else {
  450. // 回显时间输入框
  451. this.focusColor = true;
  452. thisList.push('0')
  453. const timeData = item.split('-')
  454. timeData[0] = timeData[0] + '000'
  455. timeData[1] = timeData[1] + '000'
  456. this.startTimeChange(parseInt(timeData[0]))
  457. this.endTimeChange(parseInt(timeData[1]))
  458. }
  459. })
  460. this.$refs[item].setState(thisList)
  461. }
  462. if(item === 'entState') {
  463. this.$refs[item].setState(data['entStatus'])
  464. }
  465. })
  466. },
  467. goWorkSpace: function () {
  468. const saveData = {
  469. filterState: this.filterState,
  470. listState: this.listState,
  471. searchContent: this.searchContent
  472. }
  473. sessionStorage.setItem('entdata', JSON.stringify(saveData))
  474. var goHref = location.origin + '/jylab/entSearch/index.html'
  475. window.location.replace('/page_workDesktop/work-bench/page?link=' + encodeURIComponent(goHref))
  476. },
  477. // 查询收录情况
  478. getEmployData (ids) {
  479. const url = '/jyapi/crmApplication/employ/info'
  480. const params = {
  481. employType: 2,
  482. idArr: ids ? ids.join(',') : ''
  483. }
  484. $.ajax({
  485. url: url,
  486. type: 'POST',
  487. data: JSON.stringify(params),
  488. contentType: 'application/json',
  489. success: function (res) {
  490. if (res.error_code === 0) {
  491. this.employInfo = res.data
  492. res.data.forEach((r) => {
  493. this.listState.list.forEach(m => {
  494. if(m.id === r.id) {
  495. m.active = r.isEmploy ? 1 : 0
  496. }
  497. })
  498. })
  499. this.$forceUpdate()
  500. console.info(this.listState.list)
  501. }
  502. }.bind(this)
  503. })
  504. },
  505. // 收录操作
  506. setEmployEvent (item) {
  507. const _this = this
  508. const url = '/jyapi/crmApplication/employ/operate'
  509. const params = {
  510. idArr: item.id,
  511. isEmploy: !item.active,
  512. employType: 2
  513. }
  514. $.ajax({
  515. url: url,
  516. type: 'POST',
  517. data: JSON.stringify(params),
  518. contentType: 'application/json',
  519. success: function (res) {
  520. if(res.error_code === 0) {
  521. if (res.data.status) {
  522. item.active = !item.active ? 1 : 0
  523. } else {
  524. _this.toastFn(res.data.msg, 800)
  525. }
  526. }
  527. this.$forceUpdate()
  528. }.bind(this),
  529. complete: function () {
  530. }.bind(this)
  531. })
  532. },
  533. getQuery: function () {
  534. this.query.from = getParam('from')
  535. this.query.point = getParam('point')
  536. },
  537. industryTab: function() {
  538. $.ajax({
  539. type:'POST',
  540. url:'/entnicheNew/buy/whetherbuy',
  541. success:function (res) {
  542. if (res && res.error_code == 1001 || res.error_msg.indexOf('登录') >- 1) {
  543. $('#tab-cgdw').css('display', 'none')
  544. }
  545. if (res && res.data && res.data.isNew) {
  546. $('#tab-cgdw').css('display', 'inline-block')
  547. } else {
  548. $('#tab-cgdw').css('display', 'none')
  549. }
  550. }
  551. })
  552. },
  553. getSearchForValues: function () {
  554. return this.searchTypeList.map(function (v) {
  555. return v.value
  556. })
  557. },
  558. checkLogin: function () {
  559. var moduleOpen = $('body').hasClass('modal-open')
  560. if (moduleOpen) return
  561. if (!loginflag) {
  562. $("#bidLogin").modal("show");
  563. }
  564. },
  565. getPower: function (callback) {
  566. $.ajax({
  567. url: '/publicapply/bidcoll/power',
  568. type: 'POST',
  569. success: function (res) {
  570. if (res.error_code === 0 && res.data) {
  571. Object.assign(this.powerInfo, res.data)
  572. this.checkPower()
  573. this.doSearch()
  574. if (this.showEntUsage) {
  575. this.getEntProtUsage()
  576. }
  577. } else {
  578. // this.checkLogin()
  579. }
  580. }.bind(this),
  581. complete: function () {
  582. this.powerLoaded = true
  583. callback && callback()
  584. }.bind(this)
  585. })
  586. },
  587. checkPower: function () {
  588. this.power = this.powerInfo.member || this.powerInfo.vip !== 0
  589. return this.power
  590. },
  591. initPageData: function () {
  592. console.info(pageInfo)
  593. if (pageInfo.searchContent) {
  594. this.searchContent = pageInfo.searchContent
  595. }
  596. },
  597. initProvinceMapList: function () {
  598. var provinceMapList = []
  599. for (var key in this.provinceMap) {
  600. this.provinceMap[key].forEach(function (item) {
  601. provinceMapList.push({
  602. label: item,
  603. value: item
  604. })
  605. })
  606. }
  607. this.zblyFilterOption.zbAreaOptions = provinceMapList
  608. },
  609. initDOMEvents: function () {
  610. ewmMoveHover()
  611. refreshEwmText(this.searchContent)
  612. insertVipIcon($('.search-type .el-checkbox:nth-of-type(4)'))
  613. insertVipIcon($('.search-type .el-checkbox:nth-of-type(5)'))
  614. setTimeout(function () {
  615. tabHover()
  616. }, 300)
  617. },
  618. isFilterShow: function () {
  619. if (this.filterShow) {
  620. $('.search-filters').slideUp()
  621. } else {
  622. $('.search-filters').slideDown()
  623. }
  624. this.filterShow = !this.filterShow
  625. },
  626. searchTypeChange: function (t, hideTip) {
  627. // 全选逻辑隐藏
  628. // var tempRef = this.$refs.searchType
  629. // var tempList = this.getSearchForValues()
  630. // if (t.length === 0) {
  631. // if (tempRef && tempRef.$data.selectList[0].selected) {
  632. // t = tempList
  633. // }
  634. // } else if (tempList.join('') === t.join('')) {
  635. // tempRef && tempRef.setState()
  636. // }
  637. console.info(t);
  638. console.info(hideTip);
  639. var eIndex = t.indexOf('E')
  640. if (!this.power && eIndex !== -1) {
  641. t.splice(eIndex, 1)
  642. this.$refs.searchType.setState(t)
  643. if (!hideTip) {
  644. this.powerDialogShow = true
  645. return
  646. }
  647. }
  648. var eIndex1 = t.indexOf('F')
  649. if (!this.power && eIndex1 !== -1) {
  650. t.splice(eIndex1, 1)
  651. this.$refs.searchType.setState(t)
  652. if (!hideTip) {
  653. this.powerDialogShow = true
  654. return
  655. }
  656. }
  657. this.filterState.searchType = t
  658. this.doSearch()
  659. },
  660. areaCityChange: function (area) {
  661. var city = []
  662. var area_arr = []
  663. for (var key in area) {
  664. if(area[key].length>0){
  665. city = city.concat(area[key])
  666. }else{
  667. area_arr = area_arr.concat(key)
  668. }
  669. }
  670. this.filterState.entArea = area_arr//Object.keys(area)
  671. this.filterState.entCity = city
  672. this.doSearch()
  673. },
  674. entTypeChange: function (e) {
  675. if (!e.length) {
  676. this.$refs.entType.$data.selectList[0].selected = true
  677. }
  678. this.filterState.entType = e
  679. this.doSearch()
  680. },
  681. entStateChange: function (e) {
  682. if (!e.length) {
  683. this.$refs.entState.$data.selectList[0].selected = true
  684. }
  685. this.filterState.entStatus = e
  686. this.doSearch()
  687. },
  688. //计算几年前的时间戳
  689. getTimeDate: function(year){
  690. let time = Number(year);
  691. let date = new Date();
  692. let lastYear = Number(date.getFullYear()-time)+'-'+Number(date.getMonth()+1)+'-'+date.getDate();
  693. let lastYearDate = new Date(lastYear);
  694. lastYearDate = lastYearDate.getTime();//一年前时间戳;
  695. return lastYearDate;
  696. },
  697. //成立时间多选
  698. entTimeChange: function (e) {
  699. let _this = this;
  700. // console.info('成立时间多选',e);
  701. _this.focusColor = false;
  702. if (!e.length) {
  703. _this.$refs.entTime.$data.selectList[0].selected = true;
  704. _this.filterState.establish = [];
  705. }else{
  706. let thisList = [];
  707. e.forEach(function (item) {
  708. // console.info(item);
  709. switch (item) {
  710. case 'A':
  711. // thisList.push(_this.getTimeDate(0)+'-'+_this.getTimeDate(1))
  712. thisList.push('-1y')
  713. break;
  714. case 'B':
  715. // thisList.push(_this.getTimeDate(1)+'-'+_this.getTimeDate(3))
  716. thisList.push('1y-3y')
  717. break;
  718. case 'C':
  719. // thisList.push(_this.getTimeDate(3)+'-'+_this.getTimeDate(5))
  720. thisList.push('3y-5y')
  721. break;
  722. case 'D':
  723. // thisList.push(_this.getTimeDate(5)+'-'+_this.getTimeDate(10))
  724. thisList.push('5y-10y')
  725. break;
  726. case 'E':
  727. // thisList.push(_this.getTimeDate(10)+'-'+_this.getTimeDate(1))
  728. thisList.push('10y-')
  729. break;
  730. default:
  731. break;
  732. }
  733. _this.filterState.establish = thisList;
  734. })
  735. // if (_this.foundingTime) {
  736. // // console.info(_this.foundingTime)
  737. // _this.filterState.establish.push(_this.foundingTime[0]+'-'+_this.foundingTime[1])
  738. // }
  739. }
  740. console.info(_this.filterState.establish);
  741. _this.doSearch()
  742. },
  743. //时间戳转换yyyy-mm-dd
  744. getThisDate:function(time){
  745. var date = new Date(time);
  746. var YY = date.getFullYear() + '年';
  747. var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
  748. var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日';
  749. return YY + MM + DD
  750. },
  751. //成立时间区间
  752. foundingTimeChange:function(e){
  753. if (e) {
  754. let time = e[0]+'-'+e[1];
  755. console.info('成立时间',time);
  756. console.info('成立时间',e);
  757. this.startDate = this.getThisDate(e[0]);
  758. this.endDate = this.getThisDate(e[1]);
  759. }
  760. },
  761. startTimeChange:function(e){
  762. if (e) {
  763. console.info('startTimeChange',e);
  764. this.startDate = this.getThisDate(e);
  765. }
  766. },
  767. endTimeChange:function(e){
  768. if (e) {
  769. console.info('endTimeChange',e);
  770. if (e < this.thisStartTime && this.thisStartTime) {
  771. // alert('结束日期不能小于开始日期,请重新选择')
  772. this.endDate = '';
  773. this.thisEndTime = '';
  774. this.$notify.error({
  775. title: '错误',
  776. message: '结束日期不能小于开始日期,请重新选择'
  777. });
  778. }else{
  779. this.endDate = this.getThisDate(e);
  780. }
  781. }
  782. },
  783. //成立时间自定义区间搜索按钮
  784. establishSearch:function () {
  785. let _this = this;
  786. let thisList = [];
  787. // console.info(_this.foundingTime);
  788. // if (_this.foundingTime) {
  789. // thisList.push(_this.foundingTime[0]/1000+'-'+_this.foundingTime[1]/1000)
  790. // _this.$refs.entTime.$data.selectList.forEach(function (item) {
  791. // // console.info(item);
  792. // item.selected = false;
  793. // })
  794. // _this.filterState.establish = thisList;
  795. // }else{
  796. // _this.$refs.entTime.$data.selectList.forEach(function (item) {
  797. // // console.info(item);
  798. // item.selected = false;
  799. // })
  800. // _this.$refs.entTime.$data.selectList[0].selected = true;
  801. // _this.filterState.establish = [];
  802. // }
  803. if (_this.thisStartTime && _this.thisEndTime) {
  804. thisList.push(_this.thisStartTime/1000+'-'+_this.thisEndTime/1000)
  805. _this.$refs.entTime.$data.selectList.forEach(function (item) {
  806. // console.info(item);
  807. item.selected = false;
  808. })
  809. _this.filterState.establish = thisList;
  810. }else{
  811. _this.$refs.entTime.$data.selectList.forEach(function (item) {
  812. // console.info(item);
  813. item.selected = false;
  814. })
  815. _this.$refs.entTime.$data.selectList[0].selected = true;
  816. _this.filterState.establish = [];
  817. }
  818. _this.doSearch();
  819. _this.buttonType = false;
  820. },
  821. showButton:function () {
  822. let _this = this;
  823. _this.buttonType = true;
  824. },
  825. hiddenButton:function () {
  826. // let _this = this;
  827. // _this.buttonType = false;
  828. },
  829. changeColor:function() {
  830. let _this = this;
  831. _this.focusColor = true;
  832. },
  833. // 标准金额区间
  834. inexactPriceChange: function (p) {
  835. if (!p.length) {
  836. this.$refs.entCapital.$data.selectList[0].selected = true
  837. }
  838. this.filterState.entCapital = p
  839. this.inputStatus = false
  840. this.doSearch()
  841. },
  842. // 输入金额区间
  843. exactPriceChange: function (p) {
  844. this.$refs.entCapital.setState()
  845. if (p.min === '' && p.max === '') {
  846. this.filterState.entCapital = ['']
  847. this.$refs.entCapital.$data.selectList[0].selected = true
  848. this.inputStatus = false
  849. } else {
  850. this.$refs.entCapital.$data.selectList[0].selected = false
  851. this.filterState.entCapital = [p.min + '-' + p.max]
  852. this.inputStatus = true
  853. }
  854. this.doSearch()
  855. },
  856. zbFilterChange: function (name) {
  857. this.baiduName = name
  858. if (this.power) {
  859. this.doSearch()
  860. } else {
  861. this.filterState.biddingArea = ''
  862. this.filterState.entClass = ''
  863. this.filterState.entContact = ''
  864. this.powerDialogShow = true
  865. }
  866. },
  867. getEntProtUsage: function () {
  868. $.ajax({
  869. url: '/bigmember/portrait/subVipPortrait/usage',
  870. method: 'POST',
  871. success: function (res) {
  872. if (res.error_code === 0) {
  873. if (res.data.total) {
  874. this.entUseInfo.total = res.data.total
  875. }
  876. if (res.data.provin) {
  877. this.entUseInfo.province = res.data.provin
  878. }
  879. if (res.data.usage) {
  880. this.entUseInfo.used = res.data.usage
  881. }
  882. }
  883. }.bind(this)
  884. })
  885. },
  886. setPageTdk () {
  887. var name = this.searchContent.trim()
  888. if (name) {
  889. setPageTdkToView({
  890. title: name + '相关搜索结果 - 剑鱼标讯',
  891. keywords: name + ',' + name + '中标信息,' + name + '项目动态,剑鱼标讯',
  892. description: '剑鱼标讯企业搜索是国内专业的中标企业信息查询平台,为您提供' + name + '相关的中标企业信息详情,帮助您全面了解中标企业最新动态,获取更多' + name + '相关搜索结果就上剑鱼标讯!'
  893. })
  894. } else {
  895. setPageTdkToView({
  896. title: '企业工商信息查询_公司招投标查询_中标企业查询 - 剑鱼标讯',
  897. keywords: '企业信息查询,工商查询,招投标公司查询,中标企业查询,中标单位,中标企业画像,剑鱼标讯',
  898. description: '剑鱼标讯企业搜索为您精准提供全国工商企业信息、招投标公司及中标企业信息查询服务,涵盖企业信息查询,工商查询,招投标公司查询,中标企业搜索,中标企业画像查看等多维度服务,帮您快速了解企业招投标情况,提前预判风险,拓展合作商机。'
  899. })
  900. }
  901. },
  902. doSearch: function () {
  903. this.setPageTdk()
  904. this.resetListState()
  905. this.getList()
  906. },
  907. resetListState: function () {
  908. var state = {
  909. loaded: false,
  910. loading: false,
  911. pageNum: 1,
  912. total: 0,
  913. list: []
  914. }
  915. Object.assign(this.listState, state)
  916. },
  917. getPreSearchList: utils.debounce(function () {
  918. /**
  919. * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
  920. * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
  921. */
  922. if (this._$SearchEvent) {
  923. this._$SearchEvent.syncInput()
  924. }
  925. var data = {
  926. name: this.searchContent.trim()
  927. }
  928. if (data.name.length < 2) return
  929. $.ajax({
  930. url: '/bigmember/search/ent/association',
  931. method: 'POST',
  932. data: data,
  933. success: function (res) {
  934. if (res.error_code === 0) {
  935. if (res.data) {
  936. this.preSearch.list = res.data.list || []
  937. }
  938. } else {
  939. // this.checkLogin()
  940. }
  941. }.bind(this)
  942. })
  943. }, 200),
  944. getList: function () {
  945. var data = {
  946. match: this.searchContent,
  947. matchType: this.filterState.searchType.join(','),
  948. entArea: this.filterState.entArea.join(','),
  949. entCity: this.filterState.entCity.join(','),
  950. entCapital: this.filterState.entCapital.join(','),
  951. entType: this.filterState.entType.join(','),
  952. entStatus: this.filterState.entStatus.join(','),
  953. establish: this.filterState.establish.join(','),//成立时间筛选条件
  954. biddingArea: this.filterState.biddingArea == '全国' ? '' : this.filterState.biddingArea,
  955. entClass: this.filterState.entClass,
  956. entContact: this.filterState.entContact,
  957. pageSize: this.listState.pageSize,
  958. pageNum: this.listState.pageNum - 1, // 当前页, 从0开始
  959. }
  960. this.listState.loading = true
  961. this.listState.loaded = false
  962. $.ajax({
  963. url: '/publicapply/enterpriseSearch/doQuery',
  964. method: 'POST',
  965. data: data,
  966. success: function (res) {
  967. if (res.error_code === 0) {
  968. this.setListStateAndCheckPower(res)
  969. } else {
  970. // this.checkLogin()
  971. }
  972. }.bind(this),
  973. complete: function () {
  974. this.listState.loading = false
  975. this.listState.loaded = true
  976. }.bind(this)
  977. })
  978. },
  979. setListStateAndCheckPower: function (res) {
  980. var _this = this
  981. if (res.data) {
  982. if (res.data.total) {
  983. this.listState.total = res.data.total
  984. this.listState.pageTotal = Math.ceil(res.data.total / this.listState.pageSize)
  985. }
  986. if (res.data.list) {
  987. res.data.list.forEach(function (d) {
  988. d.company_shortname = _this.getShortName(d.company_name)
  989. d.randomBgc = _this.randomBgc()
  990. try {
  991. d.visited = visitedPath.pathVisited(
  992. new VisitedPathItem(
  993. '/ent_portrait/*',
  994. 'id=' + d.id
  995. )
  996. )
  997. } catch (error) {}
  998. })
  999. this.listState.list = res.data.list || []
  1000. const resultIds = res.data.list.map(v => v.id)
  1001. this.getEmployData(resultIds)
  1002. // if (this.power) {
  1003. // this.listState.list = res.data.list || []
  1004. // } else {
  1005. // if (res.data.list.length >= 4) {
  1006. // res.data.list.length = 4
  1007. // res.data.list.push({
  1008. // company_shortname: 'xxx',
  1009. // company_address: 'xxx',
  1010. // company_name: 'xxx',
  1011. // company_status: 'xxx',
  1012. // legal_person: 'xxx',
  1013. // id: 'xxx',
  1014. // showMask: true
  1015. // })
  1016. // }
  1017. // this.listState.list = res.data.list || []
  1018. // }
  1019. }
  1020. } else {
  1021. this.listState.total = 0
  1022. this.listState.list = []
  1023. }
  1024. },
  1025. onPageChange: function (p) {
  1026. console.log(p, this.listState.total, this.listState.pageTotal);
  1027. if (p > this.listState.pageTotal) {
  1028. return this.toastFn('超出页码', 3000)
  1029. }
  1030. this.listState.pageNum = p
  1031. this.getList()
  1032. },
  1033. openVipPage: function (param) {
  1034. // 企业搜索中标区域-去开通
  1035. // 企业搜索单位类型-去开通
  1036. // 企业搜索联系方式-去开通
  1037. // 企业搜索底部第五条-去开通
  1038. // 企业搜索popover-去开通
  1039. if (param === 'more') {
  1040. this.baiduName = '底部第五条'
  1041. } else if (param === 'popover-link') {
  1042. this.baiduName = '-超级订阅用户-当月已使用hover'
  1043. }
  1044. var str = '企业搜索' + this.baiduName + '-去开通'
  1045. baiduEvent(str) // 去开通按钮百度统计
  1046. window.open('/swordfish/page_big_pc/free/svip/buy')
  1047. },
  1048. openEntHistory: function () {
  1049. baiduEvent('企业画像查看历史记录')
  1050. window.open('/swordfish/frontPage/seeHistory/sess/index')
  1051. },
  1052. openCustomerService: function () {
  1053. $('#go-customer-4').trigger('click')
  1054. },
  1055. toDetail: function (item) {
  1056. var id = item.id || item.entId
  1057. var seoId = item.nseo_id
  1058. let BIPage = ''
  1059. if (this.getBIParams) {
  1060. BIPage = '?resource=BI'
  1061. } else {
  1062. BIPage = ''
  1063. }
  1064. var seoUrl = '/qy/' + seoId + '.html' + BIPage
  1065. // 去超级订阅画像
  1066. var svipLink = '/swordfish/page_big_pc/svip/ent_ser_portrait/' + id + BIPage
  1067. // 大会员画像
  1068. var memberLink = '/swordfish/page_big_pc/ent_portrait/' + id + BIPage
  1069. // 是渠道合作页面需要登录后重定向
  1070. if(cooperateCode) {
  1071. openLoginDig(null, svipLink)
  1072. return
  1073. } else {
  1074. if (!this.inIframe && seoId) {
  1075. // 工作桌面外跳转seo画像
  1076. return window.open(seoUrl)
  1077. }
  1078. }
  1079. try {
  1080. item.visited = true
  1081. visitedPath.pathVisiting(
  1082. new VisitedPathItem(
  1083. '/ent_portrait/*',
  1084. 'id=' + id
  1085. )
  1086. )
  1087. } catch (error) {}
  1088. if (this.powerInfo.member) {
  1089. // 如果是专家版、智慧版 跳大会员页面
  1090. if (window.memberPower && window.memberPower.indexOf(4) !== -1) {
  1091. window.open(memberLink)
  1092. } else {
  1093. // 如果是商机版、自定义版
  1094. // 如果同时是超级订阅 判断有没有画像查看次数
  1095. if (this.powerInfo.vip > 0) {
  1096. $.ajax({
  1097. type: "POST",
  1098. url: "/bigmember/portrait/subVipPortrait/usage",
  1099. data: {
  1100. entId: id
  1101. },
  1102. success: function(r){
  1103. // 如果次数已用完 跳大会员企业画像页面
  1104. if (r.data.usage >= r.data.total) {
  1105. window.open(memberLink)
  1106. } else {
  1107. // 没用完 超级订阅跳企业画像页面
  1108. window.open(svipLink)
  1109. }
  1110. }
  1111. });
  1112. } else {
  1113. window.open(memberLink)
  1114. }
  1115. }
  1116. } else {
  1117. window.open(svipLink)
  1118. }
  1119. },
  1120. calcListItemForCap: function (p) {
  1121. if (p) {
  1122. return p + '万元'
  1123. } else {
  1124. return '-'
  1125. }
  1126. },
  1127. getEntStatus: function (status) {
  1128. if (status === '吊销') {
  1129. return 'tag-danger'
  1130. } else if (status === '注销') {
  1131. return 'tag-danger'
  1132. } else if (status === '撤销') {
  1133. return 'tag-disabled'
  1134. } else {
  1135. return ''
  1136. }
  1137. },
  1138. randomBgc: function () {
  1139. var arr = ['default', 'blue', 'orange', 'green']
  1140. var randomIndex = utils.getRandomNumber(0, arr.length - 1)
  1141. return 'bgc-' + arr[randomIndex]
  1142. },
  1143. getShortName: function (comName) {
  1144. var areaMap = chinaMapJSON || []
  1145. var shortname = comName
  1146. // 1. 循环省份城市进行替换
  1147. areaMap.forEach(function (item) {
  1148. var p = item.name.replace(/[省市]/, '')
  1149. if (shortname.indexOf(p) !== -1) {
  1150. shortname = shortname.replace(item.name, '').replace(p, '')
  1151. console.log(p + ' -> \'\'')
  1152. }
  1153. item.city.forEach(function (iitem) {
  1154. var c = iitem.name.replace(/[省市]/, '')
  1155. if (shortname.indexOf(c) !== -1) {
  1156. shortname = shortname.replace(iitem.name, '').replace(c, '')
  1157. console.log(c + ' -> \'\'')
  1158. }
  1159. iitem.area.forEach(function (iiitem) {
  1160. if (shortname.indexOf(iiitem) !== -1) {
  1161. shortname = shortname.replace(iiitem, '')
  1162. console.log(iiitem + ' -> \'\'')
  1163. }
  1164. })
  1165. })
  1166. })
  1167. var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm)
  1168. var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4)
  1169. if (shortname.length < 4) {
  1170. shortname = shortname.slice(0, 4)
  1171. }
  1172. return shortname
  1173. },
  1174. onSizeChange: function (val) {
  1175. this.listState.pageSize = val
  1176. this.listState.pageNum = 1
  1177. this.onPageChange(this.listState.pageNum)
  1178. },
  1179. toastFn: function (text, duration) {
  1180. if (!duration) {
  1181. duration = 2000
  1182. }
  1183. var _html = ""
  1184. _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
  1185. _html+='<span>' + text + '</span></div></div>'
  1186. $('body').append(_html)
  1187. setTimeout(function(){
  1188. $(".custom-toast").fadeOut().remove();
  1189. },duration)
  1190. }
  1191. }
  1192. })
  1193. function getPowerComplete () {
  1194. entSearch.isFree = window.isFree
  1195. }
  1196. ;(function () {
  1197. var backUpLoginCallback = logic
  1198. logic = function (data, num) {
  1199. // do something
  1200. // 如果是当前页面已经使用过了,则只需要刷新power即可
  1201. if (data.result === 'ok') {
  1202. vm.getPower()
  1203. }
  1204. backUpLoginCallback(data, num)
  1205. }
  1206. })()
  1207. function insertVipIcon (target) {
  1208. $(target).append('<span class="icon-hot-vip"></span>')
  1209. }
  1210. function tabHover () {
  1211. $('#tab-zb, #tab-cgdw, #tab-gy').on('mouseover', function () {
  1212. var left = $(this).position().left
  1213. var offset = 0
  1214. if (left < 40) {
  1215. offset = ($(this).width() - 56) / 2
  1216. } else {
  1217. offset = ($(this).width() + 40 - 56) / 2
  1218. }
  1219. $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX('+ (left + offset) +'px)'})
  1220. }).on('mouseout', function () {
  1221. $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX(124px)'})
  1222. })
  1223. }
  1224. function refreshEwmText (text) {
  1225. if (text && text.trim().length > 0) {
  1226. $(".wx-inner-title").html("扫码关注企业");
  1227. $(".wx-inner-bottom").html('扫码即可实时接收<span style="color:#2cb7ca">'+'"'+text+'"'+'</span>的中标信息!');
  1228. }
  1229. }
  1230. function ewmMoveHover() {
  1231. var $div = $(".search-right-wx .search-right-wx-inner"),
  1232. $parent = $(".search-right-wx");
  1233. $parent.on("mouseover",function(){
  1234. $div.css({
  1235. "transform":"scale(1)",
  1236. "transition":"transform 0.8s"
  1237. })
  1238. })
  1239. $parent.on("mouseout",function(){
  1240. $div.css({
  1241. "transform":"scale(0)",
  1242. "transition":"transform 0.2s"
  1243. })
  1244. })
  1245. }
  1246. function baiduEvent(name) {
  1247. console.log(name)
  1248. try {
  1249. _hmt.push(['_trackEvent', '超级订阅-pc', 'click', name]);
  1250. } catch (e) {
  1251. console.log('未初始化百度统计')
  1252. }
  1253. }