diff --git a/lib/constants/api.dart b/lib/constants/api.dart index c4b036ca..4c9e6e2e 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -124,6 +124,9 @@ class _Manager { ///物品出户:提交物品出户信息 String get articleOutSubmit => '/user/articleOut/submit'; + + ///物品出户:查询二维码信息 + String get getQRcode => '/user/articleOut/getQRCode'; } class _Community { diff --git a/lib/model/manager/article_QR_code_model.dart b/lib/model/manager/article_QR_code_model.dart new file mode 100644 index 00000000..33421476 --- /dev/null +++ b/lib/model/manager/article_QR_code_model.dart @@ -0,0 +1,51 @@ +class ArticleQRModel { + AppArticleOutQRCodeVo appArticleOutQRCodeVo; + String message; + bool status; + + ArticleQRModel({this.appArticleOutQRCodeVo, this.message, this.status}); + + ArticleQRModel.fromJson(Map json) { + appArticleOutQRCodeVo = json['appArticleOutQRCodeVo'] != null + ? new AppArticleOutQRCodeVo.fromJson(json['appArticleOutQRCodeVo']) + : null; + message = json['message']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + if (this.appArticleOutQRCodeVo != null) { + data['appArticleOutQRCodeVo'] = this.appArticleOutQRCodeVo.toJson(); + } + data['message'] = this.message; + data['status'] = this.status; + return data; + } +} + +class AppArticleOutQRCodeVo { + int id; + int residentId; + String residentName; + String effectiveTime; + + AppArticleOutQRCodeVo( + {this.id, this.residentId, this.residentName, this.effectiveTime}); + + AppArticleOutQRCodeVo.fromJson(Map json) { + id = json['id']; + residentId = json['residentId']; + residentName = json['residentName']; + effectiveTime = json['effectiveTime']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['residentId'] = this.residentId; + data['residentName'] = this.residentName; + data['effectiveTime'] = this.effectiveTime; + return data; + } +} diff --git a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart index bdd58129..2dc408c9 100644 --- a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart +++ b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart @@ -1,9 +1,14 @@ // Flutter imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/model/manager/article_QR_code_model.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:flutter_icons/flutter_icons.dart'; +import 'package:provider/provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; // Project imports: @@ -13,21 +18,22 @@ import 'package:akuCommunity/widget/dotted_line.dart'; class DetoCodePage extends StatelessWidget { final int id; - const DetoCodePage({Key key, this.id}) : super(key: key); + final ArticleQRModel model; + const DetoCodePage({Key key, this.id, this.model}) : super(key: key); - Widget _header() { + Widget _header(String estateName) { return Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - '宁波华茂悦峰', + kEstateName, style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)), ), SizedBox(height: 10.w), Text( - '1幢-1单元-702室', + estateName, style: TextStyle(fontSize: 26.sp, color: Color(0xffffffff)), ), ], @@ -35,7 +41,7 @@ class DetoCodePage extends StatelessWidget { ); } - Widget _card() { + Widget _card(String name, String effectiveTime) { return Container( decoration: BoxDecoration( color: Color(0xffffffff), @@ -73,7 +79,7 @@ class DetoCodePage extends StatelessWidget { ), SizedBox(width: 10.w), Text( - '马成泽先生', + '$name先生', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -87,7 +93,7 @@ class DetoCodePage extends StatelessWidget { ), SizedBox(height: 13.w), Text( - '有限时间:2020年6月30日', + '有效时间:$effectiveTime', style: TextStyle( fontSize: 26.sp, color: Color(0xff999999), @@ -104,18 +110,18 @@ class DetoCodePage extends StatelessWidget { alignment: Alignment.center, child: Column( children: [ - Text( - '020-598-230', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 36.sp, - color: Color(0xff333333), - ), - ), - SizedBox(height: 11.w), + // Text( + // '020-598-230', + // style: TextStyle( + // fontWeight: FontWeight.w600, + // fontSize: 36.sp, + // color: Color(0xff333333), + // ), + // ), + // SizedBox(height: 11.w), QrImage( padding: EdgeInsets.zero, - data: '智慧社区开门码', + data: model.appArticleOutQRCodeVo.id.toString(), size: 260.w, ), ], @@ -140,6 +146,7 @@ class DetoCodePage extends StatelessWidget { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '出户二维码', body: Container( @@ -149,9 +156,11 @@ class DetoCodePage extends StatelessWidget { Column( children: [ SizedBox(height: 192.w - kToolbarHeight), - _header(), + _header(BeeParse.getEstateName( + userProvider.userDetailModel.estateNames[0])), SizedBox(height: 32.w), - _card(), + _card(model.appArticleOutQRCodeVo.residentName, + model.appArticleOutQRCodeVo.effectiveTime), ], ), ], diff --git a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart index c07c23da..f7ea5812 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart @@ -1,4 +1,8 @@ // Flutter imports: +import 'package:akuCommunity/model/manager/article_QR_code_model.dart'; +import 'package:akuCommunity/pages/manager_func.dart'; +import 'package:akuCommunity/utils/network/base_model.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -91,12 +95,18 @@ class GoodsInfoCardButton extends StatelessWidget { .keys .map((index) => Expanded( child: InkWell( - onTap: () { + onTap: () async { switch (_listButton[index]['title']) { case '查看二维码': - DetoCodePage( - id: id, - ).to(); + ArticleQRModel _model = await ManagerFunc.getQRcode(id); + if (_model.status) { + DetoCodePage( + id: id, + model: _model + ).to(); + } else { + BotToast.showText(text: _model.message); + } break; case '搬家公司': if (tel.isEmptyOrNull) { diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index a67718e0..6c42d929 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -1,4 +1,5 @@ // Package imports: +import 'package:akuCommunity/model/manager/article_QR_code_model.dart'; import 'package:akuCommunity/model/manager/moving_company_model.dart'; import 'package:dio/dio.dart'; import 'package:flustars/flustars.dart'; @@ -119,11 +120,22 @@ class ManagerFunc { 'weight': weight, 'approach': approach, 'movingCompanyTel': tel, - 'expectedTime': DateUtil.formatDateStr(time,format: "yyyy-MM-dd HH:mm:ss"), + 'expectedTime': + DateUtil.formatDateStr(time, format: "yyyy-MM-dd HH:mm:ss"), 'imgUrls': urls, }, showMessage: true, ); return baseModel; } + + static Future getQRcode(int id) async { + Response response = await NetUtil().dio.get( + API.manager.getQRcode, + queryParameters: { + 'articleOutId': id, + }, + ); + return ArticleQRModel.fromJson(response.data); + } } diff --git a/lib/ui/manager/visitor/visitor_passport_page.dart b/lib/ui/manager/visitor/visitor_passport_page.dart index ea524c4f..c0d440a0 100644 --- a/lib/ui/manager/visitor/visitor_passport_page.dart +++ b/lib/ui/manager/visitor/visitor_passport_page.dart @@ -130,7 +130,6 @@ class _VisitorPassportPageState extends State { .make(), ], ), - //TODO 二维码显示 ).centered(), ], ).box.color(Color(0xFF333333)).make(),