Commit fdc651fe authored by jiangjiantao's avatar jiangjiantao

merge fixed

parents 4067b2f2 dab0bd36
...@@ -69,3 +69,13 @@ export const ACTION_BALANCE_BACK_GOODS = "ACTION_BALANCE_BACK_GOODS"; ...@@ -69,3 +69,13 @@ export const ACTION_BALANCE_BACK_GOODS = "ACTION_BALANCE_BACK_GOODS";
//提货 //提货
export const ACTION_PICK_UP_GOODS = "ACTION_PICK_UP_GOODS"; export const ACTION_PICK_UP_GOODS = "ACTION_PICK_UP_GOODS";
//打印日结订单
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%;"/>
......
...@@ -18,7 +18,9 @@ Page({ ...@@ -18,7 +18,9 @@ Page({
}, },
//回退到上一个页面 //回退到上一个页面
events: {
onBack(e) { onBack(e) {
console.log('onBack触发');
my.ix.sendBuddyMessage({ my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID // 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId, target: getApp().globalData.backScreenAppId,
...@@ -33,8 +35,10 @@ Page({ ...@@ -33,8 +35,10 @@ Page({
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`); console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
} }
}); });
}
}, },
onReady() { onReady() {
if (my.canIUse('hideBackHome')) { if (my.canIUse('hideBackHome')) {
my.hideBackHome(); my.hideBackHome();
...@@ -78,7 +82,7 @@ Page({ ...@@ -78,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,
...@@ -94,6 +98,12 @@ Page({ ...@@ -94,6 +98,12 @@ Page({
}, },
onReady() {
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
}
},
onShow() { onShow() {
my.ix.onBuddyMessage({ my.ix.onBuddyMessage({
...@@ -164,6 +174,7 @@ Page({ ...@@ -164,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),
...@@ -228,7 +239,7 @@ Page({ ...@@ -228,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_PICK_UP_GOODS ACTION_SYSTEM_SETTING, ACTION_VERIFY, ACTION_VERIFY_SUCCESS,
ACTION_VERIFY_FAILED,ACTION_DAY_CHECK,ACTION_PICK_UP_GOODS
} 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 pickgoods dialogShowType: "",//弹窗类型:如refund coupon verify pickgoods
dialogRemindText: "请扫描兑换码", dialogRemindText: "请扫描兑换码",
dialogLoadingText: "识别中", dialogLoadingText: "识别中",
dialogResultSuccessRemind: "兑换码已识别", dialogResultSuccessRemind: "兑换码已识别",
...@@ -52,12 +53,12 @@ Page({ ...@@ -52,12 +53,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
...@@ -216,6 +217,28 @@ Page({ ...@@ -216,6 +217,28 @@ Page({
pickGoods:[] pickGoods:[]
}) })
} }
} else if (res.action == ACTION_DAY_CHECK) {
//本地先写死数据
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) => { }
});
} }
} }
}); });
...@@ -242,6 +265,50 @@ Page({ ...@@ -242,6 +265,50 @@ Page({
} }
}, },
/**
* 打印
*/
printDayCheck() {
var printer = require("../../utils/printer.js");
var cmds = [
printer.setAlign(printer.ALIGN_CENTER),
printer.printText('日结订单'),
printer.printText(getApp().globalData.localAccountInfo.storeName),
printer.setAlign(printer.ALIGN_LEFT),
//打印日期
printer.printNowDate(),
//门店号
printer.printText("门店号:"+getApp().globalData.localAccountInfo.storeName),
//收款总额
printer.printText('收款总额:10.00元'),
printer.feedPaper(),
printer.feedPaper(),
printer.feedPaper(),
printer.feedPaper(),
];
printer.print({
isCheckStatus: getApp().globalData.containerVersionCode > 20,
cmds: cmds,
callback: (res) => {
//发送给后屏,告知打印结果
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_DAY_CHECK,
data: res
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
}
});
},
/**返回当前选中广告 */ /**返回当前选中广告 */
returnCurShowAd() { returnCurShowAd() {
let context = this; let context = this;
...@@ -355,6 +422,8 @@ Page({ ...@@ -355,6 +422,8 @@ Page({
}else if (this.data.dialogShowType == "pickgoods") { }else if (this.data.dialogShowType == "pickgoods") {
// 提货 // 提货
this.pickGoods(r); this.pickGoods(r);
} else if (this.data.dialogShowType == "verify") {
this.verify(r);
} }
} }
}, },
...@@ -431,6 +500,24 @@ Page({ ...@@ -431,6 +500,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)}`);
}
});
},
//退款 //退款
...@@ -499,24 +586,40 @@ Page({ ...@@ -499,24 +586,40 @@ 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)}`);
} }
}); });
}, },
//提货商品 //提货商品
pickGoods(code) { pickGoods(code) {
let context = this; let context = this;
......
...@@ -43,11 +43,11 @@ Page({ ...@@ -43,11 +43,11 @@ Page({
console.log("localLoginInfo==>" + JSON.stringify(localLoginInfo)); console.log("localLoginInfo==>" + JSON.stringify(localLoginInfo));
if (localLoginInfo.success != false && localLoginInfo.data != null) { if (localLoginInfo.success != false && localLoginInfo.data != null) {
//赋值 //赋值
// this.setData({ this.setData({
// name: localLoginInfo.data.name, name: localLoginInfo.data.name,
// password: localLoginInfo.data.password, password: localLoginInfo.data.password,
// sn: localLoginInfo.data.sn sn: localLoginInfo.data.sn
// }) })
} }
}, },
onNameClear() { onNameClear() {
......
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