feat:商品总件数

This commit is contained in:
dzc committed 2025-08-28 19:08:21 +08:00
1 parent 223adf1d16
commit 2550efa43a
4 files changed
+55 -26

No files matched your search

@@ -36,6 +36,9 @@ mixin OrderMixin {
// 总价
RxInt totalPrice = RxInt(0);
// 商品总件数量
RxInt totalProduct = RxInt(0);
// 额外需要支付的金额土豪税
RxInt amountMealPrice = RxInt(0);
@@ -433,11 +436,14 @@ mixin OrderMixin {
// 计算总价
void computedTotalPrice({isSendSubScreen = true}) {
int total = 0;
int currentTotalPrice = 0;
int currentTotalProduct = 0;
for (var e in shopCardList) {
total += e.totalPrice;
currentTotalPrice += e.totalPrice;
currentTotalProduct += e.productNumber;
}
totalPrice.value = total;
totalPrice.value = currentTotalPrice;
totalProduct.value = currentTotalProduct;
if (isSendSubScreen) sendSubScreen();
}
+44 -23
View File
@@ -12,6 +12,7 @@ Widget orderAllPrice(
required num totalPrice,
required num amountMealPrice,
num? payPrice,
num? productCount,
String productPrice = "菜品总价",
bool visibleProductPrice = true,
bool visibleAmountMealPrice = true,
@@ -27,29 +28,49 @@ Widget orderAllPrice(
),
),
<Widget>[
Text(
productPrice,
style: theme.typography.lg,
),
appPrice(context, totalPrice),
].toRow().offstage(offstage: !visibleProductPrice),
<Widget>[
Text(
"额外支付",
style: theme.typography.lg,
),
appPrice(context, amountMealPrice),
].toRow().offstage(offstage: !visibleAmountMealPrice),
<Widget>[
Text(
"实际扣款",
style: theme.typography.lg,
),
appPrice(
context,
payPrice,
),
].toRow(),
<Widget>[
<Widget>[
Text(
productPrice,
style: theme.typography.lg,
),
appPrice(context, totalPrice),
].toRow().offstage(offstage: !visibleProductPrice),
<Widget>[
Text(
"额外支付",
style: theme.typography.lg,
),
appPrice(context, amountMealPrice),
].toRow().offstage(offstage: !visibleAmountMealPrice),
<Widget>[
Text(
"实际扣款",
style: theme.typography.lg,
),
appPrice(
context,
payPrice,
),
].toRow(),
].toColumn(),
<Widget>[
<Widget>[
Text(
"件数",
style: theme.typography.lg,
),
Text(
"$productCount",
style: theme.typography.lg.copyWith(
color: theme.colorScheme.error,
),
),
].toRow().offstage(offstage: productCount == null),
].toColumn()
].toRow(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start),
FDivider(
style: theme.dividerStyles.verticalStyle.copyWith(
color: theme.colorScheme.primary,
@@ -438,6 +438,7 @@ class SupermarketOrderController extends GetxController with OrderMixin {
shopCardList.clear();
payUser.value = null;
totalPrice.value = 0;
totalProduct.value = 0;
amountMealPrice.value = 0;
}
+1
View File
@@ -269,6 +269,7 @@ class SupermarketOrderPage extends GetView<SupermarketOrderController> {
totalPrice: controller.totalPrice.value,
amountMealPrice: controller.amountMealPrice.value,
productPrice: "商品总价",
productCount: controller.totalProduct.value,
),
),
SizedBox(height: 20.h),