index.blade.php
5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.couponorder.management'))
@section('after-styles')
{{ Html::style("https://cdn.datatables.net/v/bs/dt-1.10.15/datatables.min.css") }}
@endsection
@section('page-header')
<h1>
{{ trans('labels.backend.couponorder.management') }}
<small>{{ trans('labels.backend.couponorder.active') }}</small>
</h1>
@endsection
@section('content')
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.couponorder.active') }}</h3>
<div class="box-tools pull-right">
@include('backend.couponorder.includes.Partials.couponorder-header-button')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<table id="users-table" class="table table-condensed table-hover">
<thead>
<tr>
{{--<th>{{ trans('labels.backend.couponorder.table.type') }}</th>--}}
<th>{{ trans('labels.backend.couponorder.table.nick_name') }}</th>
<th>{{ trans('labels.backend.couponorder.table.discount') }}</th>
{{--<th>{{ trans('labels.backend.couponorder.table.discount_money') }}</th>--}}
<th>{{ trans('labels.backend.couponorder.table.reason') }}</th>
<th>{{ trans('labels.backend.couponorder.table.status') }}</th>
</tr>
</thead>
</table>
</div><!--table-responsive-->
</div><!-- /.box-body -->
</div><!--box-->
@endsection
@section('after-scripts')
{{ Html::script("https://cdn.datatables.net/v/bs/dt-1.10.15/datatables.min.js") }}
{{ Html::script("js/backend/plugin/datatables/dataTables-extend.js") }}
<script>
var date = new Date().getDate();
$(function () {
$('#users-table').DataTable({
dom: 'lfrtip',
processing: false,
serverSide: true,
autoWidth: false,
ajax: {
url: '{{ route("admin.couponorder.get") }}',
type: 'get',
data: {status: 1, trashed: false},
error: function (xhr, err) {
if (err === 'parsererror')
location.reload();
}
},
columns: [
// {
// data: 'type', name: 'type', render: function (data, type, row, meta) {
// if (data == 1) {
// data = '折扣类型'
// } else if (data == 2) {
// data = "满减类型"
// } else if (data == 3) {
// // data = "以领取"
// }
//
// return data;
// }
// },
{data: 'nick_name', name: 'nick_name'},
{
data: 'discount', name: 'discount', render:function(data, type, row, meta){
data = data / 100;
return data;
}
},
// {data: 'reason', name: 'reason'},
{
data: 'discount_money', name: 'discount_money',render:function(data, type, row, meta){
data = data / 100;
return data
}
},
{
data: 'status', name: 'status', render: function (data, type, row, meta) {
var date = getNowFormatDate();
if (data == 1 ) {
if(date > row.expire_time){
data = '<span style="color:red;">已过期</span>';
}else{
data = '<span style="color:green;">领取未使用</span>';
}
} else if (data == 2) {
data = '<span style="color:blue;">已使用</span>';
}
return data;
}
},
//
],
order: [[0, "asc"]],
searchDelay: 500
});
});
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
}
</script>
@endsection