Authored by 陶雨

SALE 专题管理

... ... @@ -13,7 +13,8 @@ var urlObj={
'queryShop': '/goods/query/shop',
'maxSort': '/goods/query/maxSort',
'shopsRest':'/ShopsRest/getShopsByName',
'sortlist':'/product/class/queryAllProductSortList'
'sortlist':'/product/class/queryAllProductSortList',
'productPool':'queryBaseProductPoolList'
};
var dropDown=function(option){
... ...
var $ = require('jquery'),
common = require('../common/common');
new common.dropDown({el: "#subject-type"});
new common.dropDown({el: "#subject-paltform"});
new common.dropDown({el: "#subject-status"});
var g = new common.grid({
el: "#subject-manage",
parms: function () {
return {
sort: common.util.__input('subject-type'),
plateform: common.util.__input('subject-paltform'),
status: common.util.__input('subject-status')
};
},
columns: [
{display: "ID", name: "id"},
{display: "分类", name: "sort", render: function (item) {
if(item.sort == "1") return "奥莱";
else if(item.sort == "2") return "SALE";
}},
{display: "排序", name: "orderNum"},
{display: "标题", name: "title"},
{display: "封面图", name: "coverUrl", render: function (item) {
return '<img src="'+item.coverUrl+'"/>';
}},
{display: "促销形式", name: "promotionName"},
{display: "平台", name: "plateform", render: function (item) {
if(item.plateform == "1") return "WEB";
else if(item.plateform == "2") return "APP";
else if(item.plateform == "3") return "WAP";
else if(item.plateform == "4") return "IPAD";
}},
{display: "状态", name: "status", render: function (item) {
if(item.status == 1) return "未定时";
else if(item.status == 2) return "未发布";
else if(item.status == 3) return "已结束";
else if(item.status == 4) return "已发布";
}},
{display: "创建时间", name: "createTime", render: function (item) {
if(!item.createTime) return "";
return Bll.getLocalTime(item.createTime);
}},
{display: "活动时间", name: "", render: function (item) {
// return new Date(item.startTime).toStri34ng() + "~" + new Date(item.endTime).tostring();
if(!item.startTime || !item.endTime) return "";
return Bll.getLocalTime(item.startTime) + "~" + Bll.getLocalTime(item.endTime);
}},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>');
return arr.join("");
}
}
]
});
g.init('/runManage/subjectManage/subjectList');
var Bll = {
getLocalTime:function(nS) {
var date = new Date(parseInt(nS) * 1000);
var mm = date.getMonth() + 1;
var dd = date.getDate();
return date.getFullYear() + "-" + (mm < 10 ? "0" + mm : mm) + "-" + (dd < 10 ? "0" + dd : dd);
},
toast:function(url, item, hint) {
var e = new common.edit("#baseform");
e.on("validate",function() {
var startTime=$("#startTime").val();
var endTime=$("#endTime").val();
if((startTime==""&&endTime=="") || (startTime!=""&&endTime!="")){}else{
return "开始时间和结束时间必须同时存在";
}
});
common.dialog.confirm(hint,
common.util.__template($("#template").html(), item),
function() {
e.submit(url,function(option){
//option.data;
if(typeof option.data.startTime == "string") {
option.data.startTime=new Date(option.data.startTime).getTime() / 1000;
option.data.endTime=new Date(option.data.endTime).getTime() / 1000;
console.log(option.data.startTime);
}
var arr;
try {
arr=option.data.promotionName.split(":")//"promotionName1:折起";
option.data.promotionName = "";
for(var i = 0; i < arr.length; i++) {
var value = "";
try {
value = $("#" + arr[i]).val();
} catch(e) {
value = arr[i];
}
option.data.promotionName += value ? value : arr[i];
}
}catch(e){}
option.success=function(){
g.reload();
};
option.error=function(){
}
});
});
//
if(item.promotionName) {
if(item.promotionName.indexOf("折起") != -1) {
$('#promotionName1').val(item.promotionName.replace("折起", ""));
$("#promotion1").attr("checked","checked");
} else if(item.promotionName.indexOf("折") != -1) {
$('#promotionName2').val(item.promotionName.split("~")[0]);
$('#promotionName3').val(item.promotionName.split("~")[1]);
$("#promotion2").attr("checked","checked");
} else if(item.promotionName.indexOf("元起") != -1) {
$('#promotionName4').val(item.promotionName.replace("元起", ""));
$("#promotion4").attr("checked","checked");
} else if(item.promotionName.indexOf("%") != -1) {
var promotionName5 = $("#promotionName5");
var temp = item.promotionName.replace("%", "");
temp = temp.replace(/off/i, "");
promotionName5.val(temp);
$("#promotion5").attr("checked","checked");
}
}
e.init();
new common.dropDown({el: "#productPoolId","ajax":"productPool"});
if(hint == "专题编辑") {
common.util.__ajax({
url:'/runManage/subjectManage/queryBaseProductPoolList',
data:{id:item.productPoolId}
},function(res) {
// console.log(res);
$("#select2-productPoolId-container").html(res.data[0].text);
});
} else {
$("#select2-productPoolId-container").html("选择商品池");
}
}
};
$('#add-subject').on('click', function() {
var item = {};
Bll.toast('/runManage/subjectManage/addSubject', item, "专题添加");
});
$(document).on('click', '.add2', function() {
var item = g.rows[$(this).data("index")];
if(typeof item.startTime == "number") {
item.startTime = Bll.getLocalTime(item.startTime);
item.endTime = Bll.getLocalTime(item.endTime);
}
Bll.toast('/runManage/subjectManage/modify', item, "专题编辑");
});
$(document).on('click', '.delbtn', function() {
var item=g.rows[$(this).data("index")];
common.dialog.confirm("警告",
"确认删除?",
function() {
common.util.__ajax({
url:'/runManage/subjectManage/delSubject',
data:{id:item.id}
},function() {
g.reload();
});
});
});
$(document).on("click","#filter-btn",function () {
g.reload(1);
});
\ No newline at end of file
... ...
... ... @@ -13,4 +13,16 @@ input[type=date], input[type=time], input[type=datetime-local], input[type=month
.form-group .control-label {
margin-top: 3px;
}
\ No newline at end of file
}
.smalltxt{
width:20px;
border:0 none;
border-bottom:1px solid #ccc;
}
.tao-noborder{
border:0 none;
background-color:transparent;
}
.tao-border{
border:1px solid #ccc;
}
... ...
exports.domain = "http://192.168.102.201:8082/platform";
// exports.domain = require('../config/common.js').domain;
exports.res = [
{
route: '/runManage/subjectManage/index',
method: 'GET',
view: 'pages/product/subjectManage',
src: '/product/subjectManage'
},
{
route: '/runManage/subjectManage/subjectList',//活动列表
method: 'POST',
isJsonRaw: true,
url: '/activity/querySpecialActivityPage',
params: [
{name: 'page', type: 'number'},
{name: 'size', type: 'number',def:10},
{name: 'sort', type: 'string'},
{name: 'title', type: 'string'},
{name: 'plateform', type: 'string'},
{name: 'status', type: 'number'}
]
},
{
route: '/runManage/subjectManage/addSubject',//添加活动
method: 'POST',
isJsonRaw: true,
url: '/activity/addSpecialActivity',
params: [
{name: 'sort', type: 'string'},
{name: 'title', type: 'string'},
{name: 'plateform', type: 'string'},
{name: 'promotionName', type: 'string'},
{name: 'startTime', type: 'number'},
{name: 'endTime', type: 'number'},
{name: 'startTime', type: 'number'},
{name: 'productPoolId', type: 'number'},
{name: 'coverUrl', type: 'string'},
{name: 'logoUrl', type: 'string'},
{name: 'webUrl', type: 'string'},
{name: 'orderNum', type: 'number'}
]
},
{
route: '/runManage/subjectManage/modify',//修改活动
method: 'POST',
isJsonRaw: true,
url: '/activity/updateByPrimaryKey',
params: [
{name: 'id', type: 'number'},
{name: 'sort', type: 'string'},
{name: 'title', type: 'string'},
{name: 'plateform', type: 'string'},
{name: 'promotionName', type: 'string'},
{name: 'startTime', type: 'number'},
{name: 'endTime', type: 'number'},
{name: 'startTime', type: 'number'},
{name: 'productPoolId', type: 'number'},
{name: 'coverUrl', type: 'string'},
{name: 'logoUrl', type: 'string'},
{name: 'webUrl', type: 'string'},
{name: 'orderNum', type: 'number'}
]
},
{
route: '/runManage/subjectManage/delSubject',//删除活动
method: 'POST',
isJsonRaw: true,
url: '/activity/deleteSpecialActivity',
params: [
{name: 'id', type: 'number'}
]
},
{
route: '/runManage/subjectManage/queryBaseProductPoolList',
method: 'POST',
isJsonRaw: true,
url: '/pool/queryBaseProductPoolList',
params: [
{name: 'poolName', type: 'string'}
]
},
{
route: '/runManage/subjectManage/queryBaseProductPoolList',
method: 'POST',
isJsonRaw: true,
url: '/pool/queryBaseProductPoolList',
params: [
{name: 'id', type: 'number'}
]
},
{
route: '/runManage/subjectManage/',//排序修改
method: 'POST',
isJsonRaw: true,
url: '',
params: [
]
}];
\ No newline at end of file
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">运营管理</a></li>
<li>专题管理</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>专题管理</h4>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
<a class="btn btn-success " id="add-subject"><i class="fa fa-plus"></i> 添加专题</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select name="sort" id="subject-type" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">类型</option>
<option value="1">奥莱</option>
<option value="2">SALE</option>
</select>
</div>
<div class="panel-col">
<select name="paltform" id="subject-paltform" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">平台</option>
<option value="1">WEB</option>
<option value="2">APP</option>
<option value="3">WAP</option>
<option value="4">IPAD</option>
</select>
</div>
<div class="panel-col">
<select name="status" id="subject-status" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="" selected="">状态</option>
<option value="1">未定时</option>
<option value="2">未发布</option>
<option value="3">已发布</option>
<option value="4">已结束</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="filter-all" href="/runManage/subjectManage/index" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom: 10px">
<!-- <div class="panel-body">
<div class="row">
排序<input type="text" name="sort" size="1" />
<input type="button" id="save" value="保存" />
<input type="button" id="cancel" value="取消" />
</div>
</div> -->
<input type="hidden" id="url" value="/runManage/subjectManage/subjectList" />
<div id="subject-manage"></div>
</div>
</div>
<script type="text/template" id="template2">
<input type="text" name="sort" size="1" placeholder="排序" />
<input type="button" class="btn btn-xs btn-info sortsave" id="save" value="保存" />
<input type="button" class="btn btn-xs btn-info sortcancel" id="cancel" value="取消" />
</script>
<script type="text/template" id="template">
<div class="rows" id="baseform">
<div class="form-group">
<label class="col-sm-2 control-label">分类<font color="#f00">*</font></label>
<input type="hidden" value="{id}" id="id" />
<div class="col-sm-10">
<input name="sort" type="radio" value="1" />奥莱
<input name="sort" type="radio" value="2" />SALE
</div>
<input type="hidden" id="sort" value="{sort}" for="radio" />
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="title">标题<font color="#f00">*</font></label>
<div class="col-sm-8">
<input type="text" value="{title}" class="form-control" id="title" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">平台</label>
<div class="col-sm-8">
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="2">APP</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="3">WAP</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label>
</div>
<input type="hidden" id="plateform" value="{plateform}" for="checkbox">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">促销形式</label>
<div class="col-sm-10">
<input id="promotion1" name="promotionName" type="radio" value="promotionName1:折起" />
<input class="smalltxt" type="text" id="promotionName1" />折起
<input id="promotion2" name="promotionName" type="radio" value="promotionName2:~:promotionName3:折" /><input class="smalltxt" type="text" id="promotionName2" />~<input class="smalltxt" type="text" id="promotionName3" />
<input id="promotion4" name="promotionName" type="radio" value="promotionName4:元起" /><input class="smalltxt" type="text" id="promotionName4" />元起
<input id="promotion5" name="promotionName" type="radio" value="promotionName5:%Off" /><input class="smalltxt" type="text" id="promotionName5" />%Off(大图折扣)
</div>
<input type="hidden" id="promotionName" value="{promotionName}" for="radio"/>
</div>
<div class="form-group col-sm-100">
<label class="col-sm-2 control-label">活动时间</label>
<div class="panel-col1 col-sm-4">
<input type="text" id="startTime" jsaction="time:end:endTime" class="form-control panel-input hasDatepicker " name="start_time" placeholder="开始时间" value="{startTime}">
</div>
<div class="panel-col1 col-sm-4">
<input type="text" id="endTime" jsaction="time:start:startTime" class="form-control panel-input hasDatepicker" name="end_time" placeholder="结束时间" value="{endTime}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-lalbel" for="orderNum">排序</label>
<div class="col-sm-8">
<input type="text" id="orderNum" value="{orderNum}" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">LOGO图片</label>
<div class="col-sm-10">
<input type="file" id="logoUrl" value="{logoUrl}" /><!---->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">封面图</label>
<div class="col-sm-10">
<input type="file" id="coverUrl" value="{coverUrl}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">web列表页图</label>
<div class="col-sm-10">
<input type="file" id="webUrl" value="{webUrl}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="">添加商品</label>
<div class="col-sm-10">
<select id="productPoolId" style="width: 280px;" value="{productPoolId}"></select>
</div>
</div>
</div>
</script>
\ No newline at end of file
... ...