feat:核销打印兑换券
This commit is contained in:
1 parent
fb90b477b9
commit
d517f45f38
11 files changed
+1560
-75
No files matched your search
@@ -156,6 +156,23 @@ abstract class HardApi {
|
||||
return res.data == true;
|
||||
}
|
||||
|
||||
/// 一次提交多笔同一用户预约订单,服务端在同一事务内核销并合并生成一张兑换券。
|
||||
static Future<bool> cancelReservationOrders({
|
||||
required List<int> orderIds,
|
||||
}) async {
|
||||
final setting = await AppSettingTool.getSysSetting();
|
||||
final res = await HttpManage().dio.post(
|
||||
'/hard/hard-api/ad/reservation-menu/cancel-batch',
|
||||
data: {'orderIds': orderIds},
|
||||
options: dio.Options(
|
||||
headers: {
|
||||
if (setting.serviceId != null) 'DEVICE-ID': setting.serviceId,
|
||||
},
|
||||
),
|
||||
);
|
||||
return res.data == true;
|
||||
}
|
||||
|
||||
/// 分页查询当前设备的预约核销记录,设备范围由服务端再次校验。
|
||||
static Future<ServiceVerificationRecordPage?> verificationRecordPage({
|
||||
required int current,
|
||||
@@ -303,6 +320,50 @@ abstract class HardApi {
|
||||
return res.data != null;
|
||||
}
|
||||
|
||||
/// 在线查询当前业务终端为指定订单生成的打印凭证,不读取终端本地打印记录。
|
||||
static Future<List<ServicePrintRecord>> getPrinterRecords({
|
||||
required String orderId,
|
||||
}) async {
|
||||
final setting = await AppSettingTool.getSysSetting();
|
||||
final hardId = setting.serviceId;
|
||||
if (hardId == null || hardId.isEmpty) throw StateError('当前业务终端尚未绑定');
|
||||
final res = await HttpManage().dio.get(
|
||||
'/hard/hard-api/ad/printer/records',
|
||||
queryParameters: {'orderId': int.parse(orderId)},
|
||||
options: dio.Options(headers: {'DEVICE-ID': hardId}),
|
||||
);
|
||||
if (res.data == null) return const [];
|
||||
if (res.data is! List) throw const FormatException('打印凭证记录格式错误');
|
||||
return (res.data as List)
|
||||
.map((item) => ServicePrintRecord.fromJson(
|
||||
Map<String, dynamic>.from(item as Map),
|
||||
))
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
/// 提交当前业务终端已打印兑换券的人工重打原因并取得新任务。
|
||||
static Future<ServicePrintRecord?> reprintVoucher({
|
||||
required String historyId,
|
||||
required String reason,
|
||||
}) async {
|
||||
final setting = await AppSettingTool.getSysSetting();
|
||||
final hardId = setting.serviceId;
|
||||
if (hardId == null || hardId.isEmpty) throw StateError('当前业务终端尚未绑定');
|
||||
final res = await HttpManage().dio.post(
|
||||
'/hard/hard-api/ad/printer/reprint',
|
||||
data: {
|
||||
'historyId': int.parse(historyId),
|
||||
'reprintReason': reason,
|
||||
},
|
||||
options: dio.Options(headers: {'DEVICE-ID': hardId}),
|
||||
);
|
||||
if (res.data == null) return null;
|
||||
if (res.data is! Map) throw const FormatException('兑换券重打任务格式错误');
|
||||
return ServicePrintRecord.fromJson(
|
||||
Map<String, dynamic>.from(res.data as Map),
|
||||
);
|
||||
}
|
||||
|
||||
/// 打印成功
|
||||
static Future<bool> printInvoice(dynamic formData) async {
|
||||
final res = await HttpManage().dio.get(
|
||||
|
||||
Reference in new issue
Block a user