<?php include COMMON_PATH.'/header.html';?>
<div class="layui-container fly-marginTop fly-user-main">
    <div class="layui-row">
		<!-- 公告-->
		<?php if(isset($config['notice']) AND $config['notice']):?>
		<blockquote class="layui-elem-quote layui-text" style="background-color: #ffffff;">
			<i class="layui-icon layui-icon-speaker"></i><?php echo $config['notice'];?>
		</blockquote>
		<?php endif;?>
        <div class="layui-col-md6">
            <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="layui-this">购买商品</li><li class=""><a href="/product/query">查询订单</a></li></ul></div>

                <div class="layui-card-body" id="prodcut_num">
                    <form class="layui-form" action="">
						<div id="product_input">
							<div class="layui-form-item productname">
								<label class="layui-form-label">商品名称</label>
								<div class="layui-input-block">
									<input type="text" name="name" id="name" readonly disabled class="layui-input" value ="<?php echo $product['name'];?>">
								</div>
							</div>

							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">商品单价</label>
									<div class="layui-input-block">
										<input type="text" name="price" id="price" readonly disabled class="layui-input" value ="<?php echo $product['price'];?>" style="color: red;">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">订单金额</label>
									<div class="layui-input-block">
										<input type="text" name="money" id="money" readonly disabled class="layui-input" value ="<?php echo $product['price'];?>" style="color: red;">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">商品库存</label>
									<div class="layui-input-block">
										<input type="text" name="qty" id="qty" readonly disabled class="layui-input" value ="<?php if($product['stockcontrol']>0):?><?php if($product['qty']>0):?><?php echo $product['qty'];?><?php else:?>库存不足<?php endif;?><?php else:?>不限量<?php endif;?>">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">购买数量</label>
									<div class="layui-input-block">
										<input type="number" name="number" id="number" value="1" class="layui-input" lay-verify="required|numberCheck">
									</div>
								</div>
							</div>
							<?php if($login):?>
							<div class="layui-form-item">
								<label class="layui-form-label">邮箱账户</label>
								<div class="layui-input-block">
									<input type="text" name="email" id="email" value="<?php echo $uinfo['email'];?>" readonly class="layui-input">
								</div>
							</div>
							<?php else:?>
								<?php if(isset($config['orderinputtype']) AND $config['orderinputtype'] == '2'):?>
								<div class="layui-form-item">
									<label class="layui-form-label">QQ</label>
									<div class="layui-input-block">
										<input type="number" name="qq" id="qq" class="layui-input" required lay-verify="required|number">
									</div>
								</div>
								<?php else:?>
								<div class="layui-form-item">
									<label class="layui-form-label">邮箱账户</label>
									<div class="layui-input-block">
										<input type="text" name="email" id="email" class="layui-input" required lay-verify="required|email">
									</div>
								</div>
								<?php endif;?>
							<?php endif;?>
							<div class="layui-form-item">
								<label class="layui-form-label">查询密码</label>
								<div class="layui-input-block">
									<input type="text" name="chapwd" id="chapwd" class="layui-input" required lay-verify="required|chapwd" placeholder="将作为自助查询订单重要依据">
								</div>
							</div>
						</div>	
                        <div class="layui-form-item">
                            <div class="layui-input-block">
								<input type="hidden" name="limitorderqty" id="limitorderqty" value="<?php echo $config['limitorderqty'];?>">
								<input type="hidden" name="pid" id="pid" value="<?php echo $product['id'];?>">
								<input type="hidden" name="stockcontrol" id="stockcontrol" value="0">
                                <button class="layui-btn" id="buy" disabled="disabled" lay-submit lay-filter="buy">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md6 <?php if(isset($config['mprodcutdescriptionswitch'])):?><?php if($config['mprodcutdescriptionswitch']=="0"):?>layui-hide-xs<?php endif;?><?php else:?>layui-hide-xs<?php endif;?>">
            <div class="layui-card">
                <div class="layui-card-header">商品详情</div>
                <div class="layui-card-body" id="prodcut_description">
				<?php if(isset($config['ad'])):?><?php echo $config['ad'];?><?php endif;?>
                </div>
            </div>
        </div>
    </div>
</div>
<!--引入公共底文件-->
<?php include COMMON_PATH.'/footer.html';?>
<!--首页广告-->
<script>
layui.use('product');
var LAYERAD = "";
var PASSWORD_PRODUCT = 1;
<?php if(strlen($pifa)>0):?>
var PIFA = <?php echo $pifa;?>;
<?php else:?>
var PIFA = "";
<?php endif;?>
</script>