From e521e66e9fa708e7955fbe656cd17f0e5433ce0a Mon Sep 17 00:00:00 2001 From: datang Date: Mon, 16 May 2022 10:02:59 +0800 Subject: [PATCH 1/4] push --- lib/constants/profile_api.dart | 2 +- lib/generated_plugin_registrant.dart | 1 - lib/main.dart | 2 +- .../facility_preorder_date_picker.dart | 7 ++-- .../facility/facility_preorder_page.dart | 33 ++++++++++++------- .../work_order/history_report_page.dart | 2 +- lib/widget/picker/bee_day_picker.dart | 2 +- pubspec.lock | 18 +++++----- 8 files changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/constants/profile_api.dart b/lib/constants/profile_api.dart index 54fce71a..297552a5 100644 --- a/lib/constants/profile_api.dart +++ b/lib/constants/profile_api.dart @@ -22,7 +22,7 @@ class _MyHouse { class _MyFamily { ///查询房屋当前成员 - String get myFamilyMember => '/app/user/myFamily/findCurrentMembers'; + String get myFamilyMember => '/app/user/myFamily/findCurrentMembers'; ///查询当前用户的审核列表 String get myFamilyExamine => '/app/user/myFamily/findCurrentUserApply'; diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index 366ed6c3..8398580d 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -4,7 +4,6 @@ // ignore_for_file: directives_ordering // ignore_for_file: lines_longer_than_80_chars -// ignore_for_file: depend_on_referenced_packages import 'package:audio_session/audio_session_web.dart'; import 'package:device_info_plus_web/device_info_plus_web.dart'; diff --git a/lib/main.dart b/lib/main.dart index 774eb5ea..46763728 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -52,7 +52,7 @@ class _MyAppState extends State { } }, child: MediaQuery( - data: MediaQueryData.fromWindow(WidgetsBinding.instance.window), + data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window), child: ScreenUtilInit( designSize: Size(750, 1334), // minTextAdapt: true, diff --git a/lib/ui/community/facility/facility_preorder_date_picker.dart b/lib/ui/community/facility/facility_preorder_date_picker.dart index 4f4fb5c7..68a47bc6 100644 --- a/lib/ui/community/facility/facility_preorder_date_picker.dart +++ b/lib/ui/community/facility/facility_preorder_date_picker.dart @@ -36,12 +36,13 @@ class _FacilityPreorderDatePickerState List _selectIndex = []; + @override Widget build(BuildContext context) { return BeeChooseDatePicker( height: 700.h, onPressed: () { - Get.back(); + Get.back(result: _selectIndex); }, body: Container( height: 600.h, @@ -82,7 +83,7 @@ class _FacilityPreorderDatePickerState return GestureDetector( onTap: () { print(getNum(start)+index); - if(!models.contains(getNum(start)+index)||start.add(Duration(minutes: 30 * index)).isAfter(DateTime.now())){ + if(!models.contains(getNum(start)+index)||isPass(start.add(Duration(minutes: 30 * index)))){ if (_selectIndex.contains(index)) { _selectIndex.remove(index); } else { @@ -97,7 +98,7 @@ class _FacilityPreorderDatePickerState BeeCheckRadio( value: index, groupValue: _selectIndex, - canCheck: models.contains(getNum(start)+index), + canCheck: models.contains(getNum(start)+index)||isPass(start.add(Duration(minutes: 30 * index))), ), 30.wb, Text( diff --git a/lib/ui/community/facility/facility_preorder_page.dart b/lib/ui/community/facility/facility_preorder_page.dart index f76b0016..a43a640e 100644 --- a/lib/ui/community/facility/facility_preorder_page.dart +++ b/lib/ui/community/facility/facility_preorder_page.dart @@ -47,23 +47,29 @@ class _FacilityPreorderPageState extends State { final userProvider = Provider.of(context); return BeeScaffold( title: '添加预订', - bodyColor: Colors.white, systemStyle: SystemStyle.yellowBottomBar, body: ListView( padding: EdgeInsets.symmetric(vertical: 32.w), children: [ - Text('业主房屋').pSymmetric(h: 32.w), - ListTile( - leading: Image.asset( - R.ASSETS_ICONS_HOUSE_PNG, - height: 60.w, - width: 60.w, + Container( + color: Colors.white, + child:ListTile( + leading: Image.asset( + R.ASSETS_ICONS_HOUSE_PNG, + height: 60.w, + width: 60.w, + ), + onTap: () => Get.to(() => AdviceHousePage()), + title: Text(S.of(context)!.tempPlotName), + subtitle: Text(userProvider.defaultHouse!.addressName), + trailing: Icon(CupertinoIcons.chevron_forward), ), - onTap: () => Get.to(() => AdviceHousePage()), - title: Text(S.of(context)!.tempPlotName), - subtitle: Text(userProvider.defaultHouse!.addressName), - trailing: Icon(CupertinoIcons.chevron_forward), ), + + + + Text('业主房屋').pSymmetric(h: 32.w), + BeeDivider( indent: 32.w, endIndent: 32.w, @@ -99,9 +105,12 @@ class _FacilityPreorderPageState extends State { height: 120.w, onPressed: () async { DateTime? date = await BeeDayPicker.pick(DateTime.now()); - await Get.bottomSheet(FacilityPreorderDatePicker(typeModel: widget.typeModel,)); + print(date); if (date != null) { startDate = date; + Get.bottomSheet(FacilityPreorderDatePicker(typeModel: widget.typeModel,)); + List dateList=FacilityPreorderDatePicker(typeModel: widget.typeModel) as List; + print(dateList); setState(() {}); } }, diff --git a/lib/ui/function_and_service/work_order/history_report_page.dart b/lib/ui/function_and_service/work_order/history_report_page.dart index 382e8433..157549c7 100644 --- a/lib/ui/function_and_service/work_order/history_report_page.dart +++ b/lib/ui/function_and_service/work_order/history_report_page.dart @@ -106,7 +106,7 @@ class _LineCardState extends State { @override void didChangeDependencies() { - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { _height = context.size?.height ?? 0; print(context.size?.height); setState(() {}); diff --git a/lib/widget/picker/bee_day_picker.dart b/lib/widget/picker/bee_day_picker.dart index a944735d..78270ef2 100644 --- a/lib/widget/picker/bee_day_picker.dart +++ b/lib/widget/picker/bee_day_picker.dart @@ -55,7 +55,7 @@ class __BeeDayPickerState extends State<_BeeDayPicker> { Widget build(BuildContext context) { return BeeChooseDatePicker( onPressed: () async{ - Get.back(); + Get.back(result: _date); // await FacilityPreorderDatePicker(); }, body: CupertinoDatePicker( diff --git a/pubspec.lock b/pubspec.lock index 048266e0..81551d49 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -245,7 +245,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.16.0" + version: "1.15.0" color: dependency: transitive description: @@ -408,7 +408,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.2.0" ffi: dependency: transitive description: @@ -717,7 +717,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.4" + version: "0.6.3" json_annotation: dependency: "direct main" description: @@ -787,7 +787,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.3" meta: dependency: transitive description: @@ -892,7 +892,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" path_drawing: dependency: transitive description: @@ -1172,7 +1172,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.8.1" sqflite: dependency: transitive description: @@ -1235,7 +1235,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.8" time: dependency: transitive description: @@ -1340,7 +1340,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" velocity_x: dependency: "direct main" description: @@ -1405,5 +1405,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.17.0-0 <3.0.0" + dart: ">=2.15.0 <3.0.0" flutter: ">=2.8.0" From a693c81e918741243166ee9e124055c780d33f37 Mon Sep 17 00:00:00 2001 From: datang Date: Mon, 16 May 2022 18:14:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=BE=E6=96=BD=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .fvm/fvm_config.json | 2 +- .../facility/facility_appointment_model.dart | 16 +- lib/models/test.dart | 20 ++ lib/models/test.g.dart | 11 + lib/provider/user_provider.dart | 3 +- .../my_house/my_family_member_list_model.dart | 4 +- .../my_family_member_list_model.g.dart | 2 +- .../facility/facility_appointment_card.dart | 107 ++++-- .../facility_preorder_date_picker.dart | 38 ++- .../facility/facility_preorder_page.dart | 314 +++++++++--------- lib/ui/profile/new_house/member_view.dart | 2 +- 11 files changed, 323 insertions(+), 196 deletions(-) create mode 100644 lib/models/test.dart create mode 100644 lib/models/test.g.dart diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json index d4e14b2a..b8e6b4ff 100644 --- a/.fvm/fvm_config.json +++ b/.fvm/fvm_config.json @@ -1,4 +1,4 @@ { - "flutterSdkVersion": "3.0.0", + "flutterSdkVersion": "2.8.1", "flavors": {} } \ No newline at end of file diff --git a/lib/models/facility/facility_appointment_model.dart b/lib/models/facility/facility_appointment_model.dart index 9411e159..179d50ac 100644 --- a/lib/models/facility/facility_appointment_model.dart +++ b/lib/models/facility/facility_appointment_model.dart @@ -40,11 +40,11 @@ class FacilityAppointmentModel { Color get statusColor { switch (status) { case 1: - return kPrimaryColor; + return kBalckSubColor; case 2: - return Color(0xFF2576E5); + return kDarkPrimaryColor; case 3: - return Color(0xFFFB4702); + return kDangerColor; case 4: return Color(0xFF999999); case 5: @@ -57,15 +57,15 @@ class FacilityAppointmentModel { String get statusValue { switch (status) { case 1: - return '预约成功'; + return '待签到'; case 2: - return '签到成功'; + return '使用中'; case 3: - return '预约作废'; + return '超时作废'; case 4: - return '已取消'; + return '取消预约'; case 5: - return '已结束'; + return '使用结束'; default: return '未知状态'; } diff --git a/lib/models/test.dart b/lib/models/test.dart new file mode 100644 index 00000000..77462aa9 --- /dev/null +++ b/lib/models/test.dart @@ -0,0 +1,20 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; + +part 'test.g.dart'; + +@JsonSerializable() +class Test extends Equatable { + final int id; + + factory Test.fromJson(Map json) => _$TestFromJson(json); + + @override + List get props => [ + id, + ]; + + const Test({ + required this.id, + }); +} diff --git a/lib/models/test.g.dart b/lib/models/test.g.dart new file mode 100644 index 00000000..180ef7d1 --- /dev/null +++ b/lib/models/test.g.dart @@ -0,0 +1,11 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'test.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Test _$TestFromJson(Map json) => Test( + id: json['id'] as int, + ); diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 9a047d2a..07135df7 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -123,7 +123,8 @@ class UserProvider extends ChangeNotifier { '栋' + _defaultHouse!.unitName + '单元' + - _defaultHouse!.estateName; + _defaultHouse!.estateName + + '室'; } } diff --git a/lib/saas_model/my_house/my_family_member_list_model.dart b/lib/saas_model/my_house/my_family_member_list_model.dart index 81ccad45..7978c0dd 100644 --- a/lib/saas_model/my_house/my_family_member_list_model.dart +++ b/lib/saas_model/my_house/my_family_member_list_model.dart @@ -31,7 +31,7 @@ class Member { final int id; final String name; final int identity; - final List avatarImgList; + final List imgList; factory Member.fromJson(Map json) => _$MemberFromJson(json); @@ -39,6 +39,6 @@ class Member { required this.id, required this.name, required this.identity, - required this.avatarImgList, + required this.imgList, }); } diff --git a/lib/saas_model/my_house/my_family_member_list_model.g.dart b/lib/saas_model/my_house/my_family_member_list_model.g.dart index c1d940ba..0ec59a5f 100644 --- a/lib/saas_model/my_house/my_family_member_list_model.g.dart +++ b/lib/saas_model/my_house/my_family_member_list_model.g.dart @@ -23,7 +23,7 @@ Member _$MemberFromJson(Map json) => Member( id: json['id'] as int, name: json['name'] as String, identity: json['identity'] as int, - avatarImgList: (json['avatarImgList'] as List) + imgList: (json['imgList'] as List) .map((e) => ImgModel.fromJson(e as Map)) .toList(), ); diff --git a/lib/ui/community/facility/facility_appointment_card.dart b/lib/ui/community/facility/facility_appointment_card.dart index 2aaf7ec0..98276e5f 100644 --- a/lib/ui/community/facility/facility_appointment_card.dart +++ b/lib/ui/community/facility/facility_appointment_card.dart @@ -1,3 +1,4 @@ +import 'package:aku_new_community/ui/community/facility/pick_facility_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -36,11 +37,16 @@ class FacilityAppointmentCard extends StatelessWidget { Text( name, style: TextStyle( - color: ktextSubColor, + color: ktextThirdColor, ), ), Spacer(), - Text(subTitle), + Text( + subTitle, + style: TextStyle( + color: ktextSubColor, + ), + ), ], ); } @@ -57,13 +63,17 @@ class FacilityAppointmentCard extends StatelessWidget { bool inTime = diffTime >= 0 && diffTime <= 30; if (inTime) button = _FacilityButton( + bold: true, onPressed: () async { var result = await BeeQR.scan(); if (result != null) { final cancel = BotToast.showLoading(); await NetUtil().get( SAASAPI.facilities.signIn, - params: {'appointmentCode': result}, + params: { + 'facilitiesReserveId': model.id, + 'appointmentCode': result + }, showMessage: true, ); cancel(); @@ -74,6 +84,9 @@ class FacilityAppointmentCard extends StatelessWidget { ); else button = _FacilityButton( + outline: true, + border: true, + bold: true, onPressed: () async { bool? result = await Get.dialog( CupertinoAlertDialog( @@ -95,7 +108,7 @@ class FacilityAppointmentCard extends StatelessWidget { final cancel = BotToast.showLoading(); await NetUtil().get( SAASAPI.facilities.cancel, - params: {'facilitiesAppointmentId': model.id}, + params: {'facilitiesReserveId': model.id}, showMessage: true, ); cancel(); @@ -107,11 +120,12 @@ class FacilityAppointmentCard extends StatelessWidget { break; case 2: button = _FacilityButton( + bold: true, onPressed: () async { final cancel = BotToast.showLoading(); await NetUtil().get( SAASAPI.facilities.useStop, - params: {'facilitiesAppointmentId': model.id}, + params: {'facilitiesReserveId': model.id}, showMessage: true, ); cancel(); @@ -120,24 +134,62 @@ class FacilityAppointmentCard extends StatelessWidget { text: '使用结束', ); break; - default: - button = SizedBox(); + button = _FacilityButton( + outline: true, + border: true, + bold: true, + textColor: ktextSubColor, + onPressed: () async { + await Get.to(() => PickFacilityPage()); + }, + text: '重新预约', + ); } - return Row( - children: [ - if (showTip) - Text( - '请在预约时间前30分钟内到场扫码', - style: TextStyle( - color: ktextSubColor, - fontSize: 24.sp, - ), - ), - Spacer(), - button, - ], - ); + return model.status == 3 + ? Column( + children: [ + Container( + color: Colors.black12.withOpacity(0.25), + padding: EdgeInsets.all(10.w), + child: Text( + '作废原因:${model.nullifyReason??''}', + style: TextStyle( + color: Colors.black.withOpacity(0.8), + fontSize: 24.sp, + ), + ), + ), + Row( + children: [ + if (showTip) + Text( + '请在预约时间前30分钟内到场扫码', + style: TextStyle( + color: ktextSubColor, + fontSize: 24.sp, + ), + ), + Spacer(), + button, + ], + ), + ], + ) + : Row( + children: [ + if (showTip) + Text( + '请在预约时间前30分钟内到场扫码', + style: TextStyle( + color: ktextThirdColor, + fontSize: 24.sp, + ), + ), + Spacer(), + button, + ], + ); } @override @@ -202,6 +254,8 @@ class _FacilityButton extends StatelessWidget { final VoidCallback onPressed; final String text; final bool outline; + final bool border; + final bool bold; const _FacilityButton({ Key? key, @@ -210,13 +264,21 @@ class _FacilityButton extends StatelessWidget { required this.text, this.outline = false, this.textColor = ktextPrimary, + this.border = false, + this.bold = false, }) : super(key: key); @override Widget build(BuildContext context) { return MaterialButton( color: outline ? null : color, - shape: StadiumBorder(), + shape: border + ? StadiumBorder( + side: BorderSide( + width: 1, + color: Colors.grey, + )) + : StadiumBorder(), elevation: 0, height: 60.w, minWidth: 168.w, @@ -225,6 +287,7 @@ class _FacilityButton extends StatelessWidget { child: Text( text, style: TextStyle( + fontWeight: bold?FontWeight.bold:FontWeight.normal, color: textColor, fontSize: 26.sp, ), diff --git a/lib/ui/community/facility/facility_preorder_date_picker.dart b/lib/ui/community/facility/facility_preorder_date_picker.dart index 68a47bc6..0b8f57c9 100644 --- a/lib/ui/community/facility/facility_preorder_date_picker.dart +++ b/lib/ui/community/facility/facility_preorder_date_picker.dart @@ -14,6 +14,15 @@ import '../../../utils/network/base_model.dart'; import '../../../utils/network/net_util.dart'; import '../../../widget/buttons/bee_check_radio.dart'; +class FacilityPreorderDate { + static Future> choose( + FacilityTypeDetailModel typeModel, + ) async { + return await Get.bottomSheet( + FacilityPreorderDatePicker(typeModel: typeModel)); + } +} + class FacilityPreorderDatePicker extends StatefulWidget { FacilityTypeDetailModel typeModel; @@ -35,14 +44,15 @@ class _FacilityPreorderDatePickerState List models = []; List _selectIndex = []; - + List _selectDates = []; @override Widget build(BuildContext context) { return BeeChooseDatePicker( height: 700.h, onPressed: () { - Get.back(result: _selectIndex); + Get.back(result: _selectDates); + //print(_selectDates); }, body: Container( height: 600.h, @@ -77,17 +87,20 @@ class _FacilityPreorderDatePickerState 'todayDate': DateTime.now(), }); if (model.success) { - models = (model.data as List).toList(); + models = (model.data as List); } }; return GestureDetector( onTap: () { - print(getNum(start)+index); - if(!models.contains(getNum(start)+index)||isPass(start.add(Duration(minutes: 30 * index)))){ + //print(getNum(start)+index); + if (!models.contains(getNum(start) + index) || + isPass(start.add(Duration(minutes: 30 * index)))) { if (_selectIndex.contains(index)) { _selectIndex.remove(index); + _selectDates.remove(getNum(start) + index); } else { _selectIndex.add(index); + _selectDates.add(getNum(start) + index); } } setState(() {}); @@ -98,7 +111,8 @@ class _FacilityPreorderDatePickerState BeeCheckRadio( value: index, groupValue: _selectIndex, - canCheck: models.contains(getNum(start)+index)||isPass(start.add(Duration(minutes: 30 * index))), + canCheck: models.contains(getNum(start) + index) || + isPass(start.add(Duration(minutes: 30 * index))), ), 30.wb, Text( @@ -115,7 +129,7 @@ class _FacilityPreorderDatePickerState .size(30.sp) .color(Colors.black.withOpacity(0.45)) .make() - : models.contains(getNum(start)+index) + : models.contains(getNum(start) + index) ? '已被他人预约' .text .size(30.sp) @@ -128,14 +142,14 @@ class _FacilityPreorderDatePickerState } } -bool isPass(DateTime date){ - if(date.hour _FacilityPreorderPageState(); } class _FacilityPreorderPageState extends State { - DateTime? startDate; - DateTime? endDate; + List dateList = []; + DateTime? date; - bool get canTap => startDate != null && endDate != null; + bool get canTap => dateList.isNotEmpty; @override Widget build(BuildContext context) { final userProvider = Provider.of(context); return BeeScaffold( - title: '添加预订', + title: '添加预约', systemStyle: SystemStyle.yellowBottomBar, body: ListView( - padding: EdgeInsets.symmetric(vertical: 32.w), + padding: EdgeInsets.symmetric(vertical: 20.w), children: [ Container( + padding: EdgeInsets.all(10.w), color: Colors.white, - child:ListTile( - leading: Image.asset( - R.ASSETS_ICONS_HOUSE_PNG, - height: 60.w, - width: 60.w, + child: ListTile( + leading: BeeAvatarWidget( + width: 90.w, + height: 90.w, + imgs: UserTool.userProvider.userInfoModel!.imgList, ), onTap: () => Get.to(() => AdviceHousePage()), - title: Text(S.of(context)!.tempPlotName), - subtitle: Text(userProvider.defaultHouse!.addressName), - trailing: Icon(CupertinoIcons.chevron_forward), - ), - ), - - - - Text('业主房屋').pSymmetric(h: 32.w), - - BeeDivider( - indent: 32.w, - endIndent: 32.w, - ), - 32.hb, - Text('选择设施').pSymmetric(h: 32.w), - ListTile( - leading: Image.asset( - R.ASSETS_ICONS_FACILITY_PNG, - height: 60.w, - width: 60.w, + title: Text( + UserTool.userProvider.userInfoModel!.name!, + style: TextStyle( + fontSize: 30.sp, + ), + ), + subtitle: Text( + '租户 ' + + userProvider.defaultHouse!.communityName + + userProvider.defaultHouseString, + style: TextStyle( + color: Colors.black.withOpacity(0.45), + fontSize: 26.sp, + ), + ), + trailing: Icon( + CupertinoIcons.chevron_forward, + size: 35.w, + color: Colors.black.withOpacity(0.25), + ), ), - onTap: () async {await Get.to(() => - FacilityTypeDetailPage(facilityModel: widget.facilityModel)); - setState(() {}); - }, - title: Text(S.of(context)!.tempPlotName), - subtitle: Text(widget.typeModel.name), - trailing: Icon(CupertinoIcons.chevron_forward), - ), - BeeDivider( - indent: 32.w, - endIndent: 32.w, ), - 32.hb, - Text('预约时间').pSymmetric(h: 32.w), - SizedBox( - height: 120.w, - child: Row( + 20.hb, + Container( + padding: EdgeInsets.all(40.w), + color: Colors.white, + child: Column( children: [ - MaterialButton( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - height: 120.w, - onPressed: () async { - DateTime? date = await BeeDayPicker.pick(DateTime.now()); - print(date); - if (date != null) { - startDate = date; - Get.bottomSheet(FacilityPreorderDatePicker(typeModel: widget.typeModel,)); - List dateList=FacilityPreorderDatePicker(typeModel: widget.typeModel) as List; - print(dateList); - setState(() {}); - } + GestureDetector( + onTap: () async { + await Get.to(() => FacilityTypeDetailPage( + facilityModel: widget.facilityModel)); + setState(() {}); }, - child: Text( - startDate == null - ? '请选择开始时间' - : DateUtil.formatDate( - startDate, - format: 'yyyy/MM/dd', - ), - style: TextStyle( - color: ktextSubColor, + child: Material( + color: Colors.transparent, + child: Row( + children: [ + SizedBox( + width: 170.w, + child: '选择设施' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.50)) + .make(), + ), + '${widget.typeModel.name}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + Spacer(), + Icon( + CupertinoIcons.chevron_right, + size: 35.w, + color: Colors.black.withOpacity(0.25), + ), + ], ), ), - ).expand(), - Icon(Icons.arrow_forward), - MaterialButton( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - height: 120.w, - onPressed: () async { - DateTime? date = await BeeDatePicker.pick( - startDate == null - ? DateTime.now().add(Duration(minutes: 90)) - : startDate!.add(Duration(minutes: 30)), - min: startDate == null - ? DateTime.now().add(Duration(minutes: 60)) - : startDate!.add(Duration(minutes: 30)), - max: startDate == null - ? DateTime.now().add(Duration(days: 2)) - : (startDate!).add(Duration(days: 2)), - mode: CupertinoDatePickerMode.dateAndTime, - ); + ), + 30.hb, + BeeDivider(), + 30.hb, + GestureDetector( + onTap: () async { + date = await BeeDayPicker.pick(DateTime.now()); if (date != null) { - endDate = date; + dateList = + await FacilityPreorderDate.choose(widget.typeModel); + dateList.sort(); setState(() {}); } }, - child: Text( - endDate == null - ? '请选择结束时间' - : DateUtil.formatDate( - endDate, - format: 'yyyy-MM-dd HH:mm', - ), - style: TextStyle( - color: ktextSubColor, + child: Material( + color: Colors.transparent, + child: Row( + children: [ + SizedBox( + width: 170.w, + child: '预约时间' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.50)) + .make(), + ), + date != null + ? '${DateUtil.formatDate(date, format: 'yyyy/MM/dd')} ${dateString(dateList)}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make() + : '请选择预约时段' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + Spacer(), + Icon( + CupertinoIcons.chevron_right, + size: 35.w, + color: Colors.black.withOpacity(0.25), + ), + ], ), ), - ).expand(), + ), ], ), ), - BeeDivider( - indent: 32.w, - endIndent: 32.w, - ), ], ), - bottomNavi: BottomButton( - onPressed: canTap - ? () async { - // if (dateDifferenceIsTrue) { - final cancel = BotToast.showLoading(); - var model = await NetUtil().post( - SAASAPI.facilities.insert, - params: { - 'estateId': userProvider.defaultHouse!.id, - 'type':widget.facilityModel.type, - 'facilitiesCategoryId':widget.facilityModel.id, - 'facilitiesManageId':widget.typeModel.id, - 'appointmentDate':1, - 'appointmentPeriodList':1, - }, - ); - cancel(); - if (model.success == true) { - BotToast.showText(text: '预约成功'); - Get.back(result: true); - } else if (model.msg == '该时段已被预约') { - await Get.dialog(_hasBeenOrder()); - } else { - BotToast.showText(text: '预约失败'); + bottomNavi: Padding( + padding: EdgeInsets.only( + left: 32.w, + right: 32.w, + bottom: MediaQuery.of(context).padding.bottom + 32.w), + child: BeeLongButton( + onPressed: canTap + ? () async { + // if (dateDifferenceIsTrue) { + final cancel = BotToast.showLoading(); + var model = await NetUtil().post( + SAASAPI.facilities.insert, + params: { + 'estateId': userProvider.defaultHouse!.id, + 'type': widget.facilityModel.type, + 'facilitiesCategoryId': widget.facilityModel.id, + 'facilitiesManageId': widget.typeModel.id, + 'appointmentDate': DateUtil.formatDate(date,format: 'yyyy-MM-dd HH:mm:ss'), + 'appointmentPeriodList': dateList, + }, + ); + cancel(); + if (model.success == true) { + BotToast.showText(text: '预约成功'); + Get.back(result: true); + } else if (model.msg == '该时段已被预约') { + await Get.dialog(_hasBeenOrder()); + } else { + BotToast.showText(text: '预约失败'); + } + // } else { + // BotToast.showText(text: '预约时间必须为半小时的整数倍'); + // } } - // } else { - // BotToast.showText(text: '预约时间必须为半小时的整数倍'); - // } - } - : null, - child: Text('确认提交'), + : null, + text: '确认提交', + ), ), ); } - bool get dateDifferenceIsTrue { - if (startDate != null && endDate != null) { - int _diff = endDate!.difference(startDate!).inMinutes; - if (_diff < 30) { - return false; - } else if (_diff % 30 != 0) { - return false; - } - return true; - } - return false; - } - Widget _hasBeenOrder() { return CupertinoAlertDialog( title: '此设施已被预约' @@ -241,8 +245,8 @@ class _FacilityPreorderPageState extends State { '取消'.text.size(30.sp).color(ktextPrimary).isIntrinsic.make()), CupertinoActionSheetAction( onPressed: () { - Get.off( - () => FacilityOrderDateListPage(facilitiesId: widget.typeModel.id)); + Get.off(() => + FacilityOrderDateListPage(facilitiesId: widget.typeModel.id)); }, child: '查看'.text.size(30.sp).color(kPrimaryColor).isIntrinsic.make()), @@ -250,3 +254,17 @@ class _FacilityPreorderPageState extends State { ); } } + +DateTime getDate(int dateNum) { + DateTime startDate = DateTime( + DateTime.now().year, DateTime.now().month, DateTime.now().day, 0, 0, 0); + return startDate.add(Duration(minutes: 30 * (dateNum - 1))); +} + +String dateString(List dates){ + if(dates.length==1) + return '${DateUtil.formatDate(getDate(dates.first), format: 'HH:mm')}-${DateUtil.formatDate(getDate(dates.first).add(Duration(minutes: 30)), format: 'HH:mm')}'; + else{ + return '${DateUtil.formatDate(getDate(dates.first), format: 'HH:mm')}-${DateUtil.formatDate(getDate(dates.first).add(Duration(minutes: 30)), format: 'HH:mm')}等'; + } +} \ No newline at end of file diff --git a/lib/ui/profile/new_house/member_view.dart b/lib/ui/profile/new_house/member_view.dart index bcd11ec3..41569d91 100644 --- a/lib/ui/profile/new_house/member_view.dart +++ b/lib/ui/profile/new_house/member_view.dart @@ -82,7 +82,7 @@ class _MemberViewState extends State { crossAxisCount: 4, children: [ ...model.members - .map((e) => _avatar(e.avatarImgList,Identify.values[e.identity], e.name)) + .map((e) => _avatar(e.imgList,Identify.values[e.identity], e.name)) .toList() ], shrinkWrap: true, From cae0380d42885c717814baf9a0d2db654961d1e5 Mon Sep 17 00:00:00 2001 From: datang Date: Tue, 17 May 2022 10:16:51 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=AE=BE=E6=96=BD=E9=A2=84=E7=BA=A6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facility/facility_appointment_card.dart | 7 +++- .../facility_preorder_date_picker.dart | 40 +++++++++++++------ .../facility/facility_type_card.dart | 16 +++++--- .../facility/facility_type_detail_card.dart | 13 ++++-- 4 files changed, 55 insertions(+), 21 deletions(-) diff --git a/lib/ui/community/facility/facility_appointment_card.dart b/lib/ui/community/facility/facility_appointment_card.dart index 98276e5f..8b045a30 100644 --- a/lib/ui/community/facility/facility_appointment_card.dart +++ b/lib/ui/community/facility/facility_appointment_card.dart @@ -150,7 +150,11 @@ class FacilityAppointmentCard extends StatelessWidget { ? Column( children: [ Container( - color: Colors.black12.withOpacity(0.25), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.w), + color: Color(0xFFF9F9F9), + ), + width: double.infinity, padding: EdgeInsets.all(10.w), child: Text( '作废原因:${model.nullifyReason??''}', @@ -160,6 +164,7 @@ class FacilityAppointmentCard extends StatelessWidget { ), ), ), + 20.hb, Row( children: [ if (showTip) diff --git a/lib/ui/community/facility/facility_preorder_date_picker.dart b/lib/ui/community/facility/facility_preorder_date_picker.dart index 0b8f57c9..02f9478a 100644 --- a/lib/ui/community/facility/facility_preorder_date_picker.dart +++ b/lib/ui/community/facility/facility_preorder_date_picker.dart @@ -41,11 +41,36 @@ class _FacilityPreorderDatePickerState getNum(widget.typeModel.openStartDT!), (index) => index + 1); DateTime? start; - List models = []; + List models = []; List _selectIndex = []; List _selectDates = []; + _load() async { + BaseModel model = + await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: { + 'facilitiesManageId': widget.typeModel.id, + 'todayDate': DateTime.now(), + }); + if (model.success) { + models = (model.data as List); + print(models); + } + setState(() { + + }); + } + + @override + void initState() { + Future.delayed( + Duration.zero, + () => setState(() { + _load(); + })); + super.initState(); + } + @override Widget build(BuildContext context) { return BeeChooseDatePicker( @@ -80,16 +105,7 @@ class _FacilityPreorderDatePickerState Widget _datesList(int index) { DateTime start = widget.typeModel.openStartDT!; - () async { - BaseModel model = - await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: { - 'facilitiesManageId': widget.typeModel.id, - 'todayDate': DateTime.now(), - }); - if (model.success) { - models = (model.data as List); - } - }; + return GestureDetector( onTap: () { //print(getNum(start)+index); @@ -130,7 +146,7 @@ class _FacilityPreorderDatePickerState .color(Colors.black.withOpacity(0.45)) .make() : models.contains(getNum(start) + index) - ? '已被他人预约' + ? '已被预约' .text .size(30.sp) .color(Colors.black.withOpacity(0.45)) diff --git a/lib/ui/community/facility/facility_type_card.dart b/lib/ui/community/facility/facility_type_card.dart index 606d2ab7..ceb6abe2 100644 --- a/lib/ui/community/facility/facility_type_card.dart +++ b/lib/ui/community/facility/facility_type_card.dart @@ -1,3 +1,4 @@ +import 'package:aku_new_community/widget/bee_image_network.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -19,7 +20,7 @@ class FacilityTypeCard extends StatelessWidget { return MaterialButton( color: Colors.white, elevation: 0, - padding: EdgeInsets.all(30.w), + padding: EdgeInsets.all(25.w), clipBehavior: Clip.antiAlias, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.w), @@ -29,13 +30,18 @@ class FacilityTypeCard extends StatelessWidget { Material( borderRadius: BorderRadius.circular(10.w), clipBehavior: Clip.antiAliasWithSaveLayer, - child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: SAASAPI.image(ImgModel.first(model.imgUrls)), + child: BeeImageNetwork( + imgs: model.imgUrls??[], height: 280.w, width: double.infinity, - fit: BoxFit.cover, ), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: SAASAPI.image(ImgModel.first(model.imgUrls)), + // height: 280.w, + // width: double.infinity, + // fit: BoxFit.cover, + // ), ), 24.hb, Row( diff --git a/lib/ui/community/facility/facility_type_detail_card.dart b/lib/ui/community/facility/facility_type_detail_card.dart index d87f0761..4f08a73f 100644 --- a/lib/ui/community/facility/facility_type_detail_card.dart +++ b/lib/ui/community/facility/facility_type_detail_card.dart @@ -9,6 +9,7 @@ import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/utils/headers.dart'; import '../../../models/facility/facility_type_detail_model.dart'; import '../../../models/facility/facility_type_model.dart'; +import '../../../widget/bee_image_network.dart'; import 'facility_preorder_page.dart'; class FacilityTypeDetailCard extends StatelessWidget { @@ -36,13 +37,19 @@ class FacilityTypeDetailCard extends StatelessWidget { Material( borderRadius: BorderRadius.circular(10.w), clipBehavior: Clip.antiAliasWithSaveLayer, - child:FadeInImage.assetNetwork( - placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: SAASAPI.image(ImgModel.first(model.imgList)), + child:BeeImageNetwork( + imgs: model.imgList??[], height: 150.h, width: 200.w, fit: BoxFit.cover, ), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: SAASAPI.image(ImgModel.first(model.imgList)), + // height: 150.h, + // width: 200.w, + // fit: BoxFit.cover, + // ), ), 30.wb, Column( From e996c938585c76838105bef548507e31e56aaaf9 Mon Sep 17 00:00:00 2001 From: datang Date: Tue, 17 May 2022 11:07:48 +0800 Subject: [PATCH 4/4] update --- .fvm/fvm_config.json | 2 +- lib/constants/saas_api.dart | 3 + lib/generated_plugin_registrant.dart | 1 + lib/ui/market/search/submit_order_page.dart | 90 ++++++++++----------- lib/ui/market/shop_car/shop_car_page.dart | 1 - pubspec.lock | 18 ++--- 6 files changed, 56 insertions(+), 59 deletions(-) diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json index b8e6b4ff..d4e14b2a 100644 --- a/.fvm/fvm_config.json +++ b/.fvm/fvm_config.json @@ -1,4 +1,4 @@ { - "flutterSdkVersion": "2.8.1", + "flutterSdkVersion": "3.0.0", "flavors": {} } \ No newline at end of file diff --git a/lib/constants/saas_api.dart b/lib/constants/saas_api.dart index 940adf14..dcf31937 100644 --- a/lib/constants/saas_api.dart +++ b/lib/constants/saas_api.dart @@ -323,6 +323,9 @@ class _Pay { ///创建缴费订单 向支付宝发起订单查询请求 String get livingExpensesOrderCheckAlipay => '/app/user/alipay/livingExpensesOrderCheckAlipay'; + + String get settlement => + '/app/user/shop/cart/settlement'; } class _LifePay { diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index 8398580d..366ed6c3 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -4,6 +4,7 @@ // ignore_for_file: directives_ordering // ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: depend_on_referenced_packages import 'package:audio_session/audio_session_web.dart'; import 'package:device_info_plus_web/device_info_plus_web.dart'; diff --git a/lib/ui/market/search/submit_order_page.dart b/lib/ui/market/search/submit_order_page.dart index 9790176e..5aa3e715 100644 --- a/lib/ui/market/search/submit_order_page.dart +++ b/lib/ui/market/search/submit_order_page.dart @@ -190,57 +190,51 @@ class _SubmitOrderPageState extends State { ), _addressModel != null ? Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), - child: SizedBox( - width: 518.w, - child: Text( - _addressModel!.locationName ?? '', - style: TextStyle( - fontSize: 24.sp, color: ktextPrimary), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), - child: SizedBox( - width: 518.w, - child: Text( - (_addressModel!.addressDetail ?? ''), - style: TextStyle( - fontSize: 32.sp, color: ktextPrimary), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.w, vertical: 6.w), + child: SizedBox( + width: 518.w, + child: Text( + _addressModel!.locationName ?? '', + style: TextStyle( + fontSize: 24.sp, color: ktextPrimary), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text(_addressModel!.name ?? '', - style: TextStyle( - fontSize: 24.sp, - color: ktextPrimary)), - 30.wb, - Text(_addressModel!.tel ?? '', - style: TextStyle( - fontSize: 24.sp, - color: ktextPrimary)), - ], - ), + ), + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.w, vertical: 6.w), + child: SizedBox( + width: 518.w, + child: Text( + (_addressModel!.addressDetail ?? ''), + style: TextStyle( + fontSize: 32.sp, color: ktextPrimary), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), - ], + ), + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.w, vertical: 6.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(_addressModel!.name ?? '', + style: TextStyle( + fontSize: 24.sp, color: ktextPrimary)), + 30.wb, + Text(_addressModel!.tel ?? '', + style: TextStyle( + fontSize: 24.sp, color: ktextPrimary)), + ], + ), ), ], ) diff --git a/lib/ui/market/shop_car/shop_car_page.dart b/lib/ui/market/shop_car/shop_car_page.dart index 185527e4..847099e4 100644 --- a/lib/ui/market/shop_car/shop_car_page.dart +++ b/lib/ui/market/shop_car/shop_car_page.dart @@ -513,7 +513,6 @@ class _ShopCarPageState extends State { _controllers[index].text = (num - 1).toString(); } } - setState(() {}); }, child: Padding( diff --git a/pubspec.lock b/pubspec.lock index 7e80d097..2a354060 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -245,7 +245,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" color: dependency: transitive description: @@ -408,7 +408,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -717,7 +717,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: "direct main" description: @@ -787,7 +787,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: transitive description: @@ -892,7 +892,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -1174,7 +1174,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" sqflite: dependency: transitive description: @@ -1237,7 +1237,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.8" + version: "0.4.9" time: dependency: transitive description: @@ -1342,7 +1342,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" velocity_x: dependency: "direct main" description: @@ -1407,5 +1407,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.8.0"