已完成用户APP首期功能开发
交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
This commit is contained in:
40
apps/user_app/lib/domain/models/shipping_address.dart
Normal file
40
apps/user_app/lib/domain/models/shipping_address.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
// 功能描述:用户收货地址模型,列表脱敏展示、编辑使用本人完整数据。
|
||||
// 版本:1.0.0。
|
||||
class ShippingAddress {
|
||||
const ShippingAddress({
|
||||
this.identity = '',
|
||||
required this.address,
|
||||
required this.contactName,
|
||||
required this.contactPhone,
|
||||
this.longitude = '',
|
||||
this.latitude = '',
|
||||
this.isDefault = false,
|
||||
});
|
||||
final String identity, address, contactName, contactPhone, longitude, latitude;
|
||||
final bool isDefault;
|
||||
|
||||
/// 从兼容地址响应读取字段;历史空联系人在编辑时要求补齐。
|
||||
factory ShippingAddress.fromJson(Map<String, Object?> json) => ShippingAddress(
|
||||
identity: json['identity'] as String? ?? '',
|
||||
address: json['address'] as String? ?? '',
|
||||
contactName: json['contact_name'] as String? ?? '',
|
||||
contactPhone: json['contact_phone'] as String? ?? '',
|
||||
longitude: json['longitude'] as String? ?? '',
|
||||
latitude: json['latitude'] as String? ?? '',
|
||||
isDefault: json['is_default'] == true,
|
||||
);
|
||||
|
||||
String get maskedPhone => contactPhone.length == 11
|
||||
? '${contactPhone.substring(0, 3)}****${contactPhone.substring(7)}'
|
||||
: contactPhone;
|
||||
|
||||
/// 保存地址的完整字段;不接收内部账户编号。
|
||||
Map<String, Object?> toJson() => {
|
||||
'address': address,
|
||||
'contact_name': contactName,
|
||||
'contact_phone': contactPhone,
|
||||
'longitude': longitude,
|
||||
'latitude': latitude,
|
||||
'is_default': isDefault,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user