feat:订单详情页面

This commit is contained in:
dzc committed 2025-03-19 10:06:26 +08:00
1 parent 1a144d1860
commit 7152303f54
5 files changed
+129 -29

No files matched your search

+2 -2
View File
@@ -137,7 +137,7 @@ Future<List<DateTime>?> appShowDatePicker(
}
Navigator.of(context).pop(slectDateTime);
},
).width(200.w),
).width(300.w),
SizedBox(width: 30.w),
FButton(
style: FButtonStyle.destructive,
@@ -148,7 +148,7 @@ Future<List<DateTime>?> appShowDatePicker(
),
),
onPress: () => Navigator.of(context).pop(null),
).width(200.w),
).width(300.w),
],
),
);
+1 -1
View File
@@ -21,7 +21,7 @@ Widget appPrice(BuildContext context, dynamic price) {
),
Text(
priceNum.toStringAsFixed(2),
style: theme.typography.lg.copyWith(
style: theme.typography.xl.copyWith(
color: theme.colorScheme.error,
height: 1,
),
+41 -24
View File
@@ -32,6 +32,44 @@ class OrderHistoryPage extends GetView<OrderHistoryController> {
].toColumn();
}
Widget _buildTypeTab(BuildContext context) {
final theme = FTheme.of(context);
return Obx(
() => controller.tabList
.map((v) {
final active = v.status.code == controller.currentStatus.value.code;
return Text(
"${v.status.title}(${v.total})",
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.typography.xl2.copyWith(
height: 1,
color: active
? theme.colorScheme.background
: theme.colorScheme.primary,
),
)
.center()
.width(180.w)
.height(60.h)
.decorated(
color: active
? theme.colorScheme.primary
: theme.colorScheme.background,
border: Border.all(
color: theme.colorScheme.primary,
width: 1,
),
borderRadius: theme.style.borderRadius / 2,
)
.onTap(() => controller.doTab(v.status));
})
.toList()
.toRowSpace(space: 20.w),
);
}
Widget _buildCondition(BuildContext context, double headerHeight) {
final theme = FTheme.of(context);
return <Widget>[
@@ -39,30 +77,9 @@ class OrderHistoryPage extends GetView<OrderHistoryController> {
FAssets.icons.chevronLeft,
size: theme.typography.xl4.fontSize,
).alignLeft().width(headerHeight).onTap(() => Get.back()),
Obx(
() => controller.tabList
.map((v) {
final active =
v.status.code == controller.currentStatus.value.code;
return FButton(
style: active ? FButtonStyle.primary : FButtonStyle.secondary,
label: Text(
"${v.status.title}(${v.total})",
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.typography.lg.copyWith(
color: active
? theme.colorScheme.secondary
: theme.colorScheme.primary,
),
).width(150.w),
onPress: () => controller.doTab(v.status),
);
})
.toList()
.toRowSpace(space: 20.w),
).scrollable(scrollDirection: Axis.horizontal).expanded(),
_buildTypeTab(context)
.scrollable(scrollDirection: Axis.horizontal)
.expanded(),
// 用餐时间段
appRadioHourTypeDialog(context, controller.hourTypeC)
.width(300.w)
@@ -6,7 +6,7 @@ class OrderHistoryDetailController extends GetxController {
int detailId = -1;
Rx<OrderEntity?> detailData = null.obs;
Rx<OrderEntity?> detailData = Rx(null);
RxList<ShopCardEntity> shopCardList = <ShopCardEntity>[].obs;
@@ -41,6 +41,7 @@ class OrderHistoryDetailController extends GetxController {
final detail = await appC.dataBase.getOrderDao.findById(
detailId,
);
if (detail == null) return;
detailData.value = detail;
}
+83 -1
View File
@@ -1,4 +1,5 @@
import 'package:common_utils/common_utils.dart';
import 'package:data_table_2/data_table_2.dart';
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
import 'package:flutter/material.dart';
import 'package:forui/forui.dart';
@@ -28,6 +29,7 @@ class OrderHistoryDetailPage extends GetView<OrderHistoryDetailController> {
].toRow().marginOnly(bottom: 20.h);
}
// 左侧
Widget _buildLeft(BuildContext context) {
return <Widget>[
FTile(
@@ -126,8 +128,88 @@ class OrderHistoryDetailPage extends GetView<OrderHistoryDetailController> {
.scrollable();
}
// 右侧
Widget _buildRight(BuildContext context) {
return <Widget>[].toColumn().scrollable();
return <Widget>[
_buildCarTable(context).expanded(),
orderAllPrice(
context,
totalPrice: controller.detailData.value?.price ?? 0,
amountMealPrice: controller.detailData.value?.extraPrice ?? 0,
productPrice: "商品总价",
),
].toColumn();
}
// 购物车
Widget _buildCarTable(BuildContext context) {
final theme = FTheme.of(context);
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final width = constraints.maxWidth;
final hdHeight = 70.h;
final hdWidth = width / 4.1;
return Obx(
() => DataTable2(
columnSpacing: 12.w,
horizontalMargin: 12.w,
minWidth: 600.w,
showBottomBorder: true,
headingTextStyle: theme.typography.lg,
dataTextStyle: theme.typography.base,
dataRowHeight: hdHeight,
columns: [
DataColumn2(
label: Text("名称", textAlign: TextAlign.center),
headingRowAlignment: MainAxisAlignment.center,
fixedWidth: hdWidth,
),
DataColumn2(
label: Text("数量", textAlign: TextAlign.center),
headingRowAlignment: MainAxisAlignment.center,
fixedWidth: hdWidth,
),
DataColumn2(
label: Text("单价", textAlign: TextAlign.center),
headingRowAlignment: MainAxisAlignment.center,
fixedWidth: hdWidth,
),
DataColumn2(
label: Text("总价", textAlign: TextAlign.center),
headingRowAlignment: MainAxisAlignment.center,
fixedWidth: hdWidth,
),
],
rows: controller.shopCardList.map((v) {
return DataRow(
cells: [
DataCell(
Text(
v.productName,
textAlign: TextAlign.center,
).center(),
),
DataCell(
Text(
v.nature == ProductNature.DEFAULT
? v.productNumber.toString()
: "${v.productWidget}/kg",
textAlign: TextAlign.center,
).center(),
),
DataCell(
appPrice(context, v.productPrice).center(),
),
DataCell(
appPrice(context, v.totalPrice).center(),
),
],
);
}).toList(),
),
);
},
);
}
@override