Fixed: 修复销售类目标签管理接口参数异常
Showing
1 changed file
with
29 additions
and
1 deletions
@@ -13,7 +13,7 @@ var g = new common.grid({ | @@ -13,7 +13,7 @@ var g = new common.grid({ | ||
13 | el: "#basicTable", | 13 | el: "#basicTable", |
14 | parms: function() { | 14 | parms: function() { |
15 | return { | 15 | return { |
16 | - categoryId: $('#categoryId').val(), | 16 | + categoryId: getCategoryId(), |
17 | status: $('.state-select').find('.current').find('input').val() | 17 | status: $('.state-select').find('.current').find('input').val() |
18 | } | 18 | } |
19 | }, | 19 | }, |
@@ -130,3 +130,31 @@ $(document).on('click', '.open-btn', function() { | @@ -130,3 +130,31 @@ $(document).on('click', '.open-btn', function() { | ||
130 | 130 | ||
131 | }); | 131 | }); |
132 | 132 | ||
133 | +function getCategoryId() { | ||
134 | + var categoryId = $('#categoryId').val(); | ||
135 | + categoryId = categoryId ? categoryId : getCategoryIdFromUrl(); | ||
136 | + | ||
137 | + if(categoryId) { | ||
138 | + return categoryId; | ||
139 | + } else { | ||
140 | + common.util.__tip("无法获取销售类目ID,请确认!", "warning"); | ||
141 | + return false; | ||
142 | + } | ||
143 | +} | ||
144 | + | ||
145 | +function getCategoryIdFromUrl() { | ||
146 | + // sale/category/tag/1#page=1 | ||
147 | + var uri = location.href + ""; | ||
148 | + var uriArr = uri.split("/tag/"); | ||
149 | + if(uriArr && uriArr.length > 0) { | ||
150 | + uri = uriArr[1]; | ||
151 | + var index = uri.indexOf('#'); | ||
152 | + if(index != -1) { | ||
153 | + uri = uri.substring(0, index); | ||
154 | + } | ||
155 | + | ||
156 | + return uri; | ||
157 | + } | ||
158 | + | ||
159 | + return ""; | ||
160 | +} |
-
Please register or login to post a comment