$('#content').after('<div class="tui"></div>');
var pay_name = 0;
var token = localStorage.getItem('token');
var order_class = localStorage.getItem('shop_order_class');
var orderNo;
var orderId;
var getReasonUrl = '';
var priceT = 0;
var payCode = '';
var shopId = '';
var wxChannel = null; // 微信支付
var aliChannel = null; // 支付宝支付  
var channel = null; //支付通道 
mui.init({
	pullRefresh: {
		container: '#pullrefresh',
		down: {
			style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
			color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
			height: '50px', //可选,默认50px.下拉刷新控件的高度,
			range: '100px', //可选 默认100px,控件可下拉拖拽的范围
			offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
			//					auto: true, //可选,默认false.首次加载自动上拉刷新一次
			contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
			contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
			contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
			contentnomore: '没有更多数据了',
			callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
		},
		up: {
			contentrefresh: '正在加载...',
			callback: pullupRefresh
		},
		beforeback: function() { //获得父页面的webview
			var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
			mui.fire(list, 'reload');
			//返回true,继续页面关闭逻辑
			return true;
		}
	}
});
var count = 1;

function pullupRefresh() {
	count += 1;
	getData(count);
	mui('#pullrefresh').pullRefresh().endPullupToRefresh();
}
// //console.log(order_class);
/**
 * 下拉刷新具体业务实现
 */
function pulldownRefresh() {
	setTimeout(function() {
		window.location.reload();
		//mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
	}, 1500);
}
var isLoad = false;

function getData(page) {
	if (true == isLoad) return;
	isLoad = true;
	JZL.ajax(qlgUrl('app/Shoporders/getSellerOrderList'), {
		type: order_class,
		shopId: shopId,
		page: page,
		pagesize: 10
	}, function(data) {
		//console.log(data);
		var data = toJson(data);
		var html = '',
			html1 = "";
		if (1 == data.status) {
			// console.log(data);
			if ('' == data.data.Rows) {
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
				return;
			}
			$.each(data.data.Rows, function() {
				//this.pay_name = 1;
				var shopConfirmHtml = '';
				// console.log(this.orderStatus);
				// 			if ( == 0) {
				// 				if (0 == this.shopConfirm) {
				// 					shopConfirmHtml = '<div class="indent_status confirm_wait" > 待商家确认</div>';
				// 				} else if (1 == this.shopConfirm) {
				// 					shopConfirmHtml = '<div class="indent_status confirm_ok" > 商家已确认</div>';
				// 				}else if (2 == this.shopConfirm) {
				// 					shopConfirmHtml = '<div class="indent_status confirm_no" > 商家未收款</div>';
				// 				}
				// 			}
				// 			html += '<div class="row" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId +
				// 				'"><div class="row_title"><div class="store_name">' + this.shopName +
				// 				'</div><div class="indent_status yellow">' +
				// 				this.status + '</div>' + shopConfirmHtml + '<div class="indent_status shopPhone">商家电话:<a href="tel:' +
				// 				this.phone + '">'+this.phone+'</a></div></div><div class="row_con clearfix" data-id="' + this.orderId +
				// 				'">'
				html += '<div class="row shadown_wai" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId +
					'"><div class="row_title"><div class="rtl store_no">订单编号:' + this.orderNo +
					'</div><div class="rtr indent_time">' + this.createTime +
					'</div></div><div class="row_con clearfix" data-id="' + this.orderId + '">'
				$.each(this.list, function() {
					html += '<div class="row_block clearfix"><img src="' + hyhImgUrl(this.goodsImg) +
						'" /><div class="rc clearfix"><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName +
						' </p><p class="leibie">' + this.goodsSpecNames + '</p></div><div class="rcrr"><p>¥' + this.goodsPrice +
						'</p><del></del><span>x' + this.goodsNum +
						'</span></div></div><div class="rcb clearfix"><span>优惠</span><span>优惠:0.52</span><span>优惠:0.52</span></div></div></div>'
					// 				html += '<div class="row_block clearfix"><img src="' + hyhImgUrl(this.goodsImg) +
					// 					'" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">' + this.goodsSpecNames +
					// 					'</p></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p><del>¥' + this.marketPrice + '</del><span>x' +
					// 					this.goodsNum + '</span></div></div></div>';
				})

				html +=
					'</div><div class="row_title clearfix"><div class="rtl user_info">买家信息</div><div class="rtr combination">共' +
					this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney + '</o>(含运费¥0.00)</div></div>'
				html +=
					'<div class="user_info_"><div class="u_address"><div class="pos"><img src="../img/dingwei1.png"></div><div class="pos_c"><p class="pos_c_p">地址:</p><p for="">' +
					this.userAddress +
					'</p></div></div><div class="u_address"><div class="pos"><img src="../img/dingwei1.png"></div><div class="pos_c"><p class="">电话:</p><p>' +
					this.userPhone + '</p><p>' + this.userName + '</p></div></div></div>'
				// 			html += '</div><div class="combination">共' + this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney +
				// 				'</o>(含运费¥' + this.deliverMoney + ')</div><div class="btns clearfix">';
				if (this.orderStatus == -2) { //未付款
					html += '<div class="btns clearfix"><div class="btns_btn ">未付款</div></div>'
					// 				html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name +
					// 					'">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
				} else if (this.orderStatus == -1) {
					if (1 == this.isPay) {
						if (1 == this.isRefund) {
							//yituikuan
							// html +=	'<div class="btns clearfix"><div class="btns_btn ">已退款</div></div>'
							html +=
								'<div class="btns clearfix"><div class="btns_btn ">已退款</div><div class="btns_btn ">订单已取消</div></div>'
						} else {
							//tuikuancaozuoanniu
							// html +=	'<div class="btns clearfix"><div class="btns_btn  qrtk">确认退款</div></div>'
							html +=
								'<div class="btns clearfix"><div class="btns_btn ">确认退款</div><div class="btns_btn ">订单已取消</div></div>'

						}
					} else {
						html += '<div class="btns clearfix"><div class="btns_btn ">订单已取消</div></div>'
					} //0 daiqueren 1 queren  2 jujue
				} else if (this.orderStatus == 0) {
					if (1 == this.shopConfirm) {
						html += '<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div></div>'
					} else if (0 == this.shopConfirm) {
						html += '<div class="btns clearfix"><div class="btns_btn qrsk">确认收款</div></div>'
					} else if (2 == this.shopConfirm) {
						html +=
							'<div class="btns clearfix"><div class="btns_btn qrsk">确认收款</div><div class="btns_btn ">已拒绝</div></div>'

					}

					// html +='<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div></div>'
					//html +=
					// '<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div><div class="btns_btn qrsk">确认收款</div></div>'
				} else if (this.orderStatus == 1) {
					html += '<div class="btns clearfix"><div class="btns_btn yfh">已发货</div><div class="btns_btn">配送中</div></div>'
				} else if (this.orderStatus == 2) {
					html +=
						'<div class="btns clearfix"><div class="btns_btn finish">已完成</div><div class="btns_btn tjpz">提交凭证</div></div>'
				} else if (this.orderStatus == -3) {
					// html += '<div class="btns clearfix"><div class="btns_btn yhjs">用户拒收</div></div>'
					if (1 == this.isPay) {
						if (1 == this.isRefund) {
							//yituikuan
							html +=
								'<div class="btns clearfix"><div class="btns_btn ">已退款</div><div class="btns_btn ">用户拒收</div></div>'

						} else {
							//tuikuancaozuoanniu
							// html +=	'<div class="btns clearfix"><div class="btns_btn  qrtk">确认退款</div></div>'
							html +=
								'<div class="btns clearfix"><div class="btns_btn qrtk">确认退款</div><div class="btns_btn ">用户拒收</div></div>'
						}
					}
				}

				// 				if(-1 == this.orderStatus || -3 ==this.orderStatus){
				// 					if(1 == this.isPay){
				// 						if(1 == this.isRefund){
				// 							//yituikuan
				// 						html +=	'<div class="btns clearfix"><div class="btns_btn ">已退款</div></div>'
				// 
				// 						}else{
				// 							//tuikuancaozuoanniu
				// 						html +=	'<div class="btns clearfix"><div class="btns_btn  qrtk">确认退款</div></div>'
				// 
				// 						}
				// 					}
				// 				}
				html1 = '<span>产品券:' + this.productNum + '</span><span>优惠券:' + this.couponsNum + '</span><br/><span>旺旺券:' +
					this.wangNum + '<span>';
				html += '</div>'
			})

			$('.con').append(html);
			$(".rcb").html(html1)
		} else {
			mui.alert(data.msg)
		}
		isLoad = false;
	})
}
mui.plusReady(function() {
	var self = plus.webview.currentWebview();
	// //console.log(self);
	shopId = self.shopId;
	getData(count);
	// 	window.addEventListener('refresh', function(e) { //执行刷新
	// 		location.reload();
	// 	});
	//				//console.log(order_class)
	if (order_class == 'all') {
		order_class = '';

	}
	// 已付款 店家确认收款
	$('.con').on('tap', '.qrsk', function() {
		orderId = $(this).parent().parent().attr('data-id');
		$('.bg').css('display', 'block')
		$('#querenshoukuan').css('display', 'block')
	})
	$('#querenshoukuan').on('tap', '.pay_btn', function() {
		// orderId = $(this).parent().parent().attr('data-id');
		var confirmType = $('#querenshoukuan input[type="radio"]:checked').val();
		//console.log(confirmType,orderId,shopId);
		JZL.ajax(qlgUrl('app/Shoporders/orderConfirm'), {
			confirmType: confirmType,
			shopId: shopId,
			id: orderId
		}, function(data) {
			// console.log(data);
			if (1 == data.status) {
				$('.bg').css('display', 'none')
				$('#querenshoukuan').css('display', 'none')
				var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
				mui.fire(list, 'refresh');
				location.reload()

				// mui.back();
			} else {
				mui.alert(data.msg)
			}
		})
	})
	//  店家确认退款
	var content = "";
	$('.con').on('tap', '.qrtk', function() {
		orderId = $(this).parent().parent().attr('data-id');
		$('.bg').css('display', 'block')
		$('#querentuikuan').css('display', 'block')
	})
	$('#querentuikuan').on('tap', '.pay_btn', function() {
		// orderId = $(this).parent().parent().attr('data-id');
		var confirmType = $('#querentuikuan input[type="radio"]:checked').val();
		content = $("#refuse_con").val()
		// console.log(confirmType, orderId, shopId, content, $("#refuse_con"));
		if (-1 == confirmType) {
			if ('' == $.trim($("#refuse_con").val())) {
				mui.alert("请输入拒绝原因")
				return
			} else {}
		}
		JZL.ajax(qlgUrl('app/Shoporders/shopRefund'), {
			refundStatus: confirmType,
			content: content,
			shopId: shopId,
			id: orderId
		}, function(data) {
			//console.log(data);
			if (1 == data.status) {
				$('.bg').css('display', 'none')
				$('#querentuikuan').css('display', 'none')
				// location.reload();
				var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
				mui.fire(list, 'refresh');
				location.reload()
				// mui.back();
			} else {
				mui.alert(data.msg)
			}

		})
	})
	// 已付款 店家发货
	$('.con').on('tap', '.qrfh', function() {
		orderId = $(this).parent().parent().attr("data-id")
		$('.bg').show();
		$('.delivery').show();
		JZL.ajax(qlgUrl('app/Orders/getExpress'), {}, function(data) {
			// //console.log(data);
			if (data.status == 1) {
				// html = '';
				var html = '<option value="0">请选择快递公司</option>'
				mui.each(data.data, function(index, element) {
					html += '<option value="' + this.expressId + '">' + this.expressName + '</option>'
				})
				$('#expressId').append(html)
			} else {
				mui.alert(data.msg)
			}
		})

	})
	// 选择快递公司名称



	//确认发货
	$('.delivery').on('tap', '.pay_btn', function() {
		if (0 == $('#expressId option:selected').val()) {
			mui.alert('请选择快递公司名称')
			return;
		}
		if ('' == $('#expressNo').val()) {
			mui.alert('请输入快递单号')
			return;
		}
		var pargams = {}
		pargams.expressNo = $('#expressNo').val();
		pargams.expressId = $('#expressId').val();
		pargams.id = orderId;
		pargams.shopId = shopId;
		JZL.ajax(qlgUrl('app/ShopOrders/deliver'), pargams, function(data) {
			// console.log(data);
			if (1 == data.status) {
				// var data = data.data;
				mui.toast(data.msg)
				$('.delivery').css('display', 'none')
				$('.bg').css('display', 'none')
				var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
				mui.fire(list, 'refresh');
				location.reload()

			} else {
				mui.alert(data.msg)
			}

		})
	})
	// 返回
	$('.bg').on('tap', '.mui-icon-left-nav', function() {
		// $('.pay').css('display', 'block');
		$('.bg').css('display', 'none');
		$('.pay_way').css('display', 'none');
	})
	//提交凭证
	$('.con').on('tap', '.tjpz', function() {
		var orderId = $(this).parent().parent().attr("data-id")
		JZL.openWindow('shoperUploadVoucher.html', 'shoperUploadVoucher.html', {
			orderIds: orderId,
			shopId: shopId,
		});
	})

	// 关闭
	$('.bg').on('tap', '.mui-icon-closeempty', function() {
		$('.bg').css('display', 'none');
		// 		$(".pay").slideUp(300, function() {
		// 
		// 		});
	})
	// 

	// $('#pay_way').on('tap', '.row', function() {
	// 		$('#pay_way .row .mui-icon').removeClass('mui-icon-checkmarkempty');
	// 		$(this).children('.mui-icon').addClass('mui-icon-checkmarkempty');
	// 		$('.con_1 .on .row_right o').html($(this).children('.row_left').html());
	// 		$('.con_1 .on').attr('data-payCode', $(this).attr('data-payCode'))
	// 		$('.pay').css('display', 'block');
	// 		$('#pay_way').css('display', 'none');
	// 
	// 	})
	// 	$('.pay').on('tap', '.con_1 .on', function() {
	// 		if ($(this).attr('data-payCode') == 'ect') {
	// 
	// 		} else {
	// 			$('.pay').css('display', 'none');
	// 			$('#pay_way').css('display', 'block');
	// 		}
	// 
	// 	})
	// 	$('.pay_btn').on('tap', function() {
	// 		payCode = $('.con_1 .on').attr('data-payCode');
	// 		////console.log(payCode)
	// 		var that = $(this);
	// 		var data_ljfk = {
	// 			isBatch: 0,
	// 			orderNo: orderNo
	// 		}
	// 		that.attr('disabled', 'disabled');
	// 		mui.ajax(hyhUrl('app/orders/succeed'), {
	// 			data: data_ljfk,
	// 			dataType: 'json', //服务器返回json格式数据  
	// 			type: 'post', //HTTP请求类型  
	// 			timeout: 10000, //超时时间设置为10秒;  
	// 			success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
	// 				data = toJson(data);
	// 
	// 				if (data.status == 1) {
	// 					if (payCode == 'qlgpay') {
	// 						JZL.ajax(hyhUrl('app/' + payCode + '/payment'), {
	// 							orderNo: orderNo,
	// 							isBatch: 0
	// 						}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
	// 							// //console.log(JSON.stringify(data));
	// 							var data = toJson(data);
	// 							// //console.log(JSON.stringify(data))
	// 							if (data.status == 1) {
	// 								$('.pay').css('display', 'none');
	// 								$('#qlg_pay_pwd').css('display', 'block');
	// 								if (data.data.payPwd == '0') {
	// 									mui.alert('还未设置支付密码请先设置操作密码!');
	// 									var url = 'setting_fogetPayPwd';
	// 									JZL.openWindow(url + '.html', url + '.html');
	// 									//return;
	// 								}
	// 								$('#totalMoney').html('付款总额:¥<o>' + data.data.needPay + '</o>');
	// 								$('#productNum').val(data.data.product.useProduct);
	// 								if (data.data.product.useProduct > 0) {
	// 									var html1 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.product.useProductOk +
	// 										'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.product.useProductTaxFee +
	// 										'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.product.useProductHandlingFee +
	// 										'</span></p>';
	// 									// 									$('#productInfo').html('产品券[抵扣额:' + data.data.product.useProductOk + ',扣税:' + data.data.product.useProductTaxFee +
	// 									// 										',手续费:' + data.data.product.useProductHandlingFee + ']');
	// 									$('.productInfo_').html(html1)
	// 
	// 								}
	// 								$('#couponsNum').val(data.data.coupons.useCoupons);
	// 								if (data.data.coupons.useCoupons > 0) {
	// 									var html2 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.coupons.useCouponsOk +
	// 										'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.coupons.useCouponsTaxFee +
	// 										'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.coupons.useCouponsHandlingFee +
	// 										'</span></p>';
	// 									$('.couponsInfo_').html(html2)
	// 									// 									$('#couponsInfo').html('优惠券[抵扣额:' + data.data.coupons.useCouponsOk + ',扣税:' + data.data.coupons.useCouponsTaxFee +
	// 									// 										',手续费:' + data.data.coupons.useCouponsHandlingFee + ']');
	// 								}
	// 								$('#wangNum').val(data.data.wang.useWang);
	// 								$('#moneyNum').val(data.data.money.useMoney);
	// 
	// 							} else {
	// 								mui.alert(data.msg)
	// 							}
	// 						});
	// 					} else if (payCode == 'wallets' || payCode == 'ect') {
	// 						//跳输入密码的页面
	// 						mui.ajax(hyhUrl('app/' + payCode + '/payment'), {
	// 							data: {
	// 								orderNo: orderNo,
	// 								isBatch: 0
	// 							},
	// 							dataType: 'json', //服务器返回json格式数据  
	// 							type: 'post', //HTTP请求类型  
	// 							timeout: 10000, //超时时间设置为10秒;  
	// 							success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
	// 								//					//console.log(data.data.goodsFavoritesNum)
	// 								var data = toJson(data);
	// 								if (data.status == 1) {
	// 									$('.pay').css('display', 'none');
	// 									$('#pay_pwd').css('display', 'block');
	// 									if (data.data.payPwd == '0') {
	// 										mui.alert('还未设置支付密码请先设置支付密码!');
	// 										var url = 'setting_fogetPayPwd';
	// 										mui.openWindow({
	// 											url: url + '.html',
	// 											id: url + '.html',
	// 											styles: {
	// 												top: '0px', //新页面顶部位置
	// 												bottom: '0px', //新页面底部位置
	// 												width: '100%', //新页面宽度,默认为100%
	// 												height: '100%' //新页面高度,默认为100%
	// 											},
	// 											extras: {
	// 												//						data_href: data_href
	// 												//					..... //自定义扩展参数,可以用来处理页面间传值
	// 											},
	// 											createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
	// 											show: {
	// 												//					autoShow: true, //页面loaded事件发生后自动显示,默认为true
	// 												//					aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
	// 												//					duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
	// 												//					event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
	// 												//					extras: {} //窗口动画是否使用图片加速
	// 											},
	// 											waiting: {
	// 												autoShow: true, //自动显示等待框,默认为true
	// 												title: '正在加载...', //等待对话框上显示的提示内容
	// 												options: {
	// 													//						width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
	// 													//						height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
	// 													//						......
	// 												}
	// 											}
	// 										})
	// 									}
	// 								}
	// 							},
	// 							error: function(xhr, type, errorThrown) { //异常处理;  
	// 								//											mui.alert(type);      
	// 							}
	// 						});
	// 
	// 					} else if (payCode == 'alipays') {
	// 						pay('alipay', orderNo);
	// 						//									plus.nativeUI.showWaiting();
	// 						//									mui.post(hyhUrl('app/Alipays/payment'), {
	// 						//									orderNo: data.data,
	// 						//										isBatch: 1
	// 						//									var ALIPAYSERVER = hyhUrl('app/Alipays/payment?orderNo=' + data.data + '&isBatch=1');
	// 
	// 					}
	// 
	// 					that.removeAttr('disabled');
	// 				} else {
	// 					mui.alert('发生错误请刷新后重试!');
	// 					//							location.reload();
	// 				}
	// 			},
	// 			error: function(xhr, type, errorThrown) { //异常处理;  
	// 				mui.alert(type);
	// 			}
	// 		})
	// 	})
	// 	$('#pay_pwd,#qlg_pay_pwd').on('tap', '.p9', function() {
	// 		var url = 'setting_fogetPayPwd';
	// 		JZL.openWindow(url + '.html', url + '.html');
	// 	})
	// 	$('#pay_pwd,#qlg_pay_pwd').on('tap', '.pay_btn_pwd', function() {
	// 		// 		var self = plus.webview.currentWebview();
	// 		// 		var data_href = self.id;
	// 		// //console.log(data_href)
	// 		// 						JZL.closeWindow('waitPay');
	// 		//return;
	// 		var payPwd = $('#payPwd').val();
	// 		if (payPwd == '') {
	// 			mui.alert('支付密码不能为空!');
	// 			return;
	// 		}
	// 		var that = $(this);
	// 		that.attr('disabled', 'disabled')
	// 		var srcc = ''
	// 		if (payCode == 'qlgpay') {
	// 			srcc = 'payByQlg';
	// 		} else if (payCode == 'ect') {
	// 			srcc = 'payByEct';
	// 		} else {
	// 			srcc = 'payByWallet';
	// 		}
	// 
	// 		mui.ajax(hyhUrl('app/' + payCode + '/' + srcc), {
	// 
	// 			data: {
	// 				orderNo: orderNo,
	// 				isBatch: 0,
	// 				payPwd: payPwd
	// 			},
	// 			dataType: 'json', //服务器返回json格式数据  
	// 			type: 'post', //HTTP请求类型  
	// 			timeout: 10000, //超时时间设置为10秒;  
	// 			success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
	// 				//					//console.log(data.data.goodsFavoritesNum)
	// 				var data = toJson(data);
	// 				mui.alert(data.msg)
	// 				//console.log(data.status)
	// 				if (data.status == 1) {
	// 					JZL.openWindow('indent.html', 'waitDeliver', {
	// 						data_href: 'waitDeliver'
	// 					});
	// 					setTimeout(function() {
	// 						JZL.closeWindow(plus.webview.currentWebview().id);
	// 						// JZL.closeWindow('indent.html');
	// 					}, 700)
	// 					// 					var targetTab = plus.webview.getWebviewById("templete/my.html");
	// 					// 					mui.fire(targetTab, 'refresh');
	// 					// 					location.reload();
	// 				} else {
	// 
	// 				}
	// 				that.removeAttr('disabled')
	// 
	// 			},
	// 			error: function(xhr, type, errorThrown) { //异常处理;  
	// 				//																		mui.alert(type);      
	// 			}
	// 		});
	// 
	// 	})

	mui('.con').on('tap', '.row_con', function() {
		var data_order_id = $(this).attr('data-id');
		mui.openWindow({
			url: 'order_out.html',
			id: 'order_out.html',
			styles: {
				top: '0px', //新页面顶部位置
				bottom: '0px', //新页面底部位置
				width: '100%', //新页面宽度,默认为100%
				height: '100%' //新页面高度,默认为100%
			},
			extras: {
				data_order_id: data_order_id
				//						data_id: data_id
				//					..... //自定义扩展参数,可以用来处理页面间传值
			},
			createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
			show: {
				//					autoShow: true, //页面loaded事件发生后自动显示,默认为true
				//					aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
				//					duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
				//					event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
				//					extras: {} //窗口动画是否使用图片加速
			},
			waiting: {
				autoShow: true, //自动显示等待框,默认为true
				title: '正在加载...', //等待对话框上显示的提示内容
				options: {
					//						width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
					//						height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
					//						......
				}
			}
		})
	})
	mui('.con').on('tap', '.ckwl', function() {
		var data_order_id = $(this).parent().parent().attr('data-id'); //$(this).attr('data-id');
		JZL.openWindow('logistics.html', 'logistics.html', {
			data_order_id: data_order_id
		});
	})
	//上传凭证
	mui('.con').on('tap', '.uploadCertificate', function() {
		var orderId = $(this).parent().parent().attr('data-id');
		// mui.alert('跳到上传凭证页' + orderId)
		JZL.openWindow("uploadVoucher.html", "uploadVoucher.html", {
			orderId: orderId
		})
	})
	$('.con').on('tap', '.qxdd_js', function() {
		orderNo = $(this).parent().parent().attr('data-orderNo');
		orderId = $(this).parent().parent().attr('data-id');
		if ($(this).html() == '取消订单') {
			getReasonUrl = 'getCancelCause';
		} else if ($(this).html() == '拒收') {
			getReasonUrl = 'getRejectCause';
		} else if ($(this).html() == '申请退款') {
			getReasonUrl = 'getRefundCause';
			JZL.ajax(hyhUrl('/app/Orders/getRefund'), {
				id: orderId
			}, function(data) { //服务器返回响应
				// //console.log(JSON.stringify(data));
				var data = toJson(data);
				if (data.status == 1) {
					data = data.data;
					var html = '';
					if ('qlgpay' == data.payFrom) {
						html = '&nbsp;退款产品券数量:<input type="text" class="refundTxt" name="productNum" id="productNum" value="' +
							data.productNum +
							'" placeholder="请输入产品券数量"/>' +
							'&nbsp;退款优惠券数量:<input type="text" class="refundTxt" name="couponsNum" id="couponsNum" value="' + data.couponsNum +
							'" placeholder="请输入优惠券数量"/>' +
							'&nbsp;退款旺旺券数量:<input type="text" class="refundTxt" name="wangNum" id="wangNum" value="' + data.wangNum +
							'" placeholder="请输入旺旺券数量"/>' +
							'&nbsp;退款现金数量:' + data.moneyNum + ',现金方面请与商家协商' +
							// '<p class="info1">(金额不能超过<o>¥' + data.realTotalMoney +
							'</o>)</p>';
					} else {
						html = '<input type="text" name="Tmoney" id="Tmoney" value="' + data.realTotalMoney +
							'" placeholder="请输入退款金额"/><p class="info1">(金额不能超过<o>¥' + data.realTotalMoney +
							'</o>)</p><p class="info1">(积分数量:' + data.ectNum + ')</p>';
					}

					$('.tui').html(html)
				} else {
					mui.alert(data.msg)
				}
			});
		}
		$('.bg_').css('display', 'block');
		$('.bg_con').css('display', 'none');
		$('.bg_con').slideDown(300, function() {});
		mui.ajax(hyhUrl('/app/Orders/' + getReasonUrl), {
			data: {},
			dataType: 'json', //服务器返回json格式数据  
			type: 'post', //HTTP请求类型  
			timeout: 10000, //超时时间设置为10秒;  
			success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
				//					//console.log(data.data.goodsFavoritesNum)
				//					//console.log(data.data.Rows)
				var data = toJson(data);
				if (data.status == 1) {
					var html = '<option value="0">请下拉选择原因</option>';
					$.each(data.data, function() {
						html += '<option value="' + this.dataVal + '">' + this.dataName + '</option>'
					});
					$('#select').html(html)
				} else {
					mui.alert(data.msg)
				}
			},
			error: function(xhr, type, errorThrown) { //异常处理;  
				//					mui.alert(type);      
			}
		});
	})

	$('.bg_').on('tap', '.en_false', function() {
		$('.bg_').css('display', 'none');

	})
	$('.bg_').on('tap', '.en_true', function() {
		var setReasonUrl = '';
		var content = $('#content').val();
		var reason = $('#select').val();
		if ($('#select').val() == 0) {
			mui.alert('请选择原因!');
			return;
		}
		if ($('#select').val() == 10000 && content == '') {
			mui.alert('请输入其他原因!');
			return;
		}
		if (getReasonUrl == 'getCancelCause') {
			setReasonUrl = 'cancellation';
			mui.ajax(qlgUrl('app/Orders/' + setReasonUrl), {
				data: {
					reason: reason,
					id: orderId,
					content: content
				},
				dataType: 'json', //服务器返回json格式数据  
				type: 'post', //HTTP请求类型  
				timeout: 10000, //超时时间设置为10秒;  
				success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
					//					//console.log(data.data.goodsFavoritesNum)
					//					//console.log(data.data.Rows)
					var data = toJson(data);
					mui.alert(data.msg);
					if (data.status == 1) {
						// 						var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
						// 						mui.fire(list, 'refresh');
						if ('waitPay' == plus.webview.currentWebview().id) {
							location.reload();
						} else {
							JZL.openWindow('indent.html', 'abnormal', {
								data_href: 'abnormal'
							});
							setTimeout(function() {
								//plus.webview.currentWebview().close();
								JZL.closeWindow(plus.webview.currentWebview().id);
							}, 500)
						}
						// 						JZL.openWindow('indent.html', 'abnormal', {
						// 							data_href: 'abnormal'
						// 						});
						// 						setTimeout(function() {
						// 							plus.webview.currentWebview().close();
						// 							// JZL.closeWindow(plus.webview.currentWebview().id);
						// 						}, 500)
						//location.reload();

					}
				},
				error: function(xhr, type, errorThrown) { //异常处理;  
					//					mui.alert(type);      
				}
			});
		} else if (getReasonUrl == 'getRejectCause') {
			setReasonUrl = 'reject';
			mui.ajax(hyhUrl('app/Orders/' + setReasonUrl), {
				data: {
					reason: reason,
					id: orderId,
					content: content
				},
				dataType: 'json', //服务器返回json格式数据  
				type: 'post', //HTTP请求类型  
				timeout: 10000, //超时时间设置为10秒;  
				success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;  
					//					//console.log(data.data.goodsFavoritesNum)
					//					//console.log(data.data.Rows)
					var data = toJson(data);
					mui.alert(data.msg);
					if (data.status == 1) {
						// 						var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
						// 						mui.fire(list, 'refresh');
						location.reload();

					}
				},
				error: function(xhr, type, errorThrown) { //异常处理;  
					//					mui.alert(type);      
				}
			});
		} else if (getReasonUrl == 'getRefundCause') {
			var params = {}
			// params.money = $('#Tmoney').val();
			// 			if (params.money < 0 || params.money == 0) {
			// 				mui.alert('退款金额不能为0!');
			// 				return;
			// 			}
			params.productNum = $('#productNum').val();
			params.couponsNum = $('#couponsNum').val();
			params.wangNum = $('#wangNum').val();
			params.reason = reason;
			params.id = orderId;
			params.content = content;
			JZL.ajax(hyhUrl('app/Orderrefunds/refund'), params, function(data) {
				var data = toJson(data);
				mui.alert(data.msg);
				if (data.status == 1) {
					var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
					mui.fire(list, 'refresh');
					location.reload();
				}
			})
		}
	})
	$('#select').on('change', function() {
		if ($(this).val() == '10000') {
			$('#content').css('display', 'block');
		} else {
			$('#content').css('display', 'none');
		}
	})
})