...
|
...
|
@@ -190,6 +190,24 @@ for(var i = 0; i < resources.length; i++) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 过滤函数
|
|
|
* @param Array
|
|
|
* @param key
|
|
|
* @returns {Array}
|
|
|
* @constructor
|
|
|
*/
|
|
|
function Unique(Array,key) {
|
|
|
var res = [], hash = {};
|
|
|
for (var i = 0, elem; (elem = Array[i]) != null; i++) {
|
|
|
if (!hash[elem[key]]) {
|
|
|
res.push(elem);
|
|
|
hash[elem[key]] = true;
|
|
|
}
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/*第一步,基础模板*/
|
|
|
Bll.__render("#content-list", "content-template", resources[currIndex]);
|
|
|
Bll.__render(".contents", "template_content_btns", {btns: Button});
|
...
|
...
|
@@ -541,6 +559,7 @@ var addSuffix = function (contentData) { |
|
|
/*选择商品表格*/
|
|
|
var goodsgird = new common.grid({
|
|
|
el: '#goodsgird',
|
|
|
hash:false,
|
|
|
parms: function () {
|
|
|
var beginPrice = 0, endPrice = 1000000;
|
|
|
if (common.util.__input('beginPrice')) {
|
...
|
...
|
@@ -596,10 +615,6 @@ var goodsgird = new common.grid({ |
|
|
});
|
|
|
//搜索按钮
|
|
|
$(document).on("click", "#search", function () {
|
|
|
if($.trim($("#skns").val()).length<5){
|
|
|
common.util.__tip("请输入超过5个字符后再搜索","warning");
|
|
|
return;
|
|
|
}
|
|
|
if(goodsgird.grid){
|
|
|
goodsgird.reload(1);
|
|
|
}else{
|
...
|
...
|
@@ -615,13 +630,16 @@ $(document).on("click", "#goodsSelectBtn", function () { |
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function () {
|
|
|
Bll.module.contentData.data = goodsgird.selected.map(function (item, index) {
|
|
|
var gs=goodsgird.selected.map(function (item, index) {
|
|
|
return {
|
|
|
src: item.images_url,
|
|
|
id: item.product_skn
|
|
|
id: item.product_skn,
|
|
|
product_skc: item.product_skc
|
|
|
}
|
|
|
});
|
|
|
// Bll.module.data=goodsgird.selected;
|
|
|
})
|
|
|
Bll.module.contentData.data=Bll.module.contentData.data.concat(gs);
|
|
|
Bll.module.contentData.data=Unique(Bll.module.contentData.data,"product_skc")
|
|
|
console.log(Bll.module.contentData);
|
|
|
Bll.__render("#goodspic", "template_dialog_goodsimgs", {
|
|
|
datas: Bll.module.contentData.data
|
|
|
});
|
...
|
...
|
@@ -634,7 +652,7 @@ $(document).on("click", "#goodsSelectBtn", function () { |
|
|
});
|
|
|
//点击“添加组”按钮(添加商品组)
|
|
|
$(document).on("click", "#goodsaddBtn", function () {
|
|
|
var item = $.extend(true, {}, Button[5].data[0]);
|
|
|
var item = $.extend(true, {}, Button[4].data[0]);
|
|
|
if (Bll.module.contentData.data[0].list.length) {
|
|
|
Bll.module.contentData.data.push(item);
|
|
|
}
|
...
|
...
|
@@ -650,24 +668,33 @@ $(document).on("click", ".goodsSelectBtn", function () { |
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function () {
|
|
|
goodsgird.selected.forEach(function (item, i) {
|
|
|
Bll.module.contentData.data[index].list[i] = {
|
|
|
src: item.images_url,
|
|
|
id: item.product_skn,
|
|
|
maxSortId: item.max_sort_id
|
|
|
};
|
|
|
if (!i) {
|
|
|
Bll.module.contentData.data[index].cover = {
|
|
|
cover: item.images_url,
|
|
|
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=[];
|
|
|
}
|
|
|
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'
|
|
|
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].cover = {
|
|
|
cover: Bll.module.contentData.data[index].list[0].src,
|
|
|
maxSortId: Bll.module.contentData.data[index].list[0].maxSortId
|
|
|
};
|
|
|
}
|
|
|
console.log(Bll.module.contentData);
|
|
|
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
//goodsgird.init('/yohosearch/search');
|
|
|
goodsgird.grid=null;
|
|
|
});
|
|
|
//删除图片按钮
|
...
|
...
|
|