Authored by weiqingting

资源位

@@ -375,6 +375,7 @@ $(document).on("mouseleave", ".dragItem1", function () { @@ -375,6 +375,7 @@ $(document).on("mouseleave", ".dragItem1", function () {
375 */ 375 */
376 var g = new common.grid({ 376 var g = new common.grid({
377 el: "#gird", 377 el: "#gird",
  378 + hash:false,
378 columns: [{ 379 columns: [{
379 display: "选择", 380 display: "选择",
380 "type": "checkbox" 381 "type": "checkbox"
@@ -529,6 +530,7 @@ $(document).on("keyup", "#brandsearch", function () { @@ -529,6 +530,7 @@ $(document).on("keyup", "#brandsearch", function () {
529 /*选择商品表格*/ 530 /*选择商品表格*/
530 var goodsgird = new common.grid({ 531 var goodsgird = new common.grid({
531 el: '#goodsgird', 532 el: '#goodsgird',
  533 + hash:false,
532 parms: function () { 534 parms: function () {
533 var price = ""; 535 var price = "";
534 if (common.util.__input('beginPrice')&&common.util.__input('endPrice')) { 536 if (common.util.__input('beginPrice')&&common.util.__input('endPrice')) {
@@ -190,6 +190,24 @@ for(var i = 0; i < resources.length; i++) { @@ -190,6 +190,24 @@ for(var i = 0; i < resources.length; i++) {
190 } 190 }
191 } 191 }
192 192
  193 +/**
  194 + * 过滤函数
  195 + * @param Array
  196 + * @param key
  197 + * @returns {Array}
  198 + * @constructor
  199 + */
  200 +function Unique(Array,key) {
  201 + var res = [], hash = {};
  202 + for (var i = 0, elem; (elem = Array[i]) != null; i++) {
  203 + if (!hash[elem[key]]) {
  204 + res.push(elem);
  205 + hash[elem[key]] = true;
  206 + }
  207 + }
  208 + return res;
  209 +}
  210 +
193 /*第一步,基础模板*/ 211 /*第一步,基础模板*/
194 Bll.__render("#content-list", "content-template", resources[currIndex]); 212 Bll.__render("#content-list", "content-template", resources[currIndex]);
195 Bll.__render(".contents", "template_content_btns", {btns: Button}); 213 Bll.__render(".contents", "template_content_btns", {btns: Button});
@@ -541,6 +559,7 @@ var addSuffix = function (contentData) { @@ -541,6 +559,7 @@ var addSuffix = function (contentData) {
541 /*选择商品表格*/ 559 /*选择商品表格*/
542 var goodsgird = new common.grid({ 560 var goodsgird = new common.grid({
543 el: '#goodsgird', 561 el: '#goodsgird',
  562 + hash:false,
544 parms: function () { 563 parms: function () {
545 var beginPrice = 0, endPrice = 1000000; 564 var beginPrice = 0, endPrice = 1000000;
546 if (common.util.__input('beginPrice')) { 565 if (common.util.__input('beginPrice')) {
@@ -596,10 +615,6 @@ var goodsgird = new common.grid({ @@ -596,10 +615,6 @@ var goodsgird = new common.grid({
596 }); 615 });
597 //搜索按钮 616 //搜索按钮
598 $(document).on("click", "#search", function () { 617 $(document).on("click", "#search", function () {
599 - if($.trim($("#skns").val()).length<5){  
600 - common.util.__tip("请输入超过5个字符后再搜索","warning");  
601 - return;  
602 - }  
603 if(goodsgird.grid){ 618 if(goodsgird.grid){
604 goodsgird.reload(1); 619 goodsgird.reload(1);
605 }else{ 620 }else{
@@ -615,13 +630,16 @@ $(document).on("click", "#goodsSelectBtn", function () { @@ -615,13 +630,16 @@ $(document).on("click", "#goodsSelectBtn", function () {
615 button: [{ 630 button: [{
616 value: "确定", 631 value: "确定",
617 callback: function () { 632 callback: function () {
618 - Bll.module.contentData.data = goodsgird.selected.map(function (item, index) { 633 + var gs=goodsgird.selected.map(function (item, index) {
619 return { 634 return {
620 src: item.images_url, 635 src: item.images_url,
621 - id: item.product_skn 636 + id: item.product_skn,
  637 + product_skc: item.product_skc
622 } 638 }
623 - });  
624 - // Bll.module.data=goodsgird.selected; 639 + })
  640 + Bll.module.contentData.data=Bll.module.contentData.data.concat(gs);
  641 + Bll.module.contentData.data=Unique(Bll.module.contentData.data,"product_skc")
  642 + console.log(Bll.module.contentData);
625 Bll.__render("#goodspic", "template_dialog_goodsimgs", { 643 Bll.__render("#goodspic", "template_dialog_goodsimgs", {
626 datas: Bll.module.contentData.data 644 datas: Bll.module.contentData.data
627 }); 645 });
@@ -634,7 +652,7 @@ $(document).on("click", "#goodsSelectBtn", function () { @@ -634,7 +652,7 @@ $(document).on("click", "#goodsSelectBtn", function () {
634 }); 652 });
635 //点击“添加组”按钮(添加商品组) 653 //点击“添加组”按钮(添加商品组)
636 $(document).on("click", "#goodsaddBtn", function () { 654 $(document).on("click", "#goodsaddBtn", function () {
637 - var item = $.extend(true, {}, Button[5].data[0]); 655 + var item = $.extend(true, {}, Button[4].data[0]);
638 if (Bll.module.contentData.data[0].list.length) { 656 if (Bll.module.contentData.data[0].list.length) {
639 Bll.module.contentData.data.push(item); 657 Bll.module.contentData.data.push(item);
640 } 658 }
@@ -650,24 +668,33 @@ $(document).on("click", ".goodsSelectBtn", function () { @@ -650,24 +668,33 @@ $(document).on("click", ".goodsSelectBtn", function () {
650 button: [{ 668 button: [{
651 value: "确定", 669 value: "确定",
652 callback: function () { 670 callback: function () {
653 - goodsgird.selected.forEach(function (item, i) {  
654 - Bll.module.contentData.data[index].list[i] = {  
655 - src: item.images_url,  
656 - id: item.product_skn,  
657 - maxSortId: item.max_sort_id  
658 - };  
659 - if (!i) {  
660 - Bll.module.contentData.data[index].cover = {  
661 - cover: item.images_url, 671 + if(goodsgird.selected){
  672 + goodsgird.selected.forEach(function (item, i) {
  673 + if(Object.prototype.toString.call(Bll.module.contentData.data[index].list)!=="[object Array]"){
  674 + Bll.module.contentData.data[index].list=[];
  675 + }
  676 + Bll.module.contentData.data[index].list.push({
  677 + src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90'
  678 + id: item.product_skn,
  679 + product_skc: item.product_skc,
662 maxSortId: item.max_sort_id 680 maxSortId: item.max_sort_id
663 - };  
664 - }  
665 - }); 681 + });
  682 + });
  683 +
  684 + Bll.module.contentData.data[index].list=Unique(Bll.module.contentData.data[index].list,"product_skc");
  685 +
  686 + Bll.module.contentData.data[index].cover = {
  687 + cover: Bll.module.contentData.data[index].list[0].src,
  688 + maxSortId: Bll.module.contentData.data[index].list[0].maxSortId
  689 + };
  690 + }
  691 + console.log(Bll.module.contentData);
666 Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module); 692 Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
667 }, 693 },
668 css: "btn-primary" 694 css: "btn-primary"
669 }] 695 }]
670 }); 696 });
  697 + //goodsgird.init('/yohosearch/search');
671 goodsgird.grid=null; 698 goodsgird.grid=null;
672 }); 699 });
673 //删除图片按钮 700 //删除图片按钮
@@ -22,10 +22,10 @@ var config = { @@ -22,10 +22,10 @@ var config = {
22 // domain: 'http://172.16.6.146:8088/platform', //玛丽 22 // domain: 'http://172.16.6.146:8088/platform', //玛丽
23 //domain:'http://172.16.6.157:8080/yohobuy-platform-web',//葛超 23 //domain:'http://172.16.6.157:8080/yohobuy-platform-web',//葛超
24 // domain: 'http://192.168.102.216:8086/platform', 24 // domain: 'http://192.168.102.216:8086/platform',
25 - domain: 'http://192.168.102.202:8088/platform', 25 + // domain: 'http://192.168.102.202:8088/platform',
26 //domain: 'http://172.16.6.146:8088/platform', 26 //domain: 'http://172.16.6.146:8088/platform',
27 //domain:'http://172.16.6.120:8088/platform',//曹艳 27 //domain:'http://172.16.6.120:8088/platform',//曹艳
28 - //domain:'http://172.16.6.231:8080/platform',//王伟 28 + domain:'http://172.16.6.225:8080/platform',//王伟
29 //domain: 'http://172.16.6.239:8080', //孙杰翔 29 //domain: 'http://172.16.6.239:8080', //孙杰翔
30 //domain:'http://172.16.6.189:8088/platform', //李健1 30 //domain:'http://172.16.6.189:8088/platform', //李健1
31 //domain:'http://192.168.102.216:8180/platform', //李健2 31 //domain:'http://192.168.102.216:8180/platform', //李健2