ent-search-index-pc.js 40 KB

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