ent-search-index-pc.js 40 KB

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