HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/dd.cwoyt.com/js/public.js
layui.use(['form'],function(){
  var form = layui.form
  ,layer = layui.layer;
}); 


//单选产品
function radio(obj){
	
	$(obj).siblings('li').removeClass('this');
	$(obj).addClass('this');
	
	var nid = $(obj).attr('nid');
	var price = $(obj).attr('price');
	var title = $(obj).find('span').html();
	var img = $(obj).find('img').attr('src');
	
	if(price){
		$('[name="price"]').val(price);
		$('#showPrice').html(price);
		$('[name="num"]').val(1)
	}
	$(obj).siblings('input').val(nid);
	
	var buysend = $('[name="buysend"]').val();
	
	if(buysend == 1){
		getNormsAll();
	}
	
//	console.log(nid);
}


//多选产品
function checkbox(obj){
	
	if($(obj).hasClass('this')){
		$(obj).removeClass('this');
	}else{
		$(obj).addClass('this');
	}
	$('[name="num"]').val(1)
	
	var total = 0;
	var nid = '';
	
	$("#norms-checkbox li").each(function(i){
		if($(this).hasClass('this')){
			total += parseInt($("#norms-checkbox li").eq(i).attr('price'));
			nid += parseInt($("#norms-checkbox li").eq(i).attr('nid')) + ',';
		}
		$('[name="price"]').val(total);
		$('#showPrice').html(total);
		$(obj).siblings('input').val(nid);
	});	
}

//买就送
function send(obj){
	
	$(obj).siblings('li').removeClass('this');
	$(obj).addClass('this');
	
	var nid = $(obj).attr('nid');
	var price = $(obj).attr('price');
	var title = $(obj).find('span').html();
	var img = $(obj).find('img').attr('src');
	var buy = parseInt($(obj).attr('buy'));
	var send = parseInt($(obj).attr('send'));
	var num = buy + send;
	
	var html = $('.norms-arr').html();
	var norms_html = '<div class="norms-arr">'+html+'</div>'
	$(".norms-all").html('');
	for(var i=0;i<(num);i++){
		$('.norms-all').append(norms_html);
		$(".norms-arr").eq(i).find('.norms-title i').html(i+1);
	}
	$(obj).siblings('input').val(nid);
	$('[name="price"]').val(price);
	getNormsAll()
//	console.log(num);
}


//获取选择的产品
function getNormsAll(){
	
	$('.norms-table').show();
	$('.norms-total').show();
	
	var price = parseInt($('[name="price"]').val());
	var old_price = parseInt($('[name="old_price"]').val());
	var thumb = $('[name="thumb"]').val();
	var num = $('.norms-all .norms-arr').length;
	var html = '';
	
	$('.norms-all .norms-arr').each(function(i){
		var two = $('.norms-all .norms-arr').eq(i).find('#two_title').html();
		var three = $('.norms-all .norms-arr').eq(i).find('#three_title').html();
		
		html += '<tr>';
		if(two){
			var img = $('.norms-all .norms-arr').eq(i).find('[name="two[]"]').siblings('li.this').find('img').attr('src');
			var two_title = $('.norms-all .norms-arr').eq(i).find('[name="two[]"]').siblings('li.this').find('span').html();
			
			if(!img){ img = thumb; }
			if(!two_title){ two_title = js_string.js_select; }
			
			html += '<td><img src="'+img+'"/></td>';
			html += '<td>'+two_title+'</td>';
		}
		
		if(three){
			var three_title = $('.norms-all .norms-arr').eq(i).find('[name="three[]"]').siblings('li.this').find('span').html();
			
			if(!three_title){ three_title = js_string.js_select; } 
			
			html += '<td>'+three_title+'</td>';
		}
		html += '<td>'+old_price+'</td>';
		html += '</tr>'
		$('#norms-order').html('');
		$('#norms-order').html(html);
		
	});
	
	var prices = old_price * num;
	
	$('#norms-total-num').html(num);
	$('#norms-total-price').html(prices);
	$('#norms-total-discounts').html(prices - price);
	$('#norms-total-total').html(price);
	
	var norms_html = $('#norms-order').html();
	
	
	if(norms_html.search(js_string.js_select) == -1){
		$('[name="normsall"]').val(2);
	}
}

//加法
function plus(obj){
	
	var num = parseInt($('[name="num"]').val());
	var price = parseInt($('[name="price"]').val());
	
	if(!price){
		var one_title = $("#one_title").html();
		layer.msg(js_string.js_select+one_title,{icon:7,time:2000,shift:6}); return false;
	}
	
	var nums = num + 1;
	var total = nums * price;
	$('[name="num"]').val(nums)
	$('#showPrice').html(total);
}

//减法
function minus(obj){
	
	var num = parseInt($('[name="num"]').val());
	var price = parseInt($('[name="price"]').val());
	
	if(num > 1){
		var nums = num - 1;
		var total = nums * price;
		$('[name="num"]').val(nums)
		$('#showPrice').html(total);
	}else{
		layer.msg(js_string.js_number_1,{icon:7,time:2000,shift:6}); return false;
	}
	
}


//搜索订单
function sphone(){
	
	var phone = $('#sphone').val();
	
	if(!name && !phone){
		layer.msg(js_string.js_search_phone,{icon:7,time:2000,shift:6}); return false;
	}
	
	$.post("/search",{"phone":phone},function(data){
		if(data.code == 1){
			window.location.href = data.url;
		}else{
			layer.msg(data.msg,{icon:7,time:2000,shift:6}); return false;
		}
	},"json");
	
}

//提交表单
function submitForm(){
	
	var one_title = $("#one_title").html();
	var two_title = $("#two_title").html();
	var three_title = $("#three_title").html();
	var name_title = $("#name_title").html();
	var phone_title = $("#phone_title").html();
	var line_title = $("#line_title").html();
	var email_title = $("#email_title").html();
	var area_title = $("#area_title").html();
	var addresstxt = $("#addresstxt").html();
	var code_title = $("#code_title").html();
	
	var one = $('[name="one"]').val();
	var two = $('[name="two"]').val();
	var three = $('[name="three"]').val();
	var buysend = $('[name="buysend"]').val();
	var name = $('[name="name"]').val();
	var phone = $('[name="phone"]').val();
	var line = $('[name="line"]').val();
	var email = $('[name="email"]').val();
	var code = $('[name="code"]').val();
	var city = $('[name="city"]').val();
	var cusarea = $('[name="cusarea"]').val();
	var address = $('[name="address"]').val();
	var area_type = $('[name="area_type"]').val();
	
	if(buysend == 1){
		var normsall = $('[name="normsall"]').val();
		if(normsall == 1){
			layer.msg(js_string.js_select_1,{icon:7,time:1500,shift:4});	return false;
		}
		
	}else{
		if(one_title){
			if(!one){ layer.msg(js_string.js_select+one_title,{icon:7,time:1500,shift:4});	return false; }
		}
		
		if(two_title){
			if(!two){ layer.msg(js_string.js_select+two_title,{icon:7,time:1500,shift:4});	return false; }
		}
		
		if(three_title){
			if(!three){ layer.msg(js_string.js_select+three_title,{icon:7,time:1500,shift:4});	return false; }
		}
	}
	
	
	if(name_title){
		if(!name){ layer.msg(js_string.js_name_text,{icon:7,time:1500,shift:4});	return false; }
	}
	
	if(phone_title){
		
		if(!phone){ 
			layer.msg(js_string.js_phone_text,{icon:7,time:1500,shift:4});	return false;
		}else{
			var reg = /^[0-9][0-9]+$/gi;
			if(!reg.test(phone)){
				layer.msg(js_string.js_phone_text,{icon:7,time:1500,shift:4});	return false;
			}
		}
	}
	
	if(line_title){
		if(!line){ layer.msg(js_string.js_line_text,{icon:7,time:1500,shift:4});	return false; }
	}
	
	if(email_title){
		var email_reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		if(!email_reg.test(email)){
			layer.msg(js_string.js_email_text,{icon:7,time:1500,shift:4});	return false;
		}
		
	}
	
	if(code_title){
		if(!code){ layer.msg(js_string.js_code_text,{icon:7,time:1500,shift:4});	return false; }
	}
	
	if(area_title){
		
		if(area_type == 'tw'){ 	//台湾
			if(city == '鎮/鄉/區' || city == '區/鄉鎮' || city == ''){ 
				layer.msg(js_string.js_area_text,{icon:7,time:1500,shift:4});	return false; 
			}
		}
		
		if(area_type == 'ml' || area_type == 'xjp' || area_type == 'tg' || area_type == 'yn' || area_type == 'yny' || area_type == 'alq' || area_type == 'st' || area_type == 'jpz' || area_type == 'flb' || area_type == 'hk' || area_type == 'flbz' || area_type == 'jo' || area_type == 'ro' || area_type == 'id' || area_type == 'db'){ 	//马来、新加坡、泰国、印尼
			if(city == ''){ 
				layer.msg(js_string.js_area_text,{icon:7,time:1500,shift:4});	return false; 
			}
		} 
		
		if(area_type == 'ml' || area_type == 'tg' || area_type == 'yn' || area_type == 'yny' || area_type == 'alq' || area_type == 'st' || area_type == 'jpz' || area_type == 'flb' || area_type == 'hk' || area_type == 'flbz' || area_type == 'db'){ 	//马来、新加坡、泰国、印尼
			if(cusarea == ''){ 
				layer.msg(js_string.js_area_text,{icon:7,time:1500,shift:4});	return false; 
			}
		}
		
	}
	
	if(addresstxt){
		if(!address){ layer.msg(js_string.js_address_text,{icon:7,time:1500,shift:4});	return false; }
	}
	
	
	layer.msg('<p>'+js_string.js_submit+'</p>',{icon: 16,shade: 0.3,time:false});
	$.post('/index/form/orderpost',$("form").serialize(),function(data){
	
		if(data.code == 0){
			layer.msg(data.msg,{icon:7,time:1500,shift:4});	return false; 
		}else{
			layer.msg(data.msg,{icon:1,time:1500},function(){ 
				location = data.url; 
			});
		}
	
	},"json");
}



//提交产品表单
function submitOrderProduct(){
	
	var one_title = $("#one_title").html();
	var two_title = $("#two_title").html();
	var three_title = $("#three_title").html();
	
	var one = $('[name="one"]').val();
	var two = $('[name="two"]').val();
	var three = $('[name="three"]').val();
	var buysend = $('[name="buysend"]').val();
	
	
	
	if(buysend == 1){
		var normsall = $('[name="normsall"]').val();
		if(normsall == 1){
			layer.msg(js_string.js_select_1,{icon:7,time:1500,shift:4});	return false;
		}
		
	}else{
		if(one_title){
			if(!one){ layer.msg(js_string.js_select+one_title,{icon:7,time:1500,shift:4});	return false; }
		}
		
		if(two_title){
			if(!two){ layer.msg(js_string.js_select+two_title,{icon:7,time:1500,shift:4});	return false; }
		}
		
		if(three_title){
			if(!three){ layer.msg(js_string.js_select+three_title,{icon:7,time:1500,shift:4});	return false; }
		}
	}
	
	
	layer.msg('<p>'+js_string.js_submit+'</p>',{icon: 16,shade: 0,time:false});
	$.post('/index/form/orderProduct',$("form").serialize(),function(data){
	
		if(data.code == 0){
			layer.msg(data.msg,{icon:7,time:1500,shift:4});	return false; 
		}else{
			layer.msg(data.msg,{icon:1,time:1500},function(){ 
				parent.location.href = data.url; 
			});
		}
	
	},"json");
}


//提交修改地址
function submitAddress(){
	
	var city = $('[name="city"]').val();
	var address = $('[name="address"]').val();
	
	if(city == '鎮/鄉/區' || city == '區/鄉鎮'){ 
		layer.msg(js_string.js_area_text,{icon:7,time:1500,shift:4});	return false; 
	}
	
	if(!address){ layer.msg(js_string.js_address_text,{icon:7,time:1500,shift:4});	return false; }
	
	layer.msg('<p>'+js_string.js_submit+'</p>',{icon: 16,shade: 0,time:false});
	
	$.post('',$("form").serialize(),function(data){
	
		if(data.code == 0){
			layer.msg(data.msg,{icon:7,time:1500,shift:4});	return false; 
		}else{
			layer.msg(data.msg,{icon:1,time:1500},function(){ 
				parent.location.href = data.url; 
			});
		}
	
	},"json");
	
}


$(window).load(function(){
	$('#order').liMarquee({direction:'up',scrollamount:20});
	$('#fahuo').liMarquee({direction:'up',scrollamount:20});
	$('#review').liMarquee({direction: 'up',scrollamount:20,});
	$(".info-review dl:even").css("background-color","#f1f1f1");
	$(".info-fahuo li:even").css("background-color","#f1f1f1");
});


$(document).ready(function(){
	
	//默认是否方式
	$("#paytype li").eq(0).addClass("this selected");
	$('.pay-prompt').html($("#paytype li").eq(0).attr('title'));
	$('input[name="paytype"]').val($("#paytype li").eq(0).attr('pay'));
	
	
	var plen = $(".ldts p").length;
	var e = 0;
	var lundong = function(i){
		$(".ldts p").eq(i).show();
		$(".ldts p").eq(i).animate({opacity:1},"slow",function(){
			var lth = $(this);
			setTimeout(function(){
				lth.animate({opacity:0},"slow",function(){lth.hide();});
			},3000);
		});
    }
    var t = setInterval(function(){
		lundong(e);
		if(e+1 == plen){
			e = 0;
		}else{
			e = e + 1;
		}
    }, 1000*6);
	
	var navCount = $('.info-nav li').length;
	var w = 100/navCount;
	$('.info-nav li').width(w+'%');	
	
	$(window).scroll(function(){
		
		var scrollTo = $(document).scrollTop();
		if(scrollTo > 500){
			$('.to-top').fadeIn();
		}else{
			$('.to-top').fadeOut();
		}
		
		var topH = $("#buy").offset().top;
		if(scrollTo < (topH)){
			$('.info-nav').fadeIn();
		}else{
			$('.info-nav').fadeOut();
		}
	
	});	
	
	//点击置顶
	$(".to-top").click(function(){
		var speed = 200;//滑动的速dao度
        $('body,html').animate({ scrollTop: 0 }, speed);
        return false;
	});
	
	//选择支付方式
	$(".form-pay li").click(function(){
		
		$(".form-pay li").removeClass('this');
		$(this).addClass('this');
		
		var paytype = $(this).attr('pay');
		var title = $(this).attr('title');
		$('input[name="paytype"]').val(paytype);
		$(".pay-prompt").html(title);
		
	});
});