index.html
7.1 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
<include file="public@header"/>
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">商品列表</a></li>
<li><a href="{:url('add')}">添加商品</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('index')}">
id:
<input class="form-control" type="text" name="id" style="width: 100px;" value="{$id|default=''}"
placeholder="请输入id">
一级分类:
<select name="cate1" class="form-control" style="width: 120px;" id="classo" onchange="teacherChange(this.options[this.selectedIndex].value)">
<option value>选择分类</option>
<foreach name="cate3" item="vo">
<option value="{$vo.id}" <eq name="$cate1" value="$vo.id">selected</eq>>{$vo.name}</option>
</foreach>
</select>
二级分类:
<select name="cate2" class="form-control" style="width: 120px;" id="classobj">
<option value>选择分类</option>
<foreach name="cate4" item="vo">
<option value="{$vo.id}" <eq name="$cate2" value="$vo.id">selected</eq>>{$vo.name}</option>
</foreach>
</select>
商品名称:
<input class="form-control" type="text" name="name" style="width: 200px;" value="{$name|default=''}"
placeholder="请输入商品名称">
单价:
<input class="form-control" type="number" name="min" style="width: 100px;" value="{$min|default=''}"
placeholder="最低价">-
<input class="form-control" type="number" name="max" style="width: 100px;" value="{$max|default=''}"
placeholder="最高价">
商品状态:
<select name="zt" class="form-control" style="width: 120px;">
<option value>选择状态</option>
<option value="1" <eq name="$zt" value="1">selected</eq>>上架</option>
<option value="2" <eq name="$zt" value="2">selected</eq>>下架</option>
<option value="3" <eq name="$zt" value="3">selected</eq>>推荐</option>
<option value="4" <eq name="$zt" value="4">selected</eq>>不推荐</option>
</select>
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('index')}">清空</a>
</form>
<form method="post" class="js-ajax-form">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th style="width: 50px;">id</th>
<th>商品名称</th>
<th>商品简介</th>
<th style="width: 80px;">一级分类</th>
<th style="width: 80px;">二级分类</th>
<th style="width: 130px;">添加时间</th>
<th style="width: 130px;">积分售价</th>
<th style="width: 130px;">金额售价</th>
<th style="width: 50px;">总价</th>
<th style="width: 150px;">商品状态</th>
<th style="width: 260px;">操作</th>
</tr>
</thead>
<tbody>
<foreach name="all" item="vo">
<tr>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td>{$vo.intro}</td>
<td>{$vo.caname}</td>
<td>{$vo.cname}</td>
<td>{:date('Y-m-d H:i',$vo.create_time)}</td>
<td>
<if condition="$vo.caid eq 1||$vo.caid eq 3">
{$vo.caname}专区商品
<elseif condition="$vo.is_type eq 2">
最低现金商品
<else>
{$vo.price_num}
</if>
</td>
<td>
<if condition="$vo.caid eq 1||$vo.caid eq 3">
{$vo.caname}专区商品
<else>
{$vo.price_cash}
</if>
</td>
<td>{$vo.price}</td>
<td>
<eq name="$vo.is_shove" value="1">
不推荐
<else>
推荐
</eq>,
<eq name="$vo.is_sta" value="1">
上架
<else>
下架
</eq>
</td>
<td>
<a href="{:url('edit',array('id'=>$vo.id))}">编辑</a>
<eq name="$vo.is_shove" value="1">
<a href="{:url('state',array('id'=>$vo['id'],'is_shove'=>'2'))}" class="js-ajax-dialog-btn" data-msg="确定推荐该商品">推荐</a>
<else>
<a href="{:url('state',array('id'=>$vo['id'],'is_shove'=>'1'))}" class="js-ajax-dialog-btn" data-msg="确定取消推荐">不推荐</a>
</eq>
<eq name="$vo.is_sta" value="1">
<a href="{:url('state',array('id'=>$vo['id'],'is_sta'=>'2'))}" class="js-ajax-dialog-btn" data-msg="确定下架商品">下架</a>
<else>
<a href="{:url('state',array('id'=>$vo['id'],'is_sta'=>'1'))}" class="js-ajax-dialog-btn" data-msg="确定上架商品">上架</a>
</eq>
<a href="{:url('delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
<a href="{:url('eva',array('id'=>$vo.id))}">查看评论</a>
</td>
</tr>
</foreach>
</tbody>
</table>
<div class="pagination">{$page}</div>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
var ar1={:json_encode($cate4)};//后台传入服务名称
//当选择指向类时改变目标的下拉菜单
function teacherChange(area){
var tobj=document.getElementById('classobj');
removeAllOptions(tobj);
var option = document.createElement("option");
option.text = "选择分类";
option.value = "";
tobj.add(option);
for(m=0;m<ar1.length;m++){
if (ar1[m]['cid']==area&&area!=''){
var option = document.createElement("option");
option.text = ar1[m]['name'];
option.value = ar1[m]['id'];
tobj.add(option);
}else if(area==''){
var option = document.createElement("option");
option.text = ar1[m]['name'];
option.value = ar1[m]['id'];
tobj.add(option);
}
}
}
//移除option 当中所有元素
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
selectbox.remove(i);
}
}
</script>
</body>
</html>