Showing
1 changed file
with
25 additions
and
24 deletions
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | var $ = require('jquery'), common = require('../../../common/common'); | 5 | var $ = require('jquery'), common = require('../../../common/common'); |
6 | require('../../../common/util/datepicker'); | 6 | require('../../../common/util/datepicker'); |
7 | 7 | ||
8 | + | ||
8 | //日期插件 | 9 | //日期插件 |
9 | $('.hasDatepicker').fdatepicker({ | 10 | $('.hasDatepicker').fdatepicker({ |
10 | format: 'yyyy-mm-dd hh:ii:ss', | 11 | format: 'yyyy-mm-dd hh:ii:ss', |
@@ -33,7 +34,9 @@ var tableGird = new common.grid({ | @@ -33,7 +34,9 @@ var tableGird = new common.grid({ | ||
33 | return items.productSkn; | 34 | return items.productSkn; |
34 | }}, | 35 | }}, |
35 | { display: "有效期", render: function(items) { | 36 | { display: "有效期", render: function(items) { |
36 | - return items.startTime + items.endTime; | 37 | + return common.util.__secondsFormat(items.startTime) |
38 | + + " ~ " | ||
39 | + + common.util.__secondsFormat(items.endTime); | ||
37 | }}, | 40 | }}, |
38 | { display: "折扣", render: function(items) { | 41 | { display: "折扣", render: function(items) { |
39 | return items.discount; | 42 | return items.discount; |
@@ -42,16 +45,33 @@ var tableGird = new common.grid({ | @@ -42,16 +45,33 @@ var tableGird = new common.grid({ | ||
42 | if (items.status != 1) { | 45 | if (items.status != 1) { |
43 | return "已终止"; | 46 | return "已终止"; |
44 | } | 47 | } |
45 | - | ||
46 | - return ''; | 48 | + var now = Date.parse(new Date())/1000; |
49 | + // 未开始 | ||
50 | + if (items.startTime > now) { | ||
51 | + return "未开始"; | ||
52 | + } | ||
53 | + // 进行中 | ||
54 | + if (items.startTime <= now && items.endTime >= now) { | ||
55 | + return "进行中"; | ||
56 | + } | ||
57 | + // 已结束 | ||
58 | + if (items.endTime < now) { | ||
59 | + return "已结束"; | ||
60 | + } | ||
61 | + return "时间设置错误"; | ||
47 | }}, | 62 | }}, |
48 | { display: "操作信息", render: function(items) { | 63 | { display: "操作信息", render: function(items) { |
49 | - return ''; | 64 | + return items.operator + common.util.__secondsFormat(items.updateTime); |
50 | }}, | 65 | }}, |
51 | { display: "操作", render: function(items) { | 66 | { display: "操作", render: function(items) { |
67 | + var now = Date.parse(new Date())/1000; | ||
52 | var HtmArr = []; | 68 | var HtmArr = []; |
69 | + if (items.status == 1 && items.startTime > now) { | ||
53 | HtmArr.push('<a href="/product/bundle/' + items.id + '" data-id="' + items.id + '" class="btn btn-primary btn-xs">编辑</a>'); | 70 | HtmArr.push('<a href="/product/bundle/' + items.id + '" data-id="' + items.id + '" class="btn btn-primary btn-xs">编辑</a>'); |
54 | - HtmArr.push('<a href="javascript:void(0);" data-id="' + items.id + '" class="btn btn-danger btn-xs delete">删除</a>'); | 71 | + } |
72 | + if (items.status != 1 && items.endTime < now) { | ||
73 | + HtmArr.push('<a href="javascript:void(0);" data-id="' + items.id + '" class="btn btn-danger btn-xs delete">终止</a>'); | ||
74 | + } | ||
55 | return HtmArr.join(''); | 75 | return HtmArr.join(''); |
56 | } | 76 | } |
57 | }] | 77 | }] |
@@ -94,22 +114,3 @@ $(document).on('click', '.delete', function () { | @@ -94,22 +114,3 @@ $(document).on('click', '.delete', function () { | ||
94 | }); | 114 | }); |
95 | }); | 115 | }); |
96 | }); | 116 | }); |
97 | - | ||
98 | -/* | ||
99 | - * 复制token点击事件 | ||
100 | - */ | ||
101 | -$(document).on('click', '.info-copy', function () { | ||
102 | - common.util.__tip("Token 复制成功", "success") | ||
103 | -}); | ||
104 | - | ||
105 | -/** | ||
106 | - * 查看token使用方法 | ||
107 | - */ | ||
108 | -$(document).on('click', '#token', function () { | ||
109 | - var a = new common.dialog({ | ||
110 | - title: "<h4>token使用方法</h4>", | ||
111 | - width: '50%', | ||
112 | - content: '<p>活动开发人员使用Token时,按照对应格式写在页面中,示例代码:</p><p><a class="yoho-coin" ' + | ||
113 | - 'href="javascript:;" data-token="7173278a4a86">有货币领取按钮</a></p><p><b>注:必须引入 JS 插件</b></p>' | ||
114 | - }); | ||
115 | -}); |
-
Please register or login to post a comment