From b2d9062f93be378810fadf77e99ee46501dbd61e Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Fri, 8 Sep 2023 17:44:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=95=86=E6=88=B7=E5=85=85=E5=80=BC=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=E9=99=90=E5=88=B6=E6=9B=B4=E6=94=B9=EF=BC=9B=202.?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=88=97=E8=A1=A8=E6=97=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=A0=B9=E6=8D=AE=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E5=B7=B2=E6=9C=89=E4=B8=89=E4=B8=AA=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8Cip=E5=9C=B0=E5=9D=80=E8=B6=85?= =?UTF-8?q?=E5=87=BA=E5=85=AC=E5=8F=B8=E6=89=80=E5=9C=A8=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E5=A4=96=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=EF=BC=8C=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E9=80=89=E6=8B=A9=E6=9B=B4=E6=94=B9=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=9B=203.=E5=9C=B0=E5=9B=BE=E5=9D=90=E6=A0=87=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=9B=B4=E6=94=B9=EF=BC=8C=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E6=98=AF=EF=BC=9A=E9=AB=98=E5=BE=B7=E5=9C=B0=E5=9B=BE=E5=9D=90?= =?UTF-8?q?=E6=A0=87=EF=BC=8C=E6=95=85=E5=BA=94=E7=94=A8=E7=AB=AF=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=AF=A5=E5=9D=90=E6=A0=87=E8=BD=AC=E6=8D=A2=E4=B8=BA?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E5=9C=B0=E5=9B=BE=E5=9D=90=E6=A0=87=E5=8D=B3?= =?UTF-8?q?=E5=8F=AF=EF=BC=9B=204.=E5=9D=90=E6=A0=87=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=9B=B4=E6=94=B9=EF=BC=9B=205.=E5=95=86?= =?UTF-8?q?=E6=88=B7=E5=85=85=E5=80=BC=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=9B=B4=E6=94=B9=EF=BC=9B=206.=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E9=A1=B5=E6=96=B0=E5=A2=9E=E7=99=BE=E5=BA=A6=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=BA=95=E9=83=A8=E9=80=89=E6=8B=A9=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mine_shop_recharge.dart | 10 +-- lib/mine/mine_view/mine_item.dart | 1 - lib/retrofit/data/member_recharge_list.dart | 18 +++--- lib/union/location_map_page.dart | 67 ++++++++++++++++----- lib/union/union_list.dart | 5 +- lib/utils/flutter_utils.dart | 6 +- 6 files changed, 72 insertions(+), 35 deletions(-) diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart index cdf8e95e..3699879a 100644 --- a/lib/mine/mine_shop_recharge.dart +++ b/lib/mine/mine_shop_recharge.dart @@ -92,10 +92,10 @@ class _MineShopRecharge extends State { vipCard = baseData.data; } } finally { - if(isSingle) - setState((){}); + if (isSingle) + setState(() {}); else - addLoadCount(); + addLoadCount(); } } @@ -617,7 +617,9 @@ class _MineShopRecharge extends State { ), TextSpan( text: - "${AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100))))}元", + "${((memberRechargeList?.limitNum ?? 0) != 0 && ((memberRechargeList?.limitNum ?? 0) - (memberRechargeList?.useNum ?? 0) <= 0)) ? + (AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)) : + (AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100)))))}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index e2ecbdf2..6cb1fd39 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -1,6 +1,5 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; diff --git a/lib/retrofit/data/member_recharge_list.dart b/lib/retrofit/data/member_recharge_list.dart index 30c207d0..0fa2db51 100644 --- a/lib/retrofit/data/member_recharge_list.dart +++ b/lib/retrofit/data/member_recharge_list.dart @@ -20,7 +20,7 @@ class MemberRechargeList { String id, String rechargeMoney, String giftdMoney, - num limitNum, + dynamic limitNum, dynamic gitfdCouponId, dynamic startDate, dynamic endDate, @@ -31,8 +31,8 @@ class MemberRechargeList { num isDeleted, num rechargeType, String remark, - num sortValue, - num useNum,}){ + num sortValue, + dynamic useNum,}){ _id = id; _rechargeMoney = rechargeMoney; _giftdMoney = giftdMoney; @@ -72,7 +72,7 @@ class MemberRechargeList { String _id; String _rechargeMoney; String _giftdMoney; - num _limitNum; + dynamic _limitNum; dynamic _gitfdCouponId; dynamic _startDate; dynamic _endDate; @@ -84,11 +84,11 @@ class MemberRechargeList { num _rechargeType; String _remark; num _sortValue; - num _useNum; + dynamic _useNum; MemberRechargeList copyWith({ String id, String rechargeMoney, String giftdMoney, - num limitNum, + dynamic limitNum, dynamic gitfdCouponId, dynamic startDate, dynamic endDate, @@ -100,7 +100,7 @@ MemberRechargeList copyWith({ String id, num rechargeType, String remark, num sortValue, - num useNum, + dynamic useNum, }) => MemberRechargeList( id: id ?? _id, rechargeMoney: rechargeMoney ?? _rechargeMoney, giftdMoney: giftdMoney ?? _giftdMoney, @@ -121,7 +121,7 @@ MemberRechargeList copyWith({ String id, String get id => _id; String get rechargeMoney => _rechargeMoney; String get giftdMoney => _giftdMoney; - num get limitNum => _limitNum; + dynamic get limitNum => _limitNum; dynamic get gitfdCouponId => _gitfdCouponId; dynamic get startDate => _startDate; dynamic get endDate => _endDate; @@ -133,7 +133,7 @@ MemberRechargeList copyWith({ String id, num get rechargeType => _rechargeType; String get remark => _remark; num get sortValue => _sortValue; - num get useNum => _useNum; + dynamic get useNum => _useNum; Map toJson() { final map = {}; diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 311fb466..7cfbffc5 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:ui'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; @@ -12,7 +13,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/location.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -72,10 +72,10 @@ class _LocationMap extends State with WidgetsBindingObserver { myAddress = result.locationDetail; myCity = result.city; if (distance == null) calculate(); - AppUtils.coordConvert(myLatLng).then((value) { - this.myLatLng = value; + // AppUtils.coordConvert(myLatLng).then((value) { + // this.myLatLng = value; locationShow(); - }); + // }); Location.getInstance().stopLocation(); } }); @@ -420,19 +420,19 @@ class _LocationMap extends State with WidgetsBindingObserver { BMFCoordinate startCoord = BMFCoordinate( positionSorta == false ? myLatLng.latitude - : double.tryParse(widget.arguments["lat"]), + : latLng.latitude, positionSorta == false ? myLatLng.longitude - : double.tryParse(widget.arguments["lng"])); + : latLng.longitude); String startName = ((positionSorta == false) ? "我的位置" : "终点"); // 去的位置 String endName = ((positionSorta == false) ? "终点" : "我的位置"); BMFCoordinate endCoord = BMFCoordinate( positionSorta == false - ? double.tryParse(widget.arguments["lat"]) + ? latLng.latitude : myLatLng.latitude, positionSorta == false - ? double.tryParse(widget.arguments["lng"]) + ? latLng.longitude : myLatLng.longitude); BMFOpenRouteOption routeOption = BMFOpenRouteOption( startCoord: startCoord, @@ -471,7 +471,7 @@ class _LocationMap extends State with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: Platform.isAndroid ? 16 :10, + width: Platform.isAndroid ? 16 : 10, lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); @@ -544,8 +544,8 @@ class _LocationMap extends State with WidgetsBindingObserver { ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) : latLng); BMFPlanNode to = BMFPlanNode( - cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, - name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, + // cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, + // name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, pt: positionSorta == false ? latLng : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); @@ -1072,7 +1072,7 @@ class _LocationMap extends State with WidgetsBindingObserver { onTap: () { setState(() { navigationState = 1; - onOpenBaiduMapRoute(); + showMapSelect(); }); }, child: Container( @@ -1105,6 +1105,41 @@ class _LocationMap extends State with WidgetsBindingObserver { ); } + showMapSelect() { + showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + actions: [ + CupertinoActionSheetAction( + child: Text( + "百度地图", + style: TextStyle( + fontWeight: MyFontWeight.regular, + ), + ), + onPressed: () { + onOpenBaiduMapRoute(); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(S.of(context).quxiao, + style: TextStyle( + color: Colors.blue, + ),), + isDestructiveAction: true, + ), + ); + }); + } + List itemServer(String businessService) { if (businessService == null || businessService == "") return []; var list = businessService.split(","); @@ -1152,10 +1187,10 @@ class _LocationMap extends State with WidgetsBindingObserver { } addMarker() async { - // latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), - // double.tryParse(widget.arguments["lng"]))); - latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"])); + latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]))); + // latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), + // double.tryParse(widget.arguments["lng"])); if (bmfMarker == null && _mapController != null) { bmfMarker = BMFMarker.icon( diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 111b6821..173bc4ef 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -102,9 +102,10 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { ? NoDataView( src: "assets/image/di_zhi.webp", isShowBtn: false, - text: "暂无店铺列表~", + text: ((widget.city??"") != "武汉" && (widget.city??"") != "郑州" && (widget.city??"") != "北京") ? + " 当前回乡开放门店 仅包含 武汉/北京/郑州,您当前的位置无法获取,请手动更换城市" :"暂无店铺列表~", fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + margin: EdgeInsets.only(top: 120.h,left:45.w,right:45.w), ) : ListView.builder( itemCount: storeList.length, diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 4e53bdb5..f9257c79 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -78,12 +78,12 @@ class AppUtils { return resString; } - ///坐标系转换 + ///坐标系转换(高德转百度) static Future coordConvert(BMFCoordinate latLng) async { return BMFCalculateUtils.coordConvert( coordinate: latLng, - fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON); + fromType: BMF_COORD_TYPE.COMMON, + toType: BMF_COORD_TYPE.BD09LL); } static bool isPhone(mobile) {