<!doctype html>
<!--[if IE 6]><html id="ie6" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if IE 7]><html id="ie7" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if IE 8]><html id="ie8" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html dir="ltr" lang="zh-TW">
<!--<![endif]-->
<head>
<!--[if lt IE 9]><script src="/js/html5.js"></script><![endif]-->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<title><?# webTitle ?></title>	
<meta name="author" content="<?# webTitle ?>" />
<meta name="copyright" content="<?# webName ?>版權所有" />
<meta name="description" content="<?# webDescription ?>" />
<meta name="distribution" content="Taiwan" /> 
<meta name="keywords" content="<?# webKeyword ?>" />
<meta name="format-detection" content="telephone=no" />
<meta property="og:url" content="<?# RelLink ?><?# REQUESTURI ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?# ogTitle ?>" />
<meta property="og:description" content="<?# ogDescription ?>" />
<meta property="og:image" content="<?# ogImage ?>" />
<link href="/less/<?# webTemplates ?>/main.less" rel="stylesheet/less">
<link href="/less/<?# webTemplates ?>/layout.less" rel="stylesheet/less">
<link href="/css/<?# webTemplates ?>/main.css" rel="stylesheet">
<link href="/css/<?# webTemplates ?>/layout.css" rel="stylesheet">
<link href="/css/<?# webTemplates ?>/order.css" rel="stylesheet">
<script src="/jquery/jquery-1.10.js"></script>
<script>
	if('<?# alertMsg ?>' != ''){
		alert('<?# alertMsg ?>');
		if('<?# goBack ?>' == 'Y') history.back();
	}
	if('<?# locationHref ?>' != '') location.href = '<?# locationHref ?>';
</script>
<?# headHTML ?>
</head>
<body<?# JumpBody ?>>
<?# bodyTopHTML ?>
<div class="webBox" style="<?# JumpStyle ?>">
<?# JumpHTML ?>
<?# JumpScript ?>
<div class="wrapper">
    <?# header ?>
    <div class="pos_rel" id="sub_banner">
        <?# banner ?>
        <div class="pos_rel d_flex" id="page_title">
			<div class="workframe">
				<h1 class="talign_sm_left talign_center txt_white_5 pag_tit"><?# OrderName ?></h1>
				<div class="waylink">
					<ol class="talign_sm_left talign_center nowrap_box">
						<li class="d_inblock"><a class="d_inblock txt_white_5" href="/" title="首頁">首頁</a></li>
						<li class="d_inblock txt_white_5"><?# OrderName ?></li>
					</ol>
				</div>
			</div>
        </div>
    </div>
	<div class="pos_rel" id="wrap">
		<div class="workframe">
			<div id="content_wrap">
				<div class="shadow" id="order">
                    <div class="orderWrap">
                        <div class="d_lg_block d_none nowrap_box list title">
                            <div class="col_6 d_inblock img">名稱</div>
                            <div class="col_6 d_inblock nowrap_box info">
                                <p class="col_4 d_inblock talign_center">數量</p>
                                <p class="col_4 d_inblock talign_center">單價</p>
                                <p class="col_4 d_inblock talign_center">小計</p>
                            </div>
                        </div>
                        <php:repeater id="listCP">
                        <template>
                        <div class="pos_rel nowrap_box list">
                            <div class="col_lg_6 d_lg_inblock nowrap_box img">
                                <a class="d_lg_flex d_block nowrap_box" href="<?# link ?>" target="_blank" title="<?# name ?>">
                                    <font class="pos_lg_rel pos_xs_abs d_lg_inblock d_block talign_xs_left talign_center"><img src="<?# image ?>" alt="<?# name ?>" /></font>
                                    <span class="d_inblock txt_clamp talign_xs_left talign_center"><?# name ?></span>
                                </a>
                            </div>
                            <div class="col_lg_6 d_lg_inblock nowrap_box info">
                                <p class="pos_lg_rel pos_abs col_lg_4 d_lg_inblock talign_center nowrap_box qBox">
                                    <a class="d_inblock talign_center limit" href="javascript:void(0);" data-action="plusBtn" data-type="1">-</a>
                                    <input class="d_inblock talign_center" type="text" data-id="<?# id ?>" data-sp="<?# spid ?>" data-action="chgQ" name="q" value="<?# q ?>" autocomplete="off" />
                                    <a class="d_inblock talign_center" href="javascript:void(0);" data-action="plusBtn" data-type="2">+</a>
                                </p>
                                <p class="col_4 d_lg_inblock d_none talign_center txt_num pBox"><?# price ?></p>
                                <p class="col_lg_4 d_lg_inblock talign_lg_center talign_xs_left talign_center txt_num tBox"><?# amount ?></p>
                            </div>
                            <a class="pos_abs" href="javascript:void(0);" data-id="<?# id ?>" data-sp="<?# spid ?>" data-action="delI" title="刪除"><i class="far fa-times-circle"></i></a>
                        </div>
                        </template>
                        </php:repeater>
                	</div>
                    <div id="orderTotal">
                        <p class="talign_right nowrap_box">
							<font class="d_inblock">產品金額</font>
							<font class="d_inblock talign_right nowrap_box">
								<span class="d_inblock txt_info_5 txt_num">$</span>
								<b class="d_inblock txt_info_5 txt_num" id="price1"><?# ProductPrice ?></b>
							</font>
						</p>
                        <p class="talign_right nowrap_box">
							<font class="d_inblock">運費</font>
							<font class="d_inblock talign_right nowrap_box">
								<span class="d_inblock txt_info_5 txt_num">$</span>
								<b class="d_inblock txt_info_5 txt_num" id="price2"><?# TransPrice ?></b>
							</font>
						</p>
                        <p class="talign_right nowrap_box">
							<font class="d_inblock">總計</font>
							<font class="d_inblock talign_right nowrap_box">
								<span class="d_inblock txt_primary_5 txt_num">$</span>
								<b class="d_inblock txt_primary_5 txt_num" id="price3"><?# OrderPrice ?></b>
							</font>
						</p>
                    </div>
				</div>
				<div class="talign_right nowrap_box orderbtns">
					<p class="col_md_3 col_6 d_inblock btn_hover more send_box"><a class="over_hid pos_rel d_inblock bg_primary_5 talign_center more_btn" href="<?# htLink4 ?>" title="繼續選購"><span class="pos_rel d_inblock">← 繼續選購</span></a></p>
					<p class="col_md_3 col_6 d_inblock btn_hover more send_box"><a class="over_hid pos_rel d_inblock bg_gray_5 talign_center more_btn" id="btnClean" href="javascript:void(0);" title="清空購物車"><span class="pos_rel d_inblock">清空購物車</span></a></p>
				</div>
				<form class="form_box nowrap_box" id="form1" name="form1" method="post">
					<p class="note"><span class="red">*</span>代表必填欄位</p>
					<input type="hidden" id="PPrice" name="PPrice" value="<?# ProductPrice ?>" />
                    <input type="hidden" id="TPrice" name="TPrice" value="<?# TransPrice ?>" />
                    <input type="hidden" id="OPrice" name="OPrice" value="<?# OrderPrice ?>" />
                    <p class="nowrap_box item">
						<label class="d_md_inblock d_block"><span class="d_inblock">姓名</span><i class="d_inblock">*</i></label>
						<font class="d_md_inblock d_block"><input type="text" id="Name" name="Name" /></font>
					</p>
                    <p class="nowrap_box item">
						<label class="d_md_inblock d_block"><span class="d_inblock">手機</span><i class="d_inblock">*</i></label>
						<font class="d_md_inblock d_block"><input type="tel" inputmode="tel" id="Mobile" name="Mobile" /></font>
					</p>
                    <p class="nowrap_box item">
						<label class="d_md_inblock d_block"><span class="d_inblock">信箱</span><i class="d_inblock">*</i></label>
						<font class="d_md_inblock d_block"><input type="email" inputmode="email" id="Email" name="Email" /></font>
					</p>
                    <p class="nowrap_box item">
						<label class="d_md_inblock d_block"><span class="d_inblock">地址</span><i class="d_inblock">*</i></label>
						<font class="d_md_inblock d_block"><input type="text" id="Address" name="Address" /></font>
					</p>
                    <p class="nowrap_box item">
						<label class="d_md_inblock d_block"><span class="d_inblock">詳細說明</span></label>
						<font class="d_md_inblock d_block"><textarea name="Content" id="Content" cols="45" rows="5"></textarea></font>
					</p>
                    <p class="nowrap_box item check_box">
						<label class="d_md_inblock d_block"><span class="d_inblock">驗證碼</span><i class="d_inblock">*</i></label>
						<font class="d_md_inblock d_block">
							<input class="d_inblock" type="text" id="Checknum" name="Checknum" onKeyUp="this.value=this.value.toUpperCase();" maxlength="4" autocomplete="off" />
                            <img class="d_inblock" id="rand-img"src="/vdimgck.php" alt="看不清楚？ 點圖更換新圖片" align="absmiddle" style="cursor:pointer;border:none; width:auto;" onClick="this.src=this.src+'?'">
						</font>
					</p>
					<p class="talign_center btn_hover more send_box"><a class="over_hid pos_rel d_inblock bg_black_5 talign_center more_btn" id="btnOK" href="javascript:void(0);" title="送出"><span class="pos_rel d_inblock">送出</span><svg class="pos_abs"><use xlink:href="/svg/43/icons.svg#arrow"></use></svg></a></p>
					
                </form>
				<div class="nowrap_box" id="google_shere">
					<div class="row col_xs_offset_6 d_xs_inblock"><?# GoogleSearch ?></div>
					<div class="row col_xs_offset_6 d_xs_inblock" id="community">
						<ul class="talign_xs_right nowrap_box">
							<li class="d_inblock"><div class="fb-share-button" data-href="<?# RelLink ?><?# REQUESTURI ?>" data-layout="button" data-size="small"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2F<?# RelLink ?><?# REQUESTURI ?>%2F&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore">分享</a></div></li>
							<li class="d_inblock"><a href="https://twitter.com/share" class="twitter-share-button" data-lang="zh-tw" data-dnt="true">推文</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></li>
							<li class="d_inblock"><div class="line-it-button" data-lang="zh_Hant" data-type="like" data-url="<?# RelLink ?><?# REQUESTURI ?>" data-share="true" style="display: none;"></div></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
    <?# footer ?>
	<div class="pos_fix talign_center" data-action="loader"><div class="d_inblock loader_circle"></div></div>
</div>
</div>
</body>
</html>
<script src="/js/less.min.js" ></script>
<script>
	function sumPrice(){
		$.ajax({
			url: '/ajax/cart.php',
			async: false,
			type: 'POST',
			data: {'do':'sum'},
			dataType: 'json',
			success: function(obj){
				if(obj.err == "0"){
					$('#price1').text(obj.pprice);
					$('#price2').text(obj.tprice);
					$('#price3').text(obj.oprice);
					$('#ProductPrice').val(obj.pprice);
					$('#TransPrice').val(obj.tprice);
					$('#OrderPrice').val(obj.oprice);
				}else{
					alert(obj.msg);
					location.href = location.href;
				}
			},
			error: function(){
				alert('系統異常!請重新整理頁面再試一次!');
				location.href = location.href;
			}
		});
	}
	function chgQ(a){
		$.ajax({
			url: '/ajax/cart.php',
			async: false,
			type: 'POST',
			data: {'do':'chg','id':a.data('id'),'q':a.val()},
			dataType: 'json',
			context: a.parent('p').next().next().eq(0),
			success: function(obj){
				alert(obj.msg);
				if(obj.err == "0"){
					$(this).text(obj.amount);
					sumPrice();
				}else{
					location.href = location.href;
				}
			},
			error: function(){
				alert('系統異常!請重新整理頁面再試一次!');
				location.href = location.href;
			}
		});
	}
	$(function(){
		$('a[data-action="plusBtn"]').click(function(){
			var num = $(this).parent().children('input').val();
			num = ($(this).data('type') == '1') ?(parseInt(num) - 1):(parseInt(num) + 1);
			if(num < 1) num = 1;
			
			$(this).parent().children('input').val(num);
			chgQ($(this).parent().children('input'));
		});
		$('input:text[data-action="chgQ"]').change(function(){
			chgQ($(this));
		});
		$('a[data-action="delI"]').click(function(){
			if(confirm('確定要刪除此項產品?')){
				$.ajax({
					url: '/ajax/cart.php',
					async: false,
					type: 'POST',
					data: {'do':'del','id':$(this).data('id')},
					dataType: 'json',
					context: $(this).parent('p').parent('div').parent('div'),
					success: function(obj){
						alert(obj.msg);
						if(obj.err == "0"){
							$(this).remove();
							sumPrice();
						}else{
							location.href = location.href;
						}
					},
					error: function(){
						alert('系統異常!請重新整理頁面再試一次!!');
						location.href = location.href;
					}
				});
			}else{
				return false;
			}
		});
		$('#btnClean').click(function(){
			if(confirm('確定要清空購物車?')){
				$.ajax({
					url: '/ajax/cart.php',
					async: false,
					type: 'POST',
					data: {'do':'cln'},
					dataType: 'json',
					success: function(obj){
						alert(obj.msg);
						location.href = "/";
					},
					error: function(){
						alert('系統異常!請重新整理頁面再試一次!');
						location.href = location.href;
					}
				});
			}else{
				return false;
			}
		});
		$('#btnOK').click(function(){
			if($('#Name').val() == ''){
				alert('請輸入姓名!');
				$('#Name').focus();
				return false;
			}
			if($('#Mobile').val() == ''){
				alert('請輸入手機!');
				$('#Mobile').focus();
				return false;
			}
			if($('#Email').val() == ''){
				alert('請輸入信箱!');
				$('#Email').focus();
				return false;
			}
			var reEmail = /^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+)+$/;
			if(!reEmail.test($('#Email').val())){
				alert('信箱不合法!');
				$('#Email').focus();
				return false;
			}
			if($('#Address').val() == ''){
				alert('請輸入地址!');
				$('#Address').focus();
				return false;
			}
			if($('#Checknum').val() == ''){
				alert('請輸入驗證碼!');
				$('#Checknum').focus();
				return false;
			}else{
				$('div[data-action="loader"]').attr('id', 'lodbg');
				$(this).attr('disabled','disabled');
				$('#form1').submit();
			}
		});
	});
	document.body.oncopy = event => {
		event.preventDefault();
		let textFont,
			copyFont = window.getSelection(0).toString();
		textFont = (copyFont.length > 10) ?copyFont + '\n\n' + '原文網址: <?# webTitle ?> <?# RelLink ?><?# REQUESTURI ?>\n' + '著作權歸作者所有。商業轉載請聯絡作者獲得授權，非商業轉載請註明出處。':copyFont;
		return (event.clipboardData) ?event.clipboardData.setData('text', textFont):window.clipboardData.setData('text', textFont);// 相容IE
	};
</script>