You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
668
static/app/js/confirmOrder.js
Executable file
668
static/app/js/confirmOrder.js
Executable file
@ -0,0 +1,668 @@
|
||||
var wxChannel = null; // 微信支付
|
||||
var aliChannel = null; // 支付宝支付
|
||||
var channel = null; //支付通道
|
||||
mui.init();
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('setAddress', function(e) {
|
||||
var addressId = localStorage.getItem('addressId') ? localStorage.getItem('addressId') : 0;
|
||||
if(addressId == 0) {
|
||||
return;
|
||||
}
|
||||
mui.ajax(hyhUrl('app/useraddress/getById'), {
|
||||
data: {
|
||||
addressId: addressId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
// for(i in data.data){
|
||||
// console.log(i)
|
||||
// console.log(data.data[i])
|
||||
// }
|
||||
var html = '<div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' + data.userName + '</div><div class="add_r_t_r">' + data.userPhone + '</div></div><div class="add_r_b">收货地址:' + data.areaName + ' ' + data.userAddress + '</div></div>';
|
||||
$('.address').html(html);
|
||||
$('.address').attr('data-addressId', data.addressId);
|
||||
$('.address').attr('data-areaId', data.areaId2);
|
||||
|
||||
} else {
|
||||
alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.con').on('tap', '.address', function() {
|
||||
var addressId = $(this).attr('data-addressId');
|
||||
localStorage.setItem('addressId', addressId);
|
||||
var isOrder = true;
|
||||
mui.openWindow({
|
||||
url: 'setting_address.html',
|
||||
id: 'setting_address.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_addressId: addressId,
|
||||
data_isOrder: isOrder
|
||||
|
||||
// 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
//支付插件
|
||||
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=1&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();
|
||||
|
||||
});
|
||||
}, 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();
|
||||
|
||||
}
|
||||
var self = plus.webview.currentWebview();
|
||||
var type = self.type;
|
||||
var data_1 = {};
|
||||
var isUseScore = 0;
|
||||
var orderNo;
|
||||
var priceT = 0;
|
||||
var payCode = '';
|
||||
// console.log(type)
|
||||
|
||||
mui.ajax(hyhUrl('app/carts/settlement'), {
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
var data = toJson(data);
|
||||
|
||||
if(data.status == 1) {
|
||||
var allallnum = 0;
|
||||
data = data.data;
|
||||
data_1 = data;
|
||||
if(data.userAddress.addressId) {
|
||||
var html = '<div class="address clearfix" data-addressId="' + data.userAddress.addressId + '" data-areaId2="' + data.userAddress.areaId2 + '"><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' + data.userAddress.userName + '</div><div class="add_r_t_r">' + data.userAddress.userPhone + '</div></div><div class="add_r_b">收货地址:' + data.userAddress.areaName + ' ' + data.userAddress.userAddress + '</div></div></div>';
|
||||
} else {
|
||||
var html = '<div class="address clearfix" ><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l" style="height:60px;line-height:60px;font-size:14.4px;color:black">请选择收货地址</div></div></div></div>';
|
||||
}
|
||||
$.each(data.carts, function() {
|
||||
var allNum = 0;
|
||||
html += '<div class="shop_info"><div class="row_title"><div class="store_name">' + this.shopName + '</div></div><div class="row_con clearfix">';
|
||||
$.each(this.list, function() {
|
||||
allNum += this.cartNum;
|
||||
var price = '';
|
||||
if(this.isWhsle == 1) {
|
||||
price = this.whslePrice;
|
||||
} else if(this.specPrice != 'null') {
|
||||
price = this.shopPrice;
|
||||
} else {
|
||||
price = this.specPrice;
|
||||
}
|
||||
var specNames = '';
|
||||
for(var i in this.specNames[0]) {
|
||||
if(i == "catName") {
|
||||
specNames = this.specNames[0][i] + ':';
|
||||
} else if(i == "itemName") {
|
||||
specNames += this.specNames[0][i]
|
||||
}
|
||||
}
|
||||
|
||||
html += '<div class="row_block clearfix" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">';
|
||||
$.each(this.specNames, function() {
|
||||
html += this.catName + ':' + this.itemName + ';';
|
||||
});
|
||||
|
||||
html += '</p></div><div class="rcrr"><p>¥' + price + '</p><del>¥' + this.marketPrice + '</del><span>x' + this.cartNum + '</span></div></div></div>'
|
||||
});
|
||||
allallnum += allNum;
|
||||
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">买家留言:</div><div class="c1_r"><input class="remark" data-shopId="' + this.shopId + '" type="text" name="" id="" value="" placeholder="选填:填写内容已和卖家协商确认" /></div></div></div>';
|
||||
|
||||
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">选择优惠券:</div><div class="c1_r"><select name="" data-shopId="' + this.shopId + '" class="yhq"><option value="0">不使用优惠券</option>';
|
||||
$.each(this.coupons, function() {
|
||||
html += '<option value="' + this.couponId + '">满' + this.useMoney + '元减' + this.couponValue + '元</option>';
|
||||
});
|
||||
html += '</select></div></div></div><div class="cost"><div class="c2 clearfix"><div class="c1_r">共' + allNum + '件商品 小计:<o class="on">¥' + this.goodsMoney + '</o> + 运费:<o class="on">¥' + this.shippingMoney + '</o></div></div></div></div></div>';
|
||||
});
|
||||
if(data.ect_pay == 0) {
|
||||
html += '<div class="isHb clearfix"><div class="h_left">惠宝抵用 <o id="huibao">可抵用惠宝:' + data.useOrderScore + '</o></div><div class="he_right"><div class="checkout"><div class="check_btn"></div></div></div></div>'
|
||||
}
|
||||
html += '<div class="jf_info clearfix"><div class="jf_jf">积分</div><div class="jf_p">奖励积分为成交价格的20%</div></div>';
|
||||
priceT = (Math.floor((+data.goodsTotalMoney - (+data.promotionMoney))*100))/100;
|
||||
priceT = priceT >= 0 ? priceT : 0;
|
||||
var html1 = '<span>共' + allallnum + '件商品 合计:<j>¥' + priceT + '</j></span> <div class="btn_tj">提交订单</div>';
|
||||
if(data.ect_pay == 1) {
|
||||
var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额:<o class="userECT">' + data.userECT + '</o></p></div>';
|
||||
|
||||
$('.pay_info .con_1').append(htmlpay);
|
||||
// $('.pay_info .con_1 .row').eq(0).attr('style','display: none;');
|
||||
$('.pay_info .con_1 .row').eq(1).remove();
|
||||
};
|
||||
$('.con').html(html);
|
||||
$('.js_r').html(html1);
|
||||
$('#loginName').html(data.loginName);
|
||||
$('.userMoney').html(data.userMoney);
|
||||
|
||||
$('#goodsTotalMoney').html(priceT);
|
||||
} else {
|
||||
alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.con').on('change', 'select', function() {
|
||||
var couponIds = [];
|
||||
$('select').each(function() {
|
||||
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
|
||||
})
|
||||
// var addressId = $('.address').attr('data-addressId')
|
||||
var areaId2 = $('.address').attr('data-areaId2')
|
||||
var couponIdsArr = couponIds.join(',');
|
||||
mui.ajax(hyhUrl('app/carts/getMoney'), {
|
||||
data: {
|
||||
type: type,
|
||||
areaId2: addressId,
|
||||
isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
couponIds: couponIdsArr
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
data = toJson(data);
|
||||
// console.log(data.msg)
|
||||
if(data.status == 1) {
|
||||
|
||||
$('.js_r span j').html('¥' + data.data.realTotalMoney)
|
||||
$('#goodsTotalMoney').html(data.data.realTotalMoney);
|
||||
} else {
|
||||
alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.con').on('tap', '.checkout', function() {
|
||||
|
||||
$(this).toggleClass('on');
|
||||
if($(this).hasClass('on')) {
|
||||
isUseScore = 1;
|
||||
} else {
|
||||
isUseScore = 0;
|
||||
}
|
||||
var couponIds = [];
|
||||
$('select').each(function() {
|
||||
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
|
||||
})
|
||||
|
||||
var couponIdsArr = couponIds.join(',');
|
||||
var areaId2 = $('.address').attr('data-areaId2');
|
||||
// console.log(areaId2)
|
||||
// console.log(couponIdsArr)
|
||||
// console.log(data_1.userAddress.areaId2)
|
||||
// console.log(data_1.userAddress)
|
||||
mui.ajax(hyhUrl('app/carts/getMoney'), {
|
||||
data: {
|
||||
type: type,
|
||||
areaId2: areaId2,
|
||||
isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
couponIds: couponIdsArr
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
data = toJson(data);
|
||||
// console.log(data.msg)
|
||||
if(data.status == 1) {
|
||||
// console.log(data)
|
||||
// console.log(data.data.shopFreight)
|
||||
// for(i in data.data){
|
||||
// console.log(i)
|
||||
// console.log(data.data[i])
|
||||
// }
|
||||
$('.js_r span j').html('¥' + data.data.realTotalMoney)
|
||||
$('#goodsTotalMoney').html(data.data.realTotalMoney);
|
||||
} else {
|
||||
alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.footer').on('tap', '.btn_tj', function() {
|
||||
payCode = $('.select_payway').attr('data-payCode');
|
||||
|
||||
if(payCode == 'ect') {
|
||||
mui.ajax(hyhUrl('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 {
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
if(addressId) {
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
} else {
|
||||
alert('未设置收货地址!')
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
alert(data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
if(addressId) {
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
} else {
|
||||
alert('未设置收货地址!')
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.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').on('tap', '.select_payway', function() {
|
||||
if($(this).attr('data-payCode') == 'ect') {} else {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#pay_way').css('display', 'block');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.pay_btn').on('tap', function() {
|
||||
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
var areaId = $('.address').attr('data-areaId');
|
||||
var that = $(this);
|
||||
payCode = $('.select_payway').attr('data-payCode');
|
||||
var data_send = {
|
||||
type: type,
|
||||
s_addressId: addressId,
|
||||
s_areaId: areaId,
|
||||
payCode: payCode,
|
||||
payType: 1,
|
||||
isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
deliverType: 0,
|
||||
isInvoice: 0,
|
||||
invoiceId: 0,
|
||||
invoiceClient: ''
|
||||
}
|
||||
|
||||
$('.remark').each(function() {
|
||||
data_send['remark_' + ($(this).attr('data-shopid'))] = $(this).val();
|
||||
});
|
||||
$('select').each(function() {
|
||||
data_send['couponId_' + ($(this).attr('data-shopid'))] = $(this).val();
|
||||
})
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/orders/submit'), {
|
||||
data: data_send,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.status)
|
||||
data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
orderNo = data.data;
|
||||
if(payCode == 'wallets' || payCode == 'ect') {
|
||||
//跳输入密码的页面
|
||||
|
||||
mui.ajax(hyhUrl('app/' + payCode + '/payment'), {
|
||||
|
||||
data: {
|
||||
orderNo: data.data,
|
||||
isBatch: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
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', data.data);
|
||||
// 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('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
})
|
||||
})
|
||||
$('#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: 1,
|
||||
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) {
|
||||
// mui.back();
|
||||
mui.openWindow({
|
||||
url: 'indent.html',
|
||||
id: 'indent.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_href: 'waitDeliver'
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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: false, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
setTimeout(function() {
|
||||
plus.webview.getWebviewById('confirmOrder.html').close();
|
||||
}, 500)
|
||||
|
||||
} else {
|
||||
mui.openWindow({
|
||||
url: 'indent.html',
|
||||
id: 'indent.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_href: 'waitPay'
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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: false, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
setTimeout(function() {
|
||||
plus.webview.getWebviewById('confirmOrder.html').close();
|
||||
}, 500)
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user