Showing
6 changed files
with
103 additions
and
38 deletions
1 | +var $=require('jquery'); | ||
1 | require('../util/jquery.gritter'); | 2 | require('../util/jquery.gritter'); |
2 | 3 | ||
3 | var grid=require('./grid'), | 4 | var grid=require('./grid'), |
@@ -28,6 +29,7 @@ var common={ | @@ -28,6 +29,7 @@ var common={ | ||
28 | }); | 29 | }); |
29 | }, | 30 | }, |
30 | __tip:function(message,callback){ | 31 | __tip:function(message,callback){ |
32 | + var options={}; | ||
31 | if (arguments.length > 1) { | 33 | if (arguments.length > 1) { |
32 | options.title=arguments[0]; | 34 | options.title=arguments[0]; |
33 | if (typeof (arguments[1]) === "string") { | 35 | if (typeof (arguments[1]) === "string") { |
@@ -36,6 +38,7 @@ var common={ | @@ -36,6 +38,7 @@ var common={ | ||
36 | options.class_name="growl-success"; | 38 | options.class_name="growl-success"; |
37 | } | 39 | } |
38 | var lastargs = Array.prototype.slice.call(arguments, arguments.length-1); | 40 | var lastargs = Array.prototype.slice.call(arguments, arguments.length-1); |
41 | + lastargs=lastargs[0]; | ||
39 | if(typeof lastargs==="function"){ | 42 | if(typeof lastargs==="function"){ |
40 | options.after_open=setTimeout(function() { | 43 | options.after_open=setTimeout(function() { |
41 | lastargs&&lastargs(); | 44 | lastargs&&lastargs(); |
@@ -73,6 +76,9 @@ var common={ | @@ -73,6 +76,9 @@ var common={ | ||
73 | } | 76 | } |
74 | } | 77 | } |
75 | return result; | 78 | return result; |
79 | + }, | ||
80 | + __input:function(id){ | ||
81 | + return !!~$.trim($('#'+id).val())?$('#'+id).val():"" | ||
76 | } | 82 | } |
77 | } | 83 | } |
78 | } | 84 | } |
@@ -6,9 +6,12 @@ exports.init = function() { | @@ -6,9 +6,12 @@ exports.init = function() { | ||
6 | new common.dropDown({el: '#filter-dep'}); | 6 | new common.dropDown({el: '#filter-dep'}); |
7 | var g = new common.grid({ | 7 | var g = new common.grid({ |
8 | el: '#basicTable', | 8 | el: '#basicTable', |
9 | - url:$("#gridurl").val(), | ||
10 | parms:function(){ | 9 | parms:function(){ |
11 | - return {}; | 10 | + return { |
11 | + batchNo:common.util.__input("batchNo"), | ||
12 | + name:common.util.__input("name"), | ||
13 | + reqDepartment:common.util.__input("reqDepartment") | ||
14 | + }; | ||
12 | }, | 15 | }, |
13 | columns:[ | 16 | columns:[ |
14 | {display:"批次号",name:"batchNo"}, | 17 | {display:"批次号",name:"batchNo"}, |
@@ -25,31 +28,38 @@ exports.init = function() { | @@ -25,31 +28,38 @@ exports.init = function() { | ||
25 | }}, | 28 | }}, |
26 | {display:"限购码使用说明",name:"describe"}, | 29 | {display:"限购码使用说明",name:"describe"}, |
27 | {display:"申请人",name:"creatorName"}, | 30 | {display:"申请人",name:"creatorName"}, |
28 | - {display:"操作",render:function(){ | 31 | + {display:"操作",render:function(item){ |
29 | var HtmArr=[]; | 32 | var HtmArr=[]; |
30 | //限购码状态0:待审核 1:审核通过 2:驳回 3:过期 4:作废 | 33 | //限购码状态0:待审核 1:审核通过 2:驳回 3:过期 4:作废 |
31 | - HtmArr.push('<a href="/limit/code/info/'+ items.id+'" class="btn btn-info btn-xs">查看详情</a>'); | ||
32 | - if(items.status == 0){ | ||
33 | - HtmArr.push('<a class="btn btn-primary btn-xs apply-success" data-index="'+ items.__index+'" href="javascript:;">通过</a>'); | ||
34 | - HtmArr.push('<a class="btn btn-warning btn-xs apply-back" data-index="'+ items.__index+'" href="javascript:;">驳回</a>'); | ||
35 | - HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ items.__index+'" href="javascript:;">作废</a>'); | ||
36 | - }else if(status==1){ | ||
37 | - HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ items.__index+'" href="javascript:;">作废</a>'); | ||
38 | - }else if(status==2){ | ||
39 | - HtmArr.push('<a class="btn btn-info btn-xs apply-modify" href="/limit/code/update/'+ items.id+'">修改</a>'); | 34 | + HtmArr.push('<a href="/limit/code/info/'+ item.id+'" class="btn btn-info btn-xs">查看详情</a>'); |
35 | + if(item.status == 0){ | ||
36 | + HtmArr.push('<a class="btn btn-primary btn-xs apply-success" data-index="'+ item.__index+'" href="javascript:;">通过</a>'); | ||
37 | + HtmArr.push('<a class="btn btn-warning btn-xs apply-back" data-index="'+ item.__index+'" href="javascript:;">驳回</a>'); | ||
38 | + HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>'); | ||
39 | + }else if(item.status==1){ | ||
40 | + HtmArr.push('<a class="btn btn-danger btn-xs apply-cancel" data-index="'+ item.__index+'" href="javascript:;">作废</a>'); | ||
41 | + }else if(item.status==2){ | ||
42 | + HtmArr.push('<a class="btn btn-info btn-xs apply-modify" href="/limit/code/update/'+ item.id+'">修改</a>'); | ||
40 | } | 43 | } |
41 | return HtmArr.join(''); | 44 | return HtmArr.join(''); |
42 | }} | 45 | }} |
43 | ] | 46 | ] |
44 | }); | 47 | }); |
45 | - g.init(); | 48 | + g.init($("#gridurl").val()); |
49 | + | ||
50 | + $("#btn-search").click(function(){ | ||
51 | + g.reload(); | ||
52 | + }); | ||
53 | + $("#btn-reset").click(function(){ | ||
54 | + //g.reload(); | ||
55 | + }); | ||
46 | 56 | ||
47 | var tool={ | 57 | var tool={ |
48 | - toast:function(content,data){ | 58 | + toast:function(content,fn){ |
49 | common.dialog.confirm("温馨提示",content,function(){ | 59 | common.dialog.confirm("温馨提示",content,function(){ |
50 | common.util.__ajax({ | 60 | common.util.__ajax({ |
51 | url:'/limit/code/auditLimitCode', | 61 | url:'/limit/code/auditLimitCode', |
52 | - data:data | 62 | + data:fn() |
53 | },function(){ | 63 | },function(){ |
54 | g.reload(); | 64 | g.reload(); |
55 | }); | 65 | }); |
@@ -58,32 +68,38 @@ exports.init = function() { | @@ -58,32 +68,38 @@ exports.init = function() { | ||
58 | } | 68 | } |
59 | //审核通过 | 69 | //审核通过 |
60 | $('#basicTable').on('click', '.apply-success', function() { | 70 | $('#basicTable').on('click', '.apply-success', function() { |
61 | - var item=g.rows[$(this).data("data-index")]; | ||
62 | - var data={ | 71 | + var item=g.rows[$(this).data("index")]; |
72 | + var data=function(){ | ||
73 | + return { | ||
63 | id:item.id, | 74 | id:item.id, |
64 | status:1, | 75 | status:1, |
65 | reason:"预算不够" | 76 | reason:"预算不够" |
66 | }; | 77 | }; |
78 | + } | ||
67 | tool.toast("确定要通过该申请吗?",data); | 79 | tool.toast("确定要通过该申请吗?",data); |
68 | }); | 80 | }); |
69 | //驳回 | 81 | //驳回 |
70 | $('#basicTable').on('click', '.apply-back', function() { | 82 | $('#basicTable').on('click', '.apply-back', function() { |
71 | - var item=g.rows[$(this).data("data-index")]; | ||
72 | - var data={ | 83 | + var item=g.rows[$(this).data("index")]; |
84 | + var data=function(){ | ||
85 | + return { | ||
73 | id:item.id, | 86 | id:item.id, |
74 | status:2, | 87 | status:2, |
75 | - reason:"预算不够" | 88 | + reason:$("#reason").val() |
76 | }; | 89 | }; |
90 | + }; | ||
77 | tool.toast(common.util.__template($("#template").html(),{title:"你确定要驳回该申请吗?"}),data); | 91 | tool.toast(common.util.__template($("#template").html(),{title:"你确定要驳回该申请吗?"}),data); |
78 | }); | 92 | }); |
79 | //作废 | 93 | //作废 |
80 | $('#basicTable').on('click', '.apply-cancel', function() { | 94 | $('#basicTable').on('click', '.apply-cancel', function() { |
81 | - var item=g.rows[$(this).data("data-index")]; | ||
82 | - var data={ | 95 | + var item=g.rows[$(this).data("index")]; |
96 | + var data=function(){ | ||
97 | + return { | ||
83 | id:item.id, | 98 | id:item.id, |
84 | status: 3, | 99 | status: 3, |
85 | - reason:"预算不够" | 100 | + reason:$("#reason").val() |
86 | }; | 101 | }; |
102 | + } | ||
87 | tool.toast(common.util.__template($("#template").html(),{title:"你确定要作废此限购码吗?"}),data); | 103 | tool.toast(common.util.__template($("#template").html(),{title:"你确定要作废此限购码吗?"}),data); |
88 | }); | 104 | }); |
89 | } | 105 | } |
@@ -12,7 +12,7 @@ var config = { | @@ -12,7 +12,7 @@ var config = { | ||
12 | 'development':{ | 12 | 'development':{ |
13 | redis:null, | 13 | redis:null, |
14 | apiKey:'sd4H1ecAqlp', | 14 | apiKey:'sd4H1ecAqlp', |
15 | - domain:'http://192.168.102.215:8080/platform', | 15 | + domain:'http://192.168.102.215:8088/platform', |
16 | loggers: { | 16 | loggers: { |
17 | api: { | 17 | api: { |
18 | level:'verbose', | 18 | level:'verbose', |
@@ -15,14 +15,17 @@ exports.res = [ | @@ -15,14 +15,17 @@ exports.res = [ | ||
15 | gridurl:'/limit/code/ajax/index' | 15 | gridurl:'/limit/code/ajax/index' |
16 | } | 16 | } |
17 | }, | 17 | }, |
18 | - { | 18 | + {//查看列表【列表能够正常查看】 |
19 | route: '/limit/code/ajax/index', | 19 | route: '/limit/code/ajax/index', |
20 | method: 'POST', | 20 | method: 'POST', |
21 | url: '/limitCode/getLimitCodeList', | 21 | url: '/limitCode/getLimitCodeList', |
22 | isJsonRaw:true, | 22 | isJsonRaw:true, |
23 | params: [ | 23 | params: [ |
24 | {name: 'page', type: 'Number'}, | 24 | {name: 'page', type: 'Number'}, |
25 | - {name: 'size', type: 'Number'} | 25 | + {name: 'size', type: 'Number'}, |
26 | + {name: 'batchNo', type: 'String'}, | ||
27 | + {name: 'name', type: 'String'}, | ||
28 | + {name: 'reqDepartment', type: 'String'} | ||
26 | ] | 29 | ] |
27 | }, | 30 | }, |
28 | { | 31 | { |
@@ -38,10 +41,11 @@ exports.res = [ | @@ -38,10 +41,11 @@ exports.res = [ | ||
38 | } | 41 | } |
39 | }, | 42 | }, |
40 | src:'/limitcode/edit' | 43 | src:'/limitcode/edit' |
41 | - },{ | 44 | + },{//添加限购码【验证成功】 |
42 | route:'/limit/code/ajax/add', | 45 | route:'/limit/code/ajax/add', |
43 | method:'POST', | 46 | method:'POST', |
44 | url:'/limitCode/addLimitCode', | 47 | url:'/limitCode/addLimitCode', |
48 | + isJsonRaw: true, | ||
45 | params:[ | 49 | params:[ |
46 | {name:"name",type:"String"}, | 50 | {name:"name",type:"String"}, |
47 | {name:"limitTimes",type:"Number"}, | 51 | {name:"limitTimes",type:"Number"}, |
@@ -51,7 +55,7 @@ exports.res = [ | @@ -51,7 +55,7 @@ exports.res = [ | ||
51 | {name:"describe",type:"String"}, | 55 | {name:"describe",type:"String"}, |
52 | {name:"userUseLimit",type:"Number"}, | 56 | {name:"userUseLimit",type:"Number"}, |
53 | {name:"userTypeLimit",type:"Number"}, | 57 | {name:"userTypeLimit",type:"Number"}, |
54 | - //{name:"limitSkn",type:"String"}, | 58 | + {name:"limitSkn",type:"String"}, |
55 | {name:"creatorName",type:"String"}, | 59 | {name:"creatorName",type:"String"}, |
56 | {name:"creatorId",type:"Number"}, | 60 | {name:"creatorId",type:"Number"}, |
57 | {name:"status",type:"Number"} | 61 | {name:"status",type:"Number"} |
@@ -66,9 +70,47 @@ exports.res = [ | @@ -66,9 +70,47 @@ exports.res = [ | ||
66 | params: [ | 70 | params: [ |
67 | {name: 'id',type: 'String'} | 71 | {name: 'id',type: 'String'} |
68 | ] | 72 | ] |
69 | - },{//审核限购码接口 | ||
70 | - route: '/limit/code/auditLimitCode', | 73 | + } |
74 | + ,{//修改优惠码页面 | ||
75 | + route:'/limit/code/update/:id', | ||
71 | method: 'GET', | 76 | method: 'GET', |
77 | + view: 'pages/limitcode/edit', | ||
78 | + url:"/limitCode/getLimitCode", | ||
79 | + src:'/limitcode/edit', | ||
80 | + isJsonRaw: true, | ||
81 | + data: { | ||
82 | + action:"/limit/code/ajax/update", | ||
83 | + type:"update", | ||
84 | + }, | ||
85 | + params: [ | ||
86 | + {name: 'id',type: 'String'} | ||
87 | + ] | ||
88 | + } | ||
89 | + ,{ | ||
90 | + //更新限购码接口 | ||
91 | + route:'/limit/code/ajax/update', | ||
92 | + method:'POST', | ||
93 | + url:'/limitCode/updateLimitCode', | ||
94 | + isJsonRaw: true, | ||
95 | + params:[ | ||
96 | + {name:"name",type:"String"}, | ||
97 | + {name:"limitTimes",type:"Number"}, | ||
98 | + {name:"reqDepartment",type:"String"}, | ||
99 | + {name:"limitDateFrom",type:"String"}, | ||
100 | + {name:"limitDateTo",type:"String"}, | ||
101 | + {name:"describe",type:"String"}, | ||
102 | + {name:"userUseLimit",type:"Number"}, | ||
103 | + {name:"userTypeLimit",type:"Number"}, | ||
104 | + {name:"limitSkn",type:"String"}, | ||
105 | + {name:"creatorName",type:"String"}, | ||
106 | + {name:"creatorId",type:"Number"}, | ||
107 | + {name:"status",type:"Number"}, | ||
108 | + {name:"id",type:"Number"} | ||
109 | + ] | ||
110 | + } | ||
111 | + ,{//修改限购码接口状态[待验证] | ||
112 | + route: '/limit/code/auditLimitCode', | ||
113 | + method: 'POST', | ||
72 | view: 'pages/limitcode/info', | 114 | view: 'pages/limitcode/info', |
73 | url:"/limitCode/auditLimitCode", | 115 | url:"/limitCode/auditLimitCode", |
74 | isJsonRaw: true, | 116 | isJsonRaw: true, |
@@ -144,7 +144,7 @@ | @@ -144,7 +144,7 @@ | ||
144 | <input type="text" class="form-control" placeholder="UID"> | 144 | <input type="text" class="form-control" placeholder="UID"> |
145 | </div> | 145 | </div> |
146 | 146 | ||
147 | - <input type="hidden" value="{{userTypeLimit}}" id="userTypeLimit" for="checkbox" required placeholder="用户来源"> | 147 | + <input type="hidden" value="{{userTypeLimit}}" id="userTypeLimit" for="checkbox" required placeholder="会员身份"> |
148 | </div> | 148 | </div> |
149 | 149 | ||
150 | <div class="form-group"> | 150 | <div class="form-group"> |
@@ -225,6 +225,7 @@ | @@ -225,6 +225,7 @@ | ||
225 | 225 | ||
226 | 226 | ||
227 | <input type="hidden" value="{{status}}" id="status" > | 227 | <input type="hidden" value="{{status}}" id="status" > |
228 | + <input type="hidden" value="{{id}}" id="id" > | ||
228 | {{/ data}} | 229 | {{/ data}} |
229 | 230 | ||
230 | <div class="form-group"> | 231 | <div class="form-group"> |
@@ -27,14 +27,14 @@ | @@ -27,14 +27,14 @@ | ||
27 | <div class="panel-body"> | 27 | <div class="panel-body"> |
28 | <div class="row"> | 28 | <div class="row"> |
29 | <div class="panel-col2"> | 29 | <div class="panel-col2"> |
30 | - <input id="filter-id" class="form-control panel-input" type="text" placeholder="请输入批次号"> | 30 | + <input id="batchNo" class="form-control panel-input" type="text" placeholder="请输入批次号"> |
31 | </div> | 31 | </div> |
32 | <div class="panel-col2"> | 32 | <div class="panel-col2"> |
33 | - <input id="filter-name" class="form-control panel-input" type="text" placeholder="请输入名称"> | 33 | + <input id="name" class="form-control panel-input" type="text" placeholder="请输入名称"> |
34 | </div> | 34 | </div> |
35 | <div class="panel-col"> | 35 | <div class="panel-col"> |
36 | - <select id="filter-dep" name="filter-dep" tabindex="-1" title="" class="select2-offscreen brandBtn-group"> | ||
37 | - <option value="">全部</option> | 36 | + <select id="reqDepartment" name="filter-dep" tabindex="-1" title="" class="form-control"> |
37 | + <option value="-1">全部</option> | ||
38 | <option value="商品部">商品部</option> | 38 | <option value="商品部">商品部</option> |
39 | <option value="市场部">市场部</option> | 39 | <option value="市场部">市场部</option> |
40 | <option value="会员部">会员部</option> | 40 | <option value="会员部">会员部</option> |
@@ -45,8 +45,8 @@ | @@ -45,8 +45,8 @@ | ||
45 | <option value="其他">其他</option> | 45 | <option value="其他">其他</option> |
46 | </select> | 46 | </select> |
47 | </div> | 47 | </div> |
48 | - <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a> | ||
49 | - <a id="all-btn" href="javascript:;" class="btn btn-info">全部</a> | 48 | + <a id="btn-search" href="javascript:;" class="btn btn-info">筛选</a> |
49 | + <a id="btn-reset" href="javascript:;" class="btn btn-info">全部</a> | ||
50 | </div> | 50 | </div> |
51 | </div> | 51 | </div> |
52 | </div> | 52 | </div> |
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | <script id="template" type="text/template"> | 67 | <script id="template" type="text/template"> |
68 | <p>{title}</p> | 68 | <p>{title}</p> |
69 | <label class="col-sm-3 control-label">*请填写原因</label> | 69 | <label class="col-sm-3 control-label">*请填写原因</label> |
70 | - <input id="cancel-reason" type="text" class="form-control" name="agreement-code" style="width:280px;"> | 70 | + <input id="reason" type="text" class="form-control" name="agreement-code" style="width:280px;"> |
71 | </script> | 71 | </script> |
72 | 72 | ||
73 | 73 |
-
Please register or login to post a comment