Commit fdc651fe authored by jiangjiantao's avatar jiangjiantao

merge fixed

parents 4067b2f2 dab0bd36
......@@ -9,4 +9,4 @@
"window": {
"defaultTitle": ""
}
}
}
\ No newline at end of file
......@@ -68,4 +68,14 @@ export const ACTION_SYSTEM_SETTING = "ACTION_SYSTEM_SETTING";
export const ACTION_BALANCE_BACK_GOODS = "ACTION_BALANCE_BACK_GOODS";
//提货
export const ACTION_PICK_UP_GOODS = "ACTION_PICK_UP_GOODS";
\ No newline at end of file
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%;"/>
......
......@@ -18,23 +18,27 @@ Page({
},
//回退到上一个页面
onBack(e) {
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_BALANCE_BACK_GOODS,
data: null
},
success: (res) => {
e.preventDefault();
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
events: {
onBack(e) {
console.log('onBack触发');
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_BALANCE_BACK_GOODS,
data: null
},
success: (res) => {
e.preventDefault();
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
}
},
onReady() {
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
......@@ -78,7 +82,7 @@ Page({
}
});
var speechContent = totalPrice + "元";
var speechContent = this.data.payPrice + "元";
my.ix.speech({
text: speechContent,
speak: true,
......@@ -94,6 +98,12 @@ Page({
},
onReady() {
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
}
},
onShow() {
my.ix.onBuddyMessage({
......@@ -164,6 +174,7 @@ Page({
this.doPay(this.data.orderNo, res.barCode);
}
}, fail: (res) => {
my.hideLoading();
my.showToast({
type: 'exception',
content: api.decodeErrorMessage(res.error),
......@@ -228,7 +239,7 @@ Page({
console.log("支付回调成功,跳转 ");
if (res.data.tradeAmount != null) {
var speechContent = "成功支付" + res.data.tradeAmount + "元";
var speechContent = "成功支付" + payUtils.fen2Yuan(res.data.tradeAmount) + "元";
my.ix.speech({
text: speechContent,
speak: true,
......
......@@ -9,7 +9,8 @@ import {
ACTION_DIRECT_PAYMENT, ACTION_CONVERT_COUPON,
ACTION_GO_HOME, ACTION_REFUND, ACTION_REFUND_FAILED,
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'
......@@ -17,7 +18,7 @@ Page({
data: {
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay: 0,
dialogShowType: "",//弹窗类型:如refund coupon pickgoods
dialogShowType: "",//弹窗类型:如refund coupon verify pickgoods
dialogRemindText: "请扫描兑换码",
dialogLoadingText: "识别中",
dialogResultSuccessRemind: "兑换码已识别",
......@@ -52,12 +53,12 @@ Page({
success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if (res.action == ACTION_GO_SCAN) {
// if (res.data.printEnabled != null) {
// my.setStorageSync({
// key: 'printEnabled',
// data: { enabled: res.data.printEnabled }
// })
// }
if (res.data.printEnabled != null) {
my.setStorageSync({
key: 'printEnabled',
data: { enabled: res.data.printEnabled }
});
}
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
......@@ -216,6 +217,28 @@ Page({
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({
}
},
/**
* 打印
*/
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() {
let context = this;
......@@ -355,6 +422,8 @@ Page({
}else if (this.data.dialogShowType == "pickgoods") {
// 提货
this.pickGoods(r);
} else if (this.data.dialogShowType == "verify") {
this.verify(r);
}
}
},
......@@ -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({
},
//同步兑换券到后台
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({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_CONVERT_COUPON,
data: e
action: action,
data: result
},
success: (sres) => {
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
//跳转到扫码页面
},
fail: (fres) => {
sendConvertCouponToBack(e)
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
},
//提货商品
pickGoods(code) {
let context = this;
......
......@@ -43,11 +43,11 @@ Page({
console.log("localLoginInfo==>" + JSON.stringify(localLoginInfo));
if (localLoginInfo.success != false && localLoginInfo.data != null) {
//赋值
// this.setData({
// name: localLoginInfo.data.name,
// password: localLoginInfo.data.password,
// sn: localLoginInfo.data.sn
// })
this.setData({
name: localLoginInfo.data.name,
password: localLoginInfo.data.password,
sn: localLoginInfo.data.sn
})
}
},
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