Merge branch 'dev_商品池功能优化' into grey
Showing
4 changed files
with
205 additions
and
22 deletions
@@ -35,6 +35,7 @@ module.exports = function (app) { | @@ -35,6 +35,7 @@ module.exports = function (app) { | ||
35 | 35 | ||
36 | //详情添加SKN | 36 | //详情添加SKN |
37 | app.post("/market/productPool/addProductPoolDetailBo", "ProductPool_addProductPoolDetailBo"); | 37 | app.post("/market/productPool/addProductPoolDetailBo", "ProductPool_addProductPoolDetailBo"); |
38 | - | 38 | + //详情批量添加SKN |
39 | + app.post("/market/productPool/batchAddProductPool", "ProductPool_batchAddProductPool"); | ||
39 | 40 | ||
40 | }; | 41 | }; |
@@ -56,6 +56,11 @@ module.exports = { | @@ -56,6 +56,11 @@ module.exports = { | ||
56 | url: '/pool/queryProductPoolDetailPage', | 56 | url: '/pool/queryProductPoolDetailPage', |
57 | params: { | 57 | params: { |
58 | id: {type: Number}, | 58 | id: {type: Number}, |
59 | + productSkn:{type: Number}, | ||
60 | + maxSortId:{type: Number}, | ||
61 | + middleSortId:{type: Number}, | ||
62 | + smallSortId:{type: Number}, | ||
63 | + brandId:{type: Number}, | ||
59 | page: {type: Number}, | 64 | page: {type: Number}, |
60 | size: {type: Number,default:10} | 65 | size: {type: Number,default:10} |
61 | } | 66 | } |
@@ -76,7 +81,16 @@ module.exports = { | @@ -76,7 +81,16 @@ module.exports = { | ||
76 | productskn: {type: Number}, | 81 | productskn: {type: Number}, |
77 | producttype: {type: Number} | 82 | producttype: {type: Number} |
78 | } | 83 | } |
84 | + }, | ||
85 | + batchAddProductPool: { | ||
86 | + title: "批量添加SKN", | ||
87 | + url: '/pool/batchAddProductPool', | ||
88 | + params: { | ||
89 | + activityid: {type: Number}, | ||
90 | + id: {type: Number}, | ||
91 | + producttype: {type: Number}, | ||
92 | + productSkns: {type: String} | ||
93 | + } | ||
79 | } | 94 | } |
80 | - | ||
81 | } | 95 | } |
82 | }; | 96 | }; |
@@ -10,10 +10,11 @@ | @@ -10,10 +10,11 @@ | ||
10 | <div class="panel-body"> | 10 | <div class="panel-body"> |
11 | <div class="row"> | 11 | <div class="row"> |
12 | <div class="panel-col"> | 12 | <div class="panel-col"> |
13 | - <input type="text" class="form-control" id="search-id" placeholder="输入编号" onkeyup="this.value=this.value.replace(/\D/gi,'')" /> | 13 | + <input type="text" class="form-control" id="search-id" placeholder="输入编号" |
14 | + onkeyup="this.value=this.value.replace(/\D/gi,'')"/> | ||
14 | </div> | 15 | </div> |
15 | <div class="panel-col"> | 16 | <div class="panel-col"> |
16 | - <input type="text" class="form-control" id="search-name" placeholder="输入名称" /> | 17 | + <input type="text" class="form-control" id="search-name" placeholder="输入名称"/> |
17 | </div> | 18 | </div> |
18 | <div class="panel-col"> | 19 | <div class="panel-col"> |
19 | <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> | 20 | <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> |
@@ -31,12 +32,12 @@ | @@ -31,12 +32,12 @@ | ||
31 | 32 | ||
32 | <script type="text/template" id="template"> | 33 | <script type="text/template" id="template"> |
33 | <div class="form-horizontal" id="productEdit"> | 34 | <div class="form-horizontal" id="productEdit"> |
34 | - <input type="hidden" value="[[id]]" id="id" /> | 35 | + <input type="hidden" value="[[id]]" id="id"/> |
35 | 36 | ||
36 | <div class="form-group"> | 37 | <div class="form-group"> |
37 | <label for="poolName" class="col-sm-3 control-label">商品池名称:</label> | 38 | <label for="poolName" class="col-sm-3 control-label">商品池名称:</label> |
38 | <div class="col-sm-5"> | 39 | <div class="col-sm-5"> |
39 | - <input type="text" id="poolName" value="[[poolName]]" class="form-control" /> | 40 | + <input type="text" id="poolName" value="[[poolName]]" class="form-control"/> |
40 | </div> | 41 | </div> |
41 | <div class="col-sm-2"><label style="color: #ff0000; line-height: 40px"> * 必填</label></div> | 42 | <div class="col-sm-2"><label style="color: #ff0000; line-height: 40px"> * 必填</label></div> |
42 | </div> | 43 | </div> |
@@ -44,14 +45,14 @@ | @@ -44,14 +45,14 @@ | ||
44 | <div class="form-group"> | 45 | <div class="form-group"> |
45 | <label for="comment" class="col-sm-3 control-label">说明:</label> | 46 | <label for="comment" class="col-sm-3 control-label">说明:</label> |
46 | <div class="col-sm-5"> | 47 | <div class="col-sm-5"> |
47 | - <input type="text" id="comment" value="[[comment]]" class="form-control" /> | 48 | + <input type="text" id="comment" value="[[comment]]" class="form-control"/> |
48 | </div> | 49 | </div> |
49 | </div> | 50 | </div> |
50 | 51 | ||
51 | <div class="form-group"> | 52 | <div class="form-group"> |
52 | <label for="producttype" class="col-sm-3 control-label">商品:</label> | 53 | <label for="producttype" class="col-sm-3 control-label">商品:</label> |
53 | <div class="col-sm-5"> | 54 | <div class="col-sm-5"> |
54 | - <select id="producttype" class="form-control" > | 55 | + <select id="producttype" class="form-control"> |
55 | <option value="-1">-- 请选择添加商品类型 --</option> | 56 | <option value="-1">-- 请选择添加商品类型 --</option> |
56 | <option value="1">SKN</option> | 57 | <option value="1">SKN</option> |
57 | <option value="2" disabled>SKU(暂不支持)</option> | 58 | <option value="2" disabled>SKU(暂不支持)</option> |
@@ -66,19 +67,90 @@ | @@ -66,19 +67,90 @@ | ||
66 | <div class="col-sm-9"> | 67 | <div class="col-sm-9"> |
67 | <div class="row"> | 68 | <div class="row"> |
68 | <div class="col-sm-7"> | 69 | <div class="col-sm-7"> |
69 | - <input id="path" class="form-control" type="text" disabled="disabled" style="cursor:default; width: 218px"> | 70 | + <input id="path" class="form-control" type="text" disabled="disabled" |
71 | + style="cursor:default; width: 218px"> | ||
70 | </div> | 72 | </div> |
71 | <div class="col-sm-4" style="position: relative; padding-left: 0;"> | 73 | <div class="col-sm-4" style="position: relative; padding-left: 0;"> |
72 | - <input id="productSkn" name="productSkn" class="btn btn-default excel-upload" type="file" style="position: absolute; top: 0;left: 10px; height:37px"> | 74 | + <input id="productSkn" name="productSkn" class="btn btn-default excel-upload" type="file" |
75 | + style="position: absolute; top: 0;left: 10px; height:37px"> | ||
73 | <div class="file-name btn btn-info">请选择文件</div> | 76 | <div class="file-name btn btn-info">请选择文件</div> |
74 | - <input type="hidden" id="sknVal" /> | 77 | + <input type="hidden" id="sknVal"/> |
75 | </div> | 78 | </div> |
76 | </div> | 79 | </div> |
77 | <div style="margin: 10px 0 0; color:#f0ad4e"> | 80 | <div style="margin: 10px 0 0; color:#f0ad4e"> |
78 | - * 要导入的数据类型必须和所选类型相同。<br> | ||
79 | - EXCEL文件只有一列。 | 81 | + 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br> |
82 | + 2、<a href="/ajax/link/productpool" style="margin: 0; text-decoration: underline">下载样例.xlsx</a> | ||
80 | </div> | 83 | </div> |
81 | </div> | 84 | </div> |
82 | </div> | 85 | </div> |
83 | </div> | 86 | </div> |
87 | +</script> | ||
88 | + | ||
89 | + | ||
90 | +<script type="text/template" id="batchTemplate"> | ||
91 | + | ||
92 | + <div class="panel panel-default"> | ||
93 | + <div class="panel-body"> | ||
94 | + <div class="form-group"> | ||
95 | + <div class="col-sm-9"> | ||
96 | + <div class="row"> | ||
97 | + <div class="col-sm-7"> | ||
98 | + <input id="bathcPath" class="form-control" type="text" disabled="disabled" | ||
99 | + style="cursor:default; width: 218px"> | ||
100 | + </div> | ||
101 | + <div class="col-sm-4" style="position: relative; padding-left: 0;"> | ||
102 | + <input id="batchProductSkn" name="productSkn" class="btn btn-default excel-upload" | ||
103 | + type="file" | ||
104 | + style="position: absolute; top: 0;left: 10px; height:37px"> | ||
105 | + <div class="file-name btn btn-info">请选择文件</div> | ||
106 | + <input type="hidden" id="sknVal2"/> | ||
107 | + </div> | ||
108 | + </div> | ||
109 | + <div style="margin: 10px 0 0; color:#f0ad4e"> | ||
110 | + 1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br> | ||
111 | + 2、<a href="/ajax/link/productpool" style="margin: 0; text-decoration: underline">下载样例.xlsx</a> | ||
112 | + </div> | ||
113 | + </div> | ||
114 | + </div> | ||
115 | + </div> | ||
116 | + </div> | ||
117 | + | ||
118 | +</script> | ||
119 | +<script type="text/template" id="detailPoolTemplate"> | ||
120 | + <div class="form-group"> | ||
121 | + <label class="col-sm-2 control-label">添加SKN到商品池: </label> | ||
122 | + <div class="col-sm-3"> | ||
123 | + <input type="text" id="addSknText" class="form-control input-form" placeholder="输入SKN"> | ||
124 | + <input type="hidden" id="addSknType" value="[[producttype]]"> | ||
125 | + <input type="hidden" id="addSknPoolId" value="[[id]]"> | ||
126 | + </div> | ||
127 | + <div class="col-sm-1"> | ||
128 | + <a href="javascript:;" id="addSknBtn" class="btn btn-info">+添加</a> | ||
129 | + </div> | ||
130 | + </div> | ||
131 | + | ||
132 | + <div class="form-group"> | ||
133 | + <div class="col-sm-2"> | ||
134 | + <input type="text" id="productSkn" class="form-control input-form" placeholder="查询SKN"> | ||
135 | + </div> | ||
136 | + <div class="col-sm-2"> | ||
137 | + <select name="brandId" id="brandId" class="form-control"> | ||
138 | + <option value="-1">请选择品牌</option> | ||
139 | + </select> | ||
140 | + </div> | ||
141 | + <div class="col-sm-3"> | ||
142 | + <div id="sortTree" class="form-control height40" style="border: 0px; padding: 0px;"></div> | ||
143 | + </div> | ||
144 | + | ||
145 | + <div class="panel-col"> | ||
146 | + <a href="javascript:;" id="queryBtn" class="btn btn-info">查询</a> | ||
147 | + <a href="javascript:;"id="queryAllBtn" class="btn btn-info">全部</a> | ||
148 | + </div> | ||
149 | + | ||
150 | + <div class="col-sm-2"> | ||
151 | + <a href="javascript:;" id="batchAddPool" class="btn btn-primary">批量导入</a> | ||
152 | + </div> | ||
153 | + </div> | ||
154 | + | ||
155 | + <div id="faGrid"></div> | ||
84 | </script> | 156 | </script> |
@@ -3,7 +3,7 @@ var $ = require('jquery'), | @@ -3,7 +3,7 @@ var $ = require('jquery'), | ||
3 | 3 | ||
4 | var ZeroClipboard = require("../../../common/util/ZeroClipboard.min"); | 4 | var ZeroClipboard = require("../../../common/util/ZeroClipboard.min"); |
5 | ZeroClipboard.config({swfPath: "http://cdn.yoho.cn/yohobuy-portal/assets/images/ZeroClipboard.swf"}); | 5 | ZeroClipboard.config({swfPath: "http://cdn.yoho.cn/yohobuy-portal/assets/images/ZeroClipboard.swf"}); |
6 | - | 6 | +var tabTree; |
7 | var g = new common.grid({ | 7 | var g = new common.grid({ |
8 | el: "#product-pool", | 8 | el: "#product-pool", |
9 | hash: false, | 9 | hash: false, |
@@ -50,13 +50,7 @@ var Bll = { | @@ -50,13 +50,7 @@ var Bll = { | ||
50 | new common.dialog({ | 50 | new common.dialog({ |
51 | title: "商品池详情", | 51 | title: "商品池详情", |
52 | width: "80%", | 52 | width: "80%", |
53 | - content: '<div class="addSkn form-inline"><div class="form-group"?>' + | ||
54 | - '<label style="margin-right: 10px; font-size: 16px; font-weight: bold">添加SKN到商品池:</label>' + | ||
55 | - '<input type="text" id="addSknText" class="form-control" placeholder="输入SKN">' + | ||
56 | - '<input type="hidden" id="addSknType" value="'+obj.producttype+'">' + | ||
57 | - '<input type="hidden" id="addSknPoolId" value="'+obj.id+'">' + | ||
58 | - '<a id="addSknBtn" class="btn btn-info" style="margin-left: 15px"><i class="fa fa-plus"></i> 添加</a></div></div>' + | ||
59 | - '<div id="faGrid" style="overflow:auto; margin-top: 15px"></div>', | 53 | + content: common.util.__template2($("#detailPoolTemplate").html(), obj), |
60 | button: [{ | 54 | button: [{ |
61 | value: "确认", css:"btn-primary", | 55 | value: "确认", css:"btn-primary", |
62 | callback: function () {//局部刷新列表SKN个数 | 56 | callback: function () {//局部刷新列表SKN个数 |
@@ -65,8 +59,21 @@ var Bll = { | @@ -65,8 +59,21 @@ var Bll = { | ||
65 | }] | 59 | }] |
66 | }); | 60 | }); |
67 | $('.modal-dialog .close').hide(); | 61 | $('.modal-dialog .close').hide(); |
62 | + tabTree = new common.tabTree("#sortTree"); | ||
63 | + tabTree.init(); | ||
64 | + | ||
65 | + $("body").bind("click", function(){ | ||
66 | + tabTree.reset(); | ||
67 | + }); | ||
68 | 68 | ||
69 | - grid.options.parms = function () {return {id: obj.id}}; | 69 | + new common.dropDown({ |
70 | + el: '#brandId', | ||
71 | + ajax: 'brand', | ||
72 | + hash: true | ||
73 | + }); | ||
74 | + grid.options.parms = function () {return {id: obj.id, | ||
75 | + productSkn:common.util.__input('productSkn') | ||
76 | + }}; | ||
70 | grid.init('/market/productPool/queryProductPoolDetailPage'); | 77 | grid.init('/market/productPool/queryProductPoolDetailPage'); |
71 | }, | 78 | }, |
72 | 79 | ||
@@ -119,6 +126,45 @@ var Bll = { | @@ -119,6 +126,45 @@ var Bll = { | ||
119 | }); | 126 | }); |
120 | }, | 127 | }, |
121 | 128 | ||
129 | + //批量上传 | ||
130 | + batchAddPool: function (type,url,obj) { | ||
131 | + common.dialog.confirm("批量添加SKN", | ||
132 | + common.util.__template2($("#batchTemplate").html(),obj), | ||
133 | + function () { | ||
134 | + common.util.__ajax({ | ||
135 | + url: url, | ||
136 | + data: { | ||
137 | + id: common.util.__input('addSknPoolId'), | ||
138 | + producttype: common.util.__input('addSknType'), | ||
139 | + productSkns: $("#sknVal2").val().replace("[", "").replace("]", "") | ||
140 | + } | ||
141 | + }, function (res) {//局部刷新商品池名称,说明 | ||
142 | + if (res.code == 200) { | ||
143 | + grid.init('/market/productPool/queryProductPoolDetailPage'); | ||
144 | + } else { | ||
145 | + common.util.__tip(res.message); | ||
146 | + } | ||
147 | + }); | ||
148 | + } | ||
149 | + ); | ||
150 | + //上传文件 | ||
151 | + common.edit.ajaxfileupload("#batchProductSkn", { | ||
152 | + params: { | ||
153 | + type: "productPool", | ||
154 | + __type: "batch-import" | ||
155 | + }, | ||
156 | + onComplete: function (res) { | ||
157 | + if (res.code == 200) { | ||
158 | + common.util.__tip(res.message, 'success'); | ||
159 | + $("#sknVal2").val(JSON.stringify(res.data.productSkn)); | ||
160 | + $("#bathcPath").val($("#batchProductSkn").val()); | ||
161 | + } else { | ||
162 | + common.util.__tip(res.message); | ||
163 | + } | ||
164 | + } | ||
165 | + }); | ||
166 | + }, | ||
167 | + | ||
122 | //清空商品池 | 168 | //清空商品池 |
123 | emptyPool: function (obj,index) { | 169 | emptyPool: function (obj,index) { |
124 | common.dialog.confirm("清空商品池确认", "确认清空商品池:<font color='red'>【"+obj.poolName+"】</font>么?", function () { | 170 | common.dialog.confirm("清空商品池确认", "确认清空商品池:<font color='red'>【"+obj.poolName+"】</font>么?", function () { |
@@ -180,6 +226,18 @@ $(document).on("click", "#editPool", function () { | @@ -180,6 +226,18 @@ $(document).on("click", "#editPool", function () { | ||
180 | Bll.editPool(1, "/market/productPool/updateProductPool", item, index); | 226 | Bll.editPool(1, "/market/productPool/updateProductPool", item, index); |
181 | }); | 227 | }); |
182 | 228 | ||
229 | +//批量添加商品池 | ||
230 | +$(document).on("click", "#batchAddPool", function () { | ||
231 | + var item = function () { | ||
232 | + return { | ||
233 | + /*id: 166, | ||
234 | + producttype: 1*/ | ||
235 | + }; | ||
236 | + }; | ||
237 | + Bll.batchAddPool(1, "/market/productPool/batchAddProductPool", item); | ||
238 | +}); | ||
239 | + | ||
240 | + | ||
183 | //清空商品池 | 241 | //清空商品池 |
184 | $(document).on("click", "#emptyPool", function () { | 242 | $(document).on("click", "#emptyPool", function () { |
185 | var index = $(this).data("index"); | 243 | var index = $(this).data("index"); |
@@ -234,6 +292,44 @@ $(document).on("click", "#addSknBtn", function () { | @@ -234,6 +292,44 @@ $(document).on("click", "#addSknBtn", function () { | ||
234 | } | 292 | } |
235 | }); | 293 | }); |
236 | 294 | ||
295 | +//查询商品池 | ||
296 | +$(document).on("click", "#queryBtn", function () { | ||
297 | + if(isNaN($('#productSkn').val())){ | ||
298 | + common.util.__tip("SKN必须是数字格式!"); | ||
299 | + return false; | ||
300 | + } | ||
301 | + if(($('#productSkn').val().length>10)){ | ||
302 | + common.util.__tip("SKN过长!"); | ||
303 | + return false; | ||
304 | + } | ||
305 | + grid.options.parms = function () {return { | ||
306 | + id:common.util.__input('addSknPoolId'), | ||
307 | + productSkn:common.util.__input('productSkn'), | ||
308 | + maxSortId: tabTree.selected[0] ? tabTree.selected[0].id : "", | ||
309 | + middleSortId: tabTree.selected[1] ? tabTree.selected[1].id : "", | ||
310 | + smallSortId: tabTree.selected[2] ? tabTree.selected[2].id : "", | ||
311 | + brandId: common.util.__input("brandId"), | ||
312 | + }}; | ||
313 | + grid.init('/market/productPool/queryProductPoolDetailPage'); | ||
314 | +}); | ||
315 | +//查询全部商品池 | ||
316 | +$(document).on("click", "#queryAllBtn", function () { | ||
317 | + $('#productSkn').val(''); | ||
318 | + $("#brandId").val("-1"); | ||
319 | + new common.dropDown({ | ||
320 | + el: '#brandId', | ||
321 | + ajax: 'brand', | ||
322 | + hash: true | ||
323 | + }); | ||
324 | + tabTree = new common.tabTree("#sortTree"); | ||
325 | + tabTree.init(); | ||
326 | + | ||
327 | + grid.options.parms = function () {return { | ||
328 | + id:common.util.__input('addSknPoolId'), | ||
329 | + }}; | ||
330 | + grid.init('/market/productPool/queryProductPoolDetailPage'); | ||
331 | +}); | ||
332 | + | ||
237 | //删除详情商品 | 333 | //删除详情商品 |
238 | $(document).on("click", ".delbtn", function () { | 334 | $(document).on("click", ".delbtn", function () { |
239 | var item = grid.rows[$(this).data("index")]; | 335 | var item = grid.rows[$(this).data("index")]; |
-
Please register or login to post a comment