diff --git a/lib/constants/api.dart b/lib/constants/api.dart index f77d7177..8b124a2b 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -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 { diff --git a/lib/pages/electronic_commerc/electronic_commerc_page.dart b/lib/pages/electronic_commerc/electronic_commerc_page.dart index 3a841dd2..1abb6aa4 100644 --- a/lib/pages/electronic_commerc/electronic_commerc_page.dart +++ b/lib/pages/electronic_commerc/electronic_commerc_page.dart @@ -72,7 +72,7 @@ class _ElectronicCommercPageState extends State _tabs.length, (index) => _onloading ? ListView( - children: [_buildShimmer()], + children: [SizedBox()], ) : ElectronicCommercView( id: _models[index].id, @@ -106,7 +106,7 @@ class _ElectronicCommercPageState extends State 24.hb, VxBox().height(33.w).width(263.w).color(Colors.white).make(), ], - ), + ).expand(), ), Divider( height: 50.w, diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index 27fd59ff..90d7debc 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -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 { 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 { 24.w.heightBox, Row( children: [ - ...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 { AppProvider appProvider = Provider.of(context); return WillPopScope( child: BeeScaffold( + bodyColor: Colors.white, systemStyle: SystemStyle.yellowBottomBar, title: '报事报修', body: ListView( children: [ - _buildHouseCard(), + HouseHeadCard( + context: context, + ), _getType(), _buildReportCard(), _addImages(), diff --git a/lib/ui/manager/house_keeping/add_house_keeping_page.dart b/lib/ui/manager/house_keeping/add_house_keeping_page.dart new file mode 100644 index 00000000..72a0c9cd --- /dev/null +++ b/lib/ui/manager/house_keeping/add_house_keeping_page.dart @@ -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 { + late TextEditingController _editingController; + List _buttons = ['公区保修', '家庭维修']; + int? _selectType; + List _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 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: [ + ...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; + } + } +} diff --git a/lib/ui/manager/house_keeping/house_keeping_submit_page.dart b/lib/ui/manager/house_keeping/house_keeping_submit_page.dart new file mode 100644 index 00000000..0b5caa8b --- /dev/null +++ b/lib/ui/manager/house_keeping/house_keeping_submit_page.dart @@ -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 { + @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(), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widget/buttons/bee_check_button.dart b/lib/widget/buttons/bee_check_button.dart index 01ea917c..d38bfef1 100644 --- a/lib/widget/buttons/bee_check_button.dart +++ b/lib/widget/buttons/bee_check_button.dart @@ -4,12 +4,12 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; class BeeCheckButton 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 { 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(), diff --git a/lib/widget/picker/bee_house_picker.dart b/lib/widget/picker/bee_house_picker.dart index 4f818b3c..910a7f66 100644 --- a/lib/widget/picker/bee_house_picker.dart +++ b/lib/widget/picker/bee_house_picker.dart @@ -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);