feat:挂单
This commit is contained in:
1 parent
988247f3cd
commit
2b956342f4
12 files changed
+545
-36
No files matched your search
@@ -221,7 +221,7 @@ class OrderHistoryController extends GetxController {
|
||||
Toast.error(msg: "超过4个小时不能退款");
|
||||
return;
|
||||
}
|
||||
final price = AppriceTool.fenToYuan(v.payPrice);
|
||||
final price = AppPriceTool.fenToYuan(v.payPrice);
|
||||
refundDialog(
|
||||
Get.context!,
|
||||
title: "是否退还${v.username}用户的$price元",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_subscreen_plugin/flutter_subscreen_plugin.dart';
|
||||
@@ -121,10 +122,46 @@ class SupermarketOrderController extends GetxController with OrderMixin {
|
||||
// 更多 start
|
||||
// **************************************************************************
|
||||
// 加入挂单
|
||||
Future<void> addHoldBill() async {}
|
||||
Future<void> addHoldBill() async {
|
||||
final validShopCar = _validateShopCar();
|
||||
if (!validShopCar) return;
|
||||
// 加入挂单数据库
|
||||
final holdBillDao = appC.dataBase.getOrderHoldBillDao;
|
||||
final holdBill = OrderHoldBillEntity(
|
||||
sysType: SysType.SUPERMARKET,
|
||||
carListJson: jsonEncode(
|
||||
shopCardList.map((e) => e.toJson()).toList(),
|
||||
),
|
||||
userJson:
|
||||
payUser.value != null ? jsonEncode(payUser.value!.toJson()) : null,
|
||||
price: totalPrice.value,
|
||||
extraPrice: amountMealPrice.value,
|
||||
payPrice: totalPrice.value,
|
||||
createTime: DateTime.now(),
|
||||
);
|
||||
await holdBillDao.save(holdBill);
|
||||
Toast.success(msg: "已加入挂单列表");
|
||||
TtsManage.speak("已加入挂单列表");
|
||||
}
|
||||
|
||||
// 挂单列表
|
||||
Future<void> holdBillList() async {}
|
||||
Future<void> holdBillList() async {
|
||||
final holdBill = await selectHoldBillDialog();
|
||||
if (ObjectUtil.isEmpty(holdBill)) return;
|
||||
// 清空状态
|
||||
_clearShopCard();
|
||||
// 使用挂单数据
|
||||
final carList = (jsonDecode(holdBill?.carListJson ?? '[]') as List)
|
||||
.map((v) => ShopCardEntity.fromJson(v as Map<String, dynamic>))
|
||||
.toList();
|
||||
if (!ObjectUtil.isEmptyList(carList)) {
|
||||
shopCardList.addAll(carList);
|
||||
}
|
||||
totalPrice.value = holdBill?.price ?? 0;
|
||||
amountMealPrice.value = holdBill?.extraPrice ?? 0;
|
||||
computedTotalPrice(isSendSubScreen: false);
|
||||
sendSubScreen();
|
||||
}
|
||||
// **************************************************************************
|
||||
// 更多 end
|
||||
// **************************************************************************
|
||||
@@ -317,7 +354,7 @@ class SupermarketOrderController extends GetxController with OrderMixin {
|
||||
final validShopCar = _validateShopCar();
|
||||
if (!validShopCar) return;
|
||||
// 总金额
|
||||
final price = AppriceTool.fenToYuan(totalPrice.value);
|
||||
final price = AppPriceTool.fenToYuan(totalPrice.value);
|
||||
await createSqlOrder();
|
||||
await updateSqlOrder();
|
||||
_clearShopCard();
|
||||
|
||||
Reference in new issue
Block a user