<?php include COMMON_PATH.'/header.html';?>
<div class="layui-container fly-marginTop">
    <div class="layui-card layui-form-pane">
		<div class="layui-card-header layui-hide-xs">查询订单</div>
		<div class="layui-tab-brief layui-hide-md"><ul class="layui-tab-title"><li class=""><a href="/product/">购买商品</a></li><li class="layui-this">查询订单</li></ul></div>
        <div class="layui-card-body layui-tab layui-tab-brief" lay-filter="user">
			<blockquote class="layui-elem-quote">
				友情提示:订单查询仅能查询最近30天的数据；移动端模式下，仅能查询最近一笔订单。
			</blockquote>
            <div class="layui-tab-content">

						<div class="layui-tab layui-tab-brief" lay-filter="">
							<ul class="layui-tab-title">
								<li><a href="/product/query/?zlkbmethod=cookie">浏览器缓存</a></li>
								<li><a href="/product/query/?zlkbmethod=orderid">订单号</a></li>
								<li class="layui-this">联系方式</li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<div class="layui-form-pane" id="query-pane">
										<form class="layui-form" id="query-form">
											<?php if(isset($config['orderinputtype']) AND $config['orderinputtype'] == '2'):?>
											<div class="layui-form-item">
												<label for="qq" class="layui-form-label">QQ</label>
												<div class="layui-input-inline">
													<input type="text" id="qq" name="qq" required lay-verify="required|number" autocomplete="off" class="layui-input">
												</div>
											</div>
											<?php else:?>
											<div class="layui-form-item">
												<label for="L_email" class="layui-form-label">邮箱</label>
												<div class="layui-input-inline">
													<input type="text" id="L_email" name="email" required lay-verify="required|email" autocomplete="off" class="layui-input">
												</div>
											</div>
											<?php endif;?>
											<div class="layui-form-item">
												<label for="L_chapwd" class="layui-form-label">查询密码</label>
												<div class="layui-input-inline">
													<input type="password" id="L_chapwd" name="chapwd" required lay-verify="required" autocomplete="off" class="layui-input">
												</div>
											</div>
											<?php if(isset($config['yzmswitch']) AND $config['yzmswitch']>0):?>
											<div class="layui-form-item" style="position: relative;">
												<label for="L_vercode" class="layui-form-label">图形验证</label>
												<div class="layui-input-inline">
													<input type="text" id="L_vercode" name="vercode" required lay-verify="required|vercode" placeholder="" autocomplete="off" class="layui-input">
												</div>
												<div class="zlkb_yzm">
													<img src="/Captcha?t=productquery" alt="图片验证码" height="36" class="loadcode">
												</div>
											</div>
											<?php endif;?>
											<div class="layui-form-item">
												<input type="hidden" name="zlkbmethod" value="contact">
												<button class="layui-btn" lay-filter="query" lay-submit>查询</button>
											</div>
										</form>
										<div class="layui-table-zlkb">
											<table class="layui-table" style="display: none;" id="query-table">
												<thead><tr><th>订单ID</th><th>订单名称</th><th>数量</th><th>金额</th><th>下单时间</th><th>状态</th></tr></thead>
												<tbody><tr></tr></tbody>
											</table>
										</div>
										<div id="query-ajax-mobile-view"></div>
									</div>
								</div>
							</div>
						</div> 
					

            </div>
        </div>
    </div>
</div>
<!-- contact tpl-->
<!--引入公共底文件-->
<?php include COMMON_PATH.'/footer.html';?>
<script id="query_ajax_mobile" type="text/html">
{{#  layui.each(d.data, function(index, item){ }}
	{{# if(index ==0){ }}
	<div class="layui-hide-lg layui-hide-md layui-hide-sm">
		<div class="layui-card-header">
		订单信息-{{ converStatus(item.status)}}
		{{#  if(item.status == '0'){ }}
			<button class="layui-btn layui-btn-disabled layui-btn-xs" >未支付订单</button>
		{{# }else if(item.status =="2"){ }}
			<button class="layui-btn layui-btn-xs layui-btn-warm view_kami" id="buy" data-orderid="{{ item.orderid}}">提取卡密</button>
		{{#  } }} 
		</div>
		<div id="prodcut_num">
			<div class="layui-form-item">
				<label class="layui-form-label">订单</label>
				<div class="layui-input-block">
					<input type="text" value="{{ item.orderid}}" readonly disabled class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品</label>
				<div class="layui-input-block">
					<input type="text" value="{{ item.productname}}" readonly disabled class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">数量</label>
				<div class="layui-input-block">
					<input type="text" value="{{ item.number}}" readonly disabled class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">金额</label>
				<div class="layui-input-block">
					<input type="text" value="{{ item.money}}" readonly disabled class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">时间</label>
				<div class="layui-input-block">
					<input type="text" value="{{ createTime(item.addtime)}}" readonly disabled class="layui-input" >
				</div>
			</div>
		</div>
	</div>
	{{#  } }} 
{{#  }); }}
	{{#  if(d.data.length === 0){ }}
		<blockquote class="layui-elem-quote">无数据....</blockquote>
	{{#  } }} 
</script>
<script>
layui.use('productquery');
	function converStatus(status){
		var str = "";
		var s = status;
		switch(s)
		{
			case '0':
				str = '<span class="layui-badge layui-bg-gray">待付款</span>';
				break;
			case '1':
				str = '<span class="layui-badge layui-bg-blue">待处理</span>';
				break;
			case '2':
				str = '<span class="layui-badge layui-bg-green">已完成</span>';
				break;
			default:
				str = '<span class="layui-badge layui-bg-black">处理失败</span>';
				break;
		}
		return str;
	}
    function createTime(v) {
       var date = new Date();
       date.setTime(parseInt(v) * 1000);
		var y = date.getFullYear();
		var m = date.getMonth() + 1;
		m = m < 10 ? '0' + m : m;
		var d = date.getDate();
		d = d < 10 ? ("0" + d) : d;
		var h = date.getHours();
		h = h < 10 ? ("0" + h) : h;
		var M = date.getMinutes();
		M = M < 10 ? ("0" + M) : M;
		var s = date.getSeconds();
		s = s < 10 ? ("0" + s) : s;
		var str = y + "-" + m + "-" + d + " " + h + ":" + M + ":" + s;
		return str;
	}
</script>