Showing
1 changed file
with
19 additions
and
16 deletions
@@ -504,13 +504,15 @@ $(document).on("click", "#goodsSelectBtn", function () { | @@ -504,13 +504,15 @@ $(document).on("click", "#goodsSelectBtn", function () { | ||
504 | button: [{ | 504 | button: [{ |
505 | value: "确定", | 505 | value: "确定", |
506 | callback: function () { | 506 | callback: function () { |
507 | - Bll.module.contentData.data = goodsgird.selected.map(function (item, index) { | 507 | + var gs=goodsgird.selected.map(function (item, index) { |
508 | return { | 508 | return { |
509 | src: item.images_url, | 509 | src: item.images_url, |
510 | id: item.product_skn, | 510 | id: item.product_skn, |
511 | product_skc: item.product_skc | 511 | product_skc: item.product_skc |
512 | } | 512 | } |
513 | - }); | 513 | + }) |
514 | + Bll.module.contentData.data=Bll.module.contentData.data.concat(gs); | ||
515 | + Bll.module.contentData.data=Unique(Bll.module.contentData.data) | ||
514 | Bll.__render("#goodspic", "template_dialog_goodsimgs", { | 516 | Bll.__render("#goodspic", "template_dialog_goodsimgs", { |
515 | datas: Bll.module.contentData.data | 517 | datas: Bll.module.contentData.data |
516 | }); | 518 | }); |
@@ -539,20 +541,21 @@ $(document).on("click", ".goodsSelectBtn", function () { | @@ -539,20 +541,21 @@ $(document).on("click", ".goodsSelectBtn", function () { | ||
539 | button: [{ | 541 | button: [{ |
540 | value: "确定", | 542 | value: "确定", |
541 | callback: function () { | 543 | callback: function () { |
542 | - goodsgird.selected.forEach(function (item, i) { | ||
543 | - Bll.module.contentData.data[index].list[i] = { | ||
544 | - src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90' | ||
545 | - id: item.product_skn, | ||
546 | - product_skc: item.product_skc, | ||
547 | - maxSortId: item.max_sort_id | ||
548 | - }; | ||
549 | - if (!i) { | ||
550 | - Bll.module.contentData.data[index].cover = { | ||
551 | - cover: item.images_url, | 544 | + if(goodsgird.selected){ |
545 | + goodsgird.selected.forEach(function (item, i) { | ||
546 | + Bll.module.contentData.data[index].list.push({ | ||
547 | + src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90' | ||
548 | + id: item.product_skn, | ||
549 | + product_skc: item.product_skc, | ||
552 | maxSortId: item.max_sort_id | 550 | maxSortId: item.max_sort_id |
553 | - }; | ||
554 | - } | ||
555 | - }); | 551 | + }); |
552 | + }); | ||
553 | + Bll.module.contentData.data[index].list=Unique(Bll.module.contentData.data[index].list); | ||
554 | + Bll.module.contentData.data[index].cover = { | ||
555 | + cover: Bll.module.contentData.data[index].list[0].src, | ||
556 | + maxSortId: Bll.module.contentData.data[index].list[0].maxSortId | ||
557 | + }; | ||
558 | + } | ||
556 | Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module); | 559 | Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module); |
557 | }, | 560 | }, |
558 | css: "btn-primary" | 561 | css: "btn-primary" |
@@ -682,7 +685,7 @@ $(document).on("change", "#maxSortId", function () { | @@ -682,7 +685,7 @@ $(document).on("change", "#maxSortId", function () { | ||
682 | }); | 685 | }); |
683 | 686 | ||
684 | 687 | ||
685 | -var Unique = function(Array) { | 688 | +function Unique(Array) { |
686 | var res = [], hash = {}; | 689 | var res = [], hash = {}; |
687 | for(var i=0, elem; (elem = Array[i]) != null; i++) { | 690 | for(var i=0, elem; (elem = Array[i]) != null; i++) { |
688 | if (!hash[elem.id]) | 691 | if (!hash[elem.id]) |
-
Please register or login to post a comment