987 lines
37 KiB
JavaScript
987 lines
37 KiB
JavaScript
$('#content').after('<div class="tui"></div>');
|
||
var pay_name = 0;
|
||
var token = localStorage.getItem('token');
|
||
var order_class = localStorage.getItem('order_class');
|
||
var orderNo;
|
||
var orderId;
|
||
var getReasonUrl = '';
|
||
var priceT = 0;
|
||
var payCode = '';
|
||
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
|
||
}
|
||
}
|
||
});
|
||
var count = 1;
|
||
|
||
function pullupRefresh() {
|
||
count += 1;
|
||
getData(count);
|
||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||
}
|
||
|
||
/**
|
||
* 下拉刷新具体业务实现
|
||
*/
|
||
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/Orders/getOrderList'), {
|
||
type: order_class,
|
||
page: page,
|
||
pagesize: 10
|
||
}, function(data) {
|
||
var data = toJson(data);
|
||
var html = ''
|
||
if ('' == data.data.Rows) {
|
||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||
$('.con').append("<div style='text-align: center;margin-top: 50px;'>无数据</div>");
|
||
return;
|
||
}
|
||
$.each(data.data.Rows, function() {
|
||
//this.pay_name = 1;
|
||
var shopConfirmHtml = '';
|
||
if (this.orderStatus == 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 +
|
||
'" data-goodsType="' + this.goodsType + '" data-helpUserId="' + this.helpUserId + '" data-helpUserLevel="' + this.helpUserLevel + '" data-helpUserName="' + this.helpUser.userName + '"><div class="row_title"><div class="store_name">' + this.shopName +
|
||
'</div><div class="indent_status shopPhone">商家电话:<a href="tel:' +
|
||
this.phone + '">' + this.phone + '</a></div>' + shopConfirmHtml + '<div class="indent_status yellow">' +
|
||
this.status + '</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="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="combination">共' + this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney +
|
||
'</o>(含运费¥' + this.deliverMoney + ')</div>';
|
||
if(this.goodsType == 3){
|
||
html += '<div class="combination">助购人:'+ this.helpUser.userName +'(第'+this.helpUserLevel+'层)</div>';
|
||
}
|
||
html += '<div class="btns clearfix">';
|
||
if (this.orderStatus == -2) {
|
||
html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name +
|
||
'">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||
} else if (this.orderStatus == 0) {
|
||
html += '<div class="btns_btn uploadCertificate">上传凭证</div>';
|
||
if (this.noticeDeliver == 0) {
|
||
html += '<div class="btns_btn txfh" style="display:none;">提醒发货</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||
} else {
|
||
html += '<div class="btns_btn " style="display:none;">已提醒</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||
}
|
||
|
||
} else if (this.orderStatus == 1) {
|
||
html +=
|
||
'<div class="btns_btn qrsh">确认收货</div><div class="btns_btn ckwl">查看物流</div><div class="btns_btn qxdd_js" >拒收</div><div class="btns_btn yssh">延长收货</div>';
|
||
} else if (this.orderStatus == 2) {
|
||
if (this.isAppraise == 0) {
|
||
html += '<div class="btns_btn ljpj" >立即评价</div>';
|
||
} else {
|
||
html += '<div class="btns_btn ckpj">查看评价</div>';
|
||
}
|
||
|
||
}
|
||
if (this.orderStatus != 1 && this.orderStatus != -2 && this.isComplain == 0) {
|
||
html += '<div class="btns_btn tsdd" >投诉</div>';
|
||
}
|
||
if (this.allowRefund == 1 && (this.orderStatus == -1 || this.orderStatus == -3)) {
|
||
html += '<div class="btns_btn qxdd_js" >申请退款</div>';
|
||
}
|
||
|
||
html += '</div></div>'
|
||
})
|
||
$('.con').append(html);
|
||
isLoad = false;
|
||
})
|
||
}
|
||
mui.plusReady(function() {
|
||
|
||
// window.addEventListener('refresh', function(e) { //执行刷新
|
||
// location.reload();
|
||
// });
|
||
// //console.log(order_class)
|
||
if (order_class == 'all') {
|
||
order_class = '';
|
||
}
|
||
getData(count);
|
||
|
||
//支付插件
|
||
plus.payment.getChannels(function(channels) {
|
||
for (var i in channels) {
|
||
if (channels[i].id == "wxpay") {
|
||
wxChannel = channels[i];
|
||
} else {
|
||
aliChannel = channels[i];
|
||
}
|
||
}
|
||
}, function(e) {
|
||
mui.alert("获取支付通道失败:" + e.message);
|
||
});
|
||
// var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
|
||
var ALIPAYSERVER = hyhUrl('app/Alipays/toAlipay?isBatch=0&orderNo=');
|
||
// 2. 发起支付请求
|
||
function pay(id, orderNo) {
|
||
// 从服务器请求支付订单
|
||
var PAYSERVER = '';
|
||
if (id == 'alipay') {
|
||
PAYSERVER = ALIPAYSERVER;
|
||
channel = aliChannel;
|
||
} else if (id == 'wxpay') {
|
||
PAYSERVER = WXPAYSERVER;
|
||
channel = wxChannel;
|
||
} else {
|
||
plus.nativeUI.alert("不支持此支付通道!", null, "捐赠");
|
||
return;
|
||
}
|
||
var xhr = new XMLHttpRequest();
|
||
// var amount = 1;
|
||
|
||
xhr.onreadystatechange = function() {
|
||
switch (xhr.readyState) {
|
||
case 4:
|
||
if (xhr.status == 200) {
|
||
plus.payment.request(channel, xhr.responseText, function(result) {
|
||
plus.nativeUI.alert("支付成功!", function() {
|
||
// back();
|
||
var targetTab = plus.webview.getWebviewById("templete/my.html");
|
||
mui.fire(targetTab, 'refresh');
|
||
location.reload();
|
||
});
|
||
}, function(error) {
|
||
// plus.nativeUI.alert("支付失败:" + error.code);
|
||
// plus.webview.getWebviewById('confirmOrder.html').close()
|
||
});
|
||
} else {
|
||
mui.alert("获取订单信息失败!");
|
||
//console.log(xhr.status)
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
xhr.open('GET', PAYSERVER + orderNo);
|
||
xhr.send();
|
||
|
||
}
|
||
$('#pay_way,.pay_info .con_1').append(
|
||
'<div class="row clearfix select_payway" data-payCode="qlgpay"><p class="row_left">付款方式</p><p class="row_right">线下支付</p></div>'
|
||
);
|
||
|
||
// mui.ajax(hyhUrl('/app/Users/get_name_and_money'), {
|
||
// headers: {
|
||
// "HYH-Token": token
|
||
// },
|
||
// data: {},
|
||
// dataType: 'json', //服务器返回json格式数据
|
||
// type: 'post', //HTTP请求类型
|
||
// timeout: 10000, //超时时间设置为10秒;
|
||
// success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// // //console.log(data)
|
||
// data = toJson(data);
|
||
//
|
||
// if(data.status == 1) {
|
||
// $('#loginName').html(data.data.name);
|
||
// $('.userMoney').html(data.data.money);
|
||
// var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额:<o class="userECT">' + data.data.userECT + '</o></p></div>';
|
||
// $('.pay_info .con_1').append(htmlpay);
|
||
// } else {
|
||
// mui.alert('发生错误请刷新后重试!');
|
||
// // location.reload();
|
||
// }
|
||
// },
|
||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||
// // mui.alert(type);
|
||
// }
|
||
// })
|
||
$('.con').on('tap', '.ljfk', function() {
|
||
var that = $(this);
|
||
pay_name = $(this).attr('data-payName');
|
||
priceT = $(this).parent().siblings('.combination').children('o').html().slice(1);
|
||
$('#goodsTotalMoney').html($(this).parent().siblings('.combination').children('o').html())
|
||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||
var goodsType = $(this).parent().parent().attr('data-goodsType');
|
||
if (pay_name == 1) {
|
||
$('.pay_info .con_1 .row').eq(0).attr('style', 'display: none;');
|
||
$('.pay_info .con_1 .row').eq(2).addClass('on');
|
||
that.attr('disabled', 'disabled');
|
||
mui.ajax(hqlgUrl('app/ect/getToEctNum'), {
|
||
|
||
data: {
|
||
total_money: priceT
|
||
},
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
var data = toJson(data);
|
||
if (data.status == 1) {
|
||
var btnArray = ['是', '否'];
|
||
mui.confirm(data.msg, 'ECT确认支付', btnArray, function(e) {
|
||
if (e.index == 1) {
|
||
return;
|
||
} else {
|
||
$('.bg').css('display', 'block');
|
||
$(".pay").slideDown(300);
|
||
}
|
||
that.removeAttr('disabled');
|
||
})
|
||
} else {
|
||
mui.alert(data.msg);
|
||
that.removeAttr('disabled');
|
||
return;
|
||
}
|
||
}
|
||
})
|
||
} else {
|
||
$('.pay_info .con_1 .row').eq(2).addClass('on');
|
||
$('.pay_info .con_1 .row').eq(3).attr('style', 'display: none;');
|
||
$('.bg').css('display', 'block');
|
||
$(".pay").slideDown(300);
|
||
}
|
||
$('#loginName').html(localStorage.getItem("userName"));
|
||
// 助购层级获取
|
||
if(goodsType == '3'){
|
||
var helpUserId = $(this).parent().parent().attr('data-helpUserId');
|
||
var helpUserLevel = $(this).parent().parent().attr('data-helpUserLevel');
|
||
var helpUserName = $(this).parent().parent().attr('data-helpUserName');
|
||
$("#selectHelpLevel").show().data("user_id", helpUserId).data("user_name", helpUserName);
|
||
$("#displayHelpLevel").text(helpUserName+"(第"+helpUserLevel+"层)")
|
||
var _tmp = document.getElementById("displayHelpLevel");
|
||
_tmp.dataset["user_id"]=helpUserId;
|
||
_tmp.dataset["user_name"]=helpUserName;
|
||
_tmp.dataset["level_id"]=helpUserLevel;
|
||
JZL.ajax(qlgUrl('app/user_level/TreeList'),{},function(_zgData){
|
||
let _zgHtml = ""
|
||
for (let levelId in _zgData) {
|
||
let each = _zgData[levelId]
|
||
_zgHtml += '<div class="row clearfix" data-user_id="'+each.userId+'" data-user_name="'+each.userName+'" data-level_name="'+each.level+'" data-level_id="'+each.level_id+'">'+
|
||
'<p class="row_left">'+each.level+':</p>'+'<p class="row_right">'+each.userName.substr(0, 12)+'</p></div>'
|
||
}
|
||
$("#pay_select_level .con_1").html(_zgHtml)
|
||
})
|
||
}else{
|
||
$("#selectHelpLevel").hide();
|
||
}
|
||
})
|
||
|
||
$('.bg').on('tap', '.mui-icon-left-nav', function() {
|
||
$('.pay').css('display', 'block');
|
||
$('.pay_way').css('display', 'none');
|
||
})
|
||
$('.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').on('tap', '#selectHelpLevel', function() {
|
||
$("#pay_select_level").show();
|
||
})
|
||
$("#pay_select_level .con_1").on('tap', '.row', function(e){
|
||
$("#pay_select_level").hide();
|
||
$("#displayHelpLevel").text((this.dataset.user_name + "(" + this.dataset.level_name + ")").substr(0,12))
|
||
for(var _k in this.dataset){document.getElementById("displayHelpLevel").dataset[_k] = this.dataset[_k]}
|
||
})
|
||
$('.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
|
||
}
|
||
if(document.getElementById("displayHelpLevel").dataset["level_id"] !== undefined){
|
||
data_ljfk["helpLevel"] = document.getElementById("displayHelpLevel").dataset["level_id"]
|
||
}
|
||
if(document.getElementById("displayHelpLevel").dataset["user_id"] !== undefined){
|
||
data_ljfk["helpUserId"] = document.getElementById("displayHelpLevel").dataset["user_id"]
|
||
}
|
||
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(data.msg)
|
||
// 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';
|
||
}
|
||
var postData = {
|
||
orderNo: orderNo,
|
||
isBatch: 0,
|
||
payPwd: payPwd
|
||
}
|
||
if(document.getElementById("displayHelpLevel").dataset["user_id"] !== undefined){
|
||
postData["helpUserId"] = document.getElementById("displayHelpLevel").dataset["user_id"]
|
||
}
|
||
if(document.getElementById("displayHelpLevel").dataset["level_no"] !== undefined){
|
||
postData["helpUserLevel"] = document.getElementById("displayHelpLevel").dataset["level_no"]
|
||
}
|
||
mui.ajax(hyhUrl('app/' + payCode + '/' + srcc), {
|
||
|
||
data: postData,
|
||
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: 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 = ' 退款产品券数量:<input type="text" class="refundTxt" name="productNum" id="productNum" value="' +
|
||
data.productNum +
|
||
'" placeholder="请输入产品券数量"/>' +
|
||
' 退款优惠券数量:<input type="text" class="refundTxt" name="couponsNum" id="couponsNum" value="' + data.couponsNum +
|
||
'" placeholder="请输入优惠券数量"/>' +
|
||
' 退款旺旺券数量:<input type="text" class="refundTxt" name="wangNum" id="wangNum" value="' + data.wangNum +
|
||
'" placeholder="请输入旺旺券数量"/>' +
|
||
' 退款现金数量:' + 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();
|
||
|
||
} else {
|
||
mui.alert(data.msg)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// mui.alert(type);
|
||
}
|
||
});
|
||
} else if (getReasonUrl == 'getRejectCause') {
|
||
setReasonUrl = 'reject';
|
||
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');
|
||
location.reload();
|
||
|
||
} else {
|
||
mui.alert(data.msg)
|
||
}
|
||
},
|
||
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(qlgUrl('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();
|
||
|
||
}
|
||
})
|
||
|
||
}
|
||
|
||
})
|
||
|
||
$('.con').on('tap', '.yssh', function() {
|
||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||
orderId = $(this).parent().parent().attr('data-id');
|
||
if (confirm('你要延长收货么?')) {
|
||
mui.ajax(qlgUrl('/app/orders/delay'), {
|
||
headers: {
|
||
"HYH-Token": token
|
||
},
|
||
data: {
|
||
id: orderId
|
||
},
|
||
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);
|
||
////console.log(data.status)
|
||
if (data.status == 1) {
|
||
mui.alert(data.msg);
|
||
} else {
|
||
mui.alert(data.msg)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// mui.alert(errorThrown);
|
||
}
|
||
});
|
||
}
|
||
})
|
||
|
||
$('.con').on('tap', '.qrsh', function() {
|
||
//$('.bg_').css('display', 'block');
|
||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||
orderId = $(this).parent().parent().attr('data-id');
|
||
if (confirm('确认收货?')) {
|
||
mui.ajax(hyhUrl('/app/Orders/receive'), {
|
||
headers: {
|
||
"HYH-Token": token
|
||
},
|
||
data: {
|
||
id: orderId
|
||
},
|
||
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);
|
||
////console.log(data.status)
|
||
if (data.status == 1) {
|
||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||
mui.fire(list, 'refresh');
|
||
location.reload()
|
||
} else {
|
||
mui.alert(data.msg)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// mui.alert(errorThrown);
|
||
}
|
||
});
|
||
}
|
||
|
||
})
|
||
$('#select').on('change', function() {
|
||
if ($(this).val() == '10000') {
|
||
$('#content').css('display', 'block');
|
||
} else {
|
||
$('#content').css('display', 'none');
|
||
}
|
||
})
|
||
//跳转到评价
|
||
mui('.con').on('tap', '.ljpj', function() {
|
||
var oId = $(this).parent().parent().attr('data-id');
|
||
mui.openWindow({
|
||
url: 'pj.html',
|
||
id: 'pj.html' + oId,
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
width: '100%', //新页面宽度,默认为100%
|
||
height: '100%' //新页面高度,默认为100%
|
||
},
|
||
extras: {
|
||
data_order_id: oId
|
||
// 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', '.ckpj', function() {
|
||
var oId = $(this).parent().parent().attr('data-id');
|
||
mui.openWindow({
|
||
url: 'pj.html',
|
||
id: 'pj.html' + oId,
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
width: '100%', //新页面宽度,默认为100%
|
||
height: '100%' //新页面高度,默认为100%
|
||
},
|
||
extras: {
|
||
data_order_id: oId
|
||
// 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', '.tsdd', function() {
|
||
var oId = $(this).parent().parent().attr('data-id');
|
||
mui.openWindow({
|
||
url: 'complain.html',
|
||
id: 'complain.html' + oId,
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
width: '100%', //新页面宽度,默认为100%
|
||
height: '100%' //新页面高度,默认为100%
|
||
},
|
||
extras: {
|
||
data_order_id: oId
|
||
// 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
})
|
||
|
||
})
|