add-info.js
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var $ = require('jquery'),
common = require('../../common/common');
var e = new common.edit('#addinfo-wrap'),
basicInfo = NETSALEDATA.baseProductInfo.baseProduct;
common.util.__ajax({
url: '/goods/product/queryMakingProcess',
data: {
displayPosition: 2,
categoryId: basicInfo.maxSortId
}
}, function(res) {
var obj = res.data;
obj.makeCrafts = NETSALEDATA.productExtBo.makeCrafts.replace(/,/g, "|");
var html = common.util.__template2($('#makingProcessTemp').html(), obj);
$('.making-process-wrap .col-sm-11').html(html);
e.init();
}, true);
var addInfoHtml = common.util.__template2($('#addInfoTemp').html(), NETSALEDATA.productExtBo);
$('.addinfo-wrap').append($(addInfoHtml));
basicInfo.style = basicInfo.style.replace(/,/g, "|");
basicInfo.pattern = basicInfo.pattern.replace(/,/g, "|");
$('#productStyleWrap').html(common.util.__template2($('#productStyleWrap').html(), basicInfo));
$('#productElementsWrap').html(common.util.__template2($('#productElementsWrap').html(), basicInfo));
$('#brandModelWrap').html(common.util.__template2($('#brandModelWrap').html(), NETSALEDATA.productExtBo));
$('#brandSeriesWrap').html(common.util.__template2($('#brandSeriesWrap').html(), NETSALEDATA.productExtBo));
//console.log(NETSALEDATA.wearSenses);
/*$('#wearSenseWrap').html(common.util.__template2($('#wearSenseWrap').html(), {
wearSenses: NETSALEDATA.wearSenses
}));
*/
new common.dropDown({
el: '#brandModelSelect',
ajax: 'queryAll4Select',
params: {
type: 1,
status: 1,
shopsId: basicInfo.shopId,
brandId: basicInfo.brandId
}
});
new common.dropDown({
el: '#brandSeriesSelect',
ajax: 'queryAll4Select',
params: {
type: 2,
status: 1,
shopsId: basicInfo.shopId,
brandId: basicInfo.brandId
}
});
/*e.on("render", function() {
if ($('#brandModel').val()) {
$('#brandModelSelect').val($('#brandModel').val());
}
if ($('#brandSeries').val()) {
$('#brandSeriesSelect').val($('#brandSeries').val());
}
})*/
e.on("bind", function() {
$('#brandModelSelect').on('change', function() {
$('#brandModel').val($(this).val());
});
$('#brandSeriesSelect').on('change', function() {
$('#brandSeries').val($(this).val());
});
});
$('#saveAddInfo').on('click', function() {
e.submit('/goods/product/saveAfterSaleInfo', function(option) {
option.data.productSkn = $('#productSkn').val();
option.data.style = option.data.style.split('|').join(',');
option.data.pattern = option.data.pattern.split('|').join(',');
option.data.makeCrafts = option.data.makeCrafts.split('|').join(',');
option.data.wearSense = function() {
var arr = [];
$('#wearSenseWrap').find('select').each(function() {
if ($(this).val()) {
arr.push({
wearSenseId: $(this).attr('name'),
value: $(this).val()
});
}
});
return JSON.stringify(arr);
}
option.success = function(res) {
res = res.data;
if (res.code == '200') {
NETSALEEDIT.$tip(res.message, function() {}, 'growl-success');
} else {
NETSALEEDIT.$tip(res.message);
}
return false;
}
});
});