' + i + '';
brand_con += '
';
for (j in data[i]) {
brand_con += '![' + data[i][j]['name'] + '](' + data[i][j]['image'] + ')
';
}
brand_con += '
';
x++;
}
if (zimu_con != '') zimu_con += '
所有品牌
';
$('#zimu_arr').html(zimu_con);
$('#brand_arr').html(brand_con);
if (show_all == 0) {
$('#zimu').text(cate_name + p + '(' + data[p].length + ')');
} else {
$('#zimu').text(cate_name + '所有品牌');
}
//console.log(zimu_con,brand_con);
}
}
function supplier_success(d) {
if (d.status == 1) {
var con = '';
var data = d.data['s'];
for (i in data) {
con += '
♦' + data[i]['name'] + '';
}
if (con == '') con = '
' + name + '品牌没有代理商';
$('#supplier_list').html(con);
}
}
function show_brand(id) {
$.ajax({
url: "/index/ajax_bs.html",
type: "post",
contentType: "application/json", //提交数据类型
dataType: "json",//服务器返回的数据类型
headers: { //请求头
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate", //这是获取的token
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Host": "www.mlcc1.com",
},
data: { id: id, type: 'b' },
beforeSend: function () {
$('#brand_arr').html('
');
},
success: brand_success
});
}
function show_brand_cate(id) {
}
function show_supplier(id) {
$.ajax({
url: request_url + "/index/ajax_bs.html",
type: "post",
headers: { //请求头
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate", //这是获取的token
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Host": "www.mlcc1.com",
},
data: { id: id, type: 's' },
contentType: "application/json", //提交数据类型
dataType: "json",//服务器返回的数据类型
beforeSend: function () {
$('#supplier_list').html('
加载中……');
},
success: supplier_success
});
}
function show_bs() {
show_all = 1;
$.ajax({
url: request_url + "/index/ajax_bs.html",
type: "post",
data: { id: 0 },
headers: { //请求头
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate", //这是获取的token
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Host": "www.mlcc1.com",
},
contentType: "application/json", //提交数据类型
dataType: "json",//服务器返回的数据类型
beforeSend: function () {
$('#supplier_list').html('
加载中……');
$('#brand_arr').html('
');
},
success: function (d) {
brand_success(d);
supplier_success(d);
}
});
$('#supplier').text('所有');
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) { return pair[1]; }
}
return (false);
}
$(document).ready(function () {
//$('.zimu').eq(0).removeClass('zimu').addClass('zimu1').attr('data-check',1);
//$('.brand_l').hide();
//$('.brand_l').eq(0).show();
$('.cate_a').click(function () {
$('.cate').removeClass('border1').addClass('border');
if ($(this).next().css('display') == 'none') {
$('.cate_sub').hide();
$(this).next().show();
$(this).parent().removeClass('border').addClass('border1');
} else {
$(this).next().hide();
}
});
$('#zimu_arr').on('mouseover mouseout click', '.zimu,.zimu1', function (e) {
if (e.type == 'mouseover') {
$(this).removeClass('zimu').addClass('zimu1');
} else if (e.type == 'mouseout') {
if ($(this).attr('data-check') == 0) {
$(this).removeClass('zimu1').addClass('zimu');
} else {
$(this).removeClass('zimu').addClass('zimu1');
}
} else if (e.type == 'click') {
var id = $(this).attr('data-id');
var num = $(this).attr('data-num');
var types = getQueryVariable("types");
var ids = getQueryVariable("id");
var url = "?lettertype=" + id;
if (types != "") {
url += "&types=" + types;
}
if (ids != "") {
url += "&id=" + ids;
}
var typeb = getQueryVariable("typeb");
var idb = getQueryVariable("idb");
if (typeb != "") {
url += "&typeb=" + typeb + "&idb=" + idb;
}
window.location.href = url;
}
});
$('#brand_arr').on('click', '.brand_c', function () {
var id = $(this).attr('data-id');
var name = $(this).attr('title');
var lettertype = getQueryVariable("lettertype");
var url = "?id=" + id + "&types=s";
if (lettertype != "") {
url += "&lettertype=" + lettertype;
}
var typeb = getQueryVariable("typeb");
var idb = getQueryVariable("idb");
if (typeb != "") {
url += "&typeb=" + typeb + "&idb=" + idb;
}
var classId = getQueryVariable("classId")
var categoryName = getQueryVariable("categoryName")
if (classId != "") {
url += "&classId=" + classId + "&categoryName=" + categoryName
}
window.location.href = url;
});
if (bs_id > 0) {
if (flag == 1) {
url = request_url + "/index/ajax_brand.html";
} else if (flag == 2) {
url = "/index/ajax_supplier.html"
}
$.ajax({
url: url,
type: "post",
data: { id: bs_id },
success: function (d) {
content = d.data;
$('#content').html(content);
}
})
}
$('#supplier_arr').on('click', '.supplier_c', function () {
var id = $(this).attr('data-id');
var name = $(this).attr('title');
show_brand(id);
show_all = 1;
cate_name = '';
$.ajax({
url: request_url + "/index/ajax_supplier.html",
type: "post",
data: { id: id },
beforeSend: function () {
$('#content').html('加载中……');
},
success: function (d) {
$('#content').html(d.data);
$('#jianjie').text(name);
}
});
});
$('.ca').click(function () {
var id = $(this).attr('data-id');
var name = $(this).attr('data-name');
cate_name = name;
location.href = "?classId=" + id + "&categoryName=" + cate_name
});
$('#search_buttonx').click(function () {
var searchkey = $('input[name="searchkey"]').val();
if (searchkey == '') return false;
$('#search_form').submit();
});
});
|

Copyright © 2022 ALL Rights Reserved 版权所有:亚太电子有限公司
全国免费电话:13510980180 邮箱: sales01@asia-chips.com www.asia-chips.com
|
|
|
|