Authored by weiqingting

Merge branch 'release/qqtest' of http://git.dev.yoho.cn/platform/yohobuy-portal-…

…fe into release/qqtest
@@ -6,9 +6,8 @@ require('../common/zh-cn'); @@ -6,9 +6,8 @@ require('../common/zh-cn');
6 6
7 var baidu; 7 var baidu;
8 8
9 -  
10 /*获取数据ViewModel*/ 9 /*获取数据ViewModel*/
11 -var ViewModel = {articleGender:"3"}; 10 +var ViewModel = {articleGender: "3"};
12 var param = location.href.slice(location.href.indexOf("contentEdit")).match(/\/\d+/g); 11 var param = location.href.slice(location.href.indexOf("contentEdit")).match(/\/\d+/g);
13 if (param && param.length == 1) { 12 if (param && param.length == 1) {
14 param[0] = param[0].replace(/\//, ''); 13 param[0] = param[0].replace(/\//, '');
@@ -22,11 +21,16 @@ if (param && param.length == 1) { @@ -22,11 +21,16 @@ if (param && param.length == 1) {
22 ViewModel = res.data; 21 ViewModel = res.data;
23 }, true); 22 }, true);
24 } 23 }
25 - 24 +/**
  25 + * 验证
  26 + * @type {common.components}
  27 + */
26 var components = new common.components(".modal-body", { 28 var components = new common.components(".modal-body", {
27 bucket: "goodsimg" 29 bucket: "goodsimg"
28 }); 30 });
29 - 31 +/**
  32 + * 通用
  33 + */
30 var Bll = { 34 var Bll = {
31 d: null, 35 d: null,
32 moduleimgs: [], 36 moduleimgs: [],
@@ -36,24 +40,24 @@ var Bll = { @@ -36,24 +40,24 @@ var Bll = {
36 getBrands: function () { 40 getBrands: function () {
37 var Brand = {}; 41 var Brand = {};
38 $.get("/ajax/yohosearch", function (res) { 42 $.get("/ajax/yohosearch", function (res) {
39 - if(!res.data||!res.data.brands){ 43 + if (!res.data || !res.data.brands) {
40 return; 44 return;
41 } 45 }
42 - for(var key in res.data.brands){  
43 - var name=key;  
44 - if (/^[0-9]$/.test(name)) {  
45 - name = "0-9";  
46 - }  
47 - if (name==="") {  
48 - name = "#";  
49 - }  
50 - for(var key2 in res.data.brands[key]){  
51 - var item=res.data.brands[key][key2];  
52 - Brand[name] = Brand[name] || [];  
53 - Brand[name].push(item);  
54 - Bll.Brands1[item.id] = item;  
55 - }  
56 - } 46 + for (var key in res.data.brands) {
  47 + var name = key;
  48 + if (/^[0-9]$/.test(name)) {
  49 + name = "0-9";
  50 + }
  51 + if (name === "") {
  52 + name = "#";
  53 + }
  54 + for (var key2 in res.data.brands[key]) {
  55 + var item = res.data.brands[key][key2];
  56 + Brand[name] = Brand[name] || [];
  57 + Brand[name].push(item);
  58 + Bll.Brands1[item.id] = item;
  59 + }
  60 + }
57 for (var i in Brand) { 61 for (var i in Brand) {
58 Brand[i].sort(function (a, b) { 62 Brand[i].sort(function (a, b) {
59 var aName = a.brand_name.toLowerCase(), 63 var aName = a.brand_name.toLowerCase(),
@@ -78,7 +82,6 @@ var Bll = { @@ -78,7 +82,6 @@ var Bll = {
78 for (var key in map2) { 82 for (var key in map2) {
79 Brdata.push(map2[key]); 83 Brdata.push(map2[key]);
80 } 84 }
81 -  
82 var Brands2 = []; 85 var Brands2 = [];
83 Brdata.forEach(function (item, index) { 86 Brdata.forEach(function (item, index) {
84 if (!item.brandIco) { 87 if (!item.brandIco) {
@@ -100,24 +103,24 @@ var Bll = { @@ -100,24 +103,24 @@ var Bll = {
100 contentDatas: [], 103 contentDatas: [],
101 module: null, 104 module: null,
102 toast: function (index, module) { 105 toast: function (index, module) {
103 - if (!module.contentData.dialog||!module.contentData.template_intro) { 106 + if (!module.contentData.dialog || !module.contentData.template_intro) {
104 Button.forEach(function (item, index) { 107 Button.forEach(function (item, index) {
105 if (module.contentData.template_name == item.template_name) { 108 if (module.contentData.template_name == item.template_name) {
106 module.contentData.dialog = item.dialog; 109 module.contentData.dialog = item.dialog;
107 - module.contentData.template_intro=item.template_intro; 110 + module.contentData.template_intro = item.template_intro;
108 return; 111 return;
109 } 112 }
110 }); 113 });
111 } 114 }
112 Bll.d = new common.dialog({ 115 Bll.d = new common.dialog({
113 - title: (!!~index ? "修改" : "添加") + module.contentData.template_intro.replace("添加",''), 116 + title: (!!~index ? "修改" : "添加") + module.contentData.template_intro.replace("添加", ''),
114 content: common.util.__template2($("#" + module.contentData.dialog).html(), module), 117 content: common.util.__template2($("#" + module.contentData.dialog).html(), module),
115 width: '70%', 118 width: '70%',
116 button: [{ 119 button: [{
117 value: "保存", 120 value: "保存",
118 callback: function () { 121 callback: function () {
119 - if(module.contentData.dialog=="template_dialog_text"){  
120 - module.contentData.data.text=baidu.getContent(); 122 + if (module.contentData.dialog == "template_dialog_text") {
  123 + module.contentData.data.text = baidu.getContent();
121 } 124 }
122 if (components.validate()) { 125 if (components.validate()) {
123 //TODO 126 //TODO
@@ -131,13 +134,11 @@ var Bll = { @@ -131,13 +134,11 @@ var Bll = {
131 }] 134 }]
132 }); 135 });
133 Bll.__editRender(); 136 Bll.__editRender();
134 - if(module.contentData.dialog=="template_dialog_text"){  
135 - baidu&&baidu.destroy();  
136 - baidu=UM.getEditor('baidueditor'); 137 + if (module.contentData.dialog == "template_dialog_text") {
  138 + baidu && baidu.destroy();
  139 + baidu = UM.getEditor('baidueditor');
137 baidu.setContent(module.contentData.data.text); 140 baidu.setContent(module.contentData.data.text);
138 - }  
139 -  
140 - 141 + }
141 }, 142 },
142 renderDialog: function (templater) { 143 renderDialog: function (templater) {
143 Bll.__render(".modal-body", templater, Bll.module); 144 Bll.__render(".modal-body", templater, Bll.module);
@@ -150,23 +151,6 @@ var Bll = { @@ -150,23 +151,6 @@ var Bll = {
150 Bll.module.contentData.data = common.util.__buildobj(names, '.', Bll.module.contentData.data, function (o, name) { 151 Bll.module.contentData.data = common.util.__buildobj(names, '.', Bll.module.contentData.data, function (o, name) {
151 o[name] = obj.data; 152 o[name] = obj.data;
152 }); 153 });
153 -  
154 - // var names=obj.field;  
155 - // if(obj.datas.length>0){  
156 - // for(var i in obj.datas){  
157 - // names=names.replace(/^\d+/,i);  
158 - // if(i>0){  
159 - // Bll.module.contentData.data.push(Bll.module.contentData.data[0]);  
160 - // }  
161 - // Bll.module.contentData.data=common.util.__buildobj(names, '.', Bll.module.contentData.data, function(o, name) {  
162 - // o[name] = obj.data;  
163 - // });  
164 - // }  
165 -  
166 - // }  
167 - // console.log("Bll.module.contentData.data",Bll.module.contentData.data);  
168 - // Bll.renderDialog(Bll.module.contentData.dialog);  
169 -  
170 }); 154 });
171 }, 155 },
172 rendContent: function () { 156 rendContent: function () {
@@ -176,8 +160,6 @@ var Bll = { @@ -176,8 +160,6 @@ var Bll = {
176 }, 160 },
177 __render: function (selecter, templater, data) { 161 __render: function (selecter, templater, data) {
178 $(selecter).html(common.util.__template2($("#" + templater).html(), data)); 162 $(selecter).html(common.util.__template2($("#" + templater).html(), data));
179 -  
180 -  
181 }, 163 },
182 Tags: [] 164 Tags: []
183 }; 165 };
@@ -193,21 +175,18 @@ Bll.renderBrandPic(Bll.Brdata); @@ -193,21 +175,18 @@ Bll.renderBrandPic(Bll.Brdata);
193 /*渲染标签*/ 175 /*渲染标签*/
194 Bll.Tags = ViewModel.tag ? ViewModel.tag.split(',') : []; 176 Bll.Tags = ViewModel.tag ? ViewModel.tag.split(',') : [];
195 Bll.__render("#taglist", "template4", {tags: Bll.Tags}); 177 Bll.__render("#taglist", "template4", {tags: Bll.Tags});
196 -/*内容渲染->对象转数组*/  
197 -// Bll.contentDatas=ENUM.articleContent;  
198 178
199 if (ViewModel.articleContent) { 179 if (ViewModel.articleContent) {
200 ViewModel.articleContent.forEach(function (item, index) { 180 ViewModel.articleContent.forEach(function (item, index) {
201 item.contentData = item.contentData.replace(/(gif|png|jpg|jpeg)\?[^"]*/g, '$1'); 181 item.contentData = item.contentData.replace(/(gif|png|jpg|jpeg)\?[^"]*/g, '$1');
202 item.contentData = common.util.__ObjToArray(JSON.parse(item.contentData)); 182 item.contentData = common.util.__ObjToArray(JSON.parse(item.contentData));
203 - console.log(item); 183 + //console.log(item);
204 Bll.contentDatas.push(item); 184 Bll.contentDatas.push(item);
205 }); 185 });
206 } 186 }
207 /*第三部解析楼层*/ 187 /*第三部解析楼层*/
208 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas}); 188 Bll.__render("#add-content", "template_content", {modules: Bll.contentDatas});
209 189
210 -  
211 new common.dropDown({ 190 new common.dropDown({
212 el: "#authorId", 191 el: "#authorId",
213 ajax: "guangGetAuthorList" 192 ajax: "guangGetAuthorList"
@@ -272,7 +251,6 @@ $(document).on("click", ".tag a", function () { @@ -272,7 +251,6 @@ $(document).on("click", ".tag a", function () {
272 }); 251 });
273 252
274 $(document).on("click", "#addBrands", function () { 253 $(document).on("click", "#addBrands", function () {
275 - ///goods/brands/queryBrandsByStatus  
276 var e = new common.edit("#brandForm"); 254 var e = new common.edit("#brandForm");
277 common.dialog.confirm("选择品牌", common.util.__template2($("#template5").html(), { 255 common.dialog.confirm("选择品牌", common.util.__template2($("#template5").html(), {
278 Brands: Bll.Brands, 256 Brands: Bll.Brands,
@@ -353,12 +331,7 @@ var Button = [ @@ -353,12 +331,7 @@ var Button = [
353 template_intro: "添加商品", 331 template_intro: "添加商品",
354 dialog: "template_dialog_goods", 332 dialog: "template_dialog_goods",
355 template_name: "goods", 333 template_name: "goods",
356 - data: [  
357 - // {  
358 - // src:"",  
359 - // id:""  
360 - // }  
361 - ] 334 + data: []
362 }, 335 },
363 { 336 {
364 template_intro: "推荐商品组", 337 template_intro: "推荐商品组",
@@ -369,13 +342,7 @@ var Button = [ @@ -369,13 +342,7 @@ var Button = [
369 cover: "", 342 cover: "",
370 maxSortId: "" 343 maxSortId: ""
371 }, 344 },
372 - list: [  
373 - // {  
374 - // src:"",  
375 - // id:"",  
376 - // maxSortId:""  
377 - // }  
378 - ] 345 + list: []
379 }] 346 }]
380 }, 347 },
381 { 348 {
@@ -394,7 +361,6 @@ $("#content_btns").html(common.util.__template2($("#template_content_btns").html @@ -394,7 +361,6 @@ $("#content_btns").html(common.util.__template2($("#template_content_btns").html
394 btns: Button 361 btns: Button
395 })); 362 }));
396 363
397 -  
398 $(document).on("click", ".add_btn", function () { 364 $(document).on("click", ".add_btn", function () {
399 var item = Button[$(this).data("index")]; 365 var item = Button[$(this).data("index")];
400 Bll.module = {templateKey: item.template_name}; 366 Bll.module = {templateKey: item.template_name};
@@ -424,181 +390,10 @@ $(document).on("click", ".edit", function () { @@ -424,181 +390,10 @@ $(document).on("click", ".edit", function () {
424 Bll.toast(index, Bll.module); 390 Bll.toast(index, Bll.module);
425 }); 391 });
426 392
427 -$(document).on("dblclick","#add-content>li.custom-group",function(){ 393 +$(document).on("dblclick", "#add-content>li.custom-group", function () {
428 $(this).find(".edit").click(); 394 $(this).find(".edit").click();
429 }); 395 });
430 396
431 -/*选择商品表格*/  
432 -var goodsgird = new common.grid({  
433 - el: '#goodsgird',  
434 - parms: function () {  
435 - var price = "";  
436 - if (common.util.__input('beginPrice')&&common.util.__input('endPrice')) {  
437 - price = common.util.__input('beginPrice')+","+common.util.__input('endPrice');  
438 - }  
439 - return {  
440 - status:1,  
441 - sales:"Y",  
442 - stocknumber:"1",  
443 - attribute_not:"2",  
444 - query: common.util.__input('skns'),  
445 - price: price  
446 - };  
447 - },  
448 - columns: [  
449 - {  
450 - display: "选择",  
451 - type: "checkbox"  
452 - }, {  
453 - display: "产品图片",  
454 - render: function (item) {  
455 - console.log("item",item);  
456 - if (item.images_url) {  
457 - item.images_url = common.util.__joinImg("goodsimg", item.images_url);  
458 - }  
459 - else {  
460 - if(item.default_images){  
461 - item.images_url = common.util.__joinImg("goodsimg", item.default_images);  
462 - }  
463 - else{  
464 - item.images_url=""  
465 - }  
466 - }  
467 - if(item.images_url){  
468 - return "<img width=120 height=60 src='" + item.images_url + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90'/>";  
469 - }else{  
470 - return "";  
471 - }  
472 -  
473 - }  
474 - }, {  
475 - display: "产品名称",  
476 - name: "product_name"  
477 - }, {  
478 - display: "品牌",  
479 - name: "brand_name"  
480 - }, {  
481 - display: "现价",  
482 - name: "sales_price"  
483 - }, {  
484 - display: "吊牌价",  
485 - name: "market_price"  
486 - }, {  
487 - display: "预售",  
488 - name: "stock_number"  
489 - }, {  
490 - display: "库存",  
491 - name: "storage_num"  
492 - }]  
493 -});  
494 -//搜索按钮  
495 -$(document).on("click", "#search", function () {  
496 - if($.trim($("#skns").val()).length<5){  
497 - common.util.__tip("请输入超过5个字符后再搜索","warning");  
498 - return;  
499 - }  
500 - if(goodsgird.grid){  
501 - goodsgird.reload(1);  
502 - }else{  
503 - goodsgird.init('/yohosearch/search');  
504 - }  
505 -});  
506 -//点击“选择标签”按钮(添加商品)  
507 -$(document).on("click", "#goodsSelectBtn", function () {  
508 - new common.dialog({  
509 - title: "选择商品",  
510 - content: $("#template_dialog_goodsgird").html(),  
511 - width: '80%',  
512 - button: [{  
513 - value: "确定",  
514 - callback: function () {  
515 - var gs=goodsgird.selected.map(function (item, index) {  
516 - return {  
517 - src: item.images_url,  
518 - id: item.product_skn,  
519 - product_skc: item.product_skc  
520 - }  
521 - })  
522 - Bll.module.contentData.data=Bll.module.contentData.data.concat(gs);  
523 - Bll.module.contentData.data=Unique(Bll.module.contentData.data)  
524 - Bll.__render("#goodspic", "template_dialog_goodsimgs", {  
525 - datas: Bll.module.contentData.data  
526 - });  
527 - },  
528 - css: "btn-primary"  
529 - }]  
530 - });  
531 - goodsgird.grid=null;  
532 - //goodsgird.init('/yohosearch/search');  
533 -});  
534 -//点击“添加组”按钮(添加商品组)  
535 -$(document).on("click", "#goodsaddBtn", function () {  
536 - var item = $.extend(true, {}, Button[4].data[0]);  
537 - if (Bll.module.contentData.data[0].list.length) {  
538 - Bll.module.contentData.data.push(item);  
539 - }  
540 - Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);  
541 -});  
542 -//点击“选择标签”按钮(添加商品组)  
543 -$(document).on("click", ".goodsSelectBtn", function () {  
544 - var index = $(this).data("index");  
545 - new common.dialog({  
546 - title: "选择商品",  
547 - content: $("#template_dialog_goodsgird").html(),  
548 - width: '80%',  
549 - button: [{  
550 - value: "确定",  
551 - callback: function () {  
552 - if(goodsgird.selected){  
553 - goodsgird.selected.forEach(function (item, i) {  
554 - Bll.module.contentData.data[index].list.push({  
555 - src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90'  
556 - id: item.product_skn,  
557 - product_skc: item.product_skc,  
558 - maxSortId: item.max_sort_id  
559 - });  
560 - });  
561 - Bll.module.contentData.data[index].list=Unique(Bll.module.contentData.data[index].list);  
562 - Bll.module.contentData.data[index].cover = {  
563 - cover: Bll.module.contentData.data[index].list[0].src,  
564 - maxSortId: Bll.module.contentData.data[index].list[0].maxSortId  
565 - };  
566 - }  
567 - Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);  
568 - },  
569 - css: "btn-primary"  
570 - }]  
571 - });  
572 - //goodsgird.init('/yohosearch/search');  
573 - goodsgird.grid=null;  
574 -});  
575 -//删除图片按钮  
576 -$(document).on("click", ".removepic", function () {  
577 - var $parent = $(this).parents("ul.imagegroup");  
578 - var i = $parent.data("i");//组标志  
579 - var isg = typeof(i) === "number" ? true : false;  
580 - //推荐商品组  
581 - if (isg) {  
582 - Bll.module.contentData.data[i].list.splice($(this).data("index"), 1);  
583 - Bll.module.contentData.data[i].cover = {};  
584 - if (Bll.module.contentData.data[i].list.length == 0) {  
585 - Bll.module.contentData.data[i].cover.cover = "";  
586 - Bll.module.contentData.data[i].cover.maxSortId = "";  
587 - }  
588 - else {  
589 - Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;  
590 - Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;  
591 - }  
592 - }  
593 - //商品  
594 - else {  
595 - Bll.module.contentData.data.splice($(this).data("index"), 1);  
596 - }  
597 - $parent.html(common.util.__template2($("#template_dialog_goodsimgs").html(), {  
598 - datas: isg ? Bll.module.contentData.data[i].list : Bll.module.contentData.data  
599 - }));  
600 -});  
601 -  
602 397
603 /********************************/ 398 /********************************/
604 var e = new common.edit("#panel-body", { 399 var e = new common.edit("#panel-body", {
@@ -610,7 +405,7 @@ e.on("validate", function () { @@ -610,7 +405,7 @@ e.on("validate", function () {
610 return "链接和内容不能同时为空"; 405 return "链接和内容不能同时为空";
611 } 406 }
612 }); 407 });
613 -var imgsTem="?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"; 408 +var imgsTem = "?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90";
614 $(document).on("click", "#submit", function () { 409 $(document).on("click", "#submit", function () {
615 e.submit($("#panel-body").attr("action"), function (option) { 410 e.submit($("#panel-body").attr("action"), function (option) {
616 if (param && param.length == 1) { 411 if (param && param.length == 1) {
@@ -618,15 +413,15 @@ $(document).on("click", "#submit", function () { @@ -618,15 +413,15 @@ $(document).on("click", "#submit", function () {
618 } 413 }
619 option.data.minSortId = option.data.minSortId == "-1" ? "" : option.data.minSortId; 414 option.data.minSortId = option.data.minSortId == "-1" ? "" : option.data.minSortId;
620 415
621 - option.data.contentData =Bll.contentDatas.concat();  
622 - option.data.contentData=option.data.contentData.map(function (item, index) {  
623 - var item=$.extend(true,{},item); 416 + option.data.contentData = Bll.contentDatas.concat();
  417 + option.data.contentData = option.data.contentData.map(function (item, index) {
  418 + var item = $.extend(true, {}, item);
624 if ({}.toString.call(item.contentData.data) == "[object Array]") { 419 if ({}.toString.call(item.contentData.data) == "[object Array]") {
625 item.contentData.data.map(function (item1) { 420 item.contentData.data.map(function (item1) {
626 if (item1.src) { 421 if (item1.src) {
627 - if(item.contentData.template_name==="goods"){ 422 + if (item.contentData.template_name === "goods") {
628 item1.src = item1.src + imgsTem; 423 item1.src = item1.src + imgsTem;
629 - }else{ 424 + } else {
630 item1.src = item1.src + "?imageView/{mode}/w/{width}/h/{height}"; 425 item1.src = item1.src + "?imageView/{mode}/w/{width}/h/{height}";
631 } 426 }
632 427
@@ -634,9 +429,9 @@ $(document).on("click", "#submit", function () { @@ -634,9 +429,9 @@ $(document).on("click", "#submit", function () {
634 if (item1.cover) { 429 if (item1.cover) {
635 item1.cover.cover = item1.cover.cover + imgsTem; 430 item1.cover.cover = item1.cover.cover + imgsTem;
636 } 431 }
637 - if (item1.list&&{}.toString.call(item1.list) == "[object Array]"){  
638 - item1.list.map(function(item2){  
639 - item2.src=item2.src+imgsTem; 432 + if (item1.list && {}.toString.call(item1.list) == "[object Array]") {
  433 + item1.list.map(function (item2) {
  434 + item2.src = item2.src + imgsTem;
640 return item2; 435 return item2;
641 }); 436 });
642 } 437 }
@@ -657,14 +452,14 @@ $(document).on("click", "#submit", function () { @@ -657,14 +452,14 @@ $(document).on("click", "#submit", function () {
657 res = res.data; 452 res = res.data;
658 if (res.code == "200") { 453 if (res.code == "200") {
659 e.$tip("提交成功", function () { 454 e.$tip("提交成功", function () {
660 - location.href="/guang/article/index"; 455 + location.href = "/guang/article/index";
661 }, 'growl-success'); 456 }, 'growl-success');
662 } else { 457 } else {
663 e.$tip(res.message); 458 e.$tip(res.message);
664 } 459 }
665 }, 460 },
666 option.error = function (res) { 461 option.error = function (res) {
667 - e.$tip(res.message||"接口异常报错"); 462 + e.$tip(res.message || "接口异常报错");
668 } 463 }
669 }); 464 });
670 }); 465 });
@@ -692,19 +487,19 @@ $(document).on("change", "#maxSortId", function () { @@ -692,19 +487,19 @@ $(document).on("change", "#maxSortId", function () {
692 }); 487 });
693 }); 488 });
694 489
695 -  
696 function Unique(Array) { 490 function Unique(Array) {
697 var res = [], hash = {}; 491 var res = [], hash = {};
698 - for(var i=0, elem; (elem = Array[i]) != null; i++) {  
699 - if (!hash[elem.id])  
700 - { 492 + for (var i = 0, elem; (elem = Array[i]) != null; i++) {
  493 + if (!hash[elem.id]) {
701 res.push(elem); 494 res.push(elem);
702 hash[elem.id] = true; 495 hash[elem.id] = true;
703 } 496 }
704 } 497 }
705 return res; 498 return res;
706 } 499 }
707 - 500 +/**
  501 + * 自动获取品牌
  502 + */
708 $(document).on("click", "#brandAutoBtn", function () { 503 $(document).on("click", "#brandAutoBtn", function () {
709 var product_skc = []; 504 var product_skc = [];
710 Bll.contentDatas.forEach(function (item, index) { 505 Bll.contentDatas.forEach(function (item, index) {
@@ -749,17 +544,8 @@ $(document).on("click", "#brandAutoBtn", function () { @@ -749,17 +544,8 @@ $(document).on("click", "#brandAutoBtn", function () {
749 b.push(map[item]); 544 b.push(map[item]);
750 } 545 }
751 }); 546 });
752 - Bll.Brdata = (Bll.Brdata||ViewModel.brandList || []).concat(b);  
753 - Bll.Brdata=Unique(Bll.Brdata);  
754 - // Bll.Brdata=Bll.Brdata.unique5()  
755 - // var map2={};  
756 - // Bll.Brdata.forEach(function(item){  
757 - // map2[item.id]=item;  
758 - // });  
759 - // Bll.Brdata=[];  
760 - // for(var key in map2){  
761 - // Bll.Brdata.push(map2[key]);  
762 - // } 547 + Bll.Brdata = (Bll.Brdata || ViewModel.brandList || []).concat(b);
  548 + Bll.Brdata = Unique(Bll.Brdata);
763 Bll.Brdata = Bll.renderBrandPic(Bll.Brdata); 549 Bll.Brdata = Bll.renderBrandPic(Bll.Brdata);
764 } 550 }
765 }, true); 551 }, true);
@@ -865,4 +651,348 @@ $(document).on("mouseover", ".dragItem", function () { @@ -865,4 +651,348 @@ $(document).on("mouseover", ".dragItem", function () {
865 $(document).on("mouseleave", ".dragItem", function () { 651 $(document).on("mouseleave", ".dragItem", function () {
866 new common.drag("#add-content").destroy(); 652 new common.drag("#add-content").destroy();
867 }); 653 });
  654 +/************************************商品相关****************************************************/
  655 +/**
  656 + * 选择商品表格
  657 + */
  658 +var goodsgird = new common.grid({
  659 + el: '#goodsgird',
  660 + parms: function () {
  661 + var price = "";
  662 + if (common.util.__input('min-price') && common.util.__input('max-price')) {
  663 + price = common.util.__input('min-price') + "," + common.util.__input('max-price');
  664 + }
  665 + return {
  666 + status: 1,
  667 + sales: "Y",
  668 + stocknumber: "1",
  669 + attribute_not: "2",
  670 + query: common.util.__input('skns') || common.util.__input('skns2'),
  671 + price: price,
  672 + color: colorArray.join(','),
  673 + //style: styleArray.join(','),//风格先不管
  674 + msort: typeArray.join(','),
  675 + brand: brandArray.join(','),
  676 + gender: genderArray.join(',')
  677 + };
  678 + },
  679 + columns: [
  680 + {
  681 + display: "选择",
  682 + type: "checkbox"
  683 + }, {
  684 + display: "产品图片",
  685 + render: function (item) {
  686 + if (item.images_url) {
  687 + item.images_url = common.util.__joinImg("goodsimg", item.images_url);
  688 + }
  689 + else {
  690 + if (item.default_images) {
  691 + item.images_url = common.util.__joinImg("goodsimg", item.default_images);
  692 + }
  693 + else {
  694 + item.images_url = ""
  695 + }
  696 + }
  697 + if (item.images_url) {
  698 + return "<img width=120 height=60 src='" + item.images_url + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90'/>";
  699 + } else {
  700 + return "";
  701 + }
  702 +
  703 + }
  704 + }, {
  705 + display: "产品名称",
  706 + name: "product_name"
  707 + }, {
  708 + display: "品牌",
  709 + name: "brand_name"
  710 + }, {
  711 + display: "现价",
  712 + name: "sales_price"
  713 + }, {
  714 + display: "吊牌价",
  715 + name: "market_price"
  716 + }, {
  717 + display: "预售",
  718 + name: "stock_number"
  719 + }, {
  720 + display: "库存",
  721 + name: "storage_num"
  722 + }]
  723 +});
  724 +/**
  725 + * 手动输入
  726 + */
  727 +$(document).on("click", ".hand", function () {
  728 + $(this).css("color", 'red');
  729 + $("#skns").val("");
  730 + $(".tag").css("color", 'black');
  731 + $(".search-con1").show();
  732 + $(".search-con2").hide();
  733 + $(".tag-con").hide();
  734 + $(".goods-list").hide();
  735 +});
  736 +/**
  737 + * 手动输入中“搜索商品”按钮
  738 + */
  739 +
  740 +$(document).on("click", "#search", function () {
  741 + if ($.trim($("#skns").val()).length < 5) {
  742 + common.util.__tip("请输入超过5个字符后再搜索", "warning");
  743 + return;
  744 + }
  745 +
  746 + else {
  747 + $(".goods-list").show();
  748 + if (goodsgird.grid) {
  749 + goodsgird.reload(1);
  750 + } else {
  751 + goodsgird.init('/yohosearch/search');
  752 + }
  753 + }
  754 +
  755 +});
  756 +/**
  757 + * 标签搜索
  758 + */
  759 +$(document).on("click", ".tag", function () {
  760 +
  761 + $(this).css("color", 'red');
  762 + $(".hand").css("color", 'black');
  763 + $(".search-con1").hide();
  764 + $(".search-con2").show();
  765 + $(".tag-con").hide();
  766 + $(".goods-list").hide();
  767 +});
  768 +/**
  769 + * 标签搜索中 “搜索商品”按钮
  770 + */
  771 +$(document).on("click", "#search2", function () {
  772 + $(".goods-list").show();
  773 + goodsgird.init('/yohosearch/search');
  774 +});
  775 +/**
  776 + * 标签搜索中“搜索标签”按钮
  777 + * @type {Array}
  778 + */
  779 +var sorts = [];//所选分类
  780 +var colors = [], colorArray = [];//颜色
  781 +var styles = [{stylename: "街头"}, {stylename: "趣味"}, {stylename: "运动"}], styleArray = [];//风格
  782 +var types = [], typeArray = [];//品类
  783 +var brands = [], brandArray = [];//品牌
  784 +var genders = [{id: 1, gendername: "男"}, {id: 2, gendername: "女"}, {id: 3, gendername: "通用"}], genderArray = [];//性别
  785 +common.util.__ajax({
  786 + url: "/erpproduct/product/colorList"
  787 +}, function (res) {
  788 + colors = res.data.list;
  789 +}, true);
  790 +common.util.__ajax({
  791 + url: "/product/class/queryAllProductSortList",
  792 + data: {
  793 + booleanStatus: true
  794 + }
  795 +}, function (res) {
  796 + types = res.data;
  797 +}, true);
  798 +
  799 +$(document).on("click", "#search-tag", function () {
  800 + $(".tag-con").show();
  801 + $(".sort").html(common.util.__template2($("#tag-template").html(), {
  802 + sorts: sorts
  803 + }));
  804 + $(".orther").html(common.util.__template2($("#sorts-template").html(), {
  805 + colors: colors,
  806 + styles: styles,
  807 + types: types,
  808 + brands: Bll.Brands,
  809 + genders: genders
  810 + }));
  811 + if($("#skns2").val()!=''){
  812 + $(".goods-list").show();
  813 + if (goodsgird.grid) {
  814 + goodsgird.reload(1);
  815 + } else {
  816 + goodsgird.init('/yohosearch/search');
  817 + }
  818 + }
  819 +
  820 +});
  821 +/**
  822 + * 价格筛选
  823 + */
  824 +$(document).on("click", "#price-search", function () {
  825 + if (goodsgird.grid) {
  826 + goodsgird.reload(1);
  827 + } else {
  828 + goodsgird.init('/yohosearch/search');
  829 + }
  830 +});
  831 +
  832 +
  833 +//点击“选择标签”按钮(添加商品)
  834 +$(document).on("click", "#goodsSelectBtn", function () {
  835 + new common.dialog({
  836 + title: "选择商品",
  837 + content: $("#template_dialog_goodsgird").html(),
  838 + width: '80%',
  839 + button: [{
  840 + value: "确定",
  841 + callback: function () {
  842 + var gs = goodsgird.selected.map(function (item, index) {
  843 + return {
  844 + src: item.images_url,
  845 + id: item.product_skn,
  846 + product_skc: item.product_skc
  847 + }
  848 + })
  849 + Bll.module.contentData.data = Bll.module.contentData.data.concat(gs);
  850 + Bll.module.contentData.data = Unique(Bll.module.contentData.data)
  851 + Bll.__render("#goodspic", "template_dialog_goodsimgs", {
  852 + datas: Bll.module.contentData.data
  853 + });
  854 + },
  855 + css: "btn-primary"
  856 + }]
  857 + });
  858 + goodsgird.grid = null;
  859 + //goodsgird.init('/yohosearch/search');
  860 +});
  861 +//点击“添加组”按钮(添加商品组)
  862 +$(document).on("click", "#goodsaddBtn", function () {
  863 + var item = $.extend(true, {}, Button[4].data[0]);
  864 + if (Bll.module.contentData.data[0].list.length) {
  865 + Bll.module.contentData.data.push(item);
  866 + }
  867 + Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
  868 +});
  869 +//点击“选择标签”按钮(添加商品组)
  870 +$(document).on("click", ".goodsSelectBtn", function () {
  871 + var index = $(this).data("index");
  872 + new common.dialog({
  873 + title: "选择商品",
  874 + content: $("#template_dialog_goodsgird").html(),
  875 + width: '80%',
  876 + button: [{
  877 + value: "确定",
  878 + callback: function () {
  879 + if (goodsgird.selected) {
  880 + goodsgird.selected.forEach(function (item, i) {
  881 + Bll.module.contentData.data[index].list.push({
  882 + src: item.images_url,//+'?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90'
  883 + id: item.product_skn,
  884 + product_skc: item.product_skc,
  885 + maxSortId: item.max_sort_id
  886 + });
  887 + });
  888 + Bll.module.contentData.data[index].list = Unique(Bll.module.contentData.data[index].list);
  889 + Bll.module.contentData.data[index].cover = {
  890 + cover: Bll.module.contentData.data[index].list[0].src,
  891 + maxSortId: Bll.module.contentData.data[index].list[0].maxSortId
  892 + };
  893 + }
  894 + Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
  895 + },
  896 + css: "btn-primary"
  897 + }]
  898 + });
  899 + //goodsgird.init('/yohosearch/search');
  900 + goodsgird.grid = null;
  901 +});
  902 +//删除图片按钮
  903 +$(document).on("click", ".removepic", function () {
  904 + var $parent = $(this).parents("ul.imagegroup");
  905 + var i = $parent.data("i");//组标志
  906 + var isg = typeof(i) === "number" ? true : false;
  907 + //推荐商品组
  908 + if (isg) {
  909 + Bll.module.contentData.data[i].list.splice($(this).data("index"), 1);
  910 + Bll.module.contentData.data[i].cover = {};
  911 + if (Bll.module.contentData.data[i].list.length == 0) {
  912 + Bll.module.contentData.data[i].cover.cover = "";
  913 + Bll.module.contentData.data[i].cover.maxSortId = "";
  914 + }
  915 + else {
  916 + Bll.module.contentData.data[i].cover.cover = Bll.module.contentData.data[i].list[0].src;
  917 + Bll.module.contentData.data[i].cover.maxSortId = Bll.module.contentData.data[i].list[0].maxSortId;
  918 + }
  919 + }
  920 + //商品
  921 + else {
  922 + Bll.module.contentData.data.splice($(this).data("index"), 1);
  923 + }
  924 + $parent.html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
  925 + datas: isg ? Bll.module.contentData.data[i].list : Bll.module.contentData.data
  926 + }));
  927 +});
  928 +//勾选标签
  929 +var checkSort = function (name, array) {
  930 + $(document).on("click", "input[name='" + name + "']", function () {
  931 + if ($(this).is(':checked')) {
  932 + array.push($(this).val());
  933 + }
  934 + else {
  935 + var i = array.indexOf($(this).val());
  936 + if (i > -1) {
  937 + array.splice(i, 1);
  938 + }
  939 + }
  940 + });
  941 +};
  942 +checkSort("color", colorArray);
  943 +checkSort("style", styleArray);
  944 +checkSort("type", typeArray);
  945 +checkSort("brand", brandArray);
  946 +checkSort("gender", genderArray);
  947 +Array.prototype.indexOf = function (val) {
  948 + for (var i = 0; i < this.length; i++) {
  949 + if (this[i] == val) return i;
  950 + }
  951 + return -1;
  952 +};
  953 +//$(document).on("click", "#search-tag", function () {
  954 +// $(".tag-con").show();
  955 +// var txt = $("#tags").val();
  956 +// var regex = new RegExp(txt);
  957 +// var bs = [];
  958 +// var colors1=[],types1=[],genders1=[];
  959 +// colors.forEach(function(color){
  960 +// if (regex.test(color.colorName)) {
  961 +// colors1.push(color);
  962 +// }
  963 +// });
  964 +// types.forEach(function(type){
  965 +// if (regex.test(type.sortName)) {
  966 +// types1.push(type);
  967 +// }
  968 +// });
  969 +// genders.forEach(function(gender){
  970 +// if (regex.test(gender.gendername)) {
  971 +// genders1.push(gender);
  972 +// }
  973 +// });
  974 +// //Bll.Brands.forEach(function (brands) {
  975 +// // brands.items.forEach(function (item) {
  976 +// // if (regex.test(item.brand_name)) {
  977 +// // console.log(item.brand_name);
  978 +// // bs.push(' <input type="checkbox" name="brand" value="'+item.id+'">'+item.brand_name+'');
  979 +// // }
  980 +// // });
  981 +// //});
  982 +// $(".orther").html(common.util.__template2($("#sorts-template").html(), {
  983 +// colors: colors1,
  984 +// //styles: styles1,
  985 +// types: types1,
  986 +// //brands: Bll.Brands,
  987 +// genders: genders1
  988 +// }));
  989 +//});
  990 +
  991 +
  992 +
  993 +
  994 +
  995 +
  996 +
  997 +
868 998
@@ -5,18 +5,24 @@ var editBean = require('./partials/limitcode-edit-bean'); @@ -5,18 +5,24 @@ var editBean = require('./partials/limitcode-edit-bean');
5 var e = new common.edit2("#basicForm"); 5 var e = new common.edit2("#basicForm");
6 var type = $("#basicForm").attr("role"), 6 var type = $("#basicForm").attr("role"),
7 action = $("#basicForm").data("action"); 7 action = $("#basicForm").data("action");
  8 +var isFirst = true;
8 9
9 var Bll = { 10 var Bll = {
10 __render:function() { 11 __render:function() {
  12 + editBean.currTime = common.util.__dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
  13 + if(new Date(editBean.currTime).getTime() > new Date(editBean.limitDateFrom)) {
  14 + editBean.useCurrTime = true;
  15 + }
11 $("#basicForm").html(common.util.__template2($("#limitcodeEdit-template").html(), editBean)); 16 $("#basicForm").html(common.util.__template2($("#limitcodeEdit-template").html(), editBean));
12 e.init(); 17 e.init();
13 if(type == "edit") { 18 if(type == "edit") {
14 $('input[name="skn_sku"]').prop('disabled', true); 19 $('input[name="skn_sku"]').prop('disabled', true);
15 $(".noEdit").prop("disabled", true); 20 $(".noEdit").prop("disabled", true);
16 $('input[name="userTypeLimit"]').prop('disabled', true); 21 $('input[name="userTypeLimit"]').prop('disabled', true);
17 - if(editBean.limitDateFrom <= new Date()) { 22 + if((new Date(editBean.limitDateFrom).getTime() <= new Date().getTime()) && isFirst) {
18 $("#limitDateFrom").prop("disabled", true); 23 $("#limitDateFrom").prop("disabled", true);
19 } 24 }
  25 + isFirst = false;
20 } 26 }
21 }, 27 },
22 __checkSkn:function(callback) { 28 __checkSkn:function(callback) {
@@ -89,6 +95,14 @@ $(document).on("change", ".observe", function () { @@ -89,6 +95,14 @@ $(document).on("change", ".observe", function () {
89 editBean = common.util.__buildobj(name, '.', editBean, function (obj, name) { 95 editBean = common.util.__buildobj(name, '.', editBean, function (obj, name) {
90 obj[name] = $this.val(); 96 obj[name] = $this.val();
91 }); 97 });
  98 + if($this.prop("id") == "limitDateFrom" && new Date($this.val()).getTime() ) {
  99 + if(new Date(editBean.currTime).getTime() > new Date(editBean.limitDateFrom)) {
  100 + editBean.useCurrTime = true;
  101 + } else {
  102 + editBean.useCurrTime = false;
  103 + }
  104 + Bll.__render();
  105 + }
92 //console.log(editBean); 106 //console.log(editBean);
93 }); 107 });
94 108
@@ -14,119 +14,90 @@ require('../common/zh-cn'); @@ -14,119 +14,90 @@ require('../common/zh-cn');
14 var baidu; 14 var baidu;
15 15
16 var ENUM = { 16 var ENUM = {
17 - AuditEnum: {  
18 - '0': '待审核',  
19 - '1': '审核通过',  
20 - '2': '审核失败',  
21 - },  
22 -  
23 - RecommendEnum: {  
24 - true: '已推荐',  
25 - false: '未推荐'  
26 - },  
27 -  
28 - RewardEnum: {  
29 - false: '未发送奖励',  
30 - true: '奖励已发放' 17 + FileTypeEnum: {
  18 + '1': '频道',
  19 + '2': '专题',
  20 + '3': '邮件',
  21 + '4': '推广'
31 } 22 }
32 }; 23 };
33 24
34 25
  26 +
  27 +new common.dropDown({
  28 + el: "#sel-type"
  29 +});
  30 +
  31 +//日期插件
  32 +$('.hasDatepicker').fdatepicker({
  33 + format: 'yyyy-mm-dd'
  34 +});
  35 +
35 var g = new common.grid({ 36 var g = new common.grid({
36 el: '#basicTable', 37 el: '#basicTable',
37 size: 10, 38 size: 10,
38 parms: function () { 39 parms: function () {
39 40
  41 +
  42 +
40 return { 43 return {
41 - status: $('#status').val(),  
42 - recomReward: $('#recomReward').val(),  
43 - hasImage: $('#hasImage').val(), 44 +
  45 + fileType: $('#sel-type').val(),
44 beginTime: common.util.__input('beginTime'), 46 beginTime: common.util.__input('beginTime'),
45 - endTime: common.util.__input('endTime'),  
46 - uid: common.util.__input('uid'),  
47 - productName: common.util.__input('productName'),  
48 - productSkn: common.util.__input('productSkn'),  
49 - orderCode: common.util.__input('orderCode') 47 + endTime: common.util.__input('endTime')
  48 +
50 }; 49 };
51 }, 50 },
52 columns: [{ 51 columns: [{
53 - display: '订单号',  
54 - name: "orderId"  
55 - }, {  
56 - display: '商品名称',  
57 - render: function (item) {  
58 - var goods = item.goods;  
59 - if (goods != null) {  
60 - productHref = "http://item.yohobuy.com/product/pro_" + item.productId + "_" + goods.goodsId + "/" + goods.cnAlphabet + ".html";  
61 - }  
62 - return '<a href="' + item.productHref + '">' + item.productName + '</a>'  
63 - }  
64 - }, {  
65 - display: '用户id',  
66 - name: "uid"  
67 - }, {  
68 - display: '商品图片',  
69 - render: function (item) {  
70 - var goods = item.goods;  
71 - var goodImgUrl = "";  
72 - if (goods != null && goods.goodsImg != null && goods.goodsImg.length > 0) {  
73 - goodImgUrl = goods.goodsImg[0].imageUrl;  
74 - }  
75 -  
76 - return '<img src="' + goodImgUrl + '" width="100" height="60"/>'  
77 -  
78 - }  
79 - }, {  
80 - display: "评价图片",  
81 - render: function (item) {  
82 -  
83 - //item.url = common.util.__template(item.url,{mode:2,width:100,height:100});  
84 - return '<img src="' + item.url + '" width="100" height="60"/>'  
85 - }  
86 - }, {  
87 - display: '评价内容',  
88 - name: "content",  
89 - //width:'15%',  
90 - style: "width:15%; word-break:break-all;"  
91 - }  
92 - , {  
93 - display: '评价星级',  
94 - name: "satisfied"  
95 - }, {  
96 - display: '审核状态',  
97 - render: function (item) {  
98 - return "<p>" + ENUM.AuditEnum[item.status] + "</p>";  
99 - }  
100 - }, 52 + display: 'ID',
  53 + name: "id"
  54 + }, {
  55 + display: '标题',
  56 + name: "pageTitle"
  57 + },
101 { 58 {
102 - display: '审核返币', 59 + display: '类型',
103 render: function (item) { 60 render: function (item) {
104 - return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>"; 61 + return "<p>" + ENUM.FileTypeEnum[item.fileType] + "</p>";
105 } 62 }
106 }, 63 },
  64 + //{
  65 + // display: '审核返币',
  66 + // render: function (item) {
  67 + // return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>";
  68 + // }
  69 + //},
  70 + //{
  71 + // display: '推荐状态',
  72 + // render: function (item) {
  73 + // return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>";
  74 + // }
  75 + //},
  76 +
107 { 77 {
108 - display: '推荐状态', 78 + display: "添加时间",
  79 +
109 render: function (item) { 80 render: function (item) {
110 - return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>"; 81 + var t = new Date(item.createTime * 1000);
  82 + var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
  83 + return "<p>" + formatted + "</p>";
111 } 84 }
112 - }, {  
113 - display: "创建时间", 85 + },{
  86 + display: "修改时间",
114 87
115 render: function (item) { 88 render: function (item) {
116 - var t = new Date(item.createTime * 1000); 89 + var t = new Date(item.updateTime * 1000);
117 var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss"); 90 var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
118 return "<p>" + formatted + "</p>"; 91 return "<p>" + formatted + "</p>";
119 } 92 }
120 - }, {  
121 - display: '备注',  
122 - name: "remark"  
123 - }, { 93 + },
  94 + {
124 display: '操作', 95 display: '操作',
125 //} 96 //}
126 render: function (items) { 97 render: function (items) {
127 var HtmArr = []; 98 var HtmArr = [];
128 99
129 - HtmArr.push('<a data-index="' + items.__index + '" style="margin-bottom:10px;" href="JavaScript:;" class="btn btn-info btn-xs info-modify">编辑</a>'); 100 + HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-info btn-xs info-modify">编辑</a>');
130 HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>'); 101 HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
131 102
132 return HtmArr.join(''); 103 return HtmArr.join('');
@@ -134,12 +105,12 @@ var g = new common.grid({ @@ -134,12 +105,12 @@ var g = new common.grid({
134 } 105 }
135 ] 106 ]
136 }); 107 });
137 -g.init('/shareOrder/shareOrderList'); 108 +g.init('/staticFileManage/queryByCondition');
138 109
139 110
140 //添加 111 //添加
141 $(document).on('click', '#add', function () { 112 $(document).on('click', '#add', function () {
142 - staticFileOP("新增", '', {}); 113 + staticFileOP("新增", '/staticFileManage/add', {});
143 114
144 }); 115 });
145 116
@@ -149,9 +120,9 @@ $(document).on('click', '.info-del', function () { @@ -149,9 +120,9 @@ $(document).on('click', '.info-del', function () {
149 120
150 common.dialog.confirm("温馨提示", "确定要删除吗?", function () { 121 common.dialog.confirm("温馨提示", "确定要删除吗?", function () {
151 common.util.__ajax({ 122 common.util.__ajax({
152 - url: '', 123 + url: '/staticFileManage/deleteById',
153 data: { 124 data: {
154 - uid: item.uid, 125 + id: item.id
155 } 126 }
156 }, function (res) { 127 }, function (res) {
157 if (res.code == 200) { 128 if (res.code == 200) {
@@ -163,19 +134,16 @@ $(document).on('click', '.info-del', function () { @@ -163,19 +134,16 @@ $(document).on('click', '.info-del', function () {
163 }); 134 });
164 }); 135 });
165 136
  137 +// 查询
166 $(document).on('click', '#filter', function () { 138 $(document).on('click', '#filter', function () {
167 g.reload(); 139 g.reload();
168 }); 140 });
169 141
170 142
171 -$(document).on('click', '#add', function () {  
172 - g.reload();  
173 -});  
174 -  
175 //编辑 143 //编辑
176 $(document).on('click', '.info-modify', function () { 144 $(document).on('click', '.info-modify', function () {
177 var item = g.rows[$(this).data("index")]; 145 var item = g.rows[$(this).data("index")];
178 - staticFileOP("编辑", '/guang/relationship/updateRel', item); 146 + staticFileOP("编辑", '/staticFileManage/update', item);
179 }); 147 });
180 148
181 function staticFileOP(prefix, url, item) { 149 function staticFileOP(prefix, url, item) {
@@ -184,29 +152,32 @@ function staticFileOP(prefix, url, item) { @@ -184,29 +152,32 @@ function staticFileOP(prefix, url, item) {
184 //"bucket" : "author" 152 //"bucket" : "author"
185 }); 153 });
186 154
187 - //下拉框  
188 - new common.dropDown({  
189 - el: "#type"  
190 - });  
191 -  
192 var dialog = new common.dialog({ 155 var dialog = new common.dialog({
  156 + width: '70%',
193 title: prefix + '静态文件', 157 title: prefix + '静态文件',
194 content: common.util.__template2($("#template").html(), item), 158 content: common.util.__template2($("#template").html(), item),
195 button: [{ 159 button: [{
196 value: '提交', 160 value: '提交',
197 callback: function () { 161 callback: function () {
198 - a.submit(url, function (option) {  
199 - //option.data.  
200 -  
201 - option.success = function (res) {  
202 - res = res.data;  
203 - if (res.code == 200) {  
204 - a.$tip('提交成功', function () {  
205 - g.reload();  
206 - })  
207 - } else {  
208 - a.$tip(res.message);  
209 - } 162 +
  163 + common.util.__ajax({
  164 + url:url,
  165 + data:{
  166 + id: $('#id').val(),
  167 + fileType: $('#fileType').val(),
  168 + pageTitle: $('#pageTitle').val(),
  169 + keyWord: $('#keyWord').val(),
  170 + pageDesc: $('#pageDesc').val(),
  171 + content: baidu.getContent()
  172 + }
  173 + }, function (res) {
  174 + //res=res.data;
  175 + if(res.code=="200"){
  176 + dialog.close();
  177 + g.reload();
  178 + return true;
  179 + }else{
  180 + return false;
210 } 181 }
211 }); 182 });
212 183
@@ -216,9 +187,23 @@ function staticFileOP(prefix, url, item) { @@ -216,9 +187,23 @@ function staticFileOP(prefix, url, item) {
216 187
217 }); 188 });
218 189
  190 + ////下拉框
  191 + //new common.dropDown({
  192 + // el: "#fileType"
  193 + //});
  194 +
219 baidu && baidu.destroy(); 195 baidu && baidu.destroy();
220 - baidu = UM.getEditor('baidueditor');  
221 - //baidu.setContent(module.contentData.data.text); 196 + baidu = UM.getEditor('content');
  197 +
  198 + if (prefix == '编辑') {
  199 + baidu.setContent(item.content);
  200 +
  201 + //$("#fileType option").each(function() {
  202 + // return this.text == ENUM.FileTypeEnum[item.fileType];
  203 + //}).prop('selected', true);
  204 +
  205 + }
  206 +
222 207
223 a.init(); 208 a.init();
224 } 209 }
@@ -979,7 +979,7 @@ function editorTipInit(id){ @@ -979,7 +979,7 @@ function editorTipInit(id){
979 tipHtml = "<span>提示:【品牌一览】由PC端【品牌集合】适配,修改请到PC端【品牌集合】修改。</span>"; 979 tipHtml = "<span>提示:【品牌一览】由PC端【品牌集合】适配,修改请到PC端【品牌集合】修改。</span>";
980 break; 980 break;
981 case "editor-recommend": 981 case "editor-recommend":
982 - tipHtml = "<span>提示:请上传像素50*50的图片,图片和标题会适配到APP的【热门品类】中。</span>"; 982 + tipHtml = "<span>提示:请上传像素150*150的图片,图片和标题会适配到APP的【热门品类】中。</span>";
983 break; 983 break;
984 case "editor-recommend-app": 984 case "editor-recommend-app":
985 tipHtml = "<span>提示:【热门品类】由PC端【经典推荐】适配,修改请到PC端【经典推荐】修改。</span>"; 985 tipHtml = "<span>提示:【热门品类】由PC端【经典推荐】适配,修改请到PC端【经典推荐】修改。</span>";
@@ -137,7 +137,7 @@ pc端店铺模板css @@ -137,7 +137,7 @@ pc端店铺模板css
137 display: block; 137 display: block;
138 float: right; 138 float: right;
139 height: 50px; 139 height: 50px;
140 - width: 40%; 140 + width: 50px;
141 } 141 }
142 142
143 /*------------------------热销推荐--------------------------*/ 143 /*------------------------热销推荐--------------------------*/
@@ -642,6 +642,25 @@ exports.res = [ @@ -642,6 +642,25 @@ exports.res = [
642 route:'/guang/tags/getTags', 642 route:'/guang/tags/getTags',
643 method:'POST', 643 method:'POST',
644 url:'/guang/tags/getTags' 644 url:'/guang/tags/getTags'
  645 + },
  646 + {
  647 + //标签搜索,所有
  648 + route: '/guang/queryAllGoodsSort',
  649 + method: 'POST',
  650 + apis: {
  651 + colorList: {
  652 + url: '/erpproduct/product/colorList'
  653 + },
  654 + materialList: {
  655 + url: '/erpproduct/attribute/index',
  656 + params: [{
  657 + name: 'status',
  658 + type: 'String',
  659 + def:1
  660 + }],
  661 + isJsonRaw: true
  662 + }
  663 + }
645 } 664 }
646 ]; 665 ];
647 666
@@ -12,6 +12,47 @@ exports.res = [ @@ -12,6 +12,47 @@ exports.res = [
12 data: { 12 data: {
13 iscreate: true 13 iscreate: true
14 } 14 }
  15 + }, { // 新增
  16 + route: '/staticFileManage/add',
  17 + method: 'POST',
  18 + url: '/staticFileManage/add',
  19 + params: [
  20 + {name: 'fileType', type: 'Number'},
  21 + {name: 'pageTitle', type: 'String'},
  22 + {name: 'keyWord', type: 'String'},
  23 + {name: 'pageDesc', type: 'String'},
  24 + {name: 'content', type: 'String'}
  25 + ]
  26 + }, { // 删除
  27 + route: '/staticFileManage/deleteById',
  28 + method: 'POST',
  29 + url: '/staticFileManage/deleteById',
  30 + params: [
  31 + {name: 'id', type: 'Number'}
  32 + ]
  33 + }, { // 修改
  34 + route: '/staticFileManage/update',
  35 + method: 'POST',
  36 + url: '/staticFileManage/update',
  37 + params: [
  38 + {name: 'id', type: 'Number'},
  39 + {name: 'fileType', type: 'Number'},
  40 + {name: 'pageTitle', type: 'String'},
  41 + {name: 'keyWord', type: 'String'},
  42 + {name: 'pageDesc', type: 'String'},
  43 + {name: 'content', type: 'String'}
  44 + ]
  45 + }, { // 查询
  46 + route: '/staticFileManage/queryByCondition',
  47 + method: 'POST',
  48 + url: '/staticFileManage/queryByCondition',
  49 + params: [
  50 + {name: 'fileType', type: 'Number'},
  51 + {name: 'beginTime', type: 'String'},
  52 + {name: 'endTime', type: 'String'},
  53 + {name: 'page', type: 'Number'},
  54 + {name: 'size', type: 'Number'}
  55 + ]
15 } 56 }
16 ]; 57 ];
17 58
@@ -466,35 +466,67 @@ @@ -466,35 +466,67 @@
466 466
467 <!--添加商品/商品组--选择标签界面模板--> 467 <!--添加商品/商品组--选择标签界面模板-->
468 <script type="text/template" id="template_dialog_goodsgird"> 468 <script type="text/template" id="template_dialog_goodsgird">
469 - <div class="rows"> 469 + <h4>1、搜索商品或标签</h4>
  470 + <nav>
  471 + <a class="hand select" href="javascript:void(0)" style="font-size: 14px;padding:20px;color: red">手动输入</a>
  472 + <a class="tag" href="javascript:void(0)" style="font-size: 14px;padding:20px;color: #000000">标签筛选</a>
  473 + </nav>
  474 + <div class="search-con1 form-group">
  475 + <div class="col-sm-3">
  476 + <input type="text" id="skns" class="form-control" placeholder="输入skn,多个skn以逗号分隔">
  477 + </div>
  478 + <div class="col-sm-1">
  479 + <a id="search" class="go-search form-control btn btn-primary">搜索商品</a>
  480 + </div>
  481 +
  482 + </div>
  483 + <div class="search-con2 form-group" hidden="hidden">
  484 + <div class="col-sm-3">
  485 + <input type="text" id="tags" class="form-control" placeholder="输入关键字搜索标签">
  486 + </div>
  487 + <div class="col-sm-1">
  488 + <span style="line-height: 300%;margin-left: 50px"></span>
  489 + </div>
  490 +  
  491 + <div class="col-sm-3">
  492 + <input type="text" id="skns2" class="form-control" placeholder="输入skn搜索标签">
  493 + </div>
  494 + <div class="col-sm-1">
  495 + <a type="button" id="search-tag" class="go-search btn btn-primary">搜索标签</a>
  496 + </div>
  497 + </div>
  498 + <div class="tag-con" style="border: 1px solid rgb(0, 0, 0); padding: 10px; margin-top: 10px;" hidden="hidden">
  499 + <div class="sort">
  500 + [[layout tag-template]]
  501 + </div>
  502 + <div class="orther">
  503 + [[layout sorts-template]]
  504 + </div>
  505 + <p style="margin-top:40px;">
  506 + <a class="go-search tag-goods btn btn-primary" id="search2">搜索商品</a>
  507 + </p>
  508 + </div>
  509 + <div class="goods-list form-group" style="display: none">
  510 + <h4>2、选择商品</h4>
  511 +
470 <div class="form-group"> 512 <div class="form-group">
471 - <div class="panel-col2">  
472 - <input class="form-control" id="skns" placeholder="输入SKN(多个skn以逗号分隔)或产品名称"/> 513 + <label class="col-sm-1" for="min-price">价格筛选:</label>
  514 +
  515 + <div class="col-sm-2">
  516 + <input type="text" id="min-price" class="form-control">
473 </div> 517 </div>
474 - <div class="panel-col">  
475 - <input type="number" id="beginPrice" name="begin_price" class="form-control"  
476 - placeholder="起始价" value=""> 518 + <div class="col-sm-1">
  519 + <span>-</span>
477 </div> 520 </div>
478 -  
479 - <div class="panel-col">  
480 - <input type="number" id="endPrice" name="end_price" class="form-control"  
481 - placeholder="结束价" value=""> 521 + <div class="col-sm-2">
  522 + <input type="text" id="max-price" class="form-control">
482 </div> 523 </div>
483 <div class="col-sm-1"> 524 <div class="col-sm-1">
484 - <input type="button" id="search" class="btn btn-primary mr5" value="搜索"/> 525 + <a class="go-search price btn btn-primary" id="price-search">筛选</a>
485 </div> 526 </div>
486 </div> 527 </div>
487 - <div class="form-group">  
488 - <div class="gird" id="goodsgird">  
489 - <div class="row">  
490 - <div class="form-group">  
491 - <div class="col-sm-12">  
492 - <i class="col-sm-1 fa fa-star" style="text-align: right"></i>  
493 - <p class="col-sm-10">请在搜索框内输入SKN(多个skn以逗号分隔)或产品名称,然后点击搜索按钮</p>  
494 - </div>  
495 - </div>  
496 - </div>  
497 - </div> 528 +
  529 + <div class="gird" id="goodsgird">
498 </div> 530 </div>
499 </div> 531 </div>
500 </script> 532 </script>
@@ -597,3 +629,55 @@ @@ -597,3 +629,55 @@
597 <option value="go.discountmarket">折扣专区</option> 629 <option value="go.discountmarket">折扣专区</option>
598 <option value="go.discountmarketpro">折扣专区详情页</option> 630 <option value="go.discountmarketpro">折扣专区详情页</option>
599 </script> 631 </script>
  632 +<script type="text/template" id="sorts-template">
  633 + <div class="form-group">
  634 + 颜色:
  635 + [[each colors as item index]]
  636 + <input type="checkbox" name="color" data-index="[[index]]" value="[[item.id]]">[[item.colorName]]
  637 + [[/each]]
  638 + <input type="hidden" id="colors1" for="checkbox">
  639 +
  640 + </div>
  641 + <div class="form-group">
  642 + 风格:
  643 + [[each styles as item index]]
  644 + <input type="checkbox" name="style" value="[[item.stylename]]">[[item.stylename]]
  645 + [[/each]]
  646 + <input type="hidden" for="checkbox" id="styles1">
  647 + </div>
  648 + <div class="form-group">
  649 + 品类:
  650 + [[each types as item index]]
  651 + <input type="checkbox" name="type" value="[[item.id]]">[[item.sortName]]
  652 + [[/each]]
  653 + <input type="hidden" for="checkbox" id="types1">
  654 + </div>
  655 + <div class="form-group">
  656 + 品牌:
  657 + [[each brands as item index]]
  658 + [[each item.items as _item _index]]
  659 + <input type="checkbox" name="brand" value="[[_item.id]]">[[_item.brand_name]]
  660 + [[/each]]
  661 + [[/each]]
  662 + <input type="hidden" for="checkbox" id="brands1">
  663 + </div>
  664 + <div class="form-group">
  665 + 性别:
  666 + [[each genders as item index]]
  667 + <input type="checkbox" name="gender" value="[[item.id]]">[[item.gendername]]
  668 + [[/each]]
  669 + <input type="hidden" for="checkbox" id="genders1">
  670 + </div>
  671 +</script>
  672 +<script type="text/template" id="tag-template">
  673 + <div class="form-group">
  674 + 所有标签:
  675 + [[each sorts as item index]]
  676 + <input type="checkbox" name="color" value="[[item.id]]">[[item.id]]
  677 + [[/each]]
  678 + <input type="hidden" id="sorts1" for="checkbox">
  679 + </div>
  680 +
  681 +</script>
  682 +
  683 +
@@ -57,9 +57,10 @@ @@ -57,9 +57,10 @@
57 <input type="text" class="form-control observe" data-field="limitDateFrom" jsaction="time:end:limitDateTo" id="limitDateFrom" placeholder="开始时间" value="[[limitDateFrom]]" readonly required> 57 <input type="text" class="form-control observe" data-field="limitDateFrom" jsaction="time:end:limitDateTo" id="limitDateFrom" placeholder="开始时间" value="[[limitDateFrom]]" readonly required>
58 </div> 58 </div>
59 <div class="col-sm-6"> 59 <div class="col-sm-6">
60 - <input type="text" class="form-control observe" data-field="limitDateTo" jsaction="time:start:limitDateFrom" id="limitDateTo" placeholder="结束时间" value="[[limitDateTo]]" readonly required> 60 + <input type="text" class="form-control observe" data-field="limitDateTo" jsaction="time:start:[[useCurrTime?'limitDateCurr':'limitDateFrom']]" id="limitDateTo" placeholder="结束时间" value="[[limitDateTo]]" readonly required>
61 </div> 61 </div>
62 </div> 62 </div>
  63 + <input type="hidden" jsaction="time" id="limitDateCurr" value="[[currTime]]" readonly>
63 </div> 64 </div>
64 65
65 <div class="form-group"> 66 <div class="form-group">
@@ -28,8 +28,10 @@ @@ -28,8 +28,10 @@
28 <div class="form-group"> 28 <div class="form-group">
29 <select id="sel-type" class="form-control" style="width:120px"> 29 <select id="sel-type" class="form-control" style="width:120px">
30 <option value="">选择类型</option> 30 <option value="">选择类型</option>
31 - <option value="0">专题</option>  
32 - <option value="1">有图</option> 31 + <option value="1">频道</option>
  32 + <option value="2">专题</option>
  33 + <option value="3">邮件</option>
  34 + <option value="4">推广</option>
33 </select> 35 </select>
34 </div> 36 </div>
35 37
@@ -44,7 +46,7 @@ @@ -44,7 +46,7 @@
44 </div> 46 </div>
45 47
46 <button type="submit" id="filter" class="btn btn-info">查询</button> 48 <button type="submit" id="filter" class="btn btn-info">查询</button>
47 - <button type="submit" id="all" class="btn btn-info">全部</button> 49 + <a type="submit" href="" id="all" class="btn btn-info">全部</a>
48 <button type="submit" id="add" class="btn btn-info">新增</button> 50 <button type="submit" id="add" class="btn btn-info">新增</button>
49 </div> 51 </div>
50 52
@@ -64,43 +66,45 @@ @@ -64,43 +66,45 @@
64 66
65 <script type="text/template" id="template"> 67 <script type="text/template" id="template">
66 68
  69 + <input type="text" hidden="true" id="id" value="[[id]]"/>
67 <div class="form-group"> 70 <div class="form-group">
68 - <label for="type" class="col-sm-2 control-label">静态文件类型:</label> 71 + <label for="fileType" class="col-sm-2 control-label">静态文件类型:</label>
69 72
70 <div class="col-sm-8"> 73 <div class="col-sm-8">
71 - <select class="form-control" value="[[adsImgSize]]" id="type"> 74 + <select class="form-control" value="[[fileType]]" id="fileType">
72 <option value="">选择类型</option> 75 <option value="">选择类型</option>
73 - <option value="10881088">1088X1088</option>  
74 - <option value="1088680">1088X680</option>  
75 - <option value="1088340">1088X340</option> 76 + <option value="1">频道</option>
  77 + <option value="2">专题</option>
  78 + <option value="3">邮件</option>
  79 + <option value="4">推广</option>
76 </select> 80 </select>
77 </div> 81 </div>
78 </div> 82 </div>
79 83
80 <div class="form-group"> 84 <div class="form-group">
81 - <label for="authorDesc" class="col-sm-2 control-label">页面标题:</label> 85 + <label for="pageTitle" class="col-sm-2 control-label">页面标题:</label>
82 <div class="col-sm-10"> 86 <div class="col-sm-10">
83 - <input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面标题" required="required" class="form-control"> 87 + <input type="text" value="[[pageTitle]]" name="pageTitle" id="pageTitle" placeholder="页面标题" required="required" class="form-control">
84 </div> 88 </div>
85 </div> 89 </div>
86 90
87 <div class="form-group"> 91 <div class="form-group">
88 - <label for="authorDesc" class="col-sm-2 control-label">页面关键词:</label> 92 + <label for="keyWord" class="col-sm-2 control-label">页面关键词:</label>
89 <div class="col-sm-10"> 93 <div class="col-sm-10">
90 - <input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面关键词" required="required" class="form-control"> 94 + <input type="text" value="[[keyWord]]" name="keyWord" id="keyWord" placeholder="页面关键词" required="required" class="form-control">
91 </div> 95 </div>
92 </div> 96 </div>
93 97
94 <div class="form-group"> 98 <div class="form-group">
95 - <label for="authorDesc" class="col-sm-2 control-label">页面介绍:</label> 99 + <label for="pageDesc" class="col-sm-2 control-label">页面介绍:</label>
96 <div class="col-sm-10"> 100 <div class="col-sm-10">
97 - <input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面介绍" required="required" class="form-control"> 101 + <input type="text" value="[[pageDesc]]" name="pageDesc" id="pageDesc" placeholder="页面介绍" required="required" class="form-control">
98 </div> 102 </div>
99 </div> 103 </div>
100 104
101 <div class="rows"> 105 <div class="rows">
102 - <label for="baidueditor" class="col-sm-2 control-label">内容:</label>  
103 - <script id="baidueditor" style="width: 100%;" name="content" type="text/plain"></script> 106 + <label for="content" class="col-sm-2 control-label">内容:</label>
  107 + <script id="content" style="width: 100%;" name="content" type="text/plain"></script>
104 </div> 108 </div>
105 109
106 110