Commit 4996a488 authored by gaodapeng's avatar gaodapeng

fix bugs

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