diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 01b98566..a984a42e 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -84,6 +84,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { //判断新人弹窗 // if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) // showNew = true; + } ///邀请成功 diff --git a/lib/main_page.dart b/lib/main_page.dart index f1bb01c9..f6ff558d 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -162,6 +162,7 @@ class _MainPage extends State with WidgetsBindingObserver { queryUserInfo(); + ///App自动更新 appAutoUpdate(); } final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); diff --git a/lib/message/system_details.dart b/lib/message/system_details.dart index 3134f5bb..fdb354fd 100644 --- a/lib/message/system_details.dart +++ b/lib/message/system_details.dart @@ -51,8 +51,7 @@ class _SystemDetails extends State { msgType = widget.arguments["msgType"]; SharedPreferences.getInstance().then((value) { - apiService = - ApiService(Dio(), token: value.getString("token"), context: context); + apiService = ApiService(Dio(), token: value.getString("token"),showLoading: true, context: context); queryMessage(); }); } diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 04157479..51996486 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -78,6 +78,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { super.initState(); querySocialInfo(); queryMsgStats(); + queryCoupon(); // queryCard(); eventBus.on().listen((event) { @@ -118,22 +119,6 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ranks.addAll(rankData.data); } - BaseData> baseData = await apiService.queryCard({ - "centre": true, - "pageNum": 1, - "pageSize": 10, - "searchKey": "", - "state": 1 - }).catchError((error) { - _refreshController.refreshFailed(); - }); - if (baseData != null && baseData.isSuccess) { - couponNum = baseData.data.total; - _refreshController.refreshCompleted(); - } else { - _refreshController.refreshFailed(); - } - BaseData baseDate = await apiService.queryInfo().catchError((onError) { _refreshController.refreshFailed(); @@ -152,8 +137,34 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { // EasyLoading.dismiss(); } + queryCoupon()async{ + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: false, + ); + BaseData> baseData = await apiService.queryCard({ + "centre": true, + "pageNum": 1, + "pageSize": 10, + "searchKey": "", + "state": 1 + }).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + couponNum = baseData.data.total; + _refreshController.refreshCompleted(); + } else { + _refreshController.refreshFailed(); + } + } + _onRefresh() { // queryUserInfo(); + queryCoupon(); querySocialInfo(); queryMsgStats(); } diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index db277842..b12aefda 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -119,6 +119,8 @@ class _OrderDetailPage extends State { setState(() { statusTitle(); }); + }else{ + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); } } @@ -172,7 +174,7 @@ class _OrderDetailPage extends State { ), ///订单取货地址,或, 收货地址 - if(orderInfo != null) + if(orderInfo != null && orderInfo.addressExt != null) OrderAddress( orderStatus, isTakeOut, @@ -521,6 +523,8 @@ class _OrderDetailPage extends State { // Future.delayed(Duration(milliseconds:450), () { queryDetails(); // }); + }else{ + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); } } diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 84d4ac59..c65f5708 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -364,7 +364,7 @@ class _OrderHistoryList extends State ], ), Container( - margin: EdgeInsets.only(left: 12.w), + margin: EdgeInsets.only(left: 12.w,top:3.h), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -614,6 +614,9 @@ class _OrderHistoryList extends State if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("订单取消成功"); _onRefresh(); + }else{ + if(baseData.msg != null) + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); } } diff --git a/lib/retrofit/data/order_product_vo.dart b/lib/retrofit/data/order_product_vo.dart index bb4c5b53..b0c75db1 100644 --- a/lib/retrofit/data/order_product_vo.dart +++ b/lib/retrofit/data/order_product_vo.dart @@ -1,3 +1,5 @@ +import 'package:huixiang/retrofit/data/shoppingCart.dart'; + class OrderProductVOList { OrderProductVOList({ ActInfo actInfo, @@ -17,6 +19,7 @@ class OrderProductVOList { String skuId, String skuImg, String skuNameStr, + List setMealDataList }) { this.actInfo = actInfo; this.additionalComment = additionalComment; @@ -35,6 +38,7 @@ class OrderProductVOList { this.skuId = skuId; this.skuImg = skuImg; this.skuNameStr = skuNameStr; + this.setMealDataList = setMealDataList; } OrderProductVOList.fromJson(dynamic json) { @@ -59,6 +63,9 @@ class OrderProductVOList { this.skuId = json['skuId']; this.skuImg = json['skuImg']; this.skuNameStr = json['skuNameStr']; + this.setMealDataList = []..addAll( + (json['setMealDataList'] as List ?? []) + .map((o) => SetMealDataList.fromJson(o))); } ActInfo actInfo; @@ -78,6 +85,7 @@ class OrderProductVOList { String skuId; String skuImg; String skuNameStr; + List setMealDataList; Map toJson() { @@ -105,6 +113,7 @@ class OrderProductVOList { map['skuId'] = this.skuId; map['skuImg'] = this.skuImg; map['skuNameStr'] = this.skuNameStr; + map['setMealDataList']=this.setMealDataList; return map; } diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 2322df3c..489fd961 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -18,8 +18,8 @@ class ShoppingCart { int selectDiscount; String storeName; String tableId; - List promotionInfoList; - List couponList; + List promotionInfoList; + List couponList; static ShoppingCart fromJson(Map map) { if (map == null) return null; @@ -35,10 +35,10 @@ class ShoppingCart { shoppingCartBean.selectDiscount = map['selectDiscount']; shoppingCartBean.tableId = map['tableId']; shoppingCartBean.promotionInfoList = List()..addAll( - (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBean.fromJson(o)) + (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBeans.fromJson(o)) ); shoppingCartBean.couponList = List()..addAll( - (map['couponList'] as List ?? []).map((o) => CouponListBean.fromJson(o)) + (map['couponList'] as List ?? []).map((o) => CouponListBeans.fromJson(o)) ); return shoppingCartBean; } @@ -308,7 +308,7 @@ class ProductInfoList { /// isMaxPromotion : true /// promotionProuctList : null -class PromotionInfoListBean { +class PromotionInfoListBeans { String id; String createTime; String createUser; @@ -339,43 +339,43 @@ class PromotionInfoListBean { bool isMaxPromotion; dynamic promotionProuctList; - static PromotionInfoListBean fromJson(Map map) { + static PromotionInfoListBeans fromJson(Map map) { if (map == null) return null; - PromotionInfoListBean promotionInfoListBean = PromotionInfoListBean(); - promotionInfoListBean.id = map['id']; - promotionInfoListBean.createTime = map['createTime']; - promotionInfoListBean.createUser = map['createUser']; - promotionInfoListBean.updateTime = map['updateTime']; - promotionInfoListBean.updateUser = map['updateUser']; - promotionInfoListBean.storeId = map['storeId']; - promotionInfoListBean.name = map['name']; - promotionInfoListBean.image = map['image']; - promotionInfoListBean.description = map['description']; - promotionInfoListBean.status = map['status']; - promotionInfoListBean.applyStartTime = map['applyStartTime']; - promotionInfoListBean.applyEndTime = map['applyEndTime']; - promotionInfoListBean.activityStartTime = map['activityStartTime']; - promotionInfoListBean.activityEndTime = map['activityEndTime']; - promotionInfoListBean.doStartTime = map['doStartTime']; - promotionInfoListBean.doEndTime = map['doEndTime']; - promotionInfoListBean.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; - promotionInfoListBean.securityDeposit = map['securityDeposit']; - promotionInfoListBean.tag = map['tag']; - promotionInfoListBean.promotionType = map['promotionType']; - promotionInfoListBean.promotionPlan = map['promotionPlan']; - promotionInfoListBean.promotionDetail = List()..addAll( + PromotionInfoListBeans promotionInfoListBeans = PromotionInfoListBeans(); + promotionInfoListBeans.id = map['id']; + promotionInfoListBeans.createTime = map['createTime']; + promotionInfoListBeans.createUser = map['createUser']; + promotionInfoListBeans.updateTime = map['updateTime']; + promotionInfoListBeans.updateUser = map['updateUser']; + promotionInfoListBeans.storeId = map['storeId']; + promotionInfoListBeans.name = map['name']; + promotionInfoListBeans.image = map['image']; + promotionInfoListBeans.description = map['description']; + promotionInfoListBeans.status = map['status']; + promotionInfoListBeans.applyStartTime = map['applyStartTime']; + promotionInfoListBeans.applyEndTime = map['applyEndTime']; + promotionInfoListBeans.activityStartTime = map['activityStartTime']; + promotionInfoListBeans.activityEndTime = map['activityEndTime']; + promotionInfoListBeans.doStartTime = map['doStartTime']; + promotionInfoListBeans.doEndTime = map['doEndTime']; + promotionInfoListBeans.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; + promotionInfoListBeans.securityDeposit = map['securityDeposit']; + promotionInfoListBeans.tag = map['tag']; + promotionInfoListBeans.promotionType = map['promotionType']; + promotionInfoListBeans.promotionPlan = map['promotionPlan']; + promotionInfoListBeans.promotionDetail = List()..addAll( (map['promotionDetail'] as List ?? []).map((o) => PromotionDetailBean.fromJson(o)) ); - promotionInfoListBean.channels = List()..addAll( + promotionInfoListBeans.channels = List()..addAll( (map['channels'] as List ?? []).map((o) => o.toString()) ); - promotionInfoListBean.isVip = map['isVip']; - promotionInfoListBean.isDelete = map['isDelete']; - promotionInfoListBean.tenantCode = map['tenantCode']; - promotionInfoListBean.canPartake = map['canPartake']; - promotionInfoListBean.isMaxPromotion = map['isMaxPromotion']; - promotionInfoListBean.promotionProuctList = map['promotionProuctList']; - return promotionInfoListBean; + promotionInfoListBeans.isVip = map['isVip']; + promotionInfoListBeans.isDelete = map['isDelete']; + promotionInfoListBeans.tenantCode = map['tenantCode']; + promotionInfoListBeans.canPartake = map['canPartake']; + promotionInfoListBeans.isMaxPromotion = map['isMaxPromotion']; + promotionInfoListBeans.promotionProuctList = map['promotionProuctList']; + return promotionInfoListBeans; } Map toJson() => { @@ -437,7 +437,7 @@ class PromotionInfoListBean { /// isMaxCoupon:true /// productList : null -class CouponListBean { +class CouponListBeans { String id; String storeId; int bizType; @@ -466,35 +466,35 @@ class CouponListBean { bool isEx; - static CouponListBean fromJson(Map map) { + static CouponListBeans fromJson(Map map) { if (map == null) return null; - CouponListBean couponListBean = CouponListBean(); - couponListBean.id = map['id']; - couponListBean.storeId = map['storeId']; - couponListBean.bizType = map['bizType']; - couponListBean.fullAmount = map['fullAmount']; - couponListBean.discountAmount = map['discountAmount']; - couponListBean.fullNumber = map['fullNumber']; - couponListBean.discountPercent = map['discountPercent']; - couponListBean.bizId = map['bizId']; - couponListBean.publishStartTime = map['publishStartTime']; - couponListBean.publishEndTime = map['publishEndTime']; - couponListBean.useStartTime = map['useStartTime']; - couponListBean.useEndTime = map['useEndTime']; - couponListBean.promotionId = map['promotionId']; - couponListBean.mid = map['mid']; - couponListBean.couponId = map['couponId']; - couponListBean.receiveTime = map['receiveTime']; - couponListBean.useTime = map['useTime']; - couponListBean.status = map['status']; - couponListBean.tenantCode = map['tenantCode']; - couponListBean.type = map['type']; - couponListBean.promotionName = map['promotionName']; - couponListBean.usable = map['usable']; - couponListBean.allProduct = map['allProduct']; - couponListBean.isMaxCoupon = map['isMaxCoupon']; - couponListBean.productList = map['productList']; - return couponListBean; + CouponListBeans couponListBeans = CouponListBeans(); + couponListBeans.id = map['id']; + couponListBeans.storeId = map['storeId']; + couponListBeans.bizType = map['bizType']; + couponListBeans.fullAmount = map['fullAmount']; + couponListBeans.discountAmount = map['discountAmount']; + couponListBeans.fullNumber = map['fullNumber']; + couponListBeans.discountPercent = map['discountPercent']; + couponListBeans.bizId = map['bizId']; + couponListBeans.publishStartTime = map['publishStartTime']; + couponListBeans.publishEndTime = map['publishEndTime']; + couponListBeans.useStartTime = map['useStartTime']; + couponListBeans.useEndTime = map['useEndTime']; + couponListBeans.promotionId = map['promotionId']; + couponListBeans.mid = map['mid']; + couponListBeans.couponId = map['couponId']; + couponListBeans.receiveTime = map['receiveTime']; + couponListBeans.useTime = map['useTime']; + couponListBeans.status = map['status']; + couponListBeans.tenantCode = map['tenantCode']; + couponListBeans.type = map['type']; + couponListBeans.promotionName = map['promotionName']; + couponListBeans.usable = map['usable']; + couponListBeans.allProduct = map['allProduct']; + couponListBeans.isMaxCoupon = map['isMaxCoupon']; + couponListBeans.productList = map['productList']; + return couponListBeans; } Map toJson() => { diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index c6f656fd..23f86df5 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -33,11 +33,10 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/round_button.dart'; -import 'package:huixiang/view_widget/tips_dialog.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/shoppingCart.dart'; import '../view_widget/settlement_tips_dialog.dart'; class Settlement extends StatefulWidget { @@ -85,6 +84,7 @@ class _Settlement extends State { bool useVipPriceSelect = true; bool showVipTips = false; bool isRaiseChannel = false; + ShoppingCart shopCarGoods; @override void initState() { @@ -107,6 +107,8 @@ class _Settlement extends State { productSkuId = widget.arguments["productSkuId"]; count1 = widget.arguments["buyNum"]; productId = widget.arguments["productId"]; + shopCarGoods = widget.arguments["shoppingCart"]; + if (tableId == 0) { placeOrder = true; } @@ -516,6 +518,9 @@ class _Settlement extends State { placeOrderFirst.storeId = storeInfo.id; placeOrderFirst.subcribeTime = null; placeOrderFirst.tableId = "$tableId"; + for(int i = 0;i { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if(!(widget?.settleOrderInfo?.isRaise ?? false) && (widget?.settleOrderInfo?.memberVO?.isVip ?? false)) + if( !(widget?.settleOrderInfo?.isRaise ?? false) && (widget?.settleOrderInfo?.memberVO?.isVip ?? false) && widget.placeOrder) Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index fa99fb65..bd554982 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -21,13 +21,18 @@ class SettlementOrderCommodity extends StatefulWidget { final bool showVipTips; SettlementOrderCommodity( - this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId,this.pageType,this.useVipPriceSelect,this.showVipTips); + this.isTakeOut, + this.settleOrderInfo, + this.minOrderInfo, + this.tableId, + this.pageType, + this.useVipPriceSelect, + this.showVipTips); @override State createState() { return _SettlementOrderCommodity(); } - } class _SettlementOrderCommodity extends State { @@ -105,38 +110,47 @@ class _SettlementOrderCommodity extends State { ); } - if(widget.useVipPriceSelect && widget.settleOrderInfo.memberVO.isVip && (!widget.settleOrderInfo.isRaise) && (widget?.settleOrderInfo?.discountAmount!= "0")){ - widgets.add(vipItem(Color(0xFFFF7A1A), "VIP优惠", widget?.settleOrderInfo?.discountAmount ?? "")); + if (widget.useVipPriceSelect && + widget.settleOrderInfo.memberVO.isVip && + (!widget.settleOrderInfo.isRaise) && + (widget?.settleOrderInfo?.discountAmount != "0")) { + widgets.add(vipItem(Color(0xFFFF7A1A), "VIP优惠", + widget?.settleOrderInfo?.discountAmount ?? "")); } - if(widget.showVipTips){ - widgets.add(GestureDetector(child: Container( - alignment: Alignment.centerLeft, - child:Text.rich( - TextSpan( - children: [ - TextSpan( - text: "您未购买回乡VIP卡,无法享受优惠,", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, + if (widget.showVipTips) { + widgets.add(GestureDetector( + child: Container( + alignment: Alignment.centerLeft, + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "您未购买回乡VIP卡,无法享受优惠,", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), ), - ), - TextSpan( - text: "点击立即购买", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFF7A1A), + TextSpan( + text: "点击立即购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFF7A1A), + ), ), - ), - ], + ], + ), ), - ),),onTap: (){ - Navigator.of(context) - .pushNamedAndRemoveUntil('/router/main_page', (route) => false,arguments: {"index":2}); - },)); + ), + onTap: () { + Navigator.of(context).pushNamedAndRemoveUntil( + '/router/main_page', (route) => false, + arguments: {"index": 2}); + }, + )); } widgets.add(Container( @@ -154,7 +168,6 @@ class _SettlementOrderCommodity extends State { return widgets; } - Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -173,7 +186,7 @@ class _SettlementOrderCommodity extends State { flex: 1, child: Container( margin: EdgeInsets.only( - left:8.w, + left: 8.w, ), // height: 44.h, child: Column( @@ -190,7 +203,9 @@ class _SettlementOrderCommodity extends State { color: Color(0xFF353535), ), ), - SizedBox(height: 4.h,), + SizedBox( + height: 4.h, + ), Text( productList.skuNameStr != null ? "${productList.skuNameStr ?? ""}" @@ -208,7 +223,6 @@ class _SettlementOrderCommodity extends State { color: Color(0xFF727272), ), ), - ], ), ), @@ -218,26 +232,26 @@ class _SettlementOrderCommodity extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - productList.buyNum > 1 ? - S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0")/productList.buyNum)))) - :S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), + productList.buyNum > 1 + ? S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0") / productList.buyNum)))) + : S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 14.sp, color: Color(0xFF4C4C4C), ), ), - if(productList.discountAmount != null) - Text( - S.of(context).yuan_(productList.sellPrice), - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - fontFamily: 'JDZhengHT', - decoration: TextDecoration.lineThrough, - color: Color(0xFFA29E9E), - ), - ) + if (productList.discountAmount != null) + Text( + S.of(context).yuan_(productList.sellPrice), + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + fontFamily: 'JDZhengHT', + decoration: TextDecoration.lineThrough, + color: Color(0xFFA29E9E), + ), + ) ], ) ], @@ -405,13 +419,13 @@ class _SettlementOrderCommodity extends State { ); } - String countAllGoods(){ + String countAllGoods() { int count = 0; - if(widget.minOrderInfo != null){ + if (widget.minOrderInfo != null) { widget.minOrderInfo.orderProductVOList.forEach((element) { count += element.buyNum; }); - }else if(widget.settleOrderInfo != null){ + } else if (widget.settleOrderInfo != null) { widget.settleOrderInfo.orderProductList.forEach((element) { count += element.buyNum; }); @@ -452,7 +466,6 @@ class _SettlementOrderCommodity extends State { SizedBox( width: 15.w, ), - Container( child: Text( S.of(context).jiesuanjine, @@ -481,13 +494,16 @@ class _SettlementOrderCommodity extends State { ); } - String discountPrice(){ - if(widget.minOrderInfo != null){ - return AppUtils.calculateDouble(double.tryParse(widget.minOrderInfo?.couponSubPrice ?? "0") + double.tryParse(widget.settleOrderInfo?.benefitDiscountAmount ?? "0")); - }else if(widget.tableId < 0){ + String discountPrice() { + if (widget.minOrderInfo != null) { + return AppUtils.calculateDouble( + double.tryParse(widget.minOrderInfo?.couponSubPrice ?? "0") + + double.tryParse( + widget.settleOrderInfo?.benefitDiscountAmount ?? "0")); + } else if (widget.tableId < 0) { return "0"; - }else { - return widget?.settleOrderInfo?.discountAmount ?? "0"; + } else { + return widget?.settleOrderInfo?.discountAmount ?? "0"; } } diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 0f37fd49..cdc28cea 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -76,7 +76,8 @@ class _LocationMap extends State { leadingColor: Colors.black, ), body: Container( - child: BMFMapWidget( + //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 + child: BMFTextureMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate( double.tryParse(widget.arguments["lat"]), diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index ee005ff7..a7d6c822 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -121,6 +121,7 @@ class _UnionList extends State { child: TextField( textInputAction: TextInputAction.search, onEditingComplete: () { + FocusScope.of(context).requestFocus(FocusNode()); widget.queryStore(editingController.text); }, controller: editingController, diff --git a/lib/utils/location.dart b/lib/utils/location.dart index 5dfa092b..f678878c 100644 --- a/lib/utils/location.dart +++ b/lib/utils/location.dart @@ -2,11 +2,15 @@ import 'dart:io'; import 'package:android_intent_plus/android_intent.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bmflocation/flutter_bmflocation.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/request_permission.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'font_weight.dart'; + BaiduLocationAndroidOption initAndroidOptions() { BaiduLocationAndroidOption options = BaiduLocationAndroidOption( @@ -99,14 +103,18 @@ class Location { } return true; } else if (await Permission.location.isUndetermined) { + showAlertDialog(context); await Permission.location.request(); + Navigator.of(context).pop(); return false; } else { if (Platform.isIOS) { //去设置中心 requestDialog(context, locationCallback); } else { + showAlertDialog(context); await Permission.location.request(); + Navigator.of(context).pop(); } return false; } @@ -162,4 +170,58 @@ class Location { }, ); } + + ///定位权限说明弹窗 + showAlertDialog(context) { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return SimpleDialog( + titlePadding: EdgeInsets.all(10), + backgroundColor: Colors.transparent, + elevation: 0, + alignment: Alignment.topCenter, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + children: [ + Container( + width: double.infinity, + height: 120.h, + padding: EdgeInsets.all(16), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "访问精确地理位置信息权限说明", + style: TextStyle( + fontSize: 15.sp, + fontWeight:MyFontWeight.regular, + color: Colors.black, + ), + ), + SizedBox(height: 3.h,), + Text( + "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", + style: TextStyle( + fontSize: 13.sp, + height: 1.3.h, + fontWeight:MyFontWeight.regular, + color: Colors.black, + ), + ), + ], + ), + ), + ], + ); + }, + ); + } + } diff --git a/lib/view_widget/activity_poster.dart b/lib/view_widget/activity_poster.dart index 7fb3ef37..9500d023 100644 --- a/lib/view_widget/activity_poster.dart +++ b/lib/view_widget/activity_poster.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'package:flutter/material.dart'; @@ -14,7 +12,7 @@ class ActivityPoster extends StatefulWidget { final ActivityPos activityPos; final List firstLoginCouponList; - ActivityPoster(this.activityPos,this.firstLoginCouponList); + ActivityPoster(this.activityPos, this.firstLoginCouponList); @override State createState() { @@ -28,67 +26,65 @@ class _ActivityPoster extends State { @override void initState() { super.initState(); - if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) - showNew = true; + if (widget.firstLoginCouponList != null && + widget.firstLoginCouponList.length > 0) showNew = true; } @override Widget build(BuildContext context) { - return WillPopScope( + return WillPopScope( onWillPop: () async => false, - child:Container( - width: double.infinity, - alignment: Alignment.center, - margin: EdgeInsets.only( - left:27.w, - right:27.w, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: (){ - jumpClick(widget.activityPos); - }, - child: - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - ), - child:MImage( - widget?.activityPos?.showImage ?? "", - aspectRatio: 0.75, - fit: BoxFit.cover, - noCompress: true, - radius: BorderRadius.all(Radius.circular(12)), - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ),), + child: Container( + width: double.infinity, + alignment: Alignment.center, + margin: EdgeInsets.only( + left: 27.w, + right: 27.w, ), - Container( - margin: EdgeInsets.only(top:35.h,right: 8.w,bottom:8.w), - child:GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - Navigator.of(context).pop(); - - if (showNew) { - newShowAlertDialog(widget.firstLoginCouponList); - showNew = false; - } + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + jumpClick(widget.activityPos); }, - child: Image.asset( - "assets/image/yq_qx.webp", - width: 40, - height: 40, - fit: BoxFit.cover, - color: Colors.white, - ) - ) ) - ], - ), - )); + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child: MImage( + widget?.activityPos?.showImage ?? "", + aspectRatio: 0.75, + fit: BoxFit.cover, + noCompress: true, + radius: BorderRadius.all(Radius.circular(12)), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 35.h, right: 8.w, bottom: 8.w), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + if (showNew) { + newShowAlertDialog(widget.firstLoginCouponList); + showNew = false; + } + }, + child: Image.asset( + "assets/image/yq_qx.webp", + width: 40, + height: 40, + fit: BoxFit.cover, + color: Colors.white, + ))) + ], + ), + )); } ///新用户奖励弹窗 @@ -110,21 +106,18 @@ class _ActivityPoster extends State { arguments: {"goodsId": widget.activityPos.jumpUrl}); break; case 2: - Navigator.of(context) - .pushNamed('/router/web_page', arguments: { + Navigator.of(context).pushNamed('/router/web_page', arguments: { "activityId": widget.activityPos.jumpUrl, }); break; case 3: - Navigator.of(context) - .pushNamed('/router/web_page', arguments: { + Navigator.of(context).pushNamed('/router/web_page', arguments: { "articleId": widget.activityPos.jumpUrl, }); break; case 4: String router = widget.activityPos.jumpUrl; - - // String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}"; + // String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}"; if (router.contains("?")) { String params = router.substring(router.indexOf("?")+1); Map map = jsonDecode(params); @@ -134,8 +127,7 @@ class _ActivityPoster extends State { } break; case 5: - Navigator.of(context) - .pushNamed('/router/class_details', arguments: { + Navigator.of(context).pushNamed('/router/class_details', arguments: { "id": widget.activityPos.jumpUrl, }); break; diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index aa1b0b78..bd3cbc32 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -43,7 +43,7 @@ class NewCouponWidget extends StatelessWidget { // } return Container( - height: (coupon != null && coupon.isEx) ? 155.h : 135.h, + height: (coupon != null && coupon.isEx) ? 160.h : 140.h, width: double.infinity, margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h), padding: EdgeInsets.only(right: 5), @@ -83,11 +83,12 @@ class NewCouponWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "券名称:${coupon != null ? coupon.couponName ?? "" : ""}", + "${coupon != null ? coupon.couponName ?? "" : ""}", maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 15.sp, + height: 1.2.h, fontWeight: MyFontWeight.semi_bold, color: Color(0xFF0D0D0D), ), diff --git a/pubspec.yaml b/pubspec.yaml index 62d0e705..21f39815 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 一心回乡. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 3.2.3+44 +version: 3.2.4+48 environment: sdk: ">=2.7.0 <3.0.0"