ent-search-index-pc.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  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. goBack () {
  362. var back = function () {
  363. window.top.history.back()
  364. }
  365. var goHome = function () {
  366. // 判断是否在iframe,如果在iframe,则用父级返回
  367. window.top.location.href = '/'
  368. }
  369. var referer = document.referer
  370. if(referer) {
  371. var inJianyuWebSite = referer.indexOf('jianyu360.cn') > 0
  372. if (inJianyuWebSite) {
  373. // 本站的,判断是否是新窗口打开的页面
  374. // 1.window.open可以通过判断window.opener
  375. // 2.a target='_black'可以通过判断history.length
  376. var opener = window.opener && window.opener !== window
  377. var target_blank = history.length <= 1
  378. // 是否新窗口打开
  379. var isNewWindow = opener || target_blank
  380. if (isNewWindow) {
  381. try {
  382. window.parent && window.parent.close()
  383. } catch (error) {
  384. window.close()
  385. }
  386. back()
  387. } else {
  388. back()
  389. }
  390. } else {
  391. goHome()
  392. }
  393. } else {
  394. goHome()
  395. }
  396. },
  397. // 筛选条件回显
  398. filterEcho: function (data) {
  399. const filterLabel = [
  400. 'searchType',
  401. 'entCapital',
  402. 'entType',
  403. 'entState',
  404. 'entTime',
  405. ]
  406. filterLabel.forEach(item => {
  407. if (data[item] && data[item].length) {
  408. if(item ==='entCapital') {
  409. // 注册资本输入框是否有值
  410. const writePrice = this.priceList.filter(f => {
  411. return data[item].some(v => f.value === v);
  412. });
  413. if(!writePrice.length) {
  414. console.info(data[item][0])
  415. const priceData = data[item][0].split('-')
  416. priceData.sort((a, b) => a - b)
  417. const min = priceData[0]
  418. const max = priceData[1]
  419. this.$refs.priceRef.setState(min, max)
  420. this.inputStatus = true
  421. this.$refs[item].setState([0])
  422. } else {
  423. this.$refs[item].setState(data[item])
  424. }
  425. } else {
  426. this.$refs[item].setState(data[item])
  427. }
  428. }
  429. if(item === 'entTime') {
  430. const thisList = []
  431. data['establish'].forEach(item => {
  432. if (item === '-1y') {
  433. thisList.push('A');
  434. } else if (item === '1y-3y') {
  435. thisList.push('B');
  436. } else if (item === '3y-5y') {
  437. thisList.push('C');
  438. } else if (item === '5y-10y') {
  439. thisList.push('D');
  440. } else if (item === '10y-') {
  441. thisList.push('E');
  442. } else {
  443. // 回显时间输入框
  444. this.focusColor = true;
  445. thisList.push('0')
  446. const timeData = item.split('-')
  447. timeData[0] = timeData[0] + '000'
  448. timeData[1] = timeData[1] + '000'
  449. this.startTimeChange(parseInt(timeData[0]))
  450. this.endTimeChange(parseInt(timeData[1]))
  451. }
  452. })
  453. this.$refs[item].setState(thisList)
  454. }
  455. if(item === 'entState') {
  456. this.$refs[item].setState(data['entStatus'])
  457. }
  458. })
  459. },
  460. goWorkSpace: function () {
  461. const saveData = {
  462. filterState: this.filterState,
  463. listState: this.listState,
  464. searchContent: this.searchContent
  465. }
  466. sessionStorage.setItem('entdata', JSON.stringify(saveData))
  467. var goHref = location.origin + '/jylab/entSearch/index.html'
  468. window.location.replace('/page_workDesktop/work-bench/page?link=' + encodeURIComponent(goHref))
  469. },
  470. // 查询收录情况
  471. getEmployData (ids) {
  472. const url = '/jyapi/crmApplication/employ/info'
  473. const params = {
  474. employType: 2,
  475. idArr: ids ? ids.join(',') : ''
  476. }
  477. $.ajax({
  478. url: url,
  479. type: 'POST',
  480. data: JSON.stringify(params),
  481. contentType: 'application/json',
  482. success: function (res) {
  483. if (res.error_code === 0) {
  484. this.employInfo = res.data
  485. res.data.forEach((r) => {
  486. this.listState.list.forEach(m => {
  487. if(m.id === r.id) {
  488. m.active = r.isEmploy ? 1 : 0
  489. }
  490. })
  491. })
  492. this.$forceUpdate()
  493. console.info(this.listState.list)
  494. }
  495. }.bind(this)
  496. })
  497. },
  498. // 收录操作
  499. setEmployEvent (item) {
  500. const _this = this
  501. const url = '/jyapi/crmApplication/employ/operate'
  502. const params = {
  503. idArr: item.id,
  504. isEmploy: !item.active,
  505. employType: 2
  506. }
  507. $.ajax({
  508. url: url,
  509. type: 'POST',
  510. data: JSON.stringify(params),
  511. contentType: 'application/json',
  512. success: function (res) {
  513. if(res.error_code === 0) {
  514. if (res.data.status) {
  515. item.active = !item.active ? 1 : 0
  516. } else {
  517. _this.toastFn(res.data.msg, 800)
  518. }
  519. }
  520. this.$forceUpdate()
  521. }.bind(this),
  522. complete: function () {
  523. }.bind(this)
  524. })
  525. },
  526. getQuery: function () {
  527. this.query.from = getParam('from')
  528. this.query.point = getParam('point')
  529. },
  530. industryTab: function() {
  531. $.ajax({
  532. type:'POST',
  533. url:'/entnicheNew/buy/whetherbuy',
  534. success:function (res) {
  535. if (res && res.error_code == 1001 || res.error_msg.indexOf('登录') >- 1) {
  536. $('#tab-cgdw').css('display', 'none')
  537. }
  538. if (res && res.data && res.data.isNew) {
  539. $('#tab-cgdw').css('display', 'inline-block')
  540. } else {
  541. $('#tab-cgdw').css('display', 'none')
  542. }
  543. }
  544. })
  545. },
  546. getSearchForValues: function () {
  547. return this.searchTypeList.map(function (v) {
  548. return v.value
  549. })
  550. },
  551. checkLogin: function () {
  552. var moduleOpen = $('body').hasClass('modal-open')
  553. if (moduleOpen) return
  554. if (!loginflag) {
  555. $("#bidLogin").modal("show");
  556. }
  557. },
  558. getPower: function (callback) {
  559. $.ajax({
  560. url: '/publicapply/bidcoll/power',
  561. type: 'POST',
  562. success: function (res) {
  563. if (res.error_code === 0 && res.data) {
  564. Object.assign(this.powerInfo, res.data)
  565. this.checkPower()
  566. this.doSearch()
  567. if (this.showEntUsage) {
  568. this.getEntProtUsage()
  569. }
  570. } else {
  571. // this.checkLogin()
  572. }
  573. }.bind(this),
  574. complete: function () {
  575. this.powerLoaded = true
  576. callback && callback()
  577. }.bind(this)
  578. })
  579. },
  580. checkPower: function () {
  581. this.power = this.powerInfo.member || this.powerInfo.vip !== 0
  582. return this.power
  583. },
  584. initPageData: function () {
  585. console.info(pageInfo)
  586. if (pageInfo.searchContent) {
  587. this.searchContent = pageInfo.searchContent
  588. }
  589. },
  590. initProvinceMapList: function () {
  591. var provinceMapList = []
  592. for (var key in this.provinceMap) {
  593. this.provinceMap[key].forEach(function (item) {
  594. provinceMapList.push({
  595. label: item,
  596. value: item
  597. })
  598. })
  599. }
  600. this.zblyFilterOption.zbAreaOptions = provinceMapList
  601. },
  602. initDOMEvents: function () {
  603. ewmMoveHover()
  604. refreshEwmText(this.searchContent)
  605. insertVipIcon($('.search-type .el-checkbox:nth-of-type(4)'))
  606. insertVipIcon($('.search-type .el-checkbox:nth-of-type(5)'))
  607. setTimeout(function () {
  608. tabHover()
  609. }, 300)
  610. },
  611. isFilterShow: function () {
  612. if (this.filterShow) {
  613. $('.search-filters').slideUp()
  614. } else {
  615. $('.search-filters').slideDown()
  616. }
  617. this.filterShow = !this.filterShow
  618. },
  619. searchTypeChange: function (t, hideTip) {
  620. // 全选逻辑隐藏
  621. // var tempRef = this.$refs.searchType
  622. // var tempList = this.getSearchForValues()
  623. // if (t.length === 0) {
  624. // if (tempRef && tempRef.$data.selectList[0].selected) {
  625. // t = tempList
  626. // }
  627. // } else if (tempList.join('') === t.join('')) {
  628. // tempRef && tempRef.setState()
  629. // }
  630. console.info(t);
  631. console.info(hideTip);
  632. var eIndex = t.indexOf('E')
  633. if (!this.power && eIndex !== -1) {
  634. t.splice(eIndex, 1)
  635. this.$refs.searchType.setState(t)
  636. if (!hideTip) {
  637. this.powerDialogShow = true
  638. return
  639. }
  640. }
  641. var eIndex1 = t.indexOf('F')
  642. if (!this.power && eIndex1 !== -1) {
  643. t.splice(eIndex1, 1)
  644. this.$refs.searchType.setState(t)
  645. if (!hideTip) {
  646. this.powerDialogShow = true
  647. return
  648. }
  649. }
  650. this.filterState.searchType = t
  651. this.doSearch()
  652. },
  653. areaCityChange: function (area) {
  654. var city = []
  655. var area_arr = []
  656. for (var key in area) {
  657. if(area[key].length>0){
  658. city = city.concat(area[key])
  659. }else{
  660. area_arr = area_arr.concat(key)
  661. }
  662. }
  663. this.filterState.entArea = area_arr//Object.keys(area)
  664. this.filterState.entCity = city
  665. this.doSearch()
  666. },
  667. entTypeChange: function (e) {
  668. if (!e.length) {
  669. this.$refs.entType.$data.selectList[0].selected = true
  670. }
  671. this.filterState.entType = e
  672. this.doSearch()
  673. },
  674. entStateChange: function (e) {
  675. if (!e.length) {
  676. this.$refs.entState.$data.selectList[0].selected = true
  677. }
  678. this.filterState.entStatus = e
  679. this.doSearch()
  680. },
  681. //计算几年前的时间戳
  682. getTimeDate: function(year){
  683. let time = Number(year);
  684. let date = new Date();
  685. let lastYear = Number(date.getFullYear()-time)+'-'+Number(date.getMonth()+1)+'-'+date.getDate();
  686. let lastYearDate = new Date(lastYear);
  687. lastYearDate = lastYearDate.getTime();//一年前时间戳;
  688. return lastYearDate;
  689. },
  690. //成立时间多选
  691. entTimeChange: function (e) {
  692. let _this = this;
  693. // console.info('成立时间多选',e);
  694. _this.focusColor = false;
  695. if (!e.length) {
  696. _this.$refs.entTime.$data.selectList[0].selected = true;
  697. _this.filterState.establish = [];
  698. }else{
  699. let thisList = [];
  700. e.forEach(function (item) {
  701. // console.info(item);
  702. switch (item) {
  703. case 'A':
  704. // thisList.push(_this.getTimeDate(0)+'-'+_this.getTimeDate(1))
  705. thisList.push('-1y')
  706. break;
  707. case 'B':
  708. // thisList.push(_this.getTimeDate(1)+'-'+_this.getTimeDate(3))
  709. thisList.push('1y-3y')
  710. break;
  711. case 'C':
  712. // thisList.push(_this.getTimeDate(3)+'-'+_this.getTimeDate(5))
  713. thisList.push('3y-5y')
  714. break;
  715. case 'D':
  716. // thisList.push(_this.getTimeDate(5)+'-'+_this.getTimeDate(10))
  717. thisList.push('5y-10y')
  718. break;
  719. case 'E':
  720. // thisList.push(_this.getTimeDate(10)+'-'+_this.getTimeDate(1))
  721. thisList.push('10y-')
  722. break;
  723. default:
  724. break;
  725. }
  726. _this.filterState.establish = thisList;
  727. })
  728. // if (_this.foundingTime) {
  729. // // console.info(_this.foundingTime)
  730. // _this.filterState.establish.push(_this.foundingTime[0]+'-'+_this.foundingTime[1])
  731. // }
  732. }
  733. console.info(_this.filterState.establish);
  734. _this.doSearch()
  735. },
  736. //时间戳转换yyyy-mm-dd
  737. getThisDate:function(time){
  738. var date = new Date(time);
  739. var YY = date.getFullYear() + '年';
  740. var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
  741. var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日';
  742. return YY + MM + DD
  743. },
  744. //成立时间区间
  745. foundingTimeChange:function(e){
  746. if (e) {
  747. let time = e[0]+'-'+e[1];
  748. console.info('成立时间',time);
  749. console.info('成立时间',e);
  750. this.startDate = this.getThisDate(e[0]);
  751. this.endDate = this.getThisDate(e[1]);
  752. }
  753. },
  754. startTimeChange:function(e){
  755. if (e) {
  756. console.info('startTimeChange',e);
  757. this.startDate = this.getThisDate(e);
  758. }
  759. },
  760. endTimeChange:function(e){
  761. if (e) {
  762. console.info('endTimeChange',e);
  763. if (e < this.thisStartTime && this.thisStartTime) {
  764. // alert('结束日期不能小于开始日期,请重新选择')
  765. this.endDate = '';
  766. this.thisEndTime = '';
  767. this.$notify.error({
  768. title: '错误',
  769. message: '结束日期不能小于开始日期,请重新选择'
  770. });
  771. }else{
  772. this.endDate = this.getThisDate(e);
  773. }
  774. }
  775. },
  776. //成立时间自定义区间搜索按钮
  777. establishSearch:function () {
  778. let _this = this;
  779. let thisList = [];
  780. // console.info(_this.foundingTime);
  781. // if (_this.foundingTime) {
  782. // thisList.push(_this.foundingTime[0]/1000+'-'+_this.foundingTime[1]/1000)
  783. // _this.$refs.entTime.$data.selectList.forEach(function (item) {
  784. // // console.info(item);
  785. // item.selected = false;
  786. // })
  787. // _this.filterState.establish = thisList;
  788. // }else{
  789. // _this.$refs.entTime.$data.selectList.forEach(function (item) {
  790. // // console.info(item);
  791. // item.selected = false;
  792. // })
  793. // _this.$refs.entTime.$data.selectList[0].selected = true;
  794. // _this.filterState.establish = [];
  795. // }
  796. if (_this.thisStartTime && _this.thisEndTime) {
  797. thisList.push(_this.thisStartTime/1000+'-'+_this.thisEndTime/1000)
  798. _this.$refs.entTime.$data.selectList.forEach(function (item) {
  799. // console.info(item);
  800. item.selected = false;
  801. })
  802. _this.filterState.establish = thisList;
  803. }else{
  804. _this.$refs.entTime.$data.selectList.forEach(function (item) {
  805. // console.info(item);
  806. item.selected = false;
  807. })
  808. _this.$refs.entTime.$data.selectList[0].selected = true;
  809. _this.filterState.establish = [];
  810. }
  811. _this.doSearch();
  812. _this.buttonType = false;
  813. },
  814. showButton:function () {
  815. let _this = this;
  816. _this.buttonType = true;
  817. },
  818. hiddenButton:function () {
  819. // let _this = this;
  820. // _this.buttonType = false;
  821. },
  822. changeColor:function() {
  823. let _this = this;
  824. _this.focusColor = true;
  825. },
  826. // 标准金额区间
  827. inexactPriceChange: function (p) {
  828. if (!p.length) {
  829. this.$refs.entCapital.$data.selectList[0].selected = true
  830. }
  831. this.filterState.entCapital = p
  832. this.inputStatus = false
  833. this.doSearch()
  834. },
  835. // 输入金额区间
  836. exactPriceChange: function (p) {
  837. this.$refs.entCapital.setState()
  838. if (p.min === '' && p.max === '') {
  839. this.filterState.entCapital = ['']
  840. this.$refs.entCapital.$data.selectList[0].selected = true
  841. this.inputStatus = false
  842. } else {
  843. this.$refs.entCapital.$data.selectList[0].selected = false
  844. this.filterState.entCapital = [p.min + '-' + p.max]
  845. this.inputStatus = true
  846. }
  847. this.doSearch()
  848. },
  849. zbFilterChange: function (name) {
  850. this.baiduName = name
  851. if (this.power) {
  852. this.doSearch()
  853. } else {
  854. this.filterState.biddingArea = ''
  855. this.filterState.entClass = ''
  856. this.filterState.entContact = ''
  857. this.powerDialogShow = true
  858. }
  859. },
  860. getEntProtUsage: function () {
  861. $.ajax({
  862. url: '/bigmember/portrait/subVipPortrait/usage',
  863. method: 'POST',
  864. success: function (res) {
  865. if (res.error_code === 0) {
  866. if (res.data.total) {
  867. this.entUseInfo.total = res.data.total
  868. }
  869. if (res.data.provin) {
  870. this.entUseInfo.province = res.data.provin
  871. }
  872. if (res.data.usage) {
  873. this.entUseInfo.used = res.data.usage
  874. }
  875. }
  876. }.bind(this)
  877. })
  878. },
  879. setPageTdk () {
  880. var name = this.searchContent.trim()
  881. if (name) {
  882. setPageTdkToView({
  883. title: name + '相关搜索结果 - 剑鱼标讯',
  884. keywords: name + ',' + name + '中标信息,' + name + '项目动态,剑鱼标讯',
  885. description: '剑鱼标讯企业搜索是国内专业的中标企业信息查询平台,为您提供' + name + '相关的中标企业信息详情,帮助您全面了解中标企业最新动态,获取更多' + name + '相关搜索结果就上剑鱼标讯!'
  886. })
  887. } else {
  888. setPageTdkToView({
  889. title: '企业工商信息查询_公司招投标查询_中标企业查询 - 剑鱼标讯',
  890. keywords: '企业信息查询,工商查询,招投标公司查询,中标企业查询,中标单位,中标企业画像,剑鱼标讯',
  891. description: '剑鱼标讯企业搜索为您精准提供全国工商企业信息、招投标公司及中标企业信息查询服务,涵盖企业信息查询,工商查询,招投标公司查询,中标企业搜索,中标企业画像查看等多维度服务,帮您快速了解企业招投标情况,提前预判风险,拓展合作商机。'
  892. })
  893. }
  894. },
  895. doSearch: function () {
  896. this.setPageTdk()
  897. this.resetListState()
  898. this.getList()
  899. },
  900. resetListState: function () {
  901. var state = {
  902. loaded: false,
  903. loading: false,
  904. pageNum: 1,
  905. total: 0,
  906. list: []
  907. }
  908. Object.assign(this.listState, state)
  909. },
  910. getPreSearchList: utils.debounce(function () {
  911. /**
  912. * 初始化页面搜索框与工作台顶部搜索联动事件函数,详情见对应函数 common.js
  913. * 需要在 dom 初始化后调用来监听事件,Vue中需要额外在 input 对应事件额外手动触发事件
  914. */
  915. if (this._$SearchEvent) {
  916. this._$SearchEvent.syncInput()
  917. }
  918. var data = {
  919. name: this.searchContent.trim()
  920. }
  921. if (data.name.length < 2) return
  922. $.ajax({
  923. url: '/bigmember/search/ent/association',
  924. method: 'POST',
  925. data: data,
  926. success: function (res) {
  927. if (res.error_code === 0) {
  928. if (res.data) {
  929. this.preSearch.list = res.data.list || []
  930. }
  931. } else {
  932. // this.checkLogin()
  933. }
  934. }.bind(this)
  935. })
  936. }, 200),
  937. getList: function () {
  938. var data = {
  939. match: this.searchContent,
  940. matchType: this.filterState.searchType.join(','),
  941. entArea: this.filterState.entArea.join(','),
  942. entCity: this.filterState.entCity.join(','),
  943. entCapital: this.filterState.entCapital.join(','),
  944. entType: this.filterState.entType.join(','),
  945. entStatus: this.filterState.entStatus.join(','),
  946. establish: this.filterState.establish.join(','),//成立时间筛选条件
  947. biddingArea: this.filterState.biddingArea == '全国' ? '' : this.filterState.biddingArea,
  948. entClass: this.filterState.entClass,
  949. entContact: this.filterState.entContact,
  950. pageSize: this.listState.pageSize,
  951. pageNum: this.listState.pageNum - 1, // 当前页, 从0开始
  952. }
  953. this.listState.loading = true
  954. this.listState.loaded = false
  955. $.ajax({
  956. url: '/publicapply/enterpriseSearch/doQuery',
  957. method: 'POST',
  958. data: data,
  959. success: function (res) {
  960. if (res.error_code === 0) {
  961. this.setListStateAndCheckPower(res)
  962. } else {
  963. // this.checkLogin()
  964. }
  965. }.bind(this),
  966. complete: function () {
  967. this.listState.loading = false
  968. this.listState.loaded = true
  969. }.bind(this)
  970. })
  971. },
  972. setListStateAndCheckPower: function (res) {
  973. var _this = this
  974. if (res.data) {
  975. if (res.data.total) {
  976. this.listState.total = res.data.total
  977. this.listState.pageTotal = Math.ceil(res.data.total / this.listState.pageSize)
  978. }
  979. if (res.data.list) {
  980. res.data.list.forEach(function (d) {
  981. d.company_shortname = _this.getShortName(d.company_name)
  982. d.randomBgc = _this.randomBgc()
  983. try {
  984. d.visited = visitedPath.pathVisited(
  985. new VisitedPathItem(
  986. '/ent_portrait/*',
  987. 'id=' + d.id
  988. )
  989. )
  990. } catch (error) {}
  991. })
  992. this.listState.list = res.data.list || []
  993. const resultIds = res.data.list.map(v => v.id)
  994. this.getEmployData(resultIds)
  995. // if (this.power) {
  996. // this.listState.list = res.data.list || []
  997. // } else {
  998. // if (res.data.list.length >= 4) {
  999. // res.data.list.length = 4
  1000. // res.data.list.push({
  1001. // company_shortname: 'xxx',
  1002. // company_address: 'xxx',
  1003. // company_name: 'xxx',
  1004. // company_status: 'xxx',
  1005. // legal_person: 'xxx',
  1006. // id: 'xxx',
  1007. // showMask: true
  1008. // })
  1009. // }
  1010. // this.listState.list = res.data.list || []
  1011. // }
  1012. }
  1013. } else {
  1014. this.listState.total = 0
  1015. this.listState.list = []
  1016. }
  1017. },
  1018. onPageChange: function (p) {
  1019. console.log(p, this.listState.total, this.listState.pageTotal);
  1020. if (p > this.listState.pageTotal) {
  1021. return this.toastFn('超出页码', 3000)
  1022. }
  1023. this.listState.pageNum = p
  1024. this.getList()
  1025. },
  1026. openVipPage: function (param) {
  1027. // 企业搜索中标区域-去开通
  1028. // 企业搜索单位类型-去开通
  1029. // 企业搜索联系方式-去开通
  1030. // 企业搜索底部第五条-去开通
  1031. // 企业搜索popover-去开通
  1032. if (param === 'more') {
  1033. this.baiduName = '底部第五条'
  1034. } else if (param === 'popover-link') {
  1035. this.baiduName = '-超级订阅用户-当月已使用hover'
  1036. }
  1037. var str = '企业搜索' + this.baiduName + '-去开通'
  1038. baiduEvent(str) // 去开通按钮百度统计
  1039. window.open('/swordfish/page_big_pc/free/svip/buy')
  1040. },
  1041. openEntHistory: function () {
  1042. baiduEvent('企业画像查看历史记录')
  1043. window.open('/swordfish/frontPage/seeHistory/sess/index')
  1044. },
  1045. openCustomerService: function () {
  1046. $('#go-customer-4').trigger('click')
  1047. },
  1048. toDetail: function (item) {
  1049. var id = item.id || item.entId
  1050. var seoId = item.nseo_id
  1051. let BIPage = ''
  1052. if (this.getBIParams) {
  1053. BIPage = '?resource=BI'
  1054. } else {
  1055. BIPage = ''
  1056. }
  1057. var seoUrl = '/qy/' + seoId + '.html' + BIPage
  1058. // 去超级订阅画像
  1059. var svipLink = '/swordfish/page_big_pc/svip/ent_ser_portrait/' + id + BIPage
  1060. // 大会员画像
  1061. var memberLink = '/swordfish/page_big_pc/ent_portrait/' + id + BIPage
  1062. // 是渠道合作页面需要登录后重定向
  1063. if(cooperateCode) {
  1064. openLoginDig(null, svipLink)
  1065. return
  1066. } else {
  1067. if (!this.inIframe) {
  1068. // 工作桌面外跳转seo画像
  1069. return window.open(seoUrl)
  1070. }
  1071. }
  1072. try {
  1073. item.visited = true
  1074. visitedPath.pathVisiting(
  1075. new VisitedPathItem(
  1076. '/ent_portrait/*',
  1077. 'id=' + id
  1078. )
  1079. )
  1080. } catch (error) {}
  1081. if (this.powerInfo.member) {
  1082. // 如果是专家版、智慧版 跳大会员页面
  1083. if (window.memberPower && window.memberPower.indexOf(4) !== -1) {
  1084. window.open(memberLink)
  1085. } else {
  1086. // 如果是商机版、自定义版
  1087. // 如果同时是超级订阅 判断有没有画像查看次数
  1088. if (this.powerInfo.vip > 0) {
  1089. $.ajax({
  1090. type: "POST",
  1091. url: "/bigmember/portrait/subVipPortrait/usage",
  1092. data: {
  1093. entId: id
  1094. },
  1095. success: function(r){
  1096. // 如果次数已用完 跳大会员企业画像页面
  1097. if (r.data.usage >= r.data.total) {
  1098. window.open(memberLink)
  1099. } else {
  1100. // 没用完 超级订阅跳企业画像页面
  1101. window.open(svipLink)
  1102. }
  1103. }
  1104. });
  1105. } else {
  1106. window.open(memberLink)
  1107. }
  1108. }
  1109. } else {
  1110. window.open(svipLink)
  1111. }
  1112. },
  1113. calcListItemForCap: function (p) {
  1114. if (p) {
  1115. return p + '万元'
  1116. } else {
  1117. return '-'
  1118. }
  1119. },
  1120. getEntStatus: function (status) {
  1121. if (status === '吊销') {
  1122. return 'tag-danger'
  1123. } else if (status === '注销') {
  1124. return 'tag-danger'
  1125. } else if (status === '撤销') {
  1126. return 'tag-disabled'
  1127. } else {
  1128. return ''
  1129. }
  1130. },
  1131. randomBgc: function () {
  1132. var arr = ['default', 'blue', 'orange', 'green']
  1133. var randomIndex = utils.getRandomNumber(0, arr.length - 1)
  1134. return 'bgc-' + arr[randomIndex]
  1135. },
  1136. getShortName: function (comName) {
  1137. var areaMap = chinaMapJSON || []
  1138. var shortname = comName
  1139. // 1. 循环省份城市进行替换
  1140. areaMap.forEach(function (item) {
  1141. var p = item.name.replace(/[省市]/, '')
  1142. if (shortname.indexOf(p) !== -1) {
  1143. shortname = shortname.replace(item.name, '').replace(p, '')
  1144. console.log(p + ' -> \'\'')
  1145. }
  1146. item.city.forEach(function (iitem) {
  1147. var c = iitem.name.replace(/[省市]/, '')
  1148. if (shortname.indexOf(c) !== -1) {
  1149. shortname = shortname.replace(iitem.name, '').replace(c, '')
  1150. console.log(c + ' -> \'\'')
  1151. }
  1152. iitem.area.forEach(function (iiitem) {
  1153. if (shortname.indexOf(iiitem) !== -1) {
  1154. shortname = shortname.replace(iiitem, '')
  1155. console.log(iiitem + ' -> \'\'')
  1156. }
  1157. })
  1158. })
  1159. })
  1160. var matchRes = shortname.match(/[\u4e00-\u9fa5]{4}/gm)
  1161. var shortname = matchRes ? matchRes[0] : shortname.slice(0, 4)
  1162. if (shortname.length < 4) {
  1163. shortname = shortname.slice(0, 4)
  1164. }
  1165. return shortname
  1166. },
  1167. onSizeChange: function (val) {
  1168. this.listState.pageSize = val
  1169. this.listState.pageNum = 1
  1170. this.onPageChange(this.listState.pageNum)
  1171. },
  1172. toastFn: function (text, duration) {
  1173. if (!duration) {
  1174. duration = 2000
  1175. }
  1176. var _html = ""
  1177. _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
  1178. _html+='<span>' + text + '</span></div></div>'
  1179. $('body').append(_html)
  1180. setTimeout(function(){
  1181. $(".custom-toast").fadeOut().remove();
  1182. },duration)
  1183. }
  1184. }
  1185. })
  1186. function getPowerComplete () {
  1187. entSearch.isFree = window.isFree
  1188. }
  1189. ;(function () {
  1190. var backUpLoginCallback = logic
  1191. logic = function (data, num) {
  1192. // do something
  1193. // 如果是当前页面已经使用过了,则只需要刷新power即可
  1194. if (data.result === 'ok') {
  1195. vm.getPower()
  1196. }
  1197. backUpLoginCallback(data, num)
  1198. }
  1199. })()
  1200. function insertVipIcon (target) {
  1201. $(target).append('<span class="icon-hot-vip"></span>')
  1202. }
  1203. function tabHover () {
  1204. $('#tab-zb, #tab-cgdw, #tab-gy').on('mouseover', function () {
  1205. var left = $(this).position().left
  1206. var offset = 0
  1207. if (left < 40) {
  1208. offset = ($(this).width() - 56) / 2
  1209. } else {
  1210. offset = ($(this).width() + 40 - 56) / 2
  1211. }
  1212. $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX('+ (left + offset) +'px)'})
  1213. }).on('mouseout', function () {
  1214. $(this).siblings('.el-tabs__active-bar').css({transform: 'translateX(124px)'})
  1215. })
  1216. }
  1217. function refreshEwmText (text) {
  1218. if (text && text.trim().length > 0) {
  1219. $(".wx-inner-title").html("扫码关注企业");
  1220. $(".wx-inner-bottom").html('扫码即可实时接收<span style="color:#2cb7ca">'+'"'+text+'"'+'</span>的中标信息!');
  1221. }
  1222. }
  1223. function ewmMoveHover() {
  1224. var $div = $(".search-right-wx .search-right-wx-inner"),
  1225. $parent = $(".search-right-wx");
  1226. $parent.on("mouseover",function(){
  1227. $div.css({
  1228. "transform":"scale(1)",
  1229. "transition":"transform 0.8s"
  1230. })
  1231. })
  1232. $parent.on("mouseout",function(){
  1233. $div.css({
  1234. "transform":"scale(0)",
  1235. "transition":"transform 0.2s"
  1236. })
  1237. })
  1238. }
  1239. function baiduEvent(name) {
  1240. console.log(name)
  1241. try {
  1242. _hmt.push(['_trackEvent', '超级订阅-pc', 'click', name]);
  1243. } catch (e) {
  1244. console.log('未初始化百度统计')
  1245. }
  1246. }