Browse Source

1.商户充值次数限制更改;

2.门店列表无数据时显示,根据公司已有三个城市设置,ip地址超出公司所在城市外,显示当前位置无法获取,手动选择更改位置;
3.地图坐标错误更改,服务端是:高德地图坐标,故应用端根据该坐标转换为百度地图坐标即可;
4.坐标转换方法更改;
5.商户充值接口数据类型更改;
6.导航页新增百度地图底部选择弹窗;
dev
huixiang_app 1 year ago
parent
commit
b2d9062f93
  1. 10
      lib/mine/mine_shop_recharge.dart
  2. 1
      lib/mine/mine_view/mine_item.dart
  3. 18
      lib/retrofit/data/member_recharge_list.dart
  4. 67
      lib/union/location_map_page.dart
  5. 5
      lib/union/union_list.dart
  6. 6
      lib/utils/flutter_utils.dart

10
lib/mine/mine_shop_recharge.dart

@ -92,10 +92,10 @@ class _MineShopRecharge extends State<MineShopRecharge> {
vipCard = baseData.data; vipCard = baseData.data;
} }
} finally { } finally {
if(isSingle) if (isSingle)
setState((){}); setState(() {});
else else
addLoadCount(); addLoadCount();
} }
} }
@ -617,7 +617,9 @@ class _MineShopRecharge extends State<MineShopRecharge> {
), ),
TextSpan( TextSpan(
text: 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( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontFamily: 'JDZhengHT', fontFamily: 'JDZhengHT',

1
lib/mine/mine_view/mine_item.dart

@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';

18
lib/retrofit/data/member_recharge_list.dart

@ -20,7 +20,7 @@ class MemberRechargeList {
String id, String id,
String rechargeMoney, String rechargeMoney,
String giftdMoney, String giftdMoney,
num limitNum, dynamic limitNum,
dynamic gitfdCouponId, dynamic gitfdCouponId,
dynamic startDate, dynamic startDate,
dynamic endDate, dynamic endDate,
@ -31,8 +31,8 @@ class MemberRechargeList {
num isDeleted, num isDeleted,
num rechargeType, num rechargeType,
String remark, String remark,
num sortValue, num sortValue,
num useNum,}){ dynamic useNum,}){
_id = id; _id = id;
_rechargeMoney = rechargeMoney; _rechargeMoney = rechargeMoney;
_giftdMoney = giftdMoney; _giftdMoney = giftdMoney;
@ -72,7 +72,7 @@ class MemberRechargeList {
String _id; String _id;
String _rechargeMoney; String _rechargeMoney;
String _giftdMoney; String _giftdMoney;
num _limitNum; dynamic _limitNum;
dynamic _gitfdCouponId; dynamic _gitfdCouponId;
dynamic _startDate; dynamic _startDate;
dynamic _endDate; dynamic _endDate;
@ -84,11 +84,11 @@ class MemberRechargeList {
num _rechargeType; num _rechargeType;
String _remark; String _remark;
num _sortValue; num _sortValue;
num _useNum; dynamic _useNum;
MemberRechargeList copyWith({ String id, MemberRechargeList copyWith({ String id,
String rechargeMoney, String rechargeMoney,
String giftdMoney, String giftdMoney,
num limitNum, dynamic limitNum,
dynamic gitfdCouponId, dynamic gitfdCouponId,
dynamic startDate, dynamic startDate,
dynamic endDate, dynamic endDate,
@ -100,7 +100,7 @@ MemberRechargeList copyWith({ String id,
num rechargeType, num rechargeType,
String remark, String remark,
num sortValue, num sortValue,
num useNum, dynamic useNum,
}) => MemberRechargeList( id: id ?? _id, }) => MemberRechargeList( id: id ?? _id,
rechargeMoney: rechargeMoney ?? _rechargeMoney, rechargeMoney: rechargeMoney ?? _rechargeMoney,
giftdMoney: giftdMoney ?? _giftdMoney, giftdMoney: giftdMoney ?? _giftdMoney,
@ -121,7 +121,7 @@ MemberRechargeList copyWith({ String id,
String get id => _id; String get id => _id;
String get rechargeMoney => _rechargeMoney; String get rechargeMoney => _rechargeMoney;
String get giftdMoney => _giftdMoney; String get giftdMoney => _giftdMoney;
num get limitNum => _limitNum; dynamic get limitNum => _limitNum;
dynamic get gitfdCouponId => _gitfdCouponId; dynamic get gitfdCouponId => _gitfdCouponId;
dynamic get startDate => _startDate; dynamic get startDate => _startDate;
dynamic get endDate => _endDate; dynamic get endDate => _endDate;
@ -133,7 +133,7 @@ MemberRechargeList copyWith({ String id,
num get rechargeType => _rechargeType; num get rechargeType => _rechargeType;
String get remark => _remark; String get remark => _remark;
num get sortValue => _sortValue; num get sortValue => _sortValue;
num get useNum => _useNum; dynamic get useNum => _useNum;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};

67
lib/union/location_map_page.dart

@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.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/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -72,10 +72,10 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
myAddress = result.locationDetail; myAddress = result.locationDetail;
myCity = result.city; myCity = result.city;
if (distance == null) calculate(); if (distance == null) calculate();
AppUtils.coordConvert(myLatLng).then((value) { // AppUtils.coordConvert(myLatLng).then((value) {
this.myLatLng = value; // this.myLatLng = value;
locationShow(); locationShow();
}); // });
Location.getInstance().stopLocation(); Location.getInstance().stopLocation();
} }
}); });
@ -420,19 +420,19 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
BMFCoordinate startCoord = BMFCoordinate( BMFCoordinate startCoord = BMFCoordinate(
positionSorta == false positionSorta == false
? myLatLng.latitude ? myLatLng.latitude
: double.tryParse(widget.arguments["lat"]), : latLng.latitude,
positionSorta == false positionSorta == false
? myLatLng.longitude ? myLatLng.longitude
: double.tryParse(widget.arguments["lng"])); : latLng.longitude);
String startName = ((positionSorta == false) ? "我的位置" : "终点"); String startName = ((positionSorta == false) ? "我的位置" : "终点");
// //
String endName = ((positionSorta == false) ? "终点" : "我的位置"); String endName = ((positionSorta == false) ? "终点" : "我的位置");
BMFCoordinate endCoord = BMFCoordinate( BMFCoordinate endCoord = BMFCoordinate(
positionSorta == false positionSorta == false
? double.tryParse(widget.arguments["lat"]) ? latLng.latitude
: myLatLng.latitude, : myLatLng.latitude,
positionSorta == false positionSorta == false
? double.tryParse(widget.arguments["lng"]) ? latLng.longitude
: myLatLng.longitude); : myLatLng.longitude);
BMFOpenRouteOption routeOption = BMFOpenRouteOption( BMFOpenRouteOption routeOption = BMFOpenRouteOption(
startCoord: startCoord, startCoord: startCoord,
@ -471,7 +471,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
? 'assets/image/traffic_texture_unknown.png' ? 'assets/image/traffic_texture_unknown.png'
: 'assets/image/traffic_texture_smooth.png' : 'assets/image/traffic_texture_smooth.png'
], ],
width: Platform.isAndroid ? 16 :10, width: Platform.isAndroid ? 16 : 10,
lineDashType: BMFLineDashType.LineDashTypeNone, lineDashType: BMFLineDashType.LineDashTypeNone,
lineCapType: BMFLineCapType.LineCapButt, lineCapType: BMFLineCapType.LineCapButt,
lineJoinType: BMFLineJoinType.LineJoinRound); lineJoinType: BMFLineJoinType.LineJoinRound);
@ -544,8 +544,8 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0) ? BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)
: latLng); : latLng);
BMFPlanNode to = BMFPlanNode( BMFPlanNode to = BMFPlanNode(
cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity, // cityName: positionSorta == false ? (storeInfo?.city ?? "") : myCity,
name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress, // name: positionSorta == false ? (storeInfo?.address ?? "") : myAddress,
pt: positionSorta == false pt: positionSorta == false
? latLng ? latLng
: BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0)); : BMFCoordinate(myLatLng?.latitude ?? 0, myLatLng?.longitude ?? 0));
@ -1072,7 +1072,7 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
onTap: () { onTap: () {
setState(() { setState(() {
navigationState = 1; navigationState = 1;
onOpenBaiduMapRoute(); showMapSelect();
}); });
}, },
child: Container( child: Container(
@ -1105,6 +1105,41 @@ class _LocationMap extends State<LocationMap> 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<Widget> itemServer(String businessService) { List<Widget> itemServer(String businessService) {
if (businessService == null || businessService == "") return []; if (businessService == null || businessService == "") return [];
var list = businessService.split(","); var list = businessService.split(",");
@ -1152,10 +1187,10 @@ class _LocationMap extends State<LocationMap> with WidgetsBindingObserver {
} }
addMarker() async { addMarker() async {
// latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]),
// double.tryParse(widget.arguments["lng"]))); double.tryParse(widget.arguments["lng"])));
latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), // latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]),
double.tryParse(widget.arguments["lng"])); // double.tryParse(widget.arguments["lng"]));
if (bmfMarker == null && _mapController != null) { if (bmfMarker == null && _mapController != null) {
bmfMarker = BMFMarker.icon( bmfMarker = BMFMarker.icon(

5
lib/union/union_list.dart

@ -102,9 +102,10 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
? NoDataView( ? NoDataView(
src: "assets/image/di_zhi.webp", src: "assets/image/di_zhi.webp",
isShowBtn: false, isShowBtn: false,
text: "暂无店铺列表~", text: ((widget.city??"") != "武汉" && (widget.city??"") != "郑州" && (widget.city??"") != "北京") ?
" 当前回乡开放门店 仅包含 武汉/北京/郑州,您当前的位置无法获取,请手动更换城市" :"暂无店铺列表~",
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h), margin: EdgeInsets.only(top: 120.h,left:45.w,right:45.w),
) )
: ListView.builder( : ListView.builder(
itemCount: storeList.length, itemCount: storeList.length,

6
lib/utils/flutter_utils.dart

@ -78,12 +78,12 @@ class AppUtils {
return resString; return resString;
} }
/// ///()
static Future<BMFCoordinate> coordConvert(BMFCoordinate latLng) async { static Future<BMFCoordinate> coordConvert(BMFCoordinate latLng) async {
return BMFCalculateUtils.coordConvert( return BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
fromType: BMF_COORD_TYPE.BD09LL, fromType: BMF_COORD_TYPE.COMMON,
toType: BMF_COORD_TYPE.COMMON); toType: BMF_COORD_TYPE.BD09LL);
} }
static bool isPhone(mobile) { static bool isPhone(mobile) {

Loading…
Cancel
Save