<!DOCTYPE html>
<html>
	<?php echo $this->fetch('head.html'); ?>
	<body>
		<div class="header">
			<div class="header-back"></div>
			<div class="header-title">打印下单</div>
		</div>
		<div class="header-row"></div>
		<div class="main-body" id="App">
			<form onsubmit="return false;" id="eForm">
			<template v-if="bookid==0">
				<div class="input-flex">
					<div class="input-flex-label">打印类型</div>
					<select class="input-flex-select" name="ptype" v-model="ptype">
						<option v-for="(item,index) in ptypeList" key="index" :value="item.ptype">{{item.title}}</option>
					</select>
					
				</div>
				<div class="input-flex flex-ai-center">
					<div class="input-flex-label">页面数</div>
					<input type="text" v-model="page_num" name="page_num" class="input-flex-text w100" />
					<span class="mgl-5">页</span>
				</div>
			</template>
			<template v-else>
				<div class="input-flex">
					<div class="input-flex-label">打印资料</div>
					<input type="hidden" name="bookid" :value="bookid" />
					<input type="hidden" name="ptype" :value="ptype" />
					<div class="input-flex-txt">
						 {{book.title}} 
					</div>
					
				</div>
			</template>
			<div class="input-flex flex-ai-center">
				<div class="input-flex-label">印</div>
				<input type="text" v-model="print_num" name="print_num" class="input-flex-text w100" />
				<span class="mgl-5">份</span>
			</div>
			 
			<div v-if="bookid==0"  class="input-flex flex-ai-center">
				<div class="input-flex-label">上传文件</div>
				<div class="btn-small js-upfile">选择文件</div>
				<div id="upfile-loading" style="display: none;">上传中..</div>
				<input type="hidden" v-model="fileurl" name="fileurl" id="fileurl" />
				<span class="mgl-5 cl-red f12">*只支持zip压缩包</span>
				<input type="file" name="upfile" class="none" id="upfile" />
			</div>
			 
			<div class="input-flex">
				<div class="input-flex-label">配送方式</div>
				<div class="flex flex-ai-center">
					<input name="sendtype" v-model="sendtype" value="0" type="radio" /> 到店自取
					<input name="sendtype" v-model="sendtype" value="1" type="radio" /> 送上门
				</div>
			</div>
			<div v-if="sendtype==1">
				<div class="input-flex">
					<div class="input-flex-label input-flex-require">配送费：</div>
					<div class="input-flex-txt cl-money">￥{{send_money}}</div>
				</div>
				<div class="input-flex">
					<div class="input-flex-label input-flex-require">联系人：</div>
					<input type="text" class="input-flex-text" name="nickname" id="nickname" value="<?php echo $this->_var['nickname']; ?>">
				</div>
				<div class="input-flex">
					<div class="input-flex-label input-flex-require">电话：</div>
					<input type="text" class="input-flex-text" name="telephone" id="telephone" value="<?php echo $this->_var['telephone']; ?>">
				</div>
				
				<div class="input-flex">
					<div class="input-flex-label input-flex-require">地址：</div>
					<input type="text" class="input-flex-text" name="address" id="address" value="<?php echo $this->_var['address']; ?>">
				</div>
			</div>
			<div class="input-flex">
				<div class="input-flex-label">备注</div>
				<input placeholder="请输入备注内容" type="text" class="input-flex-text" name="content" />
			</div>
			<div class="input-flex">
				<div class="input-flex-label">支付金额</div>
				<div class="input-flex-txt cl-money">￥{{money}}</div>
			</div>
			<div @click="submit" class="btn-row-submit">确认下单</div>
			</form>
		</div>
		<?php echo $this->fetch('footer.html'); ?>
		<script>
			var bookid=<?php echo $this->_var['bookid']; ?>;
		</script>
		<script src="<?php echo $this->_var['skins']; ?>olprint_order/add.js"></script>
		<script>
			$(document).on("click",".js-upfile",function(){
				$("#upfile").click();
			})
			$(document).on("change","#upfile",function(){
				$("#upfile-loading").html("上传中...").show();
				skyUpload("upfile","/index.php?m=upload&a=upload&ajax=1",function(e){
					
					var res = JSON.parse(e.target.responseText);
					if(res.error==0){
						$("#upfile-loading").html("上传成功...");
						//$("#fileurl").val(res.imgurl);
						 
						App.$data.fileurl=res.imgurl;
					}else{
						$("#upfile-loading").html("上传失败...");
					}
					
				},function(e){
					console.log(e)
				},function(e){
					console.log(e)
				})
			})
			
			 
		</script>
	</body>
</html>
