对接 租赁认证信息回显

hmxc
张萌 3 years ago
parent 876eb16fdd
commit d3843c9e5e

@ -0,0 +1,25 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'lease_echo_model.g.dart';
@JsonSerializable()
class LeaseEchoModel extends Equatable {
final String? name;
final num? sex;
final String tel;
final String? idNumber;
LeaseEchoModel({
required this.name,
required this.sex,
required this.tel,
required this.idNumber,
});
factory LeaseEchoModel.fromJson(Map<String, dynamic> json) =>
_$LeaseEchoModelFromJson(json);
factory LeaseEchoModel.fail() =>
LeaseEchoModel(name: '', sex: 0, tel: '', idNumber: '');
@override
List<Object?> get props => [name, sex, tel, idNumber];
}

@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'lease_echo_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LeaseEchoModel _$LeaseEchoModelFromJson(Map<String, dynamic> json) {
return LeaseEchoModel(
name: json['name'] as String?,
sex: json['sex'] as num?,
tel: json['tel'] as String,
idNumber: json['idNumber'] as String?,
);
}

@ -1,5 +1,6 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/models/house/lease_echo_model.dart';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
@ -23,7 +24,7 @@ class HouseFunc {
}
///
Future leaseCertification(
Future leaseCertification(
String name,
String sex,
String tel,
@ -43,6 +44,16 @@ class HouseFunc {
return false;
}
///
static Future leaseEcho() async {
BaseModel baseModel = await NetUtil().get(API.house.leaseEcho);
if (baseModel.status ?? false) {
return LeaseEchoModel.fromJson(baseModel.data);
} else {
return LeaseEchoModel.fail();
}
}
Map<String, int> getSex = {
'': 1,
'': 2,

@ -1,4 +1,5 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/house/lease_echo_model.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/ui/profile/house/tenant_house_list_page.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
@ -22,15 +23,43 @@ class UserIdentifyPage extends StatefulWidget {
class _UserIdentifyPageState extends State<UserIdentifyPage> {
TextEditingController _nameController = TextEditingController();
TextEditingController _phoneController = TextEditingController();
TextEditingController _indentifyCodeController = TextEditingController();
String _sex = '请选择性别';
String _identify = '请选择身份';
String _tel = '';
@override
void initState() {
super.initState();
Future.delayed(Duration(milliseconds: 300), () async {
LeaseEchoModel _model = await HouseFunc.leaseEcho();
if (!_model.name.isEmptyOrNull) {
_nameController.text = _model.name!;
}
if (_model.sex != null) {
switch (_model.sex) {
case 1:
_sex = '';
break;
case 2:
_sex = '';
break;
default:
break;
}
}
if (_model.tel.isNotEmpty) {
_tel = _model.tel;
}
if (!_model.idNumber.isEmptyOrNull) {
_indentifyCodeController.text = _model.idNumber!;
}
setState(() {});
});
}
@override
void dispose() {
_nameController.dispose();
_phoneController.dispose();
_indentifyCodeController.dispose();
super.dispose();
}
@ -58,12 +87,11 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
setState(() {});
},
),
BeeInputRow(
BeeInputRow.button(
title: '手机号码',
controller: _phoneController,
formatters: [FilteringTextInputFormatter.digitsOnly],
hintText: '请输入手机号',
onPressed: () {},
isRequire: true,
hintText: _tel,
),
BeeInputRow(
title: '身份证号码',
@ -89,7 +117,7 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
bool result = await HouseFunc().leaseCertification(
_nameController.text,
_sex,
_phoneController.text,
_tel,
_indentifyCodeController.text);
if (result) {
Get.off(() => TenantHouseListPage());
@ -107,10 +135,6 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
BotToast.showText(text: '姓名不能为空!');
return false;
}
if (_phoneController.text.isEmpty) {
BotToast.showText(text: '手机号码不能为空!');
return false;
}
if (_indentifyCodeController.text.isEmpty) {
BotToast.showText(text: '身份证号码不能为空!');
return false;
@ -179,15 +203,27 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
return CupertinoAlertDialog(
title:
'账户不存在'.text.size(34.sp).color(ktextPrimary).bold.isIntrinsic.make(),
content: '''原因:
1.
2.'''
.text
.size(26.sp)
.color(ktextPrimary)
.bold
.isIntrinsic
.make(),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'原因:'.text.size(26.sp).color(ktextPrimary).bold.isIntrinsic.make(),
'1.用户未具备相关资格'
.text
.size(26.sp)
.color(ktextPrimary)
.bold
.isIntrinsic
.make(),
'2.用户填写的姓名及身份证号与登记在册的姓名及身份证号并不一致'
.text
.size(26.sp)
.color(ktextPrimary)
.align(TextAlign.left)
.bold
.isIntrinsic
.make(),
],
),
actions: [
CupertinoDialogAction(
onPressed: () {

Loading…
Cancel
Save