handlebar.js

3 篇文章 0 订阅
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!doctype html>
<html class="no-js">
<%@ taglib prefix="s" uri="/struts-tags" %> 
<head>
  <title>滴哒洗车</title>

<%@ include file="/PUBLISH/common/wapmeta.jsp"%>
<link rel="stylesheet" href="<%=path %>/PUBLISH/amazeui/css/amazeui.switch.css"/>
<link rel="stylesheet" href="<%=path %>/PUBLISH/amazeui/css/iscroll.css"/>

<script src="<%=path %>/PUBLISH/amazeui/js/iscroll.js"></script>
<script src="<%=path %>/PUBLISH/common/iscroll.js"></script>
<script src="<%=path %>/PUBLISH/amazeui/js/amazeui.switch.min.js"></script>
  <body>
  	<style>
	 .order{background:#FFF;font-size:2.0rem; color:#666; padding:0.8rem; border-bottom:1px solid #dbdbdb; margin-bottom:1rem;}
	 .order .time{}
	 .order .state{ color:#aeaeae; text-align:right; margin-bottom:1rem;}
	 .order .txtbox{ font-size:1.6rem; padding-bottom:0;}
	  .order .txtbox span{ color:#c94141; margin-right:0.5rem;}
	  
	  .order:active {background:#ededed;}
	  
	  
	  .am-tab-panel{ padding:0 !important;}
	  .am-active a{ background-color:#f5f5f5!important;  border-bottom:4px solid #f19321!important;}
	  
	 </style> 
	<script type="text/x-handlebars-template" id="amz-header">
  		{{>header header}}
	</script>
	<div id="myHeader"></div>
	<div class="am-tabs" id="doc-my-tabs">
	  <ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
	    <li class="am-active"><a href="" id="option1" style="font-size:1.6rem; padding:1rem;color:#333">已派单</a></li>
	    <li><a href="" id="option2" style="font-size:1.6rem; padding:1rem; color:#333">已完成</a></li>
	  </ul>
	  <div class="am-tabs-bd">
	  	
		<div class="am-tab-panel am-active" id="scrollDiv1">
	    <div id="orderBox1">
	    </div>
	    <img id="noorderimg1" src="<%=path %>/PUBLISH/amazeui/i/noorder.png" width="50%" style="margin-left:25%; margin-top:25%;display: none" />
	    </div>
		<div class="am-tab-panel" id="scrollDiv2">
	    <div id="orderBox2">
	    </div>
	    <img id="noorderimg2" src="<%=path %>/PUBLISH/amazeui/i/noorder.png" width="50%" style="margin-left:25%; margin-top:25%;display: none" />
	    </div>
	  </div>
	</div>
	
	<script id="order-template1" type="text/x-handlebars-template">
{{#order}}
<div id="{{id}}" class="order" οnclick="select(this.id)">

    <div class="am-g">
      <div class="am-u-sm-11">
		<div class="txtbox"> 顾客 : {{username}}</div>
        <div class="txtbox"> 车牌号 : {{carNum}}</div>
		<div class="txtbox"> 电      话: {{tel}}</div>
		<div class="txtbox"> 下单时间: {{createTime}}</div>
		<div class="txtbox"> 金额: <span style="color:red">¥{{cost}} </span></div>
      </div>
    </div>

 </div>
  
{{/order}}
 	</script>
 	<script id="order-template2" type="text/x-handlebars-template">
{{#order}}
<div id="{{id}}" class="order" οnclick="select(this.id)">

    <div class="am-g">
      <div class="am-u-sm-11">
        <div class="txtbox"> 顾客 : {{username}}</div>
        <div class="txtbox"> 车牌号 : {{carNum}}</div>
		<div class="txtbox"> 电      话: {{tel}}</div>
		<div class="txtbox"> 下单时间: {{createTime}}</div>
		<div class="txtbox"> 金额: <span style="color:red">¥{{cost}} </span></div>
      </div>
    </div>

 </div>
  
{{/order}}
 	</script>
  
  	<script >
  	
  		var rows = 20;
  		var page1 = 1;
  		var page2 = 1;
  		var template1;
  		var template2;
  		var endFinish1 = false;
  		var endFinish2 = false;
  		
  		var text;
  		
  		$("#doc-my-tabs").tabs();
	  	$(function() {
	  		template1 = Handlebars.compile($("#order-template1").html());
	  		template2 = Handlebars.compile($("#order-template2").html());
	  		// 加载header
	  		loadHeader();
	  		getData1();
	  		getData2();
	  	});
	  	var loadHeader = function() {
	  		var value={
	  				leftLink:"javascript:history.back();",
	  				leftIcon:"chevron-left",
	  				title:"订单列表",
	  				div:"myHeader"
	  		};
	  		header(value);
	  	};
	  	
	  	function getData1(){
	  		myLoading("正在加载...");
	  		$.ajax({
	  			type : "POST",
	  			dataType : "json",
	  			url : path + "/workerorder/getList.do",
	  			data : {rows : rows , page : page1 , orderStatus : "3"},
	  			success : function(json) {
	  				if(json.success){
	  					if(page1 == 1){
	  						text = $("#option1").text();
	  						$("#option1").text(text + "(" + json.sum + ")");
	  					}
	  					if(json.count == 0 && page1 == 1){
	  						$("#noorderimg1").css("display","block");
	  					}
	  					else{
	  						$("#noorderimg1").css("display","none");
	  					}
	  					$("#orderBox1").append(template1(json.data));
	  					
	  					$(window).scroll(function(){
	  						
	  						if($(document).scrollTop() + document.body.clientHeight == $(document).height()){
	  							if (!endFinish1) {
	  								getData1();
	  							}
	  						}
	  					});
	  					if(json.count < rows){
	  						endFinish1 = true;
	  					}
	  					if(json.count > 0){
	  						page1 = page1 + 1;
	  					}
	  				}
	  				myLoadingClose();
	  			}
	  		});
	  	}
	  	function getData2(){
	  		myLoading("正在加载...");
	  		$.ajax({
	  			type : "POST",
	  			dataType : "json",
	  			url : path + "/workerorder/getList.do",
	  			data : {rows : rows , page : page2 , orderStatus : "5"},
	  			success : function(json) {
	  				if(json.success){
	  					if(page2 == 1){
	  						text = $("#option2").text();
	  						$("#option2").text(text + "(" + json.sum + ")");
	  					}
	  					if(json.count == 0 && page2 == 1){
	  						$("#noorderimg2").css("display","block");
	  					}
	  					else{
	  						$("#noorderimg2").css("display","none");
	  					}
	  					$("#orderBox2").append(template2(json.data));
	  					
	  					$(window).scroll(function(){
	  						
	  						if($(document).scrollTop() + document.body.clientHeight == $(document).height()){
	  							if (!endFinish2) {
	  								getData2();
	  							}
	  						}
	  					});
	  					if(json.count < rows){
	  						endFinish2 = true;
	  					}
	  					if(json.count > 0){
	  						page2 = page2 + 1;
	  					}
	  				}
	  				myLoadingClose();
	  			}
	  		});
	  	}
	  	
	  	function select(id){
	  		window.location.href = path + "/workerorder/getDetail.do?id="+id;
	  	}
  	</script>
  </body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值