goods-sort.js
1.55 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
var $ = require('jquery'),
common = require('../../common/common');
if(window.NETSALEDATA) {
var searchSortList = [];
if(window.NETSALEDATA.searchSortList) {
searchSortList = window.NETSALEDATA.searchSortList;
}
for(var i = 0; i < searchSortList.length; i++) {
if(searchSortList[i].modelId == 1)
$("#sort0").val(searchSortList[i].intValue);
else if(searchSortList[i].modelId == 2)
$("#sort1").val(searchSortList[i].intValue);
else if(searchSortList[i].modelId == 3)
$("#sort2").val(searchSortList[i].intValue);
}
var item = [];
for (var i = 0; i < 3; i++) {
item[i] = {
productSkn:window.NETSALEDATA.baseProductInfo.baseProduct.productSkn,
modelId:i + 1,
projectId:1,
intValue:parseInt($("#sort" + i).val())
};
}
for(var i = 0; i < 3; i++) {
for (var j = 0; j < searchSortList.length; j++) {
if(searchSortList[j].modelId == item[i].modelId) {
item[i].id = searchSortList[j].id;
break;
}
}
}
window.NETSALEDATA.searchSortList = item;
$('#sort-save').on('click', function () {
common.util.__ajax({
url:'/netSale/saveSearchSort',
data:{searchSortList:JSON.stringify(window.NETSALEDATA.searchSortList)}
},function() {
});
});
$("#sort0").on('change', function() {
window.NETSALEDATA.searchSortList[0].intValue = parseInt($("#sort0").val());
});
$("#sort1").on('change', function() {
window.NETSALEDATA.searchSortList[1].intValue = parseInt($("#sort1").val());
});
$("#sort2").on('change', function() {
window.NETSALEDATA.searchSortList[2].intValue = parseInt($("#sort2").val());
});
}