var nowOrderId = null;
mui.ready(function(){
	var nowUrl = location.href;
	var orderId = nowUrl.split("?")[1].split("&")[0].split("=")[1];
	nowOrderId = orderId;
	selectUser({"orderId":orderId});
	document.querySelector('.loading-bg').style.display='none';
});

function selectUser(orderId) {
	var btnArray = ['否', '是'];
	mui.ajax('/iamberry/wechat/order/getOrderInfo',{
		data:orderId,
		dataType:'json',
		type:'post',
		timeout:15000,
		success:function(dt){
			if (dt.status) {
				var order = dt.data;
				$("#pay-money-total").html((order.salesAmount / 100).toFixed(2));
				//$("#pay-integral-total").html(dt.data.salesIntegralNum);
				$("#orderid-span").html(order.salesOrderid);
				$("#check-order-desc").attr("value", order.salesOrderid);
				$('#check-luck-draw').attr("value",order.salesOrderid);
				var date = new Date(order.salesTransactionDate);
				var str = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() + "  " + date.getHours() + ":" + date.getMinutes() + ":" + (date.getSeconds() + 1)
				$("#pay-date-span").html(str);
				//$("#rawdrs-integral").html(dt.data.salesRewardIntegralNum);
				$("#show-div-data").show();
				$("#now-load-data-div-bg").hide();
				// alert(nowOrderId);
				$("#check-order-desc").attr("href", "/iamberry/pay/goOrderInfo?orderId=" + nowOrderId)
			} else {
				mui.confirm(dt.message + '是否刷新页面？', '爱贝源-提示', btnArray, function(e) {
					if (e.index == 1) {
						location.reload(true);
					}
				});
			}
		},
		error:function(xhr,type,errorThrown){
			errorfn(xhr);
		}
	});
}