|
@@ -109,10 +109,12 @@ $(function () {
|
|
|
$("#zbIndex").attr("action", '/jylab/entSearch/index.html');
|
|
|
$("#zbIndex .ser").attr("name", 'searchvalue')
|
|
|
$("#zbIndex input").attr('placeholder', '请输入企业名称')
|
|
|
+ entAssoc.getAssocList()
|
|
|
} else if (dataId == 'cg') {
|
|
|
$("#zbIndex").attr("action", '/jylab/purSearch/index.html');
|
|
|
$("#zbIndex .ser").attr("name", 'searchvalue')
|
|
|
$("#zbIndex input").attr('placeholder', '请输入采购单位名称')
|
|
|
+ entAssoc.getAssocList()
|
|
|
} else if (dataId == 'gy') {
|
|
|
$("#zbIndex").attr("action", '/swordfish/page_web_pc/search/issued');
|
|
|
$("#zbIndex .ser").attr("name", 'keywords')
|
|
@@ -224,14 +226,21 @@ var entAssoc = {
|
|
|
var _this = this
|
|
|
$('#keywords').on('input', this.debounce(function () {
|
|
|
var isEntSearch = $('.search .tips .active').text().indexOf('企业搜索') !== -1
|
|
|
- if (isEntSearch) {
|
|
|
+ var isBuyerSearch = $('.search .tips .active').text().indexOf('采购单位搜索') !== -1
|
|
|
+ if (isEntSearch || isBuyerSearch) {
|
|
|
_this.getAssocList()
|
|
|
_this.checkListShow()
|
|
|
}
|
|
|
}, 300))
|
|
|
$('.pre-search-list').on('click', '.pre-search-item', function () {
|
|
|
+ var type = $(this).attr('data-type')
|
|
|
var id = $(this).attr('data-id')
|
|
|
- window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id)
|
|
|
+ var name = $(this).attr('data-name')
|
|
|
+ if (type === 'ent') {
|
|
|
+ window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id)
|
|
|
+ } else {
|
|
|
+ window.open('/swordfish/page_big_pc/free/loading/buyer/' + name)
|
|
|
+ }
|
|
|
})
|
|
|
// 控制list显示隐藏
|
|
|
$('#keywords').on('focus', function () {
|
|
@@ -251,17 +260,28 @@ var entAssoc = {
|
|
|
},
|
|
|
checkListShow: function () {
|
|
|
var isEntSearch = $('.search .tips .active').text().indexOf('企业搜索') !== -1
|
|
|
- var show = $('#keywords').val().length >= 2 && this.list.length && (this.preSearch.focus || this.preSearch.hover) && isEntSearch
|
|
|
+ var isBuyerSearch = $('.search .tips .active').text().indexOf('采购单位搜索') !== -1
|
|
|
+ var show = $('#keywords').val().length >= 2 && this.list.length && (this.preSearch.focus || this.preSearch.hover) && (isEntSearch || isBuyerSearch)
|
|
|
this.listShow(show)
|
|
|
},
|
|
|
getAssocList: function () {
|
|
|
var _this = this
|
|
|
+ var url = ''
|
|
|
+ var isEntSearch = $('.search .tips .active').text().indexOf('企业搜索') !== -1
|
|
|
+ var isBuyerSearch = $('.search .tips .active').text().indexOf('采购单位搜索') !== -1
|
|
|
+ if (isEntSearch) {
|
|
|
+ url = '/bigmember/search/ent/association'
|
|
|
+ } else if (isBuyerSearch) {
|
|
|
+ url = '/bigmember/search/buyer/association'
|
|
|
+ } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
var data = {
|
|
|
name: $('#keywords').val()
|
|
|
}
|
|
|
if (data.name.length < 2) return
|
|
|
$.ajax({
|
|
|
- url: '/bigmember/search/ent/association',
|
|
|
+ url: url,
|
|
|
method: 'POST',
|
|
|
data: data,
|
|
|
success: function (res) {
|
|
@@ -280,8 +300,13 @@ var entAssoc = {
|
|
|
render: function () {
|
|
|
var container = $('.pre-search-list')
|
|
|
var html = ''
|
|
|
+ var isEntSearch = $('.search .tips .active').text().indexOf('企业搜索') !== -1
|
|
|
this.list.forEach(function (item) {
|
|
|
- html += ('<div class="pre-search-item ellipsis" data-id=' + item.entId + '>' + item.name + '</div>')
|
|
|
+ if (isEntSearch) {
|
|
|
+ html += ('<div class="pre-search-item ellipsis" data-type="ent" data-id=' + item.entId + '>' + item.name + '</div>')
|
|
|
+ } else {
|
|
|
+ html += ('<div class="pre-search-item ellipsis" data-type="buyer" data-name=' + item + '>' + item + '</div>')
|
|
|
+ }
|
|
|
})
|
|
|
container.html(html)
|
|
|
},
|