From e60ceb5c7f816df0e4ad04e70d195e3203507530 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 26 May 2023 17:03:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A5=97=E9=A4=90=E6=A0=B7=E5=BC=8F=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B=202.=E8=B4=AD=E4=B9=B0=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=BA=93=E5=AD=98=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=9B=EF=BC=88=E5=88=86=E5=88=AB=E6=9B=B4=E6=94=B9=E7=82=B9?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=EF=BC=8C=E8=AF=A6=E6=83=85=E9=A1=B5=EF=BC=8C?= =?UTF-8?q?=E5=A4=9A=E8=A7=84=E6=A0=BC=E9=80=89=E6=8B=A9=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E9=A1=B5=EF=BC=9B=EF=BC=89=203.=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=BB=84=E5=A2=9E=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=88isSetMeal=EF=BC=89=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E5=88=A4=E6=96=AD=E8=AF=A5=E5=95=86=E5=93=81=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=98=AF=E5=A5=97=E9=A4=90=EF=BC=9B=204.=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E5=86=85=E5=AE=B9=E9=80=89=E6=8B=A9ui=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=98=AF=E5=94=AF=E4=B8=80?= =?UTF-8?q?=E9=A1=B9=E9=80=89=E6=8B=A9=EF=BC=88=E6=AF=94=E5=A6=82=EF=BC=9A?= =?UTF-8?q?1=E9=80=891=EF=BC=8C=E6=88=96=E8=80=853=E9=80=893=E8=BF=99?= =?UTF-8?q?=E7=A7=8D=E7=B1=BB=E5=9E=8B=EF=BC=89=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=BA1=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E5=A4=9A=E4=BA=8E=E6=93=8D=E4=BD=9C=EF=BC=9B=205.=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BB=93=E7=AE=97=E9=A1=B5=E5=A2=9E=E5=8A=A0=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E5=86=85=E5=AE=B9=E6=98=8E=E7=BB=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=9B=206.=E5=8F=91=E8=A1=A8=E5=8A=A8=E6=80=81=EF=BC=8C?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD=E6=A0=B7=E5=BC=8F=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B=EF=BC=88=E5=BC=82=E6=AD=A5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A6=82=E8=8B=A5=E5=8F=91=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E6=98=AF=E5=9B=BE=E6=96=87=EF=BC=8C=E5=8A=A0=E8=BD=BD=E5=9C=88?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=88=99=E4=BC=9A=E6=98=BE=E7=A4=BA=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=BC=A0=E5=9B=BE=E7=89=87=E5=85=B1=E5=90=8C=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E5=8F=91=E8=A1=A8=E8=A7=86=E9=A2=91=E5=88=99?= =?UTF-8?q?=EF=BC=8C=E4=B9=9F=E6=98=BE=E7=A4=BA=E8=A7=86=E9=A2=91=E7=9A=84?= =?UTF-8?q?=E9=A6=96=E5=9B=BE=E7=94=A8=E4=BA=8E=E5=BA=95=E9=83=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E6=96=87=E5=AD=97=EF=BC=8C=E5=88=99=E4=BC=9A?= =?UTF-8?q?=E5=B0=86=E6=96=87=E5=AD=97=E5=86=85=E5=AE=B9=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=8A=A0=E8=BD=BD=EF=BC=89=EF=BC=9B=207.?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=85=91=E6=8D=A2=E6=9D=BF=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9B=86=E6=8D=A2=E5=8D=A1=E5=85=91=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8=E5=8E=9F=E6=9C=89=E7=9A=84=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E4=B8=8A=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=9B=86=E6=8D=A2=E5=8D=A1?= =?UTF-8?q?=E5=85=91=E6=8D=A2=EF=BC=88oneBean=EF=BC=89=EF=BC=9B=208.?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=85=91=E6=8D=A2=E6=9D=BF=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=80=BB=E8=BE=91=E6=9B=B4=E6=94=B9=EF=BC=9B?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=A1=BA=E5=BA=8F=EF=BC=9A=E9=9B=86=E6=8D=A2?= =?UTF-8?q?=E5=8D=A1-=E7=A7=AF=E5=88=86-=E7=A7=AF=E5=88=86+=E7=8E=B0?= =?UTF-8?q?=E9=87=91-=E7=BA=AF=E7=8E=B0=E9=87=91=EF=BC=9B=209.=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=A7=AF=E5=88=86=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=EF=BC=9AisPoints=E5=BA=9F=E5=BC=83=EF=BC=9B?= =?UTF-8?q?=E6=94=B9=E7=94=A8=EF=BC=9ApayType=EF=BC=8C=E4=BC=A0=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=9E=8B=EF=BC=881=3D=E7=A7=AF=E5=88=86=202?= =?UTF-8?q?=3D=E9=9B=86=E5=8D=A1=E5=88=B8=203=3D=E4=BA=BA=E6=B0=91?= =?UTF-8?q?=E5=B8=81=E6=B7=B7=E7=94=A8=EF=BC=89=EF=BC=9B=2010.=E5=BA=94?= =?UTF-8?q?=E4=BB=98=E9=87=91=E9=A2=9D=E4=BC=98=E5=8C=96=EF=BC=8C=E5=81=9A?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=B0=83=E6=95=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/release_dynamic.dart | 2 + .../points_mall_view/points_goods_view.dart | 3 + .../integral_store_details_page.dart | 20 +- lib/main_page.dart | 264 +++-- lib/order/exchange_order_page.dart | 998 +++++++++--------- lib/retrofit/data/findMiNiGroupList.dart | 3 + lib/retrofit/data/goods.dart | 6 + lib/retrofit/min_api.dart | 2 +- lib/retrofit/min_api.g.dart | 2 +- lib/retrofit/retrofit_api.dart | 2 +- .../settlement_order_commodity.dart | 202 ++-- lib/store/shop_details_page.dart | 20 +- lib/store/store_order.dart | 13 +- lib/store/store_view/product_meals_sku.dart | 264 +++-- lib/store/store_view/product_sku.dart | 42 +- lib/store/store_view/shop_goods.dart | 166 ++- lib/store/store_view/shop_goods_car.dart | 504 ++++----- lib/store/store_view/store_order_list.dart | 1 + lib/utils/upload_async.dart | 58 +- pubspec.yaml | 2 +- 20 files changed, 1485 insertions(+), 1089 deletions(-) diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index 5268345a..496d24e6 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -381,6 +381,8 @@ class _ReleaseDynamic extends State { maxLines: 5, style: TextStyle( fontSize: 14.sp, + height: 1.3, + letterSpacing:1, fontWeight: MyFontWeight.medium, color: Color(0xFF4C4C4C), ), diff --git a/lib/home/points_mall_view/points_goods_view.dart b/lib/home/points_mall_view/points_goods_view.dart index 18ae03d2..6bc20bb2 100644 --- a/lib/home/points_mall_view/points_goods_view.dart +++ b/lib/home/points_mall_view/points_goods_view.dart @@ -22,6 +22,9 @@ class PointGoods extends StatefulWidget { class _PointGoods extends State { String pointPrice(Goods goods) { if (goods == null) return ""; + if (goods?.oneBean != null && goods?.oneBean != "0") { + return "${goods?.oneBean}印章"; + } if (goods?.onePrice != null && goods?.onePrice != "0") { return S.of(context).jifen_(goods?.onePrice); } else if ((goods?.onePrice == null || goods?.onePrice == "0") && diff --git a/lib/integral_store/integral_store_details_page.dart b/lib/integral_store/integral_store_details_page.dart index 8ad55829..583c2835 100644 --- a/lib/integral_store/integral_store_details_page.dart +++ b/lib/integral_store/integral_store_details_page.dart @@ -62,15 +62,18 @@ class _IntegralStoreDetailsPage extends State { if (baseData != null && baseData.isSuccess) { setState(() { goods = baseData.data; - if(goods != null && points != null && double.tryParse(goods.onePrice) - != 0 && double.tryParse(goods.onePrice) <= double.tryParse(points)){ + if(goods != null && points != null && double.tryParse(goods?.oneBean ?? "0") + != 0 && double.tryParse(goods?.oneBean ?? "0") <= double.tryParse(points)){ payType = 1; + } else if(goods != null && points != null && double.tryParse(goods.onePrice) + != 0 && double.tryParse(goods.onePrice) <= double.tryParse(points)){ + payType = 2; } else if (goods != null && points != null && double.tryParse(goods.price) != 0 && double.tryParse(goods.price) <= double.tryParse(points) && double.tryParse(goods.money) != 0.00){ - payType = 2; + payType = 3; } else if (goods != null && points != null && double.tryParse(goods.oneMoney) != 0.00){ - payType = 3; + payType = 4; } refreshController.refreshCompleted(); }); @@ -82,7 +85,9 @@ class _IntegralStoreDetailsPage extends State { String pointPrice(){ if(goods == null) return ""; - if(goods?.onePrice!=null && goods?.onePrice!="0"){ + if(goods?.oneBean!=null && goods?.oneBean!="0"){ + return "${goods?.oneBean}印章"; + }else if(goods?.onePrice!=null && goods?.onePrice!="0"){ return S.of(context).jifen_(goods?.onePrice); }else if((goods?.onePrice == null || goods?.onePrice == "0") && ((goods?.price != null && goods?.price != "0") || (goods?.money != null && goods?.money != "0.00"))){ return (goods?.price== "0"|| goods?.price == null ? "" : S.of(context).jifen_(goods?.price)) + (goods?.money== "0"|| goods?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}元"); @@ -168,7 +173,7 @@ class _IntegralStoreDetailsPage extends State { if(payType > 0){ toExchangeOrder(); }else{ - SmartDialog.showToast("您的积分不足!", alignment: Alignment.center); + SmartDialog.showToast(pointPrice().contains("印章")?"您的印章数量不足!" : "您的积分不足!", alignment: Alignment.center); return; } }, @@ -187,7 +192,7 @@ class _IntegralStoreDetailsPage extends State { child: Text( (payType > 0) ? "立即兑换" - : S.of(context).jifenbuzu, + : pointPrice().contains("印章")?"您的印章数量不足" :S.of(context).jifenbuzu, // "兑换功能暂未开放", style: TextStyle( fontSize: 16.sp, @@ -211,6 +216,7 @@ class _IntegralStoreDetailsPage extends State { "money": goods.money, "onePrice":goods.onePrice, "oneMoney":goods.oneMoney, + "oneBean":goods.oneBean, "price": goods.price, "image": goods.mainImgPath, "payType":payType, diff --git a/lib/main_page.dart b/lib/main_page.dart index bfcbc3ea..937b2d89 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -55,6 +55,7 @@ class _MainPage extends State with WidgetsBindingObserver { final GlobalKey minePageKey = GlobalKey(); final GlobalKey unionPageKey = GlobalKey(); final GlobalKey vipPageKey = GlobalKey(); + // List iconn; ApiService apiService; int lastTime = DateTime.now().millisecondsSinceEpoch; @@ -73,11 +74,11 @@ class _MainPage extends State with WidgetsBindingObserver { break; case AppLifecycleState.resumed: //从后台切换前台,界面可见 pushRoute(); - if(DateTime.now().millisecondsSinceEpoch - lastTime > 420000) + if (DateTime.now().millisecondsSinceEpoch - lastTime > 420000) Navigator.of(context).popAndPushNamed('/router/start_page'); break; case AppLifecycleState.paused: // 界面不可见,后台 - lastTime = DateTime.now().millisecondsSinceEpoch; + lastTime = DateTime.now().millisecondsSinceEpoch; break; case AppLifecycleState.detached: // APP结束时调用 break; @@ -87,8 +88,12 @@ class _MainPage extends State with WidgetsBindingObserver { @override void initState() { super.initState(); - pageController = PageController(initialPage: widget.arguments != null && widget.arguments["index"] != null ? widget.arguments["index"]:0); - if(widget.arguments != null && widget.arguments["index"] != null) + pageController = PageController( + initialPage: + widget.arguments != null && widget.arguments["index"] != null + ? widget.arguments["index"] + : 0); + if (widget.arguments != null && widget.arguments["index"] != null) clickIndex = widget.arguments["index"]; WidgetsBinding.instance.addObserver(this); EasyLoading.instance @@ -103,7 +108,6 @@ class _MainPage extends State with WidgetsBindingObserver { ..userInteractions = false ..dismissOnTap = false; - initSdk(); pushRoute(); @@ -112,32 +116,43 @@ class _MainPage extends State with WidgetsBindingObserver { var interviewCouponList; var firstLoginCouponList; - if(widget.arguments != null && (widget.arguments["invite"]??"") != "" - && widget.arguments["interviewCouponList"] != null ){ + if (widget.arguments != null && + (widget.arguments["invite"] ?? "") != "" && + widget.arguments["interviewCouponList"] != null) { invite = widget.arguments["invite"]; interviewCouponList = widget.arguments["interviewCouponList"]; } - if(widget.arguments != null && widget.arguments["firstLoginCouponList"] != null ){ + if (widget.arguments != null && + widget.arguments["firstLoginCouponList"] != null) { firstLoginCouponList = widget.arguments["firstLoginCouponList"]; } _widgetOptions = [ // BrandPage(), - HomePage(homePageKey,(index,jpIndex) { - if(index == 1){ - if(unionPageKey?.currentState != null) { - UnionPageState state = unionPageKey.currentState; - state.jumpIndex(jpIndex); - }else _widgetOptions[1] = UnionPage(unionPageKey,jpIndex); - } - setState(() { - pageController.jumpToPage(index); - }); - },invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,), + HomePage( + homePageKey, + (index, jpIndex) { + if (index == 1) { + if (unionPageKey?.currentState != null) { + UnionPageState state = unionPageKey.currentState; + state.jumpIndex(jpIndex); + } else + _widgetOptions[1] = UnionPage(unionPageKey, jpIndex); + } + setState(() { + pageController.jumpToPage(index); + }); + }, + invite: invite, + interviewCouponList: interviewCouponList, + firstLoginCouponList: firstLoginCouponList, + ), // MainHomePage(), - UnionPage(unionPageKey,0), + UnionPage(unionPageKey, 0), VipPage(vipPageKey), - Platform.isAndroid ? (ExamineInstance.instance.isExamine?OrderPage():CommunityPage()) :CommunityPage(), + Platform.isAndroid + ? (ExamineInstance.instance.isExamine ? OrderPage() : CommunityPage()) + : CommunityPage(), // CommunityPage(), MinePage(minePageKey), ]; @@ -167,9 +182,12 @@ class _MainPage extends State with WidgetsBindingObserver { ///App自动更新 appAutoUpdate(); } + final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); + initSdk() async { xgFlutterPlugin.stopXg(); + ///ios 调用startXg前需要调用此方法 xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com"); xgFlutterPlugin.setEnableDebug(true); @@ -217,7 +235,7 @@ class _MainPage extends State with WidgetsBindingObserver { if (Platform.isAndroid) { xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler( MyNativeEventHandler( - (String title, String message, String customContent, int type) { + (String title, String message, String customContent, int type) { print("xgPushClickAction2: $customContent"); SharedPreferences.getInstance().then((value) { value.setString("pushData", customContent); @@ -234,7 +252,7 @@ class _MainPage extends State with WidgetsBindingObserver { if (Platform.isAndroid ? (event["actionType"] == 0) : (event["xg"]["msgtype"] == 1) && - event[Platform.isAndroid ? "customMessage" : "custom"] != null) { + event[Platform.isAndroid ? "customMessage" : "custom"] != null) { SharedPreferences.getInstance().then((value) { value.setString("pushData", event[Platform.isAndroid ? "customMessage" : "custom"]); @@ -249,15 +267,15 @@ class _MainPage extends State with WidgetsBindingObserver { } return event; }, onReceiveNotificationResponse: (event) async { - try{ - if(jsonDecode(event["customMessage"])["typed"] == 6){ + try { + if (jsonDecode(event["customMessage"])["typed"] == 6) { // HomePageState state = homePageKey.currentState; // state.queryMsgStats(); MinePageState state = minePageKey.currentState; state.queryMsgStats(); } - }catch(ex){} + } catch (ex) {} print("onReceiveNotificationResponse: ${event.toString()}"); return event; }, onReceiveMessage: (event) async { @@ -277,7 +295,7 @@ class _MainPage extends State with WidgetsBindingObserver { if (sharedPreferences.getString("token") == null || sharedPreferences.getString("token") == "") return; String startIntent; - if(Platform.isAndroid) startIntent= await Bridge.getStartIntent(); + if (Platform.isAndroid) startIntent = await Bridge.getStartIntent(); print("intent:$startIntent"); String pushData = ""; if (startIntent != null && startIntent != "") { @@ -292,37 +310,45 @@ class _MainPage extends State with WidgetsBindingObserver { String routeName = ""; Map params = {}; switch (pushMap["typed"].toString()) { - case "1":case "ARTICLE": + case "1": + case "ARTICLE": routeName = "/router/web_page"; params["articleId"] = pushMap["info"]; break; - case "2":case "ACTIVITY": + case "2": + case "ACTIVITY": routeName = "/router/web_page"; params["activityId"] = pushMap["info"]; break; - case "3":case "SHOP": + case "3": + case "SHOP": routeName = "/router/store_order"; params["id"] = pushMap["info"]; params["tenant"] = pushMap["tenant"]; params["storeName"] = pushMap["storeName"]; break; - case "4":case "CREDIT_GOODS": + case "4": + case "CREDIT_GOODS": routeName = "/router/integral_store_page"; params["goodsId"] = pushMap["info"]; break; - case "5":case "ORDER": + case "5": + case "ORDER": routeName = "/router/order_details"; params["id"] = pushMap["info"]; break; - case "6":case "MEMBER": + case "6": + case "MEMBER": routeName = "/router/community_details"; params["businessId"] = pushMap["info"]; break; - case "8":case "WALLET": + case "8": + case "WALLET": routeName = "/router/mine_wallet"; params["id"] = pushMap["info"]; break; - case "9":case "WELFARE": + case "9": + case "WELFARE": routeName = "/router/welfare_page"; params["id"] = pushMap["info"]; break; @@ -366,35 +392,37 @@ class _MainPage extends State with WidgetsBindingObserver { SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null) { apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), + Dio(), + context: context, + token: value.getString("token"), ); } PackageInfo packageInfo = await PackageInfo.fromPlatform(); - BaseData baseData = await apiService.appVersion().catchError((onError) {}); + BaseData baseData = + await apiService.appVersion().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { // baseData.data.appLastVersion = "2.0.17"; // baseData.data.appLastVersionUp = "1.0.1"; - if(AppUtils.versionCompare(packageInfo.version,baseData.data?.appLastVersion) - && AppUtils.versionCompare(value.getString("appLastVersion")??"1.0.0",baseData.data?.appLastVersion)){ + if (AppUtils.versionCompare( + packageInfo.version, baseData.data?.appLastVersion) && + AppUtils.versionCompare(value.getString("appLastVersion") ?? "1.0.0", + baseData.data?.appLastVersion)) { showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return WillPopScope( - child:UpdateDialog(packageInfo.version,baseData.data), + child: UpdateDialog(packageInfo.version, baseData.data), onWillPop: () async { return Future.value(false); }); }, ); - }else{ + } else { return; } - }else{ - SmartDialog.showToast(baseData.msg, - alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); Navigator.of(context).pop(); } } @@ -443,7 +471,13 @@ class _MainPage extends State with WidgetsBindingObserver { bottomNavigationItem(S.of(context).main_menu2, 1), // bottomNavigationItem(S.of(context).main_menu3 , 2), bottomNavigationItem(S.of(context).main_menu5, 2), - bottomNavigationItem(Platform.isAndroid ? (ExamineInstance.instance.isExamine?"订单":S.of(context).main_menu3) :S.of(context).main_menu3, 3), + bottomNavigationItem( + Platform.isAndroid + ? (ExamineInstance.instance.isExamine + ? "订单" + : S.of(context).main_menu3) + : S.of(context).main_menu3, + 3), bottomNavigationItem(S.of(context).main_menu4, 4), ], ), @@ -525,72 +559,72 @@ class _MainPage extends State with WidgetsBindingObserver { ); } - // Widget bottomNavigationBigItem(text, index) { - // var isSelected = index == clickIndex; - // return Expanded( - // child: InkWell( - // onTap: () { - // setState(() { - // clickIndex = index; - // pageController.jumpToPage(clickIndex); - // }); - // }, - // child: Container( - // width: 45.w, - // alignment: Alignment.center, - // child: AnimatedCrossFade( - // firstCurve: Curves.easeIn, - // secondCurve: Curves.ease, - // sizeCurve: Curves.easeInOut, - // duration: Duration(milliseconds: 50), - // firstChild: Container( - // padding: EdgeInsets.all(4), - // height: 82.h, - // alignment: - // Platform.isAndroid ? Alignment.center : Alignment.topCenter, - // child: Image.asset( - // icons[index], - // width: 45, - // height: 45, - // fit: BoxFit.contain, - // ), - // ), - // secondChild: Column( - // mainAxisAlignment: Platform.isAndroid - // ? MainAxisAlignment.center - // : MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // if (Platform.isIOS) - // SizedBox( - // height: 4.h, - // ), - // Image.asset( - // iconn[index], - // width: 30, - // height: 30, - // fit: BoxFit.contain, - // ), - // SizedBox( - // height: 1.h, - // ), - // Text( - // text, - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.semi_bold, - // color: Color(isSelected ? 0xFF4C4C4C : 0xFFA29E9E), - // ), - // ), - // ], - // ), - // crossFadeState: isSelected - // ? CrossFadeState.showFirst - // : CrossFadeState.showSecond, - // ), - // ), - // ), - // flex: 1, - // ); - // } +// Widget bottomNavigationBigItem(text, index) { +// var isSelected = index == clickIndex; +// return Expanded( +// child: InkWell( +// onTap: () { +// setState(() { +// clickIndex = index; +// pageController.jumpToPage(clickIndex); +// }); +// }, +// child: Container( +// width: 45.w, +// alignment: Alignment.center, +// child: AnimatedCrossFade( +// firstCurve: Curves.easeIn, +// secondCurve: Curves.ease, +// sizeCurve: Curves.easeInOut, +// duration: Duration(milliseconds: 50), +// firstChild: Container( +// padding: EdgeInsets.all(4), +// height: 82.h, +// alignment: +// Platform.isAndroid ? Alignment.center : Alignment.topCenter, +// child: Image.asset( +// icons[index], +// width: 45, +// height: 45, +// fit: BoxFit.contain, +// ), +// ), +// secondChild: Column( +// mainAxisAlignment: Platform.isAndroid +// ? MainAxisAlignment.center +// : MainAxisAlignment.start, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// if (Platform.isIOS) +// SizedBox( +// height: 4.h, +// ), +// Image.asset( +// iconn[index], +// width: 30, +// height: 30, +// fit: BoxFit.contain, +// ), +// SizedBox( +// height: 1.h, +// ), +// Text( +// text, +// style: TextStyle( +// fontSize: 10.sp, +// fontWeight: MyFontWeight.semi_bold, +// color: Color(isSelected ? 0xFF4C4C4C : 0xFFA29E9E), +// ), +// ), +// ], +// ), +// crossFadeState: isSelected +// ? CrossFadeState.showFirst +// : CrossFadeState.showSecond, +// ), +// ), +// ), +// flex: 1, +// ); +// } } diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 2d348dba..43d6edca 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -62,7 +62,9 @@ class _ExchangeOrderPage extends State { '/router/exchange_order_success_page', arguments: { "id": widget.arguments["goodsId"], - "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", + "price": realPay.contains("积分") + ? realPay.substring(0, realPay.indexOf("积分")) + : "0", "points": points, "realPay": realPay, "payChannel": widget.arguments["payChannel"], @@ -73,18 +75,17 @@ class _ExchangeOrderPage extends State { return; } }); - } @override void dispose() { super.dispose(); - if(payListen!=null) - payListen.cancel(); + if (payListen != null) payListen.cancel(); } queryUserBalance() async { - BaseData baseData = await apiService.queryInfo().catchError((onError) {}); + BaseData baseData = + await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; mBalance = double.tryParse(userInfo.money); @@ -112,435 +113,424 @@ class _ExchangeOrderPage extends State { children: [ // widget.arguments["useTyped"] == 1 ? Container( - margin: EdgeInsets.only( - left: 16, right: 16, top: 26, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: - BorderRadius.all(Radius.circular(8)), - ), - child: Column( + margin: EdgeInsets.only( + left: 16, right: 16, top: 26, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + child: Column( + children: [ + Row( + children: [ + Image.asset( + "assets/image/icon_order_exchange_info.webp", + width: 24, + height: 24, + ), + SizedBox(width: 4), + Text( + S.of(context).duihuanxinxi, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: Color(0xFF353535)), + ), + ], + ), + SizedBox( + height: 18.h, + ), + GestureDetector( + onTap: () { + setState(() { + // showAlertDialog(); + }); + }, + child: Row( children: [ - Row( - children: [ - Image.asset( - "assets/image/icon_order_exchange_info.webp", - width: 24, - height: 24, - ), - SizedBox(width: 4), - Text( - S.of(context).duihuanxinxi, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Color(0xFF353535)), - ), - ], + Text( + S.of(context).lingqufangshi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), SizedBox( - height: 18.h, + width: 12.w, ), - GestureDetector( - onTap: () { - setState(() { - // showAlertDialog(); - }); - }, - child: Row( - children: [ - Text( - S.of(context).lingqufangshi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: Text( - widget.arguments["useTyped"] == 1 - ? S.of(context).ziti - : widget.arguments["useTyped"] == 2 - ? S.of(context).peisong - : S.of(context).xianshangfafang, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - ), - )), - // Icon( - // Icons.keyboard_arrow_right, - // size: 16, - // color: Color(0xFF32A060), - // ), - ], - ), - ), - Visibility( - child: SizedBox( - height: 13.h, + Expanded( + child: Text( + widget.arguments["useTyped"] == 1 + ? S.of(context).ziti + : widget.arguments["useTyped"] == 2 + ? S.of(context).peisong + : S.of(context).xianshangfafang, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), ), - visible: widget.arguments["useTyped"] != 3, - ), - Visibility( - child: Row( - children: [ - Text( - S.of(context).zitidizhi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: GestureDetector( - onTap: () { - toAddressPicker(); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - (address != null && - address != "") - ? address - : widget.arguments[ - "useTyped"] == - 1 - ? S - .of(context) - .qingxuanzhemendian - : widget.arguments[ - "useTyped"] == - 2 - ? S - .of(context) - .qingxuanzeshouhuodizhi - : S - .of(context) - .xuni, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - ), - ), - flex: 1, - ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Color(0xFF32A060), - ), - ], - ), - ), - flex: 1, - ), - ], + )), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Color(0xFF32A060), + // ), + ], + ), + ), + Visibility( + child: SizedBox( + height: 13.h, + ), + visible: widget.arguments["useTyped"] != 3, + ), + Visibility( + child: Row( + children: [ + Text( + S.of(context).zitidizhi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), ), - visible: widget.arguments["useTyped"] != 3, ), SizedBox( - height: 12.h, + width: 12.w, ), - Row( - children: [ - Visibility( - visible: - widget.arguments["useTyped"] != 3, - child: Text( - S.of(context).zitishijian, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535)), - ), - ), - Visibility( - visible: - widget.arguments["useTyped"] != 3, - child: SizedBox( - width: 12.w, - ), - ), - Text( - widget.arguments["useTyped"] == 1 - ? S - .of(context) - .duihuanhouwugegongzuori - : widget.arguments["useTyped"] == 2 - ? S.of(context).duihuanhoufahuo - : S.of(context).feishiwushangpin, - style: TextStyle( - fontSize: 14.sp, - color: - widget.arguments["useTyped"] == 3 - ? Color(0xFF32A060) - : Color(0xFF353535)), + Expanded( + child: GestureDetector( + onTap: () { + toAddressPicker(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Text( + (address != null && address != "") + ? address + : widget.arguments[ + "useTyped"] == + 1 + ? S + .of(context) + .qingxuanzhemendian + : widget.arguments[ + "useTyped"] == + 2 + ? S + .of(context) + .qingxuanzeshouhuodizhi + : S.of(context).xuni, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + flex: 1, + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], ), - ], + ), + flex: 1, ), ], ), + visible: widget.arguments["useTyped"] != 3, ), - // : - // // Container( - // // margin: - // // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - // // padding: EdgeInsets.all(20), - // // decoration: BoxDecoration( - // // color: Colors.white, - // // boxShadow: [ - // // BoxShadow( - // // color: Colors.black.withAlpha(12), - // // offset: Offset(0, 3), - // // blurRadius: 14, - // // spreadRadius: 0, - // // ) - // // ], - // // borderRadius: BorderRadius.all(Radius.circular(8)), - // // ), - // // child: Column( - // // mainAxisAlignment: MainAxisAlignment.spaceAround, - // // crossAxisAlignment: CrossAxisAlignment.start, - // // children: [ - // // Row( - // // children: [ - // // Image.asset( - // // "assets/image/icon_order_exchange_info.webp", - // // width: 24, - // // height: 24, - // // ), - // // SizedBox(width: 4), - // // Text( - // // S.of(context).duihuanxinxi, - // // style: TextStyle( - // // fontWeight: FontWeight.bold, - // // fontSize: 16, - // // color: Color(0xFF353535)), - // // ), - // // ], - // // ), - // // SizedBox( - // // height: 18.h, - // // ), - // // Row( - // // children: [ - // // Text( - // // S.of(context).lingqufangshi, - // // style: TextStyle( - // // fontSize: 14.sp, - // // color: Color(0xFF353535), - // // ), - // // ), - // // SizedBox( - // // width: 12.w, - // // ), - // // Text( - // // widget.arguments["useTyped"] == 1 - // // ? S.of(context).ziti - // // : widget.arguments["useTyped"] == 2 - // // ? S.of(context).peisong - // // : S.of(context).xianshangfafang, - // // style: TextStyle( - // // fontSize: 14.sp, - // // color: Color(0xFF353535), - // // ), - // // ), - // // ], - // // ), - // // SizedBox( - // // height: 12.h, - // // ), - // // Text( - // // "非实物商品兑换后领取到卡包即可使用!", - // // style: TextStyle( - // // fontSize: 14.sp, - // // color: Color(0xFF32A060), - // // fontWeight: MyFontWeight.medium - // // ), - // // ), - // // ], - // // ), - // // ), - // Container( - // margin: EdgeInsets.only( - // left: 16, right: 16, top: 26, bottom: 8), - // padding: EdgeInsets.all(20), - // decoration: BoxDecoration( - // color: Colors.white, - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ) - // ], - // borderRadius: - // BorderRadius.all(Radius.circular(8)), - // ), - // child: Column( - // children: [ - // Row( - // children: [ - // Image.asset( - // "assets/image/icon_order_exchange_info.webp", - // width: 24, - // height: 24, - // ), - // SizedBox(width: 4), - // Text( - // S.of(context).duihuanxinxi, - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 16, - // color: Color(0xFF353535)), - // ), - // ], - // ), - // SizedBox( - // height: 18.h, - // ), - // GestureDetector( - // onTap: () { - // setState(() { - // showAlertDialog(); - // }); - // }, - // child: Row( - // children: [ - // Text( - // S.of(context).lingqufangshi, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF353535), - // ), - // ), - // SizedBox( - // width: 12.w, - // ), - // Expanded( - // child: Text( - // widget.arguments["useTyped"] == 1 - // ? S.of(context).ziti - // : widget.arguments["useTyped"] == 2 - // ? S.of(context).peisong - // : S.of(context).xianshangfafang, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF353535), - // ), - // )), - // Icon( - // Icons.keyboard_arrow_right, - // size: 16, - // color: Color(0xFF32A060), - // ), - // ], - // ), - // ), - // Visibility( - // child: SizedBox( - // height: 13.h, - // ), - // visible: widget.arguments["useTyped"] != 3, - // ), - // Visibility( - // child: Row( - // children: [ - // Text( - // "收货地址", - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF353535), - // ), - // ), - // SizedBox( - // width: 12.w, - // ), - // Expanded( - // child: GestureDetector( - // onTap: () { - // toAddressPicker(); - // }, - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.end, - // crossAxisAlignment: - // CrossAxisAlignment.end, - // mainAxisSize: MainAxisSize.min, - // children: [ - // Expanded( - // child: Text( - // (address != null && - // address != "") - // ? address - // : widget.arguments[ - // "useTyped"] == - // 1 - // ? S - // .of(context) - // .qingxuanzhemendian - // : widget.arguments[ - // "useTyped"] == - // 2 - // ? S - // .of(context) - // .qingxuanzeshouhuodizhi - // : S - // .of(context) - // .xuni, - // overflow: - // TextOverflow.ellipsis, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF32A060), - // ), - // ), - // flex: 1, - // ), - // Icon( - // Icons.keyboard_arrow_right, - // size: 16, - // color: Color(0xFF32A060), - // ), - // ], - // ), - // ), - // flex: 1, - // ), - // ], - // ), - // visible: widget.arguments["useTyped"] != 3, - // ), - // SizedBox( - // height: 12.h, - // ), - // ], - // ), - // ), + SizedBox( + height: 12.h, + ), + Row( + children: [ + Visibility( + visible: widget.arguments["useTyped"] != 3, + child: Text( + S.of(context).zitishijian, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535)), + ), + ), + Visibility( + visible: widget.arguments["useTyped"] != 3, + child: SizedBox( + width: 12.w, + ), + ), + Text( + widget.arguments["useTyped"] == 1 + ? S.of(context).duihuanhouwugegongzuori + : widget.arguments["useTyped"] == 2 + ? S.of(context).duihuanhoufahuo + : S.of(context).feishiwushangpin, + style: TextStyle( + fontSize: 14.sp, + color: widget.arguments["useTyped"] == 3 + ? Color(0xFF32A060) + : Color(0xFF353535)), + ), + ], + ), + ], + ), + ), + // : + // // Container( + // // margin: + // // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), + // // padding: EdgeInsets.all(20), + // // decoration: BoxDecoration( + // // color: Colors.white, + // // boxShadow: [ + // // BoxShadow( + // // color: Colors.black.withAlpha(12), + // // offset: Offset(0, 3), + // // blurRadius: 14, + // // spreadRadius: 0, + // // ) + // // ], + // // borderRadius: BorderRadius.all(Radius.circular(8)), + // // ), + // // child: Column( + // // mainAxisAlignment: MainAxisAlignment.spaceAround, + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // Row( + // // children: [ + // // Image.asset( + // // "assets/image/icon_order_exchange_info.webp", + // // width: 24, + // // height: 24, + // // ), + // // SizedBox(width: 4), + // // Text( + // // S.of(context).duihuanxinxi, + // // style: TextStyle( + // // fontWeight: FontWeight.bold, + // // fontSize: 16, + // // color: Color(0xFF353535)), + // // ), + // // ], + // // ), + // // SizedBox( + // // height: 18.h, + // // ), + // // Row( + // // children: [ + // // Text( + // // S.of(context).lingqufangshi, + // // style: TextStyle( + // // fontSize: 14.sp, + // // color: Color(0xFF353535), + // // ), + // // ), + // // SizedBox( + // // width: 12.w, + // // ), + // // Text( + // // widget.arguments["useTyped"] == 1 + // // ? S.of(context).ziti + // // : widget.arguments["useTyped"] == 2 + // // ? S.of(context).peisong + // // : S.of(context).xianshangfafang, + // // style: TextStyle( + // // fontSize: 14.sp, + // // color: Color(0xFF353535), + // // ), + // // ), + // // ], + // // ), + // // SizedBox( + // // height: 12.h, + // // ), + // // Text( + // // "非实物商品兑换后领取到卡包即可使用!", + // // style: TextStyle( + // // fontSize: 14.sp, + // // color: Color(0xFF32A060), + // // fontWeight: MyFontWeight.medium + // // ), + // // ), + // // ], + // // ), + // // ), + // Container( + // margin: EdgeInsets.only( + // left: 16, right: 16, top: 26, bottom: 8), + // padding: EdgeInsets.all(20), + // decoration: BoxDecoration( + // color: Colors.white, + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // borderRadius: + // BorderRadius.all(Radius.circular(8)), + // ), + // child: Column( + // children: [ + // Row( + // children: [ + // Image.asset( + // "assets/image/icon_order_exchange_info.webp", + // width: 24, + // height: 24, + // ), + // SizedBox(width: 4), + // Text( + // S.of(context).duihuanxinxi, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 16, + // color: Color(0xFF353535)), + // ), + // ], + // ), + // SizedBox( + // height: 18.h, + // ), + // GestureDetector( + // onTap: () { + // setState(() { + // showAlertDialog(); + // }); + // }, + // child: Row( + // children: [ + // Text( + // S.of(context).lingqufangshi, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // SizedBox( + // width: 12.w, + // ), + // Expanded( + // child: Text( + // widget.arguments["useTyped"] == 1 + // ? S.of(context).ziti + // : widget.arguments["useTyped"] == 2 + // ? S.of(context).peisong + // : S.of(context).xianshangfafang, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // )), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Color(0xFF32A060), + // ), + // ], + // ), + // ), + // Visibility( + // child: SizedBox( + // height: 13.h, + // ), + // visible: widget.arguments["useTyped"] != 3, + // ), + // Visibility( + // child: Row( + // children: [ + // Text( + // "收货地址", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // SizedBox( + // width: 12.w, + // ), + // Expanded( + // child: GestureDetector( + // onTap: () { + // toAddressPicker(); + // }, + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.end, + // crossAxisAlignment: + // CrossAxisAlignment.end, + // mainAxisSize: MainAxisSize.min, + // children: [ + // Expanded( + // child: Text( + // (address != null && + // address != "") + // ? address + // : widget.arguments[ + // "useTyped"] == + // 1 + // ? S + // .of(context) + // .qingxuanzhemendian + // : widget.arguments[ + // "useTyped"] == + // 2 + // ? S + // .of(context) + // .qingxuanzeshouhuodizhi + // : S + // .of(context) + // .xuni, + // overflow: + // TextOverflow.ellipsis, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF32A060), + // ), + // ), + // flex: 1, + // ), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Color(0xFF32A060), + // ), + // ], + // ), + // ), + // flex: 1, + // ), + // ], + // ), + // visible: widget.arguments["useTyped"] != 3, + // ), + // SizedBox( + // height: 12.h, + // ), + // ], + // ), + // ), Container( margin: EdgeInsets.only( left: 16, right: 16, top: 8, bottom: 16), @@ -644,20 +634,30 @@ class _ExchangeOrderPage extends State { width: 12, ), Text( - widget.arguments["payType"] == 1 - ? "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" - : ((widget.arguments["price"] == null || - widget.arguments["price"] == "0" - ? "" - : "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + - (widget.arguments["money"] == null || - widget.arguments["money"] == - "0.00" - ? "" - : " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元")), + // widget.arguments["payType"] == 1 + // ? "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}印章" + // : (widget.arguments["payType"] == 2 ?"${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" + // :((widget.arguments["price"] == null || + // widget.arguments["price"] == "0" + // ? (widget.arguments["oneBean"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["oneBean"] ??"0") + // ? "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章" + // :(widget.arguments["onePrice"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["onePrice"]) + // ?"${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分" + // :"${AppUtils.calculateDouble(double.parse(widget.arguments["oneMoney"]) * buyNum)}元")) + // : "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + + // (widget.arguments["money"] == null || + // widget.arguments["money"] == + // "0.00" + // ? "" + // : " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"))), + payableAmount(), style: TextStyle( fontSize: 12, - decoration: (widget.arguments["payType"] == 3) + decoration: (widget.arguments["payType"] == + 4 && + ((widget.arguments["price"] != "0" && widget.arguments["money"] != "0.00" + || (widget.arguments["oneBean"] ?? "0") != "0" + || widget.arguments["onePrice"] != "0"))) ? TextDecoration.lineThrough : TextDecoration.none, fontFamily: 'JDZhengHT', @@ -669,13 +669,17 @@ class _ExchangeOrderPage extends State { SizedBox( height: 12, ), - if (widget.arguments["payType"] == 3) + if (widget.arguments["payType"] == 4 && + (widget.arguments["price"] != "0" && + widget.arguments["money"] != "0.00" || + (widget.arguments["oneBean"] ?? "0") != "0" || + widget.arguments["onePrice"] != "0")) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "现金抵扣积分", + payableAmount().contains("印章")? "现金抵扣印章":"现金抵扣积分", style: TextStyle( fontSize: 14, color: Color(0xFF353535), @@ -685,7 +689,7 @@ class _ExchangeOrderPage extends State { width: 12, ), Text( - "${double.parse(widget.arguments["oneMoney"]) * buyNum}元", + "${AppUtils.calculateDouble(double.parse(widget.arguments["oneMoney"]) * buyNum)}元", style: TextStyle( fontSize: 12, fontFamily: 'JDZhengHT', @@ -715,7 +719,8 @@ class _ExchangeOrderPage extends State { handleNeedPay(), style: TextStyle( fontFamily: 'JDZhengHT', - fontSize: 12.sp, color: Color(0xFF32A060)), + fontSize: 12.sp, + color: Color(0xFF32A060)), ), ], ), @@ -778,16 +783,23 @@ class _ExchangeOrderPage extends State { setState(() { if (widget.arguments["payType"] == 1 ? (double.parse(widget - .arguments["onePrice"]) * + .arguments["oneBean"]) * (buyNum + 1)) > double.parse(points) - : (widget.arguments["price"] == null || - widget.arguments["price"] == "0" - ? false - : (double.parse(widget - .arguments["price"]) * + : (widget.arguments["payType"] == 2 + ? (double.parse(widget.arguments[ + "onePrice"]) * (buyNum + 1)) > - double.parse(points))) { + double.parse(points) + : (widget.arguments["price"] == + null || + widget.arguments["price"] == + "0" + ? false + : (double.parse(widget + .arguments["price"]) * + (buyNum + 1)) > + double.parse(points)))) { SmartDialog.showToast("您的积分不足", alignment: Alignment.center); return; @@ -806,8 +818,8 @@ class _ExchangeOrderPage extends State { ], ), ), - if (widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && + if (widget.arguments["payType"] == 4 || + (widget.arguments["payType"] == 3 && widget.arguments["money"] != "0.00")) Container( width: double.infinity, @@ -962,7 +974,7 @@ class _ExchangeOrderPage extends State { ], ), ), - SizedBox(height:100.h) + SizedBox(height: 100.h) ], )), Align( @@ -971,11 +983,10 @@ class _ExchangeOrderPage extends State { height: 54.h, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular( - 45 - ), + borderRadius: BorderRadius.circular(45), ), - margin: EdgeInsets.only(bottom:20.h,left: 16.w,right: 16.w), + margin: + EdgeInsets.only(bottom: 20.h, left: 16.w, right: 16.w), child: Row( children: [ Spacer(), @@ -1018,18 +1029,19 @@ class _ExchangeOrderPage extends State { topRight: Radius.circular(45), ), ), - child: Text( - widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && - widget.arguments["money"] != "0.00") - ? S.current.jiesuan - : S.current.duihuan, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, + child: Text( + widget.arguments["payType"] == 4 || + (widget.arguments["payType"] == 3 && + widget.arguments["money"] != "0.00") + ? S.current.jiesuan + : S.current.duihuan, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), ), - ),), + ), ), ], ), @@ -1053,21 +1065,48 @@ class _ExchangeOrderPage extends State { ); } + ///应付数额价格显示 + String payableAmount() { + if (widget.arguments["payType"] == 0) return ""; + if (widget.arguments["payType"] == 1) { + return "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}印章"; + } else if (widget.arguments["payType"] == 2) { + return "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分"; + } else if (widget.arguments["payType"] == 3) { + return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; + } else if (widget.arguments["payType"] == 4) { + if ((widget.arguments["oneBean"] ?? "0") != "0") { + return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章"; + } else if (widget.arguments["onePrice"] != "0") { + return "${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分"; + } else if ((widget.arguments["price"] != null || widget.arguments["price"] != "0") && (widget.arguments["money"] != null || widget.arguments["money"] != "0.00")) { + if(widget.arguments["price"] == "0"){ + return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneMoney"]) * buyNum)}元"; + } + return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; + } + } + } + + ///总价支付价格 String handleNeedPay() { - if(widget.arguments["payType"] == 0) - return ""; - if(widget.arguments["payType"] == 1){ - return S.of(context).jifen_((double.parse(widget.arguments["onePrice"]) * buyNum).toInt()); - }else if(widget.arguments["payType"] ==2){ + if (widget.arguments["payType"] == 0) return ""; + if (widget.arguments["payType"] == 1) { + return "${(double.parse(widget.arguments["oneBean"]) * buyNum).toInt()}印章"; + } + if (widget.arguments["payType"] == 2) { + return S.of(context).jifen_( + (double.parse(widget.arguments["onePrice"]) * buyNum).toInt()); + } else if (widget.arguments["payType"] == 3) { return (widget.arguments["price"] == null || - widget.arguments["price"] == "0" - ? "" - : "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + + widget.arguments["price"] == "0" + ? "" + : "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + (widget.arguments["money"] == null || - widget.arguments["money"] == "0.00" + widget.arguments["money"] == "0.00" ? "" : " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"); - }else if(widget.arguments["payType"] == 3){ + } else if (widget.arguments["payType"] == 4) { return "${AppUtils.calculateDouble(double.tryParse(widget.arguments["oneMoney"]) * buyNum) ?? 0}元"; } } @@ -1123,8 +1162,13 @@ class _ExchangeOrderPage extends State { } BaseData baseDate = await apiService.creditOrder({ "goodsId": widget.arguments["goodsId"], - "isOneSell": widget.arguments["payType"] != 2, - "isPoints": !handleNeedPay().contains("元"), + "isOneSell": widget.arguments["payType"] != 3, + + ///增加集换卡,该字段去掉改用payType + // "isPoints": !handleNeedPay().contains("元"), + "payType": (widget.arguments["payType"] == 1) + ? 2 + : ((widget.arguments["payType"] == 2) ? 1 : 3), "number": buyNum, "useTyped": widget.arguments["useTyped"], "payChannel": @@ -1134,8 +1178,8 @@ class _ExchangeOrderPage extends State { }); if (baseDate.isSuccess) { String realPay = handleNeedPay(); - if ((widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && + if ((widget.arguments["payType"] == 4 || + (widget.arguments["payType"] == 3 && widget.arguments["money"] != "0.00")) && checkIndex == 3) { // if(Platform.isAndroid){ @@ -1165,7 +1209,9 @@ class _ExchangeOrderPage extends State { } await Navigator.of(context) .pushNamed('/router/exchange_order_success_page', arguments: { - "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", + "price": realPay.contains("积分") + ? realPay.substring(0, realPay.indexOf("积分")) + : "0", "realPay": realPay, "points": points, "payChannel": widget.arguments["payChannel"], diff --git a/lib/retrofit/data/findMiNiGroupList.dart b/lib/retrofit/data/findMiNiGroupList.dart index de60e3cb..8b22f8f5 100644 --- a/lib/retrofit/data/findMiNiGroupList.dart +++ b/lib/retrofit/data/findMiNiGroupList.dart @@ -103,6 +103,7 @@ class ProductListBean { String printerFlag; dynamic markProductNone; SubscribeParam subscribeParam; + bool isSetMeal; static ProductListBean fromJson(Map map) { if (map == null) return null; @@ -137,6 +138,7 @@ class ProductListBean { productListBean.printerFlag = map['printerFlag']; productListBean.markProductNone = map['markProductNone']; productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']); + productListBean.isSetMeal = map['isSetMeal']; return productListBean; } @@ -171,6 +173,7 @@ class ProductListBean { "printerFlag": printerFlag, "markProductNone": markProductNone, "subscribeParam": subscribeParam, + "isSetMeal": isSetMeal, }; } diff --git a/lib/retrofit/data/goods.dart b/lib/retrofit/data/goods.dart index e19934b4..6a3065a0 100644 --- a/lib/retrofit/data/goods.dart +++ b/lib/retrofit/data/goods.dart @@ -42,6 +42,7 @@ class Goods { String money, String onePrice, String oneMoney, + String oneBean, String orderId, int stock, int sales, @@ -69,6 +70,7 @@ class Goods { _money = money; _onePrice = onePrice; _oneMoney = oneMoney; + _oneBean = oneBean; _orderId = orderId; _stock = stock; _sales = sales; @@ -99,6 +101,7 @@ class Goods { _money = json['money']; _onePrice = json['onePrice']; _oneMoney = json['oneMoney']; + _oneBean = json['oneBean']; _orderId = json['orderId']; _stock = json['stock']; _sales = json['sales']; @@ -127,6 +130,7 @@ class Goods { String _money; String _onePrice; String _oneMoney; + String _oneBean; String _orderId; int _stock; int _sales; @@ -155,6 +159,7 @@ class Goods { String get money => _money; String get onePrice => _onePrice; String get oneMoney => _oneMoney; + String get oneBean => _oneBean; String get orderId => _orderId; int get stock => _stock; int get sales => _sales; @@ -185,6 +190,7 @@ class Goods { map['money'] = _money; map['onePrice'] = _onePrice; map['oneMoney'] = _oneMoney; + map['oneBean'] = _oneBean; map['orderId'] = _orderId; map['stock'] = _stock; map['sales'] = _sales; diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index dc0384e3..a1ad9f27 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 +const localBaseUrl = "http://192.168.10.129:8765/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index b27f12ef..a1aac3c6 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -194,7 +194,7 @@ class _MinApiService implements MinApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => (json as List) + (json) => ((json??"") == "")?null:(json as List) .map( (i) => ShoppingCart.fromJson(i as Map)) .toList()); diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index f03753ed..e27f691c 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -66,7 +66,7 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 +const localBaseUrl = "http://192.168.10.129:8766/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index d10f7b40..e8f4cd49 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -10,6 +10,8 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/separator.dart'; +import '../../retrofit/data/shoppingCart.dart'; + class SettlementOrderCommodity extends StatefulWidget { final int isTakeOut; final int tableId; @@ -181,89 +183,149 @@ class _SettlementOrderCommodity extends State { Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), - child: Row( + child: Column( children: [ - MImage( - productList.skuImg, - width: 55, - height: 55, - fit: BoxFit.cover, - radius: BorderRadius.circular(4), - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only( - left: 8.w, + Row( + children: [ + MImage( + productList.skuImg, + width: 55, + height: 55, + fit: BoxFit.cover, + radius: BorderRadius.circular(4), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), - // height: 44.h, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - productList.productName, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - SizedBox( - height: 4.h, + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.only( + left: 8.w, ), - Text( - productList.skuNameStr != null - ? "${productList.skuNameStr ?? ""}" - : "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFA29E9E), - ), + // height: 44.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + productList.productName, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + height: 4.h, + ), + Text( + productList.skuNameStr != null + ? "${productList.skuNameStr ?? ""}" + : "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFFA29E9E), + ), + ), + Text( + "x${productList.buyNum}", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF727272), + ), + ), + ], ), + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ Text( - "x${productList.buyNum}", + 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( - fontSize: 12.sp, - color: Color(0xFF727272), + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF4C4C4C), ), ), + if (productList.discountAmount != null && productList.discountAmount != "0") + 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.setMealDataList.length != 0) + ListView.builder( + itemCount: productList.setMealDataList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (context, index) { + return orderMealsItem(productList.setMealDataList[index]); + }, + ), + ], + ), + ); + } + + Widget orderMealsItem(SetMealDataList setMealDataList) { + return Container( + margin: EdgeInsets.symmetric(vertical:10.h,), + child: Row( + children: [ + Expanded( + flex:2, + child: Text( + setMealDataList.productInfoList[0].productName, + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffA29E9E), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), ), ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - 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"))), - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xFF4C4C4C), - ), + Expanded(flex:3, + child: Text( + "${(setMealDataList.productInfoList[0].skuName == "") ? "": setMealDataList.productInfoList[0].skuName}", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffA29E9E), + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, ), - if (productList.discountAmount != null && productList.discountAmount != "0") - Text( - S.of(context).yuan_(productList.sellPrice), - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - fontFamily: 'JDZhengHT', - decoration: TextDecoration.lineThrough, - color: Color(0xFFA29E9E), - ), - ) - ], - ) + ), + ), + Text( + "x${setMealDataList.productInfoList[0].buyNumber.toString()}", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffFF7A1A), + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), + ), ], ), ); diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index c27d2d8b..0b3815ce 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -64,12 +64,14 @@ class _ShopDetailsPage extends State { String parentId; int numberOfPeople = 0; int index; + bool isSetMeal; @override void initState() { super.initState(); id = widget.arguments["id"]; storeId = widget.arguments["storeId"]; + isSetMeal = widget.arguments["isSetMeal"] ?? false; // SharedPreferences.getInstance().then((value) { // String minToken = value.getString("minToken"); // String tenant = value.getString("tenant"); @@ -841,10 +843,22 @@ class _ShopDetailsPage extends State { ), )), GestureDetector( - onTap: () { + onTap: () async { if (storeInfo.posType.code == "NORMALSTORE" && tableId == 0) { showDeleteDialog(); + } else if (isSetMeal == true) { + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": id, + "storeId": storeId, + "tableId": tableId + }); + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); } else { _queryMiNiDetail(id, counts); } @@ -875,7 +889,9 @@ class _ShopDetailsPage extends State { false) == true) ? S.of(context).lijiyuyue - : "加入购物车", + : (isSetMeal ?? false) == true + ? "选套餐" + : "加入购物车", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index e0d1e416..c64a34df 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -426,6 +426,7 @@ class _StoreOrderPage extends State ]; }, body: + ///点餐 TabBarView( physics: NeverScrollableScrollPhysics(), @@ -656,9 +657,9 @@ class _StoreOrderPage extends State "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, - "distance":widget.arguments["distance"], - "vipLevelName":memberVo.memberRankVo.rankName, - "isVips":memberVo.isVip, + "distance": widget.arguments["distance"], + "vipLevelName": memberVo.memberRankVo.rankName, + "isVips": memberVo.isVip, "distance": widget.arguments["distance"], "subscribeParam": miNiDetail?.subscribeParam, }, @@ -693,7 +694,7 @@ class _StoreOrderPage extends State color: Colors.white.withAlpha(76), ), ), - autoplay: (storeInfo?.bannerList?.length ?? 0) == 0 ? false :true, + autoplay: (storeInfo?.bannerList?.length ?? 0) == 0 ? false : true, duration: 1000, autoplayDelay: 2000, itemBuilder: (context, position) { @@ -969,6 +970,8 @@ class _StoreOrderPage extends State this.shopCarGoods = await queryShopCar(); debugPrint("count.toString()"); setState(() {}); + } else { + SmartDialog.showToast(baseDate.msg, alignment: Alignment.center); } } @@ -1014,6 +1017,8 @@ class _StoreOrderPage extends State this.shopCarGoods = value; setState(() {}); }); + } else { + SmartDialog.showToast(baseDate.msg, alignment: Alignment.center); } } diff --git a/lib/store/store_view/product_meals_sku.dart b/lib/store/store_view/product_meals_sku.dart index 3d2a7e57..30d6bf80 100644 --- a/lib/store/store_view/product_meals_sku.dart +++ b/lib/store/store_view/product_meals_sku.dart @@ -316,6 +316,7 @@ class _ProductMealsSku extends State { return Container( margin: EdgeInsets.symmetric(vertical: 16.h), child: Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ MImage( productSetMeals[position].productInfoList[index].productImg ?? "", @@ -332,60 +333,63 @@ class _ProductMealsSku extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Expanded( - child: Text( - productSetMeals[position] - .productInfoList[index] - .productName ?? - "", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: Colors.black, - fontSize: 13.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - ), - if (productSetMeals[position] - .productInfoList[index] - .productAttrInfoList[0] - .attrName != - "") - GestureDetector( + Padding( + padding: EdgeInsets.symmetric(vertical: 8.h), + child: Row( + children: [ + Expanded( child: Text( - S.of(context).xuanguige, + productSetMeals[position] + .productInfoList[index] + .productName ?? + "", + overflow: TextOverflow.ellipsis, + maxLines: 1, style: TextStyle( color: Colors.black, fontSize: 13.sp, - fontWeight: MyFontWeight.regular, + fontWeight: MyFontWeight.semi_bold, ), ), - onTap: () { - showSkuDialog(position, index); - }, ), - if (productSetMeals[position] - .productInfoList[index] - .productAttrInfoList[0] - .attrName != - "") - GestureDetector( - onTap: () { - showSkuDialog(position, index); - }, - child: Icon( - Icons.chevron_right, - color: Colors.black, - size: 18, + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName != + "") + GestureDetector( + child: Text( + S.of(context).xuanguige, + style: TextStyle( + color: Colors.black, + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), + ), + onTap: () { + showSkuDialog(position, index); + }, ), - ) - ], + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName != + "") + GestureDetector( + onTap: () { + showSkuDialog(position, index); + }, + child: Icon( + Icons.chevron_right, + color: Colors.black, + size: 18, + ), + ) + ], + ), ), - SizedBox(height: 8.h), Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ if (productSetMeals[position] .productInfoList[index] @@ -410,77 +414,123 @@ class _ProductMealsSku extends State { ), ), Spacer(), - InkWell( - onTap: () { - setState(() { - if (productSetMeals[position] - .productInfoList[index] - .count >= - 1) - productSetMeals[position] - .productInfoList[index] - .count -= 1; - }); - }, - child: Image.asset( - "assets/image/reduce.webp", - width: 22, - height: 22.h, - ), - ), - Container( - width: 30, - alignment: Alignment.center, - child: Text( - productSetMeals[position] + if (productSetMeals[position] .productInfoList[index] - .count - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + .skuInfoList + .where((element) => element.isSelected) + .isNotEmpty && + productSetMeals[position].productInfoList[index].count > + 0) + Padding( + padding: EdgeInsets.only(right: 4.w), + child: Text( + "x${productSetMeals[position].productInfoList[index].count}", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Color(0xffFF7A1A), + fontSize: 13.sp, + fontWeight: MyFontWeight.regular, + ), ), ), - ), - GestureDetector( - onTap: () { - setState(() { - if (productSetMeals[position] + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName == + "") + InkWell( + onTap: () { + setState(() { + if (productSetMeals[position] + .productInfoList[index] + .count >= + 1) + productSetMeals[position] .productInfoList[index] - .productAttrInfoList[0] - .attrName != - "") { - showSkuDialog(position, index); - return; - } - int total = 0; - productSetMeals[position] - .productInfoList - .forEach((element) { - total += element.count; + .count -= 1; }); - if (total >= - productSetMeals[position].optionalNumber) { - SmartDialog.showToast("抱歉,无法加购更多", - alignment: Alignment.center); - return; - } - if (productSetMeals[position] + }, + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22.h, + ), + ), + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName == + "") + Container( + width: 30, + alignment: Alignment.center, + child: Text( + (productSetMeals[position].totalNumber > 1 && + productSetMeals[position].totalNumber != + productSetMeals[position].optionalNumber) + ? productSetMeals[position] .productInfoList[index] - .count == - 0) + .count + .toString() + : (productSetMeals[position] + .productInfoList[index] + .count = 1) + .toString(), + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName == + "") + GestureDetector( + onTap: () { + setState(() { + if (productSetMeals[position] + .productInfoList[index] + .productAttrInfoList[0] + .attrName != + "") { + showSkuDialog(position, index); + return; + } + int total = 0; productSetMeals[position] - .productInfoList[index] - .count += 1; - }); - }, - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22.h, + .productInfoList + .forEach((element) { + total += element.count; + }); + if (total >= + productSetMeals[position].optionalNumber || + productSetMeals[position] + .productInfoList[index] + .count >= + 1) { + SmartDialog.showToast("抱歉,无法加购更多", + alignment: Alignment.center); + return; + } + if (productSetMeals[position] + .productInfoList[index] + .count == + 0) + productSetMeals[position] + .productInfoList[index] + .count += 1; + }); + }, + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22.h, + ), ), - ), ], ), SizedBox( diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 14c03d45..53576f7f 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart'; @@ -237,9 +238,11 @@ class _ProductSku extends State { ), InkWell( onTap: () async { - if(count == 1) - return; - if((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false){ + if (count == 1) return; + if ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) { _isTapEd = true; EasyLoading.show(status: S.current.zhengzaijiazai); await widget.reduce(widget.miNiDetail, selectSkus); @@ -267,7 +270,10 @@ class _ProductSku extends State { ), InkWell( onTap: () async { - if((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false){ + if ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) { _isTapEd = true; EasyLoading.show(status: S.current.zhengzaijiazai); if (count == 1 && realCount == 0) @@ -276,7 +282,16 @@ class _ProductSku extends State { else await widget.add(widget.miNiDetail, selectSkus); } - count += 1; + if ((widget?.miNiDetail?.oversold ?? 0) == 0 && + count >= + (widget?.miNiDetail?.productSkuVOList[0] + ?.skuStock ?? + 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else { + count += 1; + } setState(() {}); EasyLoading.dismiss(); }, @@ -295,7 +310,12 @@ class _ProductSku extends State { RoundButton( width: double.infinity, height: 54.h, - text: (widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == true ? S.of(context).lijiyuyue:"加入购物车", + text: + (widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? + false) == + true + ? S.of(context).lijiyuyue + : "加入购物车", textColor: Colors.white, fontWeight: MyFontWeight.semi_bold, radius: 27, @@ -305,7 +325,15 @@ class _ProductSku extends State { Navigator.of(context).pop(); // SmartDialog.dismiss(); if (!_isTapEd) - widget.addShopCar(widget.miNiDetail, selectSkus,((widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == false) ? 1 : count); + widget.addShopCar( + widget.miNiDetail, + selectSkus, + ((widget?.miNiDetail?.subscribeParam + ?.isEnableSubscribe ?? + false) == + false) + ? 1 + : count); }, ), if (widget.buttonType == 1) diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index fac29938..b4f2404e 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -1,6 +1,7 @@ import 'package:dio/dio.dart'; 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/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; @@ -232,7 +233,8 @@ class _ShopGoods extends State { (widget.productListBean?.attrStyle ?? 0) == 1 && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? - false)) + false) && + !(widget?.productListBean?.isSetMeal ?? false)) GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -249,58 +251,57 @@ class _ShopGoods extends State { 0); } }, - child: Container( - // padding: EdgeInsets.only(right: 16.w), - child: Stack( - children: [ - Container( - padding: EdgeInsets.only( - left: 35.w, - top: 4.h, - bottom: 4.h, - ), - margin: EdgeInsets.only(right:8.w,top: 4.h), - child: RoundButton( - text: S.of(context).xuanguige, - textColor: Colors.white, - fontWeight: MyFontWeight.medium, - radius: 3, - backgroup: Color(0xFF32A060), - fontSize: 11.sp, - padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 3.w), - ), + child: Stack( + children: [ + Container( + padding: EdgeInsets.only( + left: 35.w, + top: 4.h, + bottom: 4.h, ), - Positioned( - right: 0, - child: Visibility( - visible: widget.count > 0, - child: RoundButton( - width: 17, - height: 17.h, - text: "${widget.count}", - textColor: Color(0xFF32A060), - fontWeight: MyFontWeight.regular, - backgroup: Colors.white, - fontSize: 12.sp, - radius: 100, - ), + margin: EdgeInsets.only(right: 8.w, top: 4.h), + child: RoundButton( + text: S.of(context).xuanguige, + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 3.w), + ), + ), + Positioned( + right: 0, + child: Visibility( + visible: widget.count > 0, + child: RoundButton( + width: 17, + height: 17.h, + text: "${widget.count}", + textColor: Color(0xFF32A060), + fontWeight: MyFontWeight.regular, + backgroup: Colors.white, + fontSize: 12.sp, + radius: 100, ), ), - ], - ), + ), + ], )), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0 && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? - false)) + false) && + !(widget?.productListBean?.isSetMeal ?? false)) Spacer(), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0 && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? - false)) + false) && + !(widget?.productListBean?.isSetMeal ?? false)) GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -324,7 +325,8 @@ class _ShopGoods extends State { (widget.productListBean?.attrStyle ?? 0) == 0 && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? - false)) + false) && + !(widget?.productListBean?.isSetMeal ?? false)) Container( alignment: Alignment.center, child: Text( @@ -340,7 +342,8 @@ class _ShopGoods extends State { (widget.productListBean?.attrStyle ?? 0) == 0 && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? - false)) + false) && + !(widget?.productListBean?.isSetMeal ?? false)) GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -348,7 +351,14 @@ class _ShopGoods extends State { widget.tableId == 0) { showDeleteDialog(); } else { - if (_jumpType == -1) + if ((widget?.productListBean?.oversold ?? 0) == 0 && + widget.count >= + (widget?.shoppingCartSkuItemListBean + ?.skuStock ?? + 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else if (_jumpType == -1) queryMiNiDetail(widget.productListBean.id); else if (_jumpType == 0) widget.add(widget.shoppingCartSkuItemListBean); @@ -364,7 +374,7 @@ class _ShopGoods extends State { } }, child: Container( - padding: EdgeInsets.only(left: 6.w, right:9.w), + padding: EdgeInsets.only(left: 6.w, right: 9.w), child: Image.asset( "assets/image/add.webp", width: 22, @@ -401,7 +411,7 @@ class _ShopGoods extends State { top: 4.h, bottom: 4.h, ), - margin: EdgeInsets.only(right:8.w,top: 4), + margin: EdgeInsets.only(right: 8.w, top: 4), child: RoundButton( text: S.of(context).lijiyuyue, textColor: Colors.white, @@ -413,6 +423,72 @@ class _ShopGoods extends State { vertical: 5.h, horizontal: 3.w), ), )), + if ((widget.productListBean.isSetMeal ?? false) == true) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if (widget.storeInfo.posType.code == + "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else if ((widget?.productListBean?.oversold ?? + 0) == + 0 && + widget.count >= + (widget?.shoppingCartSkuItemListBean + ?.skuStock ?? + 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else { + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": widget.productListBean.id, + "storeId": widget.productListBean.storeId, + "tableId": widget.tableId + }); + widget.queryShoppingCart(); + } + }, + child: Stack( + children: [ + Container( + padding: EdgeInsets.only( + left: 35.w, + top: 4.h, + bottom: 4.h, + ), + margin: EdgeInsets.only(right: 8.w, top: 4.h), + child: RoundButton( + text: "选套餐", + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: EdgeInsets.symmetric( + vertical: 5.h, horizontal: 3.w), + ), + ), + Positioned( + right: 0, + child: Visibility( + visible: widget.count > 0, + child: RoundButton( + width: 17, + height: 17.h, + text: "${widget.count}", + textColor: Color(0xFF32A060), + fontWeight: MyFontWeight.regular, + backgroup: Colors.white, + fontSize: 12.sp, + radius: 100, + ), + ), + ), + ], + )) ], ), SizedBox( diff --git a/lib/store/store_view/shop_goods_car.dart b/lib/store/store_view/shop_goods_car.dart index 084aa832..b7dfb200 100644 --- a/lib/store/store_view/shop_goods_car.dart +++ b/lib/store/store_view/shop_goods_car.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; @@ -12,21 +13,21 @@ class ShopGoodsCar extends StatefulWidget { final Function(String id, int count) queryMiNiDetail; final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) add; final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) - reduce; + reduce; final ProductListBean productListBean; final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; final int count; final bool isShopCart; ShopGoodsCar( - this.add, - this.reduce, { - this.productListBean, - this.count = 0, - this.isShopCart = false, - this.queryMiNiDetail, - this.shoppingCartSkuItemListBean, - }); + this.add, + this.reduce, { + this.productListBean, + this.count = 0, + this.isShopCart = false, + this.queryMiNiDetail, + this.shoppingCartSkuItemListBean, + }); @override State createState() { @@ -38,260 +39,283 @@ class _ShopGoodsCar extends State { @override Widget build(BuildContext context) { return Container( - color: Colors.white, - padding: EdgeInsets.only( - right: 16.w, - // bottom: 20.h, - ), - child:Column( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox(width: 12.w), - MImage( - widget.productListBean != null - ? widget.productListBean.imgPath - : (widget.shoppingCartSkuItemListBean != null - ? widget.shoppingCartSkuItemListBean.skuImg - : ""), - width: 70.h, - height: 70.h, - radius: BorderRadius.circular(4), - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Text( - widget.productListBean != null - ? widget.productListBean.productName - : widget.shoppingCartSkuItemListBean.productName, - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - color: Colors.black, - fontSize: 13.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ), - // Image.asset( - // "assets/image/green_leaf.webp", - // fit: BoxFit.cover, - // width: 12, - // height: 12, - // ), - // Text( - // "X300", - // style: TextStyle( - // color: Color(0xFF55BC51), - // fontSize: 10.sp, - // fontWeight: MyFontWeight.semi_bold, - // ), - // ), - ], - ), - SizedBox( - height: 2.h, - ), - Row( - children: [ - Expanded( - child: Text( - (widget.productListBean != null - ? widget.productListBean.shortName - : ((widget.shoppingCartSkuItemListBean.skuName == "0") ? "": widget.shoppingCartSkuItemListBean.skuName ) ?? ""), - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - color: Color(0xFF4C4C4C), - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ), - SizedBox( - width: 10, - ), - ], - ), - SizedBox( - height: 7.h, - ), - Row( - children: [ - Row( - children: [ - Text( - "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", + color: Colors.white, + padding: EdgeInsets.only( + right: 16.w, + // bottom: 20.h, + ), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox(width: 12.w), + MImage( + widget.productListBean != null + ? widget.productListBean.imgPath + : (widget.shoppingCartSkuItemListBean != null + ? widget.shoppingCartSkuItemListBean.skuImg + : ""), + width: 70.h, + height: 70.h, + radius: BorderRadius.circular(4), + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + widget.productListBean != null + ? widget.productListBean.productName + : widget + .shoppingCartSkuItemListBean.productName, + overflow: TextOverflow.ellipsis, + maxLines: 2, style: TextStyle( - color: Color(0xFFFF7A1A), - fontSize: 16.sp, - fontFamily: 'JDZhengHT', + color: Colors.black, + fontSize: 13.sp, fontWeight: MyFontWeight.medium, ), ), - SizedBox( - width: 2.w, + ), + // Image.asset( + // "assets/image/green_leaf.webp", + // fit: BoxFit.cover, + // width: 12, + // height: 12, + // ), + // Text( + // "X300", + // style: TextStyle( + // color: Color(0xFF55BC51), + // fontSize: 10.sp, + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + ], + ), + SizedBox( + height: 2.h, + ), + Row( + children: [ + Expanded( + child: Text( + (widget.productListBean != null + ? widget.productListBean.shortName + : ((widget.shoppingCartSkuItemListBean + .skuName == + "0") + ? "" + : widget.shoppingCartSkuItemListBean + .skuName) ?? + ""), + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), ), - // Container( - // width: 44.w, - // height: 18.h, - // decoration: BoxDecoration( - // color: Color(0xFFFF4500), - // borderRadius: BorderRadius.circular(2), - // ), - // alignment: Alignment.center, - // child: Text( - // "APP专享", - // style: TextStyle( - // color: Color(0xFFFFFFFF), - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // ), - // ), - // ), - ], - ), - Spacer(), - if (!widget.isShopCart && - (widget.productListBean?.attrStyle ?? 0) == 1) - Stack( + ), + SizedBox( + width: 10, + ), + ], + ), + SizedBox( + height: 7.h, + ), + Row( + children: [ + Row( children: [ - Container( - margin: EdgeInsets.only(right: 8, top: 4), - child: RoundButton( - width: 49.w, - text: S.of(context).xuanguige, - textColor: Colors.white, + Text( + "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", + style: TextStyle( + color: Color(0xFFFF7A1A), + fontSize: 16.sp, + fontFamily: 'JDZhengHT', fontWeight: MyFontWeight.medium, - radius: 3, - backgroup: Color(0xFF32A060), - fontSize: 11.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), - callback: () { - widget.queryMiNiDetail( - widget.productListBean != null - ? widget.productListBean.id - : widget.shoppingCartSkuItemListBean - .productId, - 0); - }, ), ), - Positioned( - right: 0, - child: Visibility( - visible: widget.count > 0, + SizedBox( + width: 2.w, + ), + // Container( + // width: 44.w, + // height: 18.h, + // decoration: BoxDecoration( + // color: Color(0xFFFF4500), + // borderRadius: BorderRadius.circular(2), + // ), + // alignment: Alignment.center, + // child: Text( + // "APP专享", + // style: TextStyle( + // color: Color(0xFFFFFFFF), + // fontSize: 10.sp, + // fontWeight: MyFontWeight.medium, + // ), + // ), + // ), + ], + ), + Spacer(), + if (!widget.isShopCart && + (widget.productListBean?.attrStyle ?? 0) == 1) + Stack( + children: [ + Container( + margin: EdgeInsets.only(right: 8, top: 4), child: RoundButton( - width: 17, - height: 17.h, - text: "${widget.count}", - textColor: Color(0xFF32A060), - fontWeight: MyFontWeight.regular, - backgroup: Colors.white, - fontSize: 12.sp, - radius: 100, + width: 49.w, + text: S.of(context).xuanguige, + textColor: Colors.white, + fontWeight: MyFontWeight.medium, + radius: 3, + backgroup: Color(0xFF32A060), + fontSize: 11.sp, + padding: + EdgeInsets.symmetric(vertical: 5.h), + callback: () { + widget.queryMiNiDetail( + widget.productListBean != null + ? widget.productListBean.id + : widget + .shoppingCartSkuItemListBean + .productId, + 0); + }, + ), + ), + Positioned( + right: 0, + child: Visibility( + visible: widget.count > 0, + child: RoundButton( + width: 17, + height: 17.h, + text: "${widget.count}", + textColor: Color(0xFF32A060), + fontWeight: MyFontWeight.regular, + backgroup: Colors.white, + fontSize: 12.sp, + radius: 100, + ), ), ), + ], + ), + if (widget.isShopCart || + (widget.productListBean?.attrStyle ?? 0) == 0) + InkWell( + onTap: () { + widget + .reduce(widget.shoppingCartSkuItemListBean); + }, + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22.h, ), - ], - ), - if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) - InkWell( - onTap: () { - widget.reduce(widget.shoppingCartSkuItemListBean); - }, - child: Image.asset( - "assets/image/reduce.webp", - width: 22, - height: 22.h, ), - ), - if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) - Container( - width: 30, - alignment: Alignment.center, - child: Text( - "${widget.count}", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + if (widget.isShopCart || + (widget.productListBean?.attrStyle ?? 0) == 0) + Container( + width: 30, + alignment: Alignment.center, + child: Text( + "${widget.count}", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), ), ), - ), - if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) - GestureDetector( - onTap: () { - widget.add(widget.shoppingCartSkuItemListBean); - }, - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22.h, + if (widget.isShopCart || + (widget.productListBean?.attrStyle ?? 0) == 0) + GestureDetector( + onTap: () { + if ((widget?.productListBean?.oversold ?? 0) == + 0 && + widget.count >= + (widget?.shoppingCartSkuItemListBean + ?.skuStock ?? + 0)) { + SmartDialog.showToast("库存不足", + alignment: Alignment.center); + } else { + widget + .add(widget.shoppingCartSkuItemListBean); + } + }, + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22.h, + ), ), - ), - ], - ), - SizedBox( - height: 4.h, - ), - Text( - "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", - style: TextStyle( - color: Color(0xFFA29E9E), - fontSize: 12.sp, - fontFamily: 'JDZhengHT', - decoration: TextDecoration.lineThrough, - fontWeight: MyFontWeight.regular, + ], ), - ), - ], + SizedBox( + height: 4.h, + ), + Text( + "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 12.sp, + fontFamily: 'JDZhengHT', + decoration: TextDecoration.lineThrough, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), ), - ), - ], - ), - if(widget.shoppingCartSkuItemListBean.setMealDataList.length != 0) - ListView.builder( - itemCount: widget.shoppingCartSkuItemListBean.setMealDataList.length, - scrollDirection: Axis.vertical, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.zero, - itemBuilder: (context, index) { - return shopCarMealsItem(widget.shoppingCartSkuItemListBean.setMealDataList[index]); - }, + ], ), - SizedBox(height:15.h,) - ], - ) - ); + if (widget.shoppingCartSkuItemListBean.setMealDataList.length != 0) + ListView.builder( + itemCount: + widget.shoppingCartSkuItemListBean.setMealDataList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (context, index) { + return shopCarMealsItem(widget + .shoppingCartSkuItemListBean.setMealDataList[index]); + }, + ), + SizedBox( + height: 15.h, + ) + ], + )); } - Widget shopCarMealsItem(SetMealDataList setMealDataList) { return Container( - margin: EdgeInsets.symmetric(vertical:10.h,horizontal: 16.w), + margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 16.w), child: Row( children: [ Expanded( - flex:2, + flex: 2, child: Text( setMealDataList.productInfoList[0].productName, overflow: TextOverflow.ellipsis, @@ -303,9 +327,10 @@ class _ShopGoodsCar extends State { ), ), ), - Expanded(flex:3, + Expanded( + flex: 3, child: Text( - "${(setMealDataList.productInfoList[0].skuName == "") ? "默认": setMealDataList.productInfoList[0].skuName}", + "${(setMealDataList.productInfoList[0].skuName == "") ? "默认" : setMealDataList.productInfoList[0].skuName}", overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( @@ -316,7 +341,7 @@ class _ShopGoodsCar extends State { ), ), Text( - setMealDataList.productInfoList[0].buyNumber.toString(), + "x${setMealDataList.productInfoList[0].buyNumber.toString()}", overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( @@ -329,5 +354,4 @@ class _ShopGoodsCar extends State { ), ); } - } diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 35a26cd7..4e6a99ce 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -189,6 +189,7 @@ class _StoreOrderListPage extends State { .pushNamed('/router/shop_details_page', arguments: { "id": e.id, "storeId": e.storeId, + "isSetMeal":e.isSetMeal }); widget.queryShoppingCart(); } diff --git a/lib/utils/upload_async.dart b/lib/utils/upload_async.dart index b4fb5339..4283554b 100644 --- a/lib/utils/upload_async.dart +++ b/lib/utils/upload_async.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:image_pickers/image_pickers.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:thumbnails/thumbnails.dart'; @@ -12,23 +13,56 @@ import '../community/release_dynamic.dart'; import '../retrofit/data/base_data.dart'; import '../retrofit/data/upload_result.dart'; import '../retrofit/retrofit_api.dart'; +import '../view_widget/custom_image.dart'; +import 'font_weight.dart'; class UploadAsync { static void upload(int dynamicType, List mediaPaths, String addressText, String dynamicText) async { SmartDialog.show( - widget: Container( - alignment: Alignment.centerRight, - margin: EdgeInsets.only( - right: 10.w, - ), - child: CircularProgressIndicator( - strokeWidth: 4.0, - backgroundColor: Colors.green, - // value: 0.4, - valueColor: new AlwaysStoppedAnimation(Colors.grey), - ), + widget: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only( + right: 10.w, ), + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 50.h, + height: 70.h, + decoration: BoxDecoration( + color: Colors.grey, borderRadius: BorderRadius.circular(2)), + child: dynamicType == 0 + ? Text( + dynamicText, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 10.sp, + color: Color(0xFFCDCCCC), + ), + ) + : ClipRRect( + borderRadius: BorderRadius.circular(2), + child: Image.file( + File(mediaPaths[0].galleryMode == GalleryMode.video + ? mediaPaths[0].thumbPath + : mediaPaths[0].path), + fit: BoxFit.cover, + width: double.infinity, + height: double.infinity, + ), + ), + ), + CircularProgressIndicator( + strokeWidth: 3.0, + backgroundColor: Colors.white, + // value: 0.4, + valueColor: new AlwaysStoppedAnimation(Colors.grey), + ), + ], + ), + ), maskWidgetTemp: SizedBox(), ); var sp = await SharedPreferences.getInstance(); @@ -162,7 +196,7 @@ class UploadInstance { return _instance; } - void notifyAllObservers(){ + void notifyAllObservers() { _uploadObserverList.forEach((element) { element.onUploadFinish(); }); diff --git a/pubspec.yaml b/pubspec.yaml index f42e0a03..52eb1c90 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.13+57 +version: 3.2.14+58 environment: sdk: ">=2.7.0 <3.0.0"