Commit dd1a96a7 authored by pengguangpu's avatar pengguangpu

打印上一单逻辑完善;

parent d006f2dc
...@@ -16,8 +16,10 @@ import { ACTION_LOGIN_OK } from '../../const/actioncmd' ...@@ -16,8 +16,10 @@ import { ACTION_LOGIN_OK } from '../../const/actioncmd'
import { ACTION_REFUND } from '../../const/actioncmd' import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd' import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd' import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { ACTION_PRINT_LAST_ORDER } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND } from '../../const/actioncmd' import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND } from '../../const/actioncmd'
Page({ Page({
data: { data: {
//页面控制相关参数 //页面控制相关参数
...@@ -72,7 +74,7 @@ Page({ ...@@ -72,7 +74,7 @@ Page({
printLastOrderPrintStatusHint: "正在打印上一单...", printLastOrderPrintStatusHint: "正在打印上一单...",
//是否打印成功 //是否打印成功
printLastOrderIsPrintSuccess: false, printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting:true printLastOrderIsPrinting: true
}, },
/**跳转页面方法 */ /**跳转页面方法 */
...@@ -83,7 +85,7 @@ Page({ ...@@ -83,7 +85,7 @@ Page({
"waitoperate": false, "waitoperate": false,
"payresult": false, "payresult": false,
"operateResult": false, "operateResult": false,
"printlastorder":false "printlastorder": false
}; };
//遍历pageShow //遍历pageShow
for (var key in pageShowTemp) { for (var key in pageShowTemp) {
...@@ -210,6 +212,26 @@ Page({ ...@@ -210,6 +212,26 @@ Page({
isPaySuccess: false, isPaySuccess: false,
}); });
context.goPage('operateResult'); context.goPage('operateResult');
} else if (res.action == ACTION_PRINT_LAST_ORDER && context.data.pageShow['printlastorder'] == true) {
//打印上一单结果返回
//获取到打印结果
var printLastOrderResult = res.data;
this.setData({
printLastOrderIsPrinting: false
});
if (printLastOrderResult.code == 0) {
//打印成功
this.setData({
printLastOrderIsPrintSuccess: true,
printLastOrderPrintStatusHint:"打印完成"
});
} else {
//打印失败
this.setData({
printLastOrderIsPrintSuccess: false,
printLastOrderPrintStatusHint:"打印失败"
});
}
} }
} }
...@@ -296,6 +318,22 @@ Page({ ...@@ -296,6 +318,22 @@ Page({
* 打印上一单 * 打印上一单
*/ */
onHomePrintLastOrderClicked() { onHomePrintLastOrderClicked() {
//发送指令至前屏
//通知前屏重新打印
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.frontScreenAppId,
data: {
action: ACTION_PRINT_LAST_ORDER,
data: null
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
//跳转至打印上一单页面 //跳转至打印上一单页面
this.goPage('printlastorder'); this.goPage('printlastorder');
}, },
...@@ -695,12 +733,39 @@ Page({ ...@@ -695,12 +733,39 @@ Page({
/** /**
* 打印上一单页面 * 打印上一单页面
*/ */
onPrintLastOrderCancelClicked() { }, onPrintLastOrderCancelClicked() {
//回首页
this.setData({
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting: true,
printLastOrderPrintStatusHint: "正在打印上一单"
});
this.goPage('home');
},
onPrintLastOrderConfirmClicked() { }, onPrintLastOrderConfirmClicked() {
//回首页
this.setData({
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting: true,
printLastOrderPrintStatusHint: "正在打印上一单"
});
this.goPage('home');
},
onPrintLastOrderRePrintClicked() { }, onPrintLastOrderRePrintClicked() {
//发送重新打印指令
onPrintLastOrderBackClicked(){} },
onPrintLastOrderBackClicked() {
//回首页
this.setData({
printLastOrderIsPrintSuccess: false,
printLastOrderIsPrinting: true,
printLastOrderPrintStatusHint: "正在打印上一单"
});
this.goPage('home');
}
}); });
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