Merge branch 'develop'

master
wangning 7 years ago
commit 1391d556b9

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -0,0 +1,79 @@
/**
* Created by yixian on 2016-07-15.
*/
$(document).ready(function () {
'use strict';
decode();
function decode() {
var redirect = window.redirect;
while(redirect.indexOf('://')<0){
redirect = decodeURIComponent(redirect);
if(redirect==window.redirect){
break;
}
window.redirect = redirect;
}
}
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
function startPay() {
$('#wdiv').show();
if (dataCache.paying) {
return;
}
dataCache.paying = true;
$.ajax({
url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params',
method: 'GET',
dataType: 'json',
success: function (pay) {
if (pay.direct_paid) {
location.href = window.redirect;
return;
}
if (window.AlipayJSBridge) {
callPayment();
} else {
// 如果没有注入则监听注入的事件
document.addEventListener('AlipayJSBridgeReady', callPayment, false);
}
function callPayment() {
try {
AlipayJSBridge.call('tradePay', {
tradeNO: pay.trade_no
}, function (res) {
dataCache.paying = false;
if (res.resultCode == '9000') {
AlipayJSBridge.call('startApp', {
appId: '20000056',
param: {
actionType: 'showSuccPage',
payResult: res.result
},
closeCurrentApp: false
});
location.href = window.redirect;
} else {
alert(res.memo);
}
$('#wdiv').hide();
})
} catch (err) {
alert(err);
$('#wdiv').hide();
}
}
},
error: function (jqXhr) {
alert(jqXhr.responseJSON.message);
$('#wdiv').hide();
dataCache.paying = false;
}
})
}
});

@ -0,0 +1,120 @@
.weui_cell_ft {
max-width: 60%;
white-space: normal
}
.pay-container{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.pay-container>img{
display: block;
margin: auto;
width: 250px;
}
div,span,img,button,a,p{
box-sizing: border-box;
}
body{
background: #fff;
}
.royal-container{
margin-top: 20%;
display: block;
width: 100%;
padding: 10px 30px;
}
.royal-container .royal-row{
border-bottom: 1px solid #d1d2d4;
padding: 5px 0;
}
.royal-container .royal-row.brand{
text-align: center;
}
.royal-container .royal-row.brand img{
display: block;
max-width: 60%;
max-height: 100px;
margin: auto;
}
.royal-container .royal-row.brand .name{
display: block;
margin: auto;
font-size: 1.6em;
}
.text-title{
color: #888888;
font-size: 0.9em;
}
.text-main{
color: #333333;
font-size: 1.1em;
}
.royal-pay-btn{
background: #30af69;
color: #fff;
width: 96%;
display: block;
margin: 10px auto 30px;
height: 50px;
line-height: 50px;
font-size: 1.4em;
text-align: center;
}
.alipay .royal-pay-btn{
background: #108ee9;
}
.alipay .amount_title{
background: #108ee9;
}
.amount_title{
height: 14%;
z-index: 10;
background: #30af69;
max-height: 200px;
min-height: 120px;
width: 100%;
}
.amount_title_logo{
float: left;
max-width: 90px;
min-width: 80px;
margin-left: 10px;
}
.amount_title_content{
float: left;
}
.amount_title_content_amount{
font-family: Avenir-Roman;
font-size: 30px;
color: #FFFFFF;
}
.amount_title_content_text{
font-family: PingFangSC-Regular;
font-size: 17px;
color: #FFFFFF;
}
.merchant_info{
height: 15%;
z-index: 1;
position: absolute;
width: 94%;
margin: -5% 0% 0px 3%;
text-align: center;
background-color: #FFFFFF;
box-shadow: 0px 0px 8px 0px rgba(171,171,171,0.50);
}
.merchant_info img{
max-height: 70px;
min-height: 50px;
}

@ -0,0 +1,106 @@
$(document).ready(function () {
'use strict';
decode();
function decode() {
var redirect = window.redirect;
while (redirect.indexOf('://') < 0) {
redirect = decodeURIComponent(redirect);
if (redirect == window.redirect) {
break;
}
window.redirect = redirect;
}
}
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
function startPay() {
$('#wdiv').show();
if (dataCache.paying) {
return;
}
dataCache.paying = true;
$.ajax({
url: '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + window.order_id + '/preorder',
method: 'get',
dataType: 'json',
success: function (pay) {
try {
if (pay.direct_paid) {
dataCache.paying = false;
location.href = window.redirect;
}
var paydata = pay.jsapi;
invokePay(paydata);
}catch (e) {
alert("Unexpected Error:" + e);
$('#wdiv').hide();
dataCache.paying = false;
}
},
error: function (jqXhr) {
var respText = jqXhr.responseText;
try {
alert(JSON.parse(respText).message);
$('#wdiv').hide();
dataCache.paying = false;
} catch (e) {
alert("Unexpected Error:" + respText);
$('#wdiv').hide();
dataCache.paying = false;
}
}
});
}
function invokePay(paydata) {
WeixinJSBridge.invoke('getBrandWCPayRequest', {
'appId': paydata.appId,
'timeStamp': paydata.timeStamp,
'nonceStr': paydata.nonceStr,
'package': paydata.package,
'signType': paydata.signType,
'paySign': paydata.paySign
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
startCheckOrder(window.order_id)
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
alert('WeChat Error:' + res.err_msg);
}
if (window.paydata) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=false';
}
}
//todo get status from server
$('#wdiv').hide();
})
}
function startCheckOrder(orderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
});
Loading…
Cancel
Save