Authored by 陶雨

优惠券管理发券管理部分界面

/**
* Created by ty on 2016/5/23.
*/
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var departments = ["渠道二部", "渠道一部", "零售部", "品牌资源部", "店铺运营部", "类目运营部", "营销部", "市场部", "会员部 ", "客服部", "内容营销部"];
var couponTypes = ["A券", "B券", "公开券", "生日券", "免邮券"];
//下拉框
new common.dropDown({el: '#filter-couponType'});
new common.dropDown({el: '#filter-department'});
//grid
var g = new common.grid({
el: '#basicTable',
parms:function(){
return {
couponType: common.util.__input("filter-couponType"),
couponId: common.util.__input("filter-couponId"),
couponName:common.util.__input("filter-couponName"),
department:common.util.__input("filter-department"),
startTimeStr:common.util.__input("filter-startTimeStr"),
endTimeStr:common.util.__input("filter-endTimeStr"),
};
},
columns:[
{display:"优惠券ID", name:"id"},
{display:"优惠券名称",name:"couponName"},
{display: '申请部门', render: function(item) {
return '<p class="audit-time">' + departments[item.department] + '</p>';
}},
{display: '优惠券类型', render: function(item) {
return '<p class="audit-time">' + couponTypes[item.couponType] + '</p>';
}},
{display: '数量', name: "couponNum"},
{display: '面额', name: "couponAmount"},
{display: '开始时间', render: function(item) {
return common.util.__dateFormat(new Date(item.startTime), "yyyy-MM-dd hh:mm:ss");;
}},
{display: '结束时间', render: function(item) {
return common.util.__dateFormat(new Date(item.endTime), "yyyy-MM-dd hh:mm:ss");;
}},
{display:"操作",name:"operate",render:function(item){
var HtmArr=[];
HtmArr.push('<a href="/market/couponSend/send/'+ item.id +'" class="btn btn-primary btn-xs sendCoupon" data-index="'+ item.__index+'" href="javascript:;">发券</a>');
HtmArr.push('<a href="/market/couponSend/sendHistory/'+ item.id +'" class="btn btn-primary btn-xs sendHistory" data-index="'+ item.__index+'" href="javascript:;">发放记录</a>');
HtmArr.push('<a href="/market/couponSend/useHistory/'+ item.id +'" class="btn btn-primary btn-xs useHistory" data-index="'+ item.__index+'" href="javascript:;">使用记录</a>');
return HtmArr.join('');
}}
]
});
g.init("/coupon/querySendCouponList");
$(document).on("click", "#filter-btn", function() {
g.reload(1);
});
\ No newline at end of file
... ...
/**
* Created by ty on 2016/5/23.
*/
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var couponId = location.href.substring(location.href.lastIndexOf("/") + 1);
common.util.__ajax({
url: "/coupon/querySendCouponList",
data: {couponId:couponId},
async: false
}, function (res) {
$("#title").text(res.data.list[0].couponName);
},true);
var Bll = {
getListByCouponId: function () {
common.util.__ajax({
url: "/couponSendInfo/getListByCouponId",
data: {couponId:couponId},
async: false
}, function (res) {
$("#list-content").html(common.util.__template2($("#template-list").html(), res));
},true);
}
};
Bll.getListByCouponId();
//发放优惠券事件
$(document).on("click", "#sendCoupon", function() {
var uids = $("#handworkSend").val();
if(uids) {
common.util.__ajax({
url: "/coupon/sendCoupon",
data: {
couponId:couponId,
uids:uids
}
}, function () {
location.href = location.href;
});
} else {
common.util.__tip("请输入UID", "warning");
}
});
//批量导入
$(document).on("click", "#batch-import", function() {
$("#importFile").click();
});
//重新发放
$(document).on("click", ".reSend", function() {
var id = $(this).data("id");
common.util.__ajax({
url: "/couponSendInfo/sendAgainById",
data: {id: id}
}, function () {
Bll.getListByCouponId();
});
});
//导入
common.edit.ajaxfileupload("#importFile",{
params: {
type: "drawlineUserQueue",
__type: "batch-import"
},
onComplete:function(res){
if(res.code == 200) {
common.util.__tip(res.message, 'success');
Bll.getListByCouponId();
} else {
common.util.__tip(res.message);
}
}
});
\ No newline at end of file
... ...
/**
* Created by ty on 2016/5/23.
*/
'use strict';
var $ = require('jquery'),
common=require('../common/common');
//下拉框
new common.dropDown({el: '#filter-status'});
//grid
var g = new common.grid({
el: '#content-list',
parms:function(){
return {
couponType: common.util.__input("filter-status")
};
},
columns:[
{display:"单券号", name:"couponCode"},
{display:"用户ID",name:"uid"},
{display: '状态', render: function(item) {
var status = "";
if(item.status == 0) {
status = "未发放";
} else if(item.status == 1) {
status = "已发放";
}
return '<p class="audit-time">' + status + '</p>';
}},
{display:"发放时间",render:function(item){
var status = "";
if(item.status == 0) {
status = "未发放";
} else if(item.status == 1) {
status = "已发放";
}
return '<p class="audit-time">' + status + '</p>';
}}
]
});
g.init("/couponLogs/queryUserCouponLogsList");
$(document).on("click", "#filter-btn", function() {
g.reload(1);
});
... ...
exports.domain = require('../config/common.js').domain;
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.240:8088/platform';
//exports.domain = 'http://172.16.6.162:8088/platform';
//exports.domain = 'http://172.16.6.108:8088/platform';//谭玲
//exports.domain = 'http://172.16.6.201:8088/platform';//谭玲
exports.domain = 'http://172.16.6.250:2081/platform';
//营销管理路由配置
exports.res = [
... ... @@ -596,4 +597,86 @@ exports.res = [
name: 'status',
type: 'Number'
}]
}]
\ No newline at end of file
},
/***********************************************************/
{
//发券管理列表页渲染
route: "/market/couponSend/index",
method: "GET",
view: "pages/market/couponSend",
src: "/market/couponSend"
},
{
//发券管理列表
route: "/coupon/querySendCouponList",
method: "POST",
url: "/coupon/querySendCouponList",
params: [
{name: "couponType", type: "number"},
{name: "couponId", type: "number"},
{name: "couponName", type: "string"},
{name: "department", type: "number"},
{name: "page", type: "number"},
{name: "size", type: "number"},
{name: "startTimeStr", type: "number"},
{name: "endTimeStr", type: "number"}
]
},
{
//发券页渲染
route: "/market/couponSend/send/:param",
method: "GET",
view: "pages/market/sendCoupon",
src: "/market/sendCoupon"
},
{
//查询文件发券列表
route: "/couponSendInfo/getListByCouponId",
method: "POST",
url: "/couponSendInfo/getListByCouponId",
params: [
{name: "couponId", type: "number"}
]
},
{
//手工发券
route: "/coupon/sendCoupon",
method: "POST",
url: "/coupon/sendCoupon",
params: [
{name: "couponId", type: "number"},
{name: "uids", type: "string"}
]
},
{
//文件上传重发
route: "/couponSendInfo/sendAgainById",
method: "POST",
url: "/couponSendInfo/sendAgainById",
params: [
{name: "id", type: "number"}
]
},
{
//发放记录页面渲染
route: "/market/couponSend/sendHistory/:param",
method: "GET",
view: "pages/market/sendHistory",
src: "/market/sendHistory"
},
{
//查询用户券列表
route: "/couponLogs/queryUserCouponLogsList",
method: "GET",
url: "/couponLogs/queryUserCouponLogsList",
params: [
{name: "page", type: "number"},
{name: "size", type: "number"},
{name: "couponId", type: "number"},
{name: "couponCode", type: "string"},
{name: "couponName", type: "string"},
{name: "couponId", type: "number"},
{name: "orderCode", type: "number"}
]
}
]
\ 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="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="filter-department" tabindex="-1" class="select2-offscreen brandBtn-group">
<option value="-1">申请部门</option>
<option value="1">渠道二部</option>
<option value="2">渠道一部</option>
<option value="3">零售部</option>
<option value="4">品牌资源部</option>
<option value="5">店铺运营部</option>
<option value="6">类目运营部</option>
<option value="7">营销部</option>
<option value="8">市场部</option>
<option value="9">会员部</option>
<option value="10">客服部</option>
<option value="11">内容营销部</option>
</select>
</div>
<div class="panel-col">
<select id="filter-couponType" tabindex="-1" class="select2-offscreen brandBtn-group">
<option value="-1">优惠券类型</option>
<option value="1">A券</option>
<option value="2">B券</option>
<option value="3">公开券</option>
<option value="4">生日券</option>
<option value="5">免邮券</option>
</select>
</div>
<div class="panel-col">
<input id="filter-couponName" class="form-control panel-input" type="text" placeholder="优惠券名称">
</div>
<div class="panel-col">
<input id="filter-couponId" class="form-control panel-input" type="text" placeholder="优惠券ID">
</div>
<div class="panel-col">
<input id="filter-startTimeStr" class="form-control panel-input" type="text" placeholder="开始时间">
</div>
<div class="panel-col">
<input id="filter-endTimeStr" class="form-control panel-input" type="text" placeholder="结束时间">
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="basicTable_wrapper" id="basicTable">
</div>
</div>
</div>
\ 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-body form-bordered" id="basicInfo">
<div class="row">
<div class="form-group">
<h3>优惠券名称:<span id="title"></span></h3>
</div>
<div class="form-group">
<h4>手工发放</h4>
<div class="col-sm-6">
<label>UID:</label>
<textarea id="handworkSend" rows="6" class="form-control" placeholder="请输入UID,英文输入法下用逗号分隔,批量导入则手输无效" style="resize: none"></textarea>
<span class="red">单次限制输入50个UID</span>
<br><a class="btn btn-primary btn-xs" id="sendCoupon">发放</a>
</div>
</div>
<div class="form-group">
<h4>批导发放</h4>
<a class="btn btn-primary btn-xs" id="batch-import">批量上传</a>
<input type="file" id="importFile" style="z-index: -999999" name="file" hidden>
</div><br>
<div id="list-content">
</div>
</div>
</div>
<script type="text/template" id="template-list">
<table class="table table-hover table-bordered responsive dataTable no-footer" align="center">
<thead>
<tr>
<td>文件名</td>
<td>发券状态</td>
<td>操作</td>
</tr>
</thead>
<tbody>
[[each data as item index]]
<tr>
<td>[[item.fileUrl]]</td>
[[if item.status == 0]]
<td>未开始发放</td>
[[else if item.status == 1]]
<td>正在发放</td>
[[else if item.status == 2]]
<td>已发放</td>
[[/if]]
<td><a class="btn btn-primary btn-xs reSend" data-index="[[item.id]]">重发</a></td>
</tr>
[[/each]]
</tbody>
</table>
</script>
\ 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="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="row">
<div class="panel-col">
<select id="filter-status" tabindex="-1" class="select2-offscreen brandBtn-group">
<option value="-1">状态</option>
<option value="1">已发放</option>
<option value="0">未发放</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="basicTable_wrapper" id="content-list">
</div>
</div>
</div>
\ No newline at end of file
... ...