diff --git a/lib/address/edit_address_page.dart b/lib/address/edit_address_page.dart index b7e550f5..a89c5c57 100644 --- a/lib/address/edit_address_page.dart +++ b/lib/address/edit_address_page.dart @@ -82,7 +82,7 @@ class _EditAddressPage extends State { bottomRight: Radius.circular(8), ), ), - child: Column( + child: Expanded(child:Column( children: [ editItem( S.of(context).xingming, @@ -114,7 +114,8 @@ class _EditAddressPage extends State { houseNumberController, false), ], - ), + ),), + ), InkWell( onTap: () { diff --git a/lib/article/hot_article_item.dart b/lib/article/hot_article_item.dart index da2e7b54..921bb401 100644 --- a/lib/article/hot_article_item.dart +++ b/lib/article/hot_article_item.dart @@ -1,26 +1,31 @@ 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/banner.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/hot_item.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.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 HotArticlePage extends StatefulWidget { +class TouTiao extends StatefulWidget { @override State createState() { - return _HotArticlePage(); + return _TouTiao(); } } -class _HotArticlePage extends State { +class _TouTiao extends State { ApiService apiService; + List bannerData = []; @override void dispose() { @@ -33,9 +38,9 @@ class _HotArticlePage extends State { super.initState(); SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), context: context, token: value.getString("token")), - queryArticle(), - }); + apiService = ApiService(Dio(), context: context, token: value.getString("token")), + queryArticle(), + }); } int pageNum = 1; @@ -78,6 +83,33 @@ class _HotArticlePage extends State { } } + ///banner + queryCourseBanner() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.queryBanner({ + "model": {"type": "COURSE_BANNER"}, + }).catchError((onError) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + bannerData.clear(); + bannerData.addAll(baseData.data.records); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -89,35 +121,40 @@ class _HotArticlePage extends State { // titleSize: 18.sp, // ), body: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: true, - physics: BouncingScrollPhysics(), - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: _onRefresh, - onLoading: queryArticle, - child: ListView.builder( - itemCount: articles.length, - physics: NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - itemBuilder: (context, position) { - return AspectRatio( - aspectRatio: position == 0 ? 1.38 : 2.56, - child: Container( - height: position == 0 ? 247.h : 96.h, - margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w), - child: - HotArticleItem(article: articles[position], isHot: position == 0), - ), - ); - }, - ), + child: Column( + children: [ + + SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: queryArticle, + child: ListView.builder( + itemCount: articles.length, + physics: NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + itemBuilder: (context, position) { + return AspectRatio( + aspectRatio: position == 0 ? 1.38 : 2.56, + child: Container( + height: position == 0 ? 247.h : 96.h, + margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w), + child: + HotArticleItem(article: articles[position], isHot: position == 0), + ), + ); + }, + ), + ), + ], ), ), ); diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index a67e7df8..399124ff 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:huixiang/article/hot_article_item.dart'; import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -8,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'community_course.dart'; +import 'headlines/article_page.dart'; class CommunityPage extends StatefulWidget { @override @@ -97,7 +97,7 @@ class _CommunityPage extends State if (e == "关于我们") { return BrandPage(); }else if(e == "头条"){ - return HotArticlePage(); + return ArticlePage(); }else if(e == "课程"){ return CommunityCourse(); } diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index d1e0742c..d97f7d26 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -335,7 +335,6 @@ class _ClassDetails extends State with WidgetsBindingObserver { ), flex: 1, ), - /// 富文本评论的输入框 InputComment( inputKey, diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index 937a949d..6a26b38e 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -225,7 +225,6 @@ class _HomeClass extends State { ), ), ],), - ], ), Expanded(child: diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart new file mode 100644 index 00000000..8560deac --- /dev/null +++ b/lib/community/headlines/article_list.dart @@ -0,0 +1,176 @@ +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/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.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/custom_image.dart'; +import 'package:huixiang/view_widget/hot_item.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.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 ArticleList extends StatefulWidget { + final List
articles; + + ArticleList(this.articles,); + + @override + State createState() { + return _ArticleList(); + } +} + +class _ArticleList extends State { + ApiService apiService; + + @override + void initState() { + super.initState(); + + SharedPreferences.getInstance().then((value) => { + apiService = ApiService(Dio(), + context: context, token: value.getString("token")), + }); + } + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top:20,left:16,right: 16), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding(padding:EdgeInsets.only(bottom: 12), + child:Text( + "最新文章", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + )), + ListView.builder( + padding: EdgeInsets.zero, + itemCount: widget.articles.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', + arguments: {"articleId": widget.articles[position].id}); + widget.articles[position].viewers = (widget.articles[position].viewers + 1); + setState(() {}); + }, + child: articleItem(widget.articles[position],position), + ); + }, + ), + ], + )); + } + + Widget articleItem(Article articles,position) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(16), + margin: EdgeInsets.only(bottom: 12), + color: Colors.white, + child:Row( + children: [ + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + widget?.articles[position]?.mainTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + SizedBox(height:5), + Text( + widget?.articles[position]?.viceTitle ?? "", + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 10), + Row( + children: [ + Text( + (widget.articles[position] != null && + widget.articles[position].author != null) + ? widget.articles[position].author.name + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF8E8E8E), + ), + ), + SizedBox(width:8), + Image.asset( + "assets/image/browse.png", + width: 14, + height: 14, + color: Color(0xFF808080), + ), + Expanded(child: Text( + "${widget?.articles[position]?.viewers}" + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + )), + Text( + widget?.articles[position]?.createTime?.split(" ")[0] + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + ), + ], + ), + ], + ),), + SizedBox(width:12), + MImage( + widget?.articles[position]?.coverImg ?? "", + fit: BoxFit.cover, + radius: BorderRadius.all(Radius.circular(2)), + width:96, + height:96, + ), + ], + ), + ); + } + +} diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart new file mode 100644 index 00000000..8785cb79 --- /dev/null +++ b/lib/community/headlines/article_page.dart @@ -0,0 +1,239 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/community/headlines/headlines_banner.dart'; +import 'package:huixiang/community/headlines/headlines_collection.dart'; +import 'package:huixiang/main.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/brand.dart'; +import 'package:huixiang/retrofit/data/category_select_list.dart'; +import 'package:huixiang/retrofit/data/collect_class_list.dart'; +import 'package:huixiang/retrofit/data/course_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list_details.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/store_title_tab.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'article_list.dart'; + +class ArticlePage extends StatefulWidget { + @override + State createState() { + return _ArticlePage(); + } +} + +class _ArticlePage extends State + with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { + final ScrollController scrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); + + ApiService apiService; + List globaKeys = []; + List brands = []; + List bannerData = []; + List
articles = []; + List headlines = []; + int pageNum = 1; + + @override + void initState() { + super.initState(); + + eventBus.on().listen((event) { + print("object: ArticlePage"); + if (event.type < 3) { + setState(() {}); + } + }); + queryArticleList(); + queryHeadlinesBanner(); + queryHeadlinesList(); + } + + @override + void dispose() { + super.dispose(); + refreshController.dispose(); + } + + ///banner + queryHeadlinesBanner() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.queryBanner({ + "model": {"type": "INFORMATION"}, + }).catchError((onError) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + bannerData.clear(); + bannerData.addAll(baseData.data.records); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + EasyLoading.dismiss(); + } + + ///文章列表 + queryArticleList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.queryArticle({ + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "", + "state": 1, + "type": 2 + }).catchError((onError){ + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (baseData != null && baseData.isSuccess) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + if(pageNum == 1) { + articles.clear(); + } + articles.addAll(baseData.data.list); + if (baseData.data.pageNum == baseData.data.pages) { + refreshController.loadNoData(); + } else { + pageNum += 1; + } + setState(() {}); + } else { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + } + + ///文章合集列表 + queryHeadlinesList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.headlinesList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlines.clear(); + headlines.addAll(baseData.data); + headlines.forEach((element) { + // collectCourse(element.id); + }); + }); + } + EasyLoading.dismiss(); + } + + _onRefresh(){ + queryHeadlinesBanner(); + queryHeadlinesList();//分类列表 + } + + @override + Widget build(BuildContext context) { + super.build(context); + return + Stack( + children: [ + Positioned( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: ClampingScrollPhysics(), + onRefresh: _onRefresh, + scrollController: scrollController, + child: Container( + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Container( + color: Color(0xFFF7F7F7), + margin: EdgeInsets.only(top: 16.h), + child: Column( + children: classChildItem(), + ), + ), + ), + ), + ), + ), + bottom:0, + top: 0, + left: 0, + right: 0, + ), + if (brands != null && brands.length > 0) + Positioned( + child: Container( + color: Colors.white, + child: StoreTitleTab( + brands, + globaKeys, + scrollController, + isScroll: true, + ), + ), + top: 0, + left: 0, + right: 0, + ), + ], + ); + } + + List classChildItem() { + var widgets = [ + ///课程banner + HeadlinesBanner(bannerData,), + + SizedBox(height: 28), + + ///头条合集列表 + HeadlinesCollection(headlines,articles), + + ///文章列表 + ArticleList(articles), + + + ]; + + return widgets; + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/community/headlines/headlines_banner.dart b/lib/community/headlines/headlines_banner.dart new file mode 100644 index 00000000..09a7401b --- /dev/null +++ b/lib/community/headlines/headlines_banner.dart @@ -0,0 +1,119 @@ + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +class HeadlinesBanner extends StatefulWidget { + + final List bannerData; + + HeadlinesBanner(this.bannerData); + + @override + State createState() { + return _HeadlinesBanner(); + } + +} + +class _HeadlinesBanner extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + List bannerData = []; + + + @override + Widget build(BuildContext context) { + return Container( + child: AspectRatio( + aspectRatio: 2.08, + child: Swiper( + viewportFraction: 0.88, + scale: 0.93, + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + bannerClick(widget.bannerData[position]); + }, + child: MImage( + (widget.bannerData != null && position < widget.bannerData.length) + ? widget.bannerData[position].imgUrl + : "", + fit: BoxFit.cover, + radius: BorderRadius.circular(8), + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + ); + }, + itemCount: (widget.bannerData != null && widget.bannerData.length > 0) + ? widget.bannerData.length + : 1), + ), + ); + } + + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) + bannerClick(BannerData bannerData) async { + switch (bannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": bannerData.content}); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "activityId": bannerData.content, + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "articleId": bannerData.content, + }); + break; + case 4: + String router = bannerData.content; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?")); + params = params.replaceAll("?", ""); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed(router, arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context) + .pushNamed('/router/class_details', arguments: { + "id": bannerData.content, + }); + break; + } + } +} + + + + + + + diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart new file mode 100644 index 00000000..c14f1bbd --- /dev/null +++ b/lib/community/headlines/headlines_collection.dart @@ -0,0 +1,166 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/collect_class_list.dart'; +import 'package:huixiang/retrofit/data/course_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class HeadlinesCollection extends StatefulWidget { + final List headlines; + final List
articles; + + HeadlinesCollection(this.headlines,this.articles); + + @override + State createState() { + return _HeadlinesCollection(); + } +} + +class _HeadlinesCollection extends State { + ApiService apiService; + BMFCoordinate latLng; + + final TextEditingController editingController = TextEditingController(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + height: 100, + margin: EdgeInsets.only(top:10), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 10), + itemCount:widget.headlines == null ? 0 : widget.headlines.length, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/headlines_column_details', + arguments: {"id":widget.headlines[position].id, + "articles":widget.articles}); + }, + child: headlinesCollectionItem(widget.headlines[position]), + ); + }, + ), + ); + } + + Widget headlinesCollectionItem(HeadlinesList headlines) { + return Container( + width: 225.w, + height:110.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.black, + ), + margin: EdgeInsets.symmetric( + horizontal:6, + ), + child: Stack( + children: [ + ClipRRect( + child: Opacity( + opacity: 0.8, + child: MImage( + headlines?.coverImg ?? "", + width: 225.w, + height: 110.h, + fit: BoxFit.fill, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + ), + ), + Container( + padding: EdgeInsets.all(12), + child: Column(children: [ + Expanded(child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height: 16.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + Expanded(child:Text( + headlines?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ),), + ],)), + Row( + children: [ + Expanded(child:Text( + "更新3篇", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + )), + Text( + "查看专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + SizedBox(width: 2), + Image.asset( + "assets/image/t_right.png", + width: 14, + height: 14, + ), + ],), + ],), + ), + ], + ), + ); + } +} diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart new file mode 100644 index 00000000..c15bb927 --- /dev/null +++ b/lib/community/headlines/headlines_column_details.dart @@ -0,0 +1,344 @@ +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/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list_details.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class HeadlinesColumnDetails extends StatefulWidget { + final Map arguments; + + HeadlinesColumnDetails({this.arguments}); + + @override + State createState() { + return _HeadlinesColumnDetails(); + } +} + +class _HeadlinesColumnDetails extends State + with WidgetsBindingObserver { + ApiService apiService; + List
articles; + HeadlinesListDetails headlinesListDetails; + List headlines = []; + + @override + void initState() { + super.initState(); + articles = widget.arguments["articles"]; + WidgetsBinding.instance.addObserver(this); + queryHeadlinesDetails(widget.arguments["id"]); + queryHeadlinesList(widget.arguments["id"]); + } + + ///文章合集详情 + queryHeadlinesDetails(id) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = + await apiService.headlinesDetails(id).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlinesListDetails = baseData.data; + }); + } + } + + ///文章合集列表 + queryHeadlinesList(id) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.headlinesList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlines.clear(); + headlines.addAll(baseData.data); + headlines.forEach((element) { + // collectCourse(element.id); + }); + }); + } + EasyLoading.dismiss(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + Stack( + alignment: Alignment.bottomCenter, + children: [ + Stack( + children: [ + Positioned(child: + MImage( + headlinesListDetails?.coverImg ?? "", + width:double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], + ), + Container( + child: Column( + children: [ + Padding(padding:EdgeInsets.only(left: 16), + child:Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:20.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + SizedBox( + width: 6.w, + ), + Expanded( + child: Text( + headlinesListDetails?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + flex: 1, + ) + ], + ),), + Container( + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.white, + ), + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + margin: EdgeInsets.only(top: 16), + // padding: EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding:EdgeInsets.all(16), + child: Text( + "简介:${headlinesListDetails?.introduce ?? ""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium , + color: Colors.black, + ), + )), + ], + ), + ), + ], + ), + ), + ], + ), + ListView.builder( + padding: EdgeInsets.zero, + itemCount:headlines == null ? 0 : headlines.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', + arguments: {"articleId": articles[position].id}); + articles[position].viewers = (articles[position].viewers + 1); + setState(() {} + ); + }, + child: articleColumnItem(articles[position]), + ); + }, + ), + ], + ), + ), + flex: 1, + ), + ], + ), + ), + ); + } + + Widget articleColumnItem(Article articles) { + return Container( + width: double.infinity, + // padding: EdgeInsets.all(16), + color: Colors.white, + child:Column( + children: [ + Container( + // margin: EdgeInsets.only(top: 16,bottom: 16), + width: double.infinity, + height: 0.5.h, + color: Color(0xFFF5F5F5), + ), + Padding(padding: EdgeInsets.all(16), + child:Row( + children: [ + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + articles?.mainTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + SizedBox(height:5), + Text( + articles?.viceTitle ?? "", + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 10), + Row( + children: [ + Text( + (articles != null && + articles.author != null) + ? articles.author.name + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF8E8E8E), + ), + ), + SizedBox(width:8), + Image.asset( + "assets/image/browse.png", + width: 14, + height: 14, + color: Color(0xFF808080), + ), + Expanded(child: Text( + "${articles?.viewers}" + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + )), + Text( + articles?.createTime ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + ), + ], + ), + ], + ),), + SizedBox(width:12), + MImage( + articles?.coverImg ?? "", + fit: BoxFit.cover, + radius: BorderRadius.all(Radius.circular(2)), + width:96, + height:96, + ), + ], + )), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 2d7f74fa..c5af21f7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -71,6 +71,7 @@ import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'community/community_view/class_details.dart'; +import 'community/headlines/headlines_column_details.dart'; import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; import 'main_page.dart'; @@ -298,7 +299,7 @@ Map routers = { '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), '/router/edit_remarks_page': (context, {arguments}) => EditRemarksPage(), - '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), + // '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), '/router/address_map_page': (context, {arguments}) => AddressMapPage(), '/router/roll_center_page': (context, {arguments}) => RollCenterPage(), '/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(), @@ -324,4 +325,5 @@ Map routers = { '/router/activity_list': (context, {arguments}) => ActivityList(), '/router/class_details': (context, {arguments}) => ClassDetails(arguments: arguments), '/router/mine_attainment_page': (context, {arguments}) => MineAttainmentPage(arguments: arguments), + '/router/headlines_column_details': (context, {arguments}) => HeadlinesColumnDetails(arguments: arguments), }; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index c0e69e05..5fbcc9d8 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -196,10 +196,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { tag: "vip", ranks: ranks, userInfo: userInfo, - rank: (userInfo != null) - ? int.tryParse(userInfo.expendAmount) - : 0, - rankMax: userInfo?.memberRankVo?.rankOrigin??0, + rank: double.tryParse(userInfo?.expendAmount??"0").toInt(), + rankMax: userInfo?.memberRankVo?.nextOrigin??0, createTime: userInfo?.createTime??"", ), ], diff --git a/lib/mine/mine_vip/legal_right_details.dart b/lib/mine/mine_vip/legal_right_details.dart index 6cc6eff0..89fc8c3a 100644 --- a/lib/mine/mine_vip/legal_right_details.dart +++ b/lib/mine/mine_vip/legal_right_details.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -37,6 +39,7 @@ class _LegalRightDetails extends State { int checkIndex = 0; ScrollController _scrollController = ScrollController(); List secondCardList = []; + bool offsetOnEnd = false; @override void initState() { @@ -45,7 +48,7 @@ class _LegalRightDetails extends State { apiService = ApiService(Dio(), context: context, token: value.getString("token")); }); - vipBenefitList = widget.arguments["vipBenefitList"]; + vipBenefitList.addAll(widget.arguments["vipBenefitList"]); querySecondCardList(); } @@ -59,12 +62,13 @@ class _LegalRightDetails extends State { token: value.getString("token"), ); } - BaseData> baseData = await apiService.secondCardList().catchError((onError) {}); + BaseData> baseData = + await apiService.secondCardList().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { secondCardList.clear(); secondCardList.addAll(baseData.data); - if(secondCardList.length < 5){ + if (secondCardList.length < 5) { var isSecondCard = SecondCardList(); isSecondCard.isAdd = true; secondCardList.add(isSecondCard); @@ -74,7 +78,6 @@ class _LegalRightDetails extends State { EasyLoading.dismiss(); } - ///解绑副卡 queryUnbindSecondCard(phone) async { if (apiService == null) { @@ -110,18 +113,18 @@ class _LegalRightDetails extends State { Container( height: 130, padding: EdgeInsets.only(top: 24), - margin: EdgeInsets.only( - left: (MediaQuery.of(context).size.width / 2 - - 48 - - checkIndex * 85) < - 0 - ? 0 - : (MediaQuery.of(context).size.width / 2 - - 48 - - checkIndex * 85)), + // margin: EdgeInsets.only( + // left: (MediaQuery.of(context).size.width / 2 - + // 48 - + // checkIndex * 85) < + // 0 + // ? 0 + // : (MediaQuery.of(context).size.width / 2 - + // 48 - + // checkIndex * 85)), child: ListView.builder( scrollDirection: Axis.horizontal, - physics: BouncingScrollPhysics(), + physics: NeverScrollableScrollPhysics(), controller: _scrollController, shrinkWrap: true, padding: EdgeInsets.symmetric(horizontal: 10), @@ -130,9 +133,30 @@ class _LegalRightDetails extends State { return GestureDetector( onTap: () { setState(() { - checkIndex = position; - // _scrollController.animateTo((MediaQuery.of(context).size.width/2-48-checkIndex*85) - // >0?0:checkIndex*85, duration: new Duration(seconds: 1), curve: Curves.ease); + if (checkIndex == position) return; + offsetOnEnd = position - checkIndex < 0 && position != 0; + int jumpIndex = (position - checkIndex).abs(); + int maxCountInWidth = + MediaQuery.of(context).size.width ~/ 80; + int tempPosition = checkIndex; + for (var i = 0; i < jumpIndex; i++) { + if (position - checkIndex < 0) + tempPosition -= 1; + else + tempPosition += 1; + checkIndex = tempPosition; + if (tempPosition <= + vipBenefitList.length - maxCountInWidth) { + if (tempPosition != 0) + _scrollController.jumpTo((_scrollController.offset + + (offsetOnEnd ? -85 : 85)) + .toDouble()); + } else { + _scrollController.jumpTo( + ((vipBenefitList.length - maxCountInWidth) * 85) + .toDouble()); + } + } }); }, child: legalRightItem(vipBenefitList[position], position), @@ -140,28 +164,8 @@ class _LegalRightDetails extends State { }, ), ), - Container( - alignment: Alignment.center, - width: 33, - height: 16, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0, - color: Color(0xFFFFF6E9), - ), - ), - ), - child: Image.asset( - "assets/image/jian_j.png", - width: 33, - height: 16, - color: Color(0xFFFFF6E9), - fit: BoxFit.fill, - ), - ), - Expanded(child: Container( - padding: EdgeInsets.only(left: 16, right: 49), + Expanded( + child: Container( decoration: BoxDecoration( border: Border.all( width: 0, @@ -244,82 +248,48 @@ class _LegalRightDetails extends State { ), ], ), - Text( - S.of(context).quanyijishao, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), - ), - ), - SizedBox( - height: 8.h, - ), - if (vipBenefitList[checkIndex]?.introduce != null && - vipBenefitList[checkIndex].introduce != "") - Container( - color: Color(0xFFFFF6E9), - child: Html( - data: vipBenefitList[checkIndex]?.describes ?? "", - style: { - "html": Style( - color: Color(0xFF674119), - ), - }, - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, - ), - ), - SizedBox( - height: 20, - ), - Text( - S.of(context).quanyishuoming, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), - ), - ), - SizedBox( - height: 8, - ), - if (vipBenefitList[checkIndex]?.describes != null && - vipBenefitList[checkIndex].describes != "") - Container( - color: Color(0xFFFFF6E9), - child: Html( - data: vipBenefitList[checkIndex]?.describes ?? "", - style: { - "html": Style( - color: Color(0xFF674119), - ), - }, - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, - ), - ), - SizedBox( - height: 20, - ), - if(vipBenefitList[checkIndex].name == "副卡" && vipBenefitList[checkIndex].actived && vipBenefitList[checkIndex].have) Container( + padding: EdgeInsets.only(left: 16, right: 49), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "${S.of(context).yibangfuka}(${secondCardList.length - (secondCardList.length >= 5 && !(secondCardList.last.isAdd ?? false) ? 0 :1 )}/5)", + S.of(context).quanyijishao, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF674119), + ), + ), + SizedBox( + height: 8.h, + ), + if (vipBenefitList[checkIndex]?.introduce != null && + vipBenefitList[checkIndex].introduce != "") + Container( + color: Color(0xFFFFF6E9), + child: Html( + data: vipBenefitList[checkIndex]?.describes ?? "", + style: { + "html": Style( + color: Color(0xFF674119), + ), + }, + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + SizedBox( + height: 20, + ), + Text( + S.of(context).quanyishuoming, style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, @@ -329,7 +299,52 @@ class _LegalRightDetails extends State { SizedBox( height: 8, ), - assistant(), + if (vipBenefitList[checkIndex]?.describes != null && + vipBenefitList[checkIndex].describes != "") + Container( + color: Color(0xFFFFF6E9), + child: Html( + data: vipBenefitList[checkIndex]?.describes ?? "", + style: { + "html": Style( + color: Color(0xFF674119), + ), + }, + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + SizedBox( + height: 20, + ), + if (vipBenefitList[checkIndex].name == "副卡" && + vipBenefitList[checkIndex].actived && + vipBenefitList[checkIndex].have) + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "${S.of(context).yibangfuka}(${secondCardList.length - (secondCardList.length >= 5 && !(secondCardList.last.isAdd ?? false) ? 0 : 1)}/5)", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF674119), + ), + ), + SizedBox( + height: 8, + ), + assistant(), + ], + ), + ), ], ), ), @@ -432,100 +447,124 @@ class _LegalRightDetails extends State { ///权益列表 Widget legalRightItem(VipBenefitList vipBenefitList, index) { - return Opacity( - opacity: index == checkIndex ? 1 : 0.6, - child: Container( - width: 80, - alignment: Alignment.center, - child: Column( - children: [ - Stack( - alignment: Alignment.bottomCenter, + return Column( + children: [ + Expanded( + child: Opacity( + opacity: index == checkIndex ? 1 : 0.6, + child: Container( + width: 80, + alignment: Alignment.center, + child: Column( children: [ - MImage( - vipBenefitList?.icon ?? "", - width: 50, - height: 50, - // fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - if(!vipBenefitList.actived) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), + Stack( + alignment: Alignment.bottomCenter, + children: [ + MImage( + vipBenefitList?.icon ?? "", + width: 50, + height: 50, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - width: 52.w, - height: 15.h, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.lock, - color: Color(0xFFFFDCA1), - size: 10, + if (!vipBenefitList.actived) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), ), - Text( - "暂未开放", - style: TextStyle( - color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, - ), + width: 52.w, + height: 15.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.lock, + color: Color(0xFFFFDCA1), + size: 10, + ), + Text( + "暂未开放", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], ), - ], - ), - ), - if(!vipBenefitList.actived && !vipBenefitList.have) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), - ), - width: 52.w, - height: 15.h, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.lock, - color: Color(0xFFFFDCA1), - size: 10, + ), + if (!vipBenefitList.actived && !vipBenefitList.have) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), ), - Text( - "暂未解锁", - style: TextStyle( - color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, - ), + width: 52.w, + height: 15.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.lock, + color: Color(0xFFFFDCA1), + size: 10, + ), + Text( + "暂未解锁", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], ), - ], - ), + ), + ], + ), + SizedBox( + height: 8.h, + ), + Text( + vipBenefitList.name, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, ), + ), ], ), - - SizedBox( - height: 8.h, - ), - Text( - vipBenefitList.name, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, + ), + )), + if (index == checkIndex) + Container( + width: 33, + height: 16, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0, + color: Color(0xFFFFF6E9), + ), ), ), - ], - ), - ), + child: Image.asset( + "assets/image/jian_j.png", + width: 33, + height: 16, + color: Color(0xFFFFF6E9), + fit: BoxFit.fill, + ), + ), + ], ); } @@ -534,7 +573,7 @@ class _LegalRightDetails extends State { return Column( children: [ GridView.builder( - itemCount:secondCardList == null ? 0 : secondCardList.length, + itemCount: secondCardList == null ? 0 : secondCardList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -561,73 +600,74 @@ class _LegalRightDetails extends State { Widget assistantItem(SecondCardList secondCardList) { return Container( alignment: Alignment.center, - child: !(secondCardList.isAdd ?? false) ? Column( - children: [ - Stack( - alignment: Alignment.bottomRight, - children: [ - MImage( - secondCardList?.headimg ?? "", - width: 50, - height: 50, - isCircle: true, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - GestureDetector( - onTap: () { - setState(() { - unbindShowDeleteDialog(secondCardList.phone); - }); - }, - child: Image.asset( - "assets/image/fuka_j.png", - width: 24, - height: 24, - fit: BoxFit.cover, + child: !(secondCardList.isAdd ?? false) + ? Column( + children: [ + Stack( + alignment: Alignment.bottomRight, + children: [ + MImage( + secondCardList?.headimg ?? "", + width: 50, + height: 50, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + GestureDetector( + onTap: () { + setState(() { + unbindShowDeleteDialog(secondCardList.phone); + }); + }, + child: Image.asset( + "assets/image/fuka_j.png", + width: 24, + height: 24, + fit: BoxFit.cover, + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5.h, - ), - Text( - AppUtils.phoneEncode(secondCardList?.phone ?? ""), - style: TextStyle( - color: Color(0xFF79572D), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - ], - ): - GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed('/router/binding_assistant_card').then((value) =>{ - querySecondCardList() - }); - }, - child:Column( - children: [ - Image.asset( - "assets/image/fuka_zj.png", - width:50, - height:50, - fit: BoxFit.cover, - ), - Text( - "添加新副卡", - style: TextStyle( - color: Color(0xFF79572D), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, + SizedBox( + height: 5.h, + ), + Text( + AppUtils.phoneEncode(secondCardList?.phone ?? ""), + style: TextStyle( + color: Color(0xFF79572D), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], + ) + : GestureDetector( + onTap: () { + Navigator.of(context) + .pushNamed('/router/binding_assistant_card') + .then((value) => {querySecondCardList()}); + }, + child: Column( + children: [ + Image.asset( + "assets/image/fuka_zj.png", + width: 50, + height: 50, + fit: BoxFit.cover, + ), + Text( + "添加新副卡", + style: TextStyle( + color: Color(0xFF79572D), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], ), ), - ], - ), - ), ); } } diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart index 44888956..208c52b9 100644 --- a/lib/mine/mine_vip/mine_attainment_page.dart +++ b/lib/mine/mine_vip/mine_attainment_page.dart @@ -38,6 +38,7 @@ class _MineAttainmentPage extends State { int checkPosition = 0; SocialInfo infoNumber; + @override void dispose() { super.dispose(); @@ -132,7 +133,7 @@ class _MineAttainmentPage extends State { child: Scaffold( backgroundColor: Colors.transparent, appBar: MyAppBar( - title: "我的成就", + title:S.of(context).wodechengjiu, titleColor: Colors.black, titleSize: 18.sp, background: Colors.transparent, @@ -299,7 +300,7 @@ class _MineAttainmentPage extends State { return AlertDialog( content: Container( width: MediaQuery.of(context).size.width - 84, - height: 410.h, + height: 430.h, child: Column( children: [ GestureDetector( @@ -318,7 +319,8 @@ class _MineAttainmentPage extends State { ), ), MImage( - this.vipBadgesList[index].icon, + // this.vipBadgesList[index].icon, + achievementDetail[checkPosition].icon, width: 150, height: 150, fit: BoxFit.cover, @@ -360,27 +362,28 @@ class _MineAttainmentPage extends State { color: Color(0xFF515151)), ), SizedBox(width: 8), - Image.asset( - "assets/image/icon_gold_coin.png", - width: 14, - height: 14, - fit: BoxFit.cover, - ), - SizedBox(width: 4), - Text( - vipBadgesList[index].eachReward.toString(), - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF515151)), + Column( + crossAxisAlignment:CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: + achievementDetail[checkPosition].rewardList != null + ? achievementDetail[checkPosition].rewardList.map((e) { + return Text( + rewardStr(e), + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF515151)), + ); + }).toList() + : [], ), ], ), - SizedBox(height: 5), Expanded( child: Container( height: double.maxFinite, - margin: EdgeInsets.only(top: 24), + margin: EdgeInsets.only(top:14), child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, @@ -411,6 +414,16 @@ class _MineAttainmentPage extends State { ); } + String rewardStr(RewardList rewardList){ + if(rewardList.rewardType == 1) + return "积分:${rewardList.refId}"; + else if(rewardList.rewardType == 2) + return "平台余额:${rewardList.refId}"; + else if(rewardList.rewardType == 3) + return "平台兑换券:${rewardList.couponName}"; + return ""; + } + ///徽章级别列表 Widget badgeGradeItem( AchievementDetailList achievementDetail, var position, var size) { diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index c442a0c1..da6fae11 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -47,13 +47,16 @@ class _MineVipCore extends State { super.initState(); SharedPreferences.getInstance().then((value) { - if(widget.arguments["rankLevel"] == 1 && !(value.getBool("FirstYinKa")??false)){ + if (widget.arguments["rankLevel"] == 1 && + !(value.getBool("FirstYinKa") ?? false)) { showAlertDialog("银卡会员"); value.setBool("FirstYinKa", true); - }else if(widget.arguments["rankLevel"] == 2 && !(value.getBool("FirstJinKa")??false)){ + } else if (widget.arguments["rankLevel"] == 2 && + !(value.getBool("FirstJinKa") ?? false)) { showAlertDialog("金卡会员"); value.setBool("FirstJinKa", true); - }else if(widget.arguments["rankLevel"] == 3 && !(value.getBool("FirstGongC")??false)){ + } else if (widget.arguments["rankLevel"] == 3 && + !(value.getBool("FirstGongC") ?? false)) { showAlertDialog("共创会员"); value.setBool("FirstGongC", true); } @@ -80,12 +83,13 @@ class _MineVipCore extends State { ///会员权益列表 queryBenefitList() async { - BaseData> baseData = await apiService.benefitList().catchError((onError) {}); + BaseData> baseData = + await apiService.benefitList().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { vipBenefitList.clear(); vipBenefitList.addAll(baseData.data); - vipBenefitList.sort((a,b)=>(a.sort).compareTo(b.sort)); + vipBenefitList.sort((a, b) => (a.sort).compareTo(b.sort)); }); } EasyLoading.dismiss(); @@ -94,7 +98,7 @@ class _MineVipCore extends State { ///会员权益介绍/规则/说明/储值说明 queryRuleDetails() async { BaseData baseData = - await apiService.vipBenefit().catchError((onError) {}); + await apiService.vipBenefit().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { vipRuleDetails = baseData.data; @@ -105,7 +109,6 @@ class _MineVipCore extends State { ///购买会员等级 buyRank() async { - // if (!(await Min.isInitialize())) { // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, @@ -113,8 +116,8 @@ class _MineVipCore extends State { // await Min.initialize(); // } - BaseData baseData = - await apiService.rankBuy({"buyType": 2, "rankId":ranks[checkIndex].id}); + BaseData baseData = await apiService + .rankBuy({"buyType": 2, "rankId": ranks[checkIndex].id}); if (baseData != null && baseData.isSuccess) { WxPay wxPay = WxPay.fromJson(baseData.data); await registerWxApi( @@ -133,380 +136,433 @@ class _MineVipCore extends State { ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); - if(event.errCode == 0){ + if (event.errCode == 0) { widget.arguments["rankLevel"] = ranks[checkIndex].level; queryVipLevel(); showAlertDialog(ranks[checkIndex].rankName); - } - else{ + } else { SmartDialog.showToast("支付失败", alignment: Alignment.center); return; } }); - } - else{ + } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } @override Widget build(BuildContext context) { - return Scaffold( - appBar: MyAppBar( - title: S.of(context).huiyuanzhongxin, - titleColor: Colors.black, - titleSize: 18.sp, - background: Colors.transparent, - leadingColor: Colors.black, - action:widget?.arguments["userInfo"] != null ? Container( - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/integral_detailed_page'); - }, - child: Text( - "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", - style: TextStyle( - color: Colors.black, - fontSize: 16.sp, - fontWeight: MyFontWeight.bold, - ), + return Stack( + children: [ + Container( + // padding: EdgeInsets.only(top: 40.h), + height:260.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + // border: Border.all(color: Colors.white,width: 0.5), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(35), + bottomLeft: Radius.circular(35), ), ), - ) : SizedBox(), - ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ///会员卡 - Container( - height: (MediaQuery.of(context).size.width) / - 1.78 * - AppUtils.textScale(context), - child: Swiper( - viewportFraction: 0.95, - loop: false, - physics: BouncingScrollPhysics(), - controller: controller, - onIndexChanged: (index){ - setState(() { - checkIndex = index; - }); - }, - itemBuilder: (context, position) { - return MineVipView( - vipLevel: !(ranks != null && ranks.isNotEmpty) - ? widget.arguments["rankLevel"] - : position + 1, - curLevel: widget.arguments["rankLevel"], - tag: (widget.arguments["rankLevel"] == (position + 1) || - !(ranks != null && ranks.isNotEmpty)) - ? "vip" - : "", - padding: 6.w, - rank: !(ranks != null && ranks.isNotEmpty) - ? 0 - : widget.arguments["expendAmount"], - rankMax: !(ranks != null && ranks.isNotEmpty) - ? 0 - : (position < (ranks.length - 1)) - ? ranks[position + 1].rankOrigin - : ranks[position].rankOrigin, - createTime: widget.arguments["createTime"], - ); - }, - itemCount: - (ranks != null && ranks.isNotEmpty) ? ranks.length : 1, - ), - ), + ), + Column( + children: [ + SizedBox(height: 40), - ///会员权益 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Container( + child:Row( children: [ - Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), - ), - ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanquanyi, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Padding( + padding: EdgeInsets.only(left: 16.h, bottom: 10.h), + child: Row( + children: [ + Icon( + Icons.arrow_back_ios, + size: 24, + color: Colors.white, + ), + Text( + S.of(context).huiyuanzhongxin, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 18.sp, + color: Colors.white, + ), + ), + ], + ), + )), ), + if(widget?.arguments["userInfo"] != null) + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(right: 16.w), + child: GestureDetector( + onTap: () { + // Navigator.of(context).pushNamed('/router/integral_detailed_page'); + }, + child: Text( + "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) ], ), - SizedBox( - height: 12.h, - ), - vipLegalRight(), - ], - ), - ), - - ///会员规则说明 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Expanded(child: + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( children: [ + ///会员卡 Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), + height: (MediaQuery.of(context).size.width) / + 1.78 * + AppUtils.textScale(context), + child: Swiper( + viewportFraction: 0.95, + loop: false, + physics: BouncingScrollPhysics(), + controller: controller, + onIndexChanged: (index) { + setState(() { + checkIndex = index; + }); + }, + itemBuilder: (context, position) { + return MineVipView( + vipLevel: !(ranks != null && ranks.isNotEmpty) + ? widget.arguments["rankLevel"] + : position + 1, + curLevel: widget.arguments["rankLevel"], + tag: (widget.arguments["rankLevel"] == (position + 1) || + !(ranks != null && ranks.isNotEmpty)) + ? "vip" + : "", + padding: 6.w, + rank: !(ranks != null && ranks.isNotEmpty) + ? 0 + : widget.arguments["expendAmount"] ?? 0, + rankMax: !(ranks != null && ranks.isNotEmpty) + ? 0 + : (position < (ranks.length - 1)) + ? ranks[position + 1].rankOrigin + : ranks[position].rankOrigin, + createTime: widget.arguments["createTime"], + ); + }, + itemCount: + (ranks != null && ranks.isNotEmpty) ? ranks.length : 1, ), ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanguize, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), - ), - ], - ), - SizedBox( - height: 12.h, - ), - if (vipRuleDetails?.qa != null && - vipRuleDetails.qa != "") - Container( - color: Colors.white, - padding: EdgeInsets.only(left: 8), - child: Html( - data: vipRuleDetails?.qa??"", - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, + + ///会员权益 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), - }, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanquanyi, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + vipLegalRight(), + ], + ), ), - ), - ], - ), - ), - ///会员级别对照表 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ + ///会员规则说明 Container( - width: 4, - height: 18, + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), ), - ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanjibieduizhao, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanguize, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + if (vipRuleDetails?.qa != null && vipRuleDetails.qa != "") + Container( + color: Colors.white, + padding: EdgeInsets.only(left: 8), + child: Html( + data: vipRuleDetails?.qa ?? "", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ], ), ), - ], - ), - SizedBox( - height: 12.h, - ), - MImage( - vipRuleDetails?.contrast ?? "", - width: double.infinity, - height: 281, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - SizedBox( - height: 16.h, - ), - ], - ), - ), - ///会员如何获得积分 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + ///会员级别对照表 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), - ), + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanjibieduizhao, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], ), SizedBox( - width: 4.w, + height: 12.h, ), - Text( - S.of(context).huiyuanhuodejifen, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), + MImage( + vipRuleDetails?.contrast ?? "", + width: double.infinity, + height: 281, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + height: 16.h, ), ], ), - SizedBox( - height: 12.h, - ), - if (vipRuleDetails?.rule != null && - vipRuleDetails.rule != "") - Container( + ), + + ///会员如何获得积分 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + decoration: BoxDecoration( color: Colors.white, - child: Html( - data: vipRuleDetails?.rule??"", - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), ), - ], - ), - ), - if( - ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00") - InkWell( - onTap: () { - setState(() { - buyRank(); - }); - }, - child: Container( - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFFFFDCA1), - Color(0xFFFAE4C0), - ]), - ), - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(16), - height: 54, - alignment: Alignment.center, - child: Text( - "${S.of(context).lijikaitong}¥${ranks.length>checkIndex?ranks[checkIndex].price:""}/永久", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.sp, - color: Color(0xFF4A4748), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanhuodejifen, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + if (vipRuleDetails?.rule != null && + vipRuleDetails.rule != "") + Container( + color: Colors.white, + child: Html( + data: vipRuleDetails?.rule ?? "", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ], + ), + ), + if (ranks.length > checkIndex && + widget.arguments["rankLevel"] < ranks[checkIndex].level && + ranks[checkIndex].price != "0.00") + InkWell( + onTap: () { + setState(() { + buyRank(); + }); + }, + child: Container( + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFFDCA1), + Color(0xFFFAE4C0), + ]), + ), + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(16), + height: 54, + alignment: Alignment.center, + child: Text( + "${S.of(context).lijikaitong}¥${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFF4A4748), + ), + ), + ), + ), + ], ), ), - ), + ], ), - ], - ), + )), + ], ), - ], - ), - ), + ], ); + } ///vip @@ -549,7 +605,7 @@ class _MineVipCore extends State { ///会员权益列表 Widget vipLegalRight() { return GridView.builder( - itemCount:vipBenefitList == null ? 0 : vipBenefitList.length, + itemCount: vipBenefitList == null ? 0 : vipBenefitList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -568,7 +624,9 @@ class _MineVipCore extends State { return GestureDetector( onTap: () { Navigator.of(context) - .pushNamed('/router/legal_right_details', arguments: {"vipBenefitList": vipBenefitList,}); + .pushNamed('/router/legal_right_details', arguments: { + "vipBenefitList": vipBenefitList, + }); }, child: vipLegalRightItem(vipBenefitList[index]), ); @@ -585,75 +643,76 @@ class _MineVipCore extends State { alignment: Alignment.bottomCenter, children: [ MImage( - vipBenefitList?.icon ?? "", - width: 36, - height: 36, - // fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - if(!vipBenefitList.actived) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), - ), - width: 52.w, - height: 15.h, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.lock, - color: Color(0xFFFFDCA1), - size: 10, - ), - Text( - "暂未开放", - style: TextStyle( + vipBenefitList?.icon ?? "", + width: 36, + height: 36, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + if (!vipBenefitList.actived) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), + ), + width: 52.w, + height: 15.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.lock, color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, + size: 10, ), - ), - ], - ), - ), - if(!vipBenefitList.actived && !vipBenefitList.have) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), + Text( + "暂未开放", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], + ), ), - width: 52.w, - height: 15.h, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.lock, - color: Color(0xFFFFDCA1), - size: 10, - ), - Text( - "暂未解锁", - style: TextStyle( + if (!vipBenefitList.actived && !vipBenefitList.have) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), + ), + width: 52.w, + height: 15.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.lock, color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, + size: 10, ), - ), - ], + Text( + "暂未解锁", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], + ), ), - ), ], ), SizedBox( height: 5.h, ), - Expanded(child: Text( + Expanded( + child: Text( vipBenefitList?.name ?? "", maxLines: 2, overflow: TextOverflow.ellipsis, @@ -663,8 +722,7 @@ class _MineVipCore extends State { fontWeight: MyFontWeight.regular, fontSize: 12.sp, ), - )) - , + )), ], ), ); diff --git a/lib/mine/mine_vip_level_page.dart b/lib/mine/mine_vip_level_page.dart index 817c160c..59690df6 100644 --- a/lib/mine/mine_vip_level_page.dart +++ b/lib/mine/mine_vip_level_page.dart @@ -81,7 +81,7 @@ class _MineVipLevelPage extends State { curLevel: widget.arguments["rankLevel"], tag: (widget.arguments["rankLevel"] == (position + 1) || !(ranks != null && ranks.isNotEmpty)) ? "vip" : "", padding: 6.w, - rank: !(ranks != null && ranks.isNotEmpty) ? 0 : widget.arguments["points"], + rank: !(ranks != null && ranks.isNotEmpty) ? 0 : widget.arguments["points"]??0, rankMax: !(ranks != null && ranks.isNotEmpty) ? 0 : (position < (ranks.length - 1)) ? ranks[position + 1].rankOrigin : ranks[position].rankOrigin, diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 08935bec..bbf3946a 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -164,13 +164,6 @@ class _RechargePage extends State { bottom: 20.h, ), decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, - ), - ], color: Colors.white, // borderRadius: BorderRadius.circular(4), ), diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index ba689bd9..22ecde99 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/receiving_method_dialog.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -39,6 +40,16 @@ class _ExchangeOrderPage extends State { void initState() { super.initState(); + SharedPreferences.getInstance().then((value) { + if(value.getString("minMember") == null){ + return; + } + Map memberInfo = + jsonDecode(value.getString("minMember")); + balance = memberInfo["balance"]; + money = memberInfo["money"]; + setState(() {}); + }); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token")), @@ -103,7 +114,12 @@ class _ExchangeOrderPage extends State { SizedBox( height: 18.h, ), - Row( + GestureDetector(onTap: (){ + setState(() { + showAlertDialog(); + }); + }, + child: Row( children: [ Text( S.of(context).lingqufangshi, @@ -115,7 +131,7 @@ class _ExchangeOrderPage extends State { SizedBox( width: 12.w, ), - Text( + Expanded(child:Text( widget.arguments["useTyped"] == 1 ? S.of(context).ziti : widget.arguments["useTyped"] == 2 @@ -125,9 +141,14 @@ class _ExchangeOrderPage extends State { fontSize: 14.sp, color: Color(0xFF353535), ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), ), ], - ), + ),), Visibility( child: SizedBox( height: 13.h, @@ -344,31 +365,41 @@ class _ExchangeOrderPage extends State { SizedBox( height: 18.h, ), - Row( - children: [ - Text( - S.of(context).lingqufangshi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + GestureDetector(onTap: (){ + setState(() { + showAlertDialog(); + }); + }, + child: Row( + children: [ + Text( + S.of(context).lingqufangshi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), ), - ), - SizedBox( - width: 12.w, - ), - Text( - widget.arguments["useTyped"] == 1 - ? S.of(context).ziti - : widget.arguments["useTyped"] == 2 - ? S.of(context).peisong - : S.of(context).xianshangfafang, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + SizedBox( + width: 12.w, ), - ), - ], - ), + Expanded(child:Text( + widget.arguments["useTyped"] == 1 + ? S.of(context).ziti + : widget.arguments["useTyped"] == 2 + ? S.of(context).peisong + : S.of(context).xianshangfafang, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ),), Visibility( child: SizedBox( height: 13.h, @@ -770,43 +801,43 @@ class _ExchangeOrderPage extends State { SizedBox( height: 10, ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - checkPayView(2), - Expanded( - child: Container(), - flex: 1, - ), - Text( - "¥$balance", - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - width: 10, - ), - Text( - S.of(context).dianpuyue, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], - ), - ), + // GestureDetector( + // onTap: () { + // setState(() { + // checkIndex = 2; + // }); + // }, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // checkPayView(2), + // Expanded( + // child: Container(), + // flex: 1, + // ), + // Text( + // "¥$balance", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // SizedBox( + // width: 10, + // ), + // Text( + // S.of(context).dianpuyue, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ], + // ), + // ), SizedBox( height: 10, ), @@ -898,6 +929,21 @@ class _ExchangeOrderPage extends State { ); } + ///领取方式弹窗 + showAlertDialog() { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ReceivingMethodDialog(widget.arguments["useTyped"],(value){ + setState(() { + widget.arguments["useTyped"] = value; + }); + }); + }, + ); + } + String handleNeedPay(){ return widget.arguments["payType"] == 1 ? "${double.parse(widget.arguments["onePrice"])*buyNum}积分".toString() : (widget.arguments["payType"] == 2 @@ -959,6 +1005,7 @@ class _ExchangeOrderPage extends State { BaseData baseDate = await apiService.creditOrder({ "goodsId": widget.arguments["goodsId"], "isOneSell":widget.arguments["payType"] != 2, + "isPoints":!handleNeedPay().contains("元"), "number": buyNum, "useTyped": widget.arguments["useTyped"], "payChannel":handleNeedPay().contains("元") ? (checkIndex == 3?"1":"4") : "0", diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index 3e41e806..bc9911a5 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -87,9 +87,21 @@ class _OrderCommodity extends State { ); } + if (widget.orderInfo.benefitDiscountAmount != "0.00") { + // 优惠券 + widgets.add( + vipItem( + Color(0xFFFF7A1A), + "会员优惠金额", + widget?.orderInfo?.benefitDiscountAmount ?? "0.00", + ), + ); + } + + if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.couponDTO != null) { - // 配送费 + // 优惠券 widgets.add( discountItem( Color(0xFFFF7A1A), @@ -99,10 +111,11 @@ class _OrderCommodity extends State { ), ); } + if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.activityPrice != null && double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) { - // 配送费 + // 活动 widgets.add( discountItem( Color(0xFFFF7A1A), @@ -136,6 +149,7 @@ class _OrderCommodity extends State { return widgets; } + Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -265,6 +279,45 @@ class _OrderCommodity extends State { ); } + Widget vipItem(Color color, textName,amount) { + return Container( + margin: EdgeInsets.only(top: 9.h, bottom: 9.h), + child: Row( + children: [ + Container( + padding: EdgeInsets.fromLTRB(4.w, 2.h, 4.w, 2.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(2)), + border: Border.all( + width: 1, + color: color, + style: BorderStyle.solid, + ), + ), + child: Text( + textName, + style: TextStyle( + fontSize: 10.sp, + color: color, + ), + ), + ), + SizedBox( + width: 27.w, + ), + Spacer(), + Text( + S.of(context).yuan_("$amount"), + style: TextStyle( + fontSize: 12.sp, + color: color, + ), + ), + ], + ), + ); + } + Widget buildQrCode() { return Container( margin: EdgeInsets.only(right: 16.w), @@ -357,16 +410,16 @@ class _OrderCommodity extends State { ), flex: 1, ), - Container( - child: Text( - "已优惠:¥${widget.orderInfo.orderDetail.activityPrice}", - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF7B7B7B), - fontWeight: MyFontWeight.medium, - ), - ), - ), + // Container( + // child: Text( + // "已优惠:¥${widget.orderInfo.orderDetail.activityPrice}", + // style: TextStyle( + // fontSize: 12.sp, + // color: Color(0xFF7B7B7B), + // fontWeight: MyFontWeight.medium, + // ), + // ), + // ), SizedBox( width: 15.w, ), diff --git a/lib/retrofit/data/achievement_detail_list.dart b/lib/retrofit/data/achievement_detail_list.dart index 82b93ff0..2677c888 100644 --- a/lib/retrofit/data/achievement_detail_list.dart +++ b/lib/retrofit/data/achievement_detail_list.dart @@ -1,19 +1,20 @@ -/// id : "1460450874352310812" +/// id : "1460450874352317701" /// createTime : "2021-11-12 11:42:08" /// createUser : "123" -/// updateTime : "2021-11-17 17:49:17" +/// updateTime : "2021-11-19 13:59:36" /// updateUser : "1" -/// categoryId : "1460164746211753984" +/// categoryId : "1460904379451179008" /// name : "青铜" /// level : 0 -/// icon : "https://pos.upload.gznl.top/admin/2021/11/a83f895b-8159-455e-a54d-ac67068b28b7.jpg" -/// score : 10 +/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/dd1bd6f1-6079-46ab-8d0f-6a946048db9d.png" +/// score : 1 /// actived : true /// sort : 0 /// isDelete : 0 -/// lessScore : 0 -/// get : true +/// lessScore : "1" +/// rewardList : [{"id":"1464064141143572480","createTime":"2021-11-26 10:51:07","createUser":"1","updateTime":"2021-11-26 10:51:07","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":2,"refId":"10","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null},{"id":"1464064181471805440","createTime":"2021-11-26 10:51:17","createUser":"1","updateTime":"2021-11-26 10:51:17","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":2,"refId":"20","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null},{"id":"1464136057103581184","createTime":"2021-11-26 15:36:53","createUser":"1","updateTime":"2021-11-26 15:36:53","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":1,"refId":"888","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null}] /// max : false +/// get : false class AchievementDetailList { AchievementDetailList({ @@ -30,9 +31,10 @@ class AchievementDetailList { bool actived, int sort, int isDelete, - int lessScore, - bool get, - bool max,}){ + String lessScore, + List rewardList, + bool max, + bool get,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -47,8 +49,9 @@ class AchievementDetailList { _sort = sort; _isDelete = isDelete; _lessScore = lessScore; - _get = get; + _rewardList = rewardList; _max = max; + _get = get; } AchievementDetailList.fromJson(dynamic json) { @@ -66,8 +69,14 @@ class AchievementDetailList { _sort = json['sort']; _isDelete = json['isDelete']; _lessScore = json['lessScore']; - _get = json['get']; + if (json['rewardList'] != null) { + _rewardList = []; + json['rewardList'].forEach((v) { + _rewardList.add(RewardList.fromJson(v)); + }); + } _max = json['max']; + _get = json['get']; } String _id; String _createTime; @@ -82,9 +91,10 @@ class AchievementDetailList { bool _actived; int _sort; int _isDelete; - int _lessScore; - bool _get; + String _lessScore; + List _rewardList; bool _max; + bool _get; String get id => _id; String get createTime => _createTime; @@ -99,14 +109,10 @@ class AchievementDetailList { bool get actived => _actived; int get sort => _sort; int get isDelete => _isDelete; - int get lessScore => _lessScore; - bool get get => _get; + String get lessScore => _lessScore; + List get rewardList => _rewardList; bool get max => _max; - - - set id(String value) { - _id = value; - } + bool get get => _get; Map toJson() { final map = {}; @@ -124,68 +130,119 @@ class AchievementDetailList { map['sort'] = _sort; map['isDelete'] = _isDelete; map['lessScore'] = _lessScore; - map['get'] = _get; + if (_rewardList != null) { + map['rewardList'] = _rewardList.map((v) => v.toJson()).toList(); + } map['max'] = _max; + map['get'] = _get; return map; } - set createTime(String value) { - _createTime = value; - } - - set createUser(String value) { - _createUser = value; - } - - set updateTime(String value) { - _updateTime = value; - } - - set updateUser(String value) { - _updateUser = value; - } - - set categoryId(String value) { - _categoryId = value; - } - - set name(String value) { - _name = value; - } - - set level(int value) { - _level = value; - } - - set icon(String value) { - _icon = value; - } - - set score(int value) { - _score = value; - } +} - set actived(bool value) { - _actived = value; - } +/// id : "1464064141143572480" +/// createTime : "2021-11-26 10:51:07" +/// createUser : "1" +/// updateTime : "2021-11-26 10:51:07" +/// updateUser : "1" +/// categoryId : "1460904379451179008" +/// achievementId : "1460450874352317701" +/// rewardType : 2 +/// refId : "10" +/// isDelete : 0 +/// achievementCategoryName : null +/// achievementName : null +/// couponName : null - set sort(int value) { - _sort = value; - } +class RewardList { + RewardList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String categoryId, + String achievementId, + int rewardType, + String refId, + int isDelete, + dynamic achievementCategoryName, + dynamic achievementName, + dynamic couponName,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _categoryId = categoryId; + _achievementId = achievementId; + _rewardType = rewardType; + _refId = refId; + _isDelete = isDelete; + _achievementCategoryName = achievementCategoryName; + _achievementName = achievementName; + _couponName = couponName; +} - set isDelete(int value) { - _isDelete = value; + RewardList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _categoryId = json['categoryId']; + _achievementId = json['achievementId']; + _rewardType = json['rewardType']; + _refId = json['refId']; + _isDelete = json['isDelete']; + _achievementCategoryName = json['achievementCategoryName']; + _achievementName = json['achievementName']; + _couponName = json['couponName']; } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _categoryId; + String _achievementId; + int _rewardType; + String _refId; + int _isDelete; + dynamic _achievementCategoryName; + dynamic _achievementName; + dynamic _couponName; - set lessScore(int value) { - _lessScore = value; - } + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get categoryId => _categoryId; + String get achievementId => _achievementId; + int get rewardType => _rewardType; + String get refId => _refId; + int get isDelete => _isDelete; + dynamic get achievementCategoryName => _achievementCategoryName; + dynamic get achievementName => _achievementName; + dynamic get couponName => _couponName; - set get(bool value) { - _get = value; + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['categoryId'] = _categoryId; + map['achievementId'] = _achievementId; + map['rewardType'] = _rewardType; + map['refId'] = _refId; + map['isDelete'] = _isDelete; + map['achievementCategoryName'] = _achievementCategoryName; + map['achievementName'] = _achievementName; + map['couponName'] = _couponName; + return map; } - set max(bool value) { - _max = value; - } } \ No newline at end of file diff --git a/lib/retrofit/data/headlines_list.dart b/lib/retrofit/data/headlines_list.dart new file mode 100644 index 00000000..55bef87f --- /dev/null +++ b/lib/retrofit/data/headlines_list.dart @@ -0,0 +1,99 @@ +/// id : "1463790611994771456" +/// createTime : "2021-11-25 16:44:12" +/// createUser : "1" +/// updateTime : "2021-11-25 16:45:55" +/// updateUser : "1" +/// name : "一心回乡" +/// introduce : "22" +/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/899b578b-f594-42f7-91e1-cebc5dbc39da.png" +/// bannerImg : "https://pos.upload.gznl.top/0000/2021/11/7a41ebe2-d3b1-44ea-9cda-2e952b58d54c.png" +/// sort : 0 +/// isDelete : 0 +/// tenantCode : "admin" + +class HeadlinesList { + HeadlinesList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + String introduce, + String coverImg, + String bannerImg, + int sort, + int isDelete, + String tenantCode,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _introduce = introduce; + _coverImg = coverImg; + _bannerImg = bannerImg; + _sort = sort; + _isDelete = isDelete; + _tenantCode = tenantCode; +} + + HeadlinesList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _introduce = json['introduce']; + _coverImg = json['coverImg']; + _bannerImg = json['bannerImg']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + String _introduce; + String _coverImg; + String _bannerImg; + int _sort; + int _isDelete; + String _tenantCode; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + String get introduce => _introduce; + String get coverImg => _coverImg; + String get bannerImg => _bannerImg; + int get sort => _sort; + int get isDelete => _isDelete; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['introduce'] = _introduce; + map['coverImg'] = _coverImg; + map['bannerImg'] = _bannerImg; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/headlines_list_details.dart b/lib/retrofit/data/headlines_list_details.dart new file mode 100644 index 00000000..eebed291 --- /dev/null +++ b/lib/retrofit/data/headlines_list_details.dart @@ -0,0 +1,99 @@ +/// id : "1463790611994771456" +/// createTime : "2021-11-25 16:44:12" +/// createUser : "1" +/// updateTime : "2021-11-25 16:45:55" +/// updateUser : "1" +/// name : "一心回乡" +/// introduce : "22" +/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/899b578b-f594-42f7-91e1-cebc5dbc39da.png" +/// bannerImg : "https://pos.upload.gznl.top/0000/2021/11/7a41ebe2-d3b1-44ea-9cda-2e952b58d54c.png" +/// sort : 0 +/// isDelete : 0 +/// tenantCode : "admin" + +class HeadlinesListDetails { + HeadlinesListDetails({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + String introduce, + String coverImg, + String bannerImg, + int sort, + int isDelete, + String tenantCode,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _introduce = introduce; + _coverImg = coverImg; + _bannerImg = bannerImg; + _sort = sort; + _isDelete = isDelete; + _tenantCode = tenantCode; +} + + HeadlinesListDetails.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _introduce = json['introduce']; + _coverImg = json['coverImg']; + _bannerImg = json['bannerImg']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + String _introduce; + String _coverImg; + String _bannerImg; + int _sort; + int _isDelete; + String _tenantCode; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + String get introduce => _introduce; + String get coverImg => _coverImg; + String get bannerImg => _bannerImg; + int get sort => _sort; + int get isDelete => _isDelete; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['introduce'] = _introduce; + map['coverImg'] = _coverImg; + map['bannerImg'] = _bannerImg; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/order_info.dart b/lib/retrofit/data/order_info.dart index 6b7eff3c..c65d1a83 100644 --- a/lib/retrofit/data/order_info.dart +++ b/lib/retrofit/data/order_info.dart @@ -110,6 +110,7 @@ class OrderInfo { String payNum; String promotionId; String couponId; + String benefitDiscountAmount; int isDelete; int isTakeOut; int batch; @@ -172,6 +173,7 @@ class OrderInfo { String payNum, String promotionId, String couponId, + String benefitDiscountAmount, int isDelete, int isTakeOut, int batch, @@ -232,6 +234,7 @@ class OrderInfo { this.payNum = payNum; this.promotionId = promotionId; this.couponId = couponId; + this.benefitDiscountAmount =benefitDiscountAmount; this.isDelete = isDelete; this.isTakeOut = isTakeOut; this.batch = batch; @@ -297,6 +300,7 @@ class OrderInfo { this.payNum = json["payNum"]; this.promotionId = json["promotionId"]; this.couponId = json["couponId"]; + this.benefitDiscountAmount = json["benefitDiscountAmount"]; this.isDelete = json["isDelete"]; this.isTakeOut = json["isTakeOut"]; this.batch = json["batch"]; @@ -371,6 +375,7 @@ class OrderInfo { map["payNum"] = this.payNum; map["promotionId"] = this.promotionId; map["couponId"] = this.couponId; + map["benefitDiscountAmount"] = this.benefitDiscountAmount; map["isDelete"] = this.isDelete; map["isTakeOut"] = this.isTakeOut; map["batch"] = this.batch; diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index bb92977d..b4fb5077 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -205,6 +205,7 @@ class SettleOrderInfo { /// promotionName : "��10-8" /// usable : true /// allProduct : true +/// isMaxCoupon:true /// productList : null class CouponListBean { @@ -231,6 +232,7 @@ class CouponListBean { String promotionName; bool usable; bool allProduct; + bool isMaxCoupon; dynamic productList; bool isEx; @@ -261,6 +263,7 @@ class CouponListBean { couponListBean.promotionName = map['promotionName']; couponListBean.usable = map['usable']; couponListBean.allProduct = map['allProduct']; + couponListBean.isMaxCoupon = map['isMaxCoupon']; couponListBean.productList = map['productList']; return couponListBean; } @@ -289,6 +292,7 @@ class CouponListBean { "promotionName": promotionName, "usable": usable, "allProduct": allProduct, + "isMaxCoupon": isMaxCoupon, "productList": productList, }; @@ -321,6 +325,7 @@ class CouponListBean { /// isDelete : 0 /// tenantCode : "1175" /// canPartake : true +/// isMaxPromotion : true /// promotionProuctList : null class PromotionInfoListBean { @@ -351,6 +356,7 @@ class PromotionInfoListBean { int isDelete; String tenantCode; bool canPartake; + bool isMaxPromotion; dynamic promotionProuctList; static PromotionInfoListBean fromJson(Map map) { @@ -387,6 +393,7 @@ class PromotionInfoListBean { promotionInfoListBean.isDelete = map['isDelete']; promotionInfoListBean.tenantCode = map['tenantCode']; promotionInfoListBean.canPartake = map['canPartake']; + promotionInfoListBean.isMaxPromotion = map['isMaxPromotion']; promotionInfoListBean.promotionProuctList = map['promotionProuctList']; return promotionInfoListBean; } @@ -419,6 +426,7 @@ class PromotionInfoListBean { "isDelete": isDelete, "tenantCode": tenantCode, "canPartake": canPartake, + "isMaxPromotion": isMaxPromotion, "promotionProuctList": promotionProuctList, }; } diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 01b6ec19..2126eb88 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -1,4 +1,7 @@ +import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; + /// cartSum : 0 +/// selectDiscount:2 /// numberOfPeople : 0 /// selected : 0 /// shoppingCartSkuItemList : [{"buyNum":0,"createTime":"","groupId":0,"id":0,"platterList":[{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}],"productId":0,"productName":"","selected":0,"skuImg":"","skuName":"","skuPrice":0,"skuStock":0,"storeId":0,"tableId":0}] @@ -12,8 +15,11 @@ class ShoppingCart { int selected; List shoppingCartSkuItemList; String storeId; + int selectDiscount; String storeName; String tableId; + List promotionInfoList; + List couponList; static ShoppingCart fromJson(Map map) { if (map == null) return null; @@ -26,7 +32,14 @@ class ShoppingCart { ); shoppingCartBean.storeId = map['storeId']; shoppingCartBean.storeName = map['storeName']; + shoppingCartBean.selectDiscount = map['selectDiscount']; shoppingCartBean.tableId = map['tableId']; + shoppingCartBean.promotionInfoList = List()..addAll( + (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBean.fromJson(o)) + ); + shoppingCartBean.couponList = List()..addAll( + (map['couponList'] as List ?? []).map((o) => CouponListBean.fromJson(o)) + ); return shoppingCartBean; } @@ -37,7 +50,9 @@ class ShoppingCart { "shoppingCartSkuItemList": shoppingCartSkuItemList == null ? null : shoppingCartSkuItemList.map((e) => e.toJson()).toList(), "storeId": storeId, "storeName": storeName, + "selectDiscount" : selectDiscount, "tableId": tableId, + "promotionInfoList": promotionInfoList, }; } @@ -146,4 +161,253 @@ class PlatterListBean { "required": required, "skuId": skuId, }; +} + +/// id : "1437254523520286720" +/// createTime : "2021-09-13 11:19:16" +/// createUser : "1333246101196636160" +/// updateTime : "2021-09-13 17:30:00" +/// updateUser : "0" +/// storeId : "1433719074906439680" +/// name : "�����ŵ�" +/// image : "https://pos.upload.gznl.top/1175/2021/09/44d60dab-0ae3-4d07-b624-50b8ab99d0fc.jpg" +/// description : "1" +/// status : 4 +/// applyStartTime : "2021-09-13 11:19:16" +/// applyEndTime : "2021-09-13 11:19:16" +/// activityStartTime : "2021-09-01 00:00:00" +/// activityEndTime : "2021-10-30 00:00:00" +/// doStartTime : null +/// doEndTime : null +/// isNeedSecurityDeposit : 0 +/// securityDeposit : "0" +/// tag : "11" +/// promotionType : 1 +/// promotionPlan : 0 +/// promotionDetail : [{"limitTime":"0","discountRate":"0","discountAmount":"0","fullAmount":"0","collageNumber":"0","fullNumber":"1"}] +/// channels : ["MINI","POS"] +/// isVip : false +/// isDelete : 0 +/// tenantCode : "1175" +/// canPartake : true +/// isMaxPromotion : true +/// promotionProuctList : null + +class PromotionInfoListBean { + String id; + String createTime; + String createUser; + String updateTime; + String updateUser; + String storeId; + String name; + String image; + String description; + int status; + String applyStartTime; + String applyEndTime; + String activityStartTime; + String activityEndTime; + dynamic doStartTime; + dynamic doEndTime; + int isNeedSecurityDeposit; + String securityDeposit; + String tag; + int promotionType; + int promotionPlan; + List promotionDetail; + List channels; + bool isVip; + int isDelete; + String tenantCode; + bool canPartake; + bool isMaxPromotion; + dynamic promotionProuctList; + + static PromotionInfoListBean fromJson(Map map) { + if (map == null) return null; + PromotionInfoListBean promotionInfoListBean = PromotionInfoListBean(); + promotionInfoListBean.id = map['id']; + promotionInfoListBean.createTime = map['createTime']; + promotionInfoListBean.createUser = map['createUser']; + promotionInfoListBean.updateTime = map['updateTime']; + promotionInfoListBean.updateUser = map['updateUser']; + promotionInfoListBean.storeId = map['storeId']; + promotionInfoListBean.name = map['name']; + promotionInfoListBean.image = map['image']; + promotionInfoListBean.description = map['description']; + promotionInfoListBean.status = map['status']; + promotionInfoListBean.applyStartTime = map['applyStartTime']; + promotionInfoListBean.applyEndTime = map['applyEndTime']; + promotionInfoListBean.activityStartTime = map['activityStartTime']; + promotionInfoListBean.activityEndTime = map['activityEndTime']; + promotionInfoListBean.doStartTime = map['doStartTime']; + promotionInfoListBean.doEndTime = map['doEndTime']; + promotionInfoListBean.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; + promotionInfoListBean.securityDeposit = map['securityDeposit']; + promotionInfoListBean.tag = map['tag']; + promotionInfoListBean.promotionType = map['promotionType']; + promotionInfoListBean.promotionPlan = map['promotionPlan']; + promotionInfoListBean.promotionDetail = List()..addAll( + (map['promotionDetail'] as List ?? []).map((o) => PromotionDetailBean.fromJson(o)) + ); + promotionInfoListBean.channels = List()..addAll( + (map['channels'] as List ?? []).map((o) => o.toString()) + ); + promotionInfoListBean.isVip = map['isVip']; + promotionInfoListBean.isDelete = map['isDelete']; + promotionInfoListBean.tenantCode = map['tenantCode']; + promotionInfoListBean.canPartake = map['canPartake']; + promotionInfoListBean.isMaxPromotion = map['isMaxPromotion']; + promotionInfoListBean.promotionProuctList = map['promotionProuctList']; + return promotionInfoListBean; + } + + Map toJson() => { + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "storeId": storeId, + "name": name, + "image": image, + "description": description, + "status": status, + "applyStartTime": applyStartTime, + "applyEndTime": applyEndTime, + "activityStartTime": activityStartTime, + "activityEndTime": activityEndTime, + "doStartTime": doStartTime, + "doEndTime": doEndTime, + "isNeedSecurityDeposit": isNeedSecurityDeposit, + "securityDeposit": securityDeposit, + "tag": tag, + "promotionType": promotionType, + "promotionPlan": promotionPlan, + "promotionDetail": promotionDetail, + "channels": channels, + "isVip": isVip, + "isDelete": isDelete, + "tenantCode": tenantCode, + "canPartake": canPartake, + "isMaxPromotion": isMaxPromotion, + "promotionProuctList": promotionProuctList, + }; +} + +/// id : "1448907890034212864" +/// storeId : "1333246101343436800" +/// bizType : 1 +/// fullAmount : "10.00" +/// discountAmount : "8.00" +/// fullNumber : 1 +/// discountPercent : 100 +/// bizId : "" +/// publishStartTime : "2021-10-01" +/// publishEndTime : "2021-10-29" +/// useStartTime : "2021-10-02" +/// useEndTime : "2021-10-31" +/// promotionId : "0" +/// mid : "1438443365845696512" +/// couponId : "1448902034085380096" +/// receiveTime : "2021-10-15" +/// useTime : null +/// status : 1 +/// tenantCode : "1175" +/// type : 1 +/// promotionName : "��10-8" +/// usable : true +/// allProduct : true +/// isMaxCoupon:true +/// productList : null + +class CouponListBean { + String id; + String storeId; + int bizType; + String fullAmount; + String discountAmount; + int fullNumber; + int discountPercent; + String bizId; + String publishStartTime; + String publishEndTime; + String useStartTime; + String useEndTime; + String promotionId; + String mid; + String couponId; + String receiveTime; + dynamic useTime; + int status; + String tenantCode; + int type; + String promotionName; + bool usable; + bool allProduct; + bool isMaxCoupon; + dynamic productList; + bool isEx; + + + static CouponListBean fromJson(Map map) { + if (map == null) return null; + CouponListBean couponListBean = CouponListBean(); + couponListBean.id = map['id']; + couponListBean.storeId = map['storeId']; + couponListBean.bizType = map['bizType']; + couponListBean.fullAmount = map['fullAmount']; + couponListBean.discountAmount = map['discountAmount']; + couponListBean.fullNumber = map['fullNumber']; + couponListBean.discountPercent = map['discountPercent']; + couponListBean.bizId = map['bizId']; + couponListBean.publishStartTime = map['publishStartTime']; + couponListBean.publishEndTime = map['publishEndTime']; + couponListBean.useStartTime = map['useStartTime']; + couponListBean.useEndTime = map['useEndTime']; + couponListBean.promotionId = map['promotionId']; + couponListBean.mid = map['mid']; + couponListBean.couponId = map['couponId']; + couponListBean.receiveTime = map['receiveTime']; + couponListBean.useTime = map['useTime']; + couponListBean.status = map['status']; + couponListBean.tenantCode = map['tenantCode']; + couponListBean.type = map['type']; + couponListBean.promotionName = map['promotionName']; + couponListBean.usable = map['usable']; + couponListBean.allProduct = map['allProduct']; + couponListBean.isMaxCoupon = map['isMaxCoupon']; + couponListBean.productList = map['productList']; + return couponListBean; + } + + Map toJson() => { + "id": id, + "storeId": storeId, + "bizType": bizType, + "fullAmount": fullAmount, + "discountAmount": discountAmount, + "fullNumber": fullNumber, + "discountPercent": discountPercent, + "bizId": bizId, + "publishStartTime": publishStartTime, + "publishEndTime": publishEndTime, + "useStartTime": useStartTime, + "useEndTime": useEndTime, + "promotionId": promotionId, + "mid": mid, + "couponId": couponId, + "receiveTime": receiveTime, + "useTime": useTime, + "status": status, + "tenantCode": tenantCode, + "type": type, + "promotionName": promotionName, + "usable": usable, + "allProduct": allProduct, + "isMaxCoupon": isMaxCoupon, + "productList": productList, + + }; } \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 26e0ed25..1b78be14 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -30,6 +30,8 @@ import 'data/exchange_order.dart'; import 'data/follow_list.dart'; import 'data/goods.dart'; import 'data/goods_category.dart'; +import 'data/headlines_list.dart'; +import 'data/headlines_list_details.dart'; import 'data/logistics.dart'; import 'data/member_comment_list.dart'; import 'data/message.dart'; @@ -53,15 +55,15 @@ part 'retrofit_api.g.dart'; // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.130:8766/app/";///詹云久 -// const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 +const base_url = "http://192.168.10.130:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -467,4 +469,13 @@ abstract class ApiService { @POST("/member/rankBuy") Future> rankBuy(@Body() Map param); + ///文章合集列表 + @GET("/information/categoryList") + Future>> headlinesList(); + + ///文章合集详情 + @GET("/information/category/{id}") + Future> headlinesDetails(@Path("id") String id); + + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 0b363086..05bf5876 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8766/app/'; + baseUrl ??= 'http://192.168.10.130:8766/app/'; } final Dio _dio; @@ -1393,29 +1393,6 @@ class _ApiService implements ApiService { return value; } - // - // @override - // Future> catalogList(courseId) async { - // ArgumentError.checkNotNull(courseId, 'courseId'); - // const _extra = {}; - // final queryParameters = {}; - // final _data = {}; - // final _result = await _dio.request>( - // '/course/catalogList/$courseId', - // queryParameters: queryParameters, - // options: RequestOptions( - // method: 'GET', - // headers: {}, - // extra: _extra, - // baseUrl: baseUrl), - // data: _data); - // final value = BaseData.fromJson( - // _result.data, - // (json) => json as dynamic, - // ); - // return value; - // } - @override Future>> courseList(map) async { ArgumentError.checkNotNull(map, 'map'); @@ -1730,4 +1707,48 @@ class _ApiService implements ApiService { return value; } + @override + Future>> headlinesList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/information/categoryList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => HeadlinesList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> headlinesDetails(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/information/category/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => HeadlinesListDetails.fromJson(json), + ); + return value; + } + } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index a23103f8..ed321d52 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -72,7 +72,8 @@ class _Settlement extends State { parentId = widget.arguments["parentId"] ?? ""; storeInfo = widget.arguments["storeInfo"]; numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; - + promotions=widget.arguments["pid"]??""; + coupons=widget.arguments["cid"]??""; if (tableId == 0) { placeOrder = true; } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 88857ccd..975a42bf 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -62,6 +62,8 @@ class _StoreOrderPage extends State int numberOfPeople = 0; ///小程序token String minToken; + String pid; + String cid; @override void initState() { @@ -545,7 +547,6 @@ class _StoreOrderPage extends State return; } } - await Navigator.of(context).pushNamed( '/router/settlement', arguments: { @@ -553,6 +554,8 @@ class _StoreOrderPage extends State "tableId": tableId, "parentCode": parentCode, "parentId": parentId, + "pid":pid, + "cid":cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, }, @@ -730,12 +733,27 @@ class _StoreOrderPage extends State ///查询购物车 Future queryShopCar() async { + pid=""; + 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){ + cid = element.promotionName; + } + }); + }else if(baseDate.data[0].selectDiscount==2){ + baseDate.data[0].promotionInfoList.forEach((element) { + if(element.isMaxPromotion){ + pid=element.name; + } + }); + } return baseDate.data[0]; } else { return null; diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index 265a9ca1..c79ba14f 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -102,9 +102,9 @@ class ItemInputWidget extends StatelessWidget { ), Container( margin: EdgeInsets.only(left: 5), - width: 85, height: 20.h, alignment: Alignment.center, + padding: EdgeInsets.only(left:3,right:4), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(9), diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index ee114bc4..452b80ab 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -217,9 +217,9 @@ class MineVipView extends StatelessWidget { // rank > rankMax // ? S.of(context).dangqiandengji // : "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}", - rank > rankMax + (vipLevel < curLevel)?"":(((rank ?? 0) > rankMax || curLevel == 3) ? S.of(context).dangqiandengji - : "消费¥${rankMax - rank}元 ${S.of(context).daoxiayidengji}", + : "消费¥${rankMax - (rank ?? 0)}元 ${S.of(context).daoxiayidengji}"), overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, @@ -233,14 +233,14 @@ class MineVipView extends StatelessWidget { TextSpan( children: [ TextSpan( - text: "$rank", + text: (vipLevel < curLevel)?rankMax.toString():rank.toString(), style: TextStyle( fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, color: textColor, ), ), - if (rank <= rankMax) + if ((rank ?? 0) <= rankMax) TextSpan( text: rankMax > 0 ? "/$rankMax" : "/0", style: TextStyle( @@ -259,7 +259,7 @@ class MineVipView extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(6.5), child: LinearProgressIndicator( - value: rankMax > 0 ? rank / rankMax : 0, + value: rankMax > (rank ?? 0) ? ((vipLevel < curLevel) ? rankMax/rankMax:(rank ?? 0) / rankMax) : 0, backgroundColor: Colors.white, color: levelColor, ), @@ -274,7 +274,9 @@ class MineVipView extends StatelessWidget { S.of(context).kaitongriqi( (createTime != null && createTime != "") ? createTime.split(" ")[0] - : "$createTime"), + : "$createTime" + // createTime ?? "" + ), style: TextStyle( color: textColor, fontWeight: MyFontWeight.regular, @@ -317,7 +319,7 @@ class MineVipView extends StatelessWidget { "rankLevel": curLevel, "userInfo":userInfo.masterCardRankName, "createTime": (userInfo != null) ? "${userInfo.createTime}" : "", - "expendAmount": (userInfo != null) ? int.tryParse(userInfo.expendAmount) : 0, + "expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(), }); }); } diff --git a/lib/view_widget/receiving_method_dialog.dart b/lib/view_widget/receiving_method_dialog.dart new file mode 100644 index 00000000..9007d97e --- /dev/null +++ b/lib/view_widget/receiving_method_dialog.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +import 'custom_image.dart'; +import 'my_appbar.dart'; + +class ReceivingMethodDialog extends StatefulWidget { + final int takeType; + final Function changeTakeType; + + ReceivingMethodDialog(this.takeType,this.changeTakeType); + + @override + State createState() { + return _ReceivingMethodDialog(); + } + +} + +class _ReceivingMethodDialog extends State { + + + Widget build(BuildContext context) { + return Container( + alignment:Alignment.bottomCenter, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + margin: + EdgeInsets.only(top: 26, bottom: 8), + // alignment: Alignment.center, + padding: EdgeInsets.only(top: 20,bottom:20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + child: Column( + children: [ + Text( + "请选择商品的领取方式", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA29E9E), + ), + ), + Container( + margin: EdgeInsets.only(top:20,bottom: 20), + height:1, + color:Color(0xFFF4F4F4), + ), + GestureDetector( + onTap:(){ + widget.changeTakeType(1); + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).ziti, + style: TextStyle( + fontSize: 16.sp, + fontWeight: widget.takeType == 1 ? MyFontWeight.semi_bold : MyFontWeight.medium, + color: widget.takeType == 1 ? Color(0xFF32A060):Color(0xFFA29E9E), + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 20,bottom: 20), + height:1, + color:Color(0xFFF4F4F4), + ), + GestureDetector( + onTap:(){ + widget.changeTakeType(2); + Navigator.of(context).pop(); + }, + child:Text( + "物流配送", + style: TextStyle( + fontSize: 16.sp, + fontWeight: widget.takeType == 2 ? MyFontWeight.semi_bold : MyFontWeight.medium, + color: widget.takeType == 2 ? Color(0xFF32A060):Color(0xFFA29E9E), + ), + ), + ), + ], + ), + ), + GestureDetector( + onTap: (){ + Navigator.of(context).pop(); + }, + child:Container( + margin: EdgeInsets.only(top:16), + height:68.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(18), + color: Color(0xFF32A060), + ), + child: + Text( + S.of(context).quxiao, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ) + ), + ), + ], + ), + ); + } +} diff --git a/lib/view_widget/vip_dialog.dart b/lib/view_widget/vip_dialog.dart index 5e3d5bf7..3d25b7a9 100644 --- a/lib/view_widget/vip_dialog.dart +++ b/lib/view_widget/vip_dialog.dart @@ -65,7 +65,7 @@ class _VipDialog extends State { alignment: Alignment.topCenter, children: [ Container( - margin: EdgeInsets.only(top: 40.h), + margin: EdgeInsets.only(top:50.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -76,7 +76,7 @@ class _VipDialog extends State { alignment: Alignment.center, width: double.infinity, height: 92, - padding: EdgeInsets.only(top: 50.h, bottom: 19.h), + padding: EdgeInsets.only(top: 40.h, bottom: 19.h), decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.only(