feat:统计页面
This commit is contained in:
1 parent
3c5ba3ae8a
commit
ab9ea614d5
9 files changed
+187
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import 'package:forui/forui.dart';
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
/// 设备类型
|
||||
@@ -109,6 +110,20 @@ enum ProductHourType implements BaseEnum {
|
||||
@override
|
||||
final String title;
|
||||
|
||||
// 使用 getter 方法动态获取图标
|
||||
SvgAsset get icon {
|
||||
switch (this) {
|
||||
case ProductHourType.TOTAL:
|
||||
return FAssets.icons.calendar;
|
||||
case ProductHourType.MORNING:
|
||||
return FAssets.icons.sunrise;
|
||||
case ProductHourType.NOON:
|
||||
return FAssets.icons.sun;
|
||||
case ProductHourType.NIGHT:
|
||||
return FAssets.icons.sunMoon;
|
||||
}
|
||||
}
|
||||
|
||||
const ProductHourType(this.code, this.title);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ enum PanelType implements BaseEnum {
|
||||
canteenReserve("25", "预定"),
|
||||
takeFood("30", "取餐"),
|
||||
orderHistory("40", "交易查询"),
|
||||
canteenOrderTotal("45", "交易查询"),
|
||||
setting("50", "设置"),
|
||||
cardActive("60", "开卡管理"),
|
||||
printer("70", "打印测试"),
|
||||
|
||||
@@ -20,6 +20,9 @@ class RouteNames {
|
||||
/// 食堂预定
|
||||
static const canteenReserve = '/canteen_reserve';
|
||||
|
||||
/// 食堂交易统计
|
||||
static const canteenOrderTotal = '/canteen_order_total';
|
||||
|
||||
/// 交易查询
|
||||
static const orderHistory = '/order_history';
|
||||
|
||||
|
||||
@@ -57,6 +57,14 @@ class RoutePages {
|
||||
Get.lazyPut(() => TakeFoodController());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: RouteNames.canteenOrderTotal,
|
||||
page: () => const CanteenOrderTotalPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => PanelController());
|
||||
Get.lazyPut(() => CanteenOrderTotalController());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: RouteNames.orderHistory,
|
||||
page: () => const OrderHistoryPage(),
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CanteenOrderTotalController extends GetxController {
|
||||
CanteenOrderTotalController();
|
||||
|
||||
_initData() {
|
||||
update(["canteen_order_total"]);
|
||||
}
|
||||
|
||||
void onTap() {}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
_initData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
library canteen_order_total;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
||||
@@ -0,0 +1,122 @@
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
import 'index.dart';
|
||||
|
||||
class CanteenOrderTotalPage extends GetView<CanteenOrderTotalController> {
|
||||
const CanteenOrderTotalPage({super.key});
|
||||
|
||||
// 主视图
|
||||
Widget _buildView(BuildContext context) {
|
||||
return <Widget>[
|
||||
_buildHeaderTotal(context),
|
||||
_buildCharts(context),
|
||||
].toColumn();
|
||||
}
|
||||
|
||||
// headerTotal
|
||||
Widget _buildHeaderTotal(BuildContext context) {
|
||||
return <Widget>[
|
||||
_buildHeaderTotalItem(context, title: "本日交易统计"),
|
||||
_buildHeaderTotalItem(context, title: "本周交易统计"),
|
||||
_buildHeaderTotalItem(context, title: "本月交易统计"),
|
||||
_buildHeaderTotalItem(context, title: "本年易统计"),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.spaceAround);
|
||||
}
|
||||
|
||||
// headerTotalItem
|
||||
Widget _buildHeaderTotalItem(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
return <Widget>[
|
||||
Text(title, style: theme.typography.xl.copyWith(height: 1)),
|
||||
SizedBox(height: 15.h),
|
||||
ProductHourType.values
|
||||
.map((v) {
|
||||
if (v.code == "-1") return const SizedBox.shrink();
|
||||
return <Widget>[
|
||||
FIcon(
|
||||
v.icon,
|
||||
size: theme.typography.xl2.fontSize,
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Text(
|
||||
v.title,
|
||||
maxLines: 1,
|
||||
style: theme.typography.xl.copyWith(height: 1),
|
||||
),
|
||||
FDivider(
|
||||
axis: Axis.vertical,
|
||||
style: theme.dividerStyles.verticalStyle.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Text(
|
||||
"共用餐",
|
||||
maxLines: 1,
|
||||
style: theme.typography.xl.copyWith(height: 1),
|
||||
),
|
||||
Text(
|
||||
"次",
|
||||
maxLines: 1,
|
||||
style: theme.typography.xl.copyWith(height: 1),
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Text(
|
||||
"总金额",
|
||||
maxLines: 1,
|
||||
style: theme.typography.xl.copyWith(height: 1),
|
||||
),
|
||||
]
|
||||
.toRow()
|
||||
.paddingSymmetric(horizontal: 10.w, vertical: 5.w)
|
||||
.marginSymmetric(vertical: 10.h)
|
||||
.decorated(
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.border,
|
||||
width: 1,
|
||||
),
|
||||
color: theme.colorScheme.background,
|
||||
borderRadius: theme.style.borderRadius,
|
||||
)
|
||||
.marginSymmetric(vertical: 10.h);
|
||||
})
|
||||
.toList()
|
||||
.toColumn(),
|
||||
].toColumn().paddingSymmetric(horizontal: 20.w, vertical: 15.w).decorated(
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.border,
|
||||
width: 1,
|
||||
),
|
||||
color: theme.colorScheme.secondary,
|
||||
borderRadius: theme.style.borderRadius / 2,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCharts(BuildContext context) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<CanteenOrderTotalController>(
|
||||
init: CanteenOrderTotalController(),
|
||||
id: "canteen_order_total",
|
||||
builder: (_) {
|
||||
return FScaffold(
|
||||
header: appDefaultNav(context, title: "交易统计"),
|
||||
content: _buildView(context).marginOnly(top: 20.h),
|
||||
resizeToAvoidBottomInset: false,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
library;
|
||||
|
||||
export './canteen_order_total/index.dart';
|
||||
export './canteen_product/index.dart';
|
||||
export './canteen_reserve/index.dart';
|
||||
export './card_active/index.dart';
|
||||
|
||||
@@ -17,6 +17,7 @@ class PanelController extends GetxController {
|
||||
PanelItem(title: "预定", visible: false, type: PanelType.canteenReserve),
|
||||
PanelItem(title: "取餐", visible: false, type: PanelType.takeFood),
|
||||
PanelItem(title: "交易查询", visible: true, type: PanelType.orderHistory),
|
||||
PanelItem(title: "交易统计", visible: false, type: PanelType.canteenOrderTotal),
|
||||
PanelItem(title: "开卡管理", visible: true, type: PanelType.cardActive),
|
||||
PanelItem(title: "设置", visible: true, type: PanelType.setting),
|
||||
PanelItem(title: "退出登录", visible: true, type: PanelType.logout),
|
||||
@@ -27,6 +28,7 @@ class PanelController extends GetxController {
|
||||
PanelType.canteenOrder,
|
||||
PanelType.takeFood,
|
||||
PanelType.canteenReserve,
|
||||
PanelType.canteenOrderTotal,
|
||||
];
|
||||
|
||||
final supermarketMenus = [
|
||||
@@ -103,6 +105,10 @@ class PanelController extends GetxController {
|
||||
if (!await _checkIsBind()) return;
|
||||
Get.toNamed(RouteNames.orderHistory);
|
||||
break;
|
||||
case PanelType.canteenOrderTotal:
|
||||
if (!await _checkIsBind()) return;
|
||||
Get.toNamed(RouteNames.canteenOrderTotal);
|
||||
break;
|
||||
case PanelType.setting:
|
||||
if (AppSysTool.isProd()) {
|
||||
final flag = await settingPasswordDialog(Get.context!);
|
||||
|
||||
Reference in new issue
Block a user