goods.limitcategory.Index.js
5.52 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
webpackJsonp([39],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by yoho on 2016/6/28.
*/
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
var renderHd = false;//加载表格头部
var tabTree = new common.tabTree("#sort");
tabTree.init();
//分类Id
new common.dropDown({
el: "#SortId", ajax: "fuzzySearchProductSortIds"
});
//分类级别
new common.dropDown({
el: "#SortLevel", ajax: "searchAllSortLevel"
});
var Bll = {
dataList: [],
searchList: {},
selectSort: function () {
var select = tabTree.getAddress();
if (select[0].id) {
Bll.searchList.sortNameId = select[select.length - 1].id;
}
},
getDataList: function () {
Bll.selectSort();
common.util.__ajax({
url: "/product/queryProductSortRefundAllReferdSortInfo",
async: false,
data: Bll.searchList
}, function (res) {
Bll.dataList = res.data;
}, true);
},
reload: function () {
renderHd = false;
Bll.getDataList();
g.init(Bll.dataList);
}
};
/**
* 列表
*/
var g = new common.grid({
el: "#basicTable",
columns: [
{
display: '',
name: 'foler',
render: function (item) {
var html = "", top = true, isRefundExchange = 1;
if (!renderHd) {
html += $('#tableHdTemp').html();
init(item);
renderHd = true;
} else {
init(item)
}
return html;
function init(item) {
if (top) {
html += "<div id='category_id_" + item.id + "' class='level-wrap clearfix'>";
top = false;
} else {
html += "<div id='category_id_" + item.id + "' class='level-wrap clearfix level_" + item.sortLevel + "' style='display: none'>";
}
html += common.util.__template2($('#tableTemp2').html(), item);
if (item.subList.length>0) {//如果有子集
for (var i = 0; i < item.subList.length; i++) {
init(item.subList[i]);
}
}
html += "</div>";
}
}
}
]
});
Bll.getDataList();
g.init(Bll.dataList);
//打开层级类目
$(document).on('click', '.folder', function () {
var $wrap = $(this).parent();
if (!$(this).hasClass('open')) {
var isfont = $(this).data('name');
if(isfont==0){
$wrap.find('.level-wrap .operate a').hide();
}
if ($wrap.find('> .level-wrap').size() > 0) {
var position = $(this).css("background-position");
var a = position.substring(0, position.indexOf("px"));
$wrap.find('> .level-wrap').show().find(".folder").css("background-position", (parseInt(a) + 36) + "px");
$(this).addClass('open');
}
} else {
$(this).removeClass('open');
if ($wrap.find('.level-wrap').size() > 0) {
$wrap.find('.level-wrap').hide().find(".folder").removeClass('open').css("background-position", "12px center");
}
}
});
//切换状态重载列表
$('input[name="state"]').on('change', function () {
$(this).parent().addClass('current').siblings().removeClass('current');
g.reload();
});
$(document).on('change', '#categoryName', function () {
$(this).removeClass("error")
});
/**
* 监控筛选项
*/
$(document).on('change', '#SortId', function () {
if ($(this).val() == -1) {
Bll.searchList.sortId = ""
} else {
Bll.searchList.sortId = $(this).val() ? $(this).val() : "";
}
});
$(document).on('change', '#SortLevel', function () {
if ($(this).val() == -1) {
Bll.searchList.sortLevel = ""
} else {
Bll.searchList.sortLevel = $(this).val() ? $(this).val() : "";
}
});
/**
* 筛选按钮
*/
$(document).on('click', "#filter-btn", function () {
Bll.reload();
});
//导出
$(document).on('click', '#export-btn', function () {
Bll.selectSort();
var queryConf = JSON.stringify(Bll.searchList);
window.open("/ajax/down?queryConf=" + queryConf + "&type=productSortRefundExchangeExport");
});
/**
* 开启
*/
$(document).on('click', ".close-category", function () {
var id = $(this).parent().data('id');
common.dialog.confirm("警告",
"开启后关联商品会一并开启,请谨慎操作!",
function () {
common.util.__ajax({
url: '/product/closeProductSortRefundExchange',
data: {
param: id
}
}, function () {
Bll.reload();
}, true);
});
});
/**
* 关闭
*/
$(document).on('click', ".open-category", function () {
var id = $(this).parent().data('id');
common.dialog.confirm("警告",
"关闭后关联商品会一并关闭,请谨慎操作!",
function () {
common.util.__ajax({
url: '/product/openProductSortRefundExchange',
data: {
param: id
}
}, function () {
Bll.reload();
}, true);
});
});
/***/ }
]);