feat:适配离线订单

This commit is contained in:
dzc committed 2026-03-30 10:30:40 +08:00
1 parent 48c1ee8cb2
commit 593aa39b78
4 files changed
+40 -13

No files matched your search

+30 -10
View File
@@ -32,47 +32,67 @@ abstract class JsonTool {
}
static OrderType? stringToOrderType(String? value) {
return OrderType.values.fromCode(value);
final byCode = OrderType.values.fromCode(value);
if (byCode != null) return byCode;
if (value == null) return null;
final name = value.contains('.') ? value.split('.').last : value;
return OrderType.values.byName(name);
}
static String? orderTypeToString(OrderType? value) {
if (value == null) return null;
return value.toString();
return value.code;
}
static OrderPayType? stringToOrderPayType(String? value) {
return OrderPayType.values.fromCode(value);
final byCode = OrderPayType.values.fromCode(value);
if (byCode != null) return byCode;
if (value == null) return null;
final name = value.contains('.') ? value.split('.').last : value;
return OrderPayType.values.byName(name);
}
static String? orderPayTypeToString(OrderPayType? value) {
if (value == null) return null;
return value.toString();
return value.code;
}
static WalletActType? stringToWalletActType(String? value) {
return WalletActType.values.fromCode(value);
final byCode = WalletActType.values.fromCode(value);
if (byCode != null) return byCode;
if (value == null) return null;
final name = value.contains('.') ? value.split('.').last : value;
return WalletActType.values.byName(name);
}
static String? walletActTypeToString(WalletActType? value) {
if (value == null) return null;
return value.toString();
return value.code;
}
static DiscountsType? stringToDiscountsType(String? value) {
return DiscountsType.values.fromCode(value);
final byCode = DiscountsType.values.fromCode(value);
if (byCode != null) return byCode;
if (value == null) return null;
final name = value.contains('.') ? value.split('.').last : value;
return DiscountsType.values.byName(name);
}
static String? discountsTypeToString(DiscountsType? value) {
if (value == null) return null;
return value.toString();
return value.code;
}
static ProductHourType? stringToProductHourType(String? value) {
return ProductHourType.values.fromCode(value);
final byCode = ProductHourType.values.fromCode(value);
if (byCode != null) return byCode;
if (value == null) return null;
final name = value.contains('.') ? value.split('.').last : value;
return ProductHourType.values.byName(name);
}
static String? productHourTypeToString(ProductHourType? value) {
if (value == null) return null;
return value.toString();
return value.code;
}
}