<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="description" content="[.$ourphp_web.webdescriptions.]"/>
<meta name="keywords" content="[.$ourphp_web.webkeywords.]"/>
<meta name="author" content="www.ourphp.net"/>
<meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-title" content="[.$ourphp_web.website.]">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="320">
<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="browsermode" content="application">
<meta name="x5-page-mode" content="app">
<meta name="msapplication-tap-highlight" content="no">
<title>收银台 - [.$ourphp_web.website.]</title>
[.include file="cn/cn_shophead.html".]
<script type="text/javascript">
function paytypearr(i){
	if(i == 1){
	[.sql mysql="select `OP_Key` as `keyarr` from ourphp_api where id = 10" font="" name="sql".]
		[.assign var="key" value=explode("|",$sql.keyarr).]
		[.if $key.6 == 'app'.]
		$("#form1").attr("action","[.$webpath.]function/api/appletspay/jsapi.php");
		[.else.]
		$("#form1").attr("action","[.$webpath.]function/api/weixinh5pay/jsapi.php");
		[./if.]
	[./sql.]	
	}
	if(i == 2){
		$("#form1").attr("action","[.$webpath.]client/wap/?cn-shoppingorders.html-&ourphp_cms=buyok&type=wap");
	}
	if(i == 3){
		$("#form1").attr("action","[.$webpath.]client/wap/?cn-shoppingorders.html-&ourphp_cms=buyok&type=wap");
		$("#coinok").val("ok");
	}else{
		$("#coinok").val("no");
	}
	if(i == 4){
		$("#form1").attr("action","[.$webpath.]function/api/alipay_wappay/alipayapi.php");
	}
	if(i == 5){
		$("#form1").attr("action","[.$webpath.]client/wap/?cn-shoppingorders.html-&ourphp_cms=buyok&type=wap");
		$("#delivery2").val("1");
	}else{
		$("#delivery2").val("0");
	}
}
</script>
</head>
<body>
<div id="YIQI-UI">
	<div class="top">
		<dd class="f-l mt-10 text-c">结算中心</dd>
		<div class="pos-a back"><a href="?cn-usercenter.html"><i class="icon YIQI-UI-iconfont">&#xe67d;</i></a></div>
	</div>
	<div class="pages">
        <div class="content2" style="margin:50px auto;">
        
        [.*订单处理模板开始，如果更换模板请从这里复制*.]
		<style type="text/css">
		#YIQI-UI .table td, #YIQI-UI .table th {padding:10px;}
		#YIQI-UI .buytable {background:#fff; width:96%; margin-left:2%; border-radius:5px;}
		#YIQI-UI .buytable {border-top: none;}
		</style>
		<script type="text/javascript">
			$(function(){
				$("#coupon").change(function(){
					var a = $(this).val();
					var b = a.split('|');
					var c = $("#couponmoney").html();
					var d = $("#sto_money").val();

					if(a == 'ourphp'){
						$("#couponmoney").html(d);
					}else{
						if(Number(d) < Number(b[2])){
							alert("总价不能小于优惠券面值!");
							window.location.reload();
							return false;
						}
						$("#couponmoney").html(d - b[2]);
						document.getElementById('x').disabled=false;
                        document.getElementById('x').className='btn2';
					}
				});
			})
		</script>
		<div class="shopadd">
			<a href="?cn-usershopadd.html" style="font-size:18px;">
			[.if empty($shopadd.name).]
				<li>
					<h4>我在哪？</h4>
					<p>请先创建您的快递收货信息</p>
				</li>

				<li style="float:right; line-height:80px; width:10%">
					<img src="[.$webpath.]skin/plus_64px_1164644_easyicon.net.png">
				</li>
			[.else.]
				<li>
					<p><strong>快递信息:</strong></p>
					<p>收件人姓名：[.$shopadd.name.]&nbsp;&nbsp;&nbsp;联系电话：[.$shopadd.tel.]</p>
					<p>收件人地址：[.$shopadd.add.]</p>
				</li>
				<li style="float:right; line-height:80px; width:10%">
					<img src="[.$webpath.]skin/plus_64px_1164644_easyicon.net.png">
				</li>
			[./if.]
			</a>
		</div>
		[.if $ordersarray == 1.]
            <form id="form1" name="form1" method="post" action="[.$webpath.]client/wap/?cn-shoppingorders.html-&ourphp_cms=buyok&type=wap" class="registerform">
              <table class="table table-border table-bg" style="background:#fff;">
                [.foreach $orderslist as $op.]
                <tr>
                  <td colspan="2" class="userbuylist">
					  <input type="hidden" name="id[]" value="[.$op.id.]" />
					  
					  <div class="oimg f-l">
						<img src="[.$op.minimg.]" width="80" height="80" />
					  </div>
					  <div class="otitle f-r">
						  <span class="f-l">[.$op.title|truncate:12:"...".]</span>
						  <span class="f-r">￥[.$op.usermarket.]</span>
					  </div>
					  
					  <p class="mb-0">
							<span class="f-999 f-12 f-l mt-5 ofont">[.$op.pratt.]&nbsp;[.$op.text.]</span>
							<span class="f-999 f-12 f-r mt-5 text-r">X[.$op.num.]</span>
					  </p>
					  
					  <p class="mt-0">
							<span class="f-999 f-12 f-l ofont"></span>
							<span class="f-999 f-12 f-r text-r">[.$op.weight.]KG&nbsp;￥[.$op.freight.] 运费</span>
					  </p>
					  
					  <p class="clear text-r">
							<span class="f-999 f-12 f-l pt-5">
								<a href="[.$webpath.]client/wap/?cn-usershopping-op.html-&ourphp_cms=del&id=[.$op.id.]&dh=[.$op.number.]&o" onclick="javascript:return confirm('确认删除吗?')" class="btn-link">删除</a>
							</span>
							<span class="f-999 f-12 f-r text-r">[.$op.quota.]</span>
					  </p>
					  
					  <p class="clear text-r">
							<span class="f-f00 f-12 f-r text-r">[.$op.stock.]</span>
					  </p>
					 
                  </td>
                </tr>
                [./foreach.]
			 </table>
			 
			 <table class="table table-border table-bg mt-10 buytable">
				[.if !isset($smarty.get.tuan).]
			  <tr>
                <td class="f-999">优惠券</td>
                <td>
				
                <input type="hidden" value="[.$op.idmd5.]" name="idmd5" />
				<select name="coupon" id="coupon" class="select">
					<option value="ourphp">不使用优惠券</option> 
					[.foreach $coupon as $r.]
					<option value="[.$r.id.]|[.$r.md.]|[.$r.money.]">[.$r.title.]</option> 
					[.foreachelse.]
					<option value="0|0|0">不可用优惠券</option> 
					[./foreach.]
				</select>
				
				</td>
			  </tr>
			  [.else.]
			  <input type="hidden" value="[.$op.idmd5.]" name="idmd5" />
			  <input type="hidden" value="ourphp" name="coupon" />
			  [./if.]
              <tr>
                <td width="30%" class="f-999">共计付款</td>
                <td width="70%" class="text-r">
					￥<span class="f-20 f-f00" id="couponmoney">[.$op.total + $op.freightt.]</span>&nbsp;<a href="#" onclick="window.location.reload();" class="btn-link">刷新</a>
					<input type="hidden" value="[.$op.total + $op.freightt.]" id="sto_money" />
                </td>
              </tr>
			 </table>
			 
			 <table class="table table-border table-bg mt-10 buytable">
              <tr>
                <td class="f-999">账户余额</td>
                <td class="text-r">￥[.$userview.money.]</td>
              </tr>
              <tr>
                <td class="f-999">虚拟币余额</td>
                <td class="text-r">[.$userview.coin.]</td>
              </tr>
            </table>
			
			<h6 class="pl-10 f-999">支付方式</h6>
			<table class="table table-border table-bg mt-10 buytable">
              <tr>
                <td><label for="money"><img src="[.$webpath.]skin/p2.png" height="25" /> 余额</label></td>
                <td class="text-r"><input type="radio" name="paytype" value="money" id="money" class="radio" checked onclick="paytypearr(2)" /></td>
              </tr>
			  <tr>
                <td><label for="coin"><img src="[.$webpath.]skin/p3.png" height="25" /> [.$shopset.coinname.]</label></td>
                <td class="text-r">
					<input type="radio" name="paytype" value="coin" id="coin" class="radio" onclick="paytypearr(3);" />
					<input type="hidden" name="coin" value="no" id="coinok" />
				</td>
              </tr>
			  [.if $userpaypai['weixinh5pay'][1] == 1.]
              <tr>
                <td><label for="weixin"><img src="[.$webpath.]skin/p1.png" height="25" /> 微信</label></td>
                <td class="text-r"><input type="radio" name="paytype" value="weixin" id="weixin" class="radio" onclick="paytypearr(1);" /></td>
              </tr>
			  [./if.]
			  [.if $userpaypai['alipay_mobilepay'][1] == 1.]
			  <tr>
                <td><label for="alipay"><img src="[.$webpath.]skin/p4.png" height="25" /> 支付宝</label></td>
                <td class="text-r"><input type="radio" name="paytype" value="alipay" id="alipay" class="radio" onclick="paytypearr(4);" /></td>
              </tr>
			  [./if.]
			  [.if $shopset['delivery'] == 1.]
			  <tr>
                <td><label for="delivery"><img src="[.$webpath.]skin/p5.png" height="25" /> 货到付款</label></td>
                <td class="text-r">
					<input type="radio" name="paytype" value="delivery" id="delivery" class="radio" onclick="paytypearr(5);" />
					<input type="hidden" name="delivery" value="0" id="delivery2" />
				</td>
              </tr>
			  [./if.]
			  [.if isset($smarty.get.tuan).]
				<input type="hidden" name="tuanset" value="1"/>
			  [.else.]
				<input type="hidden" name="tuanset" value="0"/>
			  [./if.]
            </table>
				<style type="text/css">
				label {width:100%; display:block;}
				#YIQI-UI .table-border th, #YIQI-UI .table-border td {
					border-bottom: 1px solid #f4f4f4;
				}
				.radio {
					font-family: inherit;
					font-size: inherit;
					font-style: inherit;
					font-weight: inherit;
					-webkit-appearance: radio; 
				}
				</style>
				<div>
					<input type="submit" name="Submit" value="立 即 支 付" class="btn pt-10 pb-10 btn-danger radius-20 mt-50" style="width:80%; margin-left:10%;" onclick="javascript:return confirm('付款后订单即时生成，无法后退等操作。')" />
				</div>
            </form>
		[.else.]
		<table width="100%" border="0" align="center" cellpadding="10">
			<tr>
			  <td>
				<div align="center">
				<img src="[.$webpath.]skin/ordersno.png" style="margin-top:50px;" class="maximg">
				</div>
			  </td>
			</tr>
		</table>
		[./if.]
        [.*订单模板结束*.]
        </div>
    </div>
	
</div>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script type="text/javascript">
        wx.miniProgram.getEnv(function (res) {
            if (res.miniprogram) {
                
                $("#form1").attr("action","[.$webpath.]function/api/appletspay/jsapi.php");
                
            }
        })
</script>
</body>
</html>