147 lines
4.0 KiB
Dart
147 lines
4.0 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
part 'sub_screen_models.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class SubScreenProductEvent {
|
|
// 购物车列表
|
|
// List<ShopCardEntity>
|
|
List<Map<String, dynamic>> shopList;
|
|
|
|
// 系统类型
|
|
SysType sysType;
|
|
|
|
// 支付用户
|
|
// ServiceUser
|
|
Map<String, dynamic>? payUser;
|
|
|
|
// 购物车总价
|
|
int totalPrice;
|
|
|
|
// 额外支付
|
|
int amountMealPrice;
|
|
|
|
SubScreenProductEvent({
|
|
required this.shopList,
|
|
required this.sysType,
|
|
required this.payUser,
|
|
required this.totalPrice,
|
|
required this.amountMealPrice,
|
|
});
|
|
|
|
factory SubScreenProductEvent.fromJson(Map<String, dynamic> json) =>
|
|
_$SubScreenProductEventFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$SubScreenProductEventToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class SubScreenQrCodeScanEvent {
|
|
/// 支付消息业务动作,聚合码固定为 `aggregateOrderPay`。
|
|
String action;
|
|
|
|
/// Hardware 业务订单 ID,仅用于副屏消息去重和诊断。
|
|
String orderId;
|
|
|
|
/// 副屏需要渲染的二维码内容,不得写入业务日志。
|
|
String qrCodeData;
|
|
|
|
/// 聚合会话编号;旧自有钱包二维码消息允许为空。
|
|
String? aggregateNo;
|
|
|
|
/// 二维码协议类型;聚合码固定为 `AGGREGATE_ORDER_PAY`。
|
|
String? qrCodeType;
|
|
|
|
/// 服务端二维码过期时间,用于副屏按真实有效期倒计时。
|
|
DateTime? expireTime;
|
|
|
|
/// 创建主屏向副屏发送的二维码支付消息。
|
|
SubScreenQrCodeScanEvent({
|
|
required this.action,
|
|
required this.orderId,
|
|
required this.qrCodeData,
|
|
this.aggregateNo,
|
|
this.qrCodeType,
|
|
this.expireTime,
|
|
});
|
|
|
|
/// 从跨 Engine JSON 消息恢复二维码支付参数。
|
|
factory SubScreenQrCodeScanEvent.fromJson(Map<String, dynamic> json) =>
|
|
_$SubScreenQrCodeScanEventFromJson(json);
|
|
|
|
/// 转换为插件可跨 Engine 发送的 JSON 数据。
|
|
Map<String, dynamic> toJson() => _$SubScreenQrCodeScanEventToJson(this);
|
|
}
|
|
|
|
/// 主屏向预约查询副屏发送的完整快照;副屏以 sessionId + revision 丢弃旧消息。
|
|
@JsonSerializable(explicitToJson: true)
|
|
class SubScreenReservationQueryEvent {
|
|
/// 主屏本次预约查询会话标识。
|
|
final String sessionId;
|
|
|
|
/// 同一会话内单调递增的消息版本。
|
|
final int revision;
|
|
|
|
/// 副屏需要展示的预约查询场景。
|
|
final String scenario;
|
|
|
|
/// 服务端脱敏后的用餐人姓名。
|
|
final String? maskedName;
|
|
|
|
/// 用餐人所属部门或班级名称。
|
|
final String? deptName;
|
|
|
|
/// 当前终端绑定的食堂名称。
|
|
final String? merchantName;
|
|
|
|
/// 当前查询结果包含预约的日期数量。
|
|
final int totalDayCount;
|
|
|
|
/// 当前查询结果包含预约的餐段数量。
|
|
final int totalMealCount;
|
|
|
|
/// 当前副屏展示的页码。
|
|
final int currentPage;
|
|
|
|
/// 当前查询结果的总页数。
|
|
final int totalPages;
|
|
|
|
/// 当前页的预约日期列表,不包含主屏核销所需的订单标识。
|
|
final List<ReservationMenuDayData> days;
|
|
|
|
/// 当前预约结果的隐私过期时间。
|
|
final String? expiresAt;
|
|
|
|
/// 是否启用查询菜单的持续人脸组合页面;旧副屏消息缺省为关闭。
|
|
final bool continuousFaceRecognition;
|
|
|
|
/// 是否在副屏等待识别布局展示快捷键盘操作提示;对应主屏“键盘模式”开关。
|
|
final bool keyboardHintsEnabled;
|
|
|
|
const SubScreenReservationQueryEvent({
|
|
required this.sessionId,
|
|
required this.revision,
|
|
required this.scenario,
|
|
this.maskedName,
|
|
this.deptName,
|
|
this.merchantName,
|
|
required this.totalDayCount,
|
|
required this.totalMealCount,
|
|
required this.currentPage,
|
|
required this.totalPages,
|
|
required this.days,
|
|
this.expiresAt,
|
|
this.continuousFaceRecognition = false,
|
|
this.keyboardHintsEnabled = false,
|
|
});
|
|
|
|
factory SubScreenReservationQueryEvent.fromJson(
|
|
Map<String, dynamic> json,
|
|
) =>
|
|
_$SubScreenReservationQueryEventFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$SubScreenReservationQueryEventToJson(this);
|
|
}
|