kira 6 years ago
parent 8eb861edf3
commit d416b2265f

@ -62,11 +62,9 @@ $(function () {
var checked = $(this).is('.checked');
if (checked) {
dataCache.coupons.push(couponId);
updatePrice();
} else {
var idx = dataCache.coupons.indexOf(couponId);
dataCache.coupons.splice(idx, 1);
updatePrice();
}
});
@ -89,29 +87,6 @@ $(function () {
return price;
}
function updatePrice() {
$('#audVal').html(dataCache.price);
var realPrice = dataCache.price;
$('#audValReal').html(realPrice);
var surchargeData = calculateSurcharge(realPrice);
var price = surchargeData.newPrice || realPrice;
var priceBeforeDiscount = price;
dataCache.discounts = [];
dataCache.tax = surchargeData.tax;
dataCache.surcharge = surchargeData.surcharge;
$(window.coupons).each(function () {
price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons);
});
dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2,Decimal.ROUND_HALF_UP);
dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR);
var rate = 'CNY' == window.currency ? 1 : exchangeRate;
var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP);
$('#cnyVal').html(cnyVal);
dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount;
}
function updatePoundageStatus() {
$(window.coupons).each(function () {
var coupon = this;
@ -142,7 +117,6 @@ $(function () {
if (dataCache.price.length == 0) {
dataCache.price = '0';
}
updatePrice();
updatePoundageStatus();
}
@ -159,7 +133,6 @@ $(function () {
dataCache.price = '';
}
dataCache.price += char;
updatePrice();
updatePoundageStatus();
}
}
@ -257,6 +230,9 @@ $(function () {
data.qrcodeVersion = window.qrcodeVersion;
dataCache.remark = '';
window.RPayPlus.send("showLoading", null, null);
$.ajax({
url: '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders',
method: 'POST',
@ -264,7 +240,8 @@ $(function () {
contentType: 'application/json',
dataType: 'json',
success: function (resp) {
pay(resp);
window.RPayPlus.send("closeLoading", null, null);
// pay(resp);
if (resp.direct_paid) {
location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result';
return;
@ -308,6 +285,7 @@ $(function () {
// }
},
error: function (jqXhr) {
window.RPayPlus.send("closeLoading", null, null);
weuiAlert(jqXhr.responseJSON.message);
$('#key_P').removeClass('hidden');
$('#key_Loading').addClass('hidden');
@ -412,9 +390,8 @@ $(function () {
}
function getUserId(){
/* function getUserId(){
window.RPayPlus.send("getUserId", null, function(data){
alert(data);
});
}
@ -425,9 +402,7 @@ $(function () {
mch_order_id:param.mch_order_id
};
alert("rpay_order_info: nonce_str:"+param.nonce_str+"rpay_order_id:"+param.rpay_order_id+"mch_order_id:"+param.mch_order_id);
window.RPayPlus.send('pay', order, function(data){
alert('this is callback from native and data='+JSON.stringify(data));
});
window.RPayPlus.send('pay', order, null);
}
function back(){
@ -461,5 +436,5 @@ $(function () {
queryOrder(data);
});
}
getUserId();
getUserId();*/
});
Loading…
Cancel
Save