Commit dab0bd36 authored by gaodapeng's avatar gaodapeng

增加核验代码,fix bugs

parent ec00a0a0
...@@ -69,3 +69,11 @@ export const ACTION_BALANCE_BACK_GOODS = "ACTION_BALANCE_BACK_GOODS"; ...@@ -69,3 +69,11 @@ export const ACTION_BALANCE_BACK_GOODS = "ACTION_BALANCE_BACK_GOODS";
//打印日结订单 //打印日结订单
export const ACTION_DAY_CHECK = "ACTION_DAY_CHECK"; export const ACTION_DAY_CHECK = "ACTION_DAY_CHECK";
//核验
export const ACTION_VERIFY = "ACTION_VERIFY";
//核验成功
export const ACTION_VERIFY_SUCCESS = "ACTION_VERIFY_SUCCESS";
//核验失败
export const ACTION_VERIFY_FAILED = "ACTION_VERIFY_FAILED";
<view class="popUpScanBg" a:if="{{dialogDisplay >= show}}"> <view class="popUpScanBg" hidden="{{dialogDisplay < show}}">
<!-- 灰黑色背景 --> <!-- 灰黑色背景 -->
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;background-color: rgba(0, 0, 0, 0.65);background-size:100% 100%;"/> <view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;background-color: rgba(0, 0, 0, 0.65);background-size:100% 100%;"/>
......
...@@ -82,7 +82,7 @@ Page({ ...@@ -82,7 +82,7 @@ Page({
} }
}); });
var speechContent = totalPrice + "元"; var speechContent = this.data.payPrice + "元";
my.ix.speech({ my.ix.speech({
text: speechContent, text: speechContent,
speak: true, speak: true,
...@@ -98,6 +98,12 @@ Page({ ...@@ -98,6 +98,12 @@ Page({
}, },
onReady() {
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
}
},
onShow() { onShow() {
my.ix.onBuddyMessage({ my.ix.onBuddyMessage({
...@@ -168,6 +174,7 @@ Page({ ...@@ -168,6 +174,7 @@ Page({
this.doPay(this.data.orderNo, res.barCode); this.doPay(this.data.orderNo, res.barCode);
} }
}, fail: (res) => { }, fail: (res) => {
my.hideLoading();
my.showToast({ my.showToast({
type: 'exception', type: 'exception',
content: api.decodeErrorMessage(res.error), content: api.decodeErrorMessage(res.error),
...@@ -232,7 +239,7 @@ Page({ ...@@ -232,7 +239,7 @@ Page({
console.log("支付回调成功,跳转 "); console.log("支付回调成功,跳转 ");
if (res.data.tradeAmount != null) { if (res.data.tradeAmount != null) {
var speechContent = "成功支付" + res.data.tradeAmount + "元"; var speechContent = "成功支付" + payUtils.fen2Yuan(res.data.tradeAmount) + "元";
my.ix.speech({ my.ix.speech({
text: speechContent, text: speechContent,
speak: true, speak: true,
......
...@@ -9,7 +9,8 @@ import { ...@@ -9,7 +9,8 @@ import {
ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON, ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON,
ACTION_GO_HOME, ACTION_REFUND, ACTION_REFUND_FAILED, ACTION_GO_HOME, ACTION_REFUND, ACTION_REFUND_FAILED,
ACTION_REFUND_SUCCESS, ACTION_PRINT_LAST_ORDER, ACTION_REFUND_SUCCESS, ACTION_PRINT_LAST_ORDER,
ACTION_SYSTEM_SETTING,ACTION_DAY_CHECK ACTION_SYSTEM_SETTING, ACTION_VERIFY, ACTION_VERIFY_SUCCESS,
ACTION_VERIFY_FAILED,ACTION_DAY_CHECK,
} from '../../const/actioncmd' } from '../../const/actioncmd'
...@@ -17,7 +18,7 @@ Page({ ...@@ -17,7 +18,7 @@ Page({
data: { data: {
//显示弹窗,>1为显示,2loading 3 result success 4 result failed //显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay: 0, scanDialogDisplay: 0,
dialogShowType: "",//弹窗类型:如refund coupon dialogShowType: "",//弹窗类型:如refund coupon verify
dialogRemindText: "请扫描兑换码", dialogRemindText: "请扫描兑换码",
dialogLoadingText: "识别中", dialogLoadingText: "识别中",
dialogResultSuccessRemind: "兑换码已识别", dialogResultSuccessRemind: "兑换码已识别",
...@@ -38,12 +39,12 @@ Page({ ...@@ -38,12 +39,12 @@ Page({
success: (res) => { success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`); console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if (res.action == ACTION_GO_SCAN) { if (res.action == ACTION_GO_SCAN) {
// if (res.data.printEnabled != null) { if (res.data.printEnabled != null) {
// my.setStorageSync({ my.setStorageSync({
// key: 'printEnabled', key: 'printEnabled',
// data: { enabled: res.data.printEnabled } data: { enabled: res.data.printEnabled }
// }) });
// } }
my.ix.sendBuddyMessage({ my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID // 填入目标小程序的 AppID
...@@ -176,6 +177,25 @@ Page({ ...@@ -176,6 +177,25 @@ Page({
} else if (res.action == ACTION_DAY_CHECK) { } else if (res.action == ACTION_DAY_CHECK) {
//本地先写死数据 //本地先写死数据
context.printDayCheck(); context.printDayCheck();
} else if (res.action == ACTION_VERIFY) {
console.log("核验事件");
//显示弹窗
context.setData({
scanDialogDisplay: 1,
dialogShowType: "verify",
dialogRemindText: "请扫描订单编码核销",
dialogLoadingText: "识别中",
dialogResultSuccessRemind: "核验通过",
dialogResultSuccessText: "核验通过!可以离场",
dialogResultFailureRemind: "核验未通过",
dialogResultFailureText: "核验未通过!无效的核验码",
});
var speechContent = "请扫描订单编码核销";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => { }
});
} }
} }
}); });
...@@ -356,6 +376,8 @@ Page({ ...@@ -356,6 +376,8 @@ Page({
} else if (this.data.dialogShowType == "coupon") { } else if (this.data.dialogShowType == "coupon") {
// 兑换券 // 兑换券
this.verifyCoupon(r); this.verifyCoupon(r);
} else if (this.data.dialogShowType == "verify") {
this.verify(r);
} }
} }
}, },
...@@ -432,6 +454,24 @@ Page({ ...@@ -432,6 +454,24 @@ Page({
}); });
}, },
//同步兑换券到后台
sendConvertCouponToBack(e) {
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_CONVERT_COUPON,
data: e
},
success: (sres) => {
},
fail: (fres) => {
sendConvertCouponToBack(e)
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
},
//退款 //退款
...@@ -500,23 +540,38 @@ Page({ ...@@ -500,23 +540,38 @@ Page({
}, },
//同步兑换券到后台 //核验
sendConvertCouponToBack(e) { verify(result) {
//目前缺少核验的接口,数据都是自造
var speechContent = "核验通过";
my.ix.speech({
text: speechContent,
speak: true,
success: (r) => { }
});
this.setData({ scanDialogDisplay: 3 })
this.onVerifyCallback(ACTION_VERIFY_SUCCESS, null);
},
onVerifyCallback(action, result) {
my.ix.sendBuddyMessage({ my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID // 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId, target: getApp().globalData.backScreenAppId,
data: { data: {
action: ACTION_CONVERT_COUPON, action: action,
data: e data: result
}, },
success: (sres) => { success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
//跳转到扫码页面
}, },
fail: (fres) => { fail: (res) => {
sendConvertCouponToBack(e)
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
} }
}); });
} },
......
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