Authored by weiqingting

商品重复解决

... ... @@ -504,13 +504,15 @@ $(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,
product_skc: item.product_skc
}
});
})
Bll.module.contentData.data=Bll.module.contentData.data.concat(gs);
Bll.module.contentData.data=Unique(Bll.module.contentData.data)
Bll.__render("#goodspic", "template_dialog_goodsimgs", {
datas: Bll.module.contentData.data
});
... ... @@ -539,20 +541,21 @@ $(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,//+'?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
};
if (!i) {
Bll.module.contentData.data[index].cover = {
cover: item.images_url,
if(goodsgird.selected){
goodsgird.selected.forEach(function (item, i) {
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);
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);
},
css: "btn-primary"
... ... @@ -682,7 +685,7 @@ $(document).on("change", "#maxSortId", function () {
});
var Unique = function(Array) {
function Unique(Array) {
var res = [], hash = {};
for(var i=0, elem; (elem = Array[i]) != null; i++) {
if (!hash[elem.id])
... ...