feat: 更新钱包规则和用户模型以支持食堂信息
- 在 `ServiceUser` 模型中添加 `canteenId` 字段以支持查询用户食堂信息 - 修改 `ServiceMchRule` 模型,增加 `rulePriceType` 字段并调整 `basePrice` 和 `multiple` 字段类型 - 更新 `CanteenProductController` 中的价格计算逻辑,支持根据食堂ID和规则类型计算额外费用
This commit is contained in:
1 parent
cf9f8da767
commit
01e14a4c1d
6 files changed
+71
-19
No files matched your search
@@ -37,6 +37,9 @@ class ServiceUser {
|
||||
/// 卡号
|
||||
String? walletCardNumber;
|
||||
|
||||
/// 查询用户食堂信息
|
||||
String? canteenId;
|
||||
|
||||
/// 构造函数
|
||||
ServiceUser({
|
||||
this.userId,
|
||||
@@ -49,6 +52,7 @@ class ServiceUser {
|
||||
this.walletBalance,
|
||||
this.walletIsFreeze,
|
||||
this.walletCardNumber,
|
||||
this.canteenId,
|
||||
});
|
||||
|
||||
factory ServiceUser.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -18,6 +18,7 @@ ServiceUser _$ServiceUserFromJson(Map<String, dynamic> json) => ServiceUser(
|
||||
walletIsFreeze:
|
||||
JsonTool.stringToBoolean(json['walletIsFreeze'] as String),
|
||||
walletCardNumber: json['walletCardNumber'] as String?,
|
||||
canteenId: json['canteenId'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServiceUserToJson(ServiceUser instance) =>
|
||||
@@ -32,6 +33,7 @@ Map<String, dynamic> _$ServiceUserToJson(ServiceUser instance) =>
|
||||
'walletBalance': instance.walletBalance,
|
||||
'walletIsFreeze': JsonTool.booleanToString(instance.walletIsFreeze),
|
||||
'walletCardNumber': instance.walletCardNumber,
|
||||
'canteenId': instance.canteenId,
|
||||
};
|
||||
|
||||
ServiceAuth _$ServiceAuthFromJson(Map<String, dynamic> json) => ServiceAuth(
|
||||
|
||||
@@ -64,21 +64,29 @@ class ServiceMchRule {
|
||||
String targetMchId;
|
||||
|
||||
/// 规则配置id
|
||||
int rulePriceConfigId;
|
||||
String rulePriceConfigId;
|
||||
|
||||
/// 钱包规则类型
|
||||
/// 10 跨单位额外支付
|
||||
/// 20 每餐额外支付
|
||||
String? rulePriceType;
|
||||
|
||||
/// 基础价格
|
||||
int basePrice;
|
||||
@JsonKey(fromJson: JsonTool.stringToInt, toJson: JsonTool.intToString)
|
||||
int? basePrice;
|
||||
|
||||
/// 额外需要支付的倍数
|
||||
int multiple;
|
||||
@JsonKey(fromJson: JsonTool.stringToInt, toJson: JsonTool.intToString)
|
||||
int? multiple;
|
||||
|
||||
ServiceMchRule({
|
||||
required this.id,
|
||||
required this.sourceMchId,
|
||||
required this.targetMchId,
|
||||
required this.rulePriceConfigId,
|
||||
required this.basePrice,
|
||||
required this.multiple,
|
||||
this.rulePriceType,
|
||||
this.basePrice,
|
||||
this.multiple,
|
||||
});
|
||||
|
||||
factory ServiceMchRule.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -42,9 +42,10 @@ ServiceMchRule _$ServiceMchRuleFromJson(Map<String, dynamic> json) =>
|
||||
id: json['id'] as String,
|
||||
sourceMchId: json['sourceMchId'] as String,
|
||||
targetMchId: json['targetMchId'] as String,
|
||||
rulePriceConfigId: (json['rulePriceConfigId'] as num).toInt(),
|
||||
basePrice: (json['basePrice'] as num).toInt(),
|
||||
multiple: (json['multiple'] as num).toInt(),
|
||||
rulePriceConfigId: json['rulePriceConfigId'] as String,
|
||||
rulePriceType: json['rulePriceType'] as String?,
|
||||
basePrice: JsonTool.stringToInt(json['basePrice'] as String?),
|
||||
multiple: JsonTool.stringToInt(json['multiple'] as String?),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServiceMchRuleToJson(ServiceMchRule instance) =>
|
||||
@@ -53,6 +54,7 @@ Map<String, dynamic> _$ServiceMchRuleToJson(ServiceMchRule instance) =>
|
||||
'sourceMchId': instance.sourceMchId,
|
||||
'targetMchId': instance.targetMchId,
|
||||
'rulePriceConfigId': instance.rulePriceConfigId,
|
||||
'basePrice': instance.basePrice,
|
||||
'multiple': instance.multiple,
|
||||
'rulePriceType': instance.rulePriceType,
|
||||
'basePrice': JsonTool.intToString(instance.basePrice),
|
||||
'multiple': JsonTool.intToString(instance.multiple),
|
||||
};
|
||||
Reference in new issue
Block a user