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 4799a91a..ec1d52a6 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(); } }); @@ -421,19 +421,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, @@ -472,7 +472,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); @@ -545,8 +545,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)); @@ -1073,7 +1073,7 @@ class _LocationMap extends State with WidgetsBindingObserver { onTap: () { setState(() { navigationState = 1; - onOpenBaiduMapRoute(); + showMapSelect(); }); }, child: Container( @@ -1106,6 +1106,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(","); @@ -1153,10 +1188,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) {