diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index a58751ba..e685f4d5 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -40,6 +40,7 @@ class UserProvider extends ChangeNotifier { await appProvider.updateHouses(await HouseFunc.passedHouses); WebSocketUtil().setUser(userInfoModel!.id.toString()); WebSocketUtil().startWebSocket(); + AppProvider().setFireAlert(true); notifyListeners(); } catch (e) { LoggerData.addData(e); diff --git a/lib/ui/profile/house/contract_pay_page.dart b/lib/ui/profile/house/contract_pay_page.dart index 28d090ea..ab771b72 100644 --- a/lib/ui/profile/house/contract_pay_page.dart +++ b/lib/ui/profile/house/contract_pay_page.dart @@ -76,11 +76,14 @@ class _ContractPayPageState extends State { bottomNavi: BottomButton( child: '点击支付'.text.size(32.sp).bold.color(ktextPrimary).make(), onPressed: () async { - String code = await HouseFunc().leaseAlipay(widget.id, 1, 0.01); - bool result = - await PayUtil().callAliPay(code, API.pay.leaseCheckAlipay); - if (result) { - Get.off(() => PayFinishPage()); + String code = await HouseFunc() + .leaseAlipay(widget.id, 1, _model!.margin.toDouble()); + if (code.isNotEmpty) { + bool result = + await PayUtil().callAliPay(code, API.pay.leaseCheckAlipay); + if (result) { + Get.off(() => PayFinishPage()); + } } }, ), diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 2cf77c4a..e335a10a 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -77,7 +77,7 @@ class HouseFunc { BaseFileModel baseFileModel = await NetUtil().upload(API.upload.uploadCardFront, file); if (baseFileModel.status ?? false) { - return baseFileModel.url!; + return baseFileModel.url??''; } else { return ''; } @@ -88,7 +88,7 @@ class HouseFunc { BaseFileModel baseFileModel = await NetUtil().upload(API.upload.uploadCardBack, file); if (baseFileModel.status ?? false) { - return baseFileModel.url!; + return baseFileModel.url??''; } else { return ''; } @@ -124,7 +124,7 @@ class HouseFunc { ); if (baseFileModel.status ?? false) { BotToast.showText(text: baseFileModel.message!); - return baseFileModel.url!; + return baseFileModel.url??''; } else { BotToast.showText(text: baseFileModel.message!); return ''; @@ -152,7 +152,7 @@ class HouseFunc { BaseFileModel baseModel = await NetUtil().upload(API.upload.uploadFormalContract, file); if (baseModel.status ?? false) { - return baseModel.url!; + return baseModel.url??''; } else { return ''; } @@ -178,7 +178,7 @@ class HouseFunc { "payPrice": price, }); if (baseModel.status ?? false) { - return baseModel.message!; + return baseModel.message??''; } else { return ''; } diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index b0dccd47..9ae984a0 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -169,12 +169,14 @@ class _HouseOwnersPageState extends State { crossAxisSpacing: 32.w, children: [ _cardBuild( - R.ASSETS_IMAGES_PLACEHOLDER_WEBP, '缴费查询', '查看租金及保证金情况', () {}), + R.ASSETS_ICONS_PAY_PNG, '缴费查询', '查看租金及保证金情况', () {}), _cardBuild( - R.ASSETS_IMAGES_PLACEHOLDER_WEBP, '合同变更', '变更合同信息、重新签约', () {}), + R.ASSETS_ICONS_CHANGE_PNG, '合同变更', '变更合同信息、重新签约', () {}), _cardBuild( - R.ASSETS_IMAGES_PLACEHOLDER_WEBP, '合同续签', '到期前线上办理续签手续', () {}), - _cardBuild(R.ASSETS_IMAGES_PLACEHOLDER_WEBP, '合同终止', '线上申请终止合同', () {}) + R.ASSETS_ICONS_CONTRACT_PNG, '合同续签', '到期前线上办理续签手续', () {}), + _cardBuild(R.ASSETS_ICONS_FINISH_PNG, '合同终止', '线上申请终止合同', () { + + }) ], ); } diff --git a/lib/ui/profile/house/upload_contracts_page.dart b/lib/ui/profile/house/upload_contracts_page.dart index 97ba372d..8fac562b 100644 --- a/lib/ui/profile/house/upload_contracts_page.dart +++ b/lib/ui/profile/house/upload_contracts_page.dart @@ -1,15 +1,13 @@ import 'dart:io'; import 'package:aku_community/base/base_style.dart'; -import 'package:aku_community/painters/upload_painter.dart'; import 'package:aku_community/ui/profile/house/contract_pay_page.dart'; import 'package:aku_community/ui/profile/house/house_func.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_image_picker.dart'; +import 'package:aku_community/widget/others/upload_widget.dart'; import 'package:aku_community/widget/views/doc_view.dart'; import 'package:bot_toast/bot_toast.dart'; -import 'package:dotted_border/dotted_border.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -37,7 +35,12 @@ class _UploadContractsPageState extends State { padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), children: [ 100.w.heightBox, - _uploadWidget(), + UploadWidget( + sheetTitle: '选择合同照片', + onPressed: (file) { + _files.add(file); + setState(() {}); + }), 64.w.heightBox, Padding( padding: EdgeInsets.symmetric(horizontal: 60.w), @@ -92,12 +95,13 @@ class _UploadContractsPageState extends State { bottomNavi: BottomButton( onPressed: () async { Function cancel = BotToast.showLoading(); - await _files.map((e) async { - String result = await HouseFunc().uploadFormalContract(e); + _urls.clear(); + for (var item in _files) { + String result = await HouseFunc().uploadFormalContract(item); if (result.isNotEmpty) { _urls.add(result); } - }); + } bool result = await HouseFunc().submitFormalContract(widget.id, _urls); if (result) { @@ -110,53 +114,4 @@ class _UploadContractsPageState extends State { child: '提交审核'.text.size(32.sp).color(ktextPrimary).bold.make()), ); } - - Widget _uploadWidget() { - return GestureDetector( - onTap: () async { - File? _file = await BeeImagePicker.pick(title: '选择合同照片'); - if (_file != null) { - _files.add(_file); - setState(() {}); - } - }, - child: Center( - child: DottedBorder( - dashPattern: [6, 4], - child: Container( - width: 500.w, - height: 500.w, - color: Color(0x19C4C4C4), - alignment: Alignment.center, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 87.w.heightBox, - SizedBox( - width: 200.w, - height: 200.w, - child: CustomPaint( - painter: UploadPainter(), - ), - ), - 43.w.heightBox, - '点击上传文件' - .text - .size(32.sp) - .color(Color(0xFFADB2C4)) - .bold - .make(), - 43.w.heightBox, - '仅支持PDF、PNG、JPG格式的文件' - .text - .size(28.sp) - .color(Color(0x999999)) - .make(), - ], - ), - )), - ), - ); - } } diff --git a/lib/ui/profile/house/upload_empty_form_page.dart b/lib/ui/profile/house/upload_empty_form_page.dart new file mode 100644 index 00000000..c96a31bf --- /dev/null +++ b/lib/ui/profile/house/upload_empty_form_page.dart @@ -0,0 +1,25 @@ +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; + +class UploadEmptyFormPage extends StatefulWidget { + UploadEmptyFormPage({Key? key}) : super(key: key); + + @override + _UploadEmptyFormPageState createState() => _UploadEmptyFormPageState(); +} + +class _UploadEmptyFormPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '联系物业', + body: Center( + child: Column( + children: [ + + ], + ), + ), + ); + } +} diff --git a/lib/widget/others/upload_widget.dart b/lib/widget/others/upload_widget.dart new file mode 100644 index 00000000..ee86a8f5 --- /dev/null +++ b/lib/widget/others/upload_widget.dart @@ -0,0 +1,64 @@ +import 'dart:io'; + +import 'package:aku_community/painters/upload_painter.dart'; +import 'package:aku_community/widget/picker/bee_image_picker.dart'; +import 'package:dotted_border/dotted_border.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class UploadWidget extends StatelessWidget { + final String sheetTitle; + final Function(File file) onPressed; + const UploadWidget( + {Key? key, required this.sheetTitle, required this.onPressed}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () async { + File? _file = await BeeImagePicker.pick(title: sheetTitle); + if (_file != null) { + onPressed(_file); + } + }, + child: Center( + child: DottedBorder( + dashPattern: [6, 4], + child: Container( + width: 500.w, + height: 500.w, + color: Color(0x19C4C4C4), + alignment: Alignment.center, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 87.w.heightBox, + SizedBox( + width: 200.w, + height: 200.w, + child: CustomPaint( + painter: UploadPainter(), + ), + ), + 40.w.heightBox, + '点击上传文件' + .text + .size(32.sp) + .color(Color(0xFFADB2C4)) + .bold + .make(), + 40.w.heightBox, + '仅支持PDF、PNG、JPG格式的文件' + .text + .size(28.sp) + .color(Color(0xFFADB2C4)) + .make(), + ], + ), + )), + ), + ); + } +}