index.php
9.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use common\helpers\ImageManager;
use domain\shop\ShopItemStatus;
$this->title = '商品管理';
$this->params['breadcrumbs'][] = '商城管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
<div class="panel-body">
<form action="" method="get" id="search-form" class="filter-form">
<table width="100%" class="table table-bordered">
<tbody>
<tr >
<td width="10%" class="text-right">商品名称:</td>
<td width="20%" class="text-left"><input type="text" class="form-control" name="name" id="name" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>"></td>
<td width="10%" class="text-right">商品添加开始时间:</td>
<td width="20%" class="text-left"><input type="date" class="form-control" name="creatTime" value="<?php if (!empty($gets['creatTime'])){ echo $gets['creatTime']; } ?>"></td>
<td width="10%" class="text-right">商品添加结束时间:</td>
<td width="20%" class="text-left"><input type="date" class="form-control" name="endTime" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>"></td>
</tr>
<tr class="search">
<td colspan="4" class="text-center">
<button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button>
<a class="btn btn-default btncls" href="<?=Url::toRoute(["/shop/goods/index"])?>">重 置</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th width="6%">ID</th>
<th width="10%">商品信息</th>
<th width="20%">商品主图</th>
<th width="30%">商品详情图</th>
<th width="10%">新增时间</th>
<th width="10%">状态</th>
<th width="14%">操作</th>
</tr>
</thead>
<tbody>
<?php if ($listdata) { ?>
<?php foreach ($listdata as $item) : ?>
<tr>
<td style="padding:12px;">
<?= $item['id'] ?>
</td>
<td style="padding:12px;">
商品名称:<?= $item['name'] ?><br/>
商品售价:¥<?= $item['price'] ?><br/>
商品原价:¥<?= $item['market_price'] ?><br/>
商品描述:<?= $item['desc'] ?><br/>
所属工程师:<?= (isset($item['engineer_info'][0]["firstname"]) ? $item['engineer_info'][0]["firstname"] : "") . (isset($item['engineer_info'][0]["lastname"]) ? $item['engineer_info'][0]["lastname"] : "") ?><br/>
所属工程师昵称:<?= (isset($item['engineer_info'][0]["nickname"]) ? $item['engineer_info'][0]["nickname"] : "") ?><br/>
所属工程师电话:<?= (isset($item['engineer_info'][0]["phone"]) ? $item['engineer_info'][0]["phone"] : "") ?><br/>
</td>
<td style="padding:12px;">
<?php foreach ($item["main_images"] as $main_image) : ?>
<img src="<?= ImageManager::getUrl(isset($main_image['path']) ? $main_image['path'] : "") ?>" height="100" style="padding: 0 1rem 0 0; margin-bottom: 1rem"/>
<?php endforeach; ?>
</td>
<td style="padding:12px;">
<?php foreach ($item["detail_images"] as $detail_image) : ?>
<img src="<?= ImageManager::getUrl(isset($detail_image['path']) ? $detail_image['path'] : "") ?>" height="75" style="padding: 0 1rem 0 0; margin-bottom: 1rem"/>
<?php endforeach; ?>
</td>
<td style="padding:12px;">
<?= date("Y-m-d H:i:s", $item['created_at'])?>
</td>
<td style="padding:12px;">
<?php if (ShopItemStatus::STATUS_STAY == $item['status']) {?>
<span style="background-color: #0a60d6; padding: 6px; color: #ffffff;">
<?php } elseif (ShopItemStatus::STATUS_SUCCESS == $item['status']) {?>
<span style="background-color: #00aa00; padding: 6px; color: #ffffff;">
<?php } elseif (ShopItemStatus::STATUS_REFUSE == $item['status']) {?>
<span style="background-color: #C40000; padding: 6px; color: #ffffff;">
<?php }?>
<?= ShopItemStatus::authStatusLabel($item['status']) ?>
</span>
</td>
<td style="padding:12px;">
<button class="btn btn-info btn-sm btn_auth_success" aid="<?=$item['id'] ?>">审核通过</button> |
<button class="btn btn-danger btn-sm btn_auth_fail" aid="<?=$item['id'] ?>">审核拒绝</button> |
<button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>
</td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td colspan="8">
<center>暂无记录</center>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
<div class="clearfix"></div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$(".btn_del").bind("click",function () {
if (confirm("确定要删除商品吗?对应工程师商品列表中也会一并删除,请谨慎操作")){
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法删除,请刷新后再试");
return false;
}
var thiz = $(this);
$.ajax({
type: "post",
url: "do-del",
dataType:"json",
data: $.csrf({"data_id":data_id}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
thiz.parents("tr").remove();
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
}
}) ;
$(".btn_auth_fail").bind("click",function () {
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法审核,请刷新后再试");
return false;
}
var thiz = $(this);
$.ajax({
type: "post",
url: "do-auth",
dataType:"json",
data: $.csrf({"data_id":data_id, "auth_type": "auth_fail"}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
window.location.reload();
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
}) ;
$(".btn_auth_success").bind("click",function () {
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法审核,请刷新后再试");
return false;
}
var thiz = $(this);
$.ajax({
type: "post",
url: "do-auth",
dataType:"json",
data: $.csrf({"data_id":data_id, "auth_type": "auth_success"}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
window.location.reload();
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
}) ;
});
</script>