<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>我的质保卡</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<style type="text/css">
			.warranty-box{margin: 14px;position: relative;}
			.warranty-box>img{width: 100%;}
			.warranty-name{position: absolute;top: 22px;left: 90px;font-size: 18px;}
			.warranty-tips{position: absolute;top: 48px;left: 90px;}
			.icon-chanpintiyan{font-size: 50px;}
			.jiqi{position: absolute;left: 20px;top: 15px;line-height: 1;border-radius: 50%;}
			 .date-list{display: table;width: 100%;position: absolute;top: 50%;text-align: center;}
			 .date-list>div{display: table-cell;position: relative;}
			 .date-list>div:after{content: '';width: 1px;top: 25%;height: 50%;background-color: #fff;-webkit-transform: scaleX(.5);position: absolute;right: 0;}
			 .warranty-number{position: absolute;left: 20px;bottom: 15px;}
		</style>
		<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
		<script>
			//屏蔽分享
			document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
				WeixinJSBridge.call('hideOptionMenu');
			});
		</script>
	</head>
	<body style="background-color: #f1f1f1;">
	<div class="loading-bg">
			<div class="mui-loading">
				<div class="mui-spinner">
				</div>
				&nbsp;&nbsp;加载中...
			</div>
		</div>
		<header class="mui-bar mui-bar-nav" style="background-color: transparent;">
			<div id="pro-menu" class="mui-segmented-control">
					<a class="mui-control-item mui-active" href="#item1">净水机</a>
					<a class="mui-control-item" href="#item2">冲奶机</a>
					<a class="mui-control-item" href="#item3">电动牙刷</a>
				</div>
		</header>
	<div class="mui-content" style="background-color: #f1f1f1;">
	<div style="margin: 10px 14px 15px 14px;background-color: #fff;padding: 10px;border-radius: 5px;">
		<div style="padding:0 0 10px 0"><span class="iconfont icon-shouhoudianhua" style="color: #d78b82;float: left;"></span> &nbsp;&nbsp;联系方式</div>
		<p>1、公众号联系客服&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、客服电话:<a href="400 8006 692">400 8006 692</a></p>
	</div>
	<div class="data-cards" id="data-cards">

			<div class="warranty-box" id="add_warranty" style="display: block;">
				<img src="images/add-bg.png"/>
				<img class="go_add_warranty_card" style="position: absolute;width: 25%;left: 37.5%;top: 16%;" src="images/add.png"/>
				<div style="position: absolute;bottom: 20%;text-align: center;width: 100%;">添加质保卡</div>
			</div>

			<div class="warranty-box">
				<img src="images/naiji-bg.png"/>
				<span class="jiqi" style="">
					<img width="60px" src="images/naiji-logo.png" />
				</span>
				<span class="warranty-name">Aiberle冲奶机</span>
				<span class="warranty-tips">售后根据国家三包政策</span>
				<div class="date-list">
					<div>购买日期<br/>2017-01-02</div>
					<div>换新截止<br/>2017-01-02</div>
					<div>保修截止<br/>2017-01-02</div>
				</div>
				<div class="warranty-number">NO.  1599  9999  999</div>
			</div>
	</div>
	<div class="mui-content-padded mui-text-center">
		<h6>温馨提示:产品有任何问题,请于保修期内联系客服解决</h6>
	</div>
	</div>
	<script type="text/javascript" src="js/mui.min.js"></script>
	<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="js/main.js"></script>
	<script type="text/javascript">
        var num = getParam("num");

	mui.ready(function(){

//      $.ajax(base_path + '/qrcode/select_warranty_card_list?dates=' + new Date().getTime(), {
//          dataType: 'json',
//          type: 'post',
//          timeout: 15000,
//          success: function(dt) {
//              if(dt.isRedirect) {
//                  location.href = dt.redirectURL;
//              } else {
//                  if(dt.status) {
//                      var data_cards = dt.data;
//                      var table = $('#data-cards');
//                      var li = '';
//                      mui(data_cards).each(function(index) {
//                          li += '<div class="mui-content" style="background: #fff;">'
//                              +'<div class="warranty-box">'
//                              +'<img src="//s.iamberry.com/wateroPF/new/images/shop/warranty_card.png"/>'
//                              +'<span class="jiqi" style=""><span class="iconfont icon-chanpintiyan"></span></span>'
//                              +'<span class="warranty-name">美国WaterO可移动智能净水机</span>'
//                              +'<span class="warranty-tips">一年只换不修、十年质保</span>'
//								+'<div class="date-list">'
//                              +'<div>购买日期<br/>' + dateFormat(this.cardSaleTime) + '</div>'
//                              +'<div>一年包换<br/>' + dateFormat(this.cardRenewTime) + '</div>'
//                              +'<div>质保截止<br/>' + dateFormat(this.cardEndTime) + '</div>'
//                              +'</div>'
//                              +'<div class="warranty-number">NO.&nbsp;&nbsp;'+ datePhone(this.cardBarcode) +'</div>'
//                          	+'</div>'
//                          	+'</div>'
//                      });
//                      if (li == '') {
//                          $('#add_warranty').show();
//                      } else {
//                          $('#add_warranty').hide();
//                      }
//                      table.append(li);
//                  } else {
//                      mui.alert(dt.message);
//                  }
//              }
//          },
//          error: function(xhr, type, errorThrown) {
//              //异常处理;
//              console.log(xhr);
//          }
//      });
        document.querySelector('.loading-bg').style.display='none';
	});

	function datePhone(phone) {
	    if (phone != null && phone.length >= 12) {
			var phone1 = phone.substring(0,4);
            var phone2 = phone.substring(4,8);
            var phone3 = phone.substring(8,12);
            var phone4 = phone.substring(12,phone.length);
            return phone1 + "&nbsp;&nbsp;" + phone2 + "&nbsp;&nbsp;" + phone3 + "&nbsp;&nbsp;" + phone4;
		}
	}
	//添加质保卡
    mui('body').on('tap', '.go_add_warranty_card', function() {
        alert(num);
        location.href='/wateroPF/view/add_machine.html?num='+num;
	});

    function dateFormat(now) {
        if (now == null || now == '') {
            return '暂无';
        } else {
            now = new Date(now);
            var year = now.getFullYear();
            var month = now.getMonth() + 1;
            var date = now.getDate();
            if (month < 10) {
                month = "0" + month;
			}
			if (date < 10) {
                date = "0" + date;
			}
            return year + "-" + month + "-" + date
        }
    };
	</script>
	</body>
</html>