Files
biz_xfj_cloud/lib/common/models/api/wallet_api_models.dart
T

173 lines
3.8 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
part 'wallet_api_models.g.dart';
@JsonSerializable()
class ServicePaySetting {
/// 唯一标识符
final String? id;
/// 是否开启每一餐的额外缴费
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
final bool? payAmountEnable;
/// 每一餐的上限(分)
final int? payAmountMealLimit;
/// 每一餐的倍数
final double? payAmountMealTimes;
/// 售后的退款理由
final String? afterSaleRefundReasons;
/// 售后的退货理由
final String? afterSaleReturnReasons;
/// 是否开启钱包二维码刷新
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
final bool? refreshQrCodeEnable;
/// 二维码刷新频率
final int? refreshQrCodeFre;
/// 是否开启离线订单审批
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
final bool? offLineOrderApplyEnable;
ServicePaySetting({
this.id,
this.payAmountEnable,
this.payAmountMealLimit,
this.payAmountMealTimes,
this.afterSaleRefundReasons,
this.afterSaleReturnReasons,
this.refreshQrCodeEnable,
this.refreshQrCodeFre,
this.offLineOrderApplyEnable,
});
factory ServicePaySetting.fromJson(Map<String, dynamic> json) =>
_$ServicePaySettingFromJson(json);
Map<String, dynamic> toJson() => _$ServicePaySettingToJson(this);
}
@JsonSerializable()
class ServiceMchRule {
String id;
/// 源商户id
String sourceMchId;
/// 目标商户id
String targetMchId;
/// 规则配置id
String rulePriceConfigId;
/// 钱包规则类型
/// 10 跨单位额外支付
/// 20 每餐额外支付
String? rulePriceType;
/// 基础价格
@JsonKey(fromJson: JsonTool.stringToInt, toJson: JsonTool.intToString)
int? basePrice;
/// 额外需要支付的倍数
@JsonKey(fromJson: JsonTool.stringToInt, toJson: JsonTool.intToString)
int? multiple;
ServiceMchRule({
required this.id,
required this.sourceMchId,
required this.targetMchId,
required this.rulePriceConfigId,
this.rulePriceType,
this.basePrice,
this.multiple,
});
factory ServiceMchRule.fromJson(Map<String, dynamic> json) =>
_$ServiceMchRuleFromJson(json);
Map<String, dynamic> toJson() => _$ServiceMchRuleToJson(this);
}
@JsonSerializable()
class ServiceWallet {
/// 钱包id
String id;
/// 唯一编号
String walletTypeUniqueCode;
/// 用户id
String userId;
/// 钱包类型
String walletTypeId;
/// 余额(单位分)
int balance = 0;
/// 卡号
String? cardNumber;
/// 是否冻结饭卡
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
bool? isFreeze;
ServiceWallet({
required this.id,
required this.walletTypeUniqueCode,
required this.userId,
required this.walletTypeId,
required this.balance,
this.cardNumber,
this.isFreeze,
});
factory ServiceWallet.fromJson(Map<String, dynamic> json) =>
_$ServiceWalletFromJson(json);
Map<String, dynamic> toJson() => _$ServiceWalletToJson(this);
}
@JsonSerializable()
class ServiceComAct {
/// 活动类型
@JsonKey(
fromJson: JsonTool.stringToWalletActType,
toJson: JsonTool.walletActTypeToString,
)
WalletActType? actType;
/// 活动id
String? actItemId;
/// 用户id
String? userId;
/// 用户名
String? username;
/// 用户头像
String? userAvatar;
/// 详情
Map<String, dynamic>? detail;
ServiceComAct({
required this.actType,
required this.actItemId,
required this.detail,
});
factory ServiceComAct.fromJson(Map<String, dynamic> json) =>
_$ServiceComActFromJson(json);
Map<String, dynamic> toJson() => _$ServiceComActToJson(this);
}