Authored by weiqingting

修改店铺

... ... @@ -285,7 +285,7 @@ edit.prototype={
}
};
callback&&callback(options);
$.ajax(options);
//$.ajax(options);
return false;
},
__listen:function(key,o,callback){
... ...
... ... @@ -92,10 +92,8 @@ var ENUM={
data:g.options.parms()
},function(res){
for(var key in res.data){
ENUM.tips[key]=res.data[key];
}
t.init(ENUM.tips);
var __dt=$.extend({},ENUM.tips,res.data);
t.init(__dt);
},true);
},400);
}
... ...
... ... @@ -246,14 +246,15 @@ var Bll={
});
});
},
addInput:function(label,name){
addInput:function(name,label,value){
var $input=$("<input />");
$input.attr("type","text");
$input.attr("name",name);
$input.attr("placeholder",label);
$input.attr("placeholder",label.replace(':',''));
$input.addClass("form-control");
$input.css("margin-bottom","15px");
$("#"+name).append($input);
value&&$input.val(value);
$("#"+name+"-list").append($input);
}
}
... ... @@ -282,12 +283,20 @@ var g2=new common.grid({
}}
]
});
g2.__rows=[];
e.on("render",function(){
$(".urlAdd").each(function(){
var label=$(this).parents(".form-group").find("label").text().replace(':','');
var name=$(this).prev("div").attr("id");
Bll.addInput(label,name);
$("#otherUrl").add("#websiteUrl").add("#shopAddress").each(function(){
var label=$(this).parents(".form-group").find("label").text();
var name=$(this).attr("id");
var value=$(this).val()?$(this).val():'[]';
var data=JSON.parse(value);
$.each(data,function(i,item){
Bll.addInput(name,label,item);
});
});
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
... ... @@ -295,15 +304,16 @@ e.on("render",function(){
//修改
if($("#shopRelationList").val()){
var a=JSON.parse($("#shopRelationList").val());
g2.init(a);
Array.prototype.push.apply(g2.__rows, a)
g2.init(g2.__rows);
}
});
e.on("bind",function(){
$(".urlAdd").click(function(){
var label=$(this).parents(".form-group").find("label").text();
var name=$(this).prev("div").attr("id");
Bll.addInput(label,name);
var name=$(this).parent("div").next(":hidden").attr("id");
Bll.addInput(name,label);
});
$("#shopsType").change(function(){
... ... @@ -313,7 +323,21 @@ e.on("bind",function(){
$("#modalId").click(function(){
//common.util.__template($("#template").html(),{})
common.dialog.confirm("添加供应商关系",$("#template").html(),function(){
g2.init(g.selected);
console.log(g.selected);
$.each(g.selected,function(index,item){
//item.supplierId
var i=0;
$.each(g2.__rows,function(index1,item1){
if(item1.supplierId==item.supplierId){
i++;
}
});
if(i==0){
g2.__rows.push(item);
}
});
g2.init(g2.__rows);
});
new common.dropDown({
el: "#brandname",
... ... @@ -327,7 +351,7 @@ e.on("bind",function(){
});
$("#updateBrand").on("click",".delete",function(){
delete g.selected[$(this).data("index")];
delete g2.__rows[$(this).data("index")];
g2.reload();
});
});
... ... @@ -381,7 +405,8 @@ var submit=function(callback){
res=res.data;
if(res.code=="200"){
e.$tip('提交成功',function(){
location.href="/supplier/store/index";
// location.href="/supplier/store/index";
history.go(-1);
},'growl-success');
}else{
e.$tip(res.message);
... ...
... ... @@ -58,6 +58,12 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳
}else{
HtmArr.push('<a href="/supplier/store/info/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-info btn-xs">查看</a>');
}
//创建
if(authority.create){
if(+item.checkStatus==100||+item.checkStatus==900){
HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>');
}
}
if(authority.btn){
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() {
Bll.toast("您确定要驳回审核吗?","/Shops/ShopsRest/checkReject");
});
var Bll={
addInput:function(label,name){
var $input=$("<input />");
$input.attr("type","text");
$input.attr("name",name);
$input.attr("placeholder",label);
$input.addClass("form-control");
$input.css("margin-bottom","15px");
$("#"+name).append($input);
}
}
var ENUM={
shopNature:{1:'旗舰店',2:'直营店'},
... ...
... ... @@ -28,7 +28,7 @@ var ENUM={
id:common.util.__input("supplier-name"),
status:common.util.__input("status"),
timeSort:common.util.__input("time-sort"),
isFreeze:common.util.__input("isFreeze"),
isFreeze:common.util.__input("isFreeze")
};
},
columns:[
... ...
... ... @@ -8,7 +8,7 @@ exports.res = [{
noApi:true,
data: {
gridurl:'/supplier/store/indexPage',
authority:'{"btn":false,"info":true,"operationStatus":1,"checkStatusArr":"100,200,900"}',
authority:'{"btn":false,"info":false,"create":true,"operationStatus":1,"checkStatusArr":"100,200,900"}',
add:true,
dropCheckStatus:true
},
... ... @@ -81,7 +81,8 @@ exports.res = [{
params:[{
name:'shopsId',
type:'String'
}]
}],
src:'/store/info'
}
,{
// 店铺详细信息页面渲染
... ... @@ -135,7 +136,7 @@ exports.res = [{
type:'String'
}],
data:{
pageTitel:"创建店铺",
pageTitel:"修改店铺",
action:'/store/update',
},
src:'/store/edit'
... ...
... ... @@ -147,7 +147,9 @@
</div>
<button type="button" data-oncheck='1' class="check btn btn-success">提交审核</button>
{{^checkStatus}}
<button type="button" data-oncheck='2' class="check btn btn-info btn-cun">暂存</button>
{{/checkStatus}}
<button onclick="history.go(-1);" type="button" class="btn btn-danger">取消</button>
</div>
</div>
... ...