Commit 4996a488 authored by gaodapeng's avatar gaodapeng

fix bugs

parent da16d384
......@@ -13,7 +13,6 @@ Page({
qrPayShow: false,
list: [],
orderNo: "",
isCashierClosed: false,
isPaying: false,
},
onLoad(options) {
......@@ -54,7 +53,13 @@ Page({
}
});
var speechContent = totalPrice + "元 请刷脸或扫码支付";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => {
}
});
},
......@@ -125,7 +130,6 @@ Page({
if (res.codeType == "F") {
this.doPay(this.data.orderNo, res.barCode);
} else {
this.data.isCashierClosed = true;
this.doPay(this.data.orderNo, res.barCode);
}
}, fail: (res) => {
......@@ -142,7 +146,6 @@ Page({
if (res.bizType == 'RESULT_CLOSED' || res.status == "RESULT_CLOSE") {
console.log("收银台关闭");
this.data.isCashierClosed = true;
//关闭监听
my.ix.offCashierEventReceive();
if (this.data.isPaying == true) {
......@@ -192,7 +195,17 @@ Page({
if (res.resultCode == 1) {
//成功
console.log("支付回调成功,跳转 ");
// if(data.isCashierClosed == true){
if (res.data.tradeAmount != null) {
var speechContent = "成功支付" + res.data.tradeAmount + "元";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => {
}
});
}
my.ix.offCashierEventReceive();
this.saveData(this.data.list, res.data);
my.redirectTo({
......@@ -214,7 +227,6 @@ Page({
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
// }
} else {
console.log("支付回调失败,toast提示 ");
my.ix.offCashierEventReceive();
......
......@@ -104,8 +104,16 @@ Page({
dialogResultSuccessText: "恭喜您!兑换成功",
dialogResultFailureRemind: "兑换码未识别",
dialogResultFailureText: "兑换失败,请稍后重试!",
})
});
if (res.data != 0) {
var speechContent = "请扫描兑换码";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => {
}
});
}
} else if (res.action == ACTION_REFUND) {
//显示弹窗
context.setData({
......@@ -119,7 +127,12 @@ Page({
dialogResultFailureText: "退款失败!无效的订单码",
});
console.log("ACTION_REFUND");
var speechContent = "请扫描订单编码";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => { }
});
} else if (res.action == ACTION_GO_HOME) {
//home界面收到,则返回界面上
context.setData({
......@@ -269,13 +282,22 @@ Page({
//核销券
verifyCoupon(code) {
//语音提示已识别
var speechContent = "兑换码已识别";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => {
}
});
this.setData({ scanDialogDisplay: 2 })
var commonRequest = {};
commonRequest.state = 2
this.sendConvertCouponToBack(commonRequest)
var couponRequest = api.createCommonRequest();
couponRequest.couponCode = code;
console.log("核销券的请求 ==>" + JSON.stringify(couponRequest));
console.log("兑换码的请求 ==>" + JSON.stringify(couponRequest));
let context = this;
my.request({
url: getApp().globalData.BASE_URL + API_USE_COUPON,
......@@ -284,20 +306,20 @@ Page({
timeout: 30000,
data: couponRequest,
success: (res) => {
console.log("核销券成功 ==>" + JSON.stringify(res));
console.log("兑换成功 ==>" + JSON.stringify(res));
if (res.data.success != true) {
var commonRequest = {};
commonRequest.state = 4
commonRequest.msg = res.data.errorMsg
context.sendConvertCouponToBack(commonRequest)
this.setData({ scanDialogDisplay: 4 })
console.log("核销券失败 ==>" + res.data.errorMsg);
console.log("兑换失败 ==>" + res.data.errorMsg);
} else {
var commonRequest = {};
commonRequest.state = 3
context.sendConvertCouponToBack(commonRequest)
this.setData({ scanDialogDisplay: 3 })
console.log("核销券成功 ==>" + JSON.stringify(res));
console.log("兑换成功 ==>" + JSON.stringify(res));
}
},
fail: (res) => {
......@@ -306,7 +328,7 @@ Page({
commonRequest.msg = "网络异常"
context.sendConvertCouponToBack(commonRequest)
this.setData({ scanDialogDisplay: 4 })
console.log("核销券失败 ==>" + JSON.stringify(res));
console.log("兑换失败 ==>" + JSON.stringify(res));
my.showToast({
type: 'exception',
content: api.decodeErrorMessage(res.error),
......@@ -320,6 +342,7 @@ Page({
//退款
refund(barcode) {
this.setData({ scanDialogDisplay: 2 })
var request = api.createCommonRequest();
request.tradeNo = barcode;
......@@ -340,6 +363,13 @@ Page({
}
this.refundCallback(ACTION_REFUND_FAILED, message);
} else {
var speechContent = "退款成功";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => { }
});
this.setData({ scanDialogDisplay: 3 })
console.log("退款成功 ==>" + JSON.stringify(res.data));
this.refundCallback(ACTION_REFUND_SUCCESS, res.data.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