Authored by 陶雨

运营管理 -> 限购商品管理

/**
* Created by ty on 2016/6/22.
* 限售商品管理
*/
module.exports=function(app) {
/*【限购商品】页面渲染*/
app.get("/limit/product/index","operations.limit.Index", function () {
this.$extend = {
moduleName: "运营管理",
pageName: "限购商品管理"
}
});
/*【限购商品】添加页面渲染*/
app.get("/limit/product/add","operations.limit.Edit", function () {
this.$extend = {
moduleName: "运营管理",
pageName: "限购商品管理",
data: {
limitProductType:"1",
hotFlag:"0"
},
action: '/limitProduct/addLimitProduct',
}
});
/*【限购商品】编辑页面渲染*/
app.get("/limit/edit/:id","operations.limit.Edit","limit_getLimitProduct", function (response) {
this.$extend = {
moduleName: "运营管理",
pageName: "限购商品管理",
action: "/limitProduct/updateLimitProduct",
type: "update",
data: response.data
}
});
/*列表*/
app.post("/limitProduct/getLimitProductList","limit_getLimitProductList");
/*添加*/
app.post("/limitProduct/addLimitProduct","limit_addLimitProduct");
/*编辑*/
app.post("/limitProduct/updateLimitProduct","limit_updateLimitProduct");
/*获取各状态数量*/
app.post("/limitProduct/getCountByStatus","limit_getCountByStatus");
/*更改商品状态*/
app.post("/limitProduct/auditLimitProduct","limit_auditLimitProduct");
/*删除限购商品*/
app.post("/limitProduct/deleteLimitProduct","limit_deleteLimitProduct");
/*检查batchNo是否存在*/
app.post("/limitProduct/checkBatchNoExist","limit_checkBatchNoExist");
/*根据BatchNo检查限购码是否正确*/
app.post("/limitCode/checkLimitCodeByBatchNo","limit_checkLimitCodeByBatchNo");
/*导出*/
app.post("/limit/batch/export","limit_export");
/*检查活动是否存在*/
app.post("/DrawlineActivityRest/checkActivityIdExists","limit_checkActivityIdExists");
/*检查活动是否存在*/
app.post("/limitProduct/checkActivityIdNoExist","limit_checkActivityIdNoExist");
/*根据id获取限购商品*/
app.post("/limitProduct/checkActivityIdNoExist","limit_checkActivityIdNoExist");
}
\ No newline at end of file
... ...
/**
* Created by ty on 2016/6/22.
* 限售商品管理
*/
module.exports={
namespace:"limit",
apis:{
getLimitProductList:{
title: "【限购商品】ajax分页",
url: '/limitProduct/getLimitProductList',
params: [
{name: 'hotFlag', type: 'Number'},
{name: 'saleFlag', type: 'Number'},
{name: 'showFlag', type: 'Number'},
{name: 'productName', type: 'String'},
{name: 'productSkn', type: 'String'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
},
addLimitProduct:{
title: "【限购商品】ajax添加",
url: '/limitProduct/addLimitProduct',
params: [
{name: 'productName', type: 'String'},
{name: 'attachmentContent', type: 'String'},
{name: 'batchNo', type: 'Number'},
{name: 'dayFlag', type: 'Number'},
{name: 'saleTimeStr', type: 'String'},
{name: 'hotFlag', type: 'Number'},
{name: 'orderBy', type: 'Number'},
{name: 'notSaleOrderBy', type: 'Number'},
{name: 'limitProductType', type: 'Number'},
{name: 'activityId', type: 'Number'}
]
},
updateLimitProduct:{
title: "【限购商品】ajax修改",
url: '/limitProduct/updateLimitProduct',
params: [
{name: 'id', type: 'Number'},
{name: 'productName', type: 'String'},
{name: 'attachmentContent', type: 'String'},
{name: 'batchNo', type: 'String'},
{name: 'saleTimeStr', type: 'String'},
{name: 'hotFlag', type: 'Number'},
{name: 'orderBy', type: 'Number'},
{name: 'notSaleOrderBy', type: 'Number'},
{name: 'dayFlag', type: 'Number'},
{name: 'showFlag', type: 'Number'},
{name: 'status', type: 'Number'},
{name: 'limitProductType', type: 'Number'},
{name: 'activityId', type: 'Number'}
]
},
getCountByStatus:{
title: "获取各状态数量",
url: '/limitProduct/getCountByStatus',
params: [
{name: 'hotFlag', type: 'Number'},
{name: 'saleFlag', type: 'Number'},
{name: 'showFlag', type: 'Number'},
{name: 'productName', type: 'String'},
{name: 'productSkn', type: 'String'}
]
},
auditLimitProduct:{
title: "更改商品状态",
url: '/limitProduct/auditLimitProduct',
params: [
{name: 'id', type: 'Number'},
{name: 'showFlag', type: 'Number'},
{name: 'hotFlag', type: 'Number'},
{name: 'orderBy', type: 'Number'},
{name: 'notSaleOrderBy', type: 'Number'}
]
},
deleteLimitProduct:{
title: "删除限购商品",
url: '/limitProduct/deleteLimitProduct',
params: [
{name: 'id', type: 'Number'}
]
},
checkBatchNoExist:{
title: "检查BatchNo是否存在",
url: '/limitProduct/checkBatchNoExist',
params: [
{name: 'batchNo', type: 'Number'},
{name: 'id', type: 'Number'}
]
},
checkLimitCodeByBatchNo:{
title: "根据BatchNo检查限购码是否正确",
url:'/limitCode/checkLimitCodeByBatchNo',
params:[
{name:"batchNo",type:'Number'},
{name:"id",type:"Number"}
]
},
export:{
title: "导出",
url: '/batch/export',
params: [
{name: 'queryConf', type: 'String'},
{name: 'type', type: 'String'}
]
},
checkActivityIdExists:{
title: "检查活动是否存在",
url:'/DrawlineActivityRest/checkActivityIdExists',
params:[
{name:"activityId",type:"Number"}
]
},
checkActivityIdNoExist:{
title: "检查活动是否存在",
url:'/limitProduct/checkActivityIdNoExist',
params:[
{name:"activityId",type:"Number"},
{name:"id",type:"Number"}
]
},
getLimitProduct:{
title: "根据id获取限购商品",
url: '/limitProduct/getLimitProduct',
params: [
{name: "id", type: "String"}
]
}
}
}
\ No newline at end of file
... ...
<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="contentpanel">
<form id="limit-add-form" class="form-horizontal form-bordered" type="<%type%>" action="<%action%>">
<div class="panel-group">
<div class="panel-group" id="editor-group">
<input type="hidden" id="id" value="<%data.id%>">
<input type="hidden" id="showFlag" value="<%data.showFlag%>">
<input type="hidden" id="status" value="<%data.status%>">
<div class="pannel">
<div class="panel-heading">
<h4>限购商品基本信息</h4>
</div>
<div class="panel-body">
<div class="row">
<div class="form-group">
<label class="col-sm-2 control-label">商品名称<span class="red">*</span></label>
<div class="col-sm-8">
<input type="text" id="productName" placeholder="商品名称" class="form-control" required value="<%data.productName%>">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-8">
<label class="radio-inline"><input type="radio" name="limitProductType" value="1" checked="checked">分享得限购码</label>
<label class="radio-inline"><input type="radio" name="limitProductType" value="2">排队得限购码</label>
<input type="hidden" value="<%data.limitProductType%>" id="limitProductType" for="radio">
</div>
</div>
<div class="form-group limitProductType" id="limitProductType_2" style="display: none;">
<label class="col-sm-2 control-label">排队限购ID:<span class="red">*</span></label>
<div class="col-sm-8">
<input id="activityId" type="text" class="form-control" value="<%data.activityId%>" placeholder="排队限购ID" />
</div>
</div>
<div class="form-group limitProductType" id="limitProductType_1">
<label class="col-sm-2 control-label">限购码批次<span class="red">*</span></label>
<div class="col-sm-8">
<input type="text" id="batchNo" placeholder="限购码批次" class="form-control" maxlength="30" value="<%data.batchNo%>" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">发售日期<span class="red">*</span></label>
<div class="col-sm-4">
<input id="saleTimeStr" data-time="" value="<%data.saleTimeStr%>" type="text" class="form-control" jsaction="time" placeholder="发售日期" readonly required>
</div>
<div class="col-md-3">
<label>是否显示日期:</label>
<label class="radio-inline"><input type="radio" name="dayFlag" value="1"></label>
<label class="radio-inline"><input type="radio" name="dayFlag" value="0"></label>
<input type="hidden" value="<%data.dayFlag%>" id="dayFlag" for="radio">
</div>
</div>
</div>
</div>
</div>
<div class="pannel">
<div class="panel-heading">
<h4>限购商品排序</h4>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-3">
<label>是否热门:</label>
<label class="radio-inline"><input type="radio" name="hotFlag" value="1"></label>
<label class="radio-inline"><input type="radio" name="hotFlag" value="0"></label>
<input type="hidden" value="<%data.hotFlag%>" id="hotFlag" for="radio">
</div>
<div class="col-md-3 height60 order-by">
<label>排序<span class="red" style="display: none;">*</span></label>
<label><input id="orderBy" value="<%data.orderBy%>" type="text" class="form-control" placeholder="排序"></label>
<p>(提示:数字越大越靠前)</p>
</div>
</div>
</div>
</div>
</div>
<div class="pannel">
<div class="panel-heading">
<h4>限量详情内容</h4>
</div>
<div id="baseTable"></div>
<input type="hidden" value="<%data.attachmentContent%>" id="attachmentContent" />
<div class="row">
<div class="col-md-12">
<button class="btn btn-info mr5" id="textDialog">文本</button>
<button class="btn btn-info mr5" id="picDialog">图片</button>
<button class="btn btn-info mr5" id="videoDialog">视频</button>
</div>
</div>
</div>
<div class="pannel">
<div class="col-md-10"></div>
<div class="col-md-2">
<input id="limit-add-btn" class="btn btn-success limit-add-btn" type="button" value="保存"></input>
</div>
</div>
</div>
</form>
</div>
<script type="text/template" id="picDialogTemp">
<div class="row">
<div id="upload-wrapper" class="col-md-3">
<input id="imgfile" name="imgfile" type="file" class="btn btn-primary ml10" value="{attachUrl}">
</div>
<div class="col-md-9">
<div class="row">
<label class="pull-left control-label height40">图片链接</label>
<div class="pull-left ml10">
<input class="form-control" id="imgText" type="text" placeholder="图片链接" value="{attachUrl}" required>
</div>
</div>
<div class="row">
<label class="pull-left control-label height40">图片描述</label>
<div class="pull-left ml10">
<input class="form-control" type="text" id="attachName" value="{attachName}" placeholder="图片描述">
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="vidioDialogTemp">
<!-- Mov avi rmvb mp4 -->
<div class="row">
<div id="upload-wrapper1" class="col-md-3">
<input id="videofile" name="videofile" type="file" bucket="goodsvideo" extend="mp4,rmvb,avi,mov" class="btn btn-primary ml10" value="{attachUrl}">
</div>
<div class="col-md-9">
<div class="row">
<label class="pull-left control-label height40">视频链接</label>
<div class="pull-left ml10">
<input class="form-control" id="videoText" type="text" placeholder="视频链接" value="{attachUrl}" required>
</div>
</div>
<div class="row">
<label class="pull-left control-label height40">视频描述</label>
<div class="pull-left ml10">
<input class="form-control" type="text" id="attachName" value="{attachName}" placeholder="视频描述">
</div>
</div>
</div>
</div>
<div class="row">
<div id="upload-wrapper2" class="col-md-3">
<input id="imgfile" name="imgfile" type="file" class="btn btn-primary ml10" value="{intro}">
</div>
<div class="col-md-9">
<div class="row">
<label class="pull-left control-label height40">图片链接</label>
<div class="pull-left ml10">
<input class="form-control" id="imgText" type="text" placeholder="图片链接" value="{intro}" required>
</div>
</div>
</div>
</div>
</script>
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../common/common');
common = require('../../../common/common');
// require('../common/bootstrap-wysihtml5');
// require('../util/datepicker');
... ... @@ -277,7 +277,6 @@ $('.limit-add-btn').click(function(option) {
$('#limit-add-btn').addClass('disabled');
};
option.success = function(res) {
res = res.data;
if (res.code == "200") {
e.$tip('提交成功', function() {
... ...
... ... @@ -5,7 +5,7 @@
var $ = require('jquery'),
common = require('../common/common');
common = require('../../../common/common');
var baseNum = 1;
... ...
/**
* Created by jiangmin on 2016/5/9.
* 反馈管理
*/
var $ = require('jquery');
common = require('../../../common/common');
datepicker = require('../../../common/util/datepicker');
var ENUM = {
//发送状态
StatusEnum1: {
'0': '未发送',
'1': '未发送',
'2': '已发送'
},
//状态
StatusEnum2: {
'0': '未回复',
'1': '已回复',
'2': '已回复'
}
};
/**
* 下拉框
*/
new common.dropDown({
el: "#isHot-filter"
});
new common.dropDown({
el: "#status-filter"
});
new common.dropDown({
el: "#clientType-filter"
});
/**
* 日期插件
*/
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
var appVersion = {};
var replyPersonName = {};
var quick_select = {};
var status = "-1";
/**
* 列表
* @type {common.grid}
*/
var g = new common.grid({
el: '#content-list',
callback: function (data) {
if (data && data.data) {
quick_select = {
replyTotal: data.data.replyTotal,
unReplyTotal: data.data.unReplyTotal,
status: status
};
}
$("#quick").html(common.util.__template2($("#quick-search").html(), {quick_select: quick_select}));
return data.data;
},
parms: function () {
if (common.util.__input('status-filter')) {
status = common.util.__input('status-filter');
}
return {
uid: common.util.__input('uid-filter'),
startTime: common.util.__input('startTime'),
endTime: common.util.__input('endTime'),
isHot: common.util.__input('isHot-filter'),
status: status,
clientType: common.util.__input('clientType-filter'),
appVersion: common.util.__input('choose-appVersion'),
replyPersonId: common.util.__input('choose-replyPersonName')
};
},
columns: [
{
display: '',
type: 'checkbox'
}, {
display: "UID",
name: "uid"
}, {
display: "来源",
name: "clientType"
}, {
display: '版本号',
name: "appVersion"
}, {
display: '图片',
render: function (item) {
var a = item.imageUrl.split('?');
return '<a href="' + a[0] + '" target="_blank"><img src="' + item.imageUrl + '"></a>'
}
}, {
display: '反馈内容',
name: "content",
style:"width:20%;word-break:break-all;"
}, {
display: '回复内容',
name: "replyContent",
style:"width:20%; word-break:break-all;"
}, {
display: '回复人',
name: "replyPersonName",
render: function (item) {
if (item.status == '0') {
return "";
}
else {
return item.replyPersonName
}
}
}, {
display: '时间',
name: "createTime"
}, {
display: "发送状态",
render: function (item) {
return "<p>" + ENUM.StatusEnum1[item.status] + "</p>";
}
}, {
display: "回复状态",
name: 'status',
render: function (item) {
return "<p>" + ENUM.StatusEnum2[item.status] + "</p>";
}
}, {
display: '操作',
render: function (item) {
var HtmArr = [];
//已发送,已回复,uid为0,则不可再“回”、“发”
if (item.status == 2 || item.uid == '0') {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs reply" disabled="true">回</a>');
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs publish" disabled="true">发</a>');
}
else if (item.status == 0) {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs reply">回</a>');
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs publish" disabled="true">发</a>');
}
else {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs reply">回</a>');
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs publish">发</a>');
}
if (item.isHot == 1) {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs setHot" disabled="false">热</a>');
}
else {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs setHot">热</a>');
}
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-dark btn-xs delete">删</a>');
return HtmArr.join('');
}
}]
});
g.init('/suggest/suggest/getSuggestList');
$(document).on("click", "input[name='quick_select']", function () {
status = $(this).val();
g.reload();
$(this).attr("checked", "");
$(this).parent().siblings().find("input[name='quick_select']").removeAttr('checked');
});
var Bll = {
dropDown: function (url, title, data) {
common.util.__ajax({
url: url,//获取所有版本号
data: {}
}, function (res) {
$("#" + title + "-content").html(common.util.__template2($("#search-" + title).html(), res));
new common.dropDown({el: "#choose-" + title});
data = res.data;
}, true);
},
toast: function (url, item, content) {
common.dialog.confirm("",
content,
function () {
common.util.__ajax({
url: url,
data: item
}, function () {
g.reload();
});
});
},
toastBatch: function (url, id, content) {
common.dialog.confirm("", content,
function () {
common.util.__ajax({
url: url,
data: {
id: id
}
}, function (res) {
//console.log(res);
g.reload(1);
});
});
}
};
Bll.dropDown("/suggest/suggest/getAllAppVersions", "appVersion", appVersion);
Bll.dropDown("/suggest/suggest/findAllReplyInfo", "replyPersonName", replyPersonName);
/**
* 查询按钮点击时间
*/
$("#filter-btn").click(function () {
g.reload(1);
});
/**
* 回
*/
$(document).on('click', '.reply', function () {
var item = g.rows[$(this).data("index")];
common.dialog({
title: "回答反馈内容",
content: common.util.__template2($("#replyTemplate").html(), item),
button: [
{
value: "保存",
callback: function () {
common.util.__ajax({
url: "/suggest/suggest/replySuggest",
data: {
id: item.id,
replyContent: $("#replyContent").val()
}
}, function (res) {
if (res.code == '200') {
g.reload();
}
})
},
css: "btn btn-info"
}, {
value: "取消"
}
]
});
});
/**
* 发
*/
$(document).on('click', '.publish', function () {
var item = g.rows[$(this).data("index")];
item = {
id: item.id
};
Bll.toast('/suggest/suggest/publishSuggest', item, "是否确认发送?");
});
/**
* 热
*/
$(document).on('click', '.setHot', function () {
var item = g.rows[$(this).data("index")];
item = {
id: item.id,
isHot: 1
};
Bll.toast('/suggest/suggest/setHotSuggest', item, "是否确认设置热门?");
});
/**
* 删除
*/
$(document).on('click', '.delete', function () {
var item = g.rows[$(this).data("index")];
Bll.toast('/suggest/suggest/deleteSuggest', item, "是否确认删除?");
});
//批量发送
$(document).on('click', '#batchPublish', function () {
var selectedArr = g.selected,
len = selectedArr.length,
idList = [],
idstatus0 = [],
idstatus2 = [];
var msg = "";
var msgs = [];
if (len <= 0) {
common.util.__tip('请选择反馈', 'warning');
return;
}
$.each(selectedArr, function (i, value) {
idList.push(value['id']);
if (value['status'] == 0) {
idstatus0.push(value['uid']);
}
if (value['status'] == 2) {
idstatus2.push(value['uid']);
}
});
var msg1 = idstatus0.length + '条反馈还没有回复,不可发送!';
var msg2 = idstatus2.length + '条反馈已发送,不可重复发送!';
if (idstatus0.length > 0) {
msgs.push(msg1);
}
if (idstatus2.length > 0) {
msgs.push(msg2);
}
if (msgs.length > 0) {
for (var i = 0; i < msgs.length; i++) {
msg = msg + '<p>' + msgs[i] + '</p>'
}
common.util.__tip(msg, 'warning');
return;
}
Bll.toastBatch("/suggest/suggest/batchPublishSuggest", idList.join(","), "确定批量发送吗?");
});
/**
* 批量导出
*/
$(document).on('click', '#batchExport', function () {
var selectedArr = g.selected,
len = selectedArr.length,
idList = [];
if (len <= 0) {
common.util.__tip('请选择反馈', 'warning');
return;
}
$.each(selectedArr, function (i, value) {
idList.push(value['id']);
});
var data = {
id: idList.join(",")
};
window.open("/ajax/down?queryConf=" + JSON.stringify(data) + "&type=suggestExport");
});
\ No newline at end of file
... ...