ent-search-index-pc.js 33 KB

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