Showing
4 changed files
with
118 additions
and
56 deletions
@@ -13,11 +13,13 @@ module.exports=function(app) { | @@ -13,11 +13,13 @@ module.exports=function(app) { | ||
13 | 13 | ||
14 | app.post("/erpproduct/standard/update","productparm_update"); | 14 | app.post("/erpproduct/standard/update","productparm_update"); |
15 | 15 | ||
16 | - /*添加*/ | 16 | + app.post("/erpproduct/standard/add","productparm_add"); |
17 | + | ||
18 | +/* /!*添加*!/ | ||
17 | app.post("/erpproduct/standardSort/add","productparm_add"); | 19 | app.post("/erpproduct/standardSort/add","productparm_add"); |
18 | - /*修改*/ | 20 | + /!*修改*!/ |
19 | app.post("/erpproduct/standardSort/update","productparm_update"); | 21 | app.post("/erpproduct/standardSort/update","productparm_update"); |
20 | - | 22 | + */ |
21 | /*商品参数类别*/ | 23 | /*商品参数类别*/ |
22 | app.get("/erpproduct/standardSort/index","baserule.standardSort.Index",function(){ | 24 | app.get("/erpproduct/standardSort/index","baserule.standardSort.Index",function(){ |
23 | this.$extend={ | 25 | this.$extend={ |
@@ -10,14 +10,12 @@ module.exports={ | @@ -10,14 +10,12 @@ module.exports={ | ||
10 | }, | 10 | }, |
11 | add:{ | 11 | add:{ |
12 | title:'增加', | 12 | title:'增加', |
13 | - url: '/brandSeries/add', | 13 | + url: '/standard/addStandard', |
14 | params:[ | 14 | params:[ |
15 | - {name: 'seriesName', type: 'String'}, | ||
16 | - {name: 'shopsId', type: 'Number'}, | ||
17 | - {name: 'brandId', type: 'Number'}, | ||
18 | - {name: 'type', type: 'Number'}, | ||
19 | - {name: 'orderBy', type: 'Number'}, | ||
20 | - {name: 'seriesBanner', type: 'String'} | 15 | + {name: 'standardName', type: 'String'}, |
16 | + {name: 'standardSortId', type: 'Number'}, | ||
17 | + {name: 'sortId', type: 'Number'}, | ||
18 | + {name: 'orderBy', type: 'Number'} | ||
21 | ] | 19 | ] |
22 | }, | 20 | }, |
23 | update:{ | 21 | update:{ |
@@ -9,6 +9,8 @@ | @@ -9,6 +9,8 @@ | ||
9 | </div> | 9 | </div> |
10 | <div class="panel-col"> | 10 | <div class="panel-col"> |
11 | <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> | 11 | <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> |
12 | + <a id="add-btn" href="javascript:;" class="btn btn-info">新增</a> | ||
13 | + <a id="standardType-btn" href="/goods/netsale/batch" class="btn btn-primary large">参数类别管理</a> | ||
12 | </div> | 14 | </div> |
13 | 15 | ||
14 | <div class="panel-col2" style="width:40%;"> | 16 | <div class="panel-col2" style="width:40%;"> |
@@ -33,8 +35,8 @@ | @@ -33,8 +35,8 @@ | ||
33 | <div class="form-group"> | 35 | <div class="form-group"> |
34 | <label for="stortTypeName" class="col-sm-3 control-label">分类</label> | 36 | <label for="stortTypeName" class="col-sm-3 control-label">分类</label> |
35 | <div class="col-md-6"> | 37 | <div class="col-md-6"> |
36 | - <input type="hidden" name="" value="{id}" id="id" class="form-control" value="" required="required" pattern="" title=""> | ||
37 | - <input type="text" name="" value="{stortTypeName}" id="stortTypeName" class="form-control" value="" required="required" pattern="" title="" maxlength="20"> | 38 | + <input type="hidden" name="" value="[[id]]" id="id" class="form-control" value="" required="required" pattern="" title=""> |
39 | + <input type="text" name="" value="[[stortTypeName]]" id="stortTypeName" class="form-control" value="" required="required" pattern="" title="" maxlength="20"> | ||
38 | </div> | 40 | </div> |
39 | </div> | 41 | </div> |
40 | 42 | ||
@@ -43,8 +45,8 @@ | @@ -43,8 +45,8 @@ | ||
43 | 参数类别 | 45 | 参数类别 |
44 | </label> | 46 | </label> |
45 | <div class="col-md-6"> | 47 | <div class="col-md-6"> |
46 | - <select name="stortTypeId" id="stortTypeId" value="[[stortTypeId]]" tabindex="-1" required="required" title="" class="form-control height40"> | ||
47 | - <option value="[[id||'-1']]">[[standardSortName||"请选择参数类别"]]</option> | 48 | + <select name="stortTypeId" id="stortTypeId" value="[[id]]" tabindex="-1" required="required" title="" class="form-control height40"> |
49 | + <option value="[[id||'-1']]">[[standardSortName||"请选择参数"]]</option> | ||
48 | </select> | 50 | </select> |
49 | </div> | 51 | </div> |
50 | </div> | 52 | </div> |
@@ -52,7 +54,7 @@ | @@ -52,7 +54,7 @@ | ||
52 | <div class="form-group"> | 54 | <div class="form-group"> |
53 | <label for="standardName" class="col-sm-3 control-label">参数名称</label> | 55 | <label for="standardName" class="col-sm-3 control-label">参数名称</label> |
54 | <div class="col-md-6"> | 56 | <div class="col-md-6"> |
55 | - <input type="text" name="" value="{standardName}" id="standardName" class="form-control" value="" required="required" pattern="" title="" maxlength="20"> | 57 | + <input type="text" name="" value="[[standardName]]" id="standardName" class="form-control" value="" required="required" pattern="" title="" maxlength="20"> |
56 | </div> | 58 | </div> |
57 | </div> | 59 | </div> |
58 | 60 | ||
@@ -61,38 +63,11 @@ | @@ -61,38 +63,11 @@ | ||
61 | 排序 | 63 | 排序 |
62 | </label> | 64 | </label> |
63 | <div class="col-md-6"> | 65 | <div class="col-md-6"> |
64 | - <input id="orderBy" value="{orderBy}" class="form-control width300" type="text" required="required" placeholder="排序" maxlength="20"> | 66 | + <input id="orderBy" value="[[orderBy]]" class="form-control width300" type="text" required="required" placeholder="排序" maxlength="20"> |
65 | </div> | 67 | </div> |
66 | </div> | 68 | </div> |
67 | 69 | ||
68 | </script> | 70 | </script> |
69 | 71 | ||
70 | 72 | ||
71 | -<script type="text/template" id="onshelve-template"> | ||
72 | - <form class="shelve-form form-horizontal form-bordered"> | ||
73 | - <div class="panel panel-default"> | ||
74 | - <div class="panel-body nopadding"> | ||
75 | - | ||
76 | - <div class="form-group"> | ||
77 | - <div class="col-sm-3 height40">预上架时间:</div> | ||
78 | - <div class="col-sm-6"><input id="shelveTime" class="form-control" jsaction="time" type="text" placeholder="预上架时间" readonly> | ||
79 | - <span class="red">预上架请填写上架时间</span> | ||
80 | - </div> | ||
81 | - </div> | ||
82 | - <div class="form-group"> | ||
83 | - <a class="btn btn-info" data-type="2" href="javascript:;">上架上新</a> | ||
84 | - <a class="btn btn-info" data-type="1" href="javascript:;">上架不上新</a> | ||
85 | - </div> | ||
86 | - <div class="form-group"> | ||
87 | - <div class="col-sm-2 height40">预售时间:</div> | ||
88 | - <div class="col-sm-4"><input id="advanceBeginTime" class="form-control" jsaction="time:end:advanceEndTime" type="text" placeholder="预售开始时间" readonly></div> | ||
89 | - <div class="col-sm-4"><input id="advanceEndTime" class="form-control" jsaction="time:start:advanceBeginTime" type="text" placeholder="预售结束时间" readonly></div> | ||
90 | - <div class="col-sm-1"><a class="btn btn-info" data-type="5" href="javascript:;">确定</a></div> | ||
91 | - </div> | ||
92 | - </div> | ||
93 | - </div> | ||
94 | - </form> | ||
95 | -</script> | ||
96 | - | ||
97 | - | ||
98 | <%include '../../../common/views/__ui/footer'%> | 73 | <%include '../../../common/views/__ui/footer'%> |
@@ -4,20 +4,10 @@ var $ = require('jquery'), | @@ -4,20 +4,10 @@ var $ = require('jquery'), | ||
4 | 4 | ||
5 | window.batchOperateShelve = []; | 5 | window.batchOperateShelve = []; |
6 | 6 | ||
7 | +$("#add-btn").hide(); | ||
7 | var tabTree = new common.tabTree("#sortTree"); | 8 | var tabTree = new common.tabTree("#sortTree"); |
8 | tabTree.init(); | 9 | tabTree.init(); |
9 | 10 | ||
10 | -new common.dropDown({ | ||
11 | - el: '#stortTypeId', | ||
12 | - ajax: 'queryStortType', | ||
13 | - hash: true, | ||
14 | - params:function(){ | ||
15 | - return {sortId: smallSortId}; | ||
16 | - } | ||
17 | -}); | ||
18 | - | ||
19 | -var smallSortId=tabTree.selected[2] ? tabTree.selected[2].id : ""; | ||
20 | - | ||
21 | var g = new common.grid({ | 11 | var g = new common.grid({ |
22 | el: "#basicTable", | 12 | el: "#basicTable", |
23 | usepagesize:true, | 13 | usepagesize:true, |
@@ -34,6 +24,7 @@ var g = new common.grid({ | @@ -34,6 +24,7 @@ var g = new common.grid({ | ||
34 | }, { | 24 | }, { |
35 | display: '参数类别', | 25 | display: '参数类别', |
36 | render: function(item) { | 26 | render: function(item) { |
27 | + console.log(item); | ||
37 | return item.standardSort.standardSortName; | 28 | return item.standardSort.standardSortName; |
38 | } | 29 | } |
39 | }, { | 30 | }, { |
@@ -69,6 +60,10 @@ g.init("/erpproduct/prodcutparm/list"); | @@ -69,6 +60,10 @@ g.init("/erpproduct/prodcutparm/list"); | ||
69 | //筛选 | 60 | //筛选 |
70 | $("#filter-btn").click(function () { | 61 | $("#filter-btn").click(function () { |
71 | g.reload(1); | 62 | g.reload(1); |
63 | + var smallSortId=tabTree.selected[2] ? tabTree.selected[2].id : ""; | ||
64 | + if(smallSortId>0){ | ||
65 | + $("#add-btn").show(); | ||
66 | + } | ||
72 | }); | 67 | }); |
73 | 68 | ||
74 | //删除 | 69 | //删除 |
@@ -97,9 +92,10 @@ $(document).on('click', '.edit-class-btn', function () { | @@ -97,9 +92,10 @@ $(document).on('click', '.edit-class-btn', function () { | ||
97 | sortName=sortName+tabTree.selected[2].sortName; | 92 | sortName=sortName+tabTree.selected[2].sortName; |
98 | } | 93 | } |
99 | common.dialog.confirm("修改参数", | 94 | common.dialog.confirm("修改参数", |
100 | - common.util.__template($("#template").html(), | 95 | + common.util.__template2($("#template").html(), |
101 | {id: item.id, standardName: item.standardName, | 96 | {id: item.id, standardName: item.standardName, |
102 | - orderBy:item.orderBy, stortTypeName:sortName,stortTypeId:item.standardSort.standardSortName}) | 97 | + orderBy:item.orderBy, stortTypeName:sortName,standardSortName:item.standardSort.standardSortName |
98 | + ,standardSortId:item.standardSortId}) | ||
103 | , function () { | 99 | , function () { |
104 | common.util.__ajax({ | 100 | common.util.__ajax({ |
105 | url: '/erpproduct/standard/update', | 101 | url: '/erpproduct/standard/update', |
@@ -117,8 +113,99 @@ $(document).on('click', '.edit-class-btn', function () { | @@ -117,8 +113,99 @@ $(document).on('click', '.edit-class-btn', function () { | ||
117 | g.reload(); | 113 | g.reload(); |
118 | }); | 114 | }); |
119 | }); | 115 | }); |
116 | + new common.dropDown({ | ||
117 | + el: '#stortTypeId', | ||
118 | + ajax: 'queryStortType', | ||
119 | + hash: true, | ||
120 | + params:function(){ | ||
121 | + return {sortId: smallSortId}; | ||
122 | + } | ||
123 | + }); | ||
124 | + $('#stortTypeName').attr("disabled", true); | ||
120 | }); | 125 | }); |
121 | 126 | ||
127 | +$(document).on('click', '#add-btn', function () { | ||
128 | + var item = g.rows[$(this).data("index")]; | ||
129 | + var sortName=""; | ||
130 | + if(tabTree.selected[0]){ | ||
131 | + sortName=sortName+tabTree.selected[0].sortName+"/"; | ||
132 | + } | ||
133 | + if(tabTree.selected[1]){ | ||
134 | + sortName=sortName+tabTree.selected[1].sortName+"/"; | ||
135 | + } | ||
136 | + if(tabTree.selected[2]){ | ||
137 | + sortName=sortName+tabTree.selected[2].sortName; | ||
138 | + } | ||
139 | + var smallSortId=tabTree.selected[2] ? tabTree.selected[2].id : ""; | ||
140 | + common.dialog.confirm("新增参数", | ||
141 | + common.util.__template2($("#template").html(), | ||
142 | + {standardName: common.util.__input("standardName"), | ||
143 | + orderBy: common.util.__input("orderBy"), stortId:smallSortId,stortTypeName:sortName | ||
144 | + ,standardSortId:common.util.__input("standardSortId")}) | ||
145 | + , function () { | ||
146 | + common.util.__ajax({ | ||
147 | + url: '/erpproduct/standard/add', | ||
148 | + data: (function () { | ||
149 | + var input = $('#standardName').val(); | ||
150 | + if (input === '' || $.trim(input) === '')return "参数名称不能为空"; | ||
151 | + return { | ||
152 | + stortId:smallSortId, | ||
153 | + standardName: $("#standardName").val(), | ||
154 | + orderBy: $("#orderBy").val(), | ||
155 | + standardSortId:$("#stortTypeId").val() | ||
156 | + }; | ||
157 | + })() | ||
158 | + }, function () { | ||
159 | + g.reload(); | ||
160 | + }); | ||
161 | + }); | ||
162 | + new common.dropDown({ | ||
163 | + el: '#stortTypeId', | ||
164 | + ajax: 'queryStortType', | ||
165 | + hash: true, | ||
166 | + params:function(){ | ||
167 | + return {sortId: smallSortId}; | ||
168 | + } | ||
169 | + }); | ||
170 | + $('#stortTypeName').attr("disabled", true); | ||
171 | +}); | ||
172 | + | ||
173 | + | ||
174 | + | ||
175 | +/*$("#add-btn").click(function(){ | ||
176 | + attributeOp("新建", '/erpproduct/standard/add', {"orderBy":0}); | ||
177 | + $('#stortTypeName').attr("disabled", true); | ||
178 | +});*/ | ||
179 | + | ||
180 | +function attributeOp(prefix, url, item) { | ||
181 | + | ||
182 | + var a = new common.edit(".confirm",BUCKET); | ||
183 | + common.dialog.confirm(prefix + "产品参数", common.util.__template2($("#template").html(), item), function () { | ||
184 | + | ||
185 | + return a.submit(url, function (option) { | ||
186 | + option.data.categoryId = item.categoryId; | ||
187 | + option.data.attributeId = item.attributeId; | ||
188 | + option.data.shopsId = common.util.__input("shopsId"); | ||
189 | + option.success = function (res) { | ||
190 | + res = res; | ||
191 | + if (res.code == "200") { | ||
192 | + a.$tip("提交成功", function () { | ||
193 | + g.reload(); | ||
194 | + }, 'growl-success'); | ||
195 | + } else { | ||
196 | + a.$tip(res.message); | ||
197 | + } | ||
198 | + return false; | ||
199 | + }, | ||
200 | + option.error = function (res) { | ||
201 | + a.$tip(res.message); | ||
202 | + } | ||
203 | + }); | ||
204 | + | ||
205 | + }); | ||
206 | + | ||
207 | + a.init(); | ||
208 | +} | ||
122 | 209 | ||
123 | 210 | ||
124 | 211 |
-
Please register or login to post a comment