添加 新增家政服务页

修改报事报修组件
hmxc
张萌 3 years ago
parent dda81c802d
commit 8aea4295a5

@ -279,6 +279,13 @@ class _Manager {
///app
String get getDoorQrCode => '/user/doorQRCode/getQrCode';
///app()
String get houseKeepingList => '/user/housekeepingService/list';
///app
String get submitHouseKeeping =>
'/user/housekeepingService/submitHousekeeping';
}
class _Community {
@ -395,6 +402,10 @@ class _Upload {
///
String get uploadClearingSingle => '/user/upload/uploadAppClearingSingle';
///
String get uploadHouseKeepingPhotos =>
'/user/upload/uploadAppHousekeepingServiceSubmitPhone';
}
class _Message {

@ -72,7 +72,7 @@ class _ElectronicCommercPageState extends State<ElectronicCommercPage>
_tabs.length,
(index) => _onloading
? ListView(
children: [_buildShimmer()],
children: [SizedBox()],
)
: ElectronicCommercView(
id: _models[index].id,
@ -106,7 +106,7 @@ class _ElectronicCommercPageState extends State<ElectronicCommercPage>
24.hb,
VxBox().height(33.w).width(263.w).color(Colors.white).make(),
],
),
).expand(),
),
Divider(
height: 50.w,

@ -1,5 +1,7 @@
import 'dart:io';
import 'package:aku_community/widget/buttons/bee_check_button.dart';
import 'package:aku_community/widget/others/house_head_card.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -19,10 +21,8 @@ import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/picker/bee_house_picker.dart';
import 'package:aku_community/widget/picker/grid_image_picker.dart';
class AddFixedSubmitPage extends StatefulWidget {
@ -50,42 +50,29 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
super.dispose();
}
Widget _buildHouseCard() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'报修房屋'.text.black.size(28.sp).make().pSymmetric(h: 32.w),
8.w.heightBox,
BeeHousePicker(),
BeeDivider.horizontal(indent: 32.w, endIndent: 32.w),
],
);
}
// Widget _buildHouseCard() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// '报修房屋'.text.black.size(28.sp).make().pSymmetric(h: 32.w),
// 8.w.heightBox,
// BeeHousePicker(),
// BeeDivider.horizontal(indent: 32.w, endIndent: 32.w),
// ],
// );
// }
Widget _selectButton(
String title,
int value,
) {
return FlatButton(
// minWidth: 200.w,
// height: 72.w,
onPressed: () {
setState(() {
_selectType = value;
});
},
child: title.text
.color(_selectType == value ? ktextPrimary : Color(0xFF979797))
.size(32.sp)
.make(),
padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w),
shape: RoundedRectangleBorder(
side: BorderSide(
color: _selectType == value ? kPrimaryColor : ktextSubColor,
width: 3.w),
borderRadius: BorderRadius.circular(36.w)),
);
}
// Widget _selectButton(
// String title,
// int value,
// ) {
// return BeeCheckButton(
// title: '',
// onChange: (value) {},
// value: 1,
// groupValue: 1,
// );
// }
Widget _getType() {
return Padding(
@ -97,8 +84,17 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
24.w.heightBox,
Row(
children: <Widget>[
...List.generate(_buttons.length,
(index) => _selectButton(_buttons[index], index)),
...List.generate(
_buttons.length,
(index) => BeeCheckButton(
groupValue: _selectType,
onChange: (value) {
_selectType = index;
setState(() {});
},
title: _buttons[index],
value: index,
)),
].sepWidget(separate: 20.w.widthBox),
),
16.w.heightBox,
@ -176,11 +172,14 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
AppProvider appProvider = Provider.of<AppProvider>(context);
return WillPopScope(
child: BeeScaffold(
bodyColor: Colors.white,
systemStyle: SystemStyle.yellowBottomBar,
title: '报事报修',
body: ListView(
children: [
_buildHouseCard(),
HouseHeadCard(
context: context,
),
_getType(),
_buildReportCard(),
_addImages(),

@ -0,0 +1,180 @@
import 'dart:io';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/ui/manager/house_keeping/house_keeping_func.dart';
import 'package:aku_community/ui/manager/house_keeping/house_keeping_submit_page.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bee_check_button.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/house_head_card.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/picker/grid_image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:power_logger/power_logger.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
class AddHouseKeepingPage extends StatefulWidget {
AddHouseKeepingPage({Key? key}) : super(key: key);
@override
_AddHouseKeepingPageState createState() => _AddHouseKeepingPageState();
}
class _AddHouseKeepingPageState extends State<AddHouseKeepingPage> {
late TextEditingController _editingController;
List<String> _buttons = ['公区保修', '家庭维修'];
int? _selectType;
List<File> _files = [];
@override
void initState() {
super.initState();
_editingController = TextEditingController();
}
@override
void dispose() {
_editingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
bodyColor: Colors.white,
title: '家政服务',
body: ListView(
children: [
HouseHeadCard(context: context),
_getType(),
_buildReportCard(),
_addImages(),
],
),
bottomNavi: BottomButton(
onPressed: _canSubmit(_selectType, _editingController.text)
? () async {
VoidCallback cancel = BotToast.showLoading();
try {
List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadHouseKeepingPhotos);
bool result = await HouseKeepingFunc.submitHouseKeeping(
UserTool.appProveider.selectedHouse!.estateId,
_selectType! + 1,
_editingController.text,
urls);
if (result) {
Get.off(() => HouseKeepingSubmitPage());
} else
BotToast.showText(text: '提交失败');
} catch (e) {
LoggerData.addData(e);
}
cancel();
}
: () {
BotToast.showText(text: '请填写完整服务信息!');
},
child: '确认提交'.text.black.bold.size(32.sp).make(),
),
);
}
Widget _getType() {
return Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'请选择服务类型'.text.black.size(28.sp).make(),
24.w.heightBox,
Row(
children: <Widget>[
...List.generate(
_buttons.length,
(index) => BeeCheckButton(
groupValue: _selectType,
onChange: (value) {
_selectType = index;
setState(() {});
},
title: _buttons[index],
value: index,
)),
].sepWidget(separate: 20.w.widthBox),
),
16.w.heightBox,
],
),
);
}
Widget _buildReportCard() {
return Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'请输入服务内容'.text.black.size(28.sp).make(),
24.w.heightBox,
Container(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: Color(0xFFD4CFBE), width: 1.w)),
constraints: BoxConstraints(
minHeight: 304.w,
),
width: 686.w,
child: TextField(
controller: _editingController,
onChanged: (value) {
setState(() {});
},
maxLines: 10,
minLines: 5,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请简要描述一下你要告知我的事情,以便于我们更好的处理……',
hintStyle: TextStyle(color: ktextSubColor, fontSize: 28.sp),
contentPadding: EdgeInsets.zero,
),
),
),
],
),
);
}
Widget _addImages() {
return Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'添加图片信息(${_files.length}/9)'.text.black.size(28.sp).make(),
24.w.heightBox,
GridImagePicker(onChange: (files) {
_files = files;
setState(() {});
})
],
),
);
}
bool _canSubmit(int? seletType, String text) {
if (seletType == null) {
return false;
} else if (text.isEmpty) {
return false;
} else {
return true;
}
}
}

@ -0,0 +1,40 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/others/finish_result_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class HouseKeepingSubmitPage extends StatefulWidget {
HouseKeepingSubmitPage({Key? key}) : super(key: key);
@override
_HouseKeepingSubmitPageState createState() => _HouseKeepingSubmitPageState();
}
class _HouseKeepingSubmitPageState extends State<HouseKeepingSubmitPage> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '家政服务',
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
76.w.heightBox,
FinishResultImage(status: true),
48.w.heightBox,
'提交成功'.text.black.size(36.sp).make(),
16.w.heightBox,
'您的家政服务已受理预计36小时内完成'
.text
.size(26.sp)
.color(ktextSubColor)
.maxLines(2)
.make(),
],
),
),
);
}
}

@ -4,12 +4,12 @@ import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/utils/headers.dart';
class BeeCheckButton<T> extends StatefulWidget {
final Function(T value)? onChange;
final T? value;
final T? groupValue;
final String? title;
final Function(T value) onChange;
final T value;
final T groupValue;
final String title;
BeeCheckButton(
{Key? key, this.onChange, this.value, this.groupValue, this.title})
{Key? key, required this.onChange, required this.value, required this.groupValue, required this.title})
: super(key: key);
@override
@ -22,9 +22,9 @@ class _BeeCheckButtonState extends State<BeeCheckButton> {
Widget build(BuildContext context) {
return MaterialButton(
onPressed: () {
widget.onChange!(widget.value);
widget.onChange(widget.value);
},
child: widget.title!.text
child: widget.title.text
.color(isSelect ? ktextPrimary : Color(0xFF979797))
.size(32.sp)
.make(),

@ -8,7 +8,7 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/profile/house/pick_my_house_page.dart';
import 'package:aku_community/utils/headers.dart';
@Deprecated('use HouseHeadCard instead')
class BeeHousePicker extends StatelessWidget {
const BeeHousePicker({Key? key}) : super(key: key);

Loading…
Cancel
Save