Authored by dongjunjie

销售类目bug

... ... @@ -107,11 +107,24 @@ var e = null,
editHtml = $('#editTemp').html();
function initForm(data) {
common.dialog.confirm(
'销售类目编辑',
common.util.__template2(editHtml, data),
function(){
saveBrand();
},
function(){
}
);
$(".modal-dialog").css("width","900px");
/*
common.dialog.open({
title: '销售类目编辑',
content: common.util.__template2(editHtml, data),
width: 900
});
});*/
e = new common.edit('#basicForm', {
bucket: 'taobaocms'
});
... ... @@ -172,7 +185,6 @@ $(document).on('click', '.edit-btn', function() {
}, function(res) {
res.data.action = '/sale/salesCategory/updateSC';
initForm(res.data);
//渲染物理类目
var selectedArr = [];
... ... @@ -245,6 +257,28 @@ $(document).on('click', '.del-sort-btn', function() {
});
//保存销售类目
function saveBrand(){
e.submit($('#basicForm').attr('action'), function(option) {
var selected = [];
$.each(tabTreeArr, function(i, item){
if (item.selected.length > 0) {
selected.push(item.selected[item.selected.length - 1].id);
}
});
option.data.relationParameter = selected.join(',');
option.success = function(res) {
res = res.data;
if (res.code == '200') {
e.$tip(res.message, function() {
//location.reload();
}, 'growl-success');
} else {
e.$tip(res.message);
}
}
});
}
$(document).on('click', '#save_brand', function() {
e.submit($('#basicForm').attr('action'), function(option) {
var selected = [];
... ... @@ -263,7 +297,6 @@ $(document).on('click', '#save_brand', function() {
} else {
e.$tip(res.message);
}
return false;
}
});
});
... ...
... ... @@ -37,9 +37,9 @@ var g = new common.grid({
name: '',
render: function(item) {
if (item.status == 1) {
return '<a class="btn btn-xs btn-danger close-btn" data-title="' + item.labelName + '" data-label="' + item.labelId + '" href="javascript:;">关闭</a>';
return '<a class="btn btn-xs btn-danger close-btn" data-title="' + item.labelName + '" _id="' + item.id + '" href="javascript:;">关闭</a>';
} else {
return '<a class="btn btn-xs btn-warning open-btn" data-title="' + item.labelName + '" data-label="' + item.labelId + '" href="javascript:;">开启</a>';
return '<a class="btn btn-xs btn-warning open-btn" data-title="' + item.labelName + '" _id="' + item.id + '" href="javascript:;">开启</a>';
}
}
}]
... ... @@ -98,12 +98,12 @@ $('input[name="state"]').on('change', function() {
$(document).on('click', '.close-btn', function() {
var labelId = $(this).data('label');
var id = $(this).attr('_id');
common.dialog.confirm("温馨提示", "确定关闭(" + $(this).data('title') + ")标签吗", function() {
common.util.__ajax({
url: '/sale/salesCategoryLabel/updateSCLabel',
data: {
labelId: labelId,
id: id,
status: 0
}
}, function(res){
... ... @@ -115,12 +115,12 @@ $(document).on('click', '.close-btn', function() {
console.log(g.rows);
});
$(document).on('click', '.open-btn', function() {
var labelId = $(this).data('label');
var id = $(this).attr('_id');
common.dialog.confirm("温馨提示", "确定开启(" + $(this).data('title') + ")标签吗", function() {
common.util.__ajax({
url: '/sale/salesCategoryLabel/updateSCLabel',
data: {
labelId: labelId,
id: id,
status: 1
}
}, function(res){
... ...
... ... @@ -39,16 +39,19 @@
span {
display: inline-block;
width: 12.5%;
font-size: 13px;
font-size: 14px;
border-left: 1px solid #ddd;
height: 50px;
line-height: 50px;
height: 60px;
line-height: 60px;
vertical-align: middle;
text-align: center;
font-family:'Microsoft YaHei';
img {
max-height: 78px;
max-width: 78px;
max-height: 56px;
max-width: 80%;
display: block;
margin: 2px auto;
}
&.orderby {
... ... @@ -57,7 +60,6 @@
&.operate {
width: 20.5%;
line-height: 42px;
}
&.status {
... ... @@ -74,11 +76,11 @@
border-bottom: 1px solid #ddd;
span {
font-weight: bold;
height: 40px;
line-height: 40px;
height: 36px;
line-height: 36px;
&.operate {
line-height: 34px;
line-height: 36px;
}
}
}
... ... @@ -108,5 +110,5 @@
}
.level-wrap input.saleCategoryNumInput{
margin: 5px auto;
margin: 10px auto;
}
... ...
... ... @@ -52,7 +52,7 @@
<div class="panel">
<div class="panel-body nopadding">
<form id="basicForm" role="form" action="[[action]]" class="form-horizontal form-bordered">
<div class="form-group">
<div class="form-group" style="padding-top: 0">
<label class="col-sm-2 control-label">父分类</label>
<!-- <div class="col-sm-8 height40">{{# parentSC}}{{categoryName}}{{# items}}-{{categoryName}}{{/ items}}{{/ parentSC}}</div> -->
<div class="col-sm-8 height40">
... ... @@ -78,7 +78,7 @@
<label class="col-sm-2 control-label">分类图标</label>
<div class="col-sm-8"><input type="file" id="icon" name="icon" value="[[icon]]" placeholder="分别图标"></div>
</div>
<div class="form-group">
<div class="form-group" style="margin-bottom: 40px">
<label class="col-sm-2 control-label">物理类目关联</label>
<div class="col-sm-8 sort-wrap">
<div class="row">
... ... @@ -97,10 +97,6 @@
<input id="orderBy" type="hidden" value="[[orderBy]]">
</form>
</div>
<div class="panel-footer">
<a id="save_brand" data-loading-text="保存中..." class="btn btn-primary" href="javascript:;">保存</a>
<a href="javascript:;" onclick="history.go(-1);" class="btn btn-danger">取消</a>
</div>
</div>
</script>
... ... @@ -240,7 +236,7 @@
<span class="operate" data-id="[[categoryId]]" data-name="[[categoryName]]">
<a class="btn btn-info btn-xs edit-btn" href="javascript:;">编辑</a>
<a class="btn btn-success btn-xs tagmgmt-btn" href="/sale/category/tag/[[categoryId]]">标签管理</a>
<a class="btn btn-info btn-xs add-sub-category" href="javascript:;">添加子分类</a>
<a class="btn btn-primary btn-xs add-sub-category" href="javascript:;">添加子分类</a>
[[if state=="1"]]<a class="btn btn-danger btn-xs close-category" href="javascript:;">关闭</a>[[/if]]
[[if state=="0"]]<a class="btn btn-warning btn-xs open-category" href="javascript:;">开启</a>[[/if]]
</span>
... ...
... ... @@ -27,8 +27,8 @@
<div class="panel-body nopadding">
<div class="state-select">
<strong>状态:</strong>
<label><input type="radio" name="state" value="">全部</label>
<label class="current"><input type="radio" name="state" value="1">开启</label>
<label class="current"><input type="radio" name="state" value="">全部</label>
<label><input type="radio" name="state" value="1">开启</label>
<label><input type="radio" name="state" value="0">关闭</label>
</div>
</div>
... ... @@ -41,11 +41,6 @@
<input id="categoryId" type="hidden" value="{{categoryId}}">
{{/ data}}
</div>
<div class="panel-footer">
<button id="save_brand" type="submit" data-loading-text="保存中..." class="btn btn-primary">保存</button>
<a href="javascript:;" onclick="history.go(-1);" class="btn btn-danger">取消</a>
</div>
</div>
</div>
... ...