Commit c9bda32d authored by pengguangpu's avatar pengguangpu

添加前后屏指令交互常量js文件;支付成功页添加指令传递&接收逻辑;

parent 3f0efb0d
//发送打印结果
export const ACTION_PRINT_RESULT = "ACTION_PRINT_RESULT";
//发送重打印指令
export const ACTION_REPRINT = "ACTION_REPRINT";
\ No newline at end of file
import { ACTION_PRINT_RESULT } from '../../const/actioncmd'
import { ACTION_REPRINT } from '../../const/actioncmd'
Page({
data: {
orderPriceYuan: "--.--",
......@@ -67,7 +70,7 @@ Page({
//循环取出商品数据
cmds.push(printer.setAlign(printer.ALIGN_LEFT));
cmds.push(printer.printText(this.data.goodsList[i].name));
cmds.push(printer.printTwoText(this.data.goodsList[i].barcode,this.data.goodsList[i].quantity+""));
cmds.push(printer.printTwoText(this.data.goodsList[i].barcode, this.data.goodsList[i].quantity + ""));
}
cmds.push(printer.setAlign(printer.ALIGN_LEFT));
cmds.push(printer.printDivide("-"));
......@@ -87,9 +90,12 @@ Page({
printCallback(res) {
//通知后屏打印结果
my.ix.sendBuddyMessage({
target: "****************",
// 填入目标小程序的 AppID
data: res,
target: "****************",
data: {
action: ACTION_PRINT_RESULT,
data: res
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
......@@ -118,9 +124,9 @@ Page({
my.ix.onBuddyMessage({
success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if ("") {
if (res.action == ACTION_REPRINT) {
//重新打印
this.print();
} else {
//未知指令
}
......
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