diff --git a/lib/common/api/hard_api.dart b/lib/common/api/hard_api.dart index af151ed..276a7cf 100644 --- a/lib/common/api/hard_api.dart +++ b/lib/common/api/hard_api.dart @@ -98,6 +98,16 @@ abstract class HardApi { return true; } + /// 核销活动订单 + static Future cancelActQrCode(dynamic formData) async { + final res = await HttpManage().dio.post( + "/hard/hard-api/ad/cancel-act-code", + data: formData, + ); + if (res.data == null) return false; + return true; + } + /// 生成发票 static Future generateInvoice( dynamic formData, diff --git a/lib/pages/setting/widgets/setting_baseInfo.dart b/lib/pages/setting/widgets/setting_baseInfo.dart index 1a2bc7c..b97cdf1 100644 --- a/lib/pages/setting/widgets/setting_baseInfo.dart +++ b/lib/pages/setting/widgets/setting_baseInfo.dart @@ -22,8 +22,8 @@ Future _bindServiceDialog(BuildContext context, SysSetting sys) async { // uniqueCodeC.text = "1896157295523049473"; // 正式环境-新县府02 // uniqueCodeC.text = "1887466308336488450"; - // 测试环境-测试设备 - // uniqueCodeC.text = "1877592554489143298"; + // 测试环境-测试设备-(食堂主要测试) + uniqueCodeC.text = "1877592554489143298"; // 测试少年宫测试 // uniqueCodeC.text = "1927932460185784321"; // 测试环境-食堂-浦阳 @@ -31,7 +31,7 @@ Future _bindServiceDialog(BuildContext context, SysSetting sys) async { // 正式环境-超市-浦阳 // uniqueCodeC.text = "1894303392833716226"; // 正式环境-超市-新县府-主要测试(2025-8-26) - uniqueCodeC.text = "1902270180536061954"; + // uniqueCodeC.text = "1902270180536061954"; } await showAdaptiveDialog( context: context, diff --git a/lib/pages/take_food/controller.dart b/lib/pages/take_food/controller.dart index 5890a23..283a905 100644 --- a/lib/pages/take_food/controller.dart +++ b/lib/pages/take_food/controller.dart @@ -108,6 +108,8 @@ class TakeFoodController extends GetxController { await getOrderDetail(); } else if (serviceCode.payType == OrderPayType.ACT_CANCEL) { orderPayType = OrderPayType.ACT_CANCEL; + globalQrCode = serviceCode; + orderId = serviceCode.id; // 查询核销活动 final act = await WalletApi.getComAct({ "actItemId": serviceCode.id, @@ -154,10 +156,16 @@ class TakeFoodController extends GetxController { status: '核销中...', maskType: EasyLoadingMaskType.black, ); - disposeOrderQrCodeCancel(serviceId!); + disposeOrderQrCodeCancel( + serviceId: serviceId!, + userId: payUser.value!.userId!, + ); } - Future disposeOrderQrCodeCancel(String serviceId) async { + Future disposeOrderQrCodeCancel({ + required String serviceId, + required String userId, + }) async { try { // 线上订餐二维码支付 if (orderPayType == OrderPayType.RESERVE_QR_CODE) { @@ -169,7 +177,15 @@ class TakeFoodController extends GetxController { if (flag == false) throw Error(); } // 活动核销 - if (orderPayType == OrderPayType.ACT_CANCEL) {} + if (orderPayType == OrderPayType.ACT_CANCEL) { + final pa = { + "actItemId": orderId, + "userId": userId, + "hardwareId": serviceId, + }; + final flag = await HardApi.cancelActQrCode(pa); + if (flag == false) throw Error(); + } EasyLoading.dismiss(); Toast.success(msg: "核销成功"); TtsManage.speak("核销成功");