Commit dd25744f authored by gaodapeng's avatar gaodapeng

修改支付内容

parent 137c5dcb
......@@ -45,7 +45,7 @@ Page({
payUtils.getOrder(/*this.data.payPrice*/1,this.data.list, function(res){
if(res != null){
console.log("callback调用,res="+JSON.stringify(res));
console.log("callback调用,res=" + JSON.stringify(res));
if(res.resultCode ==1){
this.setData({
orderNo:res.data
......@@ -57,43 +57,10 @@ Page({
}.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{
console.info("收银台版本" + my.ix.getVersionSync({
packageName: 'zoloz.phone.android.alipay.com.dragonfly'
......@@ -107,10 +74,10 @@ Page({
success: (res) => {
console.log("收银台启动回调 success==>" + JSON.stringify(res));
if (res.codeType == "F") {
this.doPay(orderNo, res.barCode);
this.doPay(this.data.orderNo, res.barCode);
} else {
this.data.isCashierClosed = true;
this.doPay(orderNo, res.barCode);
this.doPay(this.data.orderNo, res.barCode);
}
},fail:(res) => {
my.showToast({
......@@ -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){
data: payRequest,
success: (res) => {
//增加数据判断,增加重试
if (res == null|| res.data == null|| res.data.success != true||res.data.data == null) {
console.log("支付未成功 ==>" + res.data.message);
console.log("支付接口回调 ==>" + JSON.stringify(res));
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);
} else {
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