goods-params.js
1.95 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
var $ = require('jquery'),
common = require('../../common/common');
var specialAttrBo = window.NETSALEDATA.specialAttrBo || {
productSkn: window.NETSALEDATA.baseProductInfo.baseProduct.productSkn,
washTipsList: [],
materialList: []
};
var washTipsList = specialAttrBo.washTipsList;
var materialList = specialAttrBo.materialList;
console.log(window.NETSALEDATA);
var e = new common.edit("#taoyu1");
common.util.__ajax({
url: '/netSale/queryAllBySortId4Select',
data: {
param: window.NETSALEDATA.baseProductInfo.baseProduct.maxSortId
}
}, function(res) {
$("#material-group").html(common.util.__template2($("#material-params").html(), res || {}));
var materials = [];
for (var i = 0; i < materialList.length; i++) {
materials[i] = materialList[i].id;
}
$("#material").val(materials.join("|"));
e.init();
$(document).on('change', '.material', function() {
var items = $("#material").val().split("|");
for (var i = 0; i < items.length; i++) {
materialList[i] = {
"id": parseInt(items[i])
};
}
});
});
common.util.__ajax({
url: '/netSale/getAll4Select',
data: {}
}, function(res) {
$("#washTip-group").html(common.util.__template2($("#washTip-params").html(), res || {}));
var washTips = [];
for (var i = 0; i < washTipsList.length; i++) {
washTips[i] = washTipsList[i].sortId;
}
$("#washTips").val(washTips.join("|"));
e.init();
$(document).on('change', '.washTips', function() {
var items = $("#washTips").val().split("|");
for (var i = 0; i < items.length; i++) {
washTipsList[i] = {
"sortId": parseInt(items[i])
};
}
});
}, true);
$("#propertySave").on('click', function() {
var washTips = $("#washTips").val() || "";
var productMaterial = $("#material").val() || "";
common.util.__ajax({
url: '/netSale/saveProductParam',
data: {
productSkn: specialAttrBo.productSkn,
washTips: washTips.replace(/\|/g, ","),
productMaterial: productMaterial.replace(/\|/g, ",")
}
}, function() {
// body...
});
});