diff --git a/lib/base_state.dart b/lib/base_state.dart index 8262544f..916e047a 100644 --- a/lib/base_state.dart +++ b/lib/base_state.dart @@ -59,8 +59,10 @@ abstract class BaseState extends State params["activityId"] = pushMap["info"]; break; case 3: - routeName = "/router/union_detail_page"; + routeName = "/router/store_order"; params["id"] = pushMap["info"]; + params["tenant"] = pushMap["tenant"]; + params["storeName"] = pushMap["storeName"]; break; case 4: routeName = "/router/integral_store_page"; diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index be23c401..2d4ce3fd 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -105,7 +105,7 @@ class _CommunityDetails extends State void _focusNodeListener() { /*if (_focusNode.hasFocus || _focusNode.consumeKeyboardToken()){ setState(() { - emojiShowing = false; + smileyPadGone = true; }); }*/ } diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index e113f7ee..f1f5e2f9 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -213,6 +213,7 @@ class _ClassDetails extends State with WidgetsBindingObserver { child: Column( children: [ Container( + height: MediaQuery.of(context).size.width / 1.5, child: Stack( children: [ ClassDetailsVideo( diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 4b7c66a2..ae5e917b 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -226,7 +226,7 @@ class _CommunityDynamic extends State { }, child: MImage( (widget?.article?.authorHeadImg ?? - "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"), + ""), width: 44, height: 44, isCircle: true, diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index 94633c35..990cb680 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -50,8 +50,7 @@ class _WelfarePage extends State { super.initState(); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token")), - queryGoods(), - queryCoupon(), + _onRefresh(), }); } @@ -108,6 +107,8 @@ class _WelfarePage extends State { "searchKey": "", "state": 0 }).catchError((onError) { + SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), + alignment: Alignment.center); refreshController.refreshFailed(); refreshController.loadFailed(); }); @@ -134,7 +135,7 @@ class _WelfarePage extends State { _onRefresh(){ queryGoods(); - // queryCoupon(); + queryCoupon(); } @@ -262,7 +263,13 @@ class _WelfarePage extends State { ), ], )), - AspectRatio( + coupon.length == 0? + NoDataView( + src: "assets/image/ka.webp", + isShowBtn: false, + text: S.of(context).haimeiyouyouhuiquankeyilingqu, + fontSize: 16.sp, + ): AspectRatio( aspectRatio: 1.10, child: Swiper( onIndexChanged: (it){ @@ -288,12 +295,11 @@ class _WelfarePage extends State { children: [ Container( child: weekList(coupon[position]), - // weekList(testList2[position]), ), ], ); }, - itemCount:coupon.length, + itemCount:coupon.length ?? 0, ), ) ], @@ -302,27 +308,30 @@ class _WelfarePage extends State { } Widget weekList(List cops){ - return Expanded(child:(cops != null && cops.length > 0)?ListView.builder( - padding: EdgeInsets.zero, - itemCount: cops.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - }, - child: weekCoupon(cops[position]), - ); - }, - ):NoDataView( + return Expanded( + child:(cops == null && cops.length == 0)? + NoDataView( src: "assets/image/ka.webp", isShowBtn: false, text: S.of(context).haimeiyouyouhuiquankeyilingqu, fontSize: 16.sp, - ),); + ):ListView.builder( + padding: EdgeInsets.zero, + itemCount: cops.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + }, + child: weekCoupon(cops[position]), + ); + }, + ),); } + ///优惠券列表 Widget weekCoupon(Coupon cop) { return Container( height: 95.h, @@ -396,6 +405,7 @@ class _WelfarePage extends State { ); } + ///优惠券样式 Widget weekWidget(Coupon cop) { if (cop.bizType == 1) { return Column( @@ -581,6 +591,7 @@ class _WelfarePage extends State { } } + ///优惠券领取状态 Widget weekBtn(Coupon cop) { if(cop.status == 0) return Align( @@ -645,6 +656,7 @@ class _WelfarePage extends State { ); } + ///领取优惠券 receiveCoupon(couponId) async { couponIndex = swiperIndex; BaseData baseData = await apiService.receiveCoupon(couponId); @@ -881,7 +893,6 @@ class _WelfarePage extends State { ); } - String pointPrice(Goods goodsPrice){ if(goodsPrice == null) return ""; diff --git a/lib/main.dart b/lib/main.dart index 99a6c6eb..236b1317 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -199,7 +199,7 @@ class MyApp extends StatelessWidget { } else if (locales[0].countryCode == "CN"){ locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); } else{ - locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'CH'); + locale = Locale.fromSubtags(languageCode: 'en', countryCode: 'US'); } return appLocale ?? locale; }, @@ -325,7 +325,7 @@ Map routers = { '/router/help_feedback_page': (context, {arguments}) => HelpFeedbackPage(), '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), - '/router/edit_remarks_page': (context, {arguments}) => EditRemarksPage(), + '/router/edit_remarks_page': (context, {arguments}) => EditRemarksPage(arguments: arguments), // '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), '/router/address_map_page': (context, {arguments}) => AddressMapPage(), '/router/roll_center_page': (context, {arguments}) => RollCenterPage(), diff --git a/lib/main_page.dart b/lib/main_page.dart index 3390b4f0..331f2662 100644 --- a/lib/main_page.dart +++ b/lib/main_page.dart @@ -297,8 +297,10 @@ class _MainPage extends State with WidgetsBindingObserver { params["activityId"] = pushMap["info"]; break; case 3: - routeName = "/router/union_detail_page"; + routeName = "/router/store_order"; params["id"] = pushMap["info"]; + params["tenant"] = pushMap["tenant"]; + params["storeName"] = pushMap["storeName"]; break; case 4: routeName = "/router/integral_store_page"; diff --git a/lib/message/system_message.dart b/lib/message/system_message.dart index d4325106..b8631255 100644 --- a/lib/message/system_message.dart +++ b/lib/message/system_message.dart @@ -28,13 +28,13 @@ class _SystemMessagePage extends State { ApiService apiService; int pageNum = 1; List messages = []; - Map msgNumber = { - "1":0, - "2":0, - "3":0, - "4":0, - "5":0, - "6":0, + Map msgNumber = { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, }; int state = 0; @@ -75,7 +75,7 @@ class _SystemMessagePage extends State { List message = []; message.addAll(baseData.data.list); message.forEach((element) { - if(element.typed==2 || element.typed==3){ + if (element.typed == 2 || element.typed == 3) { messages.add(element); } }); @@ -102,14 +102,15 @@ class _SystemMessagePage extends State { token: value.getString("token"), ); } - BaseData> baseData = await apiService.stats().catchError((onError) {}); + BaseData> baseData = + await apiService.stats().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { msgNumber.forEach((key, value) { msgNumber[key] = 0; }); baseData.data.forEach((element) { - if(msgNumber.containsKey(element.name)){ + if (msgNumber.containsKey(element.name)) { msgNumber[element.name] = element.number; } }); @@ -125,34 +126,34 @@ class _SystemMessagePage extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppBar( - background: Colors.white, - leadingColor: Colors.black, - title: S.of(context).xiaoxi, - titleSize: 18.sp, - titleColor: Colors.black, - actions: [ - Container( - margin: EdgeInsets.only(right: 16.w), - alignment: Alignment.centerRight, - child: GestureDetector( - onTap: () { - setState(() { - queryMsgStats(); - }); - }, - child: Text( - S.of(context).biaoweiyidu, - style: TextStyle( - fontSize: 16.sp, - fontWeight:MyFontWeight.semi_bold, - color: Color(0xFF353535), - ), - ), - ), - ), - ], - ), + // appBar: MyAppBar( + // background: Colors.white, + // leadingColor: Colors.black, + // title: S.of(context).xiaoxi, + // titleSize: 18.sp, + // titleColor: Colors.black, + // actions: [ + // Container( + // margin: EdgeInsets.only(right: 16.w), + // alignment: Alignment.centerRight, + // child: GestureDetector( + // onTap: () { + // setState(() { + // queryMsgStats(); + // }); + // }, + // child: Text( + // S.of(context).biaoweiyidu, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight:MyFontWeight.semi_bold, + // color: Color(0xFF353535), + // ), + // ), + // ), + // ), + // ], + // ), body: SmartRefresher( enablePullDown: true, enablePullUp: true, @@ -161,7 +162,7 @@ class _SystemMessagePage extends State { footer: CustomFooter( loadStyle: LoadStyle.ShowWhenLoading, builder: (BuildContext context, LoadStatus mode) { - return (messages.length == 0)?Container():MyFooter(mode); + return (messages.length == 0) ? Container() : MyFooter(mode); }, ), controller: _refreshController, @@ -177,262 +178,314 @@ class _SystemMessagePage extends State { child: Container( child: Column( children: [ + Container( + color: Colors.white, + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 10.h, + bottom: 15.h,right: 16.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(left: 12,), + padding: EdgeInsets.all(6), + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + size: 24, + ), + ), + ), + Spacer(), + Expanded( + child: Text( + S.of(context).xiaoxi, + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + queryMsgStats(); + }); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.w), + child: Text( + S.of(context).biaoweiyidu, + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ), newsSurvey(), - SizedBox(height: 16.h,), + SizedBox( + height: 16.h, + ), buildMessage(), ], ), ), ), ), - ), ); } - Widget newsSurvey(){ + Widget newsSurvey() { return Container( color: Colors.white, - padding: EdgeInsets.only(top: 16.h,bottom: 16.h), + padding: EdgeInsets.only(top: 16.h, bottom: 16.h), child: Row( children: [ - Expanded(child: GestureDetector( - onTap: (){ - Navigator.of(context) - .pushNamed('/router/system_details',arguments: {"msgType":5}).then((value) { - setState(() { - msgNumber["5"] = 0; + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/system_details', + arguments: {"msgType": 5}).then((value) { + setState(() { + msgNumber["5"] = 0; + }); }); - }); - }, - child:Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_z.webp", - width: 40, - height: 40, - ), - if(msgNumber["5"].toString() != "0") - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:20, - height:17, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), + }, + child: Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_z.webp", + width: 40, + height: 40, ), - child:RoundButton( - text:msgNumber["5"].toString(), - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, - ) + if (msgNumber["5"].toString() != "0") + Container( + width: 48, + alignment: Alignment.topRight, + child: Container( + width: 20, + height: 17, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color: Color(0xFFFF441A), + ), + child: RoundButton( + text: msgNumber["5"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize: 8.sp, + radius: 100, + )), + ) + ], ), - ) - ], - ), - SizedBox(height: 6.h), - Text( - S.of(context).dianzan, - style: TextStyle( - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - color: Color(0xFF060606), - ), - ) - ], - ) - ) - ), - Expanded(child: - GestureDetector( - onTap: (){ - Navigator.of(context) - .pushNamed('/router/system_details',arguments: {"msgType":6}).then((value) { - setState(() { - msgNumber["6"] = 0; - }); - }); - }, - child: Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_pl.webp", - width: 40, - height: 40, + SizedBox(height: 6.h), + Text( + S.of(context).dianzan, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF060606), ), - if(msgNumber["6"].toString() != "0") - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:16, - height:16, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), - ), - child:RoundButton( - text: msgNumber["6"].toString(), - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, - ) + ) + ], + ))), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/system_details', + arguments: {"msgType": 6}).then((value) { + setState(() { + msgNumber["6"] = 0; + }); + }); + }, + child: Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_pl.webp", + width: 40, + height: 40, ), - ) - ], - ), - SizedBox(height: 6.h), - Text( - S.of(context).pinglun, - style: TextStyle( - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - color: Color(0xFF060606), + if (msgNumber["6"].toString() != "0") + Container( + width: 48, + alignment: Alignment.topRight, + child: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color: Color(0xFFFF441A), + ), + child: RoundButton( + text: msgNumber["6"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize: 8.sp, + radius: 100, + )), + ) + ], ), - ), - ], - ) - )), - Expanded(child: - GestureDetector( - onTap: (){ - Navigator.of(context) - .pushNamed('/router/system_details',arguments: {"msgType":4}).then((value) { - setState(() { - msgNumber["4"] = 0; - }); - }); - }, - child:Column( - children: [ - Stack( - children: [ - Image.asset( - "assets/image/icon_gz.webp", - width: 40, - height: 40, + SizedBox(height: 6.h), + Text( + S.of(context).pinglun, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF060606), ), - if(msgNumber["4"].toString() != "0") - Container( - width:48, - alignment: Alignment.topRight, - child:Container( - width:16, - height:16, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - border: Border.all( - width: 1, - color: Colors.white, - style: BorderStyle.solid, - ), - color:Color(0xFFFF441A), - ), - child:RoundButton( - text: msgNumber["4"].toString(), - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:8.sp, - radius: 100, - ) + ), + ], + ))), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/system_details', + arguments: {"msgType": 4}).then((value) { + setState(() { + msgNumber["4"] = 0; + }); + }); + }, + child: Column( + children: [ + Stack( + children: [ + Image.asset( + "assets/image/icon_gz.webp", + width: 40, + height: 40, ), - ) - ], - ), - SizedBox(height: 6.h), - Text( - S.of(context).guanzhu, - style: TextStyle( - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - color: Color(0xFF060606), + if (msgNumber["4"].toString() != "0") + Container( + width: 48, + alignment: Alignment.topRight, + child: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all( + width: 1, + color: Colors.white, + style: BorderStyle.solid, + ), + color: Color(0xFFFF441A), + ), + child: RoundButton( + text: msgNumber["4"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize: 8.sp, + radius: 100, + )), + ) + ], ), - ), - ], - ) - ) - ), + SizedBox(height: 6.h), + Text( + S.of(context).guanzhu, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF060606), + ), + ), + ], + ))), ], ), ); } - Widget buildMessage(){ + Widget buildMessage() { return Container( - color: Colors.white, - width: double.infinity, + color: Colors.white, + width: double.infinity, padding: EdgeInsets.all(20.w), - child:Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - S.of(context).xitongxiaoxi, - style: TextStyle( - fontSize: 16.sp, - fontWeight:MyFontWeight.semi_bold, - color: Colors.black, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).xitongxiaoxi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), ), - ), - (messages == null || messages.length == 0) - ? NoDataView( - src: "assets/image/icon_empty.webp", - isShowBtn: false, - text: S.of(context).haimeiyouxiaoxi, - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), - ) - :ListView.builder( - padding: EdgeInsets.only(top: 16), - itemCount: messages.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - if(messages[position].typed == 2) - Navigator.of(context) - .pushNamed('/router/system_details',arguments: {"msgType":2}).then((value) { - setState(() { - msgNumber["2"] = 0; - }); - }); - else if(messages[position].typed == 3) - Navigator.of(context) - .pushNamed('/router/system_details',arguments: {"msgType":3}).then((value) { - setState(() { - msgNumber["3"] = 0; - }); - }); - }, - child: buildMessageItem(messages[position]), - ); - }), - ], - ) - ); + (messages == null || messages.length == 0) + ? NoDataView( + src: "assets/image/icon_empty.webp", + isShowBtn: false, + text: S.of(context).haimeiyouxiaoxi, + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ) + : ListView.builder( + padding: EdgeInsets.only(top: 16), + itemCount: messages.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + if (messages[position].typed == 2) + Navigator.of(context).pushNamed( + '/router/system_details', + arguments: {"msgType": 2}).then((value) { + setState(() { + msgNumber["2"] = 0; + }); + }); + else if (messages[position].typed == 3) + Navigator.of(context).pushNamed( + '/router/system_details', + arguments: {"msgType": 3}).then((value) { + setState(() { + msgNumber["3"] = 0; + }); + }); + }, + child: buildMessageItem(messages[position]), + ); + }), + ], + )); } Widget buildMessageItem(Message message) { @@ -464,26 +517,28 @@ class _SystemMessagePage extends State { (message.typed == 1) ? "assets/image/icon_system_message.webp" : (message.typed == 2) - ? "assets/image/icon_system_message.webp" - : "assets/image/c_z.webp", + ? "assets/image/icon_system_message.webp" + : "assets/image/c_z.webp", width: 40.w, height: 40.h, ), SizedBox( - width:12.w, + width: 12.w, ), - Expanded(child:Column( + Expanded( + child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ - Expanded(child:Text( + Expanded( + child: Text( (message.typed == 1) ? S.of(context).xitongtongzhi : (message.typed == 2) - ? S.of(context).dingdanxiaoxi - : S.of(context).chongzhixiaoxi, + ? S.of(context).dingdanxiaoxi + : S.of(context).chongzhixiaoxi, style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.semi_bold, @@ -499,64 +554,67 @@ class _SystemMessagePage extends State { ), ], ), - SizedBox(height:4.h,), - (message.typed != 3) ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: - Text( - S.of(context).ninyouyigexindedingdan, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), - ),), - if(msgNumber["2"].toString() != "0") - RoundButton( - width: 16, - height: 16, - text:msgNumber["2"].toString(), - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:10.sp, - radius: 100, - ), - ], - ): - Row( - mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: - Text( - message.content, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), - )), - if(msgNumber["3"].toString() != "0") - RoundButton( - width: 16, - height: 16, - text:msgNumber["3"].toString(), - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFFF441A), - fontSize:10.sp, - radius: 100, - ), - ], + SizedBox( + height: 4.h, ), + (message.typed != 3) + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + S.of(context).ninyouyigexindedingdan, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + ), + ), + if (msgNumber["2"].toString() != "0") + RoundButton( + width: 16, + height: 16, + text: msgNumber["2"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize: 10.sp, + radius: 100, + ), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + message.content, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + )), + if (msgNumber["3"].toString() != "0") + RoundButton( + width: 16, + height: 16, + text: msgNumber["3"].toString(), + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFFF441A), + fontSize: 10.sp, + radius: 100, + ), + ], + ), ], )), ], ), Container( - margin: EdgeInsets.only(top: 16.h,bottom:8.h), + margin: EdgeInsets.only(top: 16.h, bottom: 8.h), height: 1.h, width: double.infinity, color: Color(0xFFF7F7F7), diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 1889cb9e..50219753 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -296,6 +296,7 @@ class _RechargePage extends State { ), ), GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 2; @@ -328,6 +329,7 @@ class _RechargePage extends State { ), SizedBox(height:10.h), GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 3; @@ -632,7 +634,7 @@ class _RechargePage extends State { Widget checkView(var index) { return Container( - padding: EdgeInsets.only(right: 16.w), + padding: EdgeInsets.only(right: 16.w,left: 46.w), alignment: Alignment.center, child: Image.asset( checkIndex != index diff --git a/lib/order/edit_remarks_page.dart b/lib/order/edit_remarks_page.dart index f30a4f72..638e2dba 100644 --- a/lib/order/edit_remarks_page.dart +++ b/lib/order/edit_remarks_page.dart @@ -5,6 +5,9 @@ import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class EditRemarksPage extends StatefulWidget { + final Map arguments; + + EditRemarksPage({this.arguments}); @override State createState() { return _EditRemarksPage(); @@ -14,6 +17,14 @@ class EditRemarksPage extends StatefulWidget { class _EditRemarksPage extends State { TextEditingController commentTextController = TextEditingController(); + + @override + void initState() { + super.initState(); + if((widget.arguments["remake"]??"") != "") + commentTextController.text = widget.arguments["remake"]; + } + @override Widget build(BuildContext context) { return Scaffold( @@ -75,7 +86,8 @@ class _EditRemarksPage extends State { controller: commentTextController, keyboardType: TextInputType.multiline, maxLines: 10, - decoration: InputDecoration( + decoration: + InputDecoration( isDense: true, hintText: '请填写备注信息,例如:面包切一刀', hintStyle: TextStyle( @@ -97,7 +109,8 @@ class _EditRemarksPage extends State { ), GestureDetector( onTap: (){ - Navigator.pop(context,commentTextController.text); + String notes = commentTextController.text; + Navigator.pop(context,notes); }, child: Container( padding: EdgeInsets.all(16.h), diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index eb37b90a..db277842 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -34,11 +34,11 @@ class OrderDetailPage extends StatefulWidget { class _OrderDetailPage extends State { ApiService apiService; MinApiService minService; + int jumpState; @override void initState() { super.initState(); - SharedPreferences.getInstance().then((value) { apiService = ApiService( Dio(), @@ -48,6 +48,7 @@ class _OrderDetailPage extends State { ); queryDetails(); }); + jumpState = widget.arguments["jumpState"]; } /// 小程序登录 @@ -183,6 +184,7 @@ class _OrderDetailPage extends State { paySelected, _orderCancel, orderInfo, + jumpState ), ///订单商品 diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 682f1c57..84d4ac59 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -155,7 +155,7 @@ class _OrderHistoryList extends State return InkWell( onTap: () { Navigator.of(context).pushNamed('/router/order_details', - arguments: {"id": orderInfos[position].id}); + arguments: {"id": orderInfos[position].id,"jumpState":2}); }, child: orderItem(orderInfos[position]), ); @@ -469,6 +469,7 @@ class _OrderHistoryList extends State text: orderInfo.finalPayPrice, style: TextStyle( fontSize: 12.sp, + fontWeight: FontWeight.bold, color: Colors.black, ), diff --git a/lib/order/order_view/order_address.dart b/lib/order/order_view/order_address.dart index 7ff137ff..30303357 100644 --- a/lib/order/order_view/order_address.dart +++ b/lib/order/order_view/order_address.dart @@ -22,6 +22,7 @@ class OrderAddress extends StatefulWidget { final Function orderCancel; final Function() carryOnPay; final OrderInfo orderInfo; + final int jumpState; OrderAddress( this.orderStatus, @@ -33,7 +34,8 @@ class OrderAddress extends StatefulWidget { this.center, this.carryOnPay, this.orderCancel, - this.orderInfo,); + this.orderInfo, + this.jumpState); @override State createState() { @@ -271,14 +273,18 @@ class _OrderAddress extends State { widget.orderInfo.storeVO.storeName, ); } else { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": widget.orderInfo.storeVO.id, - "tenant": widget.orderInfo.tenantCode, - "storeName": widget.orderInfo.storeVO.storeName - }, - ); + if(widget.jumpState == 1){ + Navigator.of(context).pop(); + }else if(widget.jumpState == 2){ + Navigator.of(context).popAndPushNamed( + '/router/store_order', + arguments: { + "id": widget.orderInfo.storeVO.id, + "tenant": widget.orderInfo.tenantCode, + "storeName": widget.orderInfo.storeVO.storeName + }, + ); + } } } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 830c108f..c6f656fd 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -698,6 +698,7 @@ class _Settlement extends State { '/router/order_details', arguments: { "id": orderId, + "jumpState":1, }, ); // Navigator.of(context).pop(); @@ -771,7 +772,7 @@ class _Settlement extends State { payChannel, tableId ?? 0); }, queryAddress, storeInfo, address, - selectedAddress, pageType), + selectedAddress, pageType,widget.arguments["distance"]), SizedBox( height: 16, @@ -810,7 +811,7 @@ class _Settlement extends State { () { Navigator.of(context).pushNamed( '/router/edit_remarks_page', - arguments: {}, + arguments: {"remake":remakers} ).then((value) => { setState(() { if (value != null) remakers = value; diff --git a/lib/settlement/settlement_view/distribution.dart b/lib/settlement/settlement_view/distribution.dart index 2abd5a15..e9c2179a 100644 --- a/lib/settlement/settlement_view/distribution.dart +++ b/lib/settlement/settlement_view/distribution.dart @@ -26,9 +26,10 @@ class DistributionMode extends StatefulWidget { final StoreInfo storeInfo; final Address address; final String pageType; + final double distance; DistributionMode(this.queryOrderInfo, this.queryAddress, this.storeInfo, - this.address, this.selectedNewAddress, this.pageType); + this.address, this.selectedNewAddress, this.pageType, this.distance); @override State createState() { @@ -56,7 +57,7 @@ class _DistributionMode extends State { ///定位获取当前的位置 void startLocation() async { - Location.getInstance().startLocation(context, (BaiduLocation result){ + Location.getInstance().startLocation(context, (BaiduLocation result) { if (result != null && result.latitude != null && result.longitude != null) { @@ -261,11 +262,21 @@ class _DistributionMode extends State { Column( children: [ RoundButton( - // width: 41.w, height: 13, text: distance.length > 3 - ? "${distance}km" - : "距离您${distance}km", + ? ((widget.distance ?? 0) > 1000 + ? "${((widget.distance ?? 0) / 1000 * 100).toInt() / 100.0}km" + : S.of(context).mi( + ((widget.distance ?? 0) * + 100) + .toInt() / + 100.0)) + : "距离您${(widget.distance ?? 0) > 1000 ? + "${((widget.distance ?? 0) / 1000 * 100).toInt() / 100.0}km" + : S.of(context).mi(((widget.distance ?? 0) * 100).toInt() / 100.0)}", + // distance.length > 3 + // ? "${distance}km" + // : "距离您${distance}km", textColor: Color(0xFF34A262), fontWeight: MyFontWeight.semi_bold, radius: 7.5, @@ -310,16 +321,17 @@ class _DistributionMode extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - (widget.storeInfo.storeName == "一心回乡商城") ? - Icon( - Icons.local_shipping, - color: Color(0xFF727272), - size: 24, - ):Image.asset( - "assets/image/icon_permission_location.webp", - height: 24.h, - width: 24.w, - ), + (widget.storeInfo.storeName == "一心回乡商城") + ? Icon( + Icons.local_shipping, + color: Color(0xFF727272), + size: 24, + ) + : Image.asset( + "assets/image/icon_permission_location.webp", + height: 24.h, + width: 24.w, + ), SizedBox(width: 5), Text( widget?.address?.username ?? "", diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index 65a11ec1..d947eef9 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -90,6 +90,7 @@ class _PayMethod extends State { ), if(!(widget.settleOrderInfo?.isRaise ?? false)) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 1; @@ -134,6 +135,7 @@ class _PayMethod extends State { ), if(!(widget.settleOrderInfo?.isRaise ?? false)) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 2; @@ -178,6 +180,7 @@ class _PayMethod extends State { ), if(mGreenMoney!="0.00" && !(widget.settleOrderInfo?.isRaise ?? false)) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 3; @@ -231,6 +234,7 @@ class _PayMethod extends State { ), if(mRaiseMoney!="0" && (widget.settleOrderInfo?.isRaise ?? false)) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 4; @@ -284,6 +288,7 @@ class _PayMethod extends State { ), if(!(widget.settleOrderInfo?.isRaise ?? false)) GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { setState(() { checkIndex = 5; @@ -320,7 +325,7 @@ class _PayMethod extends State { Widget checkView(var index) { return Container( - padding: EdgeInsets.only(right: 16.w), + padding: EdgeInsets.only(right:36.w), alignment: Alignment.center, child: Image.asset( checkIndex != index diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index d857f643..305216f7 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -65,6 +65,7 @@ class _ShopDetailsPage extends State { String storeId; String parentId; int numberOfPeople = 0; + int index; @override void initState() { @@ -91,7 +92,6 @@ class _ShopDetailsPage extends State { buildCount(); } - /// 查询店铺信息 queryStoreInfo() async { SharedPreferences value = await SharedPreferences.getInstance(); @@ -152,7 +152,6 @@ class _ShopDetailsPage extends State { }); } - ///商品详情 queryMiNiDetail(id) async { BaseData baseData = @@ -938,10 +937,8 @@ class _ShopDetailsPage extends State { child: Container( margin: EdgeInsets.only(left: 16, top: 52), padding: EdgeInsets.all(5), - child: Icon( - Icons.arrow_back_ios, - size: 24, - color: Color(0xFF353535), + child: Image.asset( + "assets/image/integral_return.webp", ), ), ), @@ -959,205 +956,199 @@ class _ShopDetailsPage extends State { context, state, ) { - return WillPopScope( - onWillPop: () async => false, - child:Container( - alignment: Alignment.topCenter, - padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 16), - height: MediaQuery.of(context).size.height / 3 * 2, - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( + return Container( + alignment: Alignment.topCenter, + padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 16), + height: MediaQuery.of(context).size.height / 3 * 2, + width: double.infinity, + decoration: BoxDecoration( + color: Color(0xFFFAFAFA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ClipRRect( - child: MImage( - miNiDetail.imgs[0], - fit: BoxFit.cover, - width: 70, - height: 70, - errorSrc: "assets/image/default_2_1.webp", - fadeSrc: "assets/image/default_2_1.webp", - ), - borderRadius: BorderRadius.circular(4), - ), - SizedBox( - width: 10.w, - ), - Expanded( - child: Container( - height: 70, - child: Column( + ClipRRect( + child: MImage( + miNiDetail.imgs[0], + fit: BoxFit.cover, + width: 70, + height: 70, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + borderRadius: BorderRadius.circular(4), + ), + SizedBox( + width: 10.w, + ), + Expanded( + child: Container( + 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, ), ), ], ), - )), - ], - ), - if (miNiDetail.attrList != null && - miNiDetail.attrList.length > 0) - SizedBox( - height: 10, - ), - if (miNiDetail.attrList != null && - miNiDetail.attrList.length > 0) - Expanded( - child: ListView.builder( - itemCount: miNiDetail.attrList.length, - scrollDirection: Axis.vertical, - physics: BouncingScrollPhysics(), - padding: EdgeInsets.zero, - itemBuilder: (context, position) { - return attrItem( - (attrValue) { - state(() { - // if(selectSkus.length > position) - selectSkus[position] = attrValue; - buildCount(); - }); - }, - miNiDetail.attrList[position], - position, - ); + Text( + "¥${miNiDetail?.price ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.bold, + color: Color(0xFFF65720), + ), + ), + ], + ), + )), + ], + ), + if (miNiDetail.attrList != null && + miNiDetail.attrList.length > 0) + SizedBox( + height: 10, + ), + if (miNiDetail.attrList != null && + miNiDetail.attrList.length > 0) + Expanded( + child: ListView.builder( + itemCount: miNiDetail.attrList.length, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.zero, + itemBuilder: (context, position) { + return attrItem( + (attrValue) { + state(() { + // if(selectSkus.length > position) + selectSkus[position] = attrValue; + buildCount(); + }); }, - ), + miNiDetail.attrList[position], + position, + ); + }, + ), + ), + SizedBox( + height: 24, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "数量", + style: TextStyle( + color: Color(0xFFB3B3B3), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, ), + ), SizedBox( - height: 24, + height: 10, ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + Row( children: [ - Text( - "数量", - style: TextStyle( - color: Color(0xFFB3B3B3), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - SizedBox( - height: 10, - ), - Row( - children: [ - InkWell( - onTap: () { - state(() { - if (counts > 1) - setState(() { - counts -= 1; - }); - reduce(miNiDetail, selectSkus); + InkWell( + onTap: () { + state(() { + if (counts > 1) + setState(() { + counts -= 1; }); - }, - child: Icon( - Icons.remove, - color: Color(0xFF32A060), - size: 24, - ) - // Image.asset( - // "assets/image/reduce.webp", - // width: 22, - // height: 22, - // ), - ), - Padding( - padding: EdgeInsets.only(left: 8, right: 8), - child: Text( - "$counts", - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - ), - ), + // reduce(miNiDetail, selectSkus); + }); + }, + child: Icon( + Icons.remove, + color: Color(0xFF32A060), + size: 24, + ) + ), + Padding( + padding: EdgeInsets.only(left: 8, right: 8), + child: Text( + "$counts", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, ), - InkWell( - onTap: () { - state(() { - counts += 1; - add(miNiDetail, selectSkus); - }); - }, - child: Icon( - Icons.add, - color: Color(0xFF32A060), - size: 24, - )), - ], - ) + ), + ), + InkWell( + onTap: () { + state(() { + counts += 1; + // add(miNiDetail, selectSkus); + }); + }, + child: Icon( + Icons.add, + color: Color(0xFF32A060), + size: 24, + )), ], - ), - SizedBox( - height: 24, - ), - RoundButton( - width: double.infinity, - height: 54.h, - text: "加入购物车", - textColor: Colors.white, - fontWeight: MyFontWeight.semi_bold, - radius: 27, - backgroup: Color(0xFF32A060), - fontSize: 16.sp, - callback: () { - state(() { - _addShopCar(miNiDetail, selectSkus, counts); - Navigator.of(context).pop(); - }); - }, - ), + ) ], ), - )); + SizedBox( + height: 24, + ), + RoundButton( + width: double.infinity, + height: 54.h, + text: "加入购物车", + textColor: Colors.white, + fontWeight: MyFontWeight.semi_bold, + radius: 27, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + callback: () { + state(() { + _addShopCar(miNiDetail, selectSkus, counts); + counts = 1; + Navigator.of(context).pop(); + }); + }, + ), + ], + ), + ); }); }, backgroundColor: Colors.transparent, diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index eb9d9849..5491a73b 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, @@ -649,6 +649,7 @@ class _StoreOrderPage extends State "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, + "distance":widget.arguments["distance"], }, ); if (tableId > 0) { @@ -737,15 +738,16 @@ class _StoreOrderPage extends State _queryMiNiDetail(String id, int count) async { EasyLoading.show(status: S.current.zhengzaijiazai); if (count < 0) { - shopCarGoods.shoppingCartSkuItemList.forEach((element) { + shopCarGoods.shoppingCartSkuItemList.forEach((element) async{ if (element.productId == id) { - shopCartReduce(element); + await shopCartReduce(element); setState(() {}); } }); return; } BaseData baseData = await minService.miNiDetail(id); + EasyLoading.dismiss(); if (baseData != null && baseData.isSuccess) { showStoreSelector(baseData.data, id, count); } @@ -758,20 +760,19 @@ class _StoreOrderPage extends State } else { EasyLoading.dismiss(); dialogShowing = true; - SmartDialog.show( - widget: ProductSku( - miNiDetail, - shopCarGoods, - id, - _addShopCar, - add, - reduce, - ), - onDismiss: () { - dialogShowing = false; - }, - alignmentTemp: Alignment.bottomCenter, - ); + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + builder: (_) { + return ProductSku( + miNiDetail, + shopCarGoods, + id, + _addShopCar, + add, + reduce, + ); + }); } } @@ -822,12 +823,10 @@ class _StoreOrderPage extends State }, ], }); - EasyLoading.dismiss(); + // EasyLoading.dismiss(); if (baseDate != null && baseDate.isSuccess) { - queryShopCar().then((value) { - this.shopCarGoods = value; - setState(() {}); - }); + this.shopCarGoods = await queryShopCar(); + setState(() {}); } else { SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); } @@ -917,7 +916,7 @@ class _StoreOrderPage extends State if (productSku == null) return; String skuId = productSku.id; if (shopCarGoods == null) { - await _addShopCar(miNiDetail, selectSkus, 2); + await _addShopCar(miNiDetail, selectSkus, 1); return; } int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList @@ -932,17 +931,16 @@ class _StoreOrderPage extends State .firstWhere((element) => skuId == element.id); shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; } else { - await _addShopCar(miNiDetail, selectSkus, 2); + await _addShopCar(miNiDetail, selectSkus, 1); return; } BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { - queryShopCar().then((value) { - this.shopCarGoods = value; - setState(() {}); - }); + this.shopCarGoods = await queryShopCar(); + debugPrint("count.toString()"); + setState(() {}); } } @@ -956,7 +954,7 @@ class _StoreOrderPage extends State if (productSku == null) return; String skuId = productSku.id; if (shopCarGoods == null) { - await _addShopCar(miNiDetail, selectSkus, 2); + await _addShopCar(miNiDetail, selectSkus, 1); return; } ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods @@ -970,7 +968,7 @@ class _StoreOrderPage extends State shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; } } else { - await _addShopCar(miNiDetail, selectSkus, 2); + await _addShopCar(miNiDetail, selectSkus, 1); return; } shopCarGoods.tableId = "$tableId"; diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 72d8ee88..525be6ce 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -9,24 +10,18 @@ import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; class ProductSku extends StatefulWidget { - final MiNiDetail miNiDetail; final String productId; - final Function(MiNiDetail miNiDetail, List selectSkus, int count) addShopCar; + final Function(MiNiDetail miNiDetail, List selectSkus, int count) + addShopCar; final Function(MiNiDetail miNiDetail, List selectSkus) add; final Function(MiNiDetail miNiDetail, List selectSkus) reduce; final ShoppingCart shopCarGoods; - final int buttonType; + final int buttonType; - ProductSku( - this.miNiDetail, - this.shopCarGoods, - this.productId, - this.addShopCar, - this.add, - this.reduce, - { this.buttonType} - ); + ProductSku(this.miNiDetail, this.shopCarGoods, this.productId, + this.addShopCar, this.add, this.reduce, + {this.buttonType}); @override State createState() { @@ -36,8 +31,9 @@ class ProductSku extends StatefulWidget { class _ProductSku extends State { List selectSkus = []; - int count = 1; + int count = 1, realCount = 0; String selectedPrice = ""; + bool _isTapEd = false; @override void initState() { @@ -57,16 +53,19 @@ class _ProductSku extends State { productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { return skuY(element, selectSkus); }); - }catch(ex){ + } catch (ex) { return; } if (productSku == null) return; selectedPrice = productSku.skuPrice; String skuId = productSku.id; - if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; - int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); + if (widget.shopCarGoods == null || + widget.shopCarGoods.shoppingCartSkuItemList == null) return; + int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList + .indexWhere((element) => skuId == element.id); if (shopSkuIndex >= 0) { count = widget.shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum; + realCount = count; } } @@ -81,19 +80,19 @@ class _ProductSku extends State { return gg; } - @override Widget build(BuildContext context) { return WillPopScope( onWillPop: () async { - debugPrint("ssssasdadsasdadasd"); - SmartDialog.dismiss(); + // debugPrint("ssssasdadsasdadasd"); + // SmartDialog.dismiss(); + Navigator.of(context).pop(); return true; }, child: StatefulBuilder(builder: (context1, 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( @@ -124,7 +123,8 @@ class _ProductSku extends State { SizedBox( width: 10, ), - Expanded(child:Column( + Expanded( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -136,12 +136,15 @@ class _ProductSku extends State { fontWeight: MyFontWeight.medium, ), ), - if(widget.miNiDetail.attrList[0].attrName!="") + if (widget.miNiDetail.attrList[0].attrName != "") Padding( padding: EdgeInsets.only(top: 4, bottom: 7), child: Text( "已选: " + - (selectSkus.map((e) => "$e").toList().toString()), + (selectSkus + .map((e) => "$e") + .toList() + .toString()), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -175,8 +178,8 @@ class _ProductSku extends State { )), InkWell( onTap: () { - // Navigator.of(context).pop(); - SmartDialog.dismiss(); + Navigator.of(context).pop(); + // SmartDialog.dismiss(); }, child: Image.asset( "assets/image/cancel.webp", @@ -187,11 +190,14 @@ class _ProductSku extends State { ), ], ), - if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0) + if (widget.miNiDetail.attrList != null && + widget.miNiDetail.attrList.length > 0) SizedBox( - height:10, + height: 10, ), - if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0 && widget.miNiDetail.attrList[0].attrName!="") + if (widget.miNiDetail.attrList != null && + widget.miNiDetail.attrList.length > 0 && + widget.miNiDetail.attrList[0].attrName != "") Expanded( child: ListView.builder( itemCount: widget.miNiDetail.attrList.length, @@ -200,7 +206,7 @@ class _ProductSku extends State { padding: EdgeInsets.zero, itemBuilder: (context, position) { return attrItem( - (attrValue) { + (attrValue) { state(() { selectSkus[position] = attrValue; buildCount(); @@ -212,8 +218,8 @@ class _ProductSku extends State { }, ), ), - if (widget.miNiDetail.attrList[0].attrName=="") - Expanded(child: Container()), + if (widget.miNiDetail.attrList[0].attrName == "") + Expanded(child: Container()), SizedBox( height: 24, ), @@ -231,12 +237,15 @@ class _ProductSku extends State { ), ), InkWell( - onTap: () { - if (count > 1) - setState(() { - count -= 1; - }); - widget.reduce(widget.miNiDetail, selectSkus); + onTap: () async { + if(count == 1) + return; + _isTapEd = true; + EasyLoading.show(status: S.current.zhengzaijiazai); + await widget.reduce(widget.miNiDetail, selectSkus); + count -= 1; + setState(() {}); + EasyLoading.dismiss(); }, child: Image.asset( "assets/image/reduce.webp", @@ -256,11 +265,17 @@ class _ProductSku extends State { ), ), InkWell( - onTap: () { - setState(() { - count += 1; - }); - widget.add(widget.miNiDetail, selectSkus); + onTap: () async { + _isTapEd = true; + EasyLoading.show(status: S.current.zhengzaijiazai); + if (count == 1 && realCount == 0) + await widget.addShopCar( + widget.miNiDetail, selectSkus, 2); + else + await widget.add(widget.miNiDetail, selectSkus); + count += 1; + setState(() {}); + EasyLoading.dismiss(); }, child: Image.asset( "assets/image/add.webp", @@ -273,7 +288,7 @@ class _ProductSku extends State { SizedBox( height: 24, ), - if(widget.buttonType != 1) + if (widget.buttonType != 1) RoundButton( width: double.infinity, height: 54.h, @@ -284,12 +299,13 @@ class _ProductSku extends State { backgroup: Color(0xFF32A060), fontSize: 16.sp, callback: () { - // Navigator.of(context).pop(); - SmartDialog.dismiss(); - widget.addShopCar(widget.miNiDetail, selectSkus, 1); + Navigator.of(context).pop(); + // SmartDialog.dismiss(); + if (!_isTapEd) + widget.addShopCar(widget.miNiDetail, selectSkus, 1); }, ), - if(widget.buttonType == 1) + if (widget.buttonType == 1) RoundButton( width: double.infinity, height: 54.h, @@ -300,72 +316,21 @@ class _ProductSku extends State { backgroup: Color(0xFF32A060), fontSize: 16.sp, callback: () { - // Navigator.of(context).pop(); - SmartDialog.dismiss(); - widget.addShopCar(widget.miNiDetail, selectSkus,count); + Navigator.of(context).pop(); + // SmartDialog.dismiss(); + widget.addShopCar(widget.miNiDetail, selectSkus, count); }, ), + ///秒杀按钮 - if(widget.buttonType == 2) + if (widget.buttonType == 2) Row( children: [ - Expanded(child: GestureDetector( - onTap: (){ - Navigator.of(context).pushReplacementNamed('/router/group_details'); - }, - child: Container( - alignment: Alignment.center, - width: 120.w, - height:40.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all( - width: 1, - color: Color(0xFF32A060), - style: BorderStyle.solid, - ), - ), - child: Column( - children: [ - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "¥", - style: TextStyle( - fontSize: 7.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), - ), - TextSpan( - text: "284.00", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), - ), - ], - ), - ), - Expanded(child: - Text( - "原价购买", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), - )), - ], - ), - ), - ),), - Expanded(child: GestureDetector( - onTap: (){ - Navigator.of(context).popAndPushNamed('/router/bargain_details'); + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .pushReplacementNamed('/router/group_details'); }, child: Container( alignment: Alignment.center, @@ -373,16 +338,12 @@ class _ProductSku extends State { height: 40.h, margin: EdgeInsets.only(left: 6.w), decoration: BoxDecoration( - color: Color(0xFF32A060), borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), ), child: Column( children: [ @@ -394,7 +355,7 @@ class _ProductSku extends State { style: TextStyle( fontSize: 7.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), TextSpan( @@ -402,89 +363,99 @@ class _ProductSku extends State { style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), ], ), ), - Expanded(child: - Text( - "我要砍价", + Expanded( + child: Text( + "原价购买", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), - ),), + )), ], ), - )),), - - - ], - ), - ///砍价 - if(widget.buttonType == 3) - Row( - children: [ - Expanded(child:GestureDetector( - onTap: (){ - Navigator.of(context).popAndPushNamed('/router/group_details'); - }, - child: Container( - alignment: Alignment.center, - width: 120.w, - height:40.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all( - width: 1, - color: Color(0xFF32A060), - style: BorderStyle.solid, - ), ), - child: Column( - children: [ - Text.rich( - TextSpan( - children: [ + ), + ), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( TextSpan( - text: "¥", - style: TextStyle( - fontSize: 7.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], ), - TextSpan( - text: "284.00", + ), + Expanded( + child: Text( + "我要砍价", style: TextStyle( - fontSize: 10.sp, + fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + color: Colors.white, ), ), - ], - ), + ), + ], ), - Expanded(child: - Text( - "原价购买", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), - )), - ], - ), - ), - ),), - Expanded(child:GestureDetector( - onTap: (){ - Navigator.of(context).popAndPushNamed('/router/bargain_details'); + )), + ), + ], + ), + + ///砍价 + if (widget.buttonType == 3) + Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .popAndPushNamed('/router/group_details'); }, child: Container( alignment: Alignment.center, @@ -492,16 +463,12 @@ class _ProductSku extends State { height: 40.h, margin: EdgeInsets.only(left: 6.w), decoration: BoxDecoration( - color: Color(0xFF32A060), borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), ), child: Column( children: [ @@ -513,7 +480,7 @@ class _ProductSku extends State { style: TextStyle( fontSize: 7.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), TextSpan( @@ -521,87 +488,99 @@ class _ProductSku extends State { style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), ], ), ), - Expanded(child: - Text( - "我要秒杀", + Expanded( + child: Text( + "原价购买", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), - ),), + )), ], ), - )),), - ], - ), - ///拼团按钮 - if(widget.buttonType == 4) - Row( - children: [ - Expanded(child: GestureDetector( - onTap: (){ - Navigator.of(context).popAndPushNamed('/router/group_details'); - }, - child: Container( - alignment: Alignment.center, - width: 120.w, - height:40.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all( - width: 1, - color: Color(0xFF32A060), - style: BorderStyle.solid, ), ), - child: Column( - children: [ - Text.rich( - TextSpan( + ), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( children: [ - TextSpan( - text: "¥", - style: TextStyle( - fontSize: 7.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], ), ), - TextSpan( - text: "284.00", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + Expanded( + child: Text( + "我要秒杀", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), ), ), ], ), - ), - Expanded(child: - Text( - "单人购买", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), )), - ], - ), ), - )), - Expanded(child:GestureDetector( - onTap: (){ - Navigator.of(context).popAndPushNamed('/router/bargain_details'); + ], + ), + + ///拼团按钮 + if (widget.buttonType == 4) + Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .popAndPushNamed('/router/group_details'); }, child: Container( alignment: Alignment.center, @@ -609,16 +588,12 @@ class _ProductSku extends State { height: 40.h, margin: EdgeInsets.only(left: 6.w), decoration: BoxDecoration( - color: Color(0xFF32A060), borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), ), child: Column( children: [ @@ -630,7 +605,7 @@ class _ProductSku extends State { style: TextStyle( fontSize: 7.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), TextSpan( @@ -638,26 +613,88 @@ class _ProductSku extends State { style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), ), ], ), ), - Expanded(child: - Text( - "我要开团", + Expanded( + child: Text( + "单人购买", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Colors.white, + color: Color(0xFF32A060), ), - ),), + )), ], ), - )),), - ], - ), + ), + )), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context) + .popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Text( + "我要开团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ], + ), + )), + ), + ], + ), SizedBox( height: 21.h, ), @@ -669,7 +706,8 @@ class _ProductSku extends State { } Widget attrItem(Function fc, AttrListBean attrListBean, position) { - if (attrListBean.attrValueList != null && attrListBean.attrValueList.length > 0) + if (attrListBean.attrValueList != null && + attrListBean.attrValueList.length > 0) return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -684,7 +722,7 @@ class _ProductSku extends State { ), ), ), - sweetnessStore(fc,attrListBean.attrValueList, position), + sweetnessStore(fc, attrListBean.attrValueList, position), // sweetnessStore(fc, attrListBean.attrValueList, position), ], ); @@ -723,16 +761,17 @@ class _ProductSku extends State { // ); // } - Widget sweetnessStore(Function fc,List arrays, position){ + Widget sweetnessStore(Function fc, List arrays, position) { return Wrap( runSpacing: 10.0, spacing: 10.0, - children: arrays.take(arrays.length).map((AttrValueListBean tag) { + children: + arrays.take(arrays.length).map((AttrValueListBean tag) { return GestureDetector( onTap: () { fc(tag.attrValue); }, - child:sweetnessItem( + child: sweetnessItem( tag.attrValue, (tag.attrValue == selectSkus[position]) ?? false, )); @@ -741,27 +780,26 @@ class _ProductSku extends State { Widget sweetnessItem(String name, bool isCheck) { return Container( - padding: const EdgeInsets.symmetric(vertical:5.0,horizontal: 12.0), - decoration: BoxDecoration( - color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4), - border: Border.all( - width: !isCheck ? 0:1, - color: !isCheck ? Color(0xFFF2F2F2):Color(0xFF32A060), - style: BorderStyle.solid, - ), - borderRadius: const BorderRadius.all( - Radius.circular(4.0), - ), - ), - child: Text( - name, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color:!isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 12.0), + decoration: BoxDecoration( + color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4), + border: Border.all( + width: !isCheck ? 0 : 1, + color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFF32A060), + style: BorderStyle.solid, + ), + borderRadius: const BorderRadius.all( + Radius.circular(4.0), + ), ), - )); + child: Text( + name, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: !isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )); } - } diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index c433a4bc..976dfa9b 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -94,10 +94,10 @@ class _ShopGoods extends State { Widget build(BuildContext context) { return Container( color: Colors.white, - padding: EdgeInsets.only( - right: 16.w, - // bottom: 20.h, - ), + // padding: EdgeInsets.only( + // right: 16.w, + // // bottom: 20.h, + // ), height: 123.h, child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -125,7 +125,8 @@ class _ShopGoods extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + Padding(padding: EdgeInsets.only(right: 16.w), + child: Row( children: [ Expanded( child: Text( @@ -156,11 +157,12 @@ class _ShopGoods extends State { // ), // ), ], - ), + ),), SizedBox( height: 2.h, ), - Row( + Padding(padding: EdgeInsets.only(right: 16.w), + child: Row( children: [ Expanded( child: Text( @@ -180,11 +182,12 @@ class _ShopGoods extends State { width: 10, ), ], - ), + )), SizedBox( height: 7.h, ), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ @@ -219,35 +222,38 @@ class _ShopGoods extends State { // ), ], ), - Spacer(), if (!widget.isShopCart && (widget.productListBean?.attrStyle ?? 0) == 1) - Stack( + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async{ + if(widget.storeInfo.posType.code == "NORMALSTORE"&& widget.tableId == 0){ + showDeleteDialog(); + }else{ + widget.queryMiNiDetail( + widget.productListBean != null + ? widget.productListBean.id + : widget.shoppingCartSkuItemListBean + .productId, + 0); + } + }, + child:Container( + padding: EdgeInsets.only(right: 16.w), + child: Stack( children: [ - Container( - margin: EdgeInsets.only(right: 8, top: 4), - child: RoundButton( - // width: 49.w, - text: S.of(context).xuanguige, - textColor: Colors.white, - fontWeight: MyFontWeight.medium, - radius: 3, - backgroup: Color(0xFF32A060), - fontSize: 11.sp, - padding: EdgeInsets.symmetric(vertical: 5.h,horizontal: 3.w), - callback: () { - if(widget.storeInfo.posType.code == "NORMALSTORE"&& widget.tableId == 0){ - showDeleteDialog(); - }else{ - widget.queryMiNiDetail( - widget.productListBean != null - ? widget.productListBean.id - : widget.shoppingCartSkuItemListBean - .productId, - 0); - } - }, - ), + 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, @@ -266,26 +272,32 @@ class _ShopGoods extends State { ), ), ], - ), + ),)), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) - InkWell( - onTap: () { - if(widget.storeInfo.posType.code == "NORMALSTORE" && widget.tableId == 0){ - showDeleteDialog(); - }else{ - widget.reduce(widget.shoppingCartSkuItemListBean);} - }, - child: Image.asset( - "assets/image/reduce.webp", - width: 22, - height: 22.h, + Spacer(), + 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{ + widget.reduce(widget.shoppingCartSkuItemListBean);} + }, + child: Container( + padding: EdgeInsets.only(left: 15.w,right: 6.w), + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22.h, + ), ), ), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) Container( - width: 30, alignment: Alignment.center, child: Text( "${widget.count}", @@ -298,31 +310,35 @@ class _ShopGoods extends State { ), if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0) - GestureDetector( - 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(); + 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: Image.asset( + }, + child: Container( + padding: EdgeInsets.only(left: 6.w,right:16.w), + child: Image.asset( "assets/image/add.webp", width: 22, height: 22.h, ), ), + ), ], ), SizedBox( diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index 0260d7de..ee005ff7 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -87,7 +87,8 @@ class _UnionList extends State { arguments: { "id": widget.storeList[position].id, "tenant": widget.storeList[position].tenantCode, - "storeName": widget.storeList[position].storeName + "storeName": widget.storeList[position].storeName, + "distance":widget.storeList[position].distance }, ); } diff --git a/lib/view_widget/activity_poster.dart b/lib/view_widget/activity_poster.dart index 66141e50..45b0b334 100644 --- a/lib/view_widget/activity_poster.dart +++ b/lib/view_widget/activity_poster.dart @@ -22,7 +22,9 @@ class ActivityPoster extends StatefulWidget { class _ActivityPoster extends State { @override Widget build(BuildContext context) { - return Container( + return WillPopScope( + onWillPop: () async => false, + child:Container( width: double.infinity, alignment: Alignment.center, margin: EdgeInsets.only( @@ -69,7 +71,7 @@ class _ActivityPoster extends State { ) ) ], ), - ); + )); } /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程)