<!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" href="//s.iamberry.com/watero/css/mui.min.css">
	<link rel="stylesheet" href="//s.iamberry.com/watero/css/iconfont.css" />
	<link rel="stylesheet" href="//s.iamberry.com/watero/css/icons-extra.css"/>
	<link rel="stylesheet" href="//s.iamberry.com/watero/css/style.css" />
	<style type="text/css">
		.return{position: fixed;
			right: 30px;
			bottom: 80px;
			background: rgba(0,0,0,.2);
			padding: 12px;
			border-radius: 50%;
			text-align: center;
			opacity: .9;color: #333;display: none;}
		.my-btn-hand{display:block;width: 100%;height: 55px;background-color: #c5c5c5;color: #fff;border: 0;border-radius: 0;}
		.my-btn-hand.active{background-color: #1cc9f4;}
		.cl-blue{color: #1cc9f4;}
		.iconfont{font-size: 20px;}
		.mui-content-madded{background: #fff;padding: 10px 10px 40px 10px;}
		.lease-ul{font-size: 12px;color: #999;}
		.lease-left{display: inline-block;width: 25%;}
		.ul_radio{width: 73%;display: inline-block;}
		.ul_radio li{width:100%;height: 55px;margin: 0 1%;border-radius: 5px; display: inline-block;position: relative;font-family:"iconfont" !important;font-style:normal;-webkit-font-smoothing: antialiased;}
		.radio-cell .active:after{position: absolute;right: 0;bottom: 0;content: "\e66f";color: #f1436c;line-height: 1;font-size: 20px;}
		.lease-r-center{position: absolute;left: 70px;top: 20px;}
		.lease-select-box{padding: 12px 0;position: relative;}
		.lease-select{position: absolute;left: 0;top: 10px;}
		.order-noline{font-size: 14px;color: #999;padding-top:5px;}
		.order-noline li{margin: 5px 0;}
		.order-noline .mui-media{padding: 10px;border-top: 1px solid rgba(0,0,0,.1);}
		.mui-media:after,.order-noline:after{display: none;}
		.wh-60{width: 50px;margin-right:10px;}
		.btn-give,.btn-activation{padding: 3px 10px; border: 1px solid #1cc9f4;font-size: 14px;margin-right: 10px;color: #1cc9f4;width: 90px;}
		.btn-give:before,.btn-activation:before,.btn-tui:before,.btn-shouhou:before{font-size: 16px;}
		.btn-tui{padding: 3px 10px;border:0;font-size: 14px;color: #1CC9F4;}
		.btn-shouhou{padding: 3px 10px;border: 0;font-size: 14px;color: #1CC9F4;}
		.lease-order-list>.mui-table-view-cell{border-bottom: 7px solid #f3f3f3;}
		.lease-order-list:after{display: none;}
		.lease-order-list{padding-bottom: 55px;}
		.pd-10{padding:0 0 10px 0;}
		#btn_submit{color: #fff;font-size: 18px;background: #24cae9;margin-bottom: 0;border: 0;}
		.mui-btn-block.mui-active,.btn-pull-code.mui-active{background-color: #c8c8c8 !important;}
		.buy-footer{z-index: 99;}
		.mui-scroll-wrapper {bottom:55px !important;}
		.lease-order-list>.mui-table-view-cell.mui-active{background:#fff;}
		.mui-table-view-cell>a:not(.mui-btn).mui-active {background-color: #fff;}
	</style>
	<script>
        // 屏蔽分享
        window.hiddenAllWechatMenu = true;
	</script>
</head>

<body>
<div class="loading-bg">
	<div class="mui-loading">
		<div class="mui-spinner">
		</div>
		&nbsp;&nbsp;加载中...
	</div>
</div>
<div class="mui-content">
	<!--数据列表-->
	<ul class="mui-table-view lease-order-list">

	</ul>
</div>
<div class="buy-footer">
	<button type="button" data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="提交中" class="mui-btn mui-btn-block mui-btn-outlined" id="btn_submit">继续兑换</button>
</div>

<script src="//s.iamberry.com/watero/js/mui.min.js"></script>
<script src="//s.iamberry.com/watero/js/jquery-2.1.1.min.js"></script>
<script src="//s.iamberry.com/watero/js/shop/main.js"></script>
<script src="//s.iamberry.com/watero/js/shop/wechat-utils-1.0.js"></script>
<script>
    mui.ready(function() {
        mui.ajax(base_path + '/giftCard/card/exchange/logs?dates=' + new Date().getTime(), {
            data: {},
            dataType: 'json',
            type: 'post',
            timeout: 15000,
            success: function(dt) {
                //console.log(dt);
                if(dt.isRedirect) {
                    location.href = dt.redirectURL;
                } else {
                    if(dt.returnCode=="200" && dt.resultCode=="200"){
                        var table = document.body.querySelector('.lease-order-list');
                        mui(dt.returnMsg.logs).each(function(index) {
                            var li = document.createElement('li');
                            li.className ='mui-table-view-cell';
                            var cl='';
                            switch (this.userMachineColorName){
                                case "品蓝":
                                    cl='cp-1.jpg'
                                    break;
                                case "西瓜红":
                                    cl='cp-4.jpg'
                                    break;
                                case "苹果绿":
                                    cl='cp-3.jpg'
                                    break;
                                case "品黑":
                                    cl='cp-2.jpg'
                                    break;
                                default:
                                    break;
                            }
                            var postfirm='',postnum='';
                            if(this.userMachinePostNum != null || typeof(this.userMachinePostNum)!="undefined") {
                                postnum=this.userMachinePostNum;
                                postfirm=this.userMachinePostName;
                            }
                            var order_status='';
                            var logistics = '';
                            switch (this.userMachineStatus) {
                                case 1:order_status = "待发货";break;
                                case 2:order_status = "已发货";logistics = '<span class="cl-blue mui-pull-right go_wuliu" postfirm="' + postfirm + '" postnum="' + postnum + '" gourl="/watero/wechat/giftCard/card/exchangeUI">查看物流</span>';break;
                                default:order_status = "已发货";break;
                            }
                            li.innerHTML='<div class="pd-10"><span class="iconfont icon-gift1 cl-blue"></span>&nbsp;礼品兑换详情</div><ul class="mui-table-view order-noline"><li>兑换码：'+this.cardPwd+'</li><li>兑换时间:'+formatDate(this.userMachineCreateDate)+'</li><li>兑换手机号：'+this.userMachineTel+'</li><li>订单状态：'+order_status+ logistics +'</li><li class="mui-table-view-cell mui-media"><a><img class="mui-media-object mui-pull-left" src="//s.iamberry.com/watero/images/'+cl+'"><div class="mui-media-body">'+this.userMachineProductName+'<div>'+this.userMachineColorName+'</div></div></a></li><li>'+this.userMachineAddressName+'：'+this.userMachineAddressTel+'</li><li>'+this.userMachineAddressInfo+'</li></ul>';
                            li.setAttribute("name",this.cardPwd);
                            table.appendChild(li);
                        });
                        mui('body').on('tap', '.go_wuliu', function() {
                            var urlStr = document.domain;
                            if(typeof(this.getAttribute("postFirm"))!="undefined" && typeof(this.getAttribute("postNum"))!="undefined"){
                                mui.openWindow({
                                    url: '//m.kuaidi100.com/index_all.html?type=' + this.getAttribute("postFirm") + '&postid=' + this.getAttribute("postNum") + '&callbackurl=//' + urlStr + this.getAttribute("gourl") + "&tiemstamp=" + new Date().getTime()
                                })
                            }
                        });
                        document.querySelector('.loading-bg').style.display = 'none';
                    }else{
                        mui.alert(dt.resultMsg);
                    }
                }
            },
            error: function(xhr, type, errorThrown) {
                console.log(xhr)
            }
        });
        //console.log("页面加载完毕")
        //mui('#pullrefresh_lease_orderlist').pullRefresh().pullupLoading();

        mui('body').on('tap', '#btn_submit', function() {
            mui.openWindow({
                url: '/watero/view/gift_card_user_exchange.html'
            });
        });
		/* mui('body').on('tap', '.lease-order-list>.mui-table-view-cell', function() {
		 mui.openWindow({
		 url: '/watero/view/gift_card_exchange_details.html?name='+this.getAttribute("name")
		 });
		 }); */

    });
</script>
</body>

</html>