diff --git a/assets/image/2x/bill_gl.webp b/assets/image/2x/bill_gl.webp index 4e18de77..6a0a2383 100644 Binary files a/assets/image/2x/bill_gl.webp and b/assets/image/2x/bill_gl.webp differ diff --git a/assets/image/2x/fa_bu.webp b/assets/image/2x/fa_bu.webp new file mode 100644 index 00000000..b084a8a3 Binary files /dev/null and b/assets/image/2x/fa_bu.webp differ diff --git a/assets/image/2x/mine_evaluation.webp b/assets/image/2x/mine_evaluation.webp new file mode 100644 index 00000000..b6969dd9 Binary files /dev/null and b/assets/image/2x/mine_evaluation.webp differ diff --git a/assets/image/2x/shop_yue.webp b/assets/image/2x/shop_yue.webp index 3e4c8caf..e8830ccb 100644 Binary files a/assets/image/2x/shop_yue.webp and b/assets/image/2x/shop_yue.webp differ diff --git a/assets/image/2x/shopping_bag.webp b/assets/image/2x/shopping_bag.webp new file mode 100644 index 00000000..f24b661c Binary files /dev/null and b/assets/image/2x/shopping_bag.webp differ diff --git a/assets/image/3x/bill_gl.webp b/assets/image/3x/bill_gl.webp index bad507f5..e3cba16d 100644 Binary files a/assets/image/3x/bill_gl.webp and b/assets/image/3x/bill_gl.webp differ diff --git a/assets/image/3x/fa_bu.webp b/assets/image/3x/fa_bu.webp new file mode 100644 index 00000000..5bb2f9f6 Binary files /dev/null and b/assets/image/3x/fa_bu.webp differ diff --git a/assets/image/3x/mine_evaluation.webp b/assets/image/3x/mine_evaluation.webp new file mode 100644 index 00000000..115f0282 Binary files /dev/null and b/assets/image/3x/mine_evaluation.webp differ diff --git a/assets/image/3x/shop_yue.webp b/assets/image/3x/shop_yue.webp index 491ea6ca..94c962fa 100644 Binary files a/assets/image/3x/shop_yue.webp and b/assets/image/3x/shop_yue.webp differ diff --git a/assets/image/3x/shopping_bag.webp b/assets/image/3x/shopping_bag.webp new file mode 100644 index 00000000..c064421e Binary files /dev/null and b/assets/image/3x/shopping_bag.webp differ diff --git a/assets/image/bill_gl.webp b/assets/image/bill_gl.webp index 35826336..b25f7673 100644 Binary files a/assets/image/bill_gl.webp and b/assets/image/bill_gl.webp differ diff --git a/assets/image/fa_bu.webp b/assets/image/fa_bu.webp new file mode 100644 index 00000000..f1102978 Binary files /dev/null and b/assets/image/fa_bu.webp differ diff --git a/assets/image/mine_evaluation.webp b/assets/image/mine_evaluation.webp new file mode 100644 index 00000000..35e27609 Binary files /dev/null and b/assets/image/mine_evaluation.webp differ diff --git a/assets/image/shop_yue.webp b/assets/image/shop_yue.webp index 7750a1de..df4c2850 100644 Binary files a/assets/image/shop_yue.webp and b/assets/image/shop_yue.webp differ diff --git a/assets/image/shopping_bag.webp b/assets/image/shopping_bag.webp new file mode 100644 index 00000000..74934419 Binary files /dev/null and b/assets/image/shopping_bag.webp differ diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 7eee6f2b..36f51ba6 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -18,8 +18,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class CommunityChildPage extends StatefulWidget { final String typeStr; final Function onScroll; + final Function toRelease; - CommunityChildPage(Key key, this.typeStr,this.onScroll): super(key: key); + CommunityChildPage(Key key, this.typeStr,this.onScroll,this.toRelease): super(key: key); @override State createState() { @@ -130,43 +131,61 @@ class CommunityChildPageState extends State with AutomaticKe isLoadMore = true; setState(() {}); }, - child: (articles == null || articles.length == 0)? NoDataView( - src: "assets/image/guan_zhu.webp", - isShowBtn: false, - text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), - ):ListView.builder( - controller: sc, - itemBuilder: (context, position) { - return InkWell( - child: CommunityDynamic( - articles[position], - 0, - userId: userId, - isList: true, - exitFull: () { - setState(() { - onRefresh(); - }); - }, - ), - onTap: () { - Navigator.of(context).pushNamed( - '/router/community_details', - arguments: { - "businessId": articles[position].id, - "userId": userId, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + (articles == null || articles.length == 0)? NoDataView( + src: "assets/image/guan_zhu.webp", + isShowBtn: false, + text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), + ):ListView.builder( + controller: sc, + itemBuilder: (context, position) { + return InkWell( + child: CommunityDynamic( + articles[position], + 0, + userId: userId, + isList: true, + exitFull: () { + setState(() { + onRefresh(); + }); + }, + ), + onTap: () { + Navigator.of(context).pushNamed( + '/router/community_details', + arguments: { + "businessId": articles[position].id, + "userId": userId, + }, + ).then((value) { + onRefresh(); + setState(() {}); + }); + setState(() {}); }, - ).then((value) { - onRefresh(); - setState(() {}); - }); - setState(() {}); + ); }, - ); - }, - itemCount: articles.length, + itemCount: articles.length, + ), + GestureDetector( + onTap: (){ + widget.toRelease(); + }, + child: Container( + margin: EdgeInsets.only(bottom:31,right: 14), + child: Image.asset( + "assets/image/fa_bu.webp", + width: 55, + height: 55, + ), + ), + ) + ], ), ); }, diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 5427554b..f9d5ccde 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -104,20 +104,20 @@ class _CommunityPage extends State tabs: lables.map((e) => MyTab(text: e)).toList(), ), ), - onTap: () { - _toRelease(); - }, - action: GestureDetector( - behavior: HitTestBehavior.opaque, - child: Container(color: Colors.transparent, - padding: EdgeInsets.only(left: 20,right: 20), - child: SvgPicture.asset( - "assets/svg/shequ_fabu.svg", - fit: BoxFit.contain, - width: 24, - height: 24, - ),) - ) + // onTap: () { + // _toRelease(); + // }, + // action: GestureDetector( + // behavior: HitTestBehavior.opaque, + // child: Container(color: Colors.transparent, + // padding: EdgeInsets.only(left: 20,right: 20), + // child: SvgPicture.asset( + // "assets/svg/shequ_fabu.svg", + // fit: BoxFit.contain, + // width: 24, + // height: 24, + // ),) + // ) ), body: Container( padding: EdgeInsets.only(bottom: 76.h), @@ -133,12 +133,12 @@ class _CommunityPage extends State } else if(e == "分享健康"){ if (tuijian == null){ - tuijian = CommunityChildPage(tuijianKey,"分享健康",onChildScroll); + tuijian = CommunityChildPage(tuijianKey,"分享健康",onChildScroll,_toRelease); } return tuijian; }else if(e == "关注"){ if (guanzhu == null){ - guanzhu = CommunityChildPage(guanzhuKey,"关注",onChildScroll); + guanzhu = CommunityChildPage(guanzhuKey,"关注",onChildScroll,_toRelease); } return guanzhu; } diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index 6eaa53c0..7030beb5 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -152,6 +152,7 @@ class _ShortcutOperation extends State { Expanded(child: GestureDetector( onTap: (){ Navigator.of(context).pushNamed('/router/roll_center_page'); + // Navigator.of(context).pushNamed('/router/welfare_page'); }, child:Container( width: double.infinity, diff --git a/lib/main.dart b/lib/main.dart index 4c780bae..65ff0bf1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -98,6 +98,7 @@ import 'home/welfare_page.dart'; import 'login/new_login_page.dart'; import 'main_page.dart'; import 'message/system_details.dart'; +import 'mine/coupon_page.dart'; import 'mine/edit_signature.dart'; import 'mine/invitation_record.dart'; import 'mine/manage_address_page.dart'; @@ -381,11 +382,13 @@ Map routers = { '/router/report_assess': (context, {arguments}) => ReportAssess(), '/router/shop_details_page': (context, {arguments}) => - ShopDetailsPage(arguments:arguments,), + ShopDetailsPage(arguments: arguments,), '/router/mine_greenery': (context, {arguments}) => MineGreenery(), '/router/mine_shop_page': (context, {arguments}) => MineShopPage(), '/router/mine_shop_details': (context, {arguments}) => MineShopDetails(arguments:arguments,), + '/router/coupon_page': (context, {arguments}) => + CouponPage(), }; diff --git a/lib/mine/coupon_page.dart b/lib/mine/coupon_page.dart new file mode 100644 index 00000000..fd05f4a3 --- /dev/null +++ b/lib/mine/coupon_page.dart @@ -0,0 +1,353 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/coupon.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/new_coupon_widget.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:huixiang/view_widget/receive_success.dart'; +import 'package:huixiang/view_widget/selector_store_dialog.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class CouponPage extends StatefulWidget { + @override + State createState() { + return _CouponPage(); + } +} + +class _CouponPage extends State { + ApiService apiService; + RefreshController _refreshController; + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString('token')); + queryCard(); + }); + _refreshController = RefreshController(initialRefresh: false); + } + + List coupons = []; + int pageNum = 1; + int state = 1; + + _onRefresh() async { + pageNum = 1; + queryCard(); + } + + queryCard() async { + BaseData> baseData = await apiService.queryCard({ + "centre": true, + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "", + "state": state + }).catchError((error) { + _refreshController.loadFailed(); + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + if (pageNum == 1) { + coupons.clear(); + } + coupons.addAll(baseData.data.list); + setState(() { + _refreshController.refreshCompleted(); + _refreshController.loadComplete(); + if (baseData.data.pageNum == baseData.data.pages) { + _refreshController.loadNoData(); + } else { + pageNum += 1; + } + }); + } else { + _refreshController.loadFailed(); + _refreshController.refreshFailed(); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: S.of(context).youhuiquan, + titleColor: Colors.black, + background: Color(0xFFFFFFFF), + leadingColor: Colors.black, + ), + body: Column( + children: [ + Container( + height: 54.h, + padding: EdgeInsets.only(left: 14.w, right: 14.w, bottom: 12.h), + margin: EdgeInsets.only(bottom: 10), + color: Color(0xFFFFFFFF), + child: Row( + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + state = 1; + _onRefresh(); + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(6), + bottomLeft: Radius.circular(6), + ), + border: Border.all( + color: Color(0xFF32A060), + width: 1, + ), + color: state == 1 ? Color(0xFF32A060) : Color(0xFFFFFFFF), + ), + child: Text( + S.of(context).keyongquan, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 15.sp, + color: state == 1 ? Color(0xFFFFFFFF) : Color(0xFF32A060), + ), + ), + ), + )), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + state = 3; + _onRefresh(); + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topRight: Radius.circular(6), + bottomRight: Radius.circular(6), + ), + border: Border.all( + color: Color(0xFF32A060), + width: 1, + ), + color: state == 3 ? Color(0xFF32A060) : Color(0xFFFFFFFF), + ), + child: Text( + S.of(context).shixiaoquan, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 15.sp, + color: state == 3 ? Color(0xFFFFFFFF) : Color(0xFF32A060), + ), + ), + ), + )) + ], + ), + ), + Expanded( + child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: queryCard, + child: (coupons != null && coupons.length > 0) + ? ListView.builder( + itemBuilder: (context, position) { + return GestureDetector( + child: NewCouponWidget( + coupons[position], + (type) { + if (type == 1) { + receiveCoupon(coupons[position].id); + } else { + if (coupons[position].bizType == 5 || + coupons[position].bizType == 3) { + Navigator.of(context).pushNamed( + '/router/write_off_page', + arguments: { + "couponId": coupons[position].id, + "coupon": jsonEncode(coupons[position]), + }).then((value) { + _onRefresh(); + }); + } else { + showStoreSelector( + coupons[position].storeList); + } + } + }, + // (){ + // setState(() { + // couponDialog(); + // }); + // }, + () { + setState(() { + coupons[position].isEx = + !coupons[position].isEx; + }); + }, + type: 0, + ), + ); + }, + itemCount: coupons != null ? coupons.length : 0, + ) + : NoDataView( + src: "assets/image/ka.webp", + isShowBtn: false, + text: "目前暂无优惠券,请到领劵中心领取哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h, left: 60, right: 60), + ), + ), + ), + ], + ), + ); + } + + receiveCoupon(couponId) async { + BaseData baseData = + await apiService.receiveCoupon(couponId).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + _onRefresh(); + showAlertDialog(); + } + } + + ///选择店铺使用 + showStoreSelector(storeList) { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return SelectorStoreWidget(storeList); + }); + } + + couponDialog(){ + showCouponDialog(); + } + + showAlertDialog() { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ReceiveSuccess(); + }, + ); + } + + ///优惠券详情弹窗 + showCouponDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + content: Container( + width: MediaQuery.of(context).size.width - 14, + height: 330.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: + Container( + alignment: Alignment.center, + 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), + ], + ), + SizedBox(height: 12.h,), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF2F2F2), + margin: EdgeInsets.only(bottom:11.h), + ), + Container( + color: Colors.white, + child: Html( + data: "注意", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ], + ), + ), + ); + }, + ); + } +} diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 647ddc91..85df574b 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -141,7 +141,7 @@ class _MineItem extends State { LoginTipsDialog().show(context); return; } - Navigator.of(context).pushNamed('/router/mine_card'); + Navigator.of(context).pushNamed('/router/coupon_page'); }); }, child: mineItem( @@ -198,7 +198,7 @@ class _MineItem extends State { }, child: mineItem( "我的评价", - "assets/image/fan_kui.webp", + "assets/image/mine_evaluation.webp", ), ),), ], diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index e679fe11..a2ba048b 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -90,7 +90,7 @@ class _RechargePage extends State { queryUserBalance() async { BaseData baseData = - await apiService.queryInfo().catchError((onError) {}); + await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; mBalance = double.tryParse(userInfo?.money ?? "0"); @@ -120,7 +120,8 @@ class _RechargePage extends State { token: value.getString("token"), ); } - BaseData> baseData = await apiService.rechargeAct().catchError((onError) {}); + BaseData> baseData = + await apiService.rechargeAct().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { rechargeA = baseData.data; @@ -141,299 +142,313 @@ class _RechargePage extends State { ), body: Container( color: Color(0xFFFFFFFF), - child: Stack( - children: [ - Column(children: [ - SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.only(left: 16, right: 16), - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - // ItemInputWidget( - // S.of(context).qingshuruchongzhijine, - // hintText: "", - // controller: controller, - // padding: EdgeInsets.all(20), - // errorText: S.of(context).chongzhizuixiaojine(100), - // titleColor: Color(0xFF727272), - // errorTextColor: Color(0xFF32A060), - // radius: 8, - // discount: discount / 10, - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 27.sp, - // color: color, - // ), - // inputLimit: 6, - // textInputType: TextInputType.number, - // textInputFormatter: - // FilteringTextInputFormatter.digitsOnly, - // onChanged: (value) { - // if (value != null && - // value != "" && - // double.tryParse(value) < 100) { - // color = Colors.red; - // } else { - // color = Colors.black; - // } - // setState(() {}); - // }, - // ), - SizedBox(height:20,), - Row( - children: [ - Expanded( - child: Text( - S.of(context).zhanghuyue, - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontWeight: MyFontWeight.semi_bold), - )), - Text.rich( - TextSpan(children: [ - TextSpan( - text: "$mBalance", - style: TextStyle( - fontSize: 26.sp, - color: Color(0xFF181818), - fontWeight: MyFontWeight.semi_bold), - ), - TextSpan( - text: "元", - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontWeight: MyFontWeight.semi_bold), - ), - ]), - ), - ], - ), - SizedBox(height: 28), - rechargeList(), - SizedBox(height:22), - // Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // children: [ - // if (vipRuleDetails?.recharge != null && - // vipRuleDetails.recharge != "") - // Expanded( - // child: Container( - // color: Colors.white, - // child: Html( - // data: "注意:${vipRuleDetails?.recharge ?? ""}", - // customImageRenders: { - // networkSourceMatcher(): networkImageRender( - // loadingWidget: () { - // return Container(); - // }, - // ), - // }, - // ), - // ), - // ) - // ], - // ), - ], - ), - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 16.h, - bottom: 4.h, - ), - padding: EdgeInsets.only( - top: 20.h, - bottom: 20.h, - ), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular(4), - // ), + child: SingleChildScrollView( + child: Container( + child: Stack( + children: [ + Column( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: FontWeight.bold, - ), + Container( + margin: EdgeInsets.only(left: 16, right: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + // ItemInputWidget( + // S.of(context).qingshuruchongzhijine, + // hintText: "", + // controller: controller, + // padding: EdgeInsets.all(20), + // errorText: S.of(context).chongzhizuixiaojine(100), + // titleColor: Color(0xFF727272), + // errorTextColor: Color(0xFF32A060), + // radius: 8, + // discount: discount / 10, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 27.sp, + // color: color, + // ), + // inputLimit: 6, + // textInputType: TextInputType.number, + // textInputFormatter: + // FilteringTextInputFormatter.digitsOnly, + // onChanged: (value) { + // if (value != null && + // value != "" && + // double.tryParse(value) < 100) { + // color = Colors.red; + // } else { + // color = Colors.black; + // } + // setState(() {}); + // }, + // ), + SizedBox( + height: 20, + ), + Row( + children: [ + Expanded( + child: Text( + S.of(context).zhanghuyue, + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: + MyFontWeight.semi_bold), + )), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "$mBalance", + style: TextStyle( + fontSize: 26.sp, + color: Color(0xFF181818), + fontWeight: + MyFontWeight.semi_bold), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 15.sp, + color: Color(0xFF181818), + fontWeight: + MyFontWeight.semi_bold), + ), + ]), + ), + ], + ), + SizedBox(height: 28), + rechargeList(), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // if (vipRuleDetails?.recharge != null && + // vipRuleDetails.recharge != "") + // Expanded( + // child: Container( + // color: Colors.white, + // child: Html( + // data: "注意:${vipRuleDetails?.recharge ?? ""}", + // customImageRenders: { + // networkSourceMatcher(): networkImageRender( + // loadingWidget: () { + // return Container(); + // }, + // ), + // }, + // ), + // ), + // ) + // ], + // ), + ], + )), + Container( + width: double.infinity, + margin: EdgeInsets.only( + bottom: 22.h, left: 16, right: 16), + padding: EdgeInsets.only( + top: 20.h, + bottom: 20.h, ), - ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 1; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(4), + // ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset("assets/image/icon_we_chat.webp"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, ), ), ), - checkView(1), + GestureDetector( + onTap: () { + setState(() { + checkIndex = 1; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/icon_we_chat.webp"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(1), + ], + ), + ), ], ), ), + Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () { + recharge(); + }, + child: Container( + height: 56.h, + width: double.infinity, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(27), + ), + margin: EdgeInsets.only( + left: 16, right: 16, bottom: 21), + child: Text( + S.of(context).querenchongzhi, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ), + + // Container( + // height: 56.h, + // color: Colors.white, + // child: Row( + // children: [ + // Expanded(child:Container( + // padding:EdgeInsets.only(top: 7.h,left:16), + // child:Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Text( + // S.of(context).heji, + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.black, + // ), + // ), + // Text( + // controller.text, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.medium, + // color: Color(0xFF32A060), + // ), + // ), + // ], + // ), + // if(controller.text != "") + // Text.rich( + // TextSpan( + // children: [ + // TextSpan( + // text: "充值", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${controller.text}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color:Color(0xff3541C9), + // ), + // ), + // TextSpan( + // text: "赠送", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // TextSpan( + // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xff3541C9), + // ), + // ),TextSpan( + // text: "元", + // style: TextStyle( + // fontSize:12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFADADAD), + // ), + // ), + // ], + // ), + // ), + // ], + // )) + // ), + // GestureDetector( + // onTap: () { + // recharge(); + // }, + // child: RoundButton( + // width: 103.w, + // height: 54.h, + // text: S.of(context).chongzhi, + // textColor: Colors.white, + // fontWeight: MyFontWeight.regular, + // backgroup: Color(0xFF32A060), + // radius: 0, + // fontSize: 16.sp, + // padding: EdgeInsets.symmetric(vertical: 5.h), + // ), + // ), + // ], + // ), + // ) + ) ], ), ), - ], - ), - ), - ) - ],), - Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: (){ - recharge(); - }, - child: Container( - height: 56.h, - width: double.infinity, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(27), - ), - margin: EdgeInsets.only(left: 16,right: 16,bottom: 21), - child: Text( - S.of(context).querenchongzhi, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), + ) + ], ), - ), - - // Container( - // height: 56.h, - // color: Colors.white, - // child: Row( - // children: [ - // Expanded(child:Container( - // padding:EdgeInsets.only(top: 7.h,left:16), - // child:Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // Text( - // S.of(context).heji, - // style: TextStyle( - // fontSize: 14.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.black, - // ), - // ), - // Text( - // controller.text, - // style: TextStyle( - // fontSize: 16.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // ], - // ), - // if(controller.text != "") - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "充值", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${controller.text}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color:Color(0xff3541C9), - // ), - // ), - // TextSpan( - // text: "赠送", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // TextSpan( - // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xff3541C9), - // ), - // ),TextSpan( - // text: "元", - // style: TextStyle( - // fontSize:12.sp, - // fontWeight: MyFontWeight.regular, - // color: Color(0xFFADADAD), - // ), - // ), - // ], - // ), - // ), - // ], - // )) - // ), - // GestureDetector( - // onTap: () { - // recharge(); - // }, - // child: RoundButton( - // width: 103.w, - // height: 54.h, - // text: S.of(context).chongzhi, - // textColor: Colors.white, - // fontWeight: MyFontWeight.regular, - // backgroup: Color(0xFF32A060), - // radius: 0, - // fontSize: 16.sp, - // padding: EdgeInsets.symmetric(vertical: 5.h), - // ), - // ), - // ], - // ), - // ) - ) - ], + ], + ), + ), ), ), ); @@ -447,127 +462,121 @@ class _RechargePage extends State { itemCount: rechargeA == null ? 0 : rechargeA.length, scrollDirection: Axis.vertical, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - selectIndex = position; - }); - }, - child: newRechargeItem(rechargeA[position],position) - ); - }, - ); - GridView.builder( - itemCount: rechargeA == null ? 0 : rechargeA.length, - shrinkWrap: true, physics: BouncingScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - //一行的Widget数量 - crossAxisCount: 3, - //水平子Widget之间间距 - crossAxisSpacing:11, - //垂直子Widget之间间距 - mainAxisSpacing: 0, - childAspectRatio: 1.5, - ), - itemBuilder: (context, index) { + itemBuilder: (context, position) { return GestureDetector( - onTap: () { - setState(() { - selectIndex = index; - }); - }, - child: rechargeItem(rechargeA[index],index), - ); + onTap: () { + setState(() { + selectIndex = position; + }); + }, + child: rechargeItem(rechargeA[position], position)); }, ); } - Widget rechargeItem(RechargeList rechargeA,index) { - return Container( - child: Stack( - alignment: Alignment.bottomRight, - children: [ - Container( - alignment: Alignment.center, - height: 69.h, - decoration: BoxDecoration( - color: selectIndex == index ?Color(0x2432A060) : Color(0xFFFAFAFA), - borderRadius: BorderRadius.circular(4), - ), - // margin: EdgeInsets.only(right: 11,bottom: 16), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "${AppUtils.calculateDouble(double.tryParse(rechargeA.rechargeMoney)??0)}元", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF868686), - fontWeight: MyFontWeight.medium, - fontSize:18.sp, - ), - ), - SizedBox(height:2,), - 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))))}元", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF868686), - fontWeight: MyFontWeight.regular, - fontSize:10.sp, - ), - ), - ], - ), - ), - if(selectIndex == index) - Image.asset( - "assets/image/recharge.webp", - width: 20, - height:20, - ), - ], - )); - } - - Widget newRechargeItem(RechargeList rechargeA,index) { + Widget rechargeItem(RechargeList rechargeA, index) { return Container( - width:double.infinity, + width: double.infinity, height: 69.h, decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - borderRadius: BorderRadius.circular(4), - ), - child: Row( - + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: selectIndex == index ? Color(0xFF32A060) :Color(0xFFFAFAFA), + width: selectIndex == index ? 1 :0, + ), + color: selectIndex == index ? Color(0XFFF0FAF4) :Color(0xFFFAFAFA)), + margin: EdgeInsets.only(bottom: 14.w), + padding: EdgeInsets.only(left: 16), + child: Flex( + direction: Axis.horizontal, children: [ - Text.rich( - TextSpan(children: [ - TextSpan( - text: "储值 ", - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF868686), - fontWeight: MyFontWeight.regular), + Expanded( + flex: 1, + child: Container( + child: Text.rich( + TextSpan(children: [ + TextSpan( + text: "储值 ", + style: TextStyle( + fontSize: 12.sp, + color:selectIndex == index ? Color(0xFF4D4D4D):Color(0xFF868686), + fontWeight: MyFontWeight.regular), + ), + TextSpan( + text: + "${AppUtils.calculateDouble(double.tryParse(rechargeA.rechargeMoney) ?? 0)}元", + style: TextStyle( + fontSize: 18.sp, + color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + )), + Container( + width: 1.w, + height: 37.h, + 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), + ), + 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, + color: selectIndex == index ? Color(0xFF353535) : Color(0xFF868686), + fontWeight: MyFontWeight.semi_bold), + ), + ]), ), - TextSpan( - text: "${AppUtils.calculateDouble(double.tryParse(rechargeA.rechargeMoney)??0)}元", - style: TextStyle( - fontSize: 15.sp, - color: Color(0xFF181818), - fontWeight: MyFontWeight.semi_bold), + SizedBox( + height: 4.h, ), - ]), - ), - Container( - width: 1.w, - height: 37.h, - color: Color(0xFF979797), - ) + GestureDetector( + onTap: (){ + setState(() { + if(selectIndex == index) + rechargeShowBottomSheet(); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + 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), + ), + ], + ) + ), + ], + )) ], )); } @@ -586,6 +595,98 @@ class _RechargePage extends State { ); } + ///充值说明底部弹窗 + rechargeShowBottomSheet() { + showModalBottomSheet( + builder: (BuildContext context) { + return buildBottomSheetWidget(context); + }, + backgroundColor: Colors.transparent, + context: context); + } + + Widget buildBottomSheetWidget(BuildContext context) { + return Container( + padding: EdgeInsets.only(top: 12), + decoration: new BoxDecoration( + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: const Radius.circular(25.0), + topRight: const Radius.circular(25.0))), + child: Container( + width: 299, + height:299, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded(child: + Container( + margin: EdgeInsets.symmetric(vertical: 12.h), + alignment: Alignment.center, + 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), + ], + ), + SizedBox(height: 12.h,), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF2F2F2), + margin: EdgeInsets.only(bottom:13.h), + ), + Padding(padding:EdgeInsets.only(left: 14), + child: + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + if (vipRuleDetails?.recharge != null && + vipRuleDetails.recharge != "") + Expanded( + child: Container( + color: Colors.white, + child: Html( + data: "注意:${vipRuleDetails?.recharge ?? ""}", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ) + ], + ),) + ], + ), + )); + } + recharge() async { // String money = controller.text; // if (money == null || money == "") { @@ -601,36 +702,38 @@ class _RechargePage extends State { // return; // } - if (Platform.isAndroid) { - if (!(await Min.isInitialize())) { - // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, - // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, - // 故而在此初始化一下 - await Min.initialize(); - } + if (Platform.isAndroid) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); } + } - BaseData baseData = await apiService.recharge( - {"amount": 0,"rechargeActId":rechargeA[selectIndex].id, "rechargeType": 2}).catchError((error) {}); - if (baseData != null && baseData.isSuccess) { - WxPay wxPay = WxPay.fromJson(baseData.data); - await registerWxApi( - appId: wxPay.appId, - doOnAndroid: true, - universalLink: "https://hx.lotus-wallet.com/app/", - ); - payWithWeChat( - appId: wxPay.appId, - partnerId: wxPay.partnerId, - prepayId: wxPay.prepayId, - packageValue: wxPay.packageValue, - nonceStr: wxPay.nonceStr, - timeStamp: int.tryParse(wxPay.timeStamp), - sign: wxPay.sign, - ); - } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); - } + BaseData baseData = await apiService.recharge({ + "amount": 0, + "rechargeActId": rechargeA[selectIndex].id, + "rechargeType": 2 + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + WxPay wxPay = WxPay.fromJson(baseData.data); + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } - // } + } } diff --git a/lib/qr/invite_friends.dart b/lib/qr/invite_friends.dart index ad14e915..a609452c 100644 --- a/lib/qr/invite_friends.dart +++ b/lib/qr/invite_friends.dart @@ -3,15 +3,22 @@ import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/invitation_list.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class InviteFriends extends StatefulWidget { @override @@ -24,11 +31,81 @@ class _InviteFriends extends State { ApiService apiService; final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); - Article article; + List invitationList = []; + UserInfo userInfo; + int pageNum = 1; @override void initState() { super.initState(); + queryInviteMember(); + queryInviteMember(); + } + + ///邀请记录 + queryInviteMember() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.inviteMemberList({ + "searchKey": "", + "pageNum": 1, + "pageSize": 100, + }).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + if (pageNum == 1) { + invitationList.clear(); + } + invitationList.addAll(baseData.data.list); + setState(() { + refreshController.refreshCompleted(); + }); + } else { + refreshController.refreshFailed(); + } + } + + ///查询用户信息 + queryUserInfo() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseDate = + await apiService.queryInfo().catchError((onError) { + refreshController.refreshFailed(); + }); + if (baseDate != null && baseDate.isSuccess) { + setState(() { + userInfo = baseDate.data; + }); + SharedPreferences.getInstance().then( + (value) => { + value.setString('user', jsonEncode(baseDate.data)), + }, + ); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + EasyLoading.dismiss(); + } + + _onRefresh(){ + queryInviteMember(); + queryInviteMember(); } @override @@ -84,7 +161,9 @@ class _InviteFriends extends State { }, ), onRefresh: () { - setState(() {}); + setState(() { + _onRefresh(); + }); }, physics: BouncingScrollPhysics(), scrollController: scrollController, @@ -477,7 +556,7 @@ class _InviteFriends extends State { Expanded(child:Column( children: [ Text( - "12", + (userInfo?.todayInviteNumber ?? 0).toString(), style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 25.sp, @@ -498,7 +577,7 @@ class _InviteFriends extends State { Expanded(child:Column( children: [ Text( - "100", + (userInfo?.inviteNumber ?? 0).toString(), style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 25.sp, @@ -579,9 +658,16 @@ class _InviteFriends extends State { ), ],), SizedBox(height:12.h,), - ListView.builder( + (invitationList.length == null || invitationList.length == 0) + ? NoDataView( + src: "assets/image/ding_dan.webp", + isShowBtn: false, + text:"还没有邀请记录哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ):ListView.builder( padding: EdgeInsets.zero, - itemCount:6, + itemCount:invitationList.length, scrollDirection: Axis.vertical, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -589,7 +675,7 @@ class _InviteFriends extends State { return GestureDetector( onTap: () { }, - child: mineInviteItem(), + child: mineInviteItem(invitationList[position]), ); }, ), @@ -598,7 +684,7 @@ class _InviteFriends extends State { ); } - Widget mineInviteItem(){ + Widget mineInviteItem(InvitationList invitationList){ return Container( child:Column( children: [ @@ -611,7 +697,7 @@ class _InviteFriends extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - AppUtils.phoneEncode("15392949097"), + AppUtils.phoneEncode(invitationList?.phone ?? ""), style: TextStyle( color: Color(0xFF000000), fontSize: 12.sp, @@ -620,7 +706,7 @@ class _InviteFriends extends State { ), SizedBox(height:8), Text( - "注册时间:2021.09.08 12:12:12", + "注册时间:${invitationList?.createTime ?? ""}", style: TextStyle( color: Color(0xFF000000), fontSize: 12.sp, diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 382924e6..6c6db000 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -39,7 +39,7 @@ part 'min_api.g.dart'; // const base_url = "http://192.168.10.37:8765/app/"; -const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 8109d5fa..a1f083ce 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -111,7 +111,7 @@ class _MinApiService implements MinApiService { Future>> getShoppingCart(tableId) async { ArgumentError.checkNotNull(tableId, 'tableId'); const _extra = {}; - final queryParameters = {r'tableId': tableId}; + final queryParameters = {'tableId': tableId}; final _data = {}; final _result = await _dio.request>('shoppingcart', queryParameters: queryParameters, diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index b4e1d68f..7a64513d 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -69,7 +69,7 @@ part 'retrofit_api.g.dart'; // const base_url = "http://192.168.10.132:8766/app/";///詹云久 -const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 @RestApi(baseUrl: localBaseUrl) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index ae4133e9..6ae6e0e5 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -177,7 +177,8 @@ class _Settlement extends State { "productSkuId":productSkuId, "actProductId": actProductId, "actProductSkuId": actProductSkuId, - "buyNum":buyNum + "buyNum":buyNum, + }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { diff --git a/lib/store/report_assess .dart b/lib/store/report_assess .dart index f837f99d..43afe3f3 100644 --- a/lib/store/report_assess .dart +++ b/lib/store/report_assess .dart @@ -186,7 +186,6 @@ class _ReportAssess extends State { ); } - ///评价列表 Widget goodsAssessList() { return Container( @@ -390,6 +389,4 @@ class _ReportAssess extends State { ); } - - } diff --git a/lib/store/shop__details_page.dart b/lib/store/shop__details_page.dart index de56384c..0c04c34b 100644 --- a/lib/store/shop__details_page.dart +++ b/lib/store/shop__details_page.dart @@ -1,12 +1,25 @@ - +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/miNiDetail.dart'; +import 'package:huixiang/retrofit/data/shoppingCart.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/store_view/product_sku.dart'; +import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class ShopDetailsPage extends StatefulWidget { final Map arguments; @@ -21,16 +34,385 @@ class ShopDetailsPage extends StatefulWidget { class _ShopDetailsPage extends State { ApiService apiService; + MinApiService minService; final ScrollController scrollController = ScrollController(); final RefreshController refreshController = RefreshController(); + String id; + MiNiDetail miNiDetail; + ShoppingCart shopCarGoods; + bool dialogShowing = false; + StoreInfo storeInfo; + String parentCode = ""; @override void initState() { super.initState(); + id = widget.arguments["id"]; + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService(Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: true); + queryMiNiDetail(id); + }); + } + ///商品详情 + queryMiNiDetail(id) async { + BaseData baseData = + await minService.miNiDetail(id).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + miNiDetail = baseData.data; + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + _onRefresh() { + queryMiNiDetail(id); } + // ///选规格 + // _queryMiNiDetail(String id, int count) async { + // EasyLoading.show(status: S.current.zhengzaijiazai); + // if(count < 0){ + // shopCarGoods.shoppingCartSkuItemList.forEach((element) { + // if(element.productId == id){ + // shopCartReduce(element); + // setState(() { + // }); + // } + // }); + // return; + // } + // BaseData baseData = await minService.miNiDetail(id); + // if (baseData != null && baseData.isSuccess) { + // showStoreSelector(baseData.data, id, count); + // } + // } + // + // ///选规格弹窗 + // showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { + // if (miNiDetail.attrList != null && + // miNiDetail.attrList.length == 1 && + // miNiDetail.attrList[0].attrValueList.length == 1) { + // _addShopCar(miNiDetail, [], count); + // } else { + // EasyLoading.dismiss(); + // dialogShowing = true; + // SmartDialog.show( + // widget: ProductSku( + // miNiDetail, + // shopCarGoods, + // id, + // _addShopCar, + // add, + // reduce, + // ), + // onDismiss: () { + // dialogShowing = false; + // }, + // alignmentTemp: Alignment.bottomCenter, + // ); + // } + // } + // + // ///添加购物车 + // Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { + // ProductSkuVOListBean productSku; + // if (selectSkus != null && selectSkus.length == 0) { + // productSku = miNiDetail.productSkuVOList.first; + // } else { + // productSku = miNiDetail.productSkuVOList.firstWhere((element) { + // bool gg = true; + // selectSkus.forEach((element1) { + // if (element.skuNameStr.indexOf(element1) < 0) { + // gg = false; + // return gg; + // } + // }); + // return gg; + // }); + // } + // if (productSku == null) return; + // String skuId = productSku.id; + // String skuValue = selectSkus + // .toString() + // .replaceAll("[", "") + // .replaceAll("]", "") + // .replaceAll(",", ""); + // + // if (miNiDetail != null) { + // BaseData> baseDate = await minService.addShoppingCart({ + // "storeId": storeInfo.id, + // "storeName": storeInfo.storeName ?? "", + // "parentId": miNiDetail.id, + // "parentCode": parentCode, + // "shoppingCartSkuItemList": [ + // { + // "buyNum": count, + // "id": skuId, + // "productId": miNiDetail.id, + // "productName": miNiDetail.productName, + // "skuName": skuValue, + // "storeId": storeInfo.id, + // "skuPrice": productSku.skuPrice, + // "skuStock": productSku.skuStock, + // }, + // ], + // }); + // EasyLoading.dismiss(); + // if (baseDate != null && baseDate.isSuccess) { + // queryShopCar().then((value) { + // this.shopCarGoods = value; + // setState(() {}); + // }); + // } + // } + // } + // + // /// 购物车的key,用于刷新UI + // GlobalKey shopCartKey = GlobalKey(); + // + // ///购物车弹窗 + // showShoppingCart() { + // queryShopCar().then((value) { + // this.shopCarGoods = value; + // dialogShowing = true; + // SmartDialog.show( + // widget: ShopCar( + // shopCartKey, + // this.shopCarGoods, + // clearShopCar, + // toDownOrder, + // shopCartAdd, + // shopCartReduce, + // ), + // onDismiss: () { + // dialogShowing = false; + // }, + // alignmentTemp: Alignment.bottomCenter, + // ); + // }); + // } + // + // ///计算个数 + // int count() { + // if (shopCarGoods == null || + // shopCarGoods.shoppingCartSkuItemList == null || + // shopCarGoods.shoppingCartSkuItemList.length == 0) return 0; + // int count = 0; + // shopCarGoods.shoppingCartSkuItemList.forEach((element) { + // count += element.buyNum; + // }); + // return count; + // } + // + // ///去下单结算页面 + // toDownOrder() async { + // int num = count(); + // + // if (miNiDetail.id == null || miNiDetail.id == "") { + // if (num == 0) { + // SmartDialog.showToast("请先选择您要购买的商品!~"); + // return; + // } + // } + // + // await Navigator.of(context).pushNamed( + // '/router/settlement', + // arguments: { + // "storeInfo": storeInfo, + // "parentCode": parentCode, + // "parentId": miNiDetail.id, + // // "pName": pName, + // // "pid": pid, + // // "cName": cName, + // // "cid": cid, + // "shoppingCart": shopCarGoods, + // }, + // ); + // queryShopCar().then((value) { + // this.shopCarGoods = value; + // setState(() {}); + // }); + // } + // + // ///清空购物车 + // clearShopCar() async { + // BaseData baseData = await minService.clearShoppingCart(); + // if (baseData.isSuccess) { + // shopCarGoods = null; + // setState(() {}); + // } + // } + // + // ///查询购物车 + // Future queryShopCar() async { + // // pName = ""; //活动 + // // pid = ""; //活动 + // // cName = ""; //优惠券 + // // cid = ""; //优惠券 + // BaseData> baseDate = + // await minService.getShoppingCart(tableId); + // if (baseDate != null && + // baseDate.isSuccess && + // baseDate.data != null && + // baseDate.data.length > 0) { + // if (baseDate.data[0].selectDiscount == 1) { + // baseDate.data[0].couponList.forEach((element) { + // if (element.isMaxCoupon) { + // cName = element.promotionName; + // cid = element.id; + // } + // }); + // } else if (baseDate.data[0].selectDiscount == 2) { + // baseDate.data[0].promotionInfoList.forEach((element) { + // if (element.isMaxPromotion) { + // pName = element.name; + // pid = element.id; + // } + // }); + // } + // return baseDate.data[0]; + // } else { + // return null; + // } + // } + // + // ///购物车➕1 + // Future shopCartAdd( + // ShoppingCartSkuItemListBean cartSkuItem) async { + // Map shopCarTemp = shopCarGoods.toJson(); + // cartSkuItem.buyNum += 1; + // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + // BaseData> baseDate = + // await minService.shoppingCartSingle(shopCarTemp); + // if (baseDate.isSuccess) { + // this.shopCarGoods = await queryShopCar(); + // if (shopCartKey != null) { + // shopCartKey.currentState.setState(() {}); + // } + // setState(() {}); + // } + // return this.shopCarGoods; + // } + // + // ///购物车➖1 + // Future shopCartReduce( + // ShoppingCartSkuItemListBean cartSkuItem) async { + // Map shopCarTemp = shopCarGoods.toJson(); + // cartSkuItem.buyNum -= 1; + // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + // BaseData> baseDate = + // await minService.shoppingCartSingle(shopCarTemp); + // if (baseDate.isSuccess) { + // EasyLoading.dismiss(); + // this.shopCarGoods = await queryShopCar(); + // if (shopCartKey?.currentState != null) { + // shopCartKey.currentState.setState(() {}); + // } + // setState(() { + // }); + // } + // return this.shopCarGoods; + // } + // + // ///商品➕1 + // add(MiNiDetail miNiDetail, selectSkus) async { + // ProductSkuVOListBean productSku = + // miNiDetail.productSkuVOList.firstWhere((element) { + // return skuY(element, selectSkus); + // }); + // + // if (productSku == null) return; + // String skuId = productSku.id; + // if (shopCarGoods == null) { + // await _addShopCar(miNiDetail, selectSkus, 2); + // return; + // } + // int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + // .indexWhere((element) => skuId == element.id); + // Map shopCarTemp = shopCarGoods.toJson(); + // shopCarGoods.tableId = "$tableId"; + // + // if (shopSkuIndex >= 0) { + // shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1; + // ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods + // .shoppingCartSkuItemList + // .firstWhere((element) => skuId == element.id); + // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + // } else { + // await _addShopCar(miNiDetail, selectSkus, 2); + // return; + // } + // + // BaseData> baseDate = + // await minService.shoppingCartSingle(shopCarTemp); + // if (baseDate.isSuccess) { + // queryShopCar().then((value) { + // this.shopCarGoods = value; + // setState(() {}); + // }); + // } + // } + // + // ///商品➖1 + // reduce(MiNiDetail miNiDetail, selectSkus) async { + // ProductSkuVOListBean productSku = + // miNiDetail.productSkuVOList.firstWhere((element) { + // return skuY(element, selectSkus); + // }); + // + // if (productSku == null) return; + // String skuId = productSku.id; + // if (shopCarGoods == null) { + // await _addShopCar(miNiDetail, selectSkus, 2); + // return; + // } + // ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods + // .shoppingCartSkuItemList + // .firstWhere((element) => skuId == element.id); + // int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + // .indexWhere((element) => skuId == element.id); + // + // if (shopSkuItem != null) { + // if (shopSkuItem.buyNum > 1) { + // shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1; + // } + // } else { + // await _addShopCar(miNiDetail, selectSkus, 2); + // return; + // } + // shopCarGoods.tableId = "$tableId"; + // + // Map shopCarTemp = shopCarGoods.toJson(); + // ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods + // .shoppingCartSkuItemList + // .firstWhere((element) => skuId == element.id); + // shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + // + // BaseData> baseDate = + // await minService.shoppingCartSingle(shopCarTemp); + // if (baseDate.isSuccess) { + // queryShopCar().then((value) { + // this.shopCarGoods = value; + // setState(() {}); + // }); + // } + // } + + @override Widget build(BuildContext context) { return Scaffold( @@ -48,8 +430,9 @@ class _ShopDetailsPage extends State { return MyFooter(mode); }, ), - onRefresh:(){ + onRefresh: () { setState(() { + _onRefresh(); }); }, physics: BouncingScrollPhysics(), @@ -64,7 +447,8 @@ class _ShopDetailsPage extends State { buildProduct(), Container( width: double.infinity, - padding: EdgeInsets.only(top: 16.h,left: 14.w,right: 14.w,bottom: 16.h), + padding: EdgeInsets.only( + top: 16.h, left: 14.w, right: 14.w, bottom: 16.h), color: Colors.white, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -73,17 +457,26 @@ class _ShopDetailsPage extends State { Text( "商品详情", style: TextStyle( - fontSize:15.sp, + fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, color: Color(0xFF000000), ), ), - SizedBox(height: 14.h,), - Image.asset( - "assets/image/icon_story_td.webp", - width: double.infinity, - fit: BoxFit.cover, - height:99.h, + SizedBox( + height: 14.h, + ), + Container( + color: Colors.white, + child: Html( + data: miNiDetail?.detail ?? "", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), ), ], ), @@ -120,7 +513,8 @@ class _ShopDetailsPage extends State { children: [ swiper(), Container( - padding: EdgeInsets.only(top: 16.h,left: 14.w,right: 14.w,bottom: 16.h), + padding: EdgeInsets.only( + top: 16.h, left: 14.w, right: 14.w, bottom: 16.h), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -130,26 +524,28 @@ class _ShopDetailsPage extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "¥19.00", + miNiDetail?.price ?? "", style: TextStyle( - fontSize:24.sp, + fontSize: 24.sp, fontWeight: MyFontWeight.semi_bold, color: Color(0xFFF85400), ), ), - SizedBox(width: 2,), - Expanded(child: - Text( - "¥19.00", + SizedBox( + width: 2, + ), + Expanded( + child: Text( + miNiDetail?.applyPrice ?? "", style: TextStyle( - fontSize:16.sp, + fontSize: 16.sp, decoration: TextDecoration.lineThrough, fontWeight: MyFontWeight.regular, color: Color(0xFFA29E9E), ), )), GestureDetector( - onTap: (){ + onTap: () { showDeleteDialog(); }, child: Container( @@ -170,11 +566,13 @@ class _ShopDetailsPage extends State { width: 18, height: 18, ), - SizedBox(width: 2,), + SizedBox( + width: 2, + ), Text( "加入购物车", style: TextStyle( - fontSize:12.sp, + fontSize: 12.sp, fontWeight: MyFontWeight.regular, color: Color(0xFFFFFFFF), ), @@ -186,18 +584,22 @@ class _ShopDetailsPage extends State { ], ), Text( - "手工啵啵奶茶", + miNiDetail?.productName ?? "", style: TextStyle( - fontSize:15.sp, + fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, color: Color(0xFF000000), ), ), - SizedBox(height: 12.h,), + SizedBox( + height: 12.h, + ), Text( - "商品是为了出售而生产的劳动成果,是人类社会生产力发展到一定历史阶段的产物,是用于交换的劳动产品。", + miNiDetail?.shortName ?? "", + maxLines: 3, + overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize:12.sp, + fontSize: 12.sp, height: 1.5, fontWeight: MyFontWeight.regular, color: Color(0xFF4D4D4D), @@ -229,14 +631,15 @@ class _ShopDetailsPage extends State { ), ), itemBuilder: (context, position) { - return Image.asset( - "assets/image/icon_story_td.webp", + return MImage( + miNiDetail?.imgs != null ? miNiDetail.imgs[position]:"", fit: BoxFit.cover, - width: 24, - height: 24, + radius: BorderRadius.zero, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", ); }, - itemCount: 3, + itemCount: miNiDetail?.imgs?.length ?? 1, ), GestureDetector( onTap: () { @@ -266,7 +669,7 @@ class _ShopDetailsPage extends State { return AlertDialog( content: Container( width: MediaQuery.of(context).size.width - 84, - height:500.h, + height: 500.h, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -276,18 +679,23 @@ class _ShopDetailsPage extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( - child: Image.asset( - "assets/image/icon_story_td.webp", - fit: BoxFit.fill, //填充剩余空间 - height: 70.h, + 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( + SizedBox( + width: 10.w, + ), + Expanded( + child: Container( height: 70, - child: Column( + child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -296,7 +704,7 @@ class _ShopDetailsPage extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "手工啵啵奶茶", + miNiDetail?.productName ?? "", style: TextStyle( fontSize: 13.sp, fontWeight: FontWeight.bold, @@ -312,7 +720,7 @@ class _ShopDetailsPage extends State { ], ), Text( - "¥19.00", + "¥${miNiDetail?.price ?? ""}", style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, diff --git a/lib/store/shopping/shopping_home/group_details.dart b/lib/store/shopping/shopping_home/group_details.dart index b467cad4..1cf35346 100644 --- a/lib/store/shopping/shopping_home/group_details.dart +++ b/lib/store/shopping/shopping_home/group_details.dart @@ -6,10 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; -import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/launch_join_act.dart'; -import 'package:huixiang/retrofit/data/miNiDetail.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b3fe6f5e..eff6be6a 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -80,7 +80,7 @@ class _StoreOrderPage extends State if (tabcontroller == null) tabcontroller = TabController( - length: 2, + length: 1, vsync: this, ); @@ -234,7 +234,7 @@ class _StoreOrderPage extends State sliver: SliverAppBar( expandedHeight: (storeInfo != null && storeInfo.couponVOList != null) - ? 495.h + ? 400.h : 395.h, floating: false, snap: false, @@ -270,7 +270,10 @@ class _StoreOrderPage extends State StretchMode.blurBackground, ], background: Container( - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), child: Stack( children: [ Positioned( @@ -291,33 +294,52 @@ class _StoreOrderPage extends State right: 0, ), Positioned( - child: Container( + child: Container( decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ ///门店信息 StoreInfoView(storeInfo), - - ///门店对应优惠券 - if (storeInfo != null && - storeInfo.couponVOList != null) - UnionCoupon( - storeInfo, - _receiveCoupon, - coupon: true, - ), - - if (storeInfo == null || - storeInfo.couponVOList == null) - SizedBox( - height: 8, - ), - - ///门店对应VIP信息 - Vip(storeInfo, () {}, false), + // Padding(padding:EdgeInsets.only(left: 14.w), + // child: Text( + // S.of(context).diandan, + // style: TextStyle( + // fontWeight: MyFontWeight.bold, + // fontSize: 15.sp, + // color: Color(0xFF000000), + // ), + // ),), + // Container( + // width:22.w, + // height: 3.h, + // color: Color(0xFF32A060), + // margin: EdgeInsets.only(top: 5.h,left: 14.w), + // ), + // ///门店对应优惠券 + // if (storeInfo != null && + // storeInfo.couponVOList != null) + // UnionCoupon( + // storeInfo, + // _receiveCoupon, + // coupon: true, + // ), + // + // if (storeInfo == null || + // storeInfo.couponVOList == null) + // SizedBox( + // height: 8, + // ), + // + // ///门店对应VIP信息 + // Vip(storeInfo, () {}, false), ], ), ), - top:105.h, + top:225.h, bottom: 0, left: 0, right: 0, @@ -360,7 +382,7 @@ class _StoreOrderPage extends State labelColor: Colors.black, tabs: [ MyTab(text: S.of(context).diancan), - MyTab(text: S.of(context).xindianhuodong), + // MyTab(text: ""), ], ), ), @@ -369,7 +391,9 @@ class _StoreOrderPage extends State ), ]; }, - body: TabBarView( + body: + ///点餐 + TabBarView( physics: NeverScrollableScrollPhysics(), children: [ ///点餐 @@ -385,10 +409,10 @@ class _StoreOrderPage extends State ), ///星店活动, - StoreActivity( - widget.arguments, - activitys, - ), + // StoreActivity( + // widget.arguments, + // activitys, + // ), ], controller: tabcontroller, ), @@ -405,6 +429,7 @@ class _StoreOrderPage extends State child: ),*/ ), + if(count() != 0) Positioned( bottom: 0, left: 0, @@ -413,26 +438,36 @@ class _StoreOrderPage extends State alignment: Alignment.bottomLeft, children: [ Container( - height: 54.h, - color: Color(0xFFFAFAFA), + margin: EdgeInsets.symmetric(horizontal: 14), + height: 45.h, + // color: Color(0xFFFAFAFA), + decoration: BoxDecoration( + color: Color(0xFF383A38), + borderRadius: BorderRadius.circular(100), + ), child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Spacer(), - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ), - Text( - "¥${shopCarGoods != null ? shopCarGoods.cartSum : "0.0"}", - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), + SizedBox(width:45.w,), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "¥ ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.bold), + ), + TextSpan( + text: + shopCarGoods != null ? shopCarGoods.cartSum : "0.0", + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.semi_bold), + ), + ]), ), Spacer(), GestureDetector( @@ -444,9 +479,9 @@ class _StoreOrderPage extends State height: 54.h, text: S.current.jiesuan, textColor: Colors.white, - fontWeight: MyFontWeight.regular, + fontWeight: MyFontWeight.bold, backgroup: Color(0xFF32A060), - radius: 0, + radius: 100, fontSize: 16.sp, padding: EdgeInsets.symmetric(vertical: 5.h), ), @@ -458,25 +493,27 @@ class _StoreOrderPage extends State children: [ InkWell( onTap: () { + if(count() != 0) showShoppingCart(); }, child: Image.asset( - "assets/image/shopp.webp", - width: 88, - height: 88, + "assets/image/shopping_bag.webp", + width: 66, + height: 66, fit: BoxFit.fitWidth, ), ), + if(count() != 0) Positioned( - right: 15, - top: 14, + right: 5, + // top: 14, child: RoundButton( width: 17, height: 17, text: "${count()}", textColor: Colors.white, fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), + backgroup: Color(0xFFF65720), fontSize: 12.sp, radius: 100, ), @@ -581,7 +618,7 @@ class _StoreOrderPage extends State Widget buildSwiper() { return Container( width: double.infinity, - height: 180.h, + height: 235.h, child: Swiper( pagination: SwiperPagination( alignment: Alignment.bottomCenter, diff --git a/lib/store/store_view/shop_car.dart b/lib/store/store_view/shop_car.dart index 565f783d..9f543ded 100644 --- a/lib/store/store_view/shop_car.dart +++ b/lib/store/store_view/shop_car.dart @@ -140,39 +140,34 @@ class _ShopCar extends State { alignment: Alignment.bottomLeft, children: [ Container( - height: 54.h, + height: 45.h, + margin: EdgeInsets.symmetric(horizontal: 14), decoration: BoxDecoration( - color: Color(0xFFFAFAFA), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(8), - offset: Offset(0, -1), - blurRadius: 3, - spreadRadius: 0, - ), - ], + color: Color(0xFF383A38), + borderRadius: BorderRadius.circular(100), ), child: Row( children: [ - Spacer(), - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ), - Text( - "¥" + - (widget.shopingCar == null + SizedBox(width:45.w,), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "¥ ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.bold), + ), + TextSpan( + text:widget.shopingCar == null ? "0.0" - : widget.shopingCar.cartSum), - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), - ), + : widget.shopingCar.cartSum, + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.semi_bold), + ), + ]), ), Spacer(), GestureDetector( @@ -185,9 +180,9 @@ class _ShopCar extends State { height: 54.h, text: S.current.jiesuan, textColor: Colors.white, - fontWeight: MyFontWeight.regular, + fontWeight: MyFontWeight.bold, backgroup: Color(0xFF32A060), - radius: 0, + radius: 100, fontSize: 16.sp, padding: EdgeInsets.symmetric(vertical: 5.h), ), @@ -203,21 +198,21 @@ class _ShopCar extends State { SmartDialog.dismiss(); }, child: Image.asset( - "assets/image/shopp.webp", - width: 88, - height: 88, + "assets/image/shopping_bag.webp", + width: 66, + height: 66, ), ), Positioned( - right: 15, - top: 14, + right: 5, + // top: 14, child: RoundButton( width: 17, height: 17, text: "${count()}", textColor: Colors.white, fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), + backgroup: Color(0xFFF65720), fontSize: 12.sp, radius: 100, // callback: () { diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 682e941d..dda89982 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -43,7 +43,7 @@ class _ShopGoods extends State { bottom: 10.h, top: 10.h, ), - child: Row( + child:Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, @@ -53,11 +53,12 @@ class _ShopGoods extends State { widget.productListBean != null ? widget.productListBean.imgPath : (widget.shoppingCartSkuItemListBean != null - ? widget.shoppingCartSkuItemListBean.skuImg - : ""), + ? widget.shoppingCartSkuItemListBean.skuImg + : ""), width: 70, height: 70, fit: BoxFit.cover, + radius: BorderRadius.circular(4), errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", ), @@ -68,15 +69,35 @@ class _ShopGoods extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - widget.productListBean != null - ? widget.productListBean.productName - : widget.shoppingCartSkuItemListBean.productName, - style: TextStyle( - color: Colors.black, - fontSize: 13.sp, - fontWeight: MyFontWeight.medium, - ), + Row( + children: [ + Expanded( + child: Text( + widget.productListBean != null + ? widget.productListBean.productName + : widget.shoppingCartSkuItemListBean.productName, + style: TextStyle( + color: Colors.black, + fontSize: 13.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + Image.asset( + "assets/image/green_leaf.webp", + fit: BoxFit.cover, + width: 12, + height: 12, + ), + Text( + "X300", + style: TextStyle( + color: Color(0xFF55BC51), + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], ), SizedBox( height: 2, @@ -109,17 +130,6 @@ class _ShopGoods extends State { children: [ Row( children: [ - Text( - S.of(context).huiyuanjia, - style: TextStyle( - color: Color(0xFFFF7A1A), - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox( - width: 4, - ), Text( "¥${widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price}", style: TextStyle( @@ -128,6 +138,24 @@ class _ShopGoods extends State { fontWeight: MyFontWeight.medium, ), ), + SizedBox(width: 2.w,), + Container( + width: 44.w, + height: 18.h, + decoration: BoxDecoration( + color: Color(0xFFFF4500), + borderRadius: BorderRadius.circular(2), + ), + alignment: Alignment.center, + child: Text( + "APP专享", + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), ], ), Spacer(), @@ -147,10 +175,10 @@ class _ShopGoods extends State { padding: EdgeInsets.symmetric(vertical: 5.h), callback: () { widget.queryMiNiDetail( - widget.productListBean != null - ? widget.productListBean.id - : widget.shoppingCartSkuItemListBean - .productId,0 + widget.productListBean != null + ? widget.productListBean.id + : widget.shoppingCartSkuItemListBean + .productId,0 ); }, ), @@ -210,6 +238,16 @@ class _ShopGoods extends State { ), ], ), + SizedBox(height: 4.h,), + Text( + "¥191.00", + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 12.sp, + decoration: TextDecoration.lineThrough, + fontWeight: MyFontWeight.regular, + ), + ), ], ), ), diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index fc56e83c..a3b7b183 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -25,24 +25,24 @@ class _StoreInfoView extends State { Widget build(BuildContext context) { return Container( margin: EdgeInsets.only( - left: 16.w, - right: 16.w, + // left: 16.w, + // right: 16.w, top: 5.h, bottom: 6.h, ), - height: 162.h, + height: 154.h, padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8.w), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(25), - offset: Offset(0, 3), - blurRadius: 3, - spreadRadius: 0, - ), - ], + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(25), + // offset: Offset(0, 3), + // blurRadius: 3, + // spreadRadius: 0, + // ), + // ], ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -91,11 +91,13 @@ class _StoreInfoView extends State { : "")), ), Text( - widget.storeInfo != null - ? widget.storeInfo.address - : "", - maxLines: 2, - textAlign: TextAlign.justify, + S.of(context).yingyeshijian(widget.storeInfo == null + ? "" + : (widget.storeInfo.openStartTime == null && + widget.storeInfo.openEndTime == null) + ? S.of(context).quantian + : "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} " + "- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"), style: TextStyle( color: Color(0xFF353535), fontWeight: MyFontWeight.regular, @@ -126,14 +128,12 @@ class _StoreInfoView extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ Expanded( - child: Text( - S.of(context).yingyeshijian(widget.storeInfo == null - ? "" - : (widget.storeInfo.openStartTime == null && - widget.storeInfo.openEndTime == null) - ? S.of(context).quantian - : "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} " - "- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"), + child:Text( + "${S.of(context).dizhi}:${widget.storeInfo != null + ? widget.storeInfo.address + : ""}", + maxLines: 2, + textAlign: TextAlign.justify, style: TextStyle( color: Color(0xFF353535), fontWeight: MyFontWeight.regular, @@ -176,6 +176,12 @@ class _StoreInfoView extends State { ), ], ), + Container( + width: double.infinity, + height: 1, + color: Color(0xFFF4F5F2), + margin: EdgeInsets.only(top: 16), + ) ], ), ); diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 0f4e50f4..1c157a00 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -21,7 +21,7 @@ class StoreOrderListPage extends StatefulWidget { final ScrollController controller; final String minToken; final String tenant; - final Function(String id,int count) queryMiNiDetail; + final Function(String id, int count) queryMiNiDetail; ShoppingCart shopCarGoods; @@ -31,8 +31,8 @@ class StoreOrderListPage extends StatefulWidget { this.storeInfo, this.shopCarGoods, this.controller, - this.minToken, - this.tenant, + this.minToken, + this.tenant, this.queryMiNiDetail, ); @@ -50,8 +50,7 @@ class _StoreOrderListPage extends State { List appletProducts; List productListBeans = []; - ScrollController controller1 = ScrollController(); - ScrollController controller2 = ScrollController(); + ScrollController controller = ScrollController(); @override void initState() { @@ -107,7 +106,7 @@ class _StoreOrderListPage extends State { width: 100.w, child: ListView.builder( itemCount: appletProducts == null ? 0 : appletProducts.length, - controller: controller1, + controller: controller, physics: BouncingScrollPhysics(), shrinkWrap: true, padding: EdgeInsets.only(top: 0, bottom: 25), @@ -124,7 +123,16 @@ class _StoreOrderListPage extends State { shrinkWrap: true, padding: EdgeInsets.zero, itemBuilder: (context, position) { - return goodsItem(position); + return GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pushNamed('/router/shop_details_page',arguments: { + "id":productListBeans[position].id, + }); + }); + }, + child: goodsItem(position), + ); }, ), ), @@ -231,18 +239,18 @@ class _StoreOrderListPage extends State { }); } return ShopGoods( - (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - widget.queryMiNiDetail(productListBeans[position].id,1); - }, - (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - if(count > 0) - widget.queryMiNiDetail(productListBeans[position].id,-1); - }, - productListBean: productListBeans[position], - count: count, - isShopCart: false, - queryMiNiDetail: widget.queryMiNiDetail, - shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, + (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { + widget.queryMiNiDetail(productListBeans[position].id, 1); + }, + (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { + if (count > 0) + widget.queryMiNiDetail(productListBeans[position].id, -1); + }, + productListBean: productListBeans[position], + count: count, + isShopCart: false, + queryMiNiDetail: widget.queryMiNiDetail, + shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, ); } } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 236385a0..ced3837b 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -45,11 +45,11 @@ class _UnionPage extends State final RefreshController refreshController = RefreshController(initialRefresh: false); final RefreshController refreshController1 = - RefreshController(initialRefresh: false); + RefreshController(initialRefresh: false); final RefreshController refreshController2 = - RefreshController(initialRefresh: false); + RefreshController(initialRefresh: false); final RefreshController refreshController3 = - RefreshController(initialRefresh: false); + RefreshController(initialRefresh: false); ApiService apiService; bool isKeyBoardShow = false; BMFCoordinate latLng; @@ -232,38 +232,44 @@ class _UnionPage extends State length: 4, child: Scaffold( appBar: MyAppBar( - title:"", - leading: false, - brightness: Brightness.light, + title: "", + leading: false, + brightness: Brightness.light, titleChild: PreferredSize( - preferredSize: Size(double.infinity, 38.h), - child: TabBar( - isScrollable: true, //可滚动 - indicatorColor: Color(0xff39B54A), - labelColor: Colors.black, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.normal, - ), - // controller: tabController, - //未选中文字颜色 - unselectedLabelColor: Color(0xffA29E9E), - indicatorSize: TabBarIndicatorSize.label, - //指示器与文字等宽 - tabs: [ - MyTab(text: S.of(context).quanbu), - MyTab(text:"吃"), - MyTab(text:"喝"), - MyTab(text:"玩"), - ], - ), - )), + preferredSize: Size(double.infinity, 38.h), + child: TabBar( + isScrollable: true, + //可滚动 + indicatorColor: Color(0xff39B54A), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.normal, + ), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text: S.of(context).quanbu), + MyTab(text: "吃"), + MyTab(text: "喝"), + MyTab(text: "玩"), + ], + ), + )), body: TabBarView( - children: [buildItem(refreshController),buildItem(refreshController1), buildItem(refreshController2),buildItem(refreshController3),], + children: [ + buildItem(refreshController), + buildItem(refreshController1), + buildItem(refreshController2), + buildItem(refreshController3), + ], ), ), ); @@ -366,7 +372,7 @@ class _UnionPage extends State onRefresh: () { startLocation(); }, - child:ListView.builder( + child: ListView.builder( itemCount: storeList == null ? 0 : storeList.length, padding: EdgeInsets.only( top: 8.h, @@ -378,6 +384,18 @@ class _UnionPage extends State onTap: () { if (storeList[position].posType.code == "NORMALSTORE") { showDeleteDialog(); + } else if (storeList[position].posType.code == + "RETAILSTORE" && + storeList[position].storeName == "一心回乡商城") { + Navigator.of(context).pushNamed( + '/router/shopping_mall_home', + arguments: { + "type": 0, + "id": storeList[position].id, + "tenant": storeList[position].tenantCode, + "storeName": storeList[position].storeName + }, + ); } else { Navigator.of(context).pushNamed( '/router/store_order', @@ -391,8 +409,7 @@ class _UnionPage extends State }, child: buildStoreItem(storeList[position], position), ); - }) - ), + })), ) ], ); @@ -542,7 +559,7 @@ class _UnionPage extends State ) ]), width: double.infinity, - height: 223, + height: 228, child: Stack( children: [ Positioned( @@ -574,7 +591,7 @@ class _UnionPage extends State left: 12, right: 0, child: Container( - height:95, + height: 100, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -588,9 +605,11 @@ class _UnionPage extends State errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", ), - SizedBox(width: 6.w,), - Expanded(child: - Column( + SizedBox( + width: 6.w, + ), + Expanded( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -625,20 +644,19 @@ class _UnionPage extends State width: 59.w, height: 18.h, alignment: Alignment.center, - margin: EdgeInsets.only(top:20.h), + margin: EdgeInsets.only(top: 20.h), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), + borderRadius: BorderRadius.circular(2), color: Color(0xFF32A060), - ), + ), child: Visibility( child: Text( (store.distance ?? 0) > 1000 ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100).toInt() / - 100.0) + ((store.distance ?? 0) / 1000 * 100).toInt() / + 100.0) : S.of(context).mi( - ((store.distance ?? 0) * 100).toInt() / - 100.0), + ((store.distance ?? 0) * 100).toInt() / 100.0), style: TextStyle( color: Color(0xFFFFFFFF), fontSize: 10.sp, diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index 1f16bb3a..4df2b639 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -7,11 +7,12 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class NewCouponWidget extends StatelessWidget { final Function(int type) callback; + // final Function couponDialog; final GestureTapCallback callbackEx; final Coupon coupon; final int type; - NewCouponWidget(this.coupon, this.callback, this.callbackEx, {this.type = 1}); + NewCouponWidget(this.coupon, this.callback,this.callbackEx, {this.type = 1}); @override Widget build(BuildContext context) { @@ -28,6 +29,158 @@ class NewCouponWidget extends StatelessWidget { // } return Container( + height: (coupon != null && coupon.isEx) ? 168.h : 151.h, + width: double.infinity, + margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 6.w, + height: double.infinity, + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(6), + bottomLeft: Radius.circular(6), + ), + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF32A060), + ) + ), + Expanded( + flex: 2, + child:Container( + margin: EdgeInsets.only(top: 12,left: 12,bottom: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "券名称:${coupon != null ? coupon.couponName ?? "" : ""}", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF0D0D0D), + ), + ), + SizedBox(height: 6,), + Expanded(child: + (coupon.useStartTime == null && + coupon.useEndTime == null)? + Text( + S.of(context).quantian, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), + ), + ):Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "有效期: ", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${coupon?.useStartTime ??""} ~", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), + ), + ), + Text( + "${coupon?.useEndTime ?? ""}", + maxLines:1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), + ), + ) + + ], + ) + ], + ),), + GestureDetector( + onTap: (){ + // showDeleteDialog(); + + }, + child: Row( + children: [ + Text( + "使用详情", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xFF4D4D4D), + ), + ), + Icon( + Icons.keyboard_arrow_right, + color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), + size: 20, + ) + ], + ), + ) + ], + ), + )), + Expanded( + flex: 1, + child:Container( + margin: EdgeInsets.only(top: 12,left: 12,bottom: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: Container( + child: priceWidget(context), + )), + Container( + margin: EdgeInsets.only(right: 23.w), + child: rightBtn(context), + ) + ], + ), + )), + ], + ), + ); + Container( height: (coupon != null && coupon.isEx) ? 168.h : 151.h, width: double.infinity, margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h), @@ -93,7 +246,7 @@ class NewCouponWidget extends StatelessWidget { ), Expanded( child: Text( - (coupon.storeId != "0" && coupon?.storeList != null && coupon.storeList.firstWhere((x) => x.id == coupon.storeId)!=null ? + (coupon.storeId != "0" && coupon?.storeList != null && coupon.storeList.isNotEmpty && coupon.storeList.firstWhere((x) => x.id == coupon.storeId)!=null ? coupon.storeList.firstWhere((x) => x.id == coupon.storeId).storeName : coupon.tenantName), overflow: TextOverflow.ellipsis, style: TextStyle( @@ -218,40 +371,38 @@ class NewCouponWidget extends StatelessWidget { Widget priceWidget(BuildContext context) { if (coupon.bizType == 1) { return Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, - children: [ - Text( - "¥", - style: TextStyle( - fontSize: 22.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xff32A060), - ), - ), - SizedBox( - height: 4.h, + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Text( + "¥", + style: TextStyle( + fontSize: 22.sp, + fontWeight: MyFontWeight.medium, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), - Text( - coupon != null - ? double.tryParse("${coupon.discountAmount}" ?? "0") - .toInt() - .toString() - : "", - style: TextStyle( - fontSize: 40.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), - ), + ), + SizedBox( + height: 4.h, + ), + Text( + coupon != null + ? double.tryParse("${coupon.discountAmount}" ?? "0") + .toInt() + .toString() + : "", + style: TextStyle( + fontSize: 40.sp, + fontWeight: MyFontWeight.semi_bold, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), - ], - ), + ), + ], ), Text( S.of(context).manyuankeyong(coupon != null @@ -261,26 +412,27 @@ class NewCouponWidget extends StatelessWidget { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], ); } else if (coupon.bizType == 3) { return Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( + Container( + padding: EdgeInsets.only(bottom:10,top: 7), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( S.of(context).duihuanquan, style: TextStyle( - fontSize: 25.sp, + fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], @@ -291,26 +443,27 @@ class NewCouponWidget extends StatelessWidget { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], ); } else if (coupon.bizType == 5) { return Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( + Container( + padding: EdgeInsets.only(bottom:10,top: 7), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( S.of(context).duihuanquan, style: TextStyle( - fontSize: 25.sp, + fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], @@ -321,53 +474,51 @@ class NewCouponWidget extends StatelessWidget { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], ); } else { return Column( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, - children: [ - Text( - coupon != null - ? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ?? - "0" - : "", - style: TextStyle( - fontSize: 40.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), - ), - ), - SizedBox( - height: 4.h, + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Text( + coupon != null + ? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ?? + "0" + : "", + style: TextStyle( + fontSize: 40.sp, + fontWeight: MyFontWeight.semi_bold, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), - Text( - "折", - style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), - ), + ), + SizedBox( + height: 4.h, + ), + Text( + "折", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.semi_bold, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), - ], - ), + ), + ], ), Text( S.of(context).quanchangtongyong, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: Color(0xff32A060), + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], @@ -430,22 +581,41 @@ class NewCouponWidget extends StatelessWidget { callback(type); }, child: Container( - padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h), + width: 64.w, + height: 19.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.5), color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(10), ), - child: Text( - (coupon.bizType == 5 || coupon.bizType == 3) - ? S.of(context).quhexiao - : S.of(context).qushiyong, + alignment: Alignment.center, + child:Text( + "立即使用", + maxLines: 1, + overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), ), ), ), + // Container( + // padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10.5), + // color: Color(0xFF32A060), + // ), + // child: Text( + // (coupon.bizType == 5 || coupon.bizType == 3) + // ? S.of(context).quhexiao + // : S.of(context).qushiyong, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.medium, + // color: Colors.white, + // ), + // ), + // ), ), ); } else if (coupon != null && coupon.status == 2) { @@ -474,18 +644,18 @@ class NewCouponWidget extends StatelessWidget { alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.5), - // border: Border.all( - // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid) - color: Color(0xFFA0A0A0), - ), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10.5), + // // border: Border.all( + // // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid) + // color: Color(0xFFA0A0A0), + // ), child: Text( S.of(context).yishixiao, style: TextStyle( fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFB3B3B3), ), ), ), diff --git a/lib/view_widget/selector_store_dialog.dart b/lib/view_widget/selector_store_dialog.dart index d1902a47..9c1214ba 100644 --- a/lib/view_widget/selector_store_dialog.dart +++ b/lib/view_widget/selector_store_dialog.dart @@ -3,6 +3,7 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/store.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/store/scan.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -24,6 +25,7 @@ class _SelectorStoreWidget extends State { @override Widget build(BuildContext context) { return Container( + width: double.infinity, height: ((widget.stores != null ? (widget.stores.length > 4 ? 4 : widget.stores.length) : 0.0) * @@ -32,156 +34,255 @@ class _SelectorStoreWidget extends State { 158.0.h, padding: EdgeInsets.only( top: 16.h, - left: 16.w, - right: 10.w, bottom: 16.h, ), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.horizontal( - left: Radius.circular(8), - right: Radius.circular(8), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - S.of(context).qingxuanzeshiyongmendian, - textAlign: TextAlign.left, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: FontWeight.bold, - ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + alignment: Alignment.center, + child: Text( + S.of(context).qingxuanzeshiyongmendian, + 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), + ], ), SizedBox( height: 12.h, ), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFF2F2F2), + margin: EdgeInsets.only(bottom: 11.h), + ), + Expanded(child: Container( height: (widget.stores != null - ? (widget.stores.length > 4 ? 4 : widget.stores.length) - : 0) * - 52.h, + ? (widget.stores.length > 4 ? 4 : widget.stores.length) + : 0) * + 60.h, child: ListView.builder( physics: BouncingScrollPhysics(), itemBuilder: (context, position) { - return storeItem(widget.stores[position], position); + return GestureDetector( + onTap: (){ + setState(() { + selectIndex = position; + }); + }, + child: storeItem(widget.stores[position], position), + ); }, itemCount: widget.stores != null ? widget.stores.length : 0, ), - ), - SizedBox( - height: 38.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: BorderText( - text: S.of(context).quxiao, - borderColor: Color(0xFF32A060), - textColor: Color(0xFF32A060), - radius: 4, - fontSize: 16.sp, - fontWeight: FontWeight.bold, - borderWidth: 1.w, - padding: EdgeInsets.symmetric( - vertical: 12.h, - horizontal: 42.w, - ), - ), - ), - SizedBox( - width: 13.w, + )), + GestureDetector( + onTap: (){ + if (widget.stores[selectIndex].posType.code == + "NORMALSTORE") { + Scan.toScan( + context, + widget.stores[selectIndex].id, + widget.stores[selectIndex].tenantCode, + widget.stores[selectIndex].storeName, + ); + } else { + Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": widget.stores[selectIndex].id, + "tenant": widget.stores[selectIndex].tenantCode, + "storeName": widget.stores[selectIndex].storeName + }, + ); + } + }, + child: Container( + width: double.infinity, + height: 40.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color:Color(0xFF32A060), ), - InkWell( - onTap: () { - if(widget.stores[selectIndex].posType.code == "NORMALSTORE") { - Scan.toScan( - context, - widget.stores[selectIndex].id, - widget.stores[selectIndex].tenantCode, - widget.stores[selectIndex].storeName, - ); - } else { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": widget.stores[selectIndex].id, - "tenant": widget.stores[selectIndex].tenantCode, - "storeName": widget.stores[selectIndex].storeName - }, - ); - } - - }, - child: RoundButton( - text: S.of(context).queding, - textColor: Colors.white, - backgroup: Color(0xFF32A060), - radius: 4, + alignment: Alignment.center, + margin: EdgeInsets.only(top: 14.h), + child: Text( + S.of(context).queding, + style: TextStyle( + fontWeight: MyFontWeight.bold, fontSize: 16.sp, - fontWeight: FontWeight.bold, - padding: EdgeInsets.symmetric( - vertical: 12.h, - horizontal: 42.w, - ), + color: Color(0xFFFFFFFF), ), ), - ], + ), ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // InkWell( + // onTap: () { + // Navigator.of(context).pop(); + // }, + // child: BorderText( + // text: S.of(context).quxiao, + // borderColor: Color(0xFF32A060), + // textColor: Color(0xFF32A060), + // radius: 4, + // fontSize: 16.sp, + // fontWeight: FontWeight.bold, + // borderWidth: 1.w, + // padding: EdgeInsets.symmetric( + // vertical: 12.h, + // horizontal: 42.w, + // ), + // ), + // ), + // SizedBox( + // width: 13.w, + // ), + // InkWell( + // onTap: () { + // if (widget.stores[selectIndex].posType.code == + // "NORMALSTORE") { + // Scan.toScan( + // context, + // widget.stores[selectIndex].id, + // widget.stores[selectIndex].tenantCode, + // widget.stores[selectIndex].storeName, + // ); + // } else { + // Navigator.of(context).pushNamed( + // '/router/store_order', + // arguments: { + // "id": widget.stores[selectIndex].id, + // "tenant": widget.stores[selectIndex].tenantCode, + // "storeName": widget.stores[selectIndex].storeName + // }, + // ); + // } + // }, + // child: RoundButton( + // text: S.of(context).queding, + // textColor: Colors.white, + // backgroup: Color(0xFF32A060), + // radius: 4, + // fontSize: 16.sp, + // fontWeight: FontWeight.bold, + // padding: EdgeInsets.symmetric( + // vertical: 12.h, + // horizontal: 42.w, + // ), + // ), + // ), + // ], + // ), ], ), ); } Widget storeItem(Store store, position) { - return Container( - height: 52.h, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + return Container( + height:52 , + margin: EdgeInsets.only(bottom: 12,left: 14,right: 14), + child: Stack( + alignment: Alignment.bottomRight, children: [ - MImage( - store.logo, - width: 28.w, - height: 28.h, - fit: BoxFit.cover, - radius: BorderRadius.circular(2), - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - SizedBox( - width: 12.w, - ), - Expanded( - flex: 1, + Container( + height: 52.h, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: new BorderRadius.circular(6), + border: Border.all( + color: position == selectIndex ? Color(0xFF32A060):Color(0xFFF7F7F7), + width: position == selectIndex ? 1 :0, + ), + color: position == selectIndex ? Color(0xFFF0FAF4) :Color(0xFFF7F7F7), + ), + alignment: Alignment.centerLeft, + padding: EdgeInsets.only(left: 12, bottom: 16, top: 16), child: Text( store.storeName, style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, + fontWeight: MyFontWeight.bold, + fontSize: 15.sp, + color: position == selectIndex ?Color(0xFF32A060) : Color(0xFF0D0D0D), ), ), ), - Checkbox( - value: position == selectIndex, - onChanged: (value) { - setState(() { - selectIndex = position; - }); - }, - checkColor: Color(0xFFFFFFFF), - fillColor: MaterialStateProperty.all(Color(0xFF39B54A)), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: CircleBorder(), + if (position == selectIndex) + Image.asset( + "assets/image/recharge.webp", + width: 20.w, + height: 20.h, ), + // MImage( + // store.logo, + // width: 28.w, + // height: 28.h, + // fit: BoxFit.cover, + // radius: BorderRadius.circular(2), + // errorSrc: "assets/image/default_1.webp", + // fadeSrc: "assets/image/default_1.webp", + // ), + // SizedBox( + // width: 12.w, + // ), + // Expanded( + // flex: 1, + // child: Text( + // store.storeName, + // style: TextStyle( + // color: Color(0xFF353535), + // fontSize: 16.sp, + // ), + // ), + // ), + // Checkbox( + // value: position == selectIndex, + // onChanged: (value) { + // setState(() { + // selectIndex = position; + // }); + // }, + // checkColor: Color(0xFFFFFFFF), + // fillColor: MaterialStateProperty.all(Color(0xFF39B54A)), + // materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + // shape: CircleBorder(), + // ), ], ), );