feat:特色菜收费

This commit is contained in:
dzc committed 2026-03-29 16:45:54 +08:00
1 parent e5e24231e7
commit 3729e3b896
18 files changed
+93 -26

No files matched your search

@@ -38,6 +38,9 @@ class ShopCardEntity {
/// 单商品总价(分)
int totalPrice;
/// 是否涨价
bool isPriceIncreased;
ShopCardEntity({
this.id,
required this.orderId,
@@ -49,6 +52,7 @@ class ShopCardEntity {
required this.productNumber,
required this.productWidget,
required this.totalPrice,
required this.isPriceIncreased,
});
factory ShopCardEntity.fromJson(Map<String, dynamic> json) =>
@@ -18,6 +18,7 @@ ShopCardEntity _$ShopCardEntityFromJson(Map<String, dynamic> json) =>
productNumber: (json['productNumber'] as num).toInt(),
productWidget: (json['productWidget'] as num).toDouble(),
totalPrice: (json['totalPrice'] as num).toInt(),
isPriceIncreased: json['isPriceIncreased'] as bool,
);
Map<String, dynamic> _$ShopCardEntityToJson(ShopCardEntity instance) =>
@@ -32,6 +33,7 @@ Map<String, dynamic> _$ShopCardEntityToJson(ShopCardEntity instance) =>
'productNumber': instance.productNumber,
'productWidget': instance.productWidget,
'totalPrice': instance.totalPrice,
'isPriceIncreased': instance.isPriceIncreased,
};
const _$ProductNatureEnumMap = {
@@ -3,7 +3,6 @@ import 'package:equatable/equatable.dart';
import 'package:floor/floor.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
import 'package:pj_supermarket_cloud/common/models/index.dart';
part 'user_entity.g.dart';
@@ -30,6 +29,13 @@ class DiscountsItem {
/// 基础金额(分),超过了这个基数`extraPer`就生效
int basePrice;
/// 特色菜是否额外收费
@JsonKey(
fromJson: JsonTool.stringToBoolean,
toJson: JsonTool.booleanToString,
)
bool specialDishEnable;
/// 打折(8折->0.8)
double? extraPer;
@@ -38,6 +44,7 @@ class DiscountsItem {
required this.hourType,
required this.type,
required this.basePrice,
required this.specialDishEnable,
required this.extraPer,
});
@@ -12,6 +12,8 @@ DiscountsItem _$DiscountsItemFromJson(Map<String, dynamic> json) =>
hourType: JsonTool.stringToProductHourType(json['hourType'] as String?),
type: JsonTool.stringToDiscountsType(json['type'] as String?),
basePrice: (json['basePrice'] as num).toInt(),
specialDishEnable:
JsonTool.stringToBoolean(json['specialDishEnable'] as String?),
extraPer: (json['extraPer'] as num?)?.toDouble(),
);
@@ -21,6 +23,7 @@ Map<String, dynamic> _$DiscountsItemToJson(DiscountsItem instance) =>
'hourType': JsonTool.productHourTypeToString(instance.hourType),
'type': JsonTool.discountsTypeToString(instance.type),
'basePrice': instance.basePrice,
'specialDishEnable': JsonTool.booleanToString(instance.specialDishEnable),
'extraPer': instance.extraPer,
};