feat:交易查询

This commit is contained in:
dzc committed 2025-03-19 11:33:23 +08:00
1 parent 460871e98a
commit 14067d973b
7 files changed
+27 -22

No files matched your search

@@ -59,10 +59,10 @@ enum OrderStatus implements BaseEnum {
TOTAL("-1", "全部", true),
CREATE("1", "未付款", true),
OFFLINE_CREATE("2", "离线创建订单(未支付)", false),
PAY("5", "已付款", true),
OFFLINE_PAY("6", "本地支付", true),
REFUND("10", "退款", true),
OFFLINE_CREATE("2", "离线(未支付)", true),
OFFLINE_PAY("6", "离线(本地支付)", true),
REFUND("10", "退款", false),
CANCEL("20", "已核销", false),
;
@@ -71,8 +71,8 @@ const _$OrderTypeEnumMap = {
const _$OrderStatusEnumMap = {
OrderStatus.TOTAL: 'TOTAL',
OrderStatus.CREATE: 'CREATE',
OrderStatus.OFFLINE_CREATE: 'OFFLINE_CREATE',
OrderStatus.PAY: 'PAY',
OrderStatus.OFFLINE_CREATE: 'OFFLINE_CREATE',
OrderStatus.OFFLINE_PAY: 'OFFLINE_PAY',
OrderStatus.REFUND: 'REFUND',
OrderStatus.CANCEL: 'CANCEL',
@@ -149,6 +149,7 @@ mixin OrderMixin {
Future<int?> createSqlOrder() async {
final orderSourceTypeId = getOrderSourceTypeId();
try {
final isNetwork = appC.isNetwork.value;
final order = OrderEntity(
uniqueCode: await _getUniqueCode(),
serviceUniqueCode: '001',
@@ -160,10 +161,10 @@ mixin OrderMixin {
walletId: payUser.value?.walletId,
orderSourceTypeId: orderSourceTypeId,
type: orderType,
status: OrderStatus.OFFLINE_CREATE,
status: isNetwork ? OrderStatus.CREATE : OrderStatus.OFFLINE_CREATE,
price: getTotalPrice(),
extraPrice: amountMealPrice.value,
payPrice: getTotalPrice() + amountMealPrice.value,
payPrice: 0,
productDesc: getProductDesc(),
count: getProductCount(),
weight: getProductWeight(),
@@ -315,9 +316,11 @@ mixin OrderMixin {
sqlOrderDetail.status = OrderStatus.PAY;
sqlOrderDetail.serviceUniqueCode = data;
} else {
sqlOrderDetail.status = OrderStatus.OFFLINE_CREATE;
sqlOrderDetail.status = OrderStatus.OFFLINE_PAY;
}
// 更新本地订单
final payPrice = sqlOrderDetail.price + sqlOrderDetail.extraPrice;
sqlOrderDetail.payPrice = payPrice;
sqlOrderDetail.payTime = DateTime.now();
await orderDao.edit(sqlOrderDetail);
if (sqlOrderDetail.payPrice != 0) {
@@ -475,7 +478,6 @@ mixin OrderMixin {
required price,
}) async {
try {
final app = Get.find<AppControl>();
var setting = await AppSettingTool.getCanteenExtraPriceConfig();
final isNetwork = AppNetworkTool.isAutoNetwork();
// 有网络
+3 -1
View File
@@ -11,12 +11,14 @@ Widget orderAllPrice(
BuildContext context, {
required num totalPrice,
required num amountMealPrice,
num? payPrice,
String productPrice = "菜品总价",
bool visibleProductPrice = true,
bool visibleAmountMealPrice = true,
bool visibleDivider = true,
}) {
final theme = FTheme.of(context);
payPrice ??= totalPrice + amountMealPrice;
return <Widget>[
FDivider(
style: theme.dividerStyles.verticalStyle.copyWith(
@@ -45,7 +47,7 @@ Widget orderAllPrice(
),
appPrice(
context,
totalPrice + amountMealPrice,
payPrice,
),
].toRow(),
FDivider(
+11 -11
View File
@@ -145,7 +145,7 @@ class OrderHistoryController extends GetxController {
.toList();
for (int i = 0; i < tabs.length; i++) {
final v = tabs[i];
final currentTotal = total[v.status.name];
final currentTotal = total["UNIQUE_${v.status.name}"];
if (currentTotal == null) continue;
v.total = currentTotal;
}
@@ -156,19 +156,19 @@ class OrderHistoryController extends GetxController {
Future<Map<String, dynamic>> _getTotal() async {
final appSetting = await AppSettingTool.getSysSetting();
Map<String, dynamic> map = {
"pay": 0,
"nonePay": 0,
"offlinePay": 0,
"refund": 0,
"total": 0,
"UNIQUE_TOTAL": 0,
"UNIQUE_CREATE": 0,
"UNIQUE_OFFLINE_CREATE": 0,
"UNIQUE_PAY": 0,
"UNIQUE_OFFLINE_PAY": 0,
};
String totalSql = """
SELECT
SUM(CASE WHEN status = 'pay' THEN 1 ELSE 0 END) AS pay,
SUM(CASE WHEN status = 'nonePay' THEN 1 ELSE 0 END) AS nonePay,
SUM(CASE WHEN status = 'offlinePay' THEN 1 ELSE 0 END) AS offlinePay,
SUM(CASE WHEN status = 'refund' THEN 1 ELSE 0 END) AS refund,
SUM(CASE WHEN 1 = 1 THEN 1 ELSE 0 END) AS total
SUM(CASE WHEN status = 'CREATE' THEN 1 ELSE 0 END) AS UNIQUE_CREATE,
SUM(CASE WHEN status = 'OFFLINE_CREATE' THEN 1 ELSE 0 END) AS UNIQUE_OFFLINE_CREATE,
SUM(CASE WHEN status = 'PAY' THEN 1 ELSE 0 END) AS UNIQUE_PAY,
SUM(CASE WHEN status = 'OFFLINE_PAY' THEN 1 ELSE 0 END) AS UNIQUE_OFFLINE_PAY,
SUM(CASE WHEN 1 = 1 THEN 1 ELSE 0 END) AS UNIQUE_TOTAL
FROM order_record
WHERE
sysType = ?
+2 -2
View File
@@ -43,7 +43,7 @@ class OrderHistoryPage extends GetView<OrderHistoryController> {
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.typography.xl2.copyWith(
style: theme.typography.base.copyWith(
height: 1,
color: active
? theme.colorScheme.background
@@ -51,7 +51,7 @@ class OrderHistoryPage extends GetView<OrderHistoryController> {
),
)
.center()
.width(180.w)
.width(200.w)
.height(60.h)
.decorated(
color: active
+1
View File
@@ -136,6 +136,7 @@ class OrderHistoryDetailPage extends GetView<OrderHistoryDetailController> {
context,
totalPrice: controller.detailData.value?.price ?? 0,
amountMealPrice: controller.detailData.value?.extraPrice ?? 0,
payPrice: controller.detailData.value?.payPrice,
productPrice: "商品总价",
),
].toColumn();