Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  finish deto create page 对接接口:提交物品出户信息
  对接接口:获取搬家公司电话
  update 报事报修接口
  add moving company select page update deto create page
hmxc
小赖 4 years ago
commit e8c1d86fd1

@ -118,6 +118,12 @@ class _Manager {
/// ///
String get reportRepairEvaluate => '/user/reportRepair/evaluate'; String get reportRepairEvaluate => '/user/reportRepair/evaluate';
///
String get getMovingCompanyTel => '/user/articleOut/getMovingCompanyTel';
///
String get articleOutSubmit => '/user/articleOut/submit';
} }
class _Community { class _Community {

@ -0,0 +1,42 @@
class MovingCompanyModel {
List<AppMovingCompanyVoList> appMovingCompanyVoList;
MovingCompanyModel({this.appMovingCompanyVoList});
MovingCompanyModel.fromJson(Map<String, dynamic> json) {
if (json['appMovingCompanyVoList'] != null) {
appMovingCompanyVoList = new List<AppMovingCompanyVoList>();
json['appMovingCompanyVoList'].forEach((v) {
appMovingCompanyVoList.add(new AppMovingCompanyVoList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.appMovingCompanyVoList != null) {
data['appMovingCompanyVoList'] =
this.appMovingCompanyVoList.map((v) => v.toJson()).toList();
}
return data;
}
}
class AppMovingCompanyVoList {
String name;
String tel;
AppMovingCompanyVoList({this.name, this.tel});
AppMovingCompanyVoList.fromJson(Map<String, dynamic> json) {
name = json['name'];
tel = json['tel'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['tel'] = this.tel;
return data;
}
}

@ -4,6 +4,13 @@
import 'dart:io'; import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/pages/goods_deto_page/select_move_company_page.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -19,15 +26,10 @@ import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/buttons/bee_check_box.dart';
import 'package:akuCommunity/widget/buttons/bee_check_button.dart'; import 'package:akuCommunity/widget/buttons/bee_check_button.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/buttons/radio_button.dart';
import 'package:akuCommunity/widget/picker/bee_custom_picker.dart';
import 'package:akuCommunity/widget/picker/bee_date_picker.dart'; import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
import 'widget/common_picker.dart';
import 'widget/common_radio.dart';
class DetoCreatePage extends StatefulWidget { class DetoCreatePage extends StatefulWidget {
DetoCreatePage({Key key}) : super(key: key); DetoCreatePage({Key key}) : super(key: key);
@ -39,15 +41,12 @@ class DetoCreatePage extends StatefulWidget {
class _DetoCreatePageState extends State<DetoCreatePage> { class _DetoCreatePageState extends State<DetoCreatePage> {
List<File> _files = []; List<File> _files = [];
UserProvider get userProvider => Provider.of<UserProvider>(context); UserProvider get userProvider => Provider.of<UserProvider>(context);
String get firstEstateName {
return userProvider.userDetailModel.estateNames.isEmpty
? ''
: userProvider.userDetailModel.estateNames[0];
}
String _itemName; String _itemName;
DateTime _date; DateTime _date;
String get datetime=>DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss");
int _selectWeight; int _selectWeight;
String _selectTel;
List<String> _listWeight = [ List<String> _listWeight = [
'< 50kg', '< 50kg',
'50kg-100kg', '50kg-100kg',
@ -130,34 +129,34 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
); );
} }
Widget _inkWellCheckbox() { // Widget _inkWellCheckbox() {
return InkWell( // return InkWell(
child: Container( // child: Container(
padding: EdgeInsets.only(bottom: 24.w), // padding: EdgeInsets.only(bottom: 24.w),
child: Row( // child: Row(
mainAxisSize: MainAxisSize.min, // mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ // children: [
BeeCheckBox( // BeeCheckBox(
onChange: (value) { // onChange: (value) {
needMoveCompany = value; // needMoveCompany = value;
}, // },
), // ),
10.w.widthBox, // 10.w.widthBox,
Container( // Container(
child: Text( // child: Text(
'是否需要物业提供搬家公司联系方式', // '是否需要物业提供搬家公司联系方式',
style: TextStyle( // style: TextStyle(
fontSize: 28.sp, // fontSize: 28.sp,
color: Color(0xff333333), // color: Color(0xff333333),
), // ),
), // ),
), // ),
], // ],
), // ),
), // ),
); // );
} // }
Widget _getWeight() { Widget _getWeight() {
return Container( return Container(
@ -241,6 +240,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
.toList() .toList()
], ],
), ),
20.w.heightBox,
], ],
), ),
); );
@ -340,17 +340,70 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
setState(() {}); setState(() {});
} }
Widget _getMovingCompany(String movingCompany) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'搬家公司信息'.text.color(ktextPrimary).size(28.sp).make(),
16.w.heightBox,
InkWell(
onTap: () async {
_selectTel = await SelectMoveCompanyPage().to();
},
child: Padding(
padding: EdgeInsets.symmetric(vertical: 30.w),
child: Row(
children: [
(movingCompany.isEmptyOrNull ? '请选择搬家公司' : movingCompany)
.text
.color(ktextSubColor)
.size(36.sp)
.bold
.make(),
Spacer(),
Icon(CupertinoIcons.chevron_right, size: 30.w),
],
),
),
),
BeeDivider.horizontal(),
],
),
);
}
bool _canSubmit(int weight, int approach, DateTime dateTime, String item) {
if (weight == null) {
return false;
} else if (approach == null) {
return false;
} else if (dateTime == null) {
return false;
} else if (item.isEmptyOrNull) {
return false;
} else {
return true;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '物品出户', title: '物品出户',
body: ListView( body: ListView(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
children: [ children: [
_houseAddress(kEstateName, firstEstateName), _houseAddress(
kEstateName,
userProvider.userDetailModel.estateNames.isEmpty
? ''
: BeeParse.getEstateName(
userProvider.userDetailModel.estateNames[0])),
_getWeight(), _getWeight(),
_itemPicker( _itemPicker(
'出户时间', DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"), '出户时间', datetime,
() async { () async {
_date = await BeeDatePicker.timePicker(DateTime.now()); _date = await BeeDatePicker.timePicker(DateTime.now());
setState(() {}); setState(() {});
@ -359,7 +412,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
_showItmePicker(); _showItmePicker();
}), }),
_getApproach(), _getApproach(),
_selectApproach == 0 ? SizedBox() : _inkWellCheckbox(), _selectApproach == 0 ? SizedBox() : _getMovingCompany(''),
Container( Container(
margin: EdgeInsets.only(top: 54.w, bottom: 24.w), margin: EdgeInsets.only(top: 54.w, bottom: 24.w),
child: Text( child: Text(
@ -378,14 +431,30 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
child: '确认提交'.text.color(ktextPrimary).bold.make(), child: '确认提交'.text.color(ktextPrimary).bold.make(),
onPressed: () {}, onPressed: _canSubmit(_selectWeight, _selectApproach, _date, _itemName)
? () async {
List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.articleOutSubmit(
id: BeeParse.getEstateNameId(
userProvider.userDetailModel.estateNames[0]),
name: _itemName,
weight: _selectWeight + 1,
approach: _selectApproach + 1,
tel: _selectTel,
time: datetime,
urls: urls,
);
if (baseModel.status) {
Get.back();
} else
BotToast.showText(text: baseModel.message);
}
: () {
BotToast.showText(text: '请填写完整物品出户信息!');
},
), ),
); );
// Positioned( //
// bottom: 0,
// child: BottomButton(title: '确认提交'),
// )
// ],
// ),
} }
} }

@ -36,7 +36,7 @@ class _CommonRadioState extends State<CommonRadio> {
color: _selected ? kPrimaryColor : Color(0xFF979797), color: _selected ? kPrimaryColor : Color(0xFF979797),
width: 3.w, width: 3.w,
), ),
borderRadius: BorderRadius.circular(20.w), borderRadius: BorderRadius.circular(widget.size??20.w),
), ),
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
@ -58,9 +58,13 @@ class _CommonRadioState extends State<CommonRadio> {
), ),
), ),
), ),
...widget.text == null
? [SizedBox()]
: [
10.w.widthBox, 10.w.widthBox,
widget.text, widget.text,
10.w.widthBox, 10.w.widthBox,
]
], ],
); );
} }

@ -0,0 +1,165 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/moving_company_model.dart';
import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
class SelectMoveCompanyPage extends StatefulWidget {
SelectMoveCompanyPage({Key key}) : super(key: key);
@override
_SelectMoveCompanyPageState createState() => _SelectMoveCompanyPageState();
}
class _SelectMoveCompanyPageState extends State<SelectMoveCompanyPage> {
int _selected;
MovingCompanyModel _companyModel;
EasyRefreshController _controller;
bool _onloading = true;
String get result {
if (_selected == _companyModel.appMovingCompanyVoList.length) {
return null;
} else {
return _companyModel.appMovingCompanyVoList[_selected].tel;
}
}
@override
void initState() {
super.initState();
_controller = EasyRefreshController();
}
@override
void dispose() {
_controller = EasyRefreshController();
super.dispose();
}
Widget _buildCard(int index, String name, String tel) {
return GestureDetector(
onTap: () {
_selected = index;
setState(() {});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 28.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
child: CommonRadio(
size: 32.w,
value: index,
groupValue: _selected,
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
name.text.color(ktextPrimary).size(28.sp).bold.make(),
20.w.heightBox,
Row(
children: [
Icon(
CupertinoIcons.phone_arrow_up_right,
size: 40.w,
color: kDarkSubColor,
),
8.w.widthBox,
'电话:$tel'
.text
.color(Color(0xFF999999))
.size(24.sp)
.bold
.make(),
],
),
],
).expand(),
],
),
),
);
}
Widget _buildForself(int index) {
return GestureDetector(
onTap: () {
_selected = index;
setState(() {});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 28.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
child: CommonRadio(
size: 32.w,
value: index,
groupValue: _selected,
),
),
'自己联系'.text.color(ktextPrimary).size(28.sp).bold.make()
],
),
),
);
}
Widget _emptyWidget() {
return Container();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '搬家公司',
body: EasyRefresh(
firstRefresh: true,
controller: _controller,
onRefresh: () async {
_companyModel = await ManagerFunc.getMovingCompanyTel();
_onloading = false;
setState(() {});
},
header: MaterialHeader(),
child: _onloading
? _emptyWidget()
: ListView(
padding: EdgeInsets.all(32.w),
children: [
..._companyModel.appMovingCompanyVoList
.map((e) => _buildCard(
_companyModel.appMovingCompanyVoList.indexOf(e),
e.name,
e.tel))
.toList(),
_buildForself(_companyModel.appMovingCompanyVoList.length)
].sepWidget(separate: BeeDivider.horizontal()),
),
),
bottomNavi: BottomButton(
child: '确定'.text.color(ktextPrimary).size(32.sp).bold.make(),
onPressed: () {
if (_selected == null) {
BotToast.showText(text: '请选择搬家公司!');
} else {
Get.back(result: result);
}
},
),
);
}
}

@ -1,4 +1,5 @@
// Package imports: // Package imports:
import 'package:akuCommunity/model/manager/moving_company_model.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
@ -27,10 +28,11 @@ class ManagerFunc {
} }
static reportRepairInsert( static reportRepairInsert(
int type, String reportDetail, List<String> fileUrls) async { int id, int type, String reportDetail, List<String> fileUrls) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairInsert, API.manager.reportRepairInsert,
params: { params: {
'buildingUnitEstateId': id,
'type': type, 'type': type,
'reportDetail': reportDetail, 'reportDetail': reportDetail,
'fileUrls': fileUrls, 'fileUrls': fileUrls,
@ -92,4 +94,36 @@ class ManagerFunc {
); );
return baseModel; return baseModel;
} }
static Future<MovingCompanyModel> getMovingCompanyTel() async {
Response response = await NetUtil().dio.get(
API.manager.getMovingCompanyTel,
);
return MovingCompanyModel.fromJson(response.data);
}
static Future<BaseModel> articleOutSubmit({
int id,
String name,
int weight,
int approach,
String tel,
String time,
List<String> urls,
}) async {
BaseModel baseModel = await NetUtil().post(
API.manager.articleOutSubmit,
params: {
'buildingUnitEstateId': id,
'name': name,
'weight': weight,
'approach': approach,
'movingCompanyTel': tel,
'expectedTime': DateUtil.formatDateStr(time,format: "yyyy-MM-dd HH:mm:ss"),
'imgUrls': urls,
},
showMessage: true,
);
return baseModel;
}
} }

@ -2,6 +2,7 @@
import 'dart:io'; import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -161,7 +162,9 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
width: 686.w, width: 686.w,
child: TextField( child: TextField(
controller: _textEditingController, controller: _textEditingController,
onEditingComplete: () {}, onChanged: (value) {
setState(() {});
},
maxLines: 10, maxLines: 10,
minLines: 5, minLines: 5,
decoration: InputDecoration( decoration: InputDecoration(
@ -217,7 +220,8 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
kEstateName, kEstateName,
userProvider.userDetailModel.estateNames.isEmpty userProvider.userDetailModel.estateNames.isEmpty
? '' ? ''
: userProvider.userDetailModel.estateNames[0]), : BeeParse.getEstateName(
userProvider.userDetailModel.estateNames[0])),
_getType(), _getType(),
_buildReportCard(), _buildReportCard(),
_addImages(), _addImages(),
@ -231,7 +235,11 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
List<String> urls = await NetUtil() List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair); .uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert( BaseModel baseModel = await ManagerFunc.reportRepairInsert(
_selectType + 1, _textEditingController.text, urls); BeeParse.getEstateNameId(
userProvider.userDetailModel.estateNames[0]),
_selectType + 1,
_textEditingController.text,
urls);
if (baseModel.status) { if (baseModel.status) {
FinishFixedSubmitPage().to(); FinishFixedSubmitPage().to();
} else } else

@ -0,0 +1,9 @@
class BeeParse{
static int getEstateNameId(String estateName) {
int a = int.parse(estateName.split('|')[0]);
return a;
}
static String getEstateName(String estateNmae) {
return estateNmae.split('|')[1];
}
}
Loading…
Cancel
Save