From e1c2f6d3664b8078ff7219bd55d4d117f30f4c0c Mon Sep 17 00:00:00 2001 From: fmk Date: Mon, 17 Apr 2023 10:37:29 +0800 Subject: [PATCH 1/8] ios --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 34ee85c0..232f7826 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( From 5f410bf273507191c1cf82aab7ce44a3c794dc38 Mon Sep 17 00:00:00 2001 From: fmk Date: Mon, 17 Apr 2023 11:06:17 +0800 Subject: [PATCH 2/8] =?UTF-8?q?ios=20=E5=A2=9E=E5=8A=A0=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity_coupon_remarks.dart | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 4335d428..534434c1 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -284,6 +284,46 @@ class _ActivityCouponRemarks extends State { ], ), ), + + SizedBox( + height: 13, + ), + InkWell( + onTap: () { + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "预约时间", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + Expanded( + child: Text( + "请选择时间", + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF858585), + fontWeight: MyFontWeight.medium, + ), + ), + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + ), + ], + ), + ), ], ), ); From 424d578679368fbc0e2781f27862103837207ca4 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Mon, 17 Apr 2023 17:39:04 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=9B=20=E9=A6=96=E9=A1=B5=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/new_login_page.dart | 1 + .../activity_coupon_remarks.dart | 18 ++++++++++++++++++ lib/store/store_order.dart | 10 +++++----- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index ff90b763..a584b3eb 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -284,6 +284,7 @@ class _NewLoginPage extends State { @override Widget build(BuildContext context) { return Scaffold( + resizeToAvoidBottomInset: false, body: GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 534434c1..1b4fe348 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -8,6 +8,9 @@ import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:intl/intl.dart'; + +import '../../view_widget/cupertino_date_picker.dart'; class ActivityCouponRemarks extends StatefulWidget { final Function() couponCart; @@ -290,6 +293,7 @@ class _ActivityCouponRemarks extends State { ), InkWell( onTap: () { + showDateSelector(); }, child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -329,6 +333,20 @@ class _ActivityCouponRemarks extends State { ); } + ///立即预约时间选择 + showDateSelector() async { + DateTime dateTime = await showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + builder: (_) { + return CupertinoDatePickerWidget(); + }); + if (dateTime != null) { + String time = DateFormat("yyyy-MM-dd").format(dateTime) ; + setState(() {}); + } + } + String activityText() { String promotion = ""; if (widget.promotions == null || widget.promotions == "") { diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 11a20298..d305b7a7 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -515,12 +515,12 @@ class _StoreOrderPage extends State Spacer(), GestureDetector( onTap: () { - // if(AppUtils.compareTime(storeInfo.openStartTime,DateFormat('HH:mm:ss').format(DateTime.now())) - // &&(!AppUtils.compareTime(storeInfo.openEndTime,DateFormat('HH:mm:ss').format(DateTime.now())))){ + if(AppUtils.compareTime(storeInfo.openStartTime,DateFormat('HH:mm:ss').format(DateTime.now())) + &&(!AppUtils.compareTime(storeInfo.openEndTime,DateFormat('HH:mm:ss').format(DateTime.now())))){ toDownOrder(); - // } - // else - // SmartDialog.showToast("营业时间:${storeInfo.openStartTime}-${storeInfo.openEndTime}", alignment: Alignment.center); + } + else + SmartDialog.showToast("营业时间:${storeInfo.openStartTime}-${storeInfo.openEndTime}", alignment: Alignment.center); }, child: RoundButton( width: 103.w, From 1d2340ec9d2ffe7c94f274ff1e7ecb5bf0abd02c Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Thu, 20 Apr 2023 11:28:13 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=9B=20=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E9=80=89=E6=8B=A9=E5=99=A8=EF=BC=9B=20=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E6=97=B6=E9=97=B4=E6=9B=B4=E6=94=B9-=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E5=95=86=E5=93=81=E7=9B=B4=E6=8E=A5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E9=A2=84=E7=BA=A6-=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E9=80=89=E5=A5=BD=E5=95=86=E5=93=81=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E7=9B=B4=E6=8E=A5=E8=B7=B3=E8=BD=AC=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E9=A1=B5-=E7=BB=93=E7=AE=97=E9=A1=B5=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E9=A2=84=E7=BA=A6=E5=95=86=E5=93=81=E5=B0=B1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A2=84=E7=BA=A6=E6=97=B6=E9=97=B4=E5=92=8C=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E5=BA=97=E9=93=BA-=E4=B8=8B=E5=8D=95=E6=97=B6?= =?UTF-8?q?=E6=8A=8A=E9=A2=84=E7=BA=A6=E6=97=B6=E9=97=B4=EF=BC=8C=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E5=BA=97=E9=93=BA=E6=94=BE=E5=A4=87=E6=B3=A8=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=E4=BC=A0=E8=BF=87=E5=8E=BB=EF=BC=8C=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E6=97=B6=E5=A4=96=E5=8A=A0=EF=BC=88=E9=A2=84=E7=BA=A6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=8C=E6=98=AF=E5=90=A6=E6=98=AF=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=EF=BC=89=EF=BC=9B=20=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=A2=9E=E5=8A=A0=E4=B8=8B=E5=8D=95=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=9B=20=E7=82=B9=E5=8D=95=E9=A1=B5=EF=BC=8C=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5=E5=9D=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E9=A2=84=E7=BA=A6=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/edit_remarks_page.dart | 2 +- lib/order/order_view/order_info.dart | 5 +- lib/retrofit/data/findMiNiGroupList.dart | 96 ++- lib/retrofit/data/miNiDetail.dart | 511 +++++++++------ lib/retrofit/data/placeOrderFirst.dart | 5 +- lib/settlement/settlement.dart | 593 +++++++++++------- .../activity_coupon_remarks.dart | 274 ++++---- lib/store/shop_details_page.dart | 118 ++-- lib/store/store_order.dart | 42 +- lib/store/store_view/product_sku.dart | 2 +- lib/store/store_view/shop_goods.dart | 417 +++++++----- lib/store/store_view/store_order_list.dart | 82 +-- lib/view_widget/cupertino_date_picker.dart | 8 +- pubspec.lock | 7 + pubspec.yaml | 3 + 15 files changed, 1389 insertions(+), 776 deletions(-) diff --git a/lib/order/edit_remarks_page.dart b/lib/order/edit_remarks_page.dart index 638e2dba..6de9b46a 100644 --- a/lib/order/edit_remarks_page.dart +++ b/lib/order/edit_remarks_page.dart @@ -214,7 +214,7 @@ class _EditRemarksPage extends State { fontSize: 12.sp, ), ), - ),onTap: (){addRemarksCnt("点");},), + ),onTap: (){addRemarksCnt("软一点");},), ]; } } diff --git a/lib/order/order_view/order_info.dart b/lib/order/order_view/order_info.dart index 84d92782..77ee6780 100644 --- a/lib/order/order_view/order_info.dart +++ b/lib/order/order_view/order_info.dart @@ -48,6 +48,9 @@ class _OrderInfoView extends State { orderInfoItem(S.of(context).peisongfangshi, widget.isTakeOut == 0 ? S.of(context).ziqu :(widget.orderInfo != null && widget.orderInfo.logisticsName != "") ? widget.orderInfo.logisticsName : "美团配送"), // orderInfoItem(S.of(context).peisongfangshi,"美团配送"), + if(widget?.orderInfo?.subcribeTime != null && widget?.orderInfo?.subcribeTime != "") + orderInfoItem("预约时间", + widget.orderInfo != null ? widget.orderInfo.subcribeTime : ""), orderInfoItem( S.of(context).beizhuxinxi, widget.orderInfo != null @@ -88,7 +91,7 @@ class _OrderInfoView extends State { margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( leftText, diff --git a/lib/retrofit/data/findMiNiGroupList.dart b/lib/retrofit/data/findMiNiGroupList.dart index 63f453ce..de60e3cb 100644 --- a/lib/retrofit/data/findMiNiGroupList.dart +++ b/lib/retrofit/data/findMiNiGroupList.dart @@ -102,6 +102,7 @@ class ProductListBean { int setMeal; String printerFlag; dynamic markProductNone; + SubscribeParam subscribeParam; static ProductListBean fromJson(Map map) { if (map == null) return null; @@ -135,6 +136,7 @@ class ProductListBean { productListBean.setMeal = map['setMeal']; productListBean.printerFlag = map['printerFlag']; productListBean.markProductNone = map['markProductNone']; + productListBean.subscribeParam = SubscribeParam.fromJson(map['subscribeParam']); return productListBean; } @@ -168,5 +170,97 @@ class ProductListBean { "setMeal": setMeal, "printerFlag": printerFlag, "markProductNone": markProductNone, + "subscribeParam": subscribeParam, }; -} \ No newline at end of file +} + +/// isEnableSubscribe : true +/// dayOrDate : 3 +/// startAfterDays : null +/// daysValidate : null +/// subscribeStartTime : "2023-04-20 00:00:00" +/// subscribeEndTime : "2023-04-30 00:00:00" +/// stores : ["海峡姐妹","前进麦味","百年川椒","小吃街"] + +class SubscribeParam { + SubscribeParam({ + bool isEnableSubscribe, + num dayOrDate, + dynamic startAfterDays, + dynamic daysValidate, + String subscribeStartTime, + String subscribeEndTime, + List stores,}) { + _isEnableSubscribe = isEnableSubscribe; + _dayOrDate = dayOrDate; + _startAfterDays = startAfterDays; + _daysValidate = daysValidate; + _subscribeStartTime = subscribeStartTime; + _subscribeEndTime = subscribeEndTime; + _stores = stores; + } + + SubscribeParam.fromJson(dynamic json) { + if(json == null) + return; + _isEnableSubscribe = json['isEnableSubscribe']; + _dayOrDate = json['dayOrDate']; + _startAfterDays = json['startAfterDays']; + _daysValidate = json['daysValidate']; + _subscribeStartTime = json['subscribeStartTime']; + _subscribeEndTime = json['subscribeEndTime']; + _stores = json['stores'] != null ? json['stores'].cast() : []; + } + + bool _isEnableSubscribe; + num _dayOrDate; + dynamic _startAfterDays; + dynamic _daysValidate; + String _subscribeStartTime; + String _subscribeEndTime; + List _stores; + + SubscribeParam copyWith({ bool isEnableSubscribe, + num dayOrDate, + dynamic startAfterDays, + dynamic daysValidate, + String subscribeStartTime, + String subscribeEndTime, + List stores, + }) => + SubscribeParam( + isEnableSubscribe: isEnableSubscribe ?? _isEnableSubscribe, + dayOrDate: dayOrDate ?? _dayOrDate, + startAfterDays: startAfterDays ?? _startAfterDays, + daysValidate: daysValidate ?? _daysValidate, + subscribeStartTime: subscribeStartTime ?? _subscribeStartTime, + subscribeEndTime: subscribeEndTime ?? _subscribeEndTime, + stores: stores ?? _stores, + ); + + bool get isEnableSubscribe => _isEnableSubscribe; + + num get dayOrDate => _dayOrDate; + + dynamic get startAfterDays => _startAfterDays; + + dynamic get daysValidate => _daysValidate; + + String get subscribeStartTime => _subscribeStartTime; + + String get subscribeEndTime => _subscribeEndTime; + + List get stores => _stores; + + Map toJson() { + final map = {}; + map['isEnableSubscribe'] = _isEnableSubscribe; + map['dayOrDate'] = _dayOrDate; + map['startAfterDays'] = _startAfterDays; + map['daysValidate'] = _daysValidate; + map['subscribeStartTime'] = _subscribeStartTime; + map['subscribeEndTime'] = _subscribeEndTime; + map['stores'] = _stores; + return map; + } +} diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index 6f5fb06e..2f5af8e3 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -86,6 +86,7 @@ class MiNiDetail { dynamic markProductNone; dynamic namePinyin; dynamic nameInitials; + SubscribeParam subscribeParam; static MiNiDetail fromJson(Map map) { if (map == null) return null; @@ -123,16 +124,14 @@ class MiNiDetail { miNiDetailBean.printerFlag = map['printerFlag']; miNiDetailBean.thumbnailImg = map['thumbnailImg']; miNiDetailBean.materialId = map['materialId']; - miNiDetailBean.imgs = []..addAll( - (map['imgs'] as List ?? []).map((o) => o.toString()) - ); + miNiDetailBean.imgs = [] + ..addAll((map['imgs'] as List ?? []).map((o) => o.toString())); miNiDetailBean.storeDTO = StoreDTOBean.fromJson(map['storeDTO']); miNiDetailBean.attrList = []..addAll( - (map['attrList'] as List ?? []).map((o) => AttrListBean.fromJson(o)) - ); + (map['attrList'] as List ?? []).map((o) => AttrListBean.fromJson(o))); miNiDetailBean.productSkuVOList = []..addAll( - (map['productSkuVOList'] as List ?? []).map((o) => ProductSkuVOListBean.fromJson(o)) - ); + (map['productSkuVOList'] as List ?? []) + .map((o) => ProductSkuVOListBean.fromJson(o))); miNiDetailBean.shipAddress = map['shipAddress']; miNiDetailBean.buyCount = map['buyCount']; miNiDetailBean.promotionShowVOList = map['promotionShowVOList']; @@ -141,56 +140,59 @@ class MiNiDetail { miNiDetailBean.markProductNone = map['markProductNone']; miNiDetailBean.namePinyin = map['namePinyin']; miNiDetailBean.nameInitials = map['nameInitials']; + miNiDetailBean.subscribeParam = + SubscribeParam.fromJson(map['subscribeParam']); return miNiDetailBean; } Map toJson() => { - "id": id, - "createTime": createTime, - "createUser": createUser, - "updateTime": updateTime, - "updateUser": updateUser, - "supplierName": supplierName, - "storeId": storeId, - "categoryId": categoryId, - "groupId": groupId, - "shortName": shortName, - "productName": productName, - "sellDesc": sellDesc, - "productCode": productCode, - "weight": weight, - "applyPrice": applyPrice, - "price": price, - "stock": stock, - "sellCount": sellCount, - "needLogistics": needLogistics, - "oversold": oversold, - "organic" : organic, - "status": status, - "posShow": posShow, - "productType": productType, - "productNumber": productNumber, - "setMeal": setMeal, - "attrStyle": attrStyle, - "detail" :detail, - "details" :details, - "isDelete": isDelete, - "printerFlag": printerFlag, - "thumbnailImg": thumbnailImg, - "materialId": materialId, - "imgs": imgs, - "storeDTO": storeDTO, - "attrList": attrList, - "productSkuVOList": productSkuVOList, - "shipAddress": shipAddress, - "buyCount": buyCount, - "promotionShowVOList": promotionShowVOList, - "buyNum": buyNum, - "productPlatterInfos": productPlatterInfos, - "markProductNone": markProductNone, - "namePinyin": namePinyin, - "nameInitials": nameInitials, - }; + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "supplierName": supplierName, + "storeId": storeId, + "categoryId": categoryId, + "groupId": groupId, + "shortName": shortName, + "productName": productName, + "sellDesc": sellDesc, + "productCode": productCode, + "weight": weight, + "applyPrice": applyPrice, + "price": price, + "stock": stock, + "sellCount": sellCount, + "needLogistics": needLogistics, + "oversold": oversold, + "organic": organic, + "status": status, + "posShow": posShow, + "productType": productType, + "productNumber": productNumber, + "setMeal": setMeal, + "attrStyle": attrStyle, + "detail": detail, + "details": details, + "isDelete": isDelete, + "printerFlag": printerFlag, + "thumbnailImg": thumbnailImg, + "materialId": materialId, + "imgs": imgs, + "storeDTO": storeDTO, + "attrList": attrList, + "productSkuVOList": productSkuVOList, + "shipAddress": shipAddress, + "buyCount": buyCount, + "promotionShowVOList": promotionShowVOList, + "buyNum": buyNum, + "productPlatterInfos": productPlatterInfos, + "markProductNone": markProductNone, + "namePinyin": namePinyin, + "nameInitials": nameInitials, + "subscribeParam": subscribeParam, + }; } /// id : "1446382612795883520" @@ -271,41 +273,41 @@ class ProductSkuVOListBean { productSkuVOListBean.version = map['version']; productSkuVOListBean.skuAttrCodeDTOList = map['skuAttrCodeDTOList']; productSkuVOListBean.skuAttrList = []..addAll( - (map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromJson(o)) - ); + (map['skuAttrList'] as List ?? []) + .map((o) => SkuAttrListBean.fromJson(o))); productSkuVOListBean.productSetMeals = []..addAll( - (map['productSetMeals'] as List ?? []).map((o) => ProductSetMeals.fromJson(o)) - ); + (map['productSetMeals'] as List ?? []) + .map((o) => ProductSetMeals.fromJson(o))); productSkuVOListBean.setMealDTOList = map['setMealDTOList']; return productSkuVOListBean; } Map toJson() => { - "id": id, - "createTime": createTime, - "createUser": createUser, - "updateTime": updateTime, - "updateUser": updateUser, - "storeId": storeId, - "skuCode": skuCode, - "skuNameStr": skuNameStr, - "productId": productId, - "skuPrice": skuPrice, - "applyPrice": applyPrice, - "vipPrice": vipPrice, - "skuImg": skuImg, - "skuStock": skuStock, - "sort": sort, - "setMeal": setMeal, - "weight": weight, - "volume": volume, - "isDelete": isDelete, - "material": material, - "version": version, - "skuAttrCodeDTOList": skuAttrCodeDTOList, - "skuAttrList": skuAttrList, - "setMealDTOList": setMealDTOList, - }; + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "storeId": storeId, + "skuCode": skuCode, + "skuNameStr": skuNameStr, + "productId": productId, + "skuPrice": skuPrice, + "applyPrice": applyPrice, + "vipPrice": vipPrice, + "skuImg": skuImg, + "skuStock": skuStock, + "sort": sort, + "setMeal": setMeal, + "weight": weight, + "volume": volume, + "isDelete": isDelete, + "material": material, + "version": version, + "skuAttrCodeDTOList": skuAttrCodeDTOList, + "skuAttrList": skuAttrList, + "setMealDTOList": setMealDTOList, + }; } /// id : "1446382613043347456" @@ -348,17 +350,17 @@ class SkuAttrListBean { } Map toJson() => { - "id": id, - "createTime": createTime, - "createUser": createUser, - "updateTime": updateTime, - "updateUser": updateUser, - "skuId": skuId, - "attrId": attrId, - "attrValueId": attrValueId, - "sortOrder": sortOrder, - "isDelete": isDelete, - }; + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "skuId": skuId, + "attrId": attrId, + "attrValueId": attrValueId, + "sortOrder": sortOrder, + "isDelete": isDelete, + }; } /// groupName : "酒水选1" @@ -371,7 +373,8 @@ class ProductSetMeals { String groupName, int totalNumber, int optionalNumber, - List productInfoList,}){ + List productInfoList, + }) { _groupName = groupName; _totalNumber = totalNumber; _optionalNumber = optionalNumber; @@ -389,22 +392,31 @@ class ProductSetMeals { }); } } + String _groupName; int _totalNumber; int _optionalNumber; List _productInfoList; - ProductSetMeals copyWith({ String groupName, + + ProductSetMeals copyWith({ + String groupName, int totalNumber, int optionalNumber, List productInfoList, - }) => ProductSetMeals( groupName: groupName ?? _groupName, - totalNumber: totalNumber ?? _totalNumber, - optionalNumber: optionalNumber ?? _optionalNumber, - productInfoList: productInfoList ?? _productInfoList, - ); + }) => + ProductSetMeals( + groupName: groupName ?? _groupName, + totalNumber: totalNumber ?? _totalNumber, + optionalNumber: optionalNumber ?? _optionalNumber, + productInfoList: productInfoList ?? _productInfoList, + ); + String get groupName => _groupName; + int get totalNumber => _totalNumber; + int get optionalNumber => _optionalNumber; + List get productInfoList => _productInfoList; Map toJson() { @@ -417,7 +429,6 @@ class ProductSetMeals { } return map; } - } /// productId : "1372091668961951744" @@ -436,7 +447,8 @@ class ProductInfoList { bool allSku, List skuInfoList, List productAttrInfoList, - int number,}){ + int number, + }) { _productId = productId; _productName = productName; _productImg = productImg; @@ -465,6 +477,7 @@ class ProductInfoList { } _number = json['number']; } + String _productId; String _productName; String _productImg; @@ -473,26 +486,36 @@ class ProductInfoList { List _productAttrInfoList; int _number; int _count = 0; - ProductInfoList copyWith({ String productId, + + ProductInfoList copyWith({ + String productId, String productName, String productImg, bool allSku, List skuInfoList, List productAttrInfoList, int number, - }) => ProductInfoList( productId: productId ?? _productId, - productName: productName ?? _productName, - productImg: productImg ?? _productImg, - allSku: allSku ?? _allSku, - skuInfoList: skuInfoList ?? _skuInfoList, - productAttrInfoList: productAttrInfoList ?? _productAttrInfoList, - number: number ?? _number, - ); + }) => + ProductInfoList( + productId: productId ?? _productId, + productName: productName ?? _productName, + productImg: productImg ?? _productImg, + allSku: allSku ?? _allSku, + skuInfoList: skuInfoList ?? _skuInfoList, + productAttrInfoList: productAttrInfoList ?? _productAttrInfoList, + number: number ?? _number, + ); + String get productId => _productId; + String get productName => _productName; + String get productImg => _productImg; + bool get allSku => _allSku; + List get skuInfoList => _skuInfoList; + List get productAttrInfoList => _productAttrInfoList; int number; @@ -502,8 +525,6 @@ class ProductInfoList { _count = value; } - - Map toJson() { final map = {}; map['productId'] = _productId; @@ -514,12 +535,12 @@ class ProductInfoList { map['skuInfoList'] = _skuInfoList.map((v) => v.toJson()).toList(); } if (_productAttrInfoList != null) { - map['productAttrInfoList'] = _productAttrInfoList.map((v) => v.toJson()).toList(); + map['productAttrInfoList'] = + _productAttrInfoList.map((v) => v.toJson()).toList(); } map['number'] = _number; return map; } - } /// attrId : "1372091668978728960" @@ -530,7 +551,8 @@ class ProductAttrInfoList { ProductAttrInfoList({ String attrId, String attrName, - List attrValueList,}){ + List attrValueList, + }) { _attrId = attrId; _attrName = attrName; _attrValueList = attrValueList; @@ -546,21 +568,28 @@ class ProductAttrInfoList { }); } } + String _attrId; String _attrName; List _attrValueList; String _selectSku; - ProductAttrInfoList copyWith({ String attrId, + + ProductAttrInfoList copyWith({ + String attrId, String attrName, List attrValueList, - }) => ProductAttrInfoList( attrId: attrId ?? _attrId, - attrName: attrName ?? _attrName, - attrValueList: attrValueList ?? _attrValueList, - ); + }) => + ProductAttrInfoList( + attrId: attrId ?? _attrId, + attrName: attrName ?? _attrName, + attrValueList: attrValueList ?? _attrValueList, + ); + String get attrId => _attrId; + String get attrName => _attrName; - List get attrValueList => _attrValueList; + List get attrValueList => _attrValueList; String get selectSku => _selectSku; @@ -577,7 +606,6 @@ class ProductAttrInfoList { } return map; } - } /// attrId : "1372091668987117568" @@ -588,7 +616,8 @@ class AttrValueList { AttrValueList({ String attrId, String attrName, - dynamic attrValueList,}){ + dynamic attrValueList, + }) { _attrId = attrId; _attrName = attrName; _attrValueList = attrValueList; @@ -599,18 +628,26 @@ class AttrValueList { _attrName = json['attrName']; _attrValueList = json['attrValueList']; } + String _attrId; String _attrName; dynamic _attrValueList; - AttrValueList copyWith({ String attrId, + + AttrValueList copyWith({ + String attrId, String attrName, dynamic attrValueList, - }) => AttrValueList( attrId: attrId ?? _attrId, - attrName: attrName ?? _attrName, - attrValueList: attrValueList ?? _attrValueList, - ); + }) => + AttrValueList( + attrId: attrId ?? _attrId, + attrName: attrName ?? _attrName, + attrValueList: attrValueList ?? _attrValueList, + ); + String get attrId => _attrId; + String get attrName => _attrName; + dynamic get attrValueList => _attrValueList; Map toJson() { @@ -620,7 +657,6 @@ class AttrValueList { map['attrValueList'] = _attrValueList; return map; } - } /// id : "1372091669003894784" @@ -631,7 +667,8 @@ class SkuInfoList { SkuInfoList({ String id, String skuName, - List productSkuAttrList,}){ + List productSkuAttrList, + }) { _id = id; _skuName = skuName; _productSkuAttrList = productSkuAttrList; @@ -647,19 +684,27 @@ class SkuInfoList { }); } } + String _id; String _skuName; bool _isSelected = false; List _productSkuAttrList; - SkuInfoList copyWith({ String id, + + SkuInfoList copyWith({ + String id, String skuName, List productSkuAttrList, - }) => SkuInfoList( id: id ?? _id, - skuName: skuName ?? _skuName, - productSkuAttrList: productSkuAttrList ?? _productSkuAttrList, - ); + }) => + SkuInfoList( + id: id ?? _id, + skuName: skuName ?? _skuName, + productSkuAttrList: productSkuAttrList ?? _productSkuAttrList, + ); + String get id => _id; + String get skuName => _skuName; + List get productSkuAttrList => _productSkuAttrList; bool get isSelected => _isSelected; @@ -673,11 +718,11 @@ class SkuInfoList { map['id'] = _id; map['skuName'] = _skuName; if (_productSkuAttrList != null) { - map['productSkuAttrList'] = _productSkuAttrList.map((v) => v.toJson()).toList(); + map['productSkuAttrList'] = + _productSkuAttrList.map((v) => v.toJson()).toList(); } return map; } - } /// id : "1372091669012283392" @@ -702,7 +747,8 @@ class ProductSkuAttrList { String attrId, String attrValueId, dynamic sortOrder, - int isDelete,}){ + int isDelete, + }) { _id = id; _createTime = createTime; _createUser = createUser; @@ -727,6 +773,7 @@ class ProductSkuAttrList { _sortOrder = json['sortOrder']; _isDelete = json['isDelete']; } + String _id; String _createTime; String _createUser; @@ -737,7 +784,9 @@ class ProductSkuAttrList { String _attrValueId; dynamic _sortOrder; int _isDelete; - ProductSkuAttrList copyWith({ String id, + + ProductSkuAttrList copyWith({ + String id, String createTime, String createUser, String updateTime, @@ -747,26 +796,38 @@ class ProductSkuAttrList { String attrValueId, dynamic sortOrder, int isDelete, - }) => ProductSkuAttrList( id: id ?? _id, - createTime: createTime ?? _createTime, - createUser: createUser ?? _createUser, - updateTime: updateTime ?? _updateTime, - updateUser: updateUser ?? _updateUser, - skuId: skuId ?? _skuId, - attrId: attrId ?? _attrId, - attrValueId: attrValueId ?? _attrValueId, - sortOrder: sortOrder ?? _sortOrder, - isDelete: isDelete ?? _isDelete, - ); + }) => + ProductSkuAttrList( + id: id ?? _id, + createTime: createTime ?? _createTime, + createUser: createUser ?? _createUser, + updateTime: updateTime ?? _updateTime, + updateUser: updateUser ?? _updateUser, + skuId: skuId ?? _skuId, + attrId: attrId ?? _attrId, + attrValueId: attrValueId ?? _attrValueId, + sortOrder: sortOrder ?? _sortOrder, + isDelete: isDelete ?? _isDelete, + ); + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get skuId => _skuId; + String get attrId => _attrId; + String get attrValueId => _attrValueId; + dynamic get sortOrder => _sortOrder; + int get isDelete => _isDelete; Map toJson() { @@ -783,7 +844,6 @@ class ProductSkuAttrList { map['isDelete'] = _isDelete; return map; } - } /// productId : "1433994980233314304" @@ -815,22 +875,21 @@ class AttrListBean { attrListBean.isDelete = map['isDelete']; attrListBean.attrCode = map['attrCode']; attrListBean.id = map['id']; - attrListBean.attrValueList = []..addAll( - (map['attrValueList'] as List ?? []).map((o) => AttrValueListBean.fromJson(o)) - ); + attrListBean.attrValueList = []..addAll((map['attrValueList'] as List ?? []) + .map((o) => AttrValueListBean.fromJson(o))); return attrListBean; } Map toJson() => { - "productId": productId, - "attrName": attrName, - "sortOrder": sortOrder, - "needImg": needImg, - "isDelete": isDelete, - "attrCode": attrCode, - "id": id, - "attrValueList": attrValueList, - }; + "productId": productId, + "attrName": attrName, + "sortOrder": sortOrder, + "needImg": needImg, + "isDelete": isDelete, + "attrCode": attrCode, + "id": id, + "attrValueList": attrValueList, + }; } /// id : "1434076666832879616" @@ -865,14 +924,14 @@ class AttrValueListBean { } Map toJson() => { - "id": id, - "attrId": attrId, - "attrValue": attrValue, - "attrValueImg": attrValueImg, - "sortOrder": sortOrder, - "isDelete": isDelete, - "attrValueCode": attrValueCode, - }; + "id": id, + "attrId": attrId, + "attrValue": attrValue, + "attrValueImg": attrValueImg, + "sortOrder": sortOrder, + "isDelete": isDelete, + "attrValueCode": attrValueCode, + }; } /// id : "1333246101343436800" @@ -903,11 +962,103 @@ class StoreDTOBean { } Map toJson() => { - "id": id, - "storeName": storeName, - "nickName": nickName, - "logo": logo, - "productCount": productCount, - "soldNum": soldNum, - }; -} \ No newline at end of file + "id": id, + "storeName": storeName, + "nickName": nickName, + "logo": logo, + "productCount": productCount, + "soldNum": soldNum, + }; +} + + +/// isEnableSubscribe : true +/// dayOrDate : 3 +/// startAfterDays : null +/// daysValidate : null +/// subscribeStartTime : "2023-04-20 00:00:00" +/// subscribeEndTime : "2023-04-30 00:00:00" +/// stores : ["海峡姐妹","前进麦味","百年川椒","小吃街"] + +class SubscribeParam { + SubscribeParam({ + bool isEnableSubscribe, + num dayOrDate, + dynamic startAfterDays, + dynamic daysValidate, + String subscribeStartTime, + String subscribeEndTime, + List stores,}) { + _isEnableSubscribe = isEnableSubscribe; + _dayOrDate = dayOrDate; + _startAfterDays = startAfterDays; + _daysValidate = daysValidate; + _subscribeStartTime = subscribeStartTime; + _subscribeEndTime = subscribeEndTime; + _stores = stores; + } + + SubscribeParam.fromJson(dynamic json) { + if(json == null) + return; + _isEnableSubscribe = json['isEnableSubscribe']; + _dayOrDate = json['dayOrDate']; + _startAfterDays = json['startAfterDays']; + _daysValidate = json['daysValidate']; + _subscribeStartTime = json['subscribeStartTime']; + _subscribeEndTime = json['subscribeEndTime']; + _stores = json['stores'] != null ? json['stores'].cast() : []; + } + + bool _isEnableSubscribe; + num _dayOrDate; + dynamic _startAfterDays; + dynamic _daysValidate; + String _subscribeStartTime; + String _subscribeEndTime; + List _stores; + + SubscribeParam copyWith({ bool isEnableSubscribe, + num dayOrDate, + dynamic startAfterDays, + dynamic daysValidate, + String subscribeStartTime, + String subscribeEndTime, + List stores, + }) => + SubscribeParam( + isEnableSubscribe: isEnableSubscribe ?? _isEnableSubscribe, + dayOrDate: dayOrDate ?? _dayOrDate, + startAfterDays: startAfterDays ?? _startAfterDays, + daysValidate: daysValidate ?? _daysValidate, + subscribeStartTime: subscribeStartTime ?? _subscribeStartTime, + subscribeEndTime: subscribeEndTime ?? _subscribeEndTime, + stores: stores ?? _stores, + ); + + bool get isEnableSubscribe => _isEnableSubscribe; + + num get dayOrDate => _dayOrDate; + + dynamic get startAfterDays => _startAfterDays; + + dynamic get daysValidate => _daysValidate; + + String get subscribeStartTime => _subscribeStartTime; + + String get subscribeEndTime => _subscribeEndTime; + + List get stores => _stores; + + Map toJson() { + final map = {}; + map['isEnableSubscribe'] = _isEnableSubscribe; + map['dayOrDate'] = _dayOrDate; + map['startAfterDays'] = _startAfterDays; + map['daysValidate'] = _daysValidate; + map['subscribeStartTime'] = _subscribeStartTime; + map['subscribeEndTime'] = _subscribeEndTime; + map['stores'] = _stores; + return map; + } +} diff --git a/lib/retrofit/data/placeOrderFirst.dart b/lib/retrofit/data/placeOrderFirst.dart index d7cc0276..d6f3abdb 100644 --- a/lib/retrofit/data/placeOrderFirst.dart +++ b/lib/retrofit/data/placeOrderFirst.dart @@ -119,6 +119,7 @@ class PromotionInfoDTOBean { String couponId; String promotionId; bool useVipPrice; + bool useBenefit; PromotionInfoDTOBean({this.couponId, this.promotionId,this.useVipPrice}); @@ -128,12 +129,14 @@ class PromotionInfoDTOBean { promotionInfoDTOBean.couponId = json['couponId']; promotionInfoDTOBean.promotionId = json['promotionId']; promotionInfoDTOBean.useVipPrice = json['useVipPrice']; + promotionInfoDTOBean.useBenefit = json['useBenefit']; return promotionInfoDTOBean; } Map toJson() => { "couponId": couponId, "promotionId": promotionId, - "useVipPrice":useVipPrice + "useVipPrice":useVipPrice, + "useBenefit": useBenefit, }; } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 023e78aa..464de1c7 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:fluwx/fluwx.dart'; @@ -33,9 +34,11 @@ 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:intl/intl.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/miNiDetail.dart'; import '../retrofit/data/shoppingCart.dart'; import '../view_widget/settlement_tips_dialog.dart'; @@ -85,6 +88,11 @@ class _Settlement extends State { bool showVipTips = false; bool isRaiseChannel = false; ShoppingCart shopCarGoods; + SubscribeParam subscribeParam; + String reservationTime; + String subscribeStoresName; + String subTime; + int storesIndex = 0; @override void initState() { @@ -108,7 +116,7 @@ class _Settlement extends State { count1 = widget.arguments["buyNum"]; productId = widget.arguments["productId"]; shopCarGoods = widget.arguments["shoppingCart"]; - + subscribeParam = widget?.arguments["subscribeParam"] ?? null; if (tableId == 0) { placeOrder = true; } @@ -122,8 +130,7 @@ class _Settlement extends State { token: minToken, tenant: tenant, storeId: storeId, - showLoading: false - ); + showLoading: false); queryMemberInfo(); if (promotions != null && promotions != "" && tableId <= 0) { queryOrderInfo( @@ -192,68 +199,68 @@ class _Settlement extends State { try { EasyLoading.show(status: S.current.zhengzaijiazai); - BaseData baseData = await minService.getOrderInfo({ - "addressId": addressId, - "isTake": isTake, - "memberCouponId": memberCouponId, - "orderId": orderId, - "promotionId": promotionId, - "productSkuId": productSkuId, - "actProductId": actProductId, - "actProductSkuId": actProductSkuId, - "useVipPrice":useVipPriceSelect, - "buyNum": buyNum, - "payChannel":payChannel, - "tableId": tableId - }).catchError((error) {}); - this.promotion = null; - promotions = ""; - this.couponListBean = null; - coupons = ""; - if (baseData != null && baseData.isSuccess) { - settleOrderInfo = baseData.data; - if ((settleOrderInfo?.promotionId ?? "") != "") { - settleOrderInfo.promotionInfoList.forEach((element) { - if (element.id == settleOrderInfo.promotionId) { - this.promotion = element; - promotions = promotion?.name ?? ""; - } - }); - } - if ((settleOrderInfo?.memberCouponId ?? "") != "") { - settleOrderInfo.couponList.forEach((element) { - if (element.id == settleOrderInfo.memberCouponId) { - this.couponListBean = element; - coupons = couponListBean?.promotionName ?? ""; - } - }); - } - if (settleOrderInfo.orderProductList == null || - settleOrderInfo.orderProductList.length == 0) { - placeOrder = true; - queryOrderDetails( - pageType != null ? widget.arguments["orderId"] : parentId); - } - if(!isRaiseChannel && settleOrderInfo.isRaise){ - isRaiseChannel = true; - queryOrderInfo( - address?.id, - selectedBtn, - couponListBean?.id, - 0, - promotion?.id ?? productId, - productSkuId ?? "", - actProductId ?? "", - actProductSkuId ?? "", - useVipPriceSelect, - count1, - settleOrderInfo.isRaise ? 7 :payChannel, - tableId); + BaseData baseData = await minService.getOrderInfo({ + "addressId": addressId, + "isTake": isTake, + "memberCouponId": memberCouponId, + "orderId": orderId, + "promotionId": promotionId, + "productSkuId": productSkuId, + "actProductId": actProductId, + "actProductSkuId": actProductSkuId, + "useVipPrice": useVipPriceSelect, + "buyNum": buyNum, + "payChannel": payChannel, + "tableId": tableId + }).catchError((error) {}); + this.promotion = null; + promotions = ""; + this.couponListBean = null; + coupons = ""; + if (baseData != null && baseData.isSuccess) { + settleOrderInfo = baseData.data; + if ((settleOrderInfo?.promotionId ?? "") != "") { + settleOrderInfo.promotionInfoList.forEach((element) { + if (element.id == settleOrderInfo.promotionId) { + this.promotion = element; + promotions = promotion?.name ?? ""; + } + }); + } + if ((settleOrderInfo?.memberCouponId ?? "") != "") { + settleOrderInfo.couponList.forEach((element) { + if (element.id == settleOrderInfo.memberCouponId) { + this.couponListBean = element; + coupons = couponListBean?.promotionName ?? ""; + } + }); + } + if (settleOrderInfo.orderProductList == null || + settleOrderInfo.orderProductList.length == 0) { + placeOrder = true; + queryOrderDetails( + pageType != null ? widget.arguments["orderId"] : parentId); + } + if (!isRaiseChannel && settleOrderInfo.isRaise) { + isRaiseChannel = true; + queryOrderInfo( + address?.id, + selectedBtn, + couponListBean?.id, + 0, + promotion?.id ?? productId, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + useVipPriceSelect, + count1, + settleOrderInfo.isRaise ? 7 : payChannel, + tableId); + } + } else { + SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center); } - } else { - SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center); - } - }finally{ + } finally { setState(() {}); EasyLoading.dismiss(); } @@ -266,7 +273,7 @@ class _Settlement extends State { }); if (baseData != null && baseData.isSuccess) { SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minMember', jsonEncode(baseData.data)), }, ); @@ -315,76 +322,76 @@ class _Settlement extends State { } queryAddress(int selectedBtn) async { + setState(() { + this.selectedBtn = selectedBtn; + }); + if (address != null) { + queryOrderInfo( + address.id, + selectedBtn, + null, + 0, + productId ?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + useVipPriceSelect, + count1, + payChannel, + tableId); + return; + } + BaseData> baseDate = + await minService.queryAddress().catchError((error) {}); + + BMFCoordinate bmfCoordinate = BMFCoordinate( + double.tryParse(storeInfo.latitude), + double.tryParse(storeInfo.longitude), + ); + if (baseDate != null && baseDate.isSuccess) { setState(() { - this.selectedBtn = selectedBtn; + address = baseDate.data[0]; }); - if (address != null) { - queryOrderInfo( - address.id, - selectedBtn, - null, - 0, - productId ?? null, - productSkuId ?? "", - actProductId ?? "", - actProductSkuId ?? "", - useVipPriceSelect, - count1, - payChannel, - tableId); - return; - } - BaseData> baseDate = - await minService.queryAddress().catchError((error) {}); - - BMFCoordinate bmfCoordinate = BMFCoordinate( - double.tryParse(storeInfo.latitude), - double.tryParse(storeInfo.longitude), - ); - if (baseDate != null && baseDate.isSuccess) { - setState(() { - address = baseDate.data[0]; - }); - for (int i = 1; i < baseDate.data.length; i++) { - Address address1 = baseDate.data[i]; + for (int i = 1; i < baseDate.data.length; i++) { + Address address1 = baseDate.data[i]; - BMFCoordinate coordinate = await BMFCalculateUtils.coordConvert( - coordinate: BMFCoordinate( - double.tryParse(address.longitude), - double.tryParse(address.latitude), - ), - fromType: BMF_COORD_TYPE.COMMON, - toType: BMF_COORD_TYPE.BD09LL); - BMFCoordinate coordinate1 = await BMFCalculateUtils.coordConvert( - coordinate: BMFCoordinate( - double.tryParse(address1.longitude), - double.tryParse(address1.latitude), - ), - fromType: BMF_COORD_TYPE.COMMON, - toType: BMF_COORD_TYPE.BD09LL); + BMFCoordinate coordinate = await BMFCalculateUtils.coordConvert( + coordinate: BMFCoordinate( + double.tryParse(address.longitude), + double.tryParse(address.latitude), + ), + fromType: BMF_COORD_TYPE.COMMON, + toType: BMF_COORD_TYPE.BD09LL); + BMFCoordinate coordinate1 = await BMFCalculateUtils.coordConvert( + coordinate: BMFCoordinate( + double.tryParse(address1.longitude), + double.tryParse(address1.latitude), + ), + fromType: BMF_COORD_TYPE.COMMON, + toType: BMF_COORD_TYPE.BD09LL); - double mi = await BMFCalculateUtils.getLocationDistance( - bmfCoordinate, coordinate); - double mi1 = await BMFCalculateUtils.getLocationDistance( - bmfCoordinate, coordinate1); - if (mi1 < mi) { - address = address1; - } + double mi = await BMFCalculateUtils.getLocationDistance( + bmfCoordinate, coordinate); + double mi1 = await BMFCalculateUtils.getLocationDistance( + bmfCoordinate, coordinate1); + if (mi1 < mi) { + address = address1; } - await queryOrderInfo( - address.id, - selectedBtn, - null, - 0, - productId ?? null, - productSkuId ?? "", - actProductId ?? "", - actProductSkuId ?? "", - useVipPriceSelect, - count1, - payChannel, - tableId); } + await queryOrderInfo( + address.id, + selectedBtn, + null, + 0, + productId ?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + useVipPriceSelect, + count1, + payChannel, + tableId); + } } ///选择收货地址 @@ -492,16 +499,25 @@ class _Settlement extends State { placeOrderFirst.cartNum = settleOrderInfo.orderNum; placeOrderFirst.cartSum = settleOrderInfo.price; placeOrderFirst.addressId = address == null ? null : address.id; - placeOrderFirst.isSubscribe = false; + placeOrderFirst.isSubscribe = + ((subscribeParam?.isEnableSubscribe ?? false) == true) + ? true + : false; //是否预约 placeOrderFirst.isTakeOut = selectedBtn; - placeOrderFirst.notes = remakers; + placeOrderFirst.notes = remakers + + (reservationTime ?? "") + + (subscribeParam == null + ? "" + : "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}"); placeOrderFirst.numberOfPeople = "$numberOfPeople"; placeOrderFirst.orderSource = 2; placeOrderFirst.orderType = "0"; placeOrderFirst.orderTypeId = 0; placeOrderFirst.parentCode = parentCode; // 火锅加菜 placeOrderFirst.parentId = parentId; // 火锅加菜 - placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00") ? payChannel = 0 : (settleOrderInfo.isRaise ? 7:payChannel)); + placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00") + ? payChannel = 0 + : (settleOrderInfo.isRaise ? 7 : payChannel)); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO.promotionId = (promotion != null && tableId <= 0) ? promotion.id : ""; @@ -510,16 +526,18 @@ class _Settlement extends State { (couponListBean != null && tableId <= 0) ? couponListBean.id : ""; // : widget.arguments["cid"] ?? ""; placeOrderFirst.promotionInfoDTO.useVipPrice = useVipPriceSelect; + // placeOrderFirst.promotionInfoDTO.useBenefit = false; placeOrderFirst.recMobile = (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList; placeOrderFirst.skuItemDTOList = []; placeOrderFirst.source = 1; placeOrderFirst.storeId = storeInfo.id; - placeOrderFirst.subcribeTime = null; + placeOrderFirst.subcribeTime = subTime ?? ""; //预约时间 placeOrderFirst.tableId = "$tableId"; - for(int i = 0;i { toOrderDetails(placeOrderFirst.id); } else { SmartDialog.show( - clickBgDismissTemp: false, + clickBgDismissTemp: false, widget: SettlementTips( - () { - toOrderDetails(placeOrderFirst.id); - }, - text: "${baseData?.msg}", - )); + () { + toOrderDetails(placeOrderFirst.id); + }, + text: "${baseData?.msg}", + )); } } } @@ -704,7 +722,7 @@ class _Settlement extends State { '/router/order_details', arguments: { "id": orderId, - "jumpState":1, + "jumpState": 1, }, ); // Navigator.of(context).pop(); @@ -759,8 +777,8 @@ class _Settlement extends State { child: Container( child: Column( children: [ - DistributionMode((addressId, isTake, memberCouponId, - orderId, promotionId) { + DistributionMode((addressId, isTake, + memberCouponId, orderId, promotionId) { setState(() { this.selectedBtn = 0; }); @@ -777,8 +795,13 @@ class _Settlement extends State { count1, payChannel, tableId ?? 0); - }, queryAddress, storeInfo, address, - selectedAddress, pageType,widget.arguments["distance"]), + }, + queryAddress, + storeInfo, + address, + selectedAddress, + pageType, + widget.arguments["distance"]), SizedBox( height: 16, @@ -791,50 +814,64 @@ class _Settlement extends State { // ), ///订单商品 - if(settleOrderInfo != null || minOrderInfo != null) - SettlementOrderCommodity( - selectedBtn, - settleOrderInfo, - minOrderInfo, - tableId, - pageType, - (coupons != "" || promotions!="") ? false :useVipPriceSelect, - this.showVipTips - ), + if (settleOrderInfo != null || + minOrderInfo != null) + SettlementOrderCommodity( + selectedBtn, + settleOrderInfo, + minOrderInfo, + tableId, + pageType, + (coupons != "" || promotions != "") + ? false + : useVipPriceSelect, + this.showVipTips), ///优惠券/备注/会员优惠金额 - if(settleOrderInfo != null || minOrderInfo != null) - ActivityCouponRemarks( - couponCart, - activityCart, - settleOrderInfo, - minOrderInfo, - coupons, - promotions, - couponCount(), - placeOrder, - remakers, - () { - Navigator.of(context).pushNamed( - '/router/edit_remarks_page', - arguments: {"remake":remakers} - ).then((value) => { - setState(() { - if (value != null) remakers = value; - }) - });}, - tableId, - vipPriceSelect, - (){ + if (settleOrderInfo != null || + minOrderInfo != null) + ActivityCouponRemarks( + couponCart, + activityCart, + settleOrderInfo, + minOrderInfo, + coupons, + promotions, + couponCount(), + placeOrder, + remakers, + () { + Navigator.of(context).pushNamed( + '/router/edit_remarks_page', + arguments: { + "remake": remakers + }).then((value) => { + setState(() { + if (value != null) remakers = value; + }) + }); + }, + tableId, + vipPriceSelect, + () { setState(() { this.showVipTips = true; }); - } - ), + }, + subscribeParam, + showDateSelector, + reservationTime, + showAlertDialog, + subscribeStoresName, + ), + + if (settleOrderInfo != null && + placeOrder && + joinA != JoinActivity.BargainBug) - if (settleOrderInfo != null && placeOrder && joinA != JoinActivity.BargainBug) - ///支付方式 - PayMethod(payChannelCheck,coupons,promotions,useVipPriceSelect,settleOrderInfo), + ///支付方式 + PayMethod(payChannelCheck, coupons, promotions, + useVipPriceSelect, settleOrderInfo), ], ), ), @@ -902,12 +939,23 @@ class _Settlement extends State { // return; // } else // orderButton = true; + if (subscribeParam != null && ((subscribeParam.isEnableSubscribe ?? false) == + true) && + (reservationTime == null || + subscribeStoresName == null)) { + SmartDialog.showToast( + (reservationTime == null) + ? "请选择预约时间" + : "请选择预约门店", + alignment: Alignment.center); + return; + } pageType != null ? bargainOrderId != null - ? activityPay() - : joinA == JoinActivity.GoJoin - ? queryJoinAct() - : queryLaunchAct() + ? activityPay() + : joinA == JoinActivity.GoJoin + ? queryJoinAct() + : queryLaunchAct() : queryPlaceOrderFirst(); }, ), @@ -928,23 +976,23 @@ class _Settlement extends State { payChannelCheck(int payChannel) { this.payChannel = payChannel; - if (tableId > 0) { - queryOrderDetails(parentId); - } else { - queryOrderInfo( - address?.id, - selectedBtn, - couponListBean?.id, - 0, - promotion?.id ?? productId, - productSkuId ?? "", - actProductId ?? "", - actProductSkuId ?? "", - useVipPriceSelect, - count1, - payChannel, - tableId);} - + if (tableId > 0) { + queryOrderDetails(parentId); + } else { + queryOrderInfo( + address?.id, + selectedBtn, + couponListBean?.id, + 0, + promotion?.id ?? productId, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + useVipPriceSelect, + count1, + payChannel, + tableId); + } } vipPriceSelect(bool useVipPriceSelect) { @@ -964,7 +1012,8 @@ class _Settlement extends State { useVipPriceSelect, count1, payChannel, - tableId);} + tableId); + } } mobileChange(String mobile) { @@ -1004,10 +1053,8 @@ class _Settlement extends State { // promotions = ""; // this.promotion = null; if (tableId > 0) { - if(couponBean == null) - queryCancelMemberCoupon(parentId); - if (couponBean.id != null) - queryUseMemberCoupon(couponBean.id); + if (couponBean == null) queryCancelMemberCoupon(parentId); + if (couponBean.id != null) queryUseMemberCoupon(couponBean.id); } else { queryOrderInfo( address?.id, @@ -1047,7 +1094,7 @@ class _Settlement extends State { selectedBtn, null, 0, - (pro.id??"")??productId, + (pro.id ?? "") ?? productId, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", @@ -1056,5 +1103,127 @@ class _Settlement extends State { payChannel, tableId); } -// } + + ///立即预约时间选择 + showDateSelector() { + var minTime = DateTime.now().isAfter( + DateTime.tryParse(subscribeParam?.subscribeStartTime ?? "")) + ? DateTime.now() + : DateTime.tryParse(subscribeParam?.subscribeStartTime ?? ""); + DatePicker.showDateTimePicker(context, + showTitleActions: true, + minTime: minTime, + maxTime: DateTime.tryParse(subscribeParam?.subscribeEndTime ?? ""), + theme: DatePickerTheme( + headerColor: Colors.white, + backgroundColor: Colors.white, + itemStyle: TextStyle( + color: Colors.black, + fontWeight: MyFontWeight.bold, + fontSize: 18), + doneStyle: TextStyle(color: Color(0xFF32A060), fontSize: 16.sp)), + onChanged: (date) { + print('change $date in time zone ' + + date.timeZoneOffset.inHours.toString()); + }, onConfirm: (date) { + reservationTime = date.toString().substring(0, 16); + subTime = date.toString().substring(0, 19); + setState(() {}); + }, currentTime: minTime, locale: LocaleType.zh); + } + + ///预约店铺 + showAlertDialog() { + showModalBottomSheet( + builder: (BuildContext context) { + return StatefulBuilder(builder: ( + context, + state, + ) { + return Container( + width: double.infinity, + height: 270.h, + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 16.h), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.symmetric(vertical: 10.h, horizontal: 14.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).quxiao, + style: + TextStyle(fontSize: 18.sp, color: Colors.black), + ), + ), + GestureDetector( + onTap: () { + setState(() { + subscribeStoresName = + subscribeParam.stores[storesIndex]; + }); + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).queding, + style: TextStyle( + fontSize: 18.sp, color: Color(0xFF32A060)), + ), + ) + ], + ), + ), + Expanded( + child: ListView.builder( + itemCount: subscribeParam.stores.length ?? 0, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + state(() { + storesIndex = position; + }); + }, + child: storesNameItem(position), + ); + }), + ), + ], + ), + ); + }); + }, + backgroundColor: Colors.transparent, + context: context); + } + + Widget storesNameItem(index) { + return Container( + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 10.h), + alignment: Alignment.center, + child: Text( + subscribeParam.stores[index], + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: storesIndex == index ? Color(0xFF32A060) : Colors.black, + ), + ), + ); + } } diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 1b4fe348..8118b156 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -2,15 +2,13 @@ import 'dart:io'; 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/min_order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:intl/intl.dart'; -import '../../view_widget/cupertino_date_picker.dart'; +import '../../retrofit/data/miNiDetail.dart'; class ActivityCouponRemarks extends StatefulWidget { final Function() couponCart; @@ -27,6 +25,11 @@ class ActivityCouponRemarks extends StatefulWidget { final int tableId; final Function(bool useVipPriceSelect) vipPriceSelect; final Function showVipTips; + final SubscribeParam subscribeParam; + final Function() showDateSelector; + final String reservationTime; + final Function() showAlertDialog; + final String subscribeStoresName; ActivityCouponRemarks( this.couponCart, @@ -41,7 +44,12 @@ class ActivityCouponRemarks extends StatefulWidget { this.editRemark, this.tableId, this.vipPriceSelect, - this.showVipTips); + this.showVipTips, + this.subscribeParam, + this.showDateSelector, + this.reservationTime, + this.showAlertDialog, + this.subscribeStoresName); @override State createState() { @@ -79,65 +87,78 @@ class _ActivityCouponRemarks extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if( !(widget?.settleOrderInfo?.isRaise ?? false) && (widget?.settleOrderInfo?.memberVO?.isVip ?? false) && widget.placeOrder) - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "VIP权益", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - ), - Platform.isAndroid ? - Switch.adaptive( - value: (widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - activeColor: Color(0xff32A060), - onChanged: (bool value) { - setState(() { - if((widget?.settleOrderInfo?.memberVO?.isVip ?? false)){ - vipSelect = !vipSelect; - widget.vipPriceSelect(vipSelect); - }else{ - widget.showVipTips(); - return; - } - }); - }, - ): - GestureDetector( - onTap: () { - setState(() { - if ((widget?.settleOrderInfo?.memberVO?.isVip ?? false)) { - vipSelect = !vipSelect; - widget.vipPriceSelect(vipSelect); - } else { - widget.showVipTips(); - return; - } - }); - }, - child: Container( - padding: EdgeInsets.only(bottom: 18.w), - alignment: Alignment.center, - child: Image.asset( - ((widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect) - ? "assets/image/vip_price.webp" - : "assets/image/vip_unprice.webp", - width: 38.w, - height: 20.h, + if (!(widget?.settleOrderInfo?.isRaise ?? false) && + (widget?.settleOrderInfo?.memberVO?.isVip ?? false) && + widget.placeOrder) + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "VIP权益", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), ), - ) - ], - ), + Platform.isAndroid + ? Switch.adaptive( + value: + (widget.coupons != null && widget.coupons != "" || + widget.promotions != null && + widget.promotions != "") + ? false + : vipSelect, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + activeColor: Color(0xff32A060), + onChanged: (bool value) { + setState(() { + if ((widget?.settleOrderInfo?.memberVO?.isVip ?? + false)) { + vipSelect = !vipSelect; + widget.vipPriceSelect(vipSelect); + } else { + widget.showVipTips(); + return; + } + }); + }, + ) + : GestureDetector( + onTap: () { + setState(() { + if ((widget?.settleOrderInfo?.memberVO?.isVip ?? + false)) { + vipSelect = !vipSelect; + widget.vipPriceSelect(vipSelect); + } else { + widget.showVipTips(); + return; + } + }); + }, + child: Container( + padding: EdgeInsets.only(bottom: 18.w), + alignment: Alignment.center, + child: Image.asset( + ((widget.coupons != null && widget.coupons != "" || + widget.promotions != null && + widget.promotions != "") + ? false + : vipSelect) + ? "assets/image/vip_price.webp" + : "assets/image/vip_unprice.webp", + width: 38.w, + height: 20.h, + ), + ), + ) + ], + ), if (widget.placeOrder && widget?.settleOrderInfo?.benefitDiscountAmount != null && widget?.settleOrderInfo?.benefitDiscountAmount != "0") @@ -170,7 +191,9 @@ class _ActivityCouponRemarks extends State { ], ), ), - if (widget.placeOrder && widget.tableId <= 0 && !(widget?.settleOrderInfo?.isRaise ?? false)) + if (widget.placeOrder && + widget.tableId <= 0 && + !(widget?.settleOrderInfo?.isRaise ?? false)) InkWell( onTap: () { widget.activityCart(); @@ -287,66 +310,99 @@ class _ActivityCouponRemarks extends State { ], ), ), - + if ((widget.subscribeParam?.isEnableSubscribe ?? false) == true) SizedBox( height: 13, ), - InkWell( - onTap: () { - showDateSelector(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "预约时间", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), + if ((widget.subscribeParam?.isEnableSubscribe ?? false) == true) + InkWell( + onTap: () { + widget.showDateSelector(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "预约时间", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), ), - ), - Expanded( - child: Text( - "请选择时间", - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF858585), - fontWeight: MyFontWeight.medium, + Expanded( + child: Text( + widget.reservationTime ?? "请选择时间", + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF858585), + fontWeight: MyFontWeight.medium, + ), ), ), - ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - ), - ], + Icon( + Icons.keyboard_arrow_right, + size: 16, + ), + ], + ), + ), + if ((widget.subscribeParam?.isEnableSubscribe ?? false) == true) + SizedBox( + height: 13, + ), + if ((widget.subscribeParam?.isEnableSubscribe ?? false) == true) + InkWell( + onTap: () { + if (widget.subscribeParam.stores.length > 1) + widget.showAlertDialog(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "预约店铺", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + Expanded( + child: Text( + ((widget.subscribeParam.stores.length == 1) + ? widget?.subscribeParam?.stores[0] + : widget.subscribeStoresName) ?? + "请选择店铺", + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF858585), + fontWeight: MyFontWeight.medium, + ), + ), + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + ), + ], + ), ), - ), ], ), ); } - ///立即预约时间选择 - showDateSelector() async { - DateTime dateTime = await showModalBottomSheet( - backgroundColor: Colors.transparent, - context: context, - builder: (_) { - return CupertinoDatePickerWidget(); - }); - if (dateTime != null) { - String time = DateFormat("yyyy-MM-dd").format(dateTime) ; - setState(() {}); - } - } - String activityText() { String promotion = ""; if (widget.promotions == null || widget.promotions == "") { diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index 5e9ae062..76e8d150 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -102,7 +102,7 @@ class _ShopDetailsPage extends State { token: value.getString("token"), ); BaseData baseData = - await apiService.queryStoreInfo(storeId).catchError((error) { + await apiService.queryStoreInfo(storeId).catchError((error) { debugPrint(error); }); if (baseData != null && baseData.isSuccess) { @@ -129,7 +129,7 @@ class _ShopDetailsPage extends State { String tenant = storeInfo.tenantCode; String storeId = storeInfo.id; SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minToken', minToken), value.setString('tenant', tenant), value.setString('storeId', storeId), @@ -246,7 +246,7 @@ class _ShopDetailsPage extends State { if (parentId == null || parentId == "") { if (num == 0) { - SmartDialog.showToast("请先选择您要购买的商品!~",alignment: Alignment.center); + SmartDialog.showToast("请先选择您要购买的商品!~", alignment: Alignment.center); return; } } @@ -264,8 +264,16 @@ class _ShopDetailsPage extends State { "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, + "distance": widget.arguments["distance"], + "subscribeParam": miNiDetail?.subscribeParam, }, ); + + if ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == true) { + clearShopCar(); + this.shopCarGoods = await queryShopCar(); + } + if (tableId > 0) { getParentInfo(); } @@ -365,6 +373,10 @@ class _ShopDetailsPage extends State { .replaceAll("]", "") .replaceAll(",", ""); + if ((miNiDetail.subscribeParam.isEnableSubscribe ?? false) == true) { + clearShopCar(); + } + if (miNiDetail != null) { BaseData> baseDate = await minService.addShoppingCart({ "storeId": storeInfo.id, @@ -391,6 +403,8 @@ class _ShopDetailsPage extends State { if (baseDate != null && baseDate.isSuccess) { queryShopCar().then((value) { this.shopCarGoods = value; + if ((miNiDetail.subscribeParam.isEnableSubscribe ?? false) == true) + toDownOrder(); setState(() {}); }); } else { @@ -630,7 +644,7 @@ class _ShopDetailsPage extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(left: 14.w,top: 16.h), + padding: EdgeInsets.only(left: 14.w, top: 16.h), child: Text( "商品详情", style: TextStyle( @@ -831,9 +845,10 @@ class _ShopDetailsPage extends State { )), GestureDetector( onTap: () { - if(storeInfo.posType.code == "NORMALSTORE" && tableId == 0){ + if (storeInfo.posType.code == "NORMALSTORE" && + tableId == 0) { showDeleteDialog(); - }else{ + } else { _queryMiNiDetail(id, counts); } }, @@ -859,7 +874,11 @@ class _ShopDetailsPage extends State { width: 2, ), Text( - "加入购物车", + ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? + false) == + true) + ? "立即预约" + : "加入购物车", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -953,12 +972,12 @@ class _ShopDetailsPage extends State { showModalBottomSheet( builder: (BuildContext context) { return StatefulBuilder(builder: ( - context, - state, - ) { + context, + state, + ) { return Container( alignment: Alignment.topCenter, - padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 16), + padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 16), height: MediaQuery.of(context).size.height / 3 * 2, width: double.infinity, decoration: BoxDecoration( @@ -992,47 +1011,47 @@ class _ShopDetailsPage extends State { ), Expanded( child: Container( - height: 70, - child: Column( + height: 70, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - miNiDetail?.productName ?? "", - style: TextStyle( - fontSize: 13.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF000000), - ), - ), - GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: Image.asset( - "assets/image/cancel.webp", - fit: BoxFit.cover, - height: 24, - width: 24, - ), - ), - ], - ), Text( - "¥${miNiDetail?.price ?? ""}", + miNiDetail?.productName ?? "", style: TextStyle( - fontSize: 12.sp, + fontSize: 13.sp, fontWeight: FontWeight.bold, - color: Color(0xFFF65720), + color: Color(0xFF000000), + ), + ), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + "assets/image/cancel.webp", + fit: BoxFit.cover, + height: 24, + width: 24, ), ), ], ), - )), + Text( + "¥${miNiDetail?.price ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.bold, + color: Color(0xFFF65720), + ), + ), + ], + ), + )), ], ), if (miNiDetail.attrList != null && @@ -1050,7 +1069,7 @@ class _ShopDetailsPage extends State { padding: EdgeInsets.zero, itemBuilder: (context, position) { return attrItem( - (attrValue) { + (attrValue) { state(() { // if(selectSkus.length > position) selectSkus[position] = attrValue; @@ -1097,8 +1116,7 @@ class _ShopDetailsPage extends State { Icons.remove, color: Color(0xFF32A060), size: 24, - ) - ), + )), Padding( padding: EdgeInsets.only(left: 8, right: 8), child: Text( @@ -1132,7 +1150,11 @@ class _ShopDetailsPage extends State { RoundButton( width: double.infinity, height: 54.h, - text: "加入购物车", + text: ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? + false) == + true) + ? "立即预约" + : "加入购物车", textColor: Colors.white, fontWeight: MyFontWeight.semi_bold, radius: 27, @@ -1310,7 +1332,7 @@ class _ShopDetailsPage extends State { S.of(context).ninxiangjiquanxianweikaiqi, S.of(context).weilekaipaizhaoxuanzhetouxiang, S.of(context).kaiqiquanxian, - (result) async { + (result) async { if (result) { await openAppSettings(); } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index d305b7a7..90c323de 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -34,6 +34,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../settlement/settlement.dart'; import '../view_widget/border_text.dart'; import '../view_widget/request_permission.dart'; @@ -66,6 +67,7 @@ class _StoreOrderPage extends State String tenant = ""; String storeId = ""; int numberOfPeople = 0; + MiNiDetail miNiDetail; ///小程序token String minToken; @@ -426,6 +428,7 @@ class _StoreOrderPage extends State ]; }, body: + ///点餐 TabBarView( physics: NeverScrollableScrollPhysics(), @@ -515,12 +518,19 @@ class _StoreOrderPage extends State Spacer(), GestureDetector( onTap: () { - if(AppUtils.compareTime(storeInfo.openStartTime,DateFormat('HH:mm:ss').format(DateTime.now())) - &&(!AppUtils.compareTime(storeInfo.openEndTime,DateFormat('HH:mm:ss').format(DateTime.now())))){ - toDownOrder(); - } - else - SmartDialog.showToast("营业时间:${storeInfo.openStartTime}-${storeInfo.openEndTime}", alignment: Alignment.center); + if (AppUtils.compareTime( + storeInfo.openStartTime, + DateFormat('HH:mm:ss') + .format(DateTime.now())) && + (!AppUtils.compareTime( + storeInfo.openEndTime, + DateFormat('HH:mm:ss') + .format(DateTime.now())))) { + toDownOrder(); + } else + SmartDialog.showToast( + "营业时间:${storeInfo.openStartTime}-${storeInfo.openEndTime}", + alignment: Alignment.center); }, child: RoundButton( width: 103.w, @@ -631,7 +641,7 @@ class _StoreOrderPage extends State if (parentId == null || parentId == "") { if (num == 0) { - SmartDialog.showToast("请先选择您要购买的商品!~",alignment: Alignment.center); + SmartDialog.showToast("请先选择您要购买的商品!~", alignment: Alignment.center); return; } } @@ -649,9 +659,16 @@ class _StoreOrderPage extends State "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, - "distance":widget.arguments["distance"], + "distance": widget.arguments["distance"], + "subscribeParam": miNiDetail?.subscribeParam, }, ); + + if ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == true) { + clearShopCar(); + this.shopCarGoods = await queryShopCar(); + } + if (tableId > 0) { getParentInfo(); } @@ -741,7 +758,7 @@ class _StoreOrderPage extends State _queryMiNiDetail(String id, int count) async { EasyLoading.show(status: S.current.zhengzaijiazai); if (count < 0) { - shopCarGoods.shoppingCartSkuItemList.forEach((element) async{ + shopCarGoods.shoppingCartSkuItemList.forEach((element) async { if (element.productId == id) { await shopCartReduce(element); setState(() {}); @@ -752,6 +769,7 @@ class _StoreOrderPage extends State BaseData baseData = await minService.miNiDetail(id); EasyLoading.dismiss(); if (baseData != null && baseData.isSuccess) { + miNiDetail = baseData.data; showStoreSelector(baseData.data, id, count); } } @@ -804,6 +822,10 @@ class _StoreOrderPage extends State .replaceAll("]", "") .replaceAll(",", ""); + if ((miNiDetail.subscribeParam.isEnableSubscribe ?? false) == true) { + clearShopCar(); + } + if (miNiDetail != null) { BaseData> baseDate = await minService.addShoppingCart({ "storeId": storeInfo.id, @@ -829,6 +851,8 @@ class _StoreOrderPage extends State // EasyLoading.dismiss(); if (baseDate != null && baseDate.isSuccess) { this.shopCarGoods = await queryShopCar(); + if ((miNiDetail.subscribeParam.isEnableSubscribe ?? false) == true) + toDownOrder(); setState(() {}); } else { SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 525be6ce..80ca1561 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -292,7 +292,7 @@ class _ProductSku extends State { RoundButton( width: double.infinity, height: 54.h, - text: "加入购物车", + text: (widget?.miNiDetail?.subscribeParam?.isEnableSubscribe ?? false) == true ? "立即预约":"加入购物车", textColor: Colors.white, fontWeight: MyFontWeight.semi_bold, radius: 27, diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 976dfa9b..008f32e1 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -42,7 +42,7 @@ class ShopGoods extends StatefulWidget { this.queryShoppingCart, this.queryMiNiDetail, this.shoppingCartSkuItemListBean, - this.storeInfo + this.storeInfo, }); @override @@ -51,9 +51,9 @@ class ShopGoods extends StatefulWidget { } } - class _ShopGoods extends State { int _jumpType = -1; + MiNiDetail miNiDetail; ///商品详情 queryMiNiDetail(id) async { @@ -62,26 +62,28 @@ class _ShopGoods extends State { String minToken = value.getString("minToken"); String tenant = value.getString("tenant"); String storeId = value.getString("storeId"); - minService = MinApiService(Dio(), + minService = MinApiService( + Dio(), context: context, token: minToken, tenant: tenant, - storeId: storeId,); + storeId: storeId, + ); }); BaseData baseData = - await minService.miNiDetail(id).catchError((error) { - }); + await minService.miNiDetail(id).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - if(baseData.data.productSkuVOList[0].productSetMeals.length == 0){ + miNiDetail = baseData.data; + if (baseData.data.productSkuVOList[0].productSetMeals.length == 0) { _jumpType = 0; widget.add(widget.shoppingCartSkuItemListBean); - }else{ + } else { _jumpType = 1; await Navigator.of(context) .pushNamed('/router/product_meals_sku', arguments: { - "id":widget.productListBean.id, - "storeId":widget.productListBean.storeId, - "tableId":widget.tableId + "id": widget.productListBean.id, + "storeId": widget.productListBean.storeId, + "tableId": widget.tableId }); widget.queryShoppingCart(); } @@ -90,7 +92,7 @@ class _ShopGoods extends State { } } - @override + @override Widget build(BuildContext context) { return Container( color: Colors.white, @@ -99,7 +101,7 @@ class _ShopGoods extends State { // // bottom: 20.h, // ), height: 123.h, - child: Row( + child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, @@ -109,8 +111,8 @@ class _ShopGoods extends State { widget.productListBean != null ? widget.productListBean.imgPath : (widget.shoppingCartSkuItemListBean != null - ? widget.shoppingCartSkuItemListBean.skuImg - : ""), + ? widget.shoppingCartSkuItemListBean.skuImg + : ""), width: 70.h, height: 70.h, radius: BorderRadius.circular(4), @@ -125,64 +127,68 @@ class _ShopGoods extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding(padding: EdgeInsets.only(right: 16.w), - child: 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, + Padding( + padding: EdgeInsets.only(right: 16.w), + child: 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, - // ), - // ), - ], - ),), + // 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, ), - Padding(padding: EdgeInsets.only(right: 16.w), + Padding( + padding: EdgeInsets.only(right: 16.w), child: Row( - children: [ - Expanded( - child: Text( - (widget.productListBean != null - ? widget.productListBean.shortName - : widget.shoppingCartSkuItemListBean.skuName ?? ""), - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - color: Color(0xFF4C4C4C), - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, + children: [ + Expanded( + child: Text( + (widget.productListBean != null + ? widget.productListBean.shortName + : widget.shoppingCartSkuItemListBean.skuName ?? + ""), + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), ), - ), - ), - SizedBox( - width: 10, - ), - ], - )), + SizedBox( + width: 10, + ), + ], + )), SizedBox( height: 7.h, ), @@ -223,71 +229,90 @@ class _ShopGoods extends State { ], ), if (!widget.isShopCart && - (widget.productListBean?.attrStyle ?? 0) == 1) + (widget.productListBean?.attrStyle ?? 0) == 1 && + !(widget?.productListBean?.subscribeParam + ?.isEnableSubscribe ?? + false)) GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () async{ - if(widget.storeInfo.posType.code == "NORMALSTORE"&& widget.tableId == 0){ + onTap: () async { + if (widget.storeInfo.posType.code == + "NORMALSTORE" && + widget.tableId == 0) { showDeleteDialog(); - }else{ + } else { widget.queryMiNiDetail( widget.productListBean != null ? widget.productListBean.id : widget.shoppingCartSkuItemListBean - .productId, + .productId, 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, top: 4), - 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, - ), + 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, top: 4), + 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) - Spacer(), + (widget.productListBean?.attrStyle ?? 0) == 0 && + !(widget?.productListBean?.subscribeParam + ?.isEnableSubscribe ?? + false)) + Spacer(), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) + (widget.productListBean?.attrStyle ?? 0) == 0 && + !(widget?.productListBean?.subscribeParam + ?.isEnableSubscribe ?? + false)) GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () async{ - if(widget.storeInfo.posType.code == "NORMALSTORE" && widget.tableId == 0){ - showDeleteDialog(); - }else{ - widget.reduce(widget.shoppingCartSkuItemListBean);} - }, + onTap: () async { + if (widget.storeInfo.posType.code == "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else { + widget.reduce(widget.shoppingCartSkuItemListBean); + } + }, child: Container( - padding: EdgeInsets.only(left: 15.w,right: 6.w), + padding: EdgeInsets.only(left: 15.w, right: 6.w), child: Image.asset( "assets/image/reduce.webp", width: 22, @@ -296,7 +321,10 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) + (widget.productListBean?.attrStyle ?? 0) == 0 && + !(widget?.productListBean?.subscribeParam + ?.isEnableSubscribe ?? + false)) Container( alignment: Alignment.center, child: Text( @@ -309,71 +337,117 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async{ - if(widget.storeInfo.posType.code == "NORMALSTORE" && widget.tableId == 0){ - showDeleteDialog(); - }else{ - if(_jumpType == -1) - queryMiNiDetail(widget.productListBean.id); - else if(_jumpType == 0) - widget.add(widget.shoppingCartSkuItemListBean); - else if(_jumpType == 1) - await Navigator.of(context) - .pushNamed('/router/product_meals_sku', arguments: { - "id":widget.productListBean.id, - "storeId":widget.productListBean.storeId, - "tableId":widget.tableId - }); - widget.queryShoppingCart(); - } - }, - child: Container( - padding: EdgeInsets.only(left: 6.w,right:16.w), - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22.h, + (widget.productListBean?.attrStyle ?? 0) == 0 && + !(widget?.productListBean?.subscribeParam + ?.isEnableSubscribe ?? + false)) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if (widget.storeInfo.posType.code == "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else { + if (_jumpType == -1) + queryMiNiDetail(widget.productListBean.id); + else if (_jumpType == 0) + widget.add(widget.shoppingCartSkuItemListBean); + else if (_jumpType == 1) + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": widget.productListBean.id, + "storeId": widget.productListBean.storeId, + "tableId": widget.tableId + }); + widget.queryShoppingCart(); + } + }, + child: Container( + padding: EdgeInsets.only(left: 6.w, right: 16.w), + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22.h, + ), ), ), - ), + if ((widget.productListBean.subscribeParam + .isEnableSubscribe ?? + false) == + true) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if (widget.storeInfo.posType.code == + "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else if (widget.isShopCart || + (widget.productListBean?.attrStyle ?? 0) == 0) { + queryMiNiDetail(widget.productListBean.id); + } else { + widget.queryMiNiDetail( + widget.productListBean != null + ? widget.productListBean.id + : widget.shoppingCartSkuItemListBean + .productId, + 0); + } + }, + child: Container( + padding: EdgeInsets.only( + left: 35.w, + top: 4.h, + bottom: 4.h, + ), + margin: EdgeInsets.only(right: 8, top: 4), + 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), + ), + )), ], ), SizedBox( height: 4.h, ), - if(widget.productListBean.vipPrice != null ) - Row( - children: [ - Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal:2.w), - margin: EdgeInsets.only(right: 4.w), - decoration: new BoxDecoration( - color: Color(0xff32A060), - borderRadius: BorderRadius.circular(4)), - child: Text( - "VIP", + if (widget.productListBean.vipPrice != null) + Row( + children: [ + Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(horizontal: 2.w), + margin: EdgeInsets.only(right: 4.w), + decoration: new BoxDecoration( + color: Color(0xff32A060), + borderRadius: BorderRadius.circular(4)), + child: Text( + "VIP", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFFFFFFF), + ), + ), + ), + Text( + "¥${AppUtils.calculateDouble(double.tryParse(widget.productListBean.vipPrice ?? "0") ?? 0)}", style: TextStyle( - fontSize: 12.sp, + fontSize: 14.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFFFFFFFF), + fontFamily: 'JDZhengHT', + color: Color(0xff32A060), ), ), - ), - Text( - "¥${AppUtils.calculateDouble(double.tryParse(widget.productListBean.vipPrice ?? "0") ?? 0)}", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - fontFamily: 'JDZhengHT', - color: Color(0xff32A060), - ), - ), - ], - ), + ], + ), // Text( // "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", // style: TextStyle( @@ -477,7 +551,7 @@ class _ShopGoods extends State { S.of(context).ninxiangjiquanxianweikaiqi, S.of(context).weilekaipaizhaoxuanzhetouxiang, S.of(context).kaiqiquanxian, - (result) async { + (result) async { if (result) { await openAppSettings(); } @@ -512,5 +586,4 @@ class _ShopGoods extends State { await Permission.camera.request(); } } - } diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 80878f7e..35a26cd7 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -29,18 +29,17 @@ class StoreOrderListPage extends StatefulWidget { ShoppingCart shopCarGoods; StoreOrderListPage( - this.arguments, - this.activitys, - this.storeInfo, - this.shopCarGoods, - this.controller, - this.minToken, - this.tenant, - this.tableId, - this.queryMiNiDetail, - this.queryShoppingCart, - this.scrollPhysics - ); + this.arguments, + this.activitys, + this.storeInfo, + this.shopCarGoods, + this.controller, + this.minToken, + this.tenant, + this.tableId, + this.queryMiNiDetail, + this.queryShoppingCart, + this.scrollPhysics); @override State createState() { @@ -88,14 +87,14 @@ class _StoreOrderListPage extends State { token: widget.minToken, tenant: widget.tenant, storeId: widget.arguments["id"], - showLoading: true - ); + showLoading: true); BaseData> baseData = await minService.findMiNiGroupList({ "id": widget.arguments["id"], }).catchError((error) { // refreshController.refreshFailed(); + debugPrint(error); }); if (baseData != null && baseData.isSuccess) { // refreshController.refreshCompleted(); @@ -139,8 +138,7 @@ class _StoreOrderListPage extends State { padding: EdgeInsets.only(top: 0, bottom: 25.h), itemBuilder: (context, position) { return GestureDetector( - onTap: () { - }, + onTap: () {}, child: orderItem(position), ); }, @@ -225,9 +223,10 @@ class _StoreOrderListPage extends State { width: 2, height: 17.h, color: Color(0xFF32A060), - margin: EdgeInsets.only(right:10.w), + margin: EdgeInsets.only(right: 10.w), ), - Expanded(child:Text( + Expanded( + child: Text( appletProducts[index].groupName, textAlign: TextAlign.center, style: TextStyle( @@ -236,7 +235,8 @@ class _StoreOrderListPage extends State { : Color(0xFF000000), fontSize: 12.sp, fontWeight: currentIndex != index - ? MyFontWeight.medium : MyFontWeight.semi_bold , + ? MyFontWeight.medium + : MyFontWeight.semi_bold, ), )), ], @@ -267,7 +267,12 @@ class _StoreOrderListPage extends State { Widget rightOrderItem(int rightIndex) { return Container( color: Colors.white, - margin: EdgeInsets.only(bottom: (rightIndex == appletProducts.length -1)?(_viewportDimension > appletProducts[rightIndex].height?_viewportDimension-appletProducts[rightIndex].height:30.h):0), + margin: EdgeInsets.only( + bottom: (rightIndex == appletProducts.length - 1) + ? (_viewportDimension > appletProducts[rightIndex].height + ? _viewportDimension - appletProducts[rightIndex].height + : 30.h) + : 0), padding: EdgeInsets.only( right: 16.w, ), @@ -275,30 +280,31 @@ class _StoreOrderListPage extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 50.h,child: - Padding( - padding: EdgeInsets.only(left: 16.w,top: 10.h), - child: Text( - appletProducts[rightIndex].groupName, - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF000000), - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, + SizedBox( + height: 50.h, + child: Padding( + padding: EdgeInsets.only(left: 16.w, top: 10.h), + child: Text( + appletProducts[rightIndex].groupName, + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF000000), + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + ), ), ), - ),), + ), Column( children: appletProducts[rightIndex].productList.map((e) { return GestureDetector( - onTap: (){ - if (widget.storeInfo.posType.code == - "NORMALSTORE") + onTap: () { + if (widget.storeInfo.posType.code == "NORMALSTORE") return; else goShopDetailsPage(e); }, - child:goodsItem(e), + child: goodsItem(e), ); }).toList() ?? [], @@ -346,11 +352,11 @@ class _StoreOrderListPage extends State { productListBean: e, count: count, isShopCart: false, - tableId:widget.tableId, - queryShoppingCart:widget.queryShoppingCart, + tableId: widget.tableId, + queryShoppingCart: widget.queryShoppingCart, queryMiNiDetail: widget.queryMiNiDetail, shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, - storeInfo:widget.storeInfo + storeInfo: widget.storeInfo, ); } } diff --git a/lib/view_widget/cupertino_date_picker.dart b/lib/view_widget/cupertino_date_picker.dart index 104914d3..95897df3 100644 --- a/lib/view_widget/cupertino_date_picker.dart +++ b/lib/view_widget/cupertino_date_picker.dart @@ -5,7 +5,9 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; class CupertinoDatePickerWidget extends StatelessWidget { - + final DateTime minimumDate; + final DateTime maximumDate; + CupertinoDatePickerWidget({this.minimumDate,this.maximumDate}); @override Widget build(BuildContext context) { @@ -72,8 +74,8 @@ class CupertinoDatePickerWidget extends StatelessWidget { mode: CupertinoDatePickerMode.date, backgroundColor: Colors.white, initialDateTime: DateTime.now(), - minimumDate: DateTime(1900), - maximumDate: DateTime.now(), + minimumDate: minimumDate ?? DateTime(1900), + maximumDate: maximumDate ?? DateTime.now(), onDateTimeChanged: (data) { dateTime = data; }, diff --git a/pubspec.lock b/pubspec.lock index 1f4abaac..9962839b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -202,6 +202,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1" + flutter_datetime_picker: + dependency: "direct main" + description: + name: flutter_datetime_picker + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.1" flutter_easyloading: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index dcc602c9..d7dd025e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -105,6 +105,9 @@ dependencies: mqtt_client: ^9.6.8 +# 时间选择器 + flutter_datetime_picker: ^1.5.1 + dev_dependencies: flutter_test: sdk: flutter From 6ef8f4774b293209e7b9393b54ff00737cb2f173 Mon Sep 17 00:00:00 2001 From: fmk Date: Thu, 20 Apr 2023 14:44:11 +0800 Subject: [PATCH 5/8] =?UTF-8?q?ios,=E6=9B=B4=E6=94=B9=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E9=80=89=E4=B8=AD=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ lib/view_widget/selector_store_dialog.dart | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 232f7826..954f305e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -617,7 +617,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -667,7 +667,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.10; + MARKETING_VERSION = 3.2.11; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -819,7 +819,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -869,7 +869,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.10; + MARKETING_VERSION = 3.2.11; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -912,7 +912,7 @@ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -962,7 +962,7 @@ "$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/Runner/baidu", ); - MARKETING_VERSION = 3.2.10; + MARKETING_VERSION = 3.2.11; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", diff --git a/lib/view_widget/selector_store_dialog.dart b/lib/view_widget/selector_store_dialog.dart index bd7fa585..be5eec08 100644 --- a/lib/view_widget/selector_store_dialog.dart +++ b/lib/view_widget/selector_store_dialog.dart @@ -244,8 +244,9 @@ class _SelectorStoreWidget extends State { if (position == selectIndex) Image.asset( "assets/image/recharge.webp", - width: 20.w, - height: 20.h, + width: 20, + height: 20, + fit: BoxFit.fill, ), // MImage( // store.logo, From 791cc21d1f8ea498800851579c612721b03c12ca Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Thu, 20 Apr 2023 17:21:20 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E9=80=89=E6=8B=A9=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/settlement/settlement.dart | 131 +++++++++++++++++++++++++-------- 1 file changed, 99 insertions(+), 32 deletions(-) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 464de1c7..cdf58a04 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -1127,7 +1127,7 @@ class _Settlement extends State { date.timeZoneOffset.inHours.toString()); }, onConfirm: (date) { reservationTime = date.toString().substring(0, 16); - subTime = date.toString().substring(0, 19); + subTime = date.toUtc().toIso8601String().toString(); setState(() {}); }, currentTime: minTime, locale: LocaleType.zh); } @@ -1142,7 +1142,7 @@ class _Settlement extends State { ) { return Container( width: double.infinity, - height: 270.h, + height: 280.h, padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 16.h), decoration: new BoxDecoration( color: Colors.white, @@ -1155,38 +1155,69 @@ class _Settlement extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: - EdgeInsets.symmetric(vertical: 10.h, horizontal: 14.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { + // Container( + // padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 14.w), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // GestureDetector( + // onTap: () { + // Navigator.of(context).pop(); + // }, + // child: Text( + // S.of(context).quxiao, + // style: + // TextStyle(fontSize: 18.sp, color: Colors.black), + // ), + // ), + // GestureDetector( + // onTap: () { + // setState(() { + // subscribeStoresName = + // subscribeParam.stores[storesIndex]; + // }); + // Navigator.of(context).pop(); + // }, + // child: Text( + // S.of(context).queding, + // style: TextStyle( + // fontSize: 18.sp, color: Color(0xFF32A060)), + // ), + // ), + // ], + // ), + // ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.symmetric(vertical:5.h), + child: Text( + "请选择预约门店", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), + )), + GestureDetector( + onTap: () { + setState(() { Navigator.of(context).pop(); - }, - child: Text( - S.of(context).quxiao, - style: - TextStyle(fontSize: 18.sp, color: Colors.black), - ), + }); + }, + child: Icon( + Icons.clear, + color: Colors.black, + size: 18, ), - GestureDetector( - onTap: () { - setState(() { - subscribeStoresName = - subscribeParam.stores[storesIndex]; - }); - Navigator.of(context).pop(); - }, - child: Text( - S.of(context).queding, - style: TextStyle( - fontSize: 18.sp, color: Color(0xFF32A060)), - ), - ) - ], - ), + ), + // SizedBox(width:4.w), + ], ), Expanded( child: ListView.builder( @@ -1202,6 +1233,33 @@ class _Settlement extends State { ); }), ), + GestureDetector( + onTap: (){ + setState(() { + subscribeStoresName = + subscribeParam.stores[storesIndex]; + }); + Navigator.of(context).pop(); + }, + child: Container( + width: double.infinity, + height: 40.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + color:Color(0xFF32A060), + ), + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 10.h,), + child: Text( + S.of(context).queding, + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFFFFFFF), + ), + ), + ), + ), ], ), ); @@ -1214,8 +1272,17 @@ class _Settlement extends State { Widget storesNameItem(index) { return Container( width: double.infinity, + margin: EdgeInsets.symmetric(vertical:8.h), padding: EdgeInsets.symmetric(vertical: 10.h), alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius:BorderRadius.circular(6), + border: Border.all( + color: storesIndex == index ? Color(0xFF32A060):Color(0xFFF7F7F7), + width: storesIndex == index ? 1 :0, + ), + color: storesIndex == index ? Color(0xFFF0FAF4) :Color(0xFFF7F7F7), + ), child: Text( subscribeParam.stores[index], style: TextStyle( From f9c2f9af6f86dca65f411e82c498d83d5aa67de8 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 21 Apr 2023 18:31:59 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=85=85=E5=80=BC=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8E=A8=E8=8D=90=E9=97=A8=E5=BA=97=E9=80=89=E6=8B=A9?= =?UTF-8?q?=EF=BC=9B=EF=BC=88=E5=BA=9F=E5=BC=83=E5=8E=9F=E5=85=85=E5=80=BC?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=88rechargeAct=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E6=96=B0=E6=8E=A5=E5=8F=A3=EF=BC=88rechargeActList?= =?UTF-8?q?=EF=BC=89=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=97=A8=E5=BA=97=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E6=8E=A8=E8=8D=90=E6=9D=BF=E5=9D=97=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=98=BE=E7=A4=BA=E5=BC=80=E5=85=B3=EF=BC=89=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=83=A8=E5=88=86=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF=EF=BC=88?= =?UTF-8?q?=E4=B8=BB=E8=A6=81=E6=9B=B4=E6=94=B9=E4=B8=AA=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=82=A3=E5=9D=97=EF=BC=8C=E5=A6=82=EF=BC=9A=E7=B2=89?= =?UTF-8?q?=E4=B8=9D=EF=BC=8C=E5=85=B3=E6=B3=A8=E7=AD=89=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=89=EF=BC=9B=20=E6=9B=B4=E6=94=B9=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=EF=BC=8C=E9=9D=9E=E9=A2=84=E7=BA=A6=E5=95=86?= =?UTF-8?q?=E5=93=81=EF=BC=8C=E4=B8=8D=E4=BC=A0=E2=80=9C=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E2=80=9D=E6=96=87=E6=9C=AC=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/recharge_z.webp | Bin 0 -> 894 bytes assets/image/3x/recharge_z.webp | Bin 0 -> 1194 bytes assets/image/recharge_z.webp | Bin 0 -> 658 bytes lib/mine/personal_page.dart | 2 + lib/mine/recharge_page.dart | 421 ++++++++++++++----- lib/retrofit/data/member_Infor.dart | 24 +- lib/retrofit/data/miNiDetail.dart | 4 +- lib/retrofit/data/rechargeActLists.dart | 155 +++++++ lib/retrofit/data/settleOrderInfo.dart | 6 +- lib/retrofit/data/social_info.dart | 18 +- lib/retrofit/data/user_info.dart | 8 +- lib/retrofit/retrofit_api.dart | 5 +- lib/retrofit/retrofit_api.g.dart | 14 +- lib/settlement/settlement.dart | 74 ++-- lib/view_widget/recharge_details_dialog.dart | 8 +- 15 files changed, 550 insertions(+), 189 deletions(-) create mode 100644 assets/image/2x/recharge_z.webp create mode 100644 assets/image/3x/recharge_z.webp create mode 100644 assets/image/recharge_z.webp create mode 100644 lib/retrofit/data/rechargeActLists.dart diff --git a/assets/image/2x/recharge_z.webp b/assets/image/2x/recharge_z.webp new file mode 100644 index 0000000000000000000000000000000000000000..36306282e86db7de58458f943038ea18f49e5e7d GIT binary patch literal 894 zcmWIYbaN|XW?%?+bqWXzu!!JdU|=u+VtEDzMFs{>XXk(uj6f~};|UPS0+h$ zTO=LA)&Q}SAZ!~DyS${J1gIte#4ZX6at5+ffNYI)Bz6)KJGr0;q`n8J#wItX6l50& zfPBZ3nim=jq&a|ChM|}th{2t~3FLnu9|-anF)&zsWnf^QfDlWX$-uC^m4QLx7D7yA z0Rsbn3j@Qp^9V6Sm=q)yC4!A(0g_Bm$qafxmJu*g4H?XUG3?XM$iSd4@4zA8|HxvJiux+KEn@a( zjz-xuOun3FkRg3?;&-XW_D_Ebzy2?j_S_WwHP}whPIE%NN5w4tX^FSZ`X*1Cd*}N< zMy4J=i*KgaH*UCZecAf+O|$azN4`tdt>4|Y{CC{RhI#5gzvf@f71_Tt@=JY`;oU#? zBQtlLn)Oq->8icJ+&OPn1znKjR7zc9A9l`xEki`b)#CI@t;vTt*ro)fZf{~)ZV@0R z9JrBjR)^LBH;G$aicTWR7Dt^pLKp>Obgjd9CO3bzo^zZt`U(I)$dv@ot=~-9I0xt)aTTHQ=up#gYYvAbv;VOH#HU93H i`X-%s$=x@r^XF7%&wnlYDWdw1-uFH6`Myu;c^LpGjs(a6 literal 0 HcmV?d00001 diff --git a/assets/image/3x/recharge_z.webp b/assets/image/3x/recharge_z.webp new file mode 100644 index 0000000000000000000000000000000000000000..4d1e9033bd87570397ad43a2e7ee84fabf99c006 GIT binary patch literal 1194 zcmWIYbaPw8!oU#j>J$(bU=hK^z`$St#QF>jh71gz&dvcR7=c^{#uFft1t^u9S5g$@ z?xYYA8KuDffPoPR!5}fYxB$Y!N&;1Vy9QBvSr@Ac{DPb*sl~}aB_DuTr3h#_&`lyh zwn#dJtpQ>uLD)7Rc6mub2~bS{h+PyCD76yiG=MiFvFeykZN(37Rj12~+v@`~WPs(~%mj>GeFq+a=}$B!<%ZAvX?Y{z z>t6*9+aHe1Yl`^Z-)N9Nxoyp|^U3VolXEgi8a{LaoFA7Dok@8{2YkUF^%fy>0FuAoKP%uHDBa zzrMO#?$53C>->q_+a4}GCo{i!KIetT%>#j`OZ&fnvWgdf2#Q1oh6Md}t;Y9NJl9Rz z)pf#BEpuIWO=pYWL@`r2l?9(}UrJupkb7y9)R)O_t#-94;_eiB+%lLr0S*M7CBKr{%ogT%?%n?h+hTI_;NVL2f$ zqMnmfKxnr5-|w3*@@|Y)c{-~-sy{4f%eO~mnlZZZm&7#R#@<=D!?5t_B}Q2FFxpIfvLhjxAb9PaA3lHo6|H2`)+J+75tzvY-Snp^3{g$`n!0BJ++NUCRT%1w7 Ne6m~8g2k@v3;>wJluQ5s literal 0 HcmV?d00001 diff --git a/assets/image/recharge_z.webp b/assets/image/recharge_z.webp new file mode 100644 index 0000000000000000000000000000000000000000..307da899f72b7bb6db46aaf6f632289e05f2ddd1 GIT binary patch literal 658 zcmWIYbaU%sVqge&bqWXzu!!JdU|=u+Vtxh&0R{$7XXk(uj6f~};|UPS0+h$ zTO=LA)&Q}SAZ!~DyS${J1gIte#4ZX6at5+ffNYI)Bz6)KJGr0;q`n8J#wItX6l50& zfPBZ3nim=jq&a|ChM|}th{2t~3FLnu9|-anF)&zsWnf^QfDlWX$-uC^m4QLx7D7yA z0We%!7#OylM~ET9q#&^<5o{a_kYq|rV_^8SoPmKil7T_^0s{kAG*}Ku;BcD)P)Y{q zu6!U&XUJhlWl&)7WXNMkX3zt&jDV49$Y2JHVV^lbh5GyqECS0HEXb8st5!Hxc4YYl z1%Z|mYX8?KF3X+0=Z_Hxa with WidgetsBindingObserver { BaseData baseData = await apiService.memberDetail(id).catchError((error) { refreshController.refreshFailed(); + debugPrint(error); }); if (baseData != null && baseData.isSuccess) { setState(() { @@ -126,6 +127,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { "pageSize": 10, "searchKey": searchKey ?? "" }).catchError((error) { + debugPrint(error); if (searchKey == null) { refreshController.refreshFailed(); refreshController.loadFailed(); diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 50219753..6ec69bfb 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -10,6 +10,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/rechargeActLists.dart'; import 'package:huixiang/retrofit/data/recharge_list.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; @@ -42,12 +43,14 @@ class _RechargePage extends State { List vipBenefitList = []; Color color = Colors.black; double discount = 100; - List rechargeA; + // List rechargeA; int selectIndex = 0; UserInfo userInfo; String mBalance = "0"; dynamic payListen; - + RechargeActLists rechargeActLists; + int selectStoreIndex = 0; + String recommendName; @override void initState() { @@ -58,7 +61,7 @@ class _RechargePage extends State { context: context, token: value.getString("token"), pay: true); queryBenefitList(); queryRuleDetails(); - queryRechargeList(); + queryRechargeActList(); queryUserBalance(); }); payListen = weChatResponseEventHandler.listen((event) async { @@ -67,8 +70,7 @@ class _RechargePage extends State { queryUserBalance(); Navigator.of(context).pop(); SmartDialog.showToast("充值成功", alignment: Alignment.center); - } - else{ + } else { SmartDialog.showToast("充值失败", alignment: Alignment.center); return; } @@ -78,8 +80,7 @@ class _RechargePage extends State { @override void dispose() { super.dispose(); - if(payListen!=null) - payListen.cancel(); + if (payListen != null) payListen.cancel(); } ///会员权益列表 @@ -125,7 +126,7 @@ class _RechargePage extends State { } ///充值列表 - queryRechargeList() async { + queryRechargeActList() async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -134,11 +135,11 @@ class _RechargePage extends State { token: value.getString("token"), ); } - BaseData> baseData = - await apiService.rechargeAct().catchError((onError) {}); + BaseData baseData = + await apiService.rechargeActList().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { - rechargeA = baseData.data; + rechargeActLists = baseData.data; }); } EasyLoading.dismiss(); @@ -215,7 +216,8 @@ class _RechargePage extends State { fontSize: 15.sp, color: Color(0xFF181818), fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.semi_bold), + fontWeight: + MyFontWeight.semi_bold), )), Text.rich( TextSpan(children: [ @@ -269,11 +271,10 @@ class _RechargePage extends State { )), Container( width: double.infinity, - margin: EdgeInsets.only( - bottom: 22.h, left: 16, right: 16), + margin: EdgeInsets.only(left: 16, right: 16), padding: EdgeInsets.only( top: 20.h, - bottom: 20.h, + bottom: 24.h, ), // decoration: BoxDecoration( // color: Colors.white, @@ -327,7 +328,7 @@ class _RechargePage extends State { ], ), ), - SizedBox(height:10.h), + SizedBox(height: 10.h), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -337,9 +338,9 @@ class _RechargePage extends State { }, child: Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Image.asset( "assets/image/icon_alipay.webp"), @@ -363,6 +364,48 @@ class _RechargePage extends State { ], ), ), + if((rechargeActLists?.isOpen ?? false) == true) + GestureDetector( + onTap: () { + showRecommendStore(); + }, + child: Container( + padding: EdgeInsets.only( + left: 14.w, + right: 16.w, + top: 14.h, + bottom: 14.h), + margin: EdgeInsets.only( + bottom: 22.h, left: 14.w, right: 14.w), + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.circular(4), + ), + child: Row( + children: [ + Image.asset( + "assets/image/recharge_z.webp", + width: 16.w, + height: 17.h, + fit: BoxFit.fill, + ), + SizedBox(width: 8.w), + Expanded( + child: Text( + recommendName ??"为喜爱门店打call!(可选)", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686), + ), + )), + Icon( + Icons.arrow_forward_ios, + size: 16, + ), + ], + )), + ), Align( alignment: Alignment.bottomCenter, child: GestureDetector( @@ -508,7 +551,7 @@ class _RechargePage extends State { Widget rechargeList() { return ListView.builder( padding: EdgeInsets.zero, - itemCount: rechargeA == null ? 0 : rechargeA.length, + itemCount: (rechargeActLists != null && (rechargeActLists?.preferentialList?.length ?? 0) > 0) ? rechargeActLists.preferentialList.length : 0, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), @@ -519,22 +562,24 @@ class _RechargePage extends State { selectIndex = position; }); }, - child: rechargeItem(rechargeA[position], position)); + child: rechargeItem(rechargeActLists.preferentialList[position], position)); }, ); } - Widget rechargeItem(RechargeList rechargeA, index) { + Widget rechargeItem(PreferentialList preferentialList, index) { return Container( width: double.infinity, height: 69.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), border: Border.all( - color: selectIndex == index ? Color(0xFF32A060) :Color(0xFFFAFAFA), - width: selectIndex == index ? 1 :0, + color: + selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA), + width: selectIndex == index ? 1 : 0, ), - color: selectIndex == index ? Color(0XFFF0FAF4) :Color(0xFFFAFAFA)), + color: + selectIndex == index ? Color(0XFFF0FAF4) : Color(0xFFFAFAFA)), margin: EdgeInsets.only(bottom: 14.w), padding: EdgeInsets.only(left: 16), child: Flex( @@ -549,16 +594,20 @@ class _RechargePage extends State { text: "储值 ", style: TextStyle( fontSize: 12.sp, - color:selectIndex == index ? Color(0xFF4D4D4D):Color(0xFF868686), + color: selectIndex == index + ? Color(0xFF4D4D4D) + : Color(0xFF868686), fontWeight: MyFontWeight.regular), ), TextSpan( text: - "${AppUtils.calculateDouble(double.tryParse(rechargeA.rechargeMoney) ?? 0)}元", + "${AppUtils.calculateDouble(double.tryParse(preferentialList.rechargeMoney) ?? 0)}元", style: TextStyle( fontSize: 18.sp, fontFamily: 'JDZhengHT', - color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), fontWeight: MyFontWeight.semi_bold), ), ]), @@ -567,74 +616,81 @@ class _RechargePage extends State { Container( width: 1.w, height: 37.h, - color: selectIndex == index ? Color(0xFF32A060):Color(0xFF979797), + color: + selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797), margin: EdgeInsets.only(right: 16.w, left: 12), ), - Expanded( - flex: 2, - child:Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text.rich( - TextSpan(children: [ - TextSpan( - text: "实际到账 ", - style: TextStyle( - fontSize: 12.sp, - color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), - fontWeight: MyFontWeight.regular), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan(children: [ + TextSpan( + text: "实际到账 ", + style: TextStyle( + fontSize: 12.sp, + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + fontWeight: MyFontWeight.regular), + ), + TextSpan( + text: + "${AppUtils.calculateDouble((double.tryParse(preferentialList.rechargeMoney) ?? 0) + (double.tryParse(preferentialList.giftdMoney) ?? 0) + ((double.tryParse(preferentialList.rechargeMoney) ?? 0) - ((double.tryParse(preferentialList.rechargeMoney) ?? 0) * (discount / 100))))}元", + style: TextStyle( + fontSize: 18.sp, + fontFamily: 'JDZhengHT', + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + fontWeight: MyFontWeight.semi_bold), + ), + ]), ), - TextSpan( - text: - "${AppUtils.calculateDouble((double.tryParse(rechargeA.rechargeMoney) ?? 0) + (double.tryParse(rechargeA.giftdMoney) ?? 0) + ((double.tryParse(rechargeA.rechargeMoney) ?? 0) - ((double.tryParse(rechargeA.rechargeMoney) ?? 0) * (discount / 100))))}元", - style: TextStyle( - fontSize: 18.sp, - fontFamily: 'JDZhengHT', - color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), - fontWeight: MyFontWeight.semi_bold), + SizedBox( + height: 4.h, ), - ]), - ), - SizedBox( - height: 4.h, - ), - GestureDetector( - onTap: (){ - setState(() { - if(selectIndex == index) - showRecharge(index); - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "充值说明", - style: TextStyle( - color: selectIndex == index ?Color(0xFF4D4D4D) : Color(0xFF868686), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - Icon( - Icons.chevron_right, - size: 20, - color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), - ), - ], - ) - ), - ], - )) + GestureDetector( + onTap: () { + setState(() { + if (selectIndex == index) showRecharge(index); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "充值说明", + style: TextStyle( + color: selectIndex == index + ? Color(0xFF4D4D4D) + : Color(0xFF868686), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Icon( + Icons.chevron_right, + size: 20, + color: selectIndex == index + ? Color(0xFF353535) + : Color(0xFF868686), + ), + ], + )), + ], + )) ], )); } Widget checkView(var index) { return Container( - padding: EdgeInsets.only(right: 16.w,left: 46.w), + padding: EdgeInsets.only(right: 16.w, left: 46.w), alignment: Alignment.center, child: Image.asset( checkIndex != index @@ -648,15 +704,153 @@ class _RechargePage extends State { ///充值说明底部弹窗 showRecharge(index) { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (context) { - return RechargeWidget(rechargeA[index]); - }); - } + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return RechargeWidget(rechargeActLists.preferentialList[index]); + }); + } + + ///选择推荐门店 + showRecommendStore() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (BuildContext context) { + return StatefulBuilder(builder: ( + context, + state, + ) { + return Container( + height: 321.h, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + topRight: Radius.circular(6), + ), + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.symmetric(vertical: 12), + child: Text( + "选择推荐门店", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), + )), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + child: Icon( + Icons.clear, + color: Colors.black, + size: 18, + ), + ), + SizedBox(width: 14), + ], + ), + Container( + height: 1, + color: Color(0xFFF2F2F2), + margin: EdgeInsets.only(bottom: 13.h), + ), + Expanded( + child: ListView.builder( + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + state(() { + selectStoreIndex = position; + }); + }, + child: recommendStoreItem(position), + ); + }, + itemCount: rechargeActLists.channels.length ?? 0, + )), + GestureDetector( + onTap: () { + setState(() { + recommendName = + rechargeActLists.channels[selectStoreIndex]; + Navigator.of(context).pop(); + }); + }, + child: Container( + width: double.infinity, + height: 40.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + color: Color(0xFF32A060), + ), + alignment: Alignment.center, + margin: EdgeInsets.only( + top: 14.h, bottom: 30.h, left: 16.w, right: 16.w), + child: Text( + S.of(context).queding, + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFFFFFFF), + ), + ), + ), + ), + ], + ), + ); + }); + },); + } + Widget recommendStoreItem(index) { + return Container( + height: 52, + margin: EdgeInsets.only(bottom: 12, left: 14, right: 14), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: new BorderRadius.circular(6), + border: Border.all( + color: + selectStoreIndex == index ? Color(0xFF32A060) : Color(0xFFF7F7F7), + width: selectStoreIndex == index ? 1 : 0, + ), + color: + selectStoreIndex == index ? Color(0xFFF0FAF4) : Color(0xFFF7F7F7), + ), + alignment: Alignment.centerLeft, + padding: EdgeInsets.only( + left: 12, + ), + child: Text( + rechargeActLists?.channels[index] ?? "", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 14.sp, + color: selectStoreIndex == index ? Color(0xFF32A060) : Colors.black, + ), + ), + ); + } + ///充值 recharge() async { // String money = controller.text; // if (money == null || money == "") { @@ -673,11 +867,12 @@ class _RechargePage extends State { // } BaseData baseData = await apiService.recharge({ "amount": 0, - "rechargeActId": rechargeA[selectIndex].id, - "rechargeType": checkIndex + "rechargeActId": rechargeActLists.preferentialList[selectIndex].id, + "rechargeType": checkIndex, + "channel": recommendName, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { - if(checkIndex==2){ + if (checkIndex == 2) { if (Platform.isAndroid) { if (!(await Min.isInitialize())) { // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, @@ -701,22 +896,26 @@ class _RechargePage extends State { timeStamp: int.tryParse(wxPay.timeStamp), sign: wxPay.sign, ); - }else{ - tobias.isAliPayInstalled().then((value) => { // 判断是否安装了支付宝 - if (!value) { - SmartDialog.showToast("请安装支付宝", alignment: Alignment.center) - }else{ - tobias.aliPay(baseData.data["body"]).then((payRes) { - if (payRes['resultStatus'] == 9000 || - payRes['resultStatus'] == '9000') { - SmartDialog.showToast("充值成功", alignment: Alignment.center); - Navigator.of(context).pop(); - } else { - SmartDialog.showToast(payRes['memo'], alignment: Alignment.center); - } - }) - } - }); + } else { + tobias.isAliPayInstalled().then((value) => { + // 判断是否安装了支付宝 + if (!value) + {SmartDialog.showToast("请安装支付宝", alignment: Alignment.center)} + else + { + tobias.aliPay(baseData.data["body"]).then((payRes) { + if (payRes['resultStatus'] == 9000 || + payRes['resultStatus'] == '9000') { + SmartDialog.showToast("充值成功", + alignment: Alignment.center); + Navigator.of(context).pop(); + } else { + SmartDialog.showToast(payRes['memo'], + alignment: Alignment.center); + } + }) + } + }); } } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); diff --git a/lib/retrofit/data/member_Infor.dart b/lib/retrofit/data/member_Infor.dart index c9daf168..130ea3f2 100644 --- a/lib/retrofit/data/member_Infor.dart +++ b/lib/retrofit/data/member_Infor.dart @@ -31,10 +31,10 @@ class MemberInfor { int age, String signature, String background, - int follow, - int fans, - int trendTotal, - int gainLikeTotal,}){ + String follow, + String fans, + String trendTotal, + String gainLikeTotal,}){ _id = id; _nickname = nickname; _headimg = headimg; @@ -86,10 +86,10 @@ class MemberInfor { int _age; String _signature; String _background; - int _follow; - int _fans; - int _trendTotal; - int _gainLikeTotal; + String _follow; + String _fans; + String _trendTotal; + String _gainLikeTotal; String get id => _id; String get nickname => _nickname; @@ -104,10 +104,10 @@ class MemberInfor { int get age => _age; String get signature => _signature; String get background => _background; - int get follow => _follow; - int get fans => _fans; - int get trendTotal => _trendTotal; - int get gainLikeTotal => _gainLikeTotal; + String get follow => _follow; + String get fans => _fans; + String get trendTotal => _trendTotal; + String get gainLikeTotal => _gainLikeTotal; Map toJson() { final map = {}; diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index 2f5af8e3..8b116c3e 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -946,8 +946,8 @@ class StoreDTOBean { String storeName; String nickName; String logo; - int productCount; - int soldNum; + dynamic productCount; + dynamic soldNum; static StoreDTOBean fromJson(Map map) { if (map == null) return null; diff --git a/lib/retrofit/data/rechargeActLists.dart b/lib/retrofit/data/rechargeActLists.dart new file mode 100644 index 00000000..4ad31b30 --- /dev/null +++ b/lib/retrofit/data/rechargeActLists.dart @@ -0,0 +1,155 @@ +/// preferentialList : [{"id":"1506553893994102784","rechargeMoney":"100.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-11-11 10:10:31","isDeleted":0,"rechargeType":0,"remark":"

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。
储值活动不与其他活动同享

","sortValue":1},{"id":"1506553858271215616","rechargeMoney":"300.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-11-21 19:56:39","isDeleted":0,"rechargeType":0,"remark":"

平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。

","sortValue":2},{"id":"1506553832157478912","rechargeMoney":"500.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-11-21 19:56:48","isDeleted":0,"rechargeType":0,"remark":"

平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。

","sortValue":3},{"id":"1506553759084314624","rechargeMoney":"800.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-06-10 11:14:39","isDeleted":0,"rechargeType":0,"remark":"

平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。

","sortValue":4},{"id":"1506553705988620288","rechargeMoney":"1000.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-11-21 19:56:55","isDeleted":0,"rechargeType":0,"remark":"

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。

","sortValue":5},{"id":"1506553668529291264","rechargeMoney":"1500.00","giftdMoney":"0.00","gitfdCouponId":null,"tenantCode":"admin","createTime":"2022-06-10 11:14:52","isDeleted":0,"rechargeType":0,"remark":"

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。

","sortValue":6}] +/// channels : ["海峡","回乡","boom"] +/// isOpen : false + +class RechargeActLists { + RechargeActLists({ + List preferentialList, + List channels, + bool isOpen,}){ + _preferentialList = preferentialList; + _channels = channels; + _isOpen = isOpen; +} + + RechargeActLists.fromJson(dynamic json) { + if (json['preferentialList'] != null) { + _preferentialList = []; + json['preferentialList'].forEach((v) { + _preferentialList.add(PreferentialList.fromJson(v)); + }); + } + _channels = json['channels'] != null ? json['channels'].cast() : []; + _isOpen = json['isOpen']; + } + List _preferentialList; + List _channels; + bool _isOpen; +RechargeActLists copyWith({ List preferentialList, + List channels, + bool isOpen, +}) => RechargeActLists( preferentialList: preferentialList ?? _preferentialList, + channels: channels ?? _channels, + isOpen: isOpen ?? _isOpen, +); + List get preferentialList => _preferentialList; + List get channels => _channels; + bool get isOpen => _isOpen; + + Map toJson() { + final map = {}; + if (_preferentialList != null) { + map['preferentialList'] = _preferentialList.map((v) => v.toJson()).toList(); + } + map['channels'] = _channels; + map['isOpen'] = _isOpen; + return map; + } + +} + +/// id : "1506553893994102784" +/// rechargeMoney : "100.00" +/// giftdMoney : "0.00" +/// gitfdCouponId : null +/// tenantCode : "admin" +/// createTime : "2022-11-11 10:10:31" +/// isDeleted : 0 +/// rechargeType : 0 +/// remark : "

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。
储值活动不与其他活动同享

" +/// sortValue : 1 + +class PreferentialList { + PreferentialList({ + String id, + String rechargeMoney, + String giftdMoney, + dynamic gitfdCouponId, + String tenantCode, + String createTime, + num isDeleted, + num rechargeType, + String remark, + num sortValue,}){ + _id = id; + _rechargeMoney = rechargeMoney; + _giftdMoney = giftdMoney; + _gitfdCouponId = gitfdCouponId; + _tenantCode = tenantCode; + _createTime = createTime; + _isDeleted = isDeleted; + _rechargeType = rechargeType; + _remark = remark; + _sortValue = sortValue; +} + + PreferentialList.fromJson(dynamic json) { + _id = json['id']; + _rechargeMoney = json['rechargeMoney']; + _giftdMoney = json['giftdMoney']; + _gitfdCouponId = json['gitfdCouponId']; + _tenantCode = json['tenantCode']; + _createTime = json['createTime']; + _isDeleted = json['isDeleted']; + _rechargeType = json['rechargeType']; + _remark = json['remark']; + _sortValue = json['sortValue']; + } + String _id; + String _rechargeMoney; + String _giftdMoney; + dynamic _gitfdCouponId; + String _tenantCode; + String _createTime; + num _isDeleted; + num _rechargeType; + String _remark; + num _sortValue; +PreferentialList copyWith({ String id, + String rechargeMoney, + String giftdMoney, + dynamic gitfdCouponId, + String tenantCode, + String createTime, + num isDeleted, + num rechargeType, + String remark, + num sortValue, +}) => PreferentialList( id: id ?? _id, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + giftdMoney: giftdMoney ?? _giftdMoney, + gitfdCouponId: gitfdCouponId ?? _gitfdCouponId, + tenantCode: tenantCode ?? _tenantCode, + createTime: createTime ?? _createTime, + isDeleted: isDeleted ?? _isDeleted, + rechargeType: rechargeType ?? _rechargeType, + remark: remark ?? _remark, + sortValue: sortValue ?? _sortValue, +); + String get id => _id; + String get rechargeMoney => _rechargeMoney; + String get giftdMoney => _giftdMoney; + dynamic get gitfdCouponId => _gitfdCouponId; + String get tenantCode => _tenantCode; + String get createTime => _createTime; + num get isDeleted => _isDeleted; + num get rechargeType => _rechargeType; + String get remark => _remark; + num get sortValue => _sortValue; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['rechargeMoney'] = _rechargeMoney; + map['giftdMoney'] = _giftdMoney; + map['gitfdCouponId'] = _gitfdCouponId; + map['tenantCode'] = _tenantCode; + map['createTime'] = _createTime; + map['isDeleted'] = _isDeleted; + map['rechargeType'] = _rechargeType; + map['remark'] = _remark; + map['sortValue'] = _sortValue; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index 678d794e..1176849f 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -22,6 +22,8 @@ class SettleOrderInfo { bool isRaise; int selectDiscount; bool useVipPriceSelect = false; + String vipDiscountAmount; + static SettleOrderInfo fromJson(Map map) { if (map == null) return null; @@ -51,6 +53,7 @@ class SettleOrderInfo { settleOrderInfoBean.usePlateMoney = map['usePlateMoney']; settleOrderInfoBean.isRaise = map['isRaise']; settleOrderInfoBean.selectDiscount = map['selectDiscount']; + settleOrderInfoBean.vipDiscountAmount = map['vipDiscountAmount']; return settleOrderInfoBean; } @@ -73,7 +76,8 @@ class SettleOrderInfo { "memberCouponId": memberCouponId, "usePlateMoney":usePlateMoney, "isRaise":isRaise, - "selectDiscount":selectDiscount + "selectDiscount":selectDiscount, + "vipDiscountAmount":vipDiscountAmount }; diff --git a/lib/retrofit/data/social_info.dart b/lib/retrofit/data/social_info.dart index 252dec8a..cffbc3d4 100644 --- a/lib/retrofit/data/social_info.dart +++ b/lib/retrofit/data/social_info.dart @@ -3,9 +3,9 @@ class SocialInfo { SocialInfo({ - int fans, - int follow, - int achievementNumber}){ + dynamic fans, + dynamic follow, + dynamic achievementNumber}){ _fans = fans; _follow = follow; _achievementNumber = achievementNumber; @@ -16,13 +16,13 @@ class SocialInfo { _follow = json['follow']; _achievementNumber = json['achievementNumber']; } - int _fans; - int _follow; - int _achievementNumber; + dynamic _fans; + dynamic _follow; + dynamic _achievementNumber; - int get fans => _fans; - int get follow => _follow; - int get achievementNumber => _achievementNumber; + dynamic get fans => _fans; + dynamic get follow => _follow; + dynamic get achievementNumber => _achievementNumber; set fans(int value) { diff --git a/lib/retrofit/data/user_info.dart b/lib/retrofit/data/user_info.dart index b3015f2b..1c1c03ad 100644 --- a/lib/retrofit/data/user_info.dart +++ b/lib/retrofit/data/user_info.dart @@ -41,8 +41,8 @@ class UserInfo { String raiseExpireTime; bool isBind; String masterId; - int inviteNumber; - int todayInviteNumber; + dynamic inviteNumber; + dynamic todayInviteNumber; String masterCardRankName; MemberRank memberRankVo; String inviteCode; @@ -76,8 +76,8 @@ class UserInfo { ..raiseExpireTime = json['raiseExpireTime'] as String ..isBind = json['isBind'] as bool ..masterId = json['masterId'] as String - ..inviteNumber = json['inviteNumber'] as int - ..todayInviteNumber = json['todayInviteNumber'] as int + ..inviteNumber = json['inviteNumber'] as dynamic + ..todayInviteNumber = json['todayInviteNumber'] as dynamic ..masterCardRankName = json['masterCardRankName'] as String ..inviteCode = json['inviteCode'] as String ..signature = json['signature'] as String diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 7b1581b7..eaf2e48d 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -47,6 +47,7 @@ import 'data/message.dart'; import 'data/msg_stats.dart'; import 'data/page.dart'; import 'data/rank.dart'; +import 'data/rechargeActLists.dart'; import 'data/recharge_list.dart'; import 'data/second_card_list.dart'; import 'data/sign_info.dart'; @@ -215,8 +216,8 @@ abstract class ApiService { Future> recharge(@Body() Map param); ///充值活动列表 - @GET("/wallet/rechargeAct") - Future>> rechargeAct(); + @GET("/wallet/rechargeActList") + Future> rechargeActList(); ///领取优惠券 @GET("/coupon/receive?couponId={couponId}") diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 49509dc2..c9699f94 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -301,12 +301,12 @@ class _ApiService implements ApiService { } @override - Future>> rechargeAct() async { + Future> rechargeActList() async { const _extra = {}; final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - '/wallet/rechargeAct', + '/wallet/rechargeActList', queryParameters: queryParameters, options: RequestOptions( method: 'GET', @@ -314,12 +314,10 @@ class _ApiService implements ApiService { extra: _extra, baseUrl: baseUrl), data: _data); - final value = BaseData>.fromJson( - _result.data, - (json) => (json as List) - .map( - (i) => RechargeList.fromJson(i as Map)) - .toList()); + final value = BaseData.fromJson( + _result.data, + (json) => RechargeActLists.fromJson(json), + ); return value; } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index cdf58a04..abf12147 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -136,13 +136,13 @@ class _Settlement extends State { queryOrderInfo( address != null ? address.id : null, selectedBtn, - null, 0, - widget.arguments["pid"] ?? (productId ?? ""), + 0, + widget.arguments["pid"] ?? (productId ?? 0), productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -152,11 +152,11 @@ class _Settlement extends State { selectedBtn, widget.arguments["cid"], 0, - productId ?? null, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -164,13 +164,13 @@ class _Settlement extends State { queryOrderInfo( null, selectedBtn, - null, 0, - productId ?? null, + 0, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -192,7 +192,7 @@ class _Settlement extends State { productSkuId, actProductId, actProductSkuId, - useVipPriceSelect, + // useVipPriceSelect, buyNum, payChannel, tableId) async { @@ -208,10 +208,11 @@ class _Settlement extends State { "productSkuId": productSkuId, "actProductId": actProductId, "actProductSkuId": actProductSkuId, - "useVipPrice": useVipPriceSelect, + // "useVipPrice": useVipPriceSelect, "buyNum": buyNum, "payChannel": payChannel, - "tableId": tableId + "tableId": tableId, + "discountType":"AUTO" }).catchError((error) {}); this.promotion = null; promotions = ""; @@ -252,7 +253,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, settleOrderInfo.isRaise ? 7 : payChannel, tableId); @@ -329,13 +330,13 @@ class _Settlement extends State { queryOrderInfo( address.id, selectedBtn, - null, 0, - productId ?? null, + 0, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -381,13 +382,13 @@ class _Settlement extends State { await queryOrderInfo( address.id, selectedBtn, - null, 0, - productId ?? null, + 0, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -409,13 +410,13 @@ class _Settlement extends State { queryOrderInfo( address.id, selectedBtn, - null, 0, - productId ?? null, + 0, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -506,9 +507,9 @@ class _Settlement extends State { placeOrderFirst.isTakeOut = selectedBtn; placeOrderFirst.notes = remakers + (reservationTime ?? "") + - (subscribeParam == null - ? "" - : "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}"); + ((subscribeParam?.isEnableSubscribe ?? false) == true + ? "预约门店:${((subscribeParam?.stores?.length ?? 0) == 1 ? (subscribeParam.stores[0]) : (subscribeStoresName ?? ""))}" + : ""); placeOrderFirst.numberOfPeople = "$numberOfPeople"; placeOrderFirst.orderSource = 2; placeOrderFirst.orderType = "0"; @@ -787,11 +788,11 @@ class _Settlement extends State { isTake, memberCouponId, orderId, - promotionId ?? (productId ?? ""), + promotionId ?? (productId ?? 0), productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId ?? 0); @@ -942,7 +943,7 @@ class _Settlement extends State { if (subscribeParam != null && ((subscribeParam.isEnableSubscribe ?? false) == true) && (reservationTime == null || - subscribeStoresName == null)) { + ((subscribeParam.stores.length ==1 ? subscribeParam.stores[0] : subscribeStoresName) == null))) { SmartDialog.showToast( (reservationTime == null) ? "请选择预约时间" @@ -988,7 +989,7 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -1003,13 +1004,13 @@ class _Settlement extends State { queryOrderInfo( address?.id, selectedBtn, - null, 0, - productId ?? null, + 0, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -1061,11 +1062,11 @@ class _Settlement extends State { selectedBtn, couponBean?.id, 0, - productId ?? null, + productId ?? 0, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -1092,13 +1093,13 @@ class _Settlement extends State { queryOrderInfo( address?.id, selectedBtn, - null, + 0, 0, (pro.id ?? "") ?? productId, productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - useVipPriceSelect, + // useVipPriceSelect, count1, payChannel, tableId); @@ -1236,8 +1237,7 @@ class _Settlement extends State { GestureDetector( onTap: (){ setState(() { - subscribeStoresName = - subscribeParam.stores[storesIndex]; + subscribeStoresName = subscribeParam.stores[storesIndex]; }); Navigator.of(context).pop(); }, diff --git a/lib/view_widget/recharge_details_dialog.dart b/lib/view_widget/recharge_details_dialog.dart index 92b880b3..5d180df4 100644 --- a/lib/view_widget/recharge_details_dialog.dart +++ b/lib/view_widget/recharge_details_dialog.dart @@ -11,9 +11,11 @@ import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; +import '../retrofit/data/rechargeActLists.dart'; + class RechargeWidget extends StatefulWidget { - final RechargeList rechargeA; - RechargeWidget(this.rechargeA); + final PreferentialList preferentialList; + RechargeWidget(this.preferentialList); @override State createState() { return _RechargeWidget(); @@ -87,7 +89,7 @@ class _RechargeWidget extends State { child: Container( color: Colors.white, child: Html( - data: widget.rechargeA.remark ?? "", + data: widget.preferentialList.remark ?? "", customImageRenders: { networkSourceMatcher(): networkImageRender( loadingWidget: () { From 1273e233c3fa9a6a10662262ec6de7111462e8b2 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Sun, 23 Apr 2023 16:17:49 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8E=A8=E8=8D=90=E9=97=A8=E5=BA=97=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/login_channel.webp | Bin 0 -> 996 bytes assets/image/2x/login_store.webp | Bin 0 -> 1218 bytes assets/image/3x/login_channel.webp | Bin 0 -> 1384 bytes assets/image/3x/login_store.webp | Bin 0 -> 2768 bytes assets/image/login_channel.webp | Bin 0 -> 686 bytes assets/image/login_store.webp | Bin 0 -> 752 bytes lib/login/login_store_select.dart | 174 +++++++++++++++++++++++++++ lib/login/new_login_page.dart | 46 ++++++- lib/main.dart | 3 + lib/retrofit/data/channels_list.dart | 155 ++++++++++++++++++++++++ lib/retrofit/retrofit_api.dart | 5 + lib/retrofit/retrofit_api.g.dart | 21 ++++ 12 files changed, 402 insertions(+), 2 deletions(-) create mode 100644 assets/image/2x/login_channel.webp create mode 100644 assets/image/2x/login_store.webp create mode 100644 assets/image/3x/login_channel.webp create mode 100644 assets/image/3x/login_store.webp create mode 100644 assets/image/login_channel.webp create mode 100644 assets/image/login_store.webp create mode 100644 lib/login/login_store_select.dart create mode 100644 lib/retrofit/data/channels_list.dart diff --git a/assets/image/2x/login_channel.webp b/assets/image/2x/login_channel.webp new file mode 100644 index 0000000000000000000000000000000000000000..0bfda89da51b951588fc84179af9d9f9adfba40d GIT binary patch literal 996 zcmWIYbaT7I%)k)t>J$(bU=hK^z`$St#Oh$=>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-be-p;R_55T+v`TAc4be3P33tpu6&c zFr6WXA(cUa!IL46A(=rB$T9*(sv(0JFou2JF)}dds~_MLnEp^kMP50I5gmS~*jOSvr|5cg@U-WuXkM~0Ha0GPI{(i7d*{yOvIzc7f3Pig zj>5sJ@V$HNJHWtW;eMN#xDQtHVt@C51z3W5uktc5JlK|XBWUYceh2?QW~R~({m!uM$hsA7FFDHWr)?<_ni=C+wN+BkB z!&Ps?cfOewVR=r!L893X7^G03a7{hxSz(}J*TLgc6*PVMv|O}P-m-W~W-N5_aW?av zFy-^x)dI`s$nBimb>-yiSwX5 Z*Z&*-XMWoI^WfeW&wm=cXZh#O1OUFxM5q7& literal 0 HcmV?d00001 diff --git a/assets/image/2x/login_store.webp b/assets/image/2x/login_store.webp new file mode 100644 index 0000000000000000000000000000000000000000..e9e2b7da75183fc325322e076ea5cabaf4434d8f GIT binary patch literal 1218 zcmWIYbaUIq!oU#j>J$(bU=hK^z`$St#L{5o>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9z}R45N=sv4__UmXfj5$YLHGg#16MRy4oKi|n*vZu2I#JQ zAWUb-VMt|AVDMzfV@PJu1G0>Ok!r|b28>~!GfWH&`qBs31irIaZpyuSD(d^b|Alh} znLQ_|7#fsJ-+ie-#&gn@5dQ0v)!QEIk2Jp|a>ZkkOmyh-hspi*^Y{H{t66dMp4j1S zxrdKAsorIhI3T;@`BmNgyl>_F*SlYTKYa83%a7k*ru_c+$yVln-JkvL*A3pko^QPE z`_<|1|8MxZ;p@xnS=BtBALr_|-%p-#`t9|X6SDth-+7by_0qg#yFXG z{q1eJKs5XQ|C`$itJZygS8LGH@z1#6wnyOif{fkF^I`FHU~kU9m+?CkJv|N|6Zc&A z`jw7QRawis8k6^LeWR16+ZCy)?B3fccH+Ubwj*0Jp7lNXo|e4gNOJ4eO-Hs@{ha&c zv(rxXgoj)TQ9Dc71g?IIR;)Ch`CjD*>-v3cjKXi4liyFYxOFmN*3_Jcp9hvZRP5dR zJ89CB`QIW+J^rVD3TL@+QuD#T&2|o_cYf*1Uwf_Lu;81i#n zprOakhYxvnPS?p*fBO5F=UK%!GyceJ2!E^jG+H}#p1IG(1jVP(n?EgQF}ZX*_uO{5 zB8xoT!h#(}Pou?G#>W&1%4oUnE3Mxo|MNQkh8yNjZ!=tQop)5}@|=9;j+#f3?>C2? z{dukZuh{atVIFbTk_QC(V-l>F*@(Z|_J{NJlzx?i2afyJ`=oi89X^rcsZ+m?C;HWI FCIBjuuXO+b literal 0 HcmV?d00001 diff --git a/assets/image/3x/login_channel.webp b/assets/image/3x/login_channel.webp new file mode 100644 index 0000000000000000000000000000000000000000..0b6639023d9f6120c5a302b2f18a9f038b373325 GIT binary patch literal 1384 zcmWIYbaP8!Wnc(*bqWXzu!!JdU|=u+Vrww+baoCn!3g9sFrEOBEI_H;ypp0IcPE92 z$S4K&2Mmlr2nLDC#RU)+RuZV{+ck*V%eq)q;1}dfNi9wWD)|7!Dn&rcfo>83vPIG% zYz+`Q3BtAkvCB&eN`PttK=2?(*InG6iuTNxN6ZXv`}7BDdI zw=ghlJC6`Ugh@eSQ6ktl79h!#md3#FX*mM}ZzKbQ@C612u4u3vkig+K1)!7+&|UdJ zn9h*HkjkLI;K`83kj$V5WElY?)sVpq7{fkA%nS_r)(7|mzCY5Mq;hoCyvOIa7V7yM z+SGaH9xhb&>=J3-ec$=~xxd9tJ7wG_J#o3(+$JvfSf%WPt>x1VxytT+Gk2Z;$;@L= zw&Tt6+m&|S{l|Y-OwliXY548Vo-5BI4&B?|f9Kxvx5m#V703O5mLK|WGw3RZ{; z&g?L{{{Phhd(p0*UMMR~3+TW+!~$Q0APnB>nW{d{A>S=)tYor2F78m1Rb-6^9cbl5xa zWXaDttevyg8_C(<_I%E*vb}ze_w@7GlWU5D-j@Um{f~NijIqD}O7qz&;r5_BZ^enx z88793)qH#Wvs$yaa{g(@^Z%XapO0PlG53es|NN_x|Gt|XOi!EqU*7jao&U+rz)%+Q>*rmyH8b=;!E~eMM(swcCl8w(kDlk-z~^|?={1iQt6mpR(`#cM ztysNZOpdL(S0r}rev#Pr+|}{8sM(M7-&uOwGvzLAXR>d7`~Rnm>GXb0{@0dY7e3oA z{`s7d(W2El>^HS1&OLOU(=IIYrFP<1(YV4&=AHeeHP-6;*0oK&-llD*U9(#t*y6d@ zHRZVzV}Cwj`9IHknxWPDWtZfpPnoyt*Fytqt`kWb$@6a?^}F}}e7RV@{S3n^d2hDO zFt!O(S!QY2Kk>>5@t)@%X2qNTPPsehLYiKdA^Sc3&qeQ9lXse5p6ko= literal 0 HcmV?d00001 diff --git a/assets/image/3x/login_store.webp b/assets/image/3x/login_store.webp new file mode 100644 index 0000000000000000000000000000000000000000..9ac6d0ec4787878f87a3dd49a68f8646727a4080 GIT binary patch literal 2768 zcmaJ>cUV)|5@DAQC`8 zq$wB>B1MozsY(^8A(GHrNb+v<5BGcDzBlL0+~1k`efP}VIpd=t5a*=7UpRL!u5hc{?Gb>rft~`8N`g>e4UB<4w|;01NnkDj znyUcpxc9^7N(7)L1^|h{A3nLi01&weKy}v--;Zw+Cv~=pY;d@7YfOoG)m>|?hl+bE#sh7r{y|f21IQ&^)4TMU7WRFYw-f< z6leSlQ$v_VjncAkG>GgzO7Xu5)C6x zM$|~aiY((0`MCW;0WpG=&5Xuhi;Ud*Seyft{&-l4X$b7A;3$4Fh@B-%EfUm@3-L|4 z^wJ4!uU;%}UM%~{QDv?jH3eVG{M4HS-9y%%)RO}his^;;j4}l@zY(KTu5)jX-dSa# zWD8tJWo5Cqa4Ef(nR~mUM&0l}ABg!lJcx31jPpWg-l-S%Uny0zFVu9^(bt2Ip7l^} ziFn?2Cw(igc_vkUVpr?O0~9gKROY@vZ4rTEQA_oVcYPfDm{A4H+04fLm4M9KJ~#LD z;d|ldJm*N%g`&vuY|h<_TBv zt0%ML@wu9$B1}znkmgfFfJh#%p4Zpgj|FcPAyHmN$96ocs$He^-m?#bI`yFUi8N}{ zYKwj?v+;t4U6<2lXBcOyhMlNfvqz$C?8D1Rxo-ix? zH8vblq5HWV>maE_j%S(Sw^{5Z^03ce@!BC*SymzNA;DRf zow=r>EwshAQNWWiTr63naI5HRPgWmzC$*V#zL2xe>(N00c~C^yZZ#_rUTrn4(;egV z`Sg*e-YVyMpmdWI&syoT&Jsh*S2s&&L&)Uo325|j3A0`+kJ29X(uP-CyYw&#Z;xve z4o#h|b~g;~X`bBKQ@kF$3E{}jhv6j@rAmX7&;g zxEbUID{0(A%rIv-OaR)RNVq@pKOd8!t2uc-ZeRX^Cg$t{vF+R#;@xE)U>aoT)7Iq2 zaN3cl!Jf*`mwjU%qCG)hnXnb!1q0T`SU$b@%1-NDB4Z7K%#CD9Q#Gx4wPa*5#|GE@ zo^*!~Fi2J5zeJ{ZUS%KGiYF(EikLEx$T_0QuY?!RQrB94@6NI#Kkm* zlW%!rOM!^wF$pEpXYRvMW);yh4js}FYuh@uD+CE_xEkgDNOEg(N(z0LhcUeR!iHK0 z7x)uA&zFnH?ycJxNaPP3?(nYY|J-eWq&8My_@Fg!iVqnox`n@6Wnmj{9JBNSt|J5 ziACiLvQk!6Kk)!7ma&5GM8w!JPIqI?6*Q}1)ln~Li%42P)>cAyujh6{2W8I} zLDb8|ZM?2y##3<&wwW``#!B9Pj?tz>O-;Qa`4 zMR~~*^Fv>Wkx#rRvLG%34%6$)+|`w)aKs?9d;oTMZze5#wtqf73$L@VQs4DUfVhTi z)+^kYY~D^kSr7Zc?7M7MpzCdSn-O;dq{QN)&q^$XoTo=PdgotF*5^i^zydK5aF3 zeO3@R^ExVxnK z#NVU4ndDl;^c#fE7(CN-Ri3E%E2x4A(k540>ll;f!Shj@rMQ<1oKlh?%!;+%H?0_n z=%jDMC}aI!7IOxEi&0lB+E%m5iLbpjNmarkrY=VL_2D zNwIOhiyNP8u;B=v8Ht%0vU@A{V4w#NxdYE5Z1t+F%F$;r@#Iv8EM2V|FIY6CXsBAv zI;uw}dPXF!_&O?BB|JJF_6hYfffQjs_{xuarWIP|U6P*IAsmMC=c?p*2qgBzVgJbq ja;!8+V|Q&dk;ioIR>BI=*h0DZ2#XASFsEPq5&-`JT>R<6 literal 0 HcmV?d00001 diff --git a/assets/image/login_channel.webp b/assets/image/login_channel.webp new file mode 100644 index 0000000000000000000000000000000000000000..745dd82b9aa3eb69c30a14600a6ae60798ce9bc5 GIT binary patch literal 686 zcmWIYbaPwA#J~{l>J$(bU=hK^z`$St#KK_Y>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({cs|-bi3XTwq|}iU!L82^?-y07}UK-IWi7 z=?pmxsSFAXo(y>m$qafxmJu*g4H?XUG3>J)s8C<{0E#~ey??oGZA-l4C|l3r?|a)L=Yw|V?7BA|b`3?nyB>NxJo?st$-IYgE#hqla&vC4 zD%$rrfJt@2i&t{%HT6VDh_<$2}G0$o%fJ%hPXz9mTdlX}P!rnYbkmbLaFwc)#_ SpSQj5VJp9B-qz-MDhvQ+E1pXL literal 0 HcmV?d00001 diff --git a/assets/image/login_store.webp b/assets/image/login_store.webp new file mode 100644 index 0000000000000000000000000000000000000000..aba2ba5e22eb0c407cb0ff1fa8f90fe93737aa41 GIT binary patch literal 752 zcmWIYbaQ*b#J~{l>J$(bU=hK^z`$St#JphS>FgYEf)U7NU_1dLS%6Zxc_l?b?oJ93 zkx>fl4;UDM5DXHNiwhtutRzs?w`&l!mvynKz%R&|l3JV$RPq6cRf>R?1KlJ7WQ(Lj z*cu>q5`=97VwaZ`lmOKPfY?PLLC!#S3XrXlj>JwvVkZ|AfzZ zZ((5Ab{-*y2$O=uqC~K9EI^VeEscTU({f-WL^3c4UtnP1iU!L82^?-y07}UK-IWi7 z=?pmxsSFAXo(y>m$qafxmJu*g4H?XUG3@gbs8FBRfmvYs!47+EN;ZP$qDWD%U^qQWR(_;B)^ zTTWi5HB}lGNX@(;cq zJn2}Y&yvrVc5{CT?^zNpZLwbPmbh9(rdzG6^I>+?51kJ;FTBFkv2WR createState() { + return _LoginStoreSelect(); + } +} + +class _LoginStoreSelect extends State { + ApiService apiService; + ChannelsList channelsList; + int channelIndex = 0; + + @override + void initState() { + super.initState(); + EasyLoading.show(status: S.current.zhengzaijiazai); + queryChannels(); + } + + queryChannels() async{ + apiService = ApiService(Dio(), context: context); + BaseData baseData = await apiService.appChannels().catchError((error) { + print(error.message); + SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), + alignment: Alignment.center); + }); + if (baseData != null && baseData.isSuccess) { + channelsList = baseData.data; + setState((){}); + EasyLoading.dismiss(); + } else { + if (baseData?.msg != null) + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: MyAppBar( + title: "渠道来源", + titleColor: Colors.black, + titleSize: 18.sp, + background: Color(0xFFFFFFFF), + leadingColor: Colors.black, + ), + body: Container( + color: Color(0xFFFFFFFF), + height: double.infinity, + child: Column( + children: [ + Padding(padding:EdgeInsets.only(top:18.h,bottom:20.h,left:18.w), + child: Row( + children: [ + Image.asset( + "assets/image/login_channel.webp", + fit: BoxFit.fill, + width:24, + height:24, + ), + SizedBox(width:12.w), + Text( + "Hi,您是通过什么途径了解到这款APP的?", + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: Color(0xFF181818), + ), + ), + ], + )), + Expanded(child: ListView.builder( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + channelIndex = position; + }); + }, + child: channelItem(position), + ); + }, + itemCount:(channelsList != null && (channelsList?.channels?.length ?? 0) > 0) ? channelsList.channels.length : 0, + )), + if(channelsList != null && (channelsList.channels.length) > 0) + GestureDetector( + onTap: () { + Navigator.pop(context,channelsList.channels[channelIndex]); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + left: 16, right: 16, bottom: 21), + padding: EdgeInsets.symmetric(vertical:18.h), + child: Text( + S.of(context).queren, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ) + ], + ), + ), + ); + } + + Widget channelItem(index){ + return Container( + height:52 , + margin: EdgeInsets.only(bottom: 12,left: 14,right: 14), + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + height: 52.h, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: new BorderRadius.circular(6), + border: Border.all( + color: channelIndex == index ? Color(0xFF32A060) : Color(0xFFF7F7F7), + width: channelIndex == index ? 1 : 0, + ), + color:channelIndex == index ? Color(0xFFF0FAF4) : Color(0xFFF7F7F7), + ), + alignment: Alignment.centerLeft, + padding: EdgeInsets.only(left: 12,), + child: Text( + channelsList.channels[index], + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 14.sp, + color: channelIndex == index ? Color(0xFF32A060) : Colors.black, + ), + ), + ), + if (index == channelIndex) + Image.asset( + "assets/image/recharge.webp", + width: 20, + height: 20, + fit: BoxFit.fill, + ), + ], + ), + ); + } +} diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index a584b3eb..ad4eef5b 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -53,6 +53,7 @@ class _NewLoginPage extends State { Timer _timer; bool isShowLogin = false; String area = "+86"; + String channelName; @override void initState() { @@ -211,7 +212,8 @@ class _NewLoginPage extends State { "capcha": code, "mobile": mobile, "invite": invite, - "areaCode": area + "areaCode": area, + "regChannel":channelName ?? "" }; EasyLoading.show(status: S.of(context).zhengzaijiazai); BaseData value = await apiService.memberLogin(param).catchError((error) { @@ -592,7 +594,47 @@ class _NewLoginPage extends State { ), ), SizedBox( - height: 51.h, + height: 30.h, + ), + GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed('/router/login_store_select').then((value) => { + setState(() { + if (value != null) channelName = value; + }) + }); + }, + child:Container( + padding: EdgeInsets.only(left:12.w,right:12.w,top:16.h,bottom:16.h), + margin: EdgeInsets.only(bottom:30.h), + decoration: BoxDecoration( + color: Color(0xFFF1F1F1), + borderRadius: BorderRadius.circular(4), + ), + child: Row( + children: [ + Image.asset( + "assets/image/login_store.webp", + fit: BoxFit.fill, + width:14, + height:14, + ), + SizedBox(width: 3.w,), + Expanded(child:Text( + channelName ?? "邀请来源(选填)", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF868686), + ), + )), + Icon( + Icons.arrow_forward_ios, + size: 16, + ), + ], + ), + ), ), Row( mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/main.dart b/lib/main.dart index 7412841c..74f6fd54 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -95,6 +95,7 @@ import 'home/help_farmers/help_farmers_page.dart'; import 'home/home_view/activity_list.dart'; import 'home/welfare_exchange.dart'; import 'home/welfare_page.dart'; +import 'login/login_store_select.dart'; import 'login/new_login_page.dart'; import 'login/phone_address_page.dart'; import 'main_page.dart'; @@ -429,4 +430,6 @@ Map routers = { SystemNotice(), '/router/store_html': (context, {arguments}) => StoreHtml(arguments:arguments), + '/router/login_store_select': (context, {arguments}) => + LoginStoreSelect(), }; diff --git a/lib/retrofit/data/channels_list.dart b/lib/retrofit/data/channels_list.dart new file mode 100644 index 00000000..bf58e35b --- /dev/null +++ b/lib/retrofit/data/channels_list.dart @@ -0,0 +1,155 @@ +/// channels : ["海峡","回乡","boom"] +/// isOpen : true +/// preferentialList : [{"createTime":"2023-04-21 16:15:42","giftdMoney":"0.00","gitfdCouponId":null,"id":"1506553893994102784","isDeleted":0,"rechargeMoney":"0.01","rechargeType":0,"remark":"

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。
储值活动不与其他活动同享

","sortValue":1,"tenantCode":"admin"}] + +class ChannelsList { + ChannelsList({ + List channels, + bool isOpen, + List preferentialList,}){ + _channels = channels; + _isOpen = isOpen; + _preferentialList = preferentialList; +} + + ChannelsList.fromJson(dynamic json) { + _channels = json['channels'] != null ? json['channels'].cast() : []; + _isOpen = json['isOpen']; + if (json['preferentialList'] != null) { + _preferentialList = []; + json['preferentialList'].forEach((v) { + _preferentialList.add(PreferentialList.fromJson(v)); + }); + } + } + List _channels; + bool _isOpen; + List _preferentialList; +ChannelsList copyWith({ List channels, + bool isOpen, + List preferentialList, +}) => ChannelsList( channels: channels ?? _channels, + isOpen: isOpen ?? _isOpen, + preferentialList: preferentialList ?? _preferentialList, +); + List get channels => _channels; + bool get isOpen => _isOpen; + List get preferentialList => _preferentialList; + + Map toJson() { + final map = {}; + map['channels'] = _channels; + map['isOpen'] = _isOpen; + if (_preferentialList != null) { + map['preferentialList'] = _preferentialList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// createTime : "2023-04-21 16:15:42" +/// giftdMoney : "0.00" +/// gitfdCouponId : null +/// id : "1506553893994102784" +/// isDeleted : 0 +/// rechargeMoney : "0.01" +/// rechargeType : 0 +/// remark : "

充值说明:
平台充值根据用户在平台的会员等级享有不同的充值权益。
银卡用户享1.1倍充值会员权益,即充值100元账户110元。
金卡用户享1.2倍充值会员权益,即充值100元账户120元。
共创用户享1.3倍充值会员权益,即充值100元账户130元。
平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。
储值活动不与其他活动同享

" +/// sortValue : 1 +/// tenantCode : "admin" + +class PreferentialList { + PreferentialList({ + String createTime, + String giftdMoney, + dynamic gitfdCouponId, + String id, + num isDeleted, + String rechargeMoney, + num rechargeType, + String remark, + num sortValue, + String tenantCode,}){ + _createTime = createTime; + _giftdMoney = giftdMoney; + _gitfdCouponId = gitfdCouponId; + _id = id; + _isDeleted = isDeleted; + _rechargeMoney = rechargeMoney; + _rechargeType = rechargeType; + _remark = remark; + _sortValue = sortValue; + _tenantCode = tenantCode; +} + + PreferentialList.fromJson(dynamic json) { + _createTime = json['createTime']; + _giftdMoney = json['giftdMoney']; + _gitfdCouponId = json['gitfdCouponId']; + _id = json['id']; + _isDeleted = json['isDeleted']; + _rechargeMoney = json['rechargeMoney']; + _rechargeType = json['rechargeType']; + _remark = json['remark']; + _sortValue = json['sortValue']; + _tenantCode = json['tenantCode']; + } + String _createTime; + String _giftdMoney; + dynamic _gitfdCouponId; + String _id; + num _isDeleted; + String _rechargeMoney; + num _rechargeType; + String _remark; + num _sortValue; + String _tenantCode; +PreferentialList copyWith({ String createTime, + String giftdMoney, + dynamic gitfdCouponId, + String id, + num isDeleted, + String rechargeMoney, + num rechargeType, + String remark, + num sortValue, + String tenantCode, +}) => PreferentialList( createTime: createTime ?? _createTime, + giftdMoney: giftdMoney ?? _giftdMoney, + gitfdCouponId: gitfdCouponId ?? _gitfdCouponId, + id: id ?? _id, + isDeleted: isDeleted ?? _isDeleted, + rechargeMoney: rechargeMoney ?? _rechargeMoney, + rechargeType: rechargeType ?? _rechargeType, + remark: remark ?? _remark, + sortValue: sortValue ?? _sortValue, + tenantCode: tenantCode ?? _tenantCode, +); + String get createTime => _createTime; + String get giftdMoney => _giftdMoney; + dynamic get gitfdCouponId => _gitfdCouponId; + String get id => _id; + num get isDeleted => _isDeleted; + String get rechargeMoney => _rechargeMoney; + num get rechargeType => _rechargeType; + String get remark => _remark; + num get sortValue => _sortValue; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['createTime'] = _createTime; + map['giftdMoney'] = _giftdMoney; + map['gitfdCouponId'] = _gitfdCouponId; + map['id'] = _id; + map['isDeleted'] = _isDeleted; + map['rechargeMoney'] = _rechargeMoney; + map['rechargeType'] = _rechargeType; + map['remark'] = _remark; + map['sortValue'] = _sortValue; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index eaf2e48d..f03753ed 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -27,6 +27,7 @@ import 'data/app_update.dart'; import 'data/banner.dart'; import 'data/brand_data.dart'; import 'data/category_select_list.dart'; +import 'data/channels_list.dart'; import 'data/chapter.dart'; import 'data/collect_class_list.dart'; import 'data/coupon_detail.dart'; @@ -177,6 +178,10 @@ abstract class ApiService { @POST("/auth/platform/memberLogin") Future memberLogin(@Body() Map param); + ///获取APP门店推广渠道 + @GET("/auth/appChannels") + Future> appChannels(); + ///发送验证码 @GET("/auth/sendVerify/{areaCode}/{mobile}") Future sendVerify(@Path("areaCode") String areaCode, @Path("mobile") String mobile); diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index c9699f94..19fb1bdf 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -98,6 +98,27 @@ class _ApiService implements ApiService { return value; } + @override + Future> appChannels() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/auth/appChannels', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ChannelsList.fromJson(json), + ); + return value; + } + @override Future> sendVerify(areaCode,mobile) async { ArgumentError.checkNotNull(mobile, 'mobile');