add.vm
6.22 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
<script src="/assets/js/jquery.js"></script>
<script src="/assets/js/riotjs/riotjs.js"></script>
<script src="/assets/products/product.search.categroy.js"></script>
<script src="/assets/products/addProductSearchCate.js"></script>
<script type="text/javascript" src="http://static.1n4j.com/static/newStatic/common/js/base/sea.js"></script>
<script type="text/javascript" src="http://static.1n4j.com/static/newStatic/pnr/js/javascript/common/config.js"></script>
<link rel="stylesheet" type="text/css" href="http://static.1n4j.com/static/newStatic/pnr/backstage/css/fancy.css">
<DIV id="navBar" title="productSearchCate">
<li><a href="$!{contextPath}/">首页</a><span class="divider">></span>
<a href="$!{contextPath}/titan/nhtop">农户置顶排序</a></li>
</DIV>
<input type="hidden" id="searchCid" value="$!{cid}">
<form class="well form-search" name="productSearchCateForm" id="productSearchCateForm" action="/titan/nhtop" method="POST" >
请选择城市:
<span id="cityBox"></span>
<button type="submit" class="btn btn-sm btn-primary"><i class="icon-search icon-white search"></i>搜索</button>
<button type="button" class="btn btn-sm btn-primary btn-clear">清除</button>
<a class="btn btn-sm btn-primary act-fancy" href="#fancyalter" style="float:right">新增区域</a>
</form>
<!-- 表格数据 -->
<table class="table table-striped table-bordered table-condensed grid">
<thead>
<tr>
<th #sorting($!{productSearchSort} "id")>编号</th>
<th #sorting($!{productSearchSort} "categoryName")>区域名称</th>
<th #sorting($!{productSearchSort} "ProductSearchSortCount")>推荐商品数量</th>
<th>操作</th>
</tr>
</thead>
<tbody>
#foreach(${item} in ${page.result})
<tr>
<td style="width:20%;text-align:center;vertical-align:middle;">$!{item.id}</td>
<td style="width:35%;text-align:center;vertical-align:middle;">$!{item.name}</td>
<td style="width:20%;text-align:center;vertical-align:middle;">$!{item.ProductSearchSortCount}</td>
<td class="textC" style="width:20%;text-align:center;vertical-align:middle;">
<div class="btn-group">
<a href="/titan/nhtop/sortlist?cateId=${item.cid}"><i class="icon-eye-open"></i> 添加排序商品</a>
<a href="javascript:void(0)" onclick="deleteSearchCate($!{item.cid})"><i class="icon-pencil"></i> 删除</a>
</div>
</td>
</tr>
#end
</tbody>
</table>
<div class="fancyalter" id="fancyalter">
<h2 class="alterhd">添加区域</h2>
<div class="alterbd">
<div class="fancysearch">
<div class="completethis" id="completethisId" style="width:550px">
选择城市:
<span id="city" class="required"></span>
</div>
</div>
<div class="completethis">
<a href="#" class="addsucc" id="addsc">确定添加</a>
</div>
</div>
</div>
<!-- 分页栏 -->
#showPage($!{page})
<script src="/assets/js/underscore.js"></script>
<script src="/js/common/dilicity.js"></script>
<script>
$(document).ready(function(){
$(".btn-clear").click(function(){
// $("#cityBox select:first option:first").prop("selected", 'selected');
// $("#cityBox select:first option:first").change();
window.location.href="/titan/nhtop";
})
//添加市场
$("#addsc").live('click', function(){
var cateStr = $("#sccid ").val();
if(cateStr == null || cateStr==""){
XUI.window.alert("区域必须选择到最后一级!");
return ;
}
$.ajax({
type : "post",
dataType : "json",
url : "/titan/nhtop/save",
data : {"cid" : cateStr},
success : function(data){
if(data.code == "success"){
window.location.href="/titan/nhtop";
}else{
XUI.window.alert(data.result);
}
},
error : function(){
XUI.window.alert("网络错误,请稍后重试");
}
});
});
$("#productSearchCateForm").submit(function(){
var cid = $("#cid").val();
var isSelect = false;
$("#cityBox").find("select").each(function () {
var item = $(this).find("option:selected");
if (item.val() != "" && item.val() !="请选择") {
isSelect = true;
}
});
if(isSelect) {
if (cid) {
return true;
}
alert("区域必须选择到最后一级!");
return false;
}
})
});
function deleteSearchCate(cid){
XUI.window.confirm("确定要删除排序市场吗?", "删除排序市场", function(){
$.ajax({
type : "post",
dataType : "json",
url : "/titan/nhtop/delete",
data : {cateId : cid},
success : function(data){
if(data.code == "success"){
//XUI.window.alert(" 排序分类已成功删除,若以后还需要对该分类商品进行排序,请重新添加排序分类!");
window.location.href="/titan/nhtop";
}else{
XUI.window.alert(data.result);
}
},
error : function(){
XUI.window.alert("网络错误,请稍后重试");
}
});
});
}
seajs.use(['fancybox'], function(fancybox){
$(".act-fancy").fancybox({
scrolling: 'visible',
afterClose: function(){
$("#city select:first option:first").prop("selected", 'selected');
$("#city select:first option:first").change();
// $("#productCategoryId select:first option:first").change();
}
});
});
/**
* 城市选择
*/
var pcfg = {
name: "cid",
#if(${cid})
val:${cid}
#end
};
$("#cityBox").diliCountry(pcfg);
/**
* 城市选择
*/
var pcfg1 = {
name: "sccid",
};
$("#city").diliCountry(pcfg1);
</script>