-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides.js
342 lines (320 loc) · 10.1 KB
/
slides.js
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
var userMenuTimeOut=null;
jQuery(function($){
if($(".slide-pic").length>0)
{
var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
var _titles = $("ul.slide-txt li");
var _titles_bg = $("ul.op li");
var _bodies = $("ul.slide-pic li");
var _count = _titles.length;
var _current = 0;
var _intervalID = null;
var stop = function() { window.clearInterval(_intervalID); };
var slide = function(opts) {
if (opts) {
_current = opts.current || 0;
} else {
_current = (_current >= (_count - 1)) ? 0 : (++_current);
};
_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
_bodies.removeClass("cur").eq(_current).addClass("cur");
});
_titles.removeClass("cur").eq(_current).addClass("cur");
_titles_bg.removeClass("cur").eq(_current).addClass("cur");
};
var go = function() {
stop();
_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
};
var itemMouseOver = function(target, items) {
stop();
var i = $.inArray(target, items);
slide({ current: i });
};
_titles.click(function() { if($(this).attr('class')!='cur'){itemMouseOver(this, _titles); }else{stop();}}, go);
_bodies.hover(stop, go);
go();
}
$(".AntCityLay").hover(function(){
clearTimeout(userMenuTimeOut);
},function(){
$(this).fadeOut();
});
var now = new Date(),hour = now.getHours()
if(hour < 6){$("#AntHours").html("凌晨好!")}
else if (hour < 9){$("#AntHours").html("早上好!")}
else if (hour < 12){$("#AntHours").html("上午好!")}
else if (hour < 14){$("#AntHours").html("中午好!")}
else if (hour < 17){$("#AntHours").html("下午好!")}
else if (hour < 19){$("#AntHours").html("傍晚好!")}
else if (hour < 22){$("#AntHours").html("晚上好!")}
else {$("#AntHours").html("夜里好!")};
$("#tuangou1").mouseover(function(){
$(this).addClass("on");
$("#tuangou2").removeClass("on");
$("#tuangoushow1").show();
$("#tuangoushow2").hide();
});
$("#tuangou2").mouseover(function(){
$(this).addClass("on");
$("#tuangou1").removeClass("on");
$("#tuangoushow2").show();
$("#tuangoushow1").hide();
});
$(".Ant-FloatClass").hover(function(){
$(".Select").show();
},function(){
$(".Select").hide();
});
$(".Ant-ul").find(".Ant-li").each(function(){
$(this).hover(function(){
$(this).find('.Ant-Lower').show();
$(this).find('.Ant-A').addClass("current");
},function(){
$(this).find('.Ant-Lower').hide();
$(this).find('.Ant-A').removeClass("current");
});
});
$(".AntCategories").find(".li").each(function(){
$(this).mouseover(function(){
$(this).addClass("Ant-li");
});
$(this).mouseout(function(){
$(this).removeClass("Ant-li");
});
});
$("#cataloglast").click(function(){
var y=$("#cataloglastShow").offset().top ;
$(document.documentElement).animate({"scrollTop": y}, {duration:"slow"});
});
$("#searchinputfrom").submit(function(){
var aa=$("#Shophiddenvalue").val();
var word=$.trim($("#topshopkeyword").val());
if( word.length==0 || word=="请输入您想要的店铺名或者掌柜" || word=="请输入您想要的商品"){
alert("请先选择您要搜索的条件!");
$("#topshopkeyword").focus();
return false;
}
var bb=aa.split(",");
if($("#topshopkeyword").attr("rel")=="1")
{
var url=$("#companyurl").val()+"Storelist.aspx?SearchKeyword="+escape(word);
if(bb[0]=="0")
var url=$("#companyurl").val()+encodeURIComponent("StoreList-0-0-0-0-0-0-0-S"+word+"S-p0"+bb[1]);
}
else{
var url="ItemSearch.aspx?SearchKeyword="+escape(word);
if(bb[0]=="0")
var url=encodeURIComponent("ItemSearch-0-0-0-0-0-0-0-0-0-S"+word+"S-p0"+bb[1]);
}
window.open(url,"_self");
return false;
});
$("#listformsearch").submit(function(){
var aa=$("#Shophiddenvalue").val();
var word=$.trim($("#SearchKeyword").val());
var R1=$.trim($("#R1").val());
var R2=$.trim($("#R2").val());
if(R1=="")
R1="0";
if(R2=="")
R2="0";
if( word.length==0 && R1=="0" && R2=="0" )
{
alert("请先选择您要搜索的条件!");
$("#SearchKeyword").focus();
return false;
}
if(!checknumber(R1) && R1!="0")
{
alert("输入的价格不对,只支持输入整数!");
return false;
}
if(!checknumber(R2) && R2!="0")
{
alert("输入的价格不对,只支持输入整数!");
return false;
}
if( (R1!="0" && R2=="0") || (R1=="0" && R2!="0") )
{
alert("请输入价格超始和结束范围!");
return false;
}
var bb=aa.split(",");
var url="ItemSearch.aspx?SearchKeyword="+escape(word)+"&R1="+R1+"&R2="+R2;
if(bb[0]=="0")
var url=encodeURIComponent("ItemSearch-0-0-0-0-0-0-0-"+R1+"-"+R2+"-S"+word+"S-p0"+bb[1]);
window.open(url,"_self");
return false;
});
$(".Ant-EmptyCart").click(function(){
if(confirm("您确定要清空购物车吗?"))
{
$.ajax({
url: "/public/ajax.aspx?action=deleteshoptoorder",
cache: false,
success:function(data)
{
window.location.href=window.location.href;
}
});
}
});
$(".Ant-UpdateQuantity").click(function(){
$(".Ant-ShoppingCart-01").find("#ordertr").each(function(){
var obj=$(this);
//alert("/public/ajax.aspx?action=updateshoporder&aa="+obj.find("#text").val()+"&id="+obj.find("#text").attr("rel"));
$.ajax({
url: "/public/ajax.aspx?action=updateshoporder&aa="+obj.find("#text").val()+"&id="+obj.find("#text").attr("rel"),
cache: false,
success:function(data)
{
if(data!=0)
{
alert(data);
return false;
}
}
});
});
//window.location.href=window.location.href;
});
$(".Ant-ShoppingCart-01").find("#ordertr").each(function(){
var obj=$(this);
obj.find('#delete').click(function(){
if(confirm("确定要删除该宝贝吗?"))
{
$.ajax({
url: "/public/ajax.aspx?action=deleteshoptoorder&id="+obj.find("#text").attr("rel"),
cache: false,
success:function(data)
{
window.location.href=window.location.href;
}
});
}
});
obj.find('#Update').click(function(){
var aa=obj.find("#text").val();
if(!checknumber(aa))
{
alert("对不起,数量填写不正确!");
return false;
}
else
{
$.ajax({
url: "/public/ajax.aspx?action=updateshoporder&aa="+aa+"&id="+obj.find("#text").attr("rel"),
cache: false,
success:function(data)
{
if(data==0)
{
window.location.href=window.location.href;
}
else{
alert(data);
}
}
});
}
});
});
if($("#formordersubmit").length>0)
{
$.formValidator.initConfig({formid:"formordersubmit",errorfocus:false,onerror:function(msg){},onsuccess:function(){
$("#querengorder").attr("disabled", true);
var curl="../public/ajax.aspx?action=addcompanyorder&OrderMan="+escape($("#txtOrderMan").val());
curl +="&OrderAddress="+escape($("#txtOrderAddress").val())+"&OrderCode="+escape($("#txtOrderCode").val())+"&OrderTel="+escape($("#txtOrderTel").val())+"&OrderMark="+escape($("#txtOrderMark").val())+"&OrderPeisong="+$("input[name='txtOrderPeisong']:checked").val();
$.ajax({
url: curl,
cache: false,
success:function(data)
{
var re = /^[1-9]+[0-9]*]*$/; // 整数
if (re.test(data))
{
window.location.href="SuccesOrder.aspx?id="+data;
}
else{
alert(data);
$("#querengorder").attr("disabled", false);
}
}
});
return false;
}});
$.formValidator.getInitConfig("1").wideword = true;
$("#txtOrderMan").formValidator({onshow:"请正确填写姓名,最少不能低于2个字,最多不能超过15个字",onfocus:"请正确填写姓名,最少不能低于2个字,最多不能超过15个字"}).functionValidator({
fun:function(val,elem){
var tt= 0;
if($("#txtOrderPeisong").length>0)
tt = $("input[name='txtOrderPeisong']:checked").val();
if( ( val.length>1 && val.length<15 ) ){
return true;
}else{
return "请正确填写姓名,最少不能低于2个字,最多不能超过15个字"
}
}
});
$("#txtOrderTel").formValidator({onshow:"请输入正确的联系电话。",onfocus:"请输入正确的联系电话。"}).functionValidator({
fun:function(val,elem){
if( val.match(/^.{6,}$/) ){
return true;
}else{
return "您输入的联系电话格式不正确。"
}
}
});
$("#txtOrderAddress").formValidator({onshow:"请输入详细的收货地址。",onfocus:"收货地址最少3个汉字,请正确填写。"}).functionValidator({
fun:function(val,elem){
var tt= 0;
if($("#txtOrderPeisong").length>0)
tt = $("input[name='txtOrderPeisong']:checked").val();
if( ( val.length>2 && val.length<60 ) || tt==1 ){
return true;
}else{
return "收货地址3到60个字,请正确填写"
}
}
});
$("#txtOrderCode").formValidator({onshow:"请输入6位邮政编码。",onfocus:"请输入6位邮政编码"}).functionValidator({
fun:function(val,elem){
var tt= 0;
if($("#txtOrderPeisong").length>0)
tt = $("input[name='txtOrderPeisong']:checked").val();
if( val.match(/^\d{6}$/) || tt==1 ){
return true;
}else{
return "邮政编码填写有误,请输入6位邮政编码"
}
}
});
$("#txtOrderMark").formValidator({onshow:"补充说明不能超过500字。",onfocus:"补充说明不能超过500字。",oncorrect:" "}).inputValidator({min:0,max:500,onerror: "补充说明不能超过500字。"})
}
});
function setsonghuofashi()
{
if( $("#totalmoney").html()!="面议")
{
var totalmoney = parseFloat( $("#totalmoney").html().replace("¥","") );
var yunfeimoney=0;
$(".Ant-ShoppingCart-01").find("#ordertr").each(function(){
var obj=$(this);
yunfeimoney += parseFloat( obj.attr("rel") );
var thisyunfeimoney = parseFloat( obj.attr("rel") ) ;
if(thisyunfeimoney==0 || tt==1)
{
obj.find("#totalyunfeitr").html("无");
}
if(tt==0)
{
if( thisyunfeimoney >0 )
obj.find("#totalyunfeitr").html("¥"+thisyunfeimoney.toFixed(2));
else
obj.find("#totalyunfeitr").html("无");
}
});
}
}