|
@@ -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
|
|