Commit dd25744f authored by gaodapeng's avatar gaodapeng

修改支付内容

parent 137c5dcb
...@@ -45,7 +45,7 @@ Page({ ...@@ -45,7 +45,7 @@ Page({
payUtils.getOrder(/*this.data.payPrice*/1,this.data.list, function(res){ payUtils.getOrder(/*this.data.payPrice*/1,this.data.list, function(res){
if(res != null){ if(res != null){
console.log("callback调用,res="+JSON.stringify(res)); console.log("callback调用,res=" + JSON.stringify(res));
if(res.resultCode ==1){ if(res.resultCode ==1){
this.setData({ this.setData({
orderNo:res.data orderNo:res.data
...@@ -57,43 +57,10 @@ Page({ ...@@ -57,43 +57,10 @@ Page({
}.bind(this)); }.bind(this));
}, },
//调用收款接口
doPay(orderNo, payCode) {
console.log("doPay调用");
this.setData({isPaying:true});
//使用barCode来当面付
payUtils.startPay(orderNo, payCode, 1, this.data.list, function(res){
my.hideLoading();
console.log("支付回调 ===>" + JSON.stringify(res));
this.setData({isPaying:false});
if(res == null){
return;
}
if(res.code > 0){
//成功
console.log("支付回调成功,跳转 " );
// if(data.isCashierClosed == true){
my.ix.offCashierEventReceive();
my.redirectTo({
url: '/pages/paysuccess/paysuccess?orderPrice=' + this.data.totalPrice + "&couponPrice=" + this.data.couponPrice + "&payPrice=" + this.data.payPrice+"&totalCount="+this.data.totalCount,
});
// }
}else{
console.log("支付回调失败,toast提示 ");
my.ix.offCashierEventReceive();
my.showToast({
type: 'fail',
content: res.data,
duration: 2000
});
}
}.bind(this));
},
/** /**
* 打开收银台,进行扫码收款 * 打开收银台,进行扫码收款
*/ */
payWithOpenCashier(orderNo){ payWithOpenCashier(){
try{ try{
console.info("收银台版本" + my.ix.getVersionSync({ console.info("收银台版本" + my.ix.getVersionSync({
packageName: 'zoloz.phone.android.alipay.com.dragonfly' packageName: 'zoloz.phone.android.alipay.com.dragonfly'
...@@ -107,10 +74,10 @@ Page({ ...@@ -107,10 +74,10 @@ Page({
success: (res) => { success: (res) => {
console.log("收银台启动回调 success==>" + JSON.stringify(res)); console.log("收银台启动回调 success==>" + JSON.stringify(res));
if (res.codeType == "F") { if (res.codeType == "F") {
this.doPay(orderNo, res.barCode); this.doPay(this.data.orderNo, res.barCode);
} else { } else {
this.data.isCashierClosed = true; this.data.isCashierClosed = true;
this.doPay(orderNo, res.barCode); this.doPay(this.data.orderNo, res.barCode);
} }
},fail:(res) => { },fail:(res) => {
my.showToast({ my.showToast({
...@@ -159,4 +126,39 @@ Page({ ...@@ -159,4 +126,39 @@ Page({
}, },
//调用收款接口
doPay(orderNo, payCode) {
console.log("doPay调用");
this.setData({isPaying:true});
//使用barCode来当面付
payUtils.startPay(orderNo, payCode, 1, this.data.list, function(res){
my.hideLoading();
console.log("支付回调 ===>" + JSON.stringify(res));
this.setData({isPaying:false});
if(res == null){
return;
}
if(res.code > 0){
//成功
console.log("支付回调成功,跳转 " );
// if(data.isCashierClosed == true){
my.ix.offCashierEventReceive();
my.redirectTo({
url: '/pages/paysuccess/paysuccess?orderPrice=' + this.data.totalPrice + "&couponPrice=" + this.data.couponPrice + "&payPrice=" + this.data.payPrice+"&totalCount="+this.data.totalCount,
});
// }
}else{
console.log("支付回调失败,toast提示 ");
my.ix.offCashierEventReceive();
my.showToast({
type: 'fail',
content: res.data,
duration: 2000
});
}
}.bind(this));
},
}); });
...@@ -193,8 +193,9 @@ function pay(tradeNo, payCode, payPrice, list, callback, retryCount){ ...@@ -193,8 +193,9 @@ function pay(tradeNo, payCode, payPrice, list, callback, retryCount){
data: payRequest, data: payRequest,
success: (res) => { success: (res) => {
//增加数据判断,增加重试 //增加数据判断,增加重试
if (res == null|| res.data == null|| res.data.success != true||res.data.data == null) { console.log("支付接口回调 ==>" + JSON.stringify(res));
console.log("支付未成功 ==>" + res.data.message); if (res == null|| res.data == null|| res.data.success != true/*||res.data.data == null*/) {
console.log("支付未成功 ==>" + JSON.stringify(res.data.message));
retryOrFailed(tradeNo, payCode, payPrice, list, callback, retryCount); retryOrFailed(tradeNo, payCode, payPrice, list, callback, retryCount);
} else { } else {
console.log("支付返回值 ==>" + JSON.stringify(res.data)); console.log("支付返回值 ==>" + JSON.stringify(res.data));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment