Authored by weiqingting

限购码列表完成

var $=require('jquery');
require('../util/jquery.gritter');
var grid=require('./grid'),
... ... @@ -28,6 +29,7 @@ var common={
});
},
__tip:function(message,callback){
var options={};
if (arguments.length > 1) {
options.title=arguments[0];
if (typeof (arguments[1]) === "string") {
... ... @@ -36,6 +38,7 @@ var common={
options.class_name="growl-success";
}
var lastargs = Array.prototype.slice.call(arguments, arguments.length-1);
lastargs=lastargs[0];
if(typeof lastargs==="function"){
options.after_open=setTimeout(function() {
lastargs&&lastargs();
... ... @@ -73,6 +76,9 @@ var common={
}
}
return result;
},
__input:function(id){
return !!~$.trim($('#'+id).val())?$('#'+id).val():""
}
}
}
... ...
... ... @@ -6,9 +6,12 @@ exports.init = function() {
new common.dropDown({el: '#filter-dep'});
var g = new common.grid({
el: '#basicTable',
url:$("#gridurl").val(),
parms:function(){
return {};
return {
batchNo:common.util.__input("batchNo"),
name:common.util.__input("name"),
reqDepartment:common.util.__input("reqDepartment")
};
},
columns:[
{display:"批次号",name:"batchNo"},
... ... @@ -25,31 +28,38 @@ exports.init = function() {
}},
{display:"限购码使用说明",name:"describe"},
{display:"申请人",name:"creatorName"},
{display:"操作",render:function(){
{display:"操作",render:function(item){
var HtmArr=[];
//限购码状态0:待审核 1:审核通过 2:驳回 3:过期 4:作废
HtmArr.push('<a href="/limit/code/info/'+ items.id+'" class="btn btn-info btn-xs">查看详情</a>');
if(items.status == 0){
HtmArr.push('<a class="btn btn-primary btn-xs apply-success" data-index="'+ items.__index+'" href="javascript:;">通过</a>');
HtmArr.push('<a class="btn btn-warning btn-xs apply-back" data-index="'+ items.__index+'" href="javascript:;">驳回</a>');
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ items.__index+'" href="javascript:;">作废</a>');
}else if(status==1){
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ items.__index+'" href="javascript:;">作废</a>');
}else if(status==2){
HtmArr.push('<a class="btn btn-info btn-xs apply-modify" href="/limit/code/update/'+ items.id+'">修改</a>');
HtmArr.push('<a href="/limit/code/info/'+ item.id+'" class="btn btn-info btn-xs">查看详情</a>');
if(item.status == 0){
HtmArr.push('<a class="btn btn-primary btn-xs apply-success" data-index="'+ item.__index+'" href="javascript:;">通过</a>');
HtmArr.push('<a class="btn btn-warning btn-xs apply-back" data-index="'+ item.__index+'" href="javascript:;">驳回</a>');
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>');
}else if(item.status==1){
HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>');
}else if(item.status==2){
HtmArr.push('<a class="btn btn-info btn-xs apply-modify" href="/limit/code/update/'+ item.id+'">修改</a>');
}
return HtmArr.join('');
}}
]
});
g.init();
g.init($("#gridurl").val());
$("#btn-search").click(function(){
g.reload();
});
$("#btn-reset").click(function(){
//g.reload();
});
var tool={
toast:function(content,data){
toast:function(content,fn){
common.dialog.confirm("温馨提示",content,function(){
common.util.__ajax({
url:'/limit/code/auditLimitCode',
data:data
data:fn()
},function(){
g.reload();
});
... ... @@ -58,32 +68,38 @@ exports.init = function() {
}
//审核通过
$('#basicTable').on('click', '.apply-success', function() {
var item=g.rows[$(this).data("data-index")];
var data={
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status:1,
reason:"预算不够"
};
}
tool.toast("确定要通过该申请吗?",data);
});
//驳回
$('#basicTable').on('click', '.apply-back', function() {
var item=g.rows[$(this).data("data-index")];
var data={
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status:2,
reason:"预算不够"
reason:$("#reason").val()
};
};
tool.toast(common.util.__template($("#template").html(),{title:"你确定要驳回该申请吗?"}),data);
});
//作废
$('#basicTable').on('click', '.apply-cancel', function() {
var item=g.rows[$(this).data("data-index")];
var data={
var item=g.rows[$(this).data("index")];
var data=function(){
return {
id:item.id,
status: 3,
reason:"预算不够"
reason:$("#reason").val()
};
}
tool.toast(common.util.__template($("#template").html(),{title:"你确定要作废此限购码吗?"}),data);
});
}
\ No newline at end of file
... ...
... ... @@ -12,7 +12,7 @@ var config = {
'development':{
redis:null,
apiKey:'sd4H1ecAqlp',
domain:'http://192.168.102.215:8080/platform',
domain:'http://192.168.102.215:8088/platform',
loggers: {
api: {
level:'verbose',
... ...
... ... @@ -15,14 +15,17 @@ exports.res = [
gridurl:'/limit/code/ajax/index'
}
},
{
{//查看列表【列表能够正常查看】
route: '/limit/code/ajax/index',
method: 'POST',
url: '/limitCode/getLimitCodeList',
isJsonRaw:true,
params: [
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
{name: 'size', type: 'Number'},
{name: 'batchNo', type: 'String'},
{name: 'name', type: 'String'},
{name: 'reqDepartment', type: 'String'}
]
},
{
... ... @@ -38,10 +41,11 @@ exports.res = [
}
},
src:'/limitcode/edit'
},{
},{//添加限购码【验证成功】
route:'/limit/code/ajax/add',
method:'POST',
url:'/limitCode/addLimitCode',
isJsonRaw: true,
params:[
{name:"name",type:"String"},
{name:"limitTimes",type:"Number"},
... ... @@ -51,7 +55,7 @@ exports.res = [
{name:"describe",type:"String"},
{name:"userUseLimit",type:"Number"},
{name:"userTypeLimit",type:"Number"},
//{name:"limitSkn",type:"String"},
{name:"limitSkn",type:"String"},
{name:"creatorName",type:"String"},
{name:"creatorId",type:"Number"},
{name:"status",type:"Number"}
... ... @@ -66,9 +70,47 @@ exports.res = [
params: [
{name: 'id',type: 'String'}
]
},{//审核限购码接口
route: '/limit/code/auditLimitCode',
}
,{//修改优惠码页面
route:'/limit/code/update/:id',
method: 'GET',
view: 'pages/limitcode/edit',
url:"/limitCode/getLimitCode",
src:'/limitcode/edit',
isJsonRaw: true,
data: {
action:"/limit/code/ajax/update",
type:"update",
},
params: [
{name: 'id',type: 'String'}
]
}
,{
//更新限购码接口
route:'/limit/code/ajax/update',
method:'POST',
url:'/limitCode/updateLimitCode',
isJsonRaw: true,
params:[
{name:"name",type:"String"},
{name:"limitTimes",type:"Number"},
{name:"reqDepartment",type:"String"},
{name:"limitDateFrom",type:"String"},
{name:"limitDateTo",type:"String"},
{name:"describe",type:"String"},
{name:"userUseLimit",type:"Number"},
{name:"userTypeLimit",type:"Number"},
{name:"limitSkn",type:"String"},
{name:"creatorName",type:"String"},
{name:"creatorId",type:"Number"},
{name:"status",type:"Number"},
{name:"id",type:"Number"}
]
}
,{//修改限购码接口状态[待验证]
route: '/limit/code/auditLimitCode',
method: 'POST',
view: 'pages/limitcode/info',
url:"/limitCode/auditLimitCode",
isJsonRaw: true,
... ...
... ... @@ -144,7 +144,7 @@
<input type="text" class="form-control" placeholder="UID">
</div>
<input type="hidden" value="{{userTypeLimit}}" id="userTypeLimit" for="checkbox" required placeholder="用户来源">
<input type="hidden" value="{{userTypeLimit}}" id="userTypeLimit" for="checkbox" required placeholder="会员身份">
</div>
<div class="form-group">
... ... @@ -225,6 +225,7 @@
<input type="hidden" value="{{status}}" id="status" >
<input type="hidden" value="{{id}}" id="id" >
{{/ data}}
<div class="form-group">
... ...
... ... @@ -27,14 +27,14 @@
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<input id="filter-id" class="form-control panel-input" type="text" placeholder="请输入批次号">
<input id="batchNo" class="form-control panel-input" type="text" placeholder="请输入批次号">
</div>
<div class="panel-col2">
<input id="filter-name" class="form-control panel-input" type="text" placeholder="请输入名称">
<input id="name" class="form-control panel-input" type="text" placeholder="请输入名称">
</div>
<div class="panel-col">
<select id="filter-dep" name="filter-dep" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="">全部</option>
<select id="reqDepartment" name="filter-dep" tabindex="-1" title="" class="form-control">
<option value="-1">全部</option>
<option value="商品部">商品部</option>
<option value="市场部">市场部</option>
<option value="会员部">会员部</option>
... ... @@ -45,8 +45,8 @@
<option value="其他">其他</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
<a id="btn-search" href="javascript:;" class="btn btn-info">筛选</a>
<a id="btn-reset" href="javascript:;" class="btn btn-info">全部</a>
</div>
</div>
</div>
... ... @@ -67,7 +67,7 @@
<script id="template" type="text/template">
<p>{title}</p>
<label class="col-sm-3 control-label">*请填写原因</label>
<input id="cancel-reason" type="text" class="form-control" name="agreement-code" style="width:280px;">
<input id="reason" type="text" class="form-control" name="agreement-code" style="width:280px;">
</script>
... ...