Showing
8 changed files
with
55 additions
and
33 deletions
@@ -285,7 +285,7 @@ edit.prototype={ | @@ -285,7 +285,7 @@ edit.prototype={ | ||
285 | } | 285 | } |
286 | }; | 286 | }; |
287 | callback&&callback(options); | 287 | callback&&callback(options); |
288 | - $.ajax(options); | 288 | + //$.ajax(options); |
289 | return false; | 289 | return false; |
290 | }, | 290 | }, |
291 | __listen:function(key,o,callback){ | 291 | __listen:function(key,o,callback){ |
@@ -92,10 +92,8 @@ var ENUM={ | @@ -92,10 +92,8 @@ var ENUM={ | ||
92 | data:g.options.parms() | 92 | data:g.options.parms() |
93 | 93 | ||
94 | },function(res){ | 94 | },function(res){ |
95 | - for(var key in res.data){ | ||
96 | - ENUM.tips[key]=res.data[key]; | ||
97 | - } | ||
98 | - t.init(ENUM.tips); | 95 | + var __dt=$.extend({},ENUM.tips,res.data); |
96 | + t.init(__dt); | ||
99 | },true); | 97 | },true); |
100 | },400); | 98 | },400); |
101 | } | 99 | } |
@@ -246,14 +246,15 @@ var Bll={ | @@ -246,14 +246,15 @@ var Bll={ | ||
246 | }); | 246 | }); |
247 | }); | 247 | }); |
248 | }, | 248 | }, |
249 | - addInput:function(label,name){ | 249 | + addInput:function(name,label,value){ |
250 | var $input=$("<input />"); | 250 | var $input=$("<input />"); |
251 | $input.attr("type","text"); | 251 | $input.attr("type","text"); |
252 | $input.attr("name",name); | 252 | $input.attr("name",name); |
253 | - $input.attr("placeholder",label); | 253 | + $input.attr("placeholder",label.replace(':','')); |
254 | $input.addClass("form-control"); | 254 | $input.addClass("form-control"); |
255 | $input.css("margin-bottom","15px"); | 255 | $input.css("margin-bottom","15px"); |
256 | - $("#"+name).append($input); | 256 | + value&&$input.val(value); |
257 | + $("#"+name+"-list").append($input); | ||
257 | } | 258 | } |
258 | } | 259 | } |
259 | 260 | ||
@@ -282,12 +283,20 @@ var g2=new common.grid({ | @@ -282,12 +283,20 @@ var g2=new common.grid({ | ||
282 | }} | 283 | }} |
283 | ] | 284 | ] |
284 | }); | 285 | }); |
286 | +g2.__rows=[]; | ||
285 | 287 | ||
286 | e.on("render",function(){ | 288 | e.on("render",function(){ |
287 | - $(".urlAdd").each(function(){ | ||
288 | - var label=$(this).parents(".form-group").find("label").text().replace(':',''); | ||
289 | - var name=$(this).prev("div").attr("id"); | ||
290 | - Bll.addInput(label,name); | 289 | + |
290 | + | ||
291 | + $("#otherUrl").add("#websiteUrl").add("#shopAddress").each(function(){ | ||
292 | + var label=$(this).parents(".form-group").find("label").text(); | ||
293 | + var name=$(this).attr("id"); | ||
294 | + var value=$(this).val()?$(this).val():'[]'; | ||
295 | + | ||
296 | + var data=JSON.parse(value); | ||
297 | + $.each(data,function(i,item){ | ||
298 | + Bll.addInput(name,label,item); | ||
299 | + }); | ||
291 | }); | 300 | }); |
292 | 301 | ||
293 | (!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true); | 302 | (!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true); |
@@ -295,15 +304,16 @@ e.on("render",function(){ | @@ -295,15 +304,16 @@ e.on("render",function(){ | ||
295 | //修改 | 304 | //修改 |
296 | if($("#shopRelationList").val()){ | 305 | if($("#shopRelationList").val()){ |
297 | var a=JSON.parse($("#shopRelationList").val()); | 306 | var a=JSON.parse($("#shopRelationList").val()); |
298 | - g2.init(a); | 307 | + Array.prototype.push.apply(g2.__rows, a) |
308 | + g2.init(g2.__rows); | ||
299 | } | 309 | } |
300 | }); | 310 | }); |
301 | 311 | ||
302 | e.on("bind",function(){ | 312 | e.on("bind",function(){ |
303 | $(".urlAdd").click(function(){ | 313 | $(".urlAdd").click(function(){ |
304 | var label=$(this).parents(".form-group").find("label").text(); | 314 | var label=$(this).parents(".form-group").find("label").text(); |
305 | - var name=$(this).prev("div").attr("id"); | ||
306 | - Bll.addInput(label,name); | 315 | + var name=$(this).parent("div").next(":hidden").attr("id"); |
316 | + Bll.addInput(name,label); | ||
307 | }); | 317 | }); |
308 | 318 | ||
309 | $("#shopsType").change(function(){ | 319 | $("#shopsType").change(function(){ |
@@ -313,7 +323,21 @@ e.on("bind",function(){ | @@ -313,7 +323,21 @@ e.on("bind",function(){ | ||
313 | $("#modalId").click(function(){ | 323 | $("#modalId").click(function(){ |
314 | //common.util.__template($("#template").html(),{}) | 324 | //common.util.__template($("#template").html(),{}) |
315 | common.dialog.confirm("添加供应商关系",$("#template").html(),function(){ | 325 | common.dialog.confirm("添加供应商关系",$("#template").html(),function(){ |
316 | - g2.init(g.selected); | 326 | + console.log(g.selected); |
327 | + $.each(g.selected,function(index,item){ | ||
328 | + //item.supplierId | ||
329 | + var i=0; | ||
330 | + $.each(g2.__rows,function(index1,item1){ | ||
331 | + if(item1.supplierId==item.supplierId){ | ||
332 | + i++; | ||
333 | + } | ||
334 | + }); | ||
335 | + if(i==0){ | ||
336 | + g2.__rows.push(item); | ||
337 | + } | ||
338 | + }); | ||
339 | + | ||
340 | + g2.init(g2.__rows); | ||
317 | }); | 341 | }); |
318 | new common.dropDown({ | 342 | new common.dropDown({ |
319 | el: "#brandname", | 343 | el: "#brandname", |
@@ -327,7 +351,7 @@ e.on("bind",function(){ | @@ -327,7 +351,7 @@ e.on("bind",function(){ | ||
327 | }); | 351 | }); |
328 | 352 | ||
329 | $("#updateBrand").on("click",".delete",function(){ | 353 | $("#updateBrand").on("click",".delete",function(){ |
330 | - delete g.selected[$(this).data("index")]; | 354 | + delete g2.__rows[$(this).data("index")]; |
331 | g2.reload(); | 355 | g2.reload(); |
332 | }); | 356 | }); |
333 | }); | 357 | }); |
@@ -381,7 +405,8 @@ var submit=function(callback){ | @@ -381,7 +405,8 @@ var submit=function(callback){ | ||
381 | res=res.data; | 405 | res=res.data; |
382 | if(res.code=="200"){ | 406 | if(res.code=="200"){ |
383 | e.$tip('提交成功',function(){ | 407 | e.$tip('提交成功',function(){ |
384 | - location.href="/supplier/store/index"; | 408 | + // location.href="/supplier/store/index"; |
409 | + history.go(-1); | ||
385 | },'growl-success'); | 410 | },'growl-success'); |
386 | }else{ | 411 | }else{ |
387 | e.$tip(res.message); | 412 | e.$tip(res.message); |
@@ -58,6 +58,12 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳 | @@ -58,6 +58,12 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳 | ||
58 | }else{ | 58 | }else{ |
59 | HtmArr.push('<a href="/supplier/store/info/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-info btn-xs">查看</a>'); | 59 | HtmArr.push('<a href="/supplier/store/info/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-info btn-xs">查看</a>'); |
60 | } | 60 | } |
61 | + //创建 | ||
62 | + if(authority.create){ | ||
63 | + if(+item.checkStatus==100||+item.checkStatus==900){ | ||
64 | + HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>'); | ||
65 | + } | ||
66 | + } | ||
61 | 67 | ||
62 | if(authority.btn){ | 68 | if(authority.btn){ |
63 | HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>'); | 69 | HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>'); |
@@ -26,17 +26,7 @@ $('#basicTable').on('click', '#bohui', function() { | @@ -26,17 +26,7 @@ $('#basicTable').on('click', '#bohui', function() { | ||
26 | Bll.toast("您确定要驳回审核吗?","/Shops/ShopsRest/checkReject"); | 26 | Bll.toast("您确定要驳回审核吗?","/Shops/ShopsRest/checkReject"); |
27 | }); | 27 | }); |
28 | 28 | ||
29 | -var Bll={ | ||
30 | - addInput:function(label,name){ | ||
31 | - var $input=$("<input />"); | ||
32 | - $input.attr("type","text"); | ||
33 | - $input.attr("name",name); | ||
34 | - $input.attr("placeholder",label); | ||
35 | - $input.addClass("form-control"); | ||
36 | - $input.css("margin-bottom","15px"); | ||
37 | - $("#"+name).append($input); | ||
38 | - } | ||
39 | -} | 29 | + |
40 | 30 | ||
41 | var ENUM={ | 31 | var ENUM={ |
42 | shopNature:{1:'旗舰店',2:'直营店'}, | 32 | shopNature:{1:'旗舰店',2:'直营店'}, |
@@ -28,7 +28,7 @@ var ENUM={ | @@ -28,7 +28,7 @@ var ENUM={ | ||
28 | id:common.util.__input("supplier-name"), | 28 | id:common.util.__input("supplier-name"), |
29 | status:common.util.__input("status"), | 29 | status:common.util.__input("status"), |
30 | timeSort:common.util.__input("time-sort"), | 30 | timeSort:common.util.__input("time-sort"), |
31 | - isFreeze:common.util.__input("isFreeze"), | 31 | + isFreeze:common.util.__input("isFreeze") |
32 | }; | 32 | }; |
33 | }, | 33 | }, |
34 | columns:[ | 34 | columns:[ |
@@ -8,7 +8,7 @@ exports.res = [{ | @@ -8,7 +8,7 @@ exports.res = [{ | ||
8 | noApi:true, | 8 | noApi:true, |
9 | data: { | 9 | data: { |
10 | gridurl:'/supplier/store/indexPage', | 10 | gridurl:'/supplier/store/indexPage', |
11 | - authority:'{"btn":false,"info":true,"operationStatus":1,"checkStatusArr":"100,200,900"}', | 11 | + authority:'{"btn":false,"info":false,"create":true,"operationStatus":1,"checkStatusArr":"100,200,900"}', |
12 | add:true, | 12 | add:true, |
13 | dropCheckStatus:true | 13 | dropCheckStatus:true |
14 | }, | 14 | }, |
@@ -81,7 +81,8 @@ exports.res = [{ | @@ -81,7 +81,8 @@ exports.res = [{ | ||
81 | params:[{ | 81 | params:[{ |
82 | name:'shopsId', | 82 | name:'shopsId', |
83 | type:'String' | 83 | type:'String' |
84 | - }] | 84 | + }], |
85 | + src:'/store/info' | ||
85 | } | 86 | } |
86 | ,{ | 87 | ,{ |
87 | // 店铺详细信息页面渲染 | 88 | // 店铺详细信息页面渲染 |
@@ -135,7 +136,7 @@ exports.res = [{ | @@ -135,7 +136,7 @@ exports.res = [{ | ||
135 | type:'String' | 136 | type:'String' |
136 | }], | 137 | }], |
137 | data:{ | 138 | data:{ |
138 | - pageTitel:"创建店铺", | 139 | + pageTitel:"修改店铺", |
139 | action:'/store/update', | 140 | action:'/store/update', |
140 | }, | 141 | }, |
141 | src:'/store/edit' | 142 | src:'/store/edit' |
@@ -147,7 +147,9 @@ | @@ -147,7 +147,9 @@ | ||
147 | </div> | 147 | </div> |
148 | 148 | ||
149 | <button type="button" data-oncheck='1' class="check btn btn-success">提交审核</button> | 149 | <button type="button" data-oncheck='1' class="check btn btn-success">提交审核</button> |
150 | + {{^checkStatus}} | ||
150 | <button type="button" data-oncheck='2' class="check btn btn-info btn-cun">暂存</button> | 151 | <button type="button" data-oncheck='2' class="check btn btn-info btn-cun">暂存</button> |
152 | + {{/checkStatus}} | ||
151 | <button onclick="history.go(-1);" type="button" class="btn btn-danger">取消</button> | 153 | <button onclick="history.go(-1);" type="button" class="btn btn-danger">取消</button> |
152 | </div> | 154 | </div> |
153 | </div> | 155 | </div> |
-
Please register or login to post a comment