1006 lines
40 KiB
JavaScript
Executable File
1006 lines
40 KiB
JavaScript
Executable File
$('#content').after('<div class="tui"></div>');
|
||
$('.pay_info .row_left').eq(0).html('桔子链账号');
|
||
|
||
var pay_name = 0;
|
||
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: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
|
||
callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
|
||
},
|
||
up: {
|
||
contentrefresh: '正在加载...',
|
||
callback: pullupRefresh
|
||
}
|
||
}
|
||
});
|
||
var count = 1;
|
||
|
||
function pullupRefresh() {
|
||
|
||
setTimeout(function() {
|
||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||
count += 1;
|
||
var order_class = localStorage.getItem('order_class');
|
||
var token = localStorage.getItem('token');
|
||
// console.log(order_class)
|
||
if(order_class == 'all') {
|
||
order_class = '';
|
||
}
|
||
mui.ajax(hyhUrl('app/Orders/getOrderList'), {
|
||
headers: {
|
||
"HYH-Token": token
|
||
},
|
||
data: {
|
||
type: order_class,
|
||
page: count,
|
||
pagesize : 5
|
||
},
|
||
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.data.Rows.length == 0) {
|
||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||
return;
|
||
}
|
||
|
||
var html = ''
|
||
$.each(data.data.Rows, function() {
|
||
this.pay_name = 1;
|
||
html += '<div class="row shadown_wai" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId + '"><div class="row_title"><div class="store_name">' + this.shopName + '</div><div class="indent_status">' + 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><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) {
|
||
if(this.noticeDeliver == 0) {
|
||
html += '<div class="btns_btn txfh" style="display:none;">提醒发货</div><div class="btns_btn qxdd">取消订单</div>';
|
||
} else {
|
||
html += '<div class="btns_btn " style="display:none;">已提醒</div><div class="btns_btn qxdd">取消订单</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>';
|
||
} else if(this.orderStatus == 2) {
|
||
if(this.isAppraise == 0) {
|
||
html += '<div class="btns_btn ljpj" >立即评价</div>';
|
||
} else {
|
||
html += '<div class="btns_btn qxdd_js">查看评价</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);
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
}, 500);
|
||
}
|
||
|
||
/**
|
||
* 下拉刷新具体业务实现
|
||
*/
|
||
function pulldownRefresh() {
|
||
setTimeout(function() {
|
||
window.location.reload();
|
||
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
|
||
}, 1500);
|
||
}
|
||
mui.plusReady(function() {
|
||
var token = localStorage.getItem('token');
|
||
var order_class = localStorage.getItem('order_class');
|
||
var orderNo;
|
||
var orderId;
|
||
var getReasonUrl = '';
|
||
var priceT = 0;
|
||
var payCode = '';
|
||
window.addEventListener('refresh', function(e) { //执行刷新
|
||
location.reload();
|
||
});
|
||
//支付插件
|
||
plus.payment.getChannels(function(channels) {
|
||
for(var i in channels) {
|
||
if(channels[i].id == "wxpay") {
|
||
wxChannel = channels[i];
|
||
} else {
|
||
aliChannel = channels[i];
|
||
}
|
||
}
|
||
}, function(e) {
|
||
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 {
|
||
alert("获取订单信息失败!");
|
||
console.log(xhr.status)
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
xhr.open('GET', PAYSERVER + orderNo);
|
||
xhr.send();
|
||
|
||
}
|
||
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" data-payCode="ect"><p class="row_left">ECT余额:<o class="userECT">' + data.data.userECT + '</o></p></div>';
|
||
$('#pay_way .con_1').append(htmlpay);
|
||
} else {
|
||
alert('发生错误请刷新后重试!');
|
||
// location.reload();
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
})
|
||
|
||
$('.pay').on('tap', '.select_payway', function() {
|
||
//if($(this).attr('data-payCode') == 'ect') {} else {
|
||
$('.pay').css('display', 'none');
|
||
$('#pay_way').css('display', 'block');
|
||
//}
|
||
|
||
})
|
||
|
||
$('.con').on('tap', '.ljfk', function() {
|
||
var that = $(this);
|
||
|
||
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');
|
||
// $('.pay_info .con_1 .row').eq(1).addClass('on');
|
||
// $('.pay_info .con_1 .row').eq(2).attr('style', 'display: none;');
|
||
$('.bg').css('display', 'block');
|
||
$(".pay").slideDown(300);
|
||
|
||
})
|
||
|
||
$('.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');
|
||
$('.select_payway .row_right o').html($(this).children('.row_left').html());
|
||
$('.select_payway').attr('data-payCode', $(this).attr('data-payCode'))
|
||
$('.pay').css('display', 'block');
|
||
$('#pay_way').css('display', 'none');
|
||
})
|
||
$('.pay_btn').on('tap', function() {
|
||
payCode = $('.select_payway').attr('data-payCode');
|
||
var that = $(this);
|
||
var data_ljfk = {
|
||
isBatch: 0,
|
||
orderNo: orderNo
|
||
}
|
||
that.attr('disabled', 'disabled');
|
||
console.log(payCode)
|
||
if(payCode == 'ect') {
|
||
mui.ajax(hyhUrl('app/ect/getToEctNum'), {
|
||
|
||
data: {
|
||
'total_money': priceT,
|
||
'wait_pay': 1
|
||
},
|
||
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) {
|
||
that.removeAttr('disabled');
|
||
return;
|
||
} else {
|
||
mui.ajax(hyhUrl('app/orders/succeed'), {
|
||
data: data_ljfk,
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// console.log(data)
|
||
data = toJson(data);
|
||
|
||
if(data.status == 1) {
|
||
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') {
|
||
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) { //异常处理;
|
||
// 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 {
|
||
alert(data.msg);
|
||
// location.reload();
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
})
|
||
}
|
||
that.removeAttr('disabled');
|
||
})
|
||
} else {
|
||
alert(data.msg);
|
||
that.removeAttr('disabled');
|
||
return;
|
||
}
|
||
|
||
}
|
||
})
|
||
} else {
|
||
mui.ajax(hyhUrl('app/orders/succeed'), {
|
||
data: data_ljfk,
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// console.log(data)
|
||
data = toJson(data);
|
||
|
||
if(data.status == 1) {
|
||
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') {
|
||
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) { //异常处理;
|
||
// 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 {
|
||
alert(data.msg);
|
||
// location.reload();
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
})
|
||
}
|
||
|
||
})
|
||
$('#pay_pwd').on('tap', '.p9', function() {
|
||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
})
|
||
$('#pay_pwd').on('tap', '.pay_btn_pwd', function() {
|
||
|
||
var payPwd = $('#payPwd').val();
|
||
if(payPwd == '') {
|
||
alert('支付密码不能为空!');
|
||
}
|
||
var that = $(this);
|
||
that.attr('disabled', 'disabled')
|
||
var srcc = ''
|
||
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);
|
||
alert(data.msg)
|
||
if(data.status == 1) {
|
||
var targetTab = plus.webview.getWebviewById("templete/my.html");
|
||
mui.fire(targetTab, 'refresh');
|
||
location.reload();
|
||
} else {
|
||
|
||
}
|
||
that.removeAttr('disabled')
|
||
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
|
||
})
|
||
|
||
// console.log(order_class)
|
||
if(order_class == 'all') {
|
||
order_class = '';
|
||
}
|
||
mui.ajax(hyhUrl('app/Orders/getOrderList'), {
|
||
headers: {
|
||
"HYH-Token": token
|
||
},
|
||
data: {
|
||
type: order_class,
|
||
page: 1,
|
||
pagesize : 5
|
||
},
|
||
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);
|
||
var html = ''
|
||
$.each(data.data.Rows, function() {
|
||
// this.pay_name = 1;
|
||
html += '<div class="row shadown_wai" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId + '"><div class="row_title"><div class="store_name">' + this.shopName + '</div><div class="indent_status">' + 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><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) {
|
||
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>';
|
||
} 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);
|
||
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// 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');
|
||
mui.openWindow({
|
||
url: 'logistics.html',
|
||
id: 'logistics.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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
})
|
||
|
||
$('.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';
|
||
mui.ajax(hyhUrl('/app/Orders/getRefund'), {
|
||
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);
|
||
if(data.status == 1) {
|
||
data = data.data;
|
||
var html = '<input type="text" name="Tmoney" id="Tmoney" value="" placeholder="请输入退款金额"/><p class="info1">(金额不能超过<o>¥' + data.realTotalMoney + '</o>)</p><p class="info1">(' + data.useScore + '个惠宝抵扣<o>¥' + data.scoreMoney + '</o>)</p>';
|
||
$('.tui').html(html)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
}
|
||
$('.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)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// 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) {
|
||
alert('请选择原因!');
|
||
return;
|
||
}
|
||
if($('#select').val() == 10000 && content == '') {
|
||
alert('请输入其他原因!');
|
||
return;
|
||
}
|
||
if(getReasonUrl == 'getCancelCause') {
|
||
setReasonUrl = 'cancellation';
|
||
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);
|
||
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) { //异常处理;
|
||
// 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);
|
||
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) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
} else if(getReasonUrl == 'getRefundCause') {
|
||
var money = $('#Tmoney').val();
|
||
if(money < 0 || money == 0) {
|
||
alert('退款金额不能为0!');
|
||
return;
|
||
} else {
|
||
mui.ajax(hyhUrl('app/Orderrefunds/refund'), {
|
||
data: {
|
||
reason: reason,
|
||
id: orderId,
|
||
content: content,
|
||
money: money
|
||
},
|
||
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);
|
||
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) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
}
|
||
|
||
}
|
||
|
||
})
|
||
$('.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);
|
||
if(data.status == 1) {
|
||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||
mui.fire(list, 'refresh');
|
||
location.reload()
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(type);
|
||
}
|
||
});
|
||
}
|
||
|
||
})
|
||
$('#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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
})
|
||
|
||
}) |