...
|
...
|
@@ -37,6 +37,15 @@ var Bll = { |
|
|
Brands: [],
|
|
|
Brands1: {},
|
|
|
Brdata: [],
|
|
|
sorts: [
|
|
|
{tagName: 'colorName', list: []},
|
|
|
{tagName: 'stylename', list: []},
|
|
|
{tagName: 'sortName', list: []},
|
|
|
{tagName: 'brand_name', list: []},
|
|
|
{tagName: 'gendername', list: []}
|
|
|
],
|
|
|
searchSorts: [],
|
|
|
searchSkn: [],
|
|
|
getBrands: function () {
|
|
|
var Brand = {};
|
|
|
$.get("/ajax/yohosearch", function (res) {
|
...
|
...
|
@@ -134,7 +143,7 @@ var Bll = { |
|
|
}]
|
|
|
});
|
|
|
Bll.__editRender();
|
|
|
moveDrag();
|
|
|
Bll2.moveDrag();
|
|
|
if (module.contentData.dialog == "template_dialog_text") {
|
|
|
baidu && baidu.destroy();
|
|
|
baidu = UM.getEditor('baidueditor');
|
...
|
...
|
@@ -144,7 +153,7 @@ var Bll = { |
|
|
renderDialog: function (templater) {
|
|
|
Bll.__render(".modal-body", templater, Bll.module);
|
|
|
Bll.__editRender();
|
|
|
|
|
|
|
|
|
},
|
|
|
__editRender: function () {
|
|
|
components.init();
|
...
|
...
|
@@ -174,7 +183,7 @@ Bll.getBrands(); |
|
|
* @returns {Array}
|
|
|
* @constructor
|
|
|
*/
|
|
|
function Unique(Array,key) {
|
|
|
function Unique(Array, key) {
|
|
|
var res = [], hash = {};
|
|
|
for (var i = 0, elem; (elem = Array[i]) != null; i++) {
|
|
|
if (!hash[elem[key]]) {
|
...
|
...
|
@@ -379,7 +388,7 @@ $(document).on("mouseleave", ".dragItem1", function () { |
|
|
*/
|
|
|
var g = new common.grid({
|
|
|
el: "#gird",
|
|
|
hash:false,
|
|
|
hash: false,
|
|
|
columns: [{
|
|
|
display: "选择",
|
|
|
"type": "checkbox"
|
...
|
...
|
@@ -470,7 +479,6 @@ $(document).on("click", "#brandAutoBtn", function () { |
|
|
});
|
|
|
}
|
|
|
});
|
|
|
//product_skc=["51022754","51178582","50030519","51128961","51146105","51055462","51143090","51153133","51010047","51153223","51152761","51149414","51082157","51149561","51079256"];
|
|
|
if (product_skc.length > 0) {
|
|
|
common.util.__ajax({
|
|
|
url: '/yohosearch/search',
|
...
|
...
|
@@ -499,7 +507,7 @@ $(document).on("click", "#brandAutoBtn", function () { |
|
|
}
|
|
|
});
|
|
|
Bll.Brdata = (Bll.Brdata || ViewModel.brandList || []).concat(b);
|
|
|
Bll.Brdata = Unique(Bll.Brdata,"id");
|
|
|
Bll.Brdata = Unique(Bll.Brdata, "id");
|
|
|
Bll.Brdata = Bll.renderBrandPic(Bll.Brdata);
|
|
|
}
|
|
|
}, true);
|
...
|
...
|
@@ -531,22 +539,117 @@ $(document).on("keyup", "#brandsearch", function () { |
|
|
});
|
|
|
|
|
|
/******************************************商品部分**********************************/
|
|
|
/**
|
|
|
* 商品部分公共方法
|
|
|
*/
|
|
|
var Bll2 = {
|
|
|
colors:[],//颜色
|
|
|
styles :[{id: 1, stylename: "街头"}, {id: 2, stylename: "趣味"}, {id: 3, stylename: "运动"}, {id: 4, stylename: "美式"},
|
|
|
{id: 5, stylename: "简约"}, {id: 5, stylename: "潮流"}],//风格
|
|
|
genders :[{id: 1, gendername: "男"}, {id: 2, gendername: "女"}, {id: 3, gendername: "通用"}],//性别
|
|
|
sorts:[],
|
|
|
/**
|
|
|
* 拼接勾选标签的id,作为查询条件
|
|
|
*/
|
|
|
getIds: function (array) {
|
|
|
var ids = [];
|
|
|
var id = "";
|
|
|
if (array.length > 0) {
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
ids.push(array[i].id);
|
|
|
}
|
|
|
id = ids.join(',');
|
|
|
}
|
|
|
return id;
|
|
|
},
|
|
|
/**
|
|
|
* 输入关键字查询
|
|
|
* @param txt 输入的内容
|
|
|
* @param array 匹配的数组
|
|
|
* @param attr 匹配的字段
|
|
|
*/
|
|
|
//todo 多个标签查询时,单个标签不是模糊匹配
|
|
|
reg: function (txt, array, attr) {
|
|
|
var obj = {
|
|
|
tagName: attr,
|
|
|
list: []
|
|
|
};
|
|
|
array.forEach(function (item) {
|
|
|
var i = item[attr].indexOf(txt);
|
|
|
var j = txt.indexOf(item[attr]);
|
|
|
if (i > -1 || j > -1) {
|
|
|
obj.list.push({id: item.id, name: item[attr]})
|
|
|
}
|
|
|
});
|
|
|
Bll.searchSorts.push(obj);
|
|
|
},
|
|
|
//拖拽商品
|
|
|
moveDrag:function (ele) {
|
|
|
var $parent = $(".imagegroup");
|
|
|
var i = $parent.data("i");//组标志
|
|
|
var isg = typeof(i) === "number" ? true : false;
|
|
|
var __data__ = null;
|
|
|
|
|
|
$parent.css("height", "auto");
|
|
|
$parent.each(function (i) {
|
|
|
if (isg) {
|
|
|
__data__ = Bll.module.contentData.data[i].list;
|
|
|
} else {
|
|
|
__data__ = Bll.module.contentData.data;
|
|
|
}
|
|
|
console.log($(this));
|
|
|
$(this).sortable({
|
|
|
items: ".dragItem2",
|
|
|
array: __data__,
|
|
|
callback: function (data) {
|
|
|
if (isg) {
|
|
|
Bll.module.contentData.data[i].list = data;
|
|
|
Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;
|
|
|
Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;
|
|
|
} else {
|
|
|
Bll.module.contentData.data = data;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
common.util.__ajax({
|
|
|
async: false,
|
|
|
url: "/erpproduct/product/colorList"
|
|
|
}, function (res) {
|
|
|
Bll2.colors = res.data.list;
|
|
|
}, true);
|
|
|
common.util.__ajax({
|
|
|
async: false,
|
|
|
url: "/product/class/queryAllProductSortList",
|
|
|
data: {
|
|
|
booleanStatus: true
|
|
|
}
|
|
|
}, function (res) {
|
|
|
Bll2.sorts = res.data;
|
|
|
}, true);
|
|
|
/*选择商品表格*/
|
|
|
var goodsgird = new common.grid({
|
|
|
el: '#goodsgird',
|
|
|
hash:false,
|
|
|
hash: false,
|
|
|
parms: function () {
|
|
|
var price = "";
|
|
|
if (common.util.__input('beginPrice')&&common.util.__input('endPrice')) {
|
|
|
price = common.util.__input('beginPrice')+","+common.util.__input('endPrice');
|
|
|
if (common.util.__input('min-price') && common.util.__input('max-price')) {
|
|
|
price = common.util.__input('min-price') + "," + common.util.__input('max-price');
|
|
|
}
|
|
|
return {
|
|
|
status:1,
|
|
|
sales:"Y",
|
|
|
stocknumber:"1",
|
|
|
attribute_not:"2",
|
|
|
status: 1,
|
|
|
sales: "Y",
|
|
|
stocknumber: "1",
|
|
|
attribute_not: "2",
|
|
|
query: common.util.__input('skns'),
|
|
|
price: price
|
|
|
price: price,
|
|
|
color: Bll2.getIds(Bll.sorts[0].list),
|
|
|
//style: getIds(Bll.sorts[1].list),//风格先不管
|
|
|
msort: Bll2.getIds(Bll.sorts[2].list),
|
|
|
brand: Bll2.getIds(Bll.sorts[3].list),
|
|
|
gender: Bll2.getIds(Bll.sorts[4].list)
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
...
|
...
|
@@ -561,19 +664,19 @@ var goodsgird = new common.grid({ |
|
|
item.images_url = common.util.__joinImg("goodsimg", item.images_url);
|
|
|
}
|
|
|
else {
|
|
|
if(item.default_images){
|
|
|
if (item.default_images) {
|
|
|
item.images_url = common.util.__joinImg("goodsimg", item.default_images);
|
|
|
}
|
|
|
else{
|
|
|
item.images_url=""
|
|
|
else {
|
|
|
item.images_url = ""
|
|
|
}
|
|
|
}
|
|
|
if(item.images_url){
|
|
|
if (item.images_url) {
|
|
|
return "<img width=120 height=60 src='" + item.images_url + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90'/>";
|
|
|
}else{
|
|
|
} else {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}, {
|
|
|
display: "产品名称",
|
...
|
...
|
@@ -595,44 +698,37 @@ var goodsgird = new common.grid({ |
|
|
name: "storage_num"
|
|
|
}]
|
|
|
});
|
|
|
//搜索按钮
|
|
|
$(document).on("click", "#search", function () {
|
|
|
if(goodsgird.grid){
|
|
|
goodsgird.reload(1);
|
|
|
}else{
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
}
|
|
|
});
|
|
|
//点击“选择标签”按钮(添加商品)
|
|
|
$(document).on("click", "#goodsSelectBtn", function () {
|
|
|
new common.dialog({
|
|
|
title: "选择商品",
|
|
|
zIndex: 52,
|
|
|
content: $("#template_dialog_goodsgird").html(),
|
|
|
width: '80%',
|
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function () {
|
|
|
var gs=goodsgird.selected.map(function (item, index) {
|
|
|
var gs = goodsgird.selected.map(function (item, index) {
|
|
|
return {
|
|
|
src: item.images_url,
|
|
|
id: item.product_skn,
|
|
|
product_skc: item.product_skc
|
|
|
}
|
|
|
})
|
|
|
Bll.module.contentData.data=Bll.module.contentData.data.concat(gs);
|
|
|
Bll.module.contentData.data=Unique(Bll.module.contentData.data,"product_skc")
|
|
|
Bll.module.contentData.data = Bll.module.contentData.data.concat(gs);
|
|
|
Bll.module.contentData.data = Unique(Bll.module.contentData.data, "product_skc")
|
|
|
Bll.__render("#goodspic", "template_dialog_goodsimgs", {
|
|
|
datas: Bll.module.contentData.data
|
|
|
});
|
|
|
moveDrag();
|
|
|
|
|
|
Bll2.moveDrag();
|
|
|
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
goodsgird.grid=null;
|
|
|
//goodsgird.init('/yohosearch/search');
|
|
|
goodsgird.grid = null;
|
|
|
});
|
|
|
|
|
|
//点击“添加组”按钮(添加商品组)
|
|
|
$(document).on("click", "#goodsaddBtn", function () {
|
|
|
var item = $.extend(true, {}, Button[4].data[0]);
|
...
|
...
|
@@ -646,40 +742,38 @@ $(document).on("click", ".goodsSelectBtn", function () { |
|
|
var index = $(this).data("index");
|
|
|
new common.dialog({
|
|
|
title: "选择商品",
|
|
|
zIndex: 52,
|
|
|
content: $("#template_dialog_goodsgird").html(),
|
|
|
width: '80%',
|
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function () {
|
|
|
if(goodsgird.selected){
|
|
|
if (goodsgird.selected) {
|
|
|
goodsgird.selected.forEach(function (item, i) {
|
|
|
if(Object.prototype.toString.call(Bll.module.contentData.data[index].list)!=="[object Array]"){
|
|
|
Bll.module.contentData.data[index].list=[];
|
|
|
if (Object.prototype.toString.call(Bll.module.contentData.data[index].list) !== "[object Array]") {
|
|
|
Bll.module.contentData.data[index].list = [];
|
|
|
}
|
|
|
Bll.module.contentData.data[index].list.push({
|
|
|
src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90'
|
|
|
src: item.images_url,
|
|
|
id: item.product_skn,
|
|
|
product_skc: item.product_skc,
|
|
|
maxSortId: item.max_sort_id
|
|
|
});
|
|
|
});
|
|
|
|
|
|
Bll.module.contentData.data[index].list=Unique(Bll.module.contentData.data[index].list,"product_skc");
|
|
|
|
|
|
Bll.module.contentData.data[index].list = Unique(Bll.module.contentData.data[index].list, "product_skc");
|
|
|
Bll.module.contentData.data[index].cover = {
|
|
|
cover: Bll.module.contentData.data[index].list[0].src,
|
|
|
maxSortId: Bll.module.contentData.data[index].list[0].maxSortId
|
|
|
};
|
|
|
|
|
|
|
|
|
}
|
|
|
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
|
|
|
moveDrag();
|
|
|
Bll2.moveDrag();
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
//goodsgird.init('/yohosearch/search');
|
|
|
goodsgird.grid=null;
|
|
|
goodsgird.grid = null;
|
|
|
});
|
|
|
//删除图片按钮
|
|
|
$(document).on("click", ".removepic", function () {
|
...
|
...
|
@@ -708,70 +802,342 @@ $(document).on("click", ".removepic", function () { |
|
|
}));
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 手动输入 tab
|
|
|
*/
|
|
|
$(document).on("click", ".hand", function () {
|
|
|
$(this).css("color", 'red');//当前链接变红色
|
|
|
$("#skns").val("");//清空输入框
|
|
|
$(".tag").css("color", 'black');//搜索标签链接变黑色
|
|
|
$(".search-con1").show();
|
|
|
$(".search-con2").hide();
|
|
|
$(".tag-con").hide();
|
|
|
$(".goods-list").hide();
|
|
|
});
|
|
|
|
|
|
//拖拽商品
|
|
|
//
|
|
|
function moveDrag(ele){
|
|
|
var $parent = $(".imagegroup");
|
|
|
var i = $parent.data("i");//组标志
|
|
|
var isg = typeof(i) === "number" ? true : false;
|
|
|
var __data__=null;
|
|
|
|
|
|
$parent.css("height","auto");
|
|
|
$parent.each(function(i){
|
|
|
if (isg) {
|
|
|
__data__=Bll.module.contentData.data[i].list;
|
|
|
}else{
|
|
|
__data__=Bll.module.contentData.data;
|
|
|
}
|
|
|
console.log($(this));
|
|
|
$(this).sortable({
|
|
|
items:".dragItem2",
|
|
|
array:__data__,
|
|
|
callback:function(data){
|
|
|
if (isg) {
|
|
|
Bll.module.contentData.data[i].list=data;
|
|
|
Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;
|
|
|
Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;
|
|
|
}else{
|
|
|
Bll.module.contentData.data=data;
|
|
|
/**
|
|
|
* 手动输入中“搜索商品”按钮
|
|
|
*/
|
|
|
$(document).on("click", "#search", function () {
|
|
|
$(".goods-list").show();
|
|
|
if (goodsgird.grid) {
|
|
|
goodsgird.reload(1);
|
|
|
} else {
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 标签搜索 tag
|
|
|
*/
|
|
|
$(document).on("click", ".tag", function () {
|
|
|
$(this).css("color", 'red');
|
|
|
$("#tags").val("");//清空输入框
|
|
|
$("#skns2").val("");//清空输入框
|
|
|
$(".hand").css("color", 'black');
|
|
|
$(".search-con1").hide();
|
|
|
$(".search-con2").show();
|
|
|
$(".tag-con").hide();
|
|
|
$(".goods-list").hide();
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 搜索标签按钮
|
|
|
* 1、默认情况
|
|
|
* 2、输入关键字
|
|
|
* 3、输入skn
|
|
|
*/
|
|
|
$(document).on("click", "#search-tag", function () {
|
|
|
Bll.sorts = [
|
|
|
{tagName: 'colorName', list: []},
|
|
|
{tagName: 'stylename', list: []},
|
|
|
{tagName: 'sortName', list: []},
|
|
|
{tagName: 'brand_name', list: []},
|
|
|
{tagName: 'gendername', list: []}
|
|
|
];
|
|
|
$(".tag-con").show();
|
|
|
$(".tag-con .sort").hide();
|
|
|
$(".orther").html(common.util.__template2($("#sorts-template").html(), {
|
|
|
colors: Bll2.colors,
|
|
|
//todo 风格暂时无数据
|
|
|
styles: Bll2.styles,
|
|
|
sorts: Bll2.sorts,
|
|
|
brands: Bll.Brands,
|
|
|
brands1: Bll.Brands[0],
|
|
|
genders: Bll2.genders
|
|
|
}));
|
|
|
if ($("#tags").val() !== "") {
|
|
|
var txt = $("#tags").val();
|
|
|
Bll2.reg(txt, Bll2.colors, "colorName");
|
|
|
//todo 风格暂时无数据
|
|
|
Bll2.reg(txt, Bll2.styles, "stylename");
|
|
|
Bll2.reg(txt, Bll2.sorts, "sortName");
|
|
|
Bll2.reg(txt, Bll2.genders, "gendername");
|
|
|
$(".orther").html(common.util.__template2($("#sorts-template").html(), {
|
|
|
colors: Bll.searchSorts[0].list.length == 0 ? Bll2.colors : Bll.searchSorts[0].list,
|
|
|
//todo 风格暂时无数据
|
|
|
styles: Bll.searchSorts[1].list.length == 0 ? Bll2.styles : Bll.searchSorts[1].list,
|
|
|
sorts: Bll.searchSorts[2].list.length == 0 ? Bll2.sorts : Bll.searchSorts[2].list,
|
|
|
brands: Bll.Brands,
|
|
|
brands1: Bll.Brands[0],
|
|
|
genders: Bll.searchSorts[3].list.length == 0 ? Bll2.genders : Bll.searchSorts[3].list
|
|
|
}));
|
|
|
Bll.searchSorts = [];
|
|
|
}
|
|
|
if ($("#skns2").val() !== "") {
|
|
|
var sknTxt = $("#skns2").val();
|
|
|
common.util.__ajax({
|
|
|
async: false,
|
|
|
url: "/yohosearch/search",
|
|
|
data: {
|
|
|
status: 1,
|
|
|
sales: "Y",
|
|
|
stocknumber: "1",
|
|
|
attribute_not: "2",
|
|
|
query: sknTxt
|
|
|
}
|
|
|
}, function (res) {
|
|
|
Bll.searchSkn = res.data.list;
|
|
|
}, true);
|
|
|
var Arrlist = [
|
|
|
{tagName: 'colorName', list: []},
|
|
|
{tagName: 'stylename', list: []},
|
|
|
{tagName: 'sortName', list: []},
|
|
|
{tagName: 'brand_name', list: []},
|
|
|
{tagName: 'gendername', list: []}
|
|
|
];
|
|
|
//todo 风格无数据
|
|
|
for (var i = 0; i < Bll.searchSkn.length; i++) {
|
|
|
var sortname = "";
|
|
|
for (var j = 0; j < Bll2.sorts.length; j++) {
|
|
|
if (Bll2.sorts[j].id == Bll.searchSkn[i].max_sort_id) {
|
|
|
sortname = Bll2.sorts[j].sortName;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
var colorObj = {
|
|
|
id: Bll.searchSkn[i].color_id,
|
|
|
name: Bll.searchSkn[i].color_name
|
|
|
};
|
|
|
var genderObj = {
|
|
|
id: Bll.searchSkn[i].gender,
|
|
|
name: Bll2.genders[Bll.searchSkn[i].gender - 1].gendername
|
|
|
};
|
|
|
var sortObj = {
|
|
|
id: Bll.searchSkn[i].max_sort_id,
|
|
|
name: sortname
|
|
|
};
|
|
|
Arrlist[0].list.push(colorObj);
|
|
|
Arrlist[2].list.push(sortObj);
|
|
|
Arrlist[4].list.push(genderObj);
|
|
|
}
|
|
|
$(".orther").html(common.util.__template2($("#sorts-template").html(), {
|
|
|
colors: Arrlist[0].list.length == 0 ? Bll2.colors : Unique(Arrlist[0].list, "id"),
|
|
|
//todo 风格暂时无数据
|
|
|
styles: Bll2.styles,
|
|
|
sorts: Arrlist[2].list.length == 0 ? Bll2.sorts : Unique(Arrlist[2].list, "id"),
|
|
|
brands: Bll.Brands,
|
|
|
brands1: Bll.Brands[0],
|
|
|
genders: Arrlist[4].list.length == 0 ? Bll2.genders : Unique(Arrlist[4].list, "id")
|
|
|
}));
|
|
|
}
|
|
|
});
|
|
|
/**
|
|
|
* 标签搜索中 “搜索商品”按钮
|
|
|
*/
|
|
|
$(document).on("click", "#search2", function () {
|
|
|
$(".goods-list").show();
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
});
|
|
|
/**
|
|
|
* 价格筛选
|
|
|
*/
|
|
|
$(document).on("click", "#price-search", function () {
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
});
|
|
|
|
|
|
/*
|
|
|
$(document).on("mouseover", ".dragItem2", function () {
|
|
|
var $parent = $(this).parents("ul.imagegroup");
|
|
|
var i = $parent.data("i");//组标志
|
|
|
var isg = typeof(i) === "number" ? true : false;
|
|
|
var __data__=null;
|
|
|
if (isg) {
|
|
|
__data__=Bll.module.contentData.data[i].list;
|
|
|
}else{
|
|
|
__data__=Bll.module.contentData.data;
|
|
|
/**
|
|
|
* 点击更多品牌
|
|
|
*/
|
|
|
//todo 勾选项展开后仍然勾选
|
|
|
$(document).on("click", ".brandMore", function () {
|
|
|
var brandShow = $(this).parent().find(".brandShow");
|
|
|
var brandHide = $(this).parent().find(".brandHide");
|
|
|
var i = 0;
|
|
|
var brandId = "";
|
|
|
if ($(this).hasClass('open')) {
|
|
|
$(this).removeClass("open").find('a').text("更多");
|
|
|
brandHide.hide();
|
|
|
brandShow.show();
|
|
|
for (i = 0; i < Bll.sorts[3].list.length; i++) {
|
|
|
brandId = "brandId_" + Bll.sorts[3].list[i].id;
|
|
|
$("input." + brandId).attr("checked", "checked");
|
|
|
}
|
|
|
} else {
|
|
|
$(this).addClass("open").find('a').text("收起");
|
|
|
brandHide.show();
|
|
|
brandShow.hide();
|
|
|
$("#all .form-group").show();
|
|
|
for (i = 0; i < Bll.sorts[3].list.length; i++) {
|
|
|
brandId = "brandId_" + Bll.sorts[3].list[i].id;
|
|
|
$("input." + brandId).attr("checked", "checked");
|
|
|
}
|
|
|
}
|
|
|
var drag = new common.drag(".imagegroup", __data__, function (data) {
|
|
|
if (isg) {
|
|
|
Bll.module.contentData.data[i].list=data;
|
|
|
Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;
|
|
|
Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;
|
|
|
}else{
|
|
|
Bll.module.contentData.data=data;
|
|
|
});
|
|
|
/**
|
|
|
* 点击"more"
|
|
|
*/
|
|
|
$(document).on("click", ".more", function () {
|
|
|
var _show = $(this).parent().find("._show");
|
|
|
//如果已经打开
|
|
|
if ($(this).hasClass('open')) {
|
|
|
$(this).removeClass("open").find('a').text("更多");
|
|
|
_show.find(".form-group:gt(4)").addClass('hide');
|
|
|
} else {
|
|
|
$(this).addClass("open").find('a').text("收起");
|
|
|
_show.find(".form-group").removeClass('hide');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//勾选标签
|
|
|
$(document).on("click", ".changeCheck", function () {
|
|
|
var name = $(this).attr('name');
|
|
|
if ($(this).is(':checked')) {
|
|
|
for (var i = 0; i < Bll.sorts.length; i++) {
|
|
|
if (Bll.sorts[i].tagName == name) {
|
|
|
Bll.sorts[i].list.push({id: $(this).val(), name: $(this).data('val')})
|
|
|
}
|
|
|
}
|
|
|
$parent.html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
|
|
|
datas: data
|
|
|
}));
|
|
|
}
|
|
|
else {
|
|
|
for (var j = 0; j < Bll.sorts.length; j++) {
|
|
|
if (Bll.sorts[j].tagName == name) {
|
|
|
for (var k = 0; k < Bll.sorts[j].list.length; k++) {
|
|
|
if (Bll.sorts[j].list[k].id == $(this).val()) {
|
|
|
Bll.sorts[j].list.splice(k, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$(".sort").show();
|
|
|
Bll.__render(".sort", "tag-template", {
|
|
|
sorts: Bll.sorts
|
|
|
});
|
|
|
drag.Initialize();
|
|
|
|
|
|
});
|
|
|
$(document).on("mouseleave", ".dragItem2", function () {
|
|
|
new common.drag(".imagegroup").destroy();
|
|
|
|
|
|
});*/
|
|
|
/**
|
|
|
* 单击单个已选标签,删除
|
|
|
*/
|
|
|
$(document).on("click", ".tag1 a", function () {
|
|
|
var i = 0;
|
|
|
var name = $(this).attr('name');//属于哪一类 name
|
|
|
var index = $(this).data('val');//属于哪一类 index
|
|
|
var id = $(this).data('field');//当前项的id
|
|
|
for (i = 0; i < Bll.sorts.length; i++) {
|
|
|
if (Bll.sorts[i].tagName == name) {
|
|
|
Bll.sorts[i].list.splice($(this).data("index"), 1);
|
|
|
}
|
|
|
}
|
|
|
switch (index) {
|
|
|
case 0:
|
|
|
for (i = 0; i < colors.length; i++) {
|
|
|
if (colors[i].id == id) {
|
|
|
$("input[name='colorName'][value='" + id + "']").removeAttr("checked");
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
//todo 风格暂时无数据
|
|
|
case 1:
|
|
|
for (i = 0; i < styles.length; i++) {
|
|
|
if (styles[i].id == id) {
|
|
|
$("input[name='stylename'][value='" + id + "']").removeAttr("checked");
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
for (i = 0; i < sorts.length; i++) {
|
|
|
if (sorts[i].id == id) {
|
|
|
$("input[name='sortName'][value='" + id + "']").removeAttr("checked");
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
//todo 品牌
|
|
|
case 3:
|
|
|
for (i = 0; i < Bll.Brands.length; i++) {
|
|
|
for (var j = 0; j < Bll.Brands[i].items.length; j++) {
|
|
|
if (Bll.Brands[i].items[j].id == id) {
|
|
|
$("input[name='brand_name'][value='" + id + "']").removeAttr("checked");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 4:
|
|
|
for (i = 0; i < genders.length; i++) {
|
|
|
if (genders[i].id == id) {
|
|
|
$("input[name='gendername'][value='" + id + "']").removeAttr("checked");
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
Bll.__render(".sort", "tag-template", {
|
|
|
sorts: Bll.sorts
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 搜索品牌输入框
|
|
|
*/
|
|
|
$(document).on("keyup", "#brandsearch1", function () {
|
|
|
var txt = $(this).val();
|
|
|
$("#all .form-group").hide();
|
|
|
var list = $("#all .form-group");
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var value = $(list[i]).find('input').data("val");
|
|
|
if (value.indexOf(txt) > -1) {
|
|
|
$(list[i]).show();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
/*点击品牌切换*/
|
|
|
$(document).on('click', '.brand-index1', function () {
|
|
|
var brandIndex = $(this).text();
|
|
|
$("#brandsearch1").val("");
|
|
|
$("#all .form-group").hide();
|
|
|
$('#all').find('[name="' + brandIndex + '"]').show();
|
|
|
});
|
|
|
|
|
|
|
|
|
/*
|
|
|
$(document).on("mouseover", ".dragItem2", function () {
|
|
|
var $parent = $(this).parents("ul.imagegroup");
|
|
|
var i = $parent.data("i");//组标志
|
|
|
var isg = typeof(i) === "number" ? true : false;
|
|
|
var __data__=null;
|
|
|
if (isg) {
|
|
|
__data__=Bll.module.contentData.data[i].list;
|
|
|
}else{
|
|
|
__data__=Bll.module.contentData.data;
|
|
|
}
|
|
|
var drag = new common.drag(".imagegroup", __data__, function (data) {
|
|
|
if (isg) {
|
|
|
Bll.module.contentData.data[i].list=data;
|
|
|
Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;
|
|
|
Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;
|
|
|
}else{
|
|
|
Bll.module.contentData.data=data;
|
|
|
}
|
|
|
$parent.html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
|
|
|
datas: data
|
|
|
}));
|
|
|
});
|
|
|
drag.Initialize();
|
|
|
|
|
|
});
|
|
|
$(document).on("mouseleave", ".dragItem2", function () {
|
|
|
new common.drag(".imagegroup").destroy();
|
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
/******************************************其余界面部分**********************************/
|
...
|
...
|
@@ -887,9 +1253,9 @@ $(document).on("click", "#submit", function () { |
|
|
option.data.id = param[0];
|
|
|
}
|
|
|
option.data.minSortId = option.data.minSortId == "-1" ? "" : option.data.minSortId;
|
|
|
option.data.contentData =Bll.contentDatas.concat();
|
|
|
option.data.contentData=option.data.contentData.map(function (item, index) {
|
|
|
var item=$.extend(true,{},item),data=[];
|
|
|
option.data.contentData = Bll.contentDatas.concat();
|
|
|
option.data.contentData = option.data.contentData.map(function (item, index) {
|
|
|
var item = $.extend(true, {}, item), data = [];
|
|
|
if ({}.toString.call(item.contentData.data) == "[object Array]") {
|
|
|
item.contentData.data.forEach(function (item1) {
|
|
|
if (item1.src) {
|
...
|
...
|
@@ -900,24 +1266,24 @@ $(document).on("click", "#submit", function () { |
|
|
}
|
|
|
|
|
|
}
|
|
|
if (item1.list){
|
|
|
if({}.toString.call(item1.list) == "[object Array]"&&item1.list.length>0){
|
|
|
if (item1.list) {
|
|
|
if ({}.toString.call(item1.list) == "[object Array]" && item1.list.length > 0) {
|
|
|
if (item1.cover) {
|
|
|
item1.cover.cover = item1.cover.cover + imgsTem;
|
|
|
}
|
|
|
item1.list.map(function(item2){
|
|
|
item2.src=item2.src+imgsTem;
|
|
|
item1.list.map(function (item2) {
|
|
|
item2.src = item2.src + imgsTem;
|
|
|
return item2;
|
|
|
});
|
|
|
}else{
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
data.push(item1);
|
|
|
});
|
|
|
}
|
|
|
if(data.length!=0){
|
|
|
item.contentData.data=data;
|
|
|
if (data.length != 0) {
|
|
|
item.contentData.data = data;
|
|
|
}
|
|
|
|
|
|
item.contentData = common.util.__ArrayToObj(item.contentData);
|
...
|
...
|
|