ent-search-index-pc.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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. provinceMap: provinceMap,
  13. searchContent: '',
  14. tabActive: 'qy',
  15. filterShow: true,
  16. searchTypeList: [
  17. {
  18. label: '企业名称',
  19. value: 'A'
  20. },
  21. {
  22. label: '法定代表人',
  23. value: 'B'
  24. },
  25. {
  26. label: '股东',
  27. value: 'C'
  28. },
  29. {
  30. label: '高管',
  31. value: 'D'
  32. },
  33. {
  34. label: '中标项目/标的物',
  35. value: 'E'
  36. }
  37. ],
  38. entTypeList: [
  39. {
  40. label: '有限责任公司',
  41. value: 'A'
  42. },
  43. {
  44. label: '股份有限公司',
  45. value: 'B'
  46. },
  47. {
  48. label: '有限合伙',
  49. value: 'C'
  50. },
  51. {
  52. label: '普通合伙',
  53. value: 'D'
  54. }
  55. ],
  56. entStateList: [
  57. {
  58. label: '存续(在营、开业、在业)',
  59. value: 'A'
  60. },
  61. {
  62. label: '吊销',
  63. value: 'B'
  64. },
  65. {
  66. label: '注销',
  67. value: 'C'
  68. },
  69. {
  70. label: '撤销',
  71. value: 'D'
  72. }
  73. ],
  74. priceList: [
  75. {
  76. label: '100万以内',
  77. value: '0-100'
  78. },
  79. {
  80. label: '100-500万',
  81. value: '100-500'
  82. },
  83. {
  84. label: '500-1000万',
  85. value: '500-1000'
  86. },
  87. {
  88. label: '1000-5000万',
  89. value: '1000-5000'
  90. },
  91. {
  92. label: '5000万以上',
  93. value: '5000-'
  94. },
  95. ],
  96. zblyFilterOption: {
  97. zbAreaOptions: [
  98. // {
  99. // label: '北京',
  100. // value: '北京'
  101. // }
  102. ],
  103. dwlxOptions: [
  104. {
  105. label: '采购单位',
  106. value: '1'
  107. },
  108. {
  109. label: '投标企业',
  110. value: '2'
  111. },
  112. {
  113. label: '招标代理机构',
  114. value: '3'
  115. },
  116. {
  117. label: '厂商',
  118. value: '4'
  119. }
  120. ],
  121. lxfsOptions: [
  122. {
  123. label: '固定电话',
  124. value: '1'
  125. },
  126. {
  127. label: '手机号',
  128. value: '2'
  129. },
  130. {
  131. label: '电子邮箱',
  132. value: '3'
  133. },
  134. {
  135. label: '不存在',
  136. value: '4'
  137. }
  138. ],
  139. },
  140. filterState: {
  141. searchType: [],
  142. entArea: [],
  143. entCity: [],
  144. entType: [],
  145. entStatus: [],
  146. entCapital: [],
  147. biddingArea: '', // 中标区域
  148. entClass: '', // 单位类型
  149. entContact: '' // 联系方式
  150. },
  151. listState: {
  152. loaded: false, // 是否已经搜索过
  153. loading: false,
  154. pageNum: 1, // 当前页, 从0开始
  155. pageSize: 10, // 每页多少条数据
  156. total: 0, // 一共多少条数据
  157. list: [] // 查询请求返回的数据
  158. },
  159. preSearch: {
  160. hover: false,
  161. focus: false,
  162. list: []
  163. },
  164. powerInfo: {
  165. entniche: '',
  166. member: '',
  167. vip: ''
  168. },
  169. power: false,
  170. powerLoaded: false,
  171. powerDialogShow: false,
  172. }
  173. },
  174. watch: {
  175. tabActive: function (newVal, oldVal) {
  176. if (newVal === 'zb') {
  177. if (this.searchContent) {
  178. location.href = '/jylab/supsearch/index.html?keywords=' + this.searchContent
  179. } else {
  180. location.href = '/jylab/supsearch/index.html'
  181. }
  182. }
  183. }
  184. },
  185. computed: {
  186. preSearchListShow: function () {
  187. return this.searchContent.trim().length > 2 && this.preSearch.list.length && (this.preSearch.focus || this.preSearch.hover)
  188. },
  189. buttonText: function () {
  190. if (this.power) {
  191. return '升级'
  192. } else {
  193. if (this.powerInfo.vip === 0) {
  194. return '开通'
  195. } else if (this.powerInfo.vip === 1) {
  196. return '升级'
  197. } else {
  198. return '升级'
  199. }
  200. }
  201. }
  202. },
  203. created: function () {
  204. this.getPower()
  205. this.initPageData()
  206. this.initProvinceMapList()
  207. },
  208. mounted: function () {
  209. this.initDOMEvents()
  210. // this.checkLogin()
  211. },
  212. methods: {
  213. checkLogin: function () {
  214. var moduleOpen = $('body').hasClass('modal-open')
  215. if (moduleOpen) return
  216. if (!loginflag) {
  217. $("#bidLogin").modal("show");
  218. }
  219. },
  220. getPower: function (callback) {
  221. $.ajax({
  222. url: '/publicapply/bidcoll/power',
  223. type: 'POST',
  224. success: function (res) {
  225. if (res.error_code === 0 && res.data) {
  226. Object.assign(this.powerInfo, res.data)
  227. this.checkPower()
  228. } else {
  229. this.checkLogin()
  230. }
  231. }.bind(this),
  232. complete: function () {
  233. this.powerLoaded = true
  234. callback && callback()
  235. }.bind(this)
  236. })
  237. },
  238. checkPower: function () {
  239. this.power = this.powerInfo.member || this.powerInfo.vip !== 0
  240. },
  241. initPageData: function () {
  242. if (pageInfo.searchContent) {
  243. this.searchContent = pageInfo.searchContent
  244. }
  245. },
  246. initProvinceMapList: function () {
  247. var provinceMapList = []
  248. for (var key in this.provinceMap) {
  249. this.provinceMap[key].forEach(function (item) {
  250. provinceMapList.push({
  251. label: item,
  252. value: item
  253. })
  254. })
  255. }
  256. this.zblyFilterOption.zbAreaOptions = provinceMapList
  257. },
  258. initDOMEvents: function () {
  259. ewmMoveHover()
  260. refreshEwmText(this.searchContent)
  261. },
  262. isFilterShow: function () {
  263. if (this.filterShow) {
  264. $('.search-filters').slideUp()
  265. } else {
  266. $('.search-filters').slideDown()
  267. }
  268. this.filterShow = !this.filterShow
  269. },
  270. searchTypeChange: function (t) {
  271. var eIndex = t.indexOf('E')
  272. if (!this.power && eIndex !== -1) {
  273. this.powerDialogShow = true
  274. t.splice(eIndex, 1)
  275. this.$refs.searchType.setState(t)
  276. return
  277. }
  278. this.filterState.searchType = t
  279. this.doSearch()
  280. },
  281. areaCityChange: function (area) {
  282. var city = []
  283. for (var key in area) {
  284. city = city.concat(area[key])
  285. }
  286. this.filterState.entArea = Object.keys(area)
  287. this.filterState.entCity = city
  288. this.doSearch()
  289. },
  290. entTypeChange: function (e) {
  291. this.filterState.entType = e
  292. this.doSearch()
  293. },
  294. entStateChange: function (e) {
  295. this.filterState.entStatus = e
  296. this.doSearch()
  297. },
  298. // 标准金额区间
  299. inexactPriceChange: function (p) {
  300. this.filterState.entCapital = p
  301. this.doSearch()
  302. },
  303. // 输入金额区间
  304. exactPriceChange: function (p) {
  305. this.$refs.entCapital.setState()
  306. this.filterState.entCapital = [p.min + '-' + p.max]
  307. this.doSearch()
  308. },
  309. zbFilterChange: function () {
  310. if (this.power) {
  311. this.doSearch()
  312. } else {
  313. this.filterState.biddingArea = ''
  314. this.filterState.entClass = ''
  315. this.filterState.entContact = ''
  316. this.powerDialogShow = true
  317. }
  318. },
  319. doSearch: function () {
  320. this.resetListState()
  321. this.getList()
  322. },
  323. resetListState: function () {
  324. var state = {
  325. loaded: false,
  326. loading: false,
  327. pageNum: 1,
  328. total: 0,
  329. list: []
  330. }
  331. Object.assign(this.listState, state)
  332. },
  333. getPreSearchList: utils.debounce(function () {
  334. var data = {
  335. name: this.searchContent.trim()
  336. }
  337. if (data.name.length <= 2) return
  338. $.ajax({
  339. url: '/bigmember/search/ent/association',
  340. method: 'POST',
  341. data: data,
  342. success: function (res) {
  343. if (res.error_code === 0) {
  344. if (res.data) {
  345. this.preSearch.list = res.data.list || []
  346. }
  347. } else {
  348. this.checkLogin()
  349. }
  350. }.bind(this)
  351. })
  352. }, 200),
  353. getList: function () {
  354. var data = {
  355. match: this.searchContent,
  356. matchType: this.filterState.searchType.join(','),
  357. entArea: this.filterState.entArea.join(','),
  358. entCity: this.filterState.entCity.join(','),
  359. entCapital: this.filterState.entCapital.join(','),
  360. entType: this.filterState.entType.join(','),
  361. entStatus: this.filterState.entStatus.join(','),
  362. biddingArea: this.filterState.biddingArea,
  363. entClass: this.filterState.entClass,
  364. entContact: this.filterState.entContact,
  365. pageSize: this.listState.pageSize,
  366. pageNum: this.listState.pageNum - 1, // 当前页, 从0开始
  367. }
  368. // return console.info(JSON.stringify(data, null, 2))
  369. if (!data.match.replace(/\s+/g, '')) return
  370. this.listState.loading = true
  371. this.listState.loaded = false
  372. $.ajax({
  373. url: '/publicapply/enterpriseSearch/doQuery',
  374. method: 'POST',
  375. data: data,
  376. success: function (res) {
  377. if (res.error_code === 0) {
  378. if (res.data) {
  379. if (res.data.total) {
  380. if (this.power) {
  381. this.listState.total = res.data.total
  382. } else {
  383. this.listState.total = 9
  384. }
  385. }
  386. if (res.data.list) {
  387. if (this.power) {
  388. this.listState.list = res.data.list || []
  389. } else {
  390. if (res.data.list.length > 4) {
  391. res.data.list.length = 4
  392. res.data.list.push({
  393. company_address: 'xxx',
  394. company_name: 'xxx',
  395. company_status: 'xxx',
  396. legal_person: 'xxx',
  397. id: 'xxx',
  398. showMask: true
  399. })
  400. }
  401. this.listState.list = res.data.list || []
  402. }
  403. }
  404. } else {
  405. this.listState.total = 0
  406. this.listState.list = []
  407. }
  408. } else {
  409. this.checkLogin()
  410. }
  411. }.bind(this),
  412. complete: function () {
  413. this.listState.loading = false
  414. this.listState.loaded = true
  415. }.bind(this)
  416. })
  417. },
  418. onPageChange: function (p) {
  419. this.listState.pageNum = p
  420. this.getList()
  421. },
  422. openVipPage: function () {
  423. window.open('/front/subscribe.html')
  424. },
  425. toDetail: function (id) {
  426. window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id)
  427. },
  428. calcListItemForCap: function (p) {
  429. if (p) {
  430. return p + '万元'
  431. } else {
  432. return '-'
  433. }
  434. },
  435. }
  436. })
  437. function refreshEwmText (text) {
  438. if (text && text.trim().length > 0) {
  439. $(".wx-inner-title").html("扫码关注企业");
  440. $(".wx-inner-bottom").html('扫码即可实时接收<span style="color:#2cb7ca">'+'"'+text+'"'+'</span>的中标信息!');
  441. }
  442. }
  443. function ewmMoveHover() {
  444. var $div = $(".search-right-wx .search-right-wx-inner"),
  445. $parent = $(".search-right-wx");
  446. $parent.on("mouseover",function(){
  447. $div.css({
  448. "transform":"scale(1)",
  449. "transition":"transform 0.8s"
  450. })
  451. })
  452. $parent.on("mouseout",function(){
  453. $div.css({
  454. "transform":"scale(0)",
  455. "transition":"transform 0.2s"
  456. })
  457. })
  458. }