Browse Source

Merge remote-tracking branch 'origin/dev' into remove_uniapp

ff_new
fmk 3 years ago
parent
commit
4476c8fa62
  1. BIN
      assets/image/2x/bianhao.png
  2. BIN
      assets/image/2x/t_right.png
  3. BIN
      assets/image/3x/bianhao.png
  4. BIN
      assets/image/3x/t_right.png
  5. BIN
      assets/image/bianhao.png
  6. BIN
      assets/image/t_right.png
  7. 5
      lib/address/edit_address_page.dart
  8. 45
      lib/article/hot_article_item.dart
  9. 4
      lib/community/community_details.dart
  10. 4
      lib/community/community_page.dart
  11. 1
      lib/community/community_view/class_details.dart
  12. 1
      lib/community/community_view/home_class.dart
  13. 176
      lib/community/headlines/article_list.dart
  14. 239
      lib/community/headlines/article_page.dart
  15. 119
      lib/community/headlines/headlines_banner.dart
  16. 166
      lib/community/headlines/headlines_collection.dart
  17. 344
      lib/community/headlines/headlines_column_details.dart
  18. 4
      lib/generated/intl/messages_en.dart
  19. 4
      lib/generated/intl/messages_zh_CN.dart
  20. 4
      lib/generated/intl/messages_zh_Hans_CN.dart
  21. 3
      lib/generated/intl/messages_zh_Hant_CN.dart
  22. 4
      lib/generated/intl/messages_zh_TW.dart
  23. 40
      lib/generated/l10n.dart
  24. 2
      lib/integral/intergra_view/integral_vip.dart
  25. 5
      lib/l10n/intl_en.arb
  26. 6
      lib/l10n/intl_zh_CN.arb
  27. 6
      lib/l10n/intl_zh_Hans_CN.arb
  28. 4
      lib/l10n/intl_zh_Hant_CN.arb
  29. 6
      lib/l10n/intl_zh_TW.arb
  30. 9
      lib/main.dart
  31. 19
      lib/mine/mine_page.dart
  32. 2
      lib/mine/mine_view/community_follow.dart
  33. 85
      lib/mine/mine_vip/binding_assistant_card.dart
  34. 491
      lib/mine/mine_vip/legal_right_details.dart
  35. 340
      lib/mine/mine_vip/mine_attainment_page.dart
  36. 343
      lib/mine/mine_vip/mine_vip_core.dart
  37. 2
      lib/mine/mine_vip_level_page.dart
  38. 195
      lib/mine/recharge_page.dart
  39. 97
      lib/order/exchange_history_page.dart
  40. 283
      lib/order/exchange_order_page.dart
  41. 2
      lib/order/exchange_order_success_page.dart
  42. 290
      lib/order/exchange_write_off_page.dart
  43. 53
      lib/order/logistics_information_page.dart
  44. 77
      lib/order/order_view/order_commodity.dart
  45. 4
      lib/order/write_off_page.dart
  46. 248
      lib/retrofit/data/achievement_detail_list.dart
  47. 12
      lib/retrofit/data/exchange_order.dart
  48. 6
      lib/retrofit/data/goods.dart
  49. 99
      lib/retrofit/data/headlines_list.dart
  50. 99
      lib/retrofit/data/headlines_list_details.dart
  51. 5
      lib/retrofit/data/order_info.dart
  52. 6
      lib/retrofit/data/rank.dart
  53. 73
      lib/retrofit/data/second_card_list.dart
  54. 11
      lib/retrofit/data/settleOrderInfo.dart
  55. 264
      lib/retrofit/data/shoppingCart.dart
  56. 12
      lib/retrofit/data/social_info.dart
  57. 9
      lib/retrofit/data/user_info.dart
  58. 147
      lib/retrofit/data/vip_badges_list.dart
  59. 127
      lib/retrofit/data/vip_benefit_list.dart
  60. 57
      lib/retrofit/data/vip_rule_details.dart
  61. 60
      lib/retrofit/retrofit_api.dart
  62. 272
      lib/retrofit/retrofit_api.g.dart
  63. 5
      lib/settlement/settlement.dart
  64. 46
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  65. 25
      lib/store/store_order.dart
  66. 6
      lib/utils/flutter_utils.dart
  67. 104
      lib/view_widget/badge_attainment_dialog.dart
  68. 4
      lib/view_widget/cupertino_date_picker.dart
  69. 56
      lib/view_widget/item_input_widget.dart
  70. 26
      lib/view_widget/mine_vip_view.dart
  71. 131
      lib/view_widget/receiving_method_dialog.dart
  72. 181
      lib/view_widget/vip_dialog.dart

BIN
assets/image/2x/bianhao.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

BIN
assets/image/2x/t_right.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
assets/image/3x/bianhao.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/3x/t_right.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

BIN
assets/image/bianhao.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

BIN
assets/image/t_right.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

5
lib/address/edit_address_page.dart

@ -82,7 +82,7 @@ class _EditAddressPage extends State<EditAddressPage> {
bottomRight: Radius.circular(8),
),
),
child: Column(
child: Expanded(child:Column(
children: [
editItem(
S.of(context).xingming,
@ -114,7 +114,8 @@ class _EditAddressPage extends State<EditAddressPage> {
houseNumberController,
false),
],
),
),),
),
InkWell(
onTap: () {

45
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<StatefulWidget> createState() {
return _HotArticlePage();
return _TouTiao();
}
}
class _HotArticlePage extends State<HotArticlePage> {
class _TouTiao extends State<TouTiao> {
ApiService apiService;
List<BannerData> bannerData = [];
@override
void dispose() {
@ -78,6 +83,33 @@ class _HotArticlePage extends State<HotArticlePage> {
}
}
///banner
queryCourseBanner() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<PageInfo<BannerData>> 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,7 +121,10 @@ class _HotArticlePage extends State<HotArticlePage> {
// titleSize: 18.sp,
// ),
body: Container(
child: SmartRefresher(
child: Column(
children: [
SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
@ -119,6 +154,8 @@ class _HotArticlePage extends State<HotArticlePage> {
},
),
),
],
),
),
);
}

4
lib/community/community_details.dart

@ -205,13 +205,13 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
}
}
///
///
_queryMemberComment(String content) async {
BaseData baseData = await apiService.memberComment({
"content": content,
"parentId": parenId,
"relationalId": comunity.id,
"relationalType": 1
"relationalType":4
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState;

4
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<CommunityPage>
if (e == "关于我们") {
return BrandPage();
}else if(e == "头条"){
return HotArticlePage();
return ArticlePage();
}else if(e == "课程"){
return CommunityCourse();
}

1
lib/community/community_view/class_details.dart

@ -335,7 +335,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
),
flex: 1,
),
///
InputComment(
inputKey,

1
lib/community/community_view/home_class.dart

@ -225,7 +225,6 @@ class _HomeClass extends State<HomeClass> {
),
),
],),
],
),
Expanded(child:

176
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<Article> articles;
ArticleList(this.articles,);
@override
State<StatefulWidget> createState() {
return _ArticleList();
}
}
class _ArticleList extends State<ArticleList> {
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,
),
],
),
);
}
}

239
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<StatefulWidget> createState() {
return _ArticlePage();
}
}
class _ArticlePage extends State<ArticlePage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController();
ApiService apiService;
List<GlobalKey> globaKeys = [];
List<Brand> brands = [];
List<BannerData> bannerData = [];
List<Article> articles = [];
List<HeadlinesList> headlines = [];
int pageNum = 1;
@override
void initState() {
super.initState();
eventBus.on<EventType>().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<PageInfo<BannerData>> 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<PageInfo<Article>> 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<List<HeadlinesList>> 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<Widget> classChildItem() {
var widgets = <Widget>[
///banner
HeadlinesBanner(bannerData,),
SizedBox(height: 28),
///
HeadlinesCollection(headlines,articles),
///
ArticleList(articles),
];
return widgets;
}
@override
bool get wantKeepAlive => true;
}

119
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> bannerData;
HeadlinesBanner(this.bannerData);
@override
State<StatefulWidget> createState() {
return _HeadlinesBanner();
}
}
class _HeadlinesBanner extends State<HeadlinesBanner> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
List<BannerData> 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 0123,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;
}
}
}

166
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<HeadlinesList> headlines;
final List<Article> articles;
HeadlinesCollection(this.headlines,this.articles);
@override
State<StatefulWidget> createState() {
return _HeadlinesCollection();
}
}
class _HeadlinesCollection extends State<HeadlinesCollection> {
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,
),
],),
],),
),
],
),
);
}
}

344
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<String, dynamic> arguments;
HeadlinesColumnDetails({this.arguments});
@override
State<StatefulWidget> createState() {
return _HeadlinesColumnDetails();
}
}
class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
with WidgetsBindingObserver {
ApiService apiService;
List<Article> articles;
HeadlinesListDetails headlinesListDetails;
List<HeadlinesList> 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<HeadlinesListDetails> 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<List<HeadlinesList>> 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,
),
],
)),
],
),
);
}
}

4
lib/generated/intl/messages_en.dart

@ -121,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"buzhichikaipiao" : MessageLookupByLibrary.simpleMessage("不支持开票"),
"chakan" : MessageLookupByLibrary.simpleMessage("查看"),
"chakangengduo" : MessageLookupByLibrary.simpleMessage("查看更多"),
"chakanhexiaoma" : MessageLookupByLibrary.simpleMessage("查看核销码"),
"chakanquanyi" : MessageLookupByLibrary.simpleMessage("查看权益"),
"chakanshixiaoquan" : MessageLookupByLibrary.simpleMessage("查看失效券"),
"chakanwodekabao" : MessageLookupByLibrary.simpleMessage("查看我的卡包"),
@ -157,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),
@ -171,6 +173,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
"dianzanxihuan_" : m3,
"dingdan" : MessageLookupByLibrary.simpleMessage("订单"),
"dingdanbianhao" : MessageLookupByLibrary.simpleMessage("订单编号"),
"dingdandaifahuo" : MessageLookupByLibrary.simpleMessage("订单待发货"),
"dingdandaizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"),
"dingdangenzong" : MessageLookupByLibrary.simpleMessage("订单跟踪"),
@ -469,6 +472,7 @@ class MessageLookup extends MessageLookupByLibrary {
"shiyongriqi" : MessageLookupByLibrary.simpleMessage("使用日期"),
"shiyongshuoming" : MessageLookupByLibrary.simpleMessage("使用说明"),
"shiyongtiaojian" : MessageLookupByLibrary.simpleMessage("使用条件"),
"shouhuodi" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuodizhi" : MessageLookupByLibrary.simpleMessage("请输入详细收货地址"),
"shouhuodizhi1" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuorenshoujihao" : MessageLookupByLibrary.simpleMessage("请输入收货人手机号"),

4
lib/generated/intl/messages_zh_CN.dart

@ -121,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"buzhichikaipiao" : MessageLookupByLibrary.simpleMessage("不支持开票"),
"chakan" : MessageLookupByLibrary.simpleMessage("查看"),
"chakangengduo" : MessageLookupByLibrary.simpleMessage("查看更多"),
"chakanhexiaoma" : MessageLookupByLibrary.simpleMessage("查看核销码"),
"chakanquanyi" : MessageLookupByLibrary.simpleMessage("查看权益"),
"chakanshixiaoquan" : MessageLookupByLibrary.simpleMessage("查看失效券"),
"chakanwodekabao" : MessageLookupByLibrary.simpleMessage("查看我的卡包"),
@ -157,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),
@ -171,6 +173,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
"dianzanxihuan_" : m3,
"dingdan" : MessageLookupByLibrary.simpleMessage("订单"),
"dingdanbianhao" : MessageLookupByLibrary.simpleMessage("订单编号"),
"dingdandaifahuo" : MessageLookupByLibrary.simpleMessage("订单待发货"),
"dingdandaizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"),
"dingdangenzong" : MessageLookupByLibrary.simpleMessage("订单跟踪"),
@ -467,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"shiyongriqi" : MessageLookupByLibrary.simpleMessage("使用日期"),
"shiyongshuoming" : MessageLookupByLibrary.simpleMessage("使用说明"),
"shiyongtiaojian" : MessageLookupByLibrary.simpleMessage("使用条件"),
"shouhuodi" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuodizhi" : MessageLookupByLibrary.simpleMessage("请输入详细收货地址"),
"shouhuodizhi1" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuorenshoujihao" : MessageLookupByLibrary.simpleMessage("请输入收货人手机号"),

4
lib/generated/intl/messages_zh_Hans_CN.dart

@ -121,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"buzhichikaipiao" : MessageLookupByLibrary.simpleMessage("不支持开票"),
"chakan" : MessageLookupByLibrary.simpleMessage("查看"),
"chakangengduo" : MessageLookupByLibrary.simpleMessage("查看更多"),
"chakanhexiaoma" : MessageLookupByLibrary.simpleMessage("查看核销码"),
"chakanquanyi" : MessageLookupByLibrary.simpleMessage("查看权益"),
"chakanshixiaoquan" : MessageLookupByLibrary.simpleMessage("查看失效券"),
"chakanwodekabao" : MessageLookupByLibrary.simpleMessage("查看我的卡包"),
@ -157,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),
@ -171,6 +173,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
"dianzanxihuan_" : m3,
"dingdan" : MessageLookupByLibrary.simpleMessage("订单"),
"dingdanbianhao" : MessageLookupByLibrary.simpleMessage("订单编号"),
"dingdandaifahuo" : MessageLookupByLibrary.simpleMessage("订单待发货"),
"dingdandaizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"),
"dingdangenzong" : MessageLookupByLibrary.simpleMessage("订单跟踪"),
@ -467,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"shiyongriqi" : MessageLookupByLibrary.simpleMessage("使用日期"),
"shiyongshuoming" : MessageLookupByLibrary.simpleMessage("使用说明"),
"shiyongtiaojian" : MessageLookupByLibrary.simpleMessage("使用条件"),
"shouhuodi" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuodizhi" : MessageLookupByLibrary.simpleMessage("请输入详细收货地址"),
"shouhuodizhi1" : MessageLookupByLibrary.simpleMessage("收货地址"),
"shouhuorenshoujihao" : MessageLookupByLibrary.simpleMessage("请输入收货人手机号"),

3
lib/generated/intl/messages_zh_Hant_CN.dart

@ -121,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"buzhichikaipiao" : MessageLookupByLibrary.simpleMessage("不支持開票"),
"chakan" : MessageLookupByLibrary.simpleMessage("查看"),
"chakangengduo" : MessageLookupByLibrary.simpleMessage("查看更多"),
"chakanhexiaoma" : MessageLookupByLibrary.simpleMessage("查看核銷碼"),
"chakanquanyi" : MessageLookupByLibrary.simpleMessage("查看權益"),
"chakanshixiaoquan" : MessageLookupByLibrary.simpleMessage("查看失效券"),
"chakanwodekabao" : MessageLookupByLibrary.simpleMessage("查看我的卡包"),
@ -157,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"),
@ -171,6 +173,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("點我領取"),
"dianzanxihuan_" : m3,
"dingdan" : MessageLookupByLibrary.simpleMessage("訂單"),
"dingdanbianhao" : MessageLookupByLibrary.simpleMessage("訂單編號"),
"dingdandaifahuo" : MessageLookupByLibrary.simpleMessage("訂單待發貨"),
"dingdandaizhifu" : MessageLookupByLibrary.simpleMessage("訂單待支付"),
"dingdangenzong" : MessageLookupByLibrary.simpleMessage("訂單跟蹤"),

4
lib/generated/intl/messages_zh_TW.dart

@ -121,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"buzhichikaipiao" : MessageLookupByLibrary.simpleMessage("不支持開票"),
"chakan" : MessageLookupByLibrary.simpleMessage("查看"),
"chakangengduo" : MessageLookupByLibrary.simpleMessage("查看更多"),
"chakanhexiaoma" : MessageLookupByLibrary.simpleMessage("查看核銷碼"),
"chakanquanyi" : MessageLookupByLibrary.simpleMessage("查看權益"),
"chakanshixiaoquan" : MessageLookupByLibrary.simpleMessage("查看失效券"),
"chakanwodekabao" : MessageLookupByLibrary.simpleMessage("查看我的卡包"),
@ -157,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"),
@ -171,6 +173,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("點我領取"),
"dianzanxihuan_" : m3,
"dingdan" : MessageLookupByLibrary.simpleMessage("訂單"),
"dingdanbianhao" : MessageLookupByLibrary.simpleMessage("訂單編號"),
"dingdandaifahuo" : MessageLookupByLibrary.simpleMessage("訂單待發貨"),
"dingdandaizhifu" : MessageLookupByLibrary.simpleMessage("訂單待支付"),
"dingdangenzong" : MessageLookupByLibrary.simpleMessage("訂單跟蹤"),
@ -467,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"shiyongriqi" : MessageLookupByLibrary.simpleMessage("使用日期"),
"shiyongshuoming" : MessageLookupByLibrary.simpleMessage("使用说明"),
"shiyongtiaojian" : MessageLookupByLibrary.simpleMessage("使用条件"),
"shouhuodi" : MessageLookupByLibrary.simpleMessage("收貨地址"),
"shouhuodizhi" : MessageLookupByLibrary.simpleMessage("請輸入詳細收貨地址"),
"shouhuodizhi1" : MessageLookupByLibrary.simpleMessage("收貨地址"),
"shouhuorenshoujihao" : MessageLookupByLibrary.simpleMessage("請輸入收貨人手機號"),

40
lib/generated/l10n.dart

@ -5495,6 +5495,46 @@ class S {
);
}
/// ``
String get dingdanbianhao {
return Intl.message(
'订单编号',
name: 'dingdanbianhao',
desc: '',
args: [],
);
}
/// ``
String get shouhuodi {
return Intl.message(
'收货地址',
name: 'shouhuodi',
desc: '',
args: [],
);
}
/// ``
String get chakanhexiaoma {
return Intl.message(
'查看核销码',
name: 'chakanhexiaoma',
desc: '',
args: [],
);
}
/// ``
String get dangqianzhukadengji {
return Intl.message(
'当前主卡等级',
name: 'dangqianzhukadengji',
desc: '',
args: [],
);
}
/// `使`
String get privacy_policy4 {
return Intl.message(

2
lib/integral/intergra_view/integral_vip.dart

@ -68,7 +68,7 @@ class _IntegralVip extends State<IntegralVip> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
(widget.signInfo != null && widget.signInfo.rank != null)
(widget?.signInfo?.rank?.rankName != null)
? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}"
: "",
style: TextStyle(

5
lib/l10n/intl_en.arb

@ -569,6 +569,11 @@
"querenbangding": "确认绑定",
"zanweikaitong": "暂未开通",
"huiyuanquanyi": "会员权益",
"dingdanbianhao": "订单编号",
"shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

6
lib/l10n/intl_zh_CN.arb

@ -567,7 +567,11 @@
"jinxingbangdingfuka": "进行绑定副卡",
"fukashoujihao": "副卡手机号",
"querenbangding": "确认绑定",
"dingdanbianhao": "订单编号",
"shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

6
lib/l10n/intl_zh_Hans_CN.arb

@ -567,7 +567,11 @@
"jinxingbangdingfuka": "进行绑定副卡",
"fukashoujihao": "副卡手机号",
"querenbangding": "确认绑定",
"dingdanbianhao": "订单编号",
"shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

4
lib/l10n/intl_zh_Hant_CN.arb

@ -562,6 +562,10 @@
"jinxingbangdingfuka": "進行綁定副卡",
"fukashoujihao": "副卡手機號",
"querenbangding": "確認綁定",
"dingdanbianhao": "訂單編號",
"chakanhexiaoma": "查看核銷碼",
"chakanwuliu": "查看物流",
"dangqianzhukadengji": "當前主卡等級",

6
lib/l10n/intl_zh_TW.arb

@ -561,6 +561,12 @@
"jinxingbangdingfuka": "進行綁定副卡",
"fukashoujihao": "副卡手機號",
"querenbangding": "確認綁定",
"dingdanbianhao": "訂單編號",
"shouhuodi": "收貨地址",
"chakanhexiaoma": "查看核銷碼",
"chakanwuliu": "查看物流",
"dangqianzhukadengji": "當前主卡等級",

9
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';
@ -82,6 +83,7 @@ import 'mine/mine_vip/binding_assistant_card.dart';
import 'mine/mine_vip/legal_right_details.dart';
import 'mine/mine_vip/mine_attainment_page.dart';
import 'mine/mine_vip/mine_vip_core.dart';
import 'order/exchange_write_off_page.dart';
import 'view_widget/vip_dialog.dart';
import 'mine/release_page.dart';
import 'mine/roll_center_page.dart';
@ -237,6 +239,8 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
ExchangeOrderSuccessPage(arguments: arguments),
'/router/logistics_information_page': (context, {arguments}) =>
LogisticsInformationPage(arguments: arguments),
'/router/exchange_write_offPage': (context, {arguments}) =>
ExchangeWriteOffPage(arguments: arguments),
'/router/integral_store_page': (context, {arguments}) =>
IntegralStoreDetailsPage(arguments: arguments),
'/router/manage_address_page': (context, {arguments}) =>
@ -248,7 +252,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/mine_vip_core': (context, {arguments}) =>
MineVipCore(arguments: arguments),
'/router/legal_right_details': (context, {arguments}) =>
LegalRightDetails(),
LegalRightDetails(arguments: arguments),
'/router/binding_assistant_card': (context, {arguments}) =>
BindingAssistantCard(),
'/router/order_history_page': (context, {arguments}) =>
@ -295,7 +299,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/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(),
@ -321,4 +325,5 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/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),
};

19
lib/mine/mine_page.dart

@ -118,7 +118,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss();
}
///(/)
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@ -196,16 +196,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
tag: "vip",
ranks: ranks,
userInfo: userInfo,
rank: (userInfo != null)
? int.tryParse(userInfo.points)
: 0,
rankMax: (userInfo != null &&
userInfo.memberRankVo != null)
? userInfo.memberRankVo.rankOrigin
: 0,
createTime: (userInfo != null)
? userInfo.createTime
: "",
rank: double.tryParse(userInfo?.expendAmount??"0").toInt(),
rankMax: userInfo?.memberRankVo?.nextOrigin??0,
createTime: userInfo?.createTime??"",
),
],
),
@ -305,7 +298,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
}
/////
/////
Widget attention(){
return Container(
margin: EdgeInsets.only(left: 16,top: 10),
@ -400,7 +393,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
),
SizedBox(width: 5,),
Text(
"1",
infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,

2
lib/mine/mine_view/community_follow.dart

@ -31,7 +31,7 @@ class _CommunityFollow extends State<CommunityFollow>
querySocialInfo();
}
///(/)
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(

85
lib/mine/mine_vip/binding_assistant_card.dart

@ -35,6 +35,25 @@ class _BindingAssistantCard extends State<BindingAssistantCard> {
});
}
///
queryBindSecondCard(phone) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.bindSecondCard(phone);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("绑定成功", alignment: Alignment.center);
Navigator.of(context).pop(true);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -46,8 +65,7 @@ class _BindingAssistantCard extends State<BindingAssistantCard> {
),
body: Stack(
children: [
Expanded(
child: Column(
Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 26.h),
@ -92,35 +110,35 @@ class _BindingAssistantCard extends State<BindingAssistantCard> {
height: 1,
color: Color(0xFFF4F4F4),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: InkWell(
onTap: () {},
child: editItem(
"验证码",
"",
S.of(context).qingshuruyanzhengma,
addressController,
false),
)),
Padding(
padding: EdgeInsets.only(right: 16, top: 10),
child: GestureDetector(
onTap: () {},
child: Text(
"发送验证",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF32A060),
),
),
)),
],
),
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Expanded(
// child: InkWell(
// onTap: () {},
// child: editItem(
// "验证码",
// "",
// S.of(context).qingshuruyanzhengma,
// addressController,
// false),
// )),
// Padding(
// padding: EdgeInsets.only(right: 16, top: 10),
// child: GestureDetector(
// onTap: () {},
// child: Text(
// "发送验证",
// style: TextStyle(
// fontSize: 14.sp,
// fontWeight: FontWeight.bold,
// color: Color(0xFF32A060),
// ),
// ),
// )),
// ],
// ),
Container(
margin:
EdgeInsets.symmetric(horizontal: 16, vertical: 5),
@ -133,12 +151,13 @@ class _BindingAssistantCard extends State<BindingAssistantCard> {
),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () {
setState(() {
queryBindSecondCard(mobileController.text);
});
},
child: Container(
color: Color(0xFF32A060),

491
lib/mine/mine_vip/legal_right_details.dart

@ -1,22 +1,31 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/second_card_list.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/mine_vip_view.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
class LegalRightDetails extends StatefulWidget {
final Map<String, dynamic> arguments;
LegalRightDetails({this.arguments});
@override
State<StatefulWidget> createState() {
return _LegalRightDetails();
@ -25,17 +34,67 @@ class LegalRightDetails extends StatefulWidget {
class _LegalRightDetails extends State<LegalRightDetails> {
ApiService apiService;
List<VipBenefitList> vipBenefitList = [];
final SwiperController controller = SwiperController();
int checkIndex = 0;
ScrollController _scrollController = ScrollController();
List<SecondCardList> secondCardList = [];
bool offsetOnEnd = false;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
});
vipBenefitList.addAll(widget.arguments["vipBenefitList"]);
querySecondCardList();
}
///
querySecondCardList() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<SecondCardList>> baseData =
await apiService.secondCardList().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
secondCardList.clear();
secondCardList.addAll(baseData.data);
if (secondCardList.length < 5) {
var isSecondCard = SecondCardList();
isSecondCard.isAdd = true;
secondCardList.add(isSecondCard);
}
});
}
EasyLoading.dismiss();
}
///
queryUnbindSecondCard(phone) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.unbindSecondCard(phone);
if (baseData != null && baseData.isSuccess) {
querySecondCardList();
SmartDialog.showToast("解绑成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
@ -49,50 +108,64 @@ class _LegalRightDetails extends State<LegalRightDetails> {
background: Colors.transparent,
leadingColor: Colors.white,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
body: Column(
children: [
Container(
height: 130,
margin: EdgeInsets.only(top: 24),
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)),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
controller: _scrollController,
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 10),
itemCount: 15,
itemCount: vipBenefitList == null ? 0 : vipBenefitList.length,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {});
setState(() {
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(),
child: legalRightItem(vipBenefitList[position], position),
);
},
),
),
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,
),
),
Container(
padding: EdgeInsets.only(left: 16, right: 49),
Expanded(
child: Container(
decoration: BoxDecoration(
border: Border.all(
width: 0,
@ -142,7 +215,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
),
SizedBox(width: 6.w),
Text(
"可绑定5位副卡",
vipBenefitList[checkIndex].name,
style: TextStyle(
fontSize: 17.sp,
fontWeight: FontWeight.bold,
@ -175,6 +248,12 @@ class _LegalRightDetails extends State<LegalRightDetails> {
),
],
),
Container(
padding: EdgeInsets.only(left: 16, right: 49),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).quanyijishao,
style: TextStyle(
@ -186,15 +265,25 @@ class _LegalRightDetails extends State<LegalRightDetails> {
SizedBox(
height: 8.h,
),
Text(
"用户在成为金卡会员/共创会员之后,即可进行副卡绑定。点击添加新副卡,输入需要绑定用户的手机号,输入验证码,"
"验证通过后,即可绑定成功。点击头像右下方的解除,出现提示弹窗,点击确认即可解除绑定。",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
height: 1.5,
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,
@ -210,116 +299,39 @@ class _LegalRightDetails extends State<LegalRightDetails> {
SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (vipBenefitList[checkIndex]?.describes != null &&
vipBenefitList[checkIndex].describes != "")
Container(
width: 6.w,
height: 6.h,
margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF79572D),
),
),
Text(
"副卡用户必须为平台注册用户",
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFF6E9),
child: Html(
data: vipBenefitList[checkIndex]?.describes ?? "",
style: {
"html": Style(
color: Color(0xFF674119),
),
},
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
return Container();
},
),
],
),
SizedBox(
height: 6,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 6.w,
height: 6.h,
margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF79572D),
),
),
Text(
"每位主卡用户只可绑定5位副卡用户,同时,只能解绑3次",
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF674119),
),
},
),
],
),
SizedBox(
height: 6,
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (vipBenefitList[checkIndex].name == "副卡" &&
vipBenefitList[checkIndex].actived &&
vipBenefitList[checkIndex].have)
Container(
width: 6.w,
height: 6.h,
margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF79572D),
),
),
Text(
"副卡享受主卡的部分权益,主卡会员失效后,副卡也失效",
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF674119),
),
),
],
),
SizedBox(
height: 6,
),
Row(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 6.w,
height: 6.h,
margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF79572D),
),
),
Text(
"副卡成为金卡会员后,自动与主卡解绑",
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF674119),
),
),
],
),
SizedBox(
height: 20,
),
Text(
"${S.of(context).yibangfuka}(0/5)",
"${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,
@ -333,15 +345,20 @@ class _LegalRightDetails extends State<LegalRightDetails> {
],
),
),
)
],
),
),
],
),
),
))
],
),
);
}
///
unbindShowDeleteDialog() {
unbindShowDeleteDialog(phone) {
showDialog(
context: context,
builder: (context) {
@ -410,7 +427,10 @@ class _LegalRightDetails extends State<LegalRightDetails> {
fontWeight: FontWeight.bold,
),
onTap: () {
setState(() {
queryUnbindSecondCard(phone);
Navigator.of(context).pop();
});
},
),
flex: 1,
@ -426,34 +446,91 @@ class _LegalRightDetails extends State<LegalRightDetails> {
}
///
Widget legalRightItem() {
return Container(
margin: EdgeInsets.only(left: 20),
Widget legalRightItem(VipBenefitList vipBenefitList, index) {
return Column(
children: [
Expanded(
child: Opacity(
opacity: index == checkIndex ? 1 : 0.6,
child: Container(
width: 80,
alignment: Alignment.center,
child: Column(
children: [
Opacity(
opacity: 1,
// MImage(
// "assets/image/badge_img.png",
// width: 80,
// height: 80,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
child: Image.asset(
"assets/image/vip_qy.png",
Stack(
alignment: Alignment.bottomCenter,
children: [
MImage(
vipBenefitList?.icon ?? "",
width: 50,
height: 50,
fit: BoxFit.cover,
// 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(
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,
),
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,
@ -465,6 +542,29 @@ class _LegalRightDetails extends State<LegalRightDetails> {
),
],
),
),
)),
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,
),
),
],
);
}
@ -473,7 +573,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
return Column(
children: [
GridView.builder(
itemCount: 4,
itemCount: secondCardList == null ? 0 : secondCardList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
@ -484,14 +584,12 @@ class _LegalRightDetails extends State<LegalRightDetails> {
//Widget之间间距
mainAxisSpacing: 5,
//Widget宽高比例
// childAspectRatio: AppUtils.textScale(context) > 1
// ? (1 - ((AppUtils.textScale(context) - 1)))
// : 0.48,
childAspectRatio: 1.2,
),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {},
child: assistantItem(),
child: assistantItem(secondCardList[index]),
);
},
),
@ -499,25 +597,28 @@ class _LegalRightDetails extends State<LegalRightDetails> {
);
}
Widget assistantItem() {
Widget assistantItem(SecondCardList secondCardList) {
return Container(
alignment: Alignment.center,
child:
Column(
child: !(secondCardList.isAdd ?? false)
? Column(
children: [
Stack(
alignment: Alignment.bottomRight,
children: [
Image.asset(
"assets/image/icon_idea_ya.png",
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();
unbindShowDeleteDialog(secondCardList.phone);
});
},
child: Image.asset(
@ -533,7 +634,31 @@ class _LegalRightDetails extends State<LegalRightDetails> {
height: 5.h,
),
Text(
"123****6789",
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,
@ -542,29 +667,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
),
],
),
// GestureDetector(
// onTap: (){
// Navigator.of(context).pushNamed('/router/binding_assistant_card');
// },
// 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,
// ),
// ),
// ],
// ),
// ),
),
);
}
}

340
lib/mine/mine_vip/mine_attainment_page.dart

@ -1,17 +1,22 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/achievement_detail_list.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/data/vip_badges_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/badge_attainment_dialog.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class MineAttainmentPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -28,7 +33,11 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
ApiService apiService;
final RefreshController _refreshController = RefreshController();
UserInfo userInfo;
var checkIndex = 1;
List<VipBadgesList> vipBadgesList = [];
List<AchievementDetailList> achievementDetail = [];
int checkPosition = 0;
SocialInfo infoNumber;
@override
void dispose() {
@ -40,19 +49,91 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
void initState() {
super.initState();
userInfo = widget.arguments["userInfo"];
queryAttainmentBadges();
querySocialInfo();
}
///
queryAttainmentBadges() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<VipBadgesList>> baseData =
await apiService.findBadges({}).catchError((error) {
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
vipBadgesList.clear();
vipBadgesList.addAll(baseData.data);
setState(() {
_refreshController.refreshCompleted();
});
} else {
_refreshController.refreshFailed();
}
}
///
queryAchievementDetail(index) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<AchievementDetailList>> baseData = await apiService
.getAchievementDetail(vipBadgesList[index].id)
.catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
achievementDetail.clear();
achievementDetail.addAll(baseData.data);
showDeleteDialog(index);
});
}
EasyLoading.dismiss();
}
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: false,
);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
});
}
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
return Container(decoration: BoxDecoration(
return Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/attainment_bj.png"),
),
),child:Scaffold(
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
title: "我的成就",
title:S.of(context).wodechengjiu,
titleColor: Colors.black,
titleSize: 18.sp,
background: Colors.transparent,
@ -83,7 +164,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
),
SizedBox(height: 28),
Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
margin:
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
@ -119,14 +201,14 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)),
),
Text(
"0",
infoNumber != null ? infoNumber.achievementNumber.toString() :"0",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14,
color: Color(0xFF32A060)),
),
Text(
"/8)",
"/${vipBadgesList.length})",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14,
@ -148,7 +230,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
///
Widget attainmentBadge() {
return GridView.builder(
itemCount: 8,
itemCount: vipBadgesList == null ? 0 : vipBadgesList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
@ -166,38 +248,34 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
showDeleteDialog();
setState(() {
queryAchievementDetail(index);
});
},
child: badgeItem(),
child: badgeItem(vipBadgesList[index]),
);
},
);
}
Widget badgeItem() {
Widget badgeItem(VipBadgesList vipBadgesList) {
return Container(
alignment: Alignment.center,
child: Column(
children: [
// MImage(
// "assets/image/badge_img.png",
// width: 80,
// height: 80,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
Image.asset(
"assets/image/badge_img.png",
MImage(
vipBadgesList?.icon ?? "",
width: 80,
height: 80,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(
height: 4.h,
),
Text(
"签到",
vipBadgesList?.name ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF181818),
@ -211,18 +289,19 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
}
///
showDeleteDialog() {
showDeleteDialog(index) {
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(builder: (context, state) {
return StatefulBuilder(builder: (
context,
state,
) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 385.h,
height: 430.h,
child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
@ -239,14 +318,18 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
],
),
),
Image.asset(
"assets/image/badge_img.png",
MImage(
// this.vipBadgesList[index].icon,
achievementDetail[checkPosition].icon,
width: 150,
height: 150,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(height: 10),
Text(
"消费白银徽章",
"${vipBadgesList.length >index ?vipBadgesList[index].name :""}${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].name:""}徽章",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
@ -257,7 +340,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
height: 6.h,
),
Text(
"消费268.4元即可升级",
"${vipBadgesList.length >index ? vipBadgesList[index].name :""} ${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].lessScore :""} 即可升级",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
@ -279,110 +362,90 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
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(
"+ 10",
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),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
Expanded(
child: Container(
height: double.maxFinite,
margin: EdgeInsets.only(top:14),
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount: achievementDetail == null
? 0
: achievementDetail.length,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
state(() {
checkIndex = 1;
checkPosition = position;
});
},
child: Column(
children: [
Image.asset(
"assets/image/qt_badge.png",
width: checkIndex != 1 ? 30 : 55,
height: checkIndex != 1 ? 30 : 55,
fit: BoxFit.cover,
),
SizedBox(height: 10),
Text(
"青铜",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFA3A3A3),
),
),
],
),
),
Container(
width: 35.w,
height: 2.h,
decoration: new BoxDecoration(
color: Color(0xFFE1F2F7),
),
),
GestureDetector(
onTap: () {
state(() {
checkIndex = 2;
});
child: badgeGradeItem(achievementDetail[position],
position, achievementDetail.length),
);
},
child: Column(
children: [
Image.asset(
"assets/image/by_badge.png",
width: checkIndex != 2 ? 35 : 65,
height: checkIndex != 2 ? 35 : 65,
fit: BoxFit.cover,
),
SizedBox(height: 10),
Text(
"白银",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFA3A3A3),
),
),
)
],
),
),
Container(
width: 35.w,
height: 2.h,
decoration: new BoxDecoration(
color: Color(0xFFE1F2F7),
),
),
GestureDetector(
onTap: () {
state(() {
checkIndex = 3;
);
});
},
child: Column(
);
}
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) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
"assets/image/hj_badge.png",
width: checkIndex != 3 ? 35 : 65,
height: checkIndex != 3 ? 35 : 65,
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
MImage(
achievementDetail?.icon ?? "",
width: checkPosition == position ? 50 : 30,
height: checkPosition == position ? 50 : 30,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(height: 10),
Text(
"黄金",
achievementDetail?.name ?? "",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -391,47 +454,32 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (position != size - 1)
Container(
width: 35.w,
height: 2.h,
// margin: EdgeInsets.only(top: 25),
decoration: new BoxDecoration(
color: Color(0xFFE1F2F7),
),
),
GestureDetector(
onTap: () {
state(() {
checkIndex = 4;
});
},
child: Column(
children: [
Image.asset(
"assets/image/qt_badge.png",
width: checkIndex != 4 ? 35 : 65,
height: checkIndex != 4 ? 35 : 65,
fit: BoxFit.cover,
),
SizedBox(height: 10),
Text(
"铂金",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFA3A3A3),
),
),
],
),
),
SizedBox(height: 20),
])
],
),
],
),
),
);
});
}
///()
showAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return BadgeAttainmentDialog();
},
);
}

343
lib/mine/mine_vip/mine_vip_core.dart

@ -1,14 +1,21 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/mine_vip_view.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
@ -29,6 +36,9 @@ class MineVipCore extends StatefulWidget {
class _MineVipCore extends State<MineVipCore> {
ApiService apiService;
List<Rank> ranks = [];
List<VipBenefitList> vipBenefitList = [];
VipRuleDetails vipRuleDetails;
int checkIndex = 0;
final SwiperController controller = SwiperController();
@ -37,9 +47,24 @@ class _MineVipCore extends State<MineVipCore> {
super.initState();
SharedPreferences.getInstance().then((value) {
if (widget.arguments["rankLevel"] == 1 &&
!(value.getBool("FirstYinKa") ?? false)) {
showAlertDialog("银卡会员");
value.setBool("FirstYinKa", true);
} 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)) {
showAlertDialog("共创会员");
value.setBool("FirstGongC", true);
}
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryVipLevel();
queryBenefitList();
queryRuleDetails();
});
}
@ -56,17 +81,154 @@ class _MineVipCore extends State<MineVipCore> {
}
}
///
queryBenefitList() async {
BaseData<List<VipBenefitList>> 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));
});
}
EasyLoading.dismiss();
}
//////
queryRuleDetails() async {
BaseData<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipRuleDetails = baseData.data;
});
}
EasyLoading.dismiss();
}
///
buyRank() async {
// if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
// await Min.initialize();
// }
BaseData<dynamic> baseData = await apiService
.rankBuy({"buyType": 2, "rankId": ranks[checkIndex].id});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if (event.errCode == 0) {
widget.arguments["rankLevel"] = ranks[checkIndex].level;
queryVipLevel();
showAlertDialog(ranks[checkIndex].rankName);
} else {
SmartDialog.showToast("支付失败", alignment: Alignment.center);
return;
}
});
} 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,
),
body: SingleChildScrollView(
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),
),
),
),
Column(
children: [
SizedBox(height: 40),
Container(
child:Row(
children: [
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,
),
),
),
)
],
),
),
Expanded(child:
SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
@ -80,6 +242,11 @@ class _MineVipCore extends State<MineVipCore> {
loop: false,
physics: BouncingScrollPhysics(),
controller: controller,
onIndexChanged: (index) {
setState(() {
checkIndex = index;
});
},
itemBuilder: (context, position) {
return MineVipView(
vipLevel: !(ranks != null && ranks.isNotEmpty)
@ -93,7 +260,7 @@ class _MineVipCore extends State<MineVipCore> {
padding: 6.w,
rank: !(ranks != null && ranks.isNotEmpty)
? 0
: widget.arguments["points"],
: widget.arguments["expendAmount"] ?? 0,
rankMax: !(ranks != null && ranks.isNotEmpty)
? 0
: (position < (ranks.length - 1))
@ -204,17 +371,19 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(
height: 12.h,
),
Padding(
if (vipRuleDetails?.qa != null && vipRuleDetails.qa != "")
Container(
color: Colors.white,
padding: EdgeInsets.only(left: 8),
child: Text(
"会员共分为3个等级,分别是银卡会员、金卡会员、共创会员。其中,银卡会员和金卡会员由用户的消费金额决定,"
"消费金额越高,会员等级越高,享受到的会员权益也越多。而共创会员需要直接购买,但是它的权益包含银卡和金卡的,属于最高等级会员。",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
height: 1.5,
color: Color(0xFF4C4C4C),
child: Html(
data: vipRuleDetails?.qa ?? "",
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
return Container();
},
),
},
),
),
],
@ -267,10 +436,12 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(
height: 12.h,
),
Image.asset(
"assets/image/vip_contrastive_table.png",
MImage(
vipRuleDetails?.contrast ?? "",
width: double.infinity,
height: 281,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(
height: 16.h,
@ -330,47 +501,31 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(
height: 12.h,
),
Text(
"1.用户每消费1元可获得1个积分。",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF4C4C4C),
),
),
SizedBox(
height: 8.h,
),
Text(
"2.通过完成积分详情-做任务得积分来获得积分。",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF4C4C4C),
),
),
SizedBox(
height: 8.h,
),
Text(
"3.优惠金额无法累积积分,订单撤销或其他原因造成的未成功支付的订单,无法获得对应的积分。",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
height: 1.5,
color: Color(0xFF4C4C4C),
if (vipRuleDetails?.rule != null &&
vipRuleDetails.rule != "")
Container(
color: Colors.white,
child: Html(
data: vipRuleDetails?.rule ?? "",
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
return Container();
},
),
},
),
SizedBox(
height: 8.h,
),
],
),
),
if (ranks.length > checkIndex &&
widget.arguments["rankLevel"] < ranks[checkIndex].level &&
ranks[checkIndex].price != "0.00")
InkWell(
onTap: () {
setState(() {
showAlertDialog();
buyRank();
});
},
child: Container(
@ -388,7 +543,7 @@ class _MineVipCore extends State<MineVipCore> {
height: 54,
alignment: Alignment.center,
child: Text(
"${S.of(context).lijikaitong}20000/永久",
"${S.of(context).lijikaitong}${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
@ -396,16 +551,21 @@ class _MineVipCore extends State<MineVipCore> {
),
),
),
)
),
],
),
),
],
),
)),
],
),
],
);
}
///vip
Widget levelItem(Rank rank, rankOrigin, rankOriginMax) {
return Container(
margin: EdgeInsets.symmetric(vertical: 8.h),
@ -445,7 +605,7 @@ class _MineVipCore extends State<MineVipCore> {
///
Widget vipLegalRight() {
return GridView.builder(
itemCount: 13,
itemCount: vipBenefitList == null ? 0 : vipBenefitList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
@ -464,15 +624,17 @@ class _MineVipCore extends State<MineVipCore> {
return GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/legal_right_details', arguments: {});
.pushNamed('/router/legal_right_details', arguments: {
"vipBenefitList": vipBenefitList,
});
},
child: vipLegalRightItem(),
child: vipLegalRightItem(vipBenefitList[index]),
);
},
);
}
Widget vipLegalRightItem() {
Widget vipLegalRightItem(VipBenefitList vipBenefitList) {
return Container(
alignment: Alignment.center,
child: Column(
@ -480,23 +642,15 @@ class _MineVipCore extends State<MineVipCore> {
Stack(
alignment: Alignment.bottomCenter,
children: [
Opacity(
opacity: 0.3,
// MImage(
// "assets/image/badge_img.png",
// width: 80,
// height: 80,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
child: Image.asset(
"assets/image/vip_qy.png",
MImage(
vipBenefitList?.icon ?? "",
width: 36,
height: 36,
fit: BoxFit.cover,
),
// 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),
@ -516,21 +670,50 @@ class _MineVipCore extends State<MineVipCore> {
Text(
"暂未开放",
style: TextStyle(
color: Color(0xFF181818),
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,
),
Text(
"暂未解锁",
style: TextStyle(
color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular,
fontSize: 9.sp,
),
),
],
),
),
],
),
SizedBox(
height: 5.h,
),
Text(
"储值优惠",
Expanded(
child: Text(
vipBenefitList?.name ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
@ -539,19 +722,19 @@ class _MineVipCore extends State<MineVipCore> {
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)),
],
),
);
}
///
showAlertDialog() {
showAlertDialog(vipName) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return VipDialog();
return VipDialog(vipName);
},
);
}

2
lib/mine/mine_vip_level_page.dart

@ -81,7 +81,7 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
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,

195
lib/mine/recharge_page.dart

@ -1,12 +1,17 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.dart';
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/utils/min.dart';
import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -23,10 +28,11 @@ class RechargePage extends StatefulWidget {
class _RechargePage extends State<RechargePage> {
ApiService apiService;
TextEditingController controller = TextEditingController();
VipRuleDetails vipRuleDetails;
List<VipBenefitList> vipBenefitList = [];
Color color = Colors.black;
double discount = 100;
@override
void initState() {
@ -35,8 +41,41 @@ class _RechargePage extends State<RechargePage> {
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), pay: true);
queryBenefitList();
queryRuleDetails();
});
}
///
queryBenefitList() async {
BaseData<List<VipBenefitList>> baseData = await apiService.benefitList().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipBenefitList.clear();
vipBenefitList.addAll(baseData.data);
vipBenefitList.forEach((element) {
if(element.have && element.config != null && element.code == "RECHARGE"){
discount = double.parse(element.config);
}
});
});
}
EasyLoading.dismiss();
}
//////
queryRuleDetails() async {
BaseData<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipRuleDetails = baseData.data;
});
}
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
@ -48,20 +87,25 @@ class _RechargePage extends State<RechargePage> {
background: Color(0xFFFFFFFF),
leadingColor: Colors.black,
),
body: SingleChildScrollView(
body:Stack(
children: [
SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child: Column(
children: [
Container(
child: Column(children: [
ItemInputWidget(
S.of(context).qingshuruchongzhijine,
hintText: "",
controller: controller,
padding: EdgeInsets.all(20),
errorText: S.of(context).chongzhizuixiaojine(10),
errorText: S.of(context).chongzhizuixiaojine(0.1),
titleColor: Color(0xFF727272),
errorTextColor: Color(0xFF32A060),
radius: 8,
discount: discount/10,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 27.sp,
@ -81,12 +125,36 @@ class _RechargePage extends State<RechargePage> {
setState(() {});
},
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
if (vipRuleDetails?.recharge != null &&
vipRuleDetails.recharge != "")
Expanded(child:Container(
color: Colors.white,
padding: EdgeInsets.only(left: 8),
child: Html(
data: "注意:${vipRuleDetails?.recharge??""}",
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
return Container();
},
),
},
),
),)
],
),
],),
),
Container(
width: double.infinity,
margin: EdgeInsets.only(
left: 20.w,
right: 20.w,
top: 12.h,
left: 0.w,
right: 0.w,
top: 16.h,
bottom: 4.h,
),
padding: EdgeInsets.only(
@ -96,15 +164,8 @@ class _RechargePage extends State<RechargePage> {
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),
// borderRadius: BorderRadius.circular(4),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -152,33 +213,84 @@ class _RechargePage extends State<RechargePage> {
],
),
),
InkWell(
onTap: () {
recharge();
},
child: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
// InkWell(
// onTap: () {
// recharge();
// },
// child: Container(
// // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// RoundButton(
// width: double.infinity,
// height: 46.h,
// text: S.of(context).querenchongzhi,
// textColor: Colors.white,
// fontSize: 14.sp,
// backgroup: Color(0xff32A060),
// fontWeight: FontWeight.bold,
// ),
// ],
// ),
// ),
// ),
],
),
),
),
Align(alignment: Alignment.bottomCenter,child:
Container(
height: 54.h,
color: Colors.white,
child: Row(
children: [
Spacer(),
Padding(padding: EdgeInsets.only(top: 7,right: 16),
child:Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RoundButton(
width: double.infinity,
height: 46.h,
text: S.of(context).querenchongzhi,
textColor: Colors.white,
fontSize: 14.sp,
backgroup: Color(0xff32A060),
fontWeight: FontWeight.bold,
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
],
),
Text(
controller.text == "" ? "" :(double.parse(controller.text) * (discount/100)).toString(),
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
],
)),
GestureDetector(
onTap: () {
recharge();
},
child: RoundButton(
width: 103.w,
height: 54.h,
text: S.of(context).chongzhi,
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
radius: 0,
fontSize: 16.sp,
padding: EdgeInsets.symmetric(vertical: 5.h),
),
),
],
),
))
],
),
);
}
@ -207,8 +319,8 @@ class _RechargePage extends State<RechargePage> {
}
int amount = int.tryParse(money);
if (checkIndex == 1) {
if (amount < 10) {
SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10),
if (amount < 0.001) {
SmartDialog.showToast(S.of(context).chongzhizuixiaojine(0.001),
alignment: Alignment.center);
return;
}
@ -220,10 +332,10 @@ class _RechargePage extends State<RechargePage> {
await Min.initialize();
}
BaseData<WxPay> baseData =
BaseData<dynamic> baseData =
await apiService.recharge({"amount": amount, "rechargeType": 2});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data;
WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
@ -240,8 +352,19 @@ class _RechargePage extends State<RechargePage> {
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if(event.errCode == 0){
Navigator.of(context).pop();
SmartDialog.showToast("充值成功", alignment: Alignment.center);
}
else{
SmartDialog.showToast("充值失败", alignment: Alignment.center);
return;
}
});
}
else{
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
}
}

97
lib/order/exchange_history_page.dart

@ -263,6 +263,10 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
SizedBox(
height: 16.h,
),
exchangeOrder.useTyped == 1 ?
Container(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -318,6 +322,36 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
)
],
),
],
),
):
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).shouhuodi + " :",
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.recAddress ?? "",
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)
],
),
SizedBox(
height: 16.h,
),
@ -423,8 +457,8 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
IconText(
S.of(context).youxiaoqizhi(exchangeOrder.updateTime),
leftImage: "assets/image/icon_order_time.png",
"${S.of(context).dingdanbianhao}: ${exchangeOrder.orderCode}",
leftImage: "assets/image/bianhao.png",
iconSize: 16,
textStyle: TextStyle(
fontSize: 12.sp,
@ -432,16 +466,38 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
color: Color(0xFF353535),
),
),
exchangeOrder.useTyped == 1 ?
GestureDetector(
onTap: () {
if (exchangeOrder.state == 1) {
receive2Card(exchangeOrder.id);
} else {
Navigator.of(context)
.pushNamed('/router/write_off_page', arguments: {});
}
// if (exchangeOrder.state == 1) {
// receive2Card(exchangeOrder.id);
// } else {
// Navigator.of(context)
// .pushNamed('/router/write_off_page', arguments: {});
// }
Navigator.of(context).pushNamed(
'/router/exchange_write_offPage',
arguments: {
"exchangeOrder": exchangeOrder.toJson(),
});
},
child: buildBtnStatus(exchangeOrder.state),
):
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pushNamed(
'/router/logistics_information_page',
arguments: {
"orderId": exchangeOrder.creditOrderDetailList[0].orderId,
"logisticsNum": "",
"logisticsName": "",
"productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber,
"skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg
});
});
},
child: buildBtnStatusTow(exchangeOrder.state),
),
],
)
@ -461,7 +517,30 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
if (state == 1) {
return RoundButton(
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
text: S.of(context).lingqudaokabao,
text: S.of(context).chakanhexiaoma,
textColor: Colors.white,
fontSize: 12,
backgroup: Color(0xFF32A060),
radius: 2,
);
} else {
return Container();
// return BorderText(
// text: S.of(context).shanchudingdan,
// textColor: Color(0xFF32A060),
// borderWidth: 1,
// borderColor: Color(0xFF32A060),
// fontSize: 12,
// padding: EdgeInsets.fromLTRB(14, 4, 14, 4),
// );
}
}
Widget buildBtnStatusTow(state) {
if (state == 1) {
return RoundButton(
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
text: S.of(context).chakanwuliu,
textColor: Colors.white,
fontSize: 12,
backgroup: Color(0xFF32A060),

283
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<ExchangeOrderPage> {
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
if(value.getString("minMember") == null){
return;
}
Map<String, dynamic> 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<ExchangeOrderPage> {
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<ExchangeOrderPage> {
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<ExchangeOrderPage> {
fontSize: 14.sp,
color: Color(0xFF353535),
),
)),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
),
],
),
),),
Visibility(
child: SizedBox(
height: 13.h,
@ -227,6 +248,85 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
],
),
):
// Container(
// margin:
// EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
// padding: EdgeInsets.all(20),
// decoration: BoxDecoration(
// color: Colors.white,
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// )
// ],
// borderRadius: BorderRadius.all(Radius.circular(8)),
// ),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Image.asset(
// "assets/image/icon_order_exchange_info.png",
// width: 24,
// height: 24,
// ),
// SizedBox(width: 4),
// Text(
// S.of(context).duihuanxinxi,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 16,
// color: Color(0xFF353535)),
// ),
// ],
// ),
// SizedBox(
// height: 18.h,
// ),
// Row(
// children: [
// Text(
// S.of(context).lingqufangshi,
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF353535),
// ),
// ),
// SizedBox(
// width: 12.w,
// ),
// Text(
// widget.arguments["useTyped"] == 1
// ? S.of(context).ziti
// : widget.arguments["useTyped"] == 2
// ? S.of(context).peisong
// : S.of(context).xianshangfafang,
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF353535),
// ),
// ),
// ],
// ),
// SizedBox(
// height: 12.h,
// ),
// Text(
// "非实物商品兑换后领取到卡包即可使用!",
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF32A060),
// fontWeight: MyFontWeight.medium
// ),
// ),
// ],
// ),
// ),
Container(
margin:
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
@ -244,8 +344,6 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
@ -267,7 +365,12 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox(
height: 18.h,
),
Row(
GestureDetector(onTap: (){
setState(() {
showAlertDialog();
});
},
child: Row(
children: [
Text(
S.of(context).lingqufangshi,
@ -279,7 +382,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SizedBox(
width: 12.w,
),
Text(
Expanded(child:Text(
widget.arguments["useTyped"] == 1
? S.of(context).ziti
: widget.arguments["useTyped"] == 2
@ -289,20 +392,80 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
fontSize: 14.sp,
color: Color(0xFF353535),
),
)),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
),
],
),),
Visibility(
child: SizedBox(
height: 13.h,
),
SizedBox(
height: 12.h,
visible: widget.arguments["useTyped"] != 3,
),
Visibility(
child: Row(
children: [
Text(
"非实物商品兑换后领取到卡包即可使用!",
"收货地址",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
SizedBox(
width: 12.w,
),
Expanded(
child: GestureDetector(
onTap: () {
toAddressPicker();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Text(
(address != null && address != "")
? address
: widget.arguments["useTyped"] == 1
? S.of(context).qingxuanzhemendian
: widget.arguments["useTyped"] ==
2
? S
.of(context)
.qingxuanzeshouhuodizhi
: S.of(context).xuni,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontWeight: MyFontWeight.medium
),
),
flex: 1,
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
),
],
),
),
flex: 1,
),
],
),
visible: widget.arguments["useTyped"] != 3,
),
SizedBox(
height: 12.h,
),
],
),
),
@ -638,43 +801,43 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
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,
),
@ -766,6 +929,21 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
);
}
///
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
@ -827,6 +1005,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
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",
@ -861,6 +1040,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if(event.errCode == 0){
Navigator.of(context).popAndPushNamed(
'/router/exchange_order_success_page',
arguments: {
@ -871,9 +1051,15 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
? "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())),
"points": points,
"realPay":handleNeedPay(),
"payChannel":widget.arguments["payChannel"],
},
);
}else {
SmartDialog.showToast("支付失败", alignment: Alignment.center);
return;
}
});
return;
}
@ -884,6 +1070,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
(widget.arguments["price"] == null || widget.arguments["price"] == "0"
? "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())),
"realPay":handleNeedPay(),
"points": points,
"payChannel":widget.arguments["payChannel"],
"id": baseDate.data

2
lib/order/exchange_order_success_page.dart

@ -87,7 +87,7 @@ class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> {
child: Column(
children: [
Text(
widget.arguments["price"],
widget.arguments["realPay"],
style: TextStyle(
color: Colors.black,
fontSize: 21.sp,

290
lib/order/exchange_write_off_page.dart

@ -0,0 +1,290 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/exchange_order.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/separator.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:qr_flutter/qr_flutter.dart';
class ExchangeWriteOffPage extends StatefulWidget {
final arguments;
ExchangeWriteOffPage({this.arguments});
@override
State<StatefulWidget> createState() {
return _ExchangeWriteOffPage();
}
}
class _ExchangeWriteOffPage extends State<ExchangeWriteOffPage> {
ExchangeOrder exchangeOrder;
@override
void initState() {
super.initState();
exchangeOrder = ExchangeOrder.fromJson(widget.arguments["exchangeOrder"]);
if (mounted) setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF32A060),
appBar: MyAppBar(
title: S.of(context).hexiaomaxiangqing,
titleSize: 18.sp,
titleColor: Colors.white,
background: Color(0xFF32A060),
leadingColor: Colors.white,
),
body: Container(
alignment: Alignment.topCenter,
child: Stack(
alignment: Alignment.topCenter,
children: [
Image.asset(
"assets/image/icon_write_off_bg.png",
width: MediaQuery.of(context).size.width * 0.912,
fit: BoxFit.fill,
),
LayoutBuilder(builder: (context, constraints) {
return Container(
width: constraints.constrainWidth() * 0.912,
child: Column(
children: [
Expanded(
child: Container(
child: Column(
children: [
Text(
exchangeOrder != null ? exchangeOrder.creditOrderDetailList[0].name : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF353535)),
),
SizedBox(
height: 8.h,
),
Text(
(exchangeOrder.updateTime == null) ? "" : S.of(context).youxiaoqi(
"${exchangeOrder.updateTime}"),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF353535),
),
),
],
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
),
alignment: Alignment.center,
),
flex: 6,
),
Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: MySeparator(
width: 5.w,
height: 1.h,
color: Color(0xFFA29E9E),
),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
exchangeOrder != null
? "${exchangeOrder.id.substring(0, 4)} "
"${exchangeOrder.id.substring(4, 8)} "
"${exchangeOrder.id.substring(8, 12)} "
"${exchangeOrder.id.substring(12, 16)} "
"${exchangeOrder.id.substring(16, exchangeOrder.id.length)}"
: "",
style: TextStyle(
fontSize: 14.sp,
wordSpacing: exchangeOrder == null
? 10
: (MediaQuery.of(context).size.width -
64.w) /
(((exchangeOrder.id.length) * 4)),
letterSpacing: exchangeOrder == null
? 8
: (MediaQuery.of(context).size.width -
64.w) /
(((exchangeOrder.id.length) * 4)),
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
),
SizedBox(
height: 12.h,
),
BarcodeWidget(
barcode: Barcode.code128(useCode128C: true),
data: exchangeOrder != null ? exchangeOrder.id : "",
height: 72.h,
color: Colors.black,
drawText: false,
),
SizedBox(
height: 16.h,
),
Expanded(child: QrImage(
data: exchangeOrder != null ? exchangeOrder.id : "",
version: QrVersions.auto,
size: 200.w,
gapless: true,
),),
SizedBox(
height: 35.h,
),
],
),
margin: EdgeInsets.symmetric(horizontal: 20.w),
),
flex: 27,
),
Container(
child: MySeparator(
width: 5.w,
height: 1.h,
color: Color(0xFFA29E9E),
),
margin: EdgeInsets.only(left: 20.w, right: 20.w),
),
Expanded(
child: Container(
padding: EdgeInsets.fromLTRB(20.w, 15.h, 20.w, 24.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 3.w,
height: 15.h,
margin:
EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF20662A),
),
),
Text(
S.of(context).shiyongtiaojian,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 11.w,
),
Expanded(
child: Text(
S
.of(context)
.qianwanghuixiangmendianduihuanhexiao,
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 14.sp,
color: Color(0xFF353535)),
),
flex: 1,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 3.w,
height: 15.h,
margin: EdgeInsets.fromLTRB(4, 7, 4, 7),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF20662A),
),
),
Text(
S.of(context).shiyongshuoming,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Color(0xFF353535)),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 11.w,
),
Text(
S.of(context).zitiduihuanquan,
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 11.w,
),
Text(
S.of(context).huixiangrenyimendian,
style: TextStyle(
textBaseline: TextBaseline.alphabetic,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
],
),
],
),
),
flex: 13,
),
Expanded(
child: Container(),
flex: 3,
),
],
),
);
})
],
),
),
);
}
}

53
lib/order/logistics_information_page.dart

@ -6,6 +6,7 @@ import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/logistics.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:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
@ -35,8 +36,12 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
SharedPreferences.getInstance().then((value) {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
if((widget.arguments["shipperCode"]??"") != "" &&
(widget.arguments["logisticsNum"]??"") != "")
getShippingTrace(widget.arguments["shipperCode"] ?? "",
widget.arguments["logisticsNum"] ?? "");
else
queryAppShippingTrace(widget.arguments["orderId"]);
});
}
@ -63,6 +68,27 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
}
}
queryAppShippingTrace(orderId) async {
BaseData<Logistics> baseData =
await apiService.getAppShippingTrace(orderId).catchError((error) {
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
Logistics lgs = baseData.data;
logistics.clear();
logistics.addAll(lgs.traces.reversed);
setState(() {
shipStatus = logisticsStatus(lgs.state);
widget.arguments["logisticsName"] = lgs.shipperCode;
widget.arguments["logisticsNum"] = lgs.logisticCode;
if (logistics.length > 0) logistics[0].acceptStation += shipStatus;
_refreshController.refreshCompleted();
});
} else {
_refreshController.refreshFailed();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -115,12 +141,13 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
color: Color(0xff353535)),
),
),
SizedBox(
height: 500.h,
Container(
child: (logistics != null && logistics.length > 0)
? ListView.builder(
itemCount:
logistics != null ? logistics.length : 0,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return orderTrackItem(logistics[position],
position, logistics.length);
@ -166,19 +193,13 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
Stack(
alignment: Alignment.bottomCenter,
children: [
if (widget.arguments["skuImg"] != null)
Image.network(
widget.arguments["skuImg"],
width: 95.w,
height: 95.h,
fit: BoxFit.cover,
)
else
Image.asset(
"assets/image/default_1.png",
width: 95.w,
height: 95.h,
MImage(
widget.arguments["skuImg"] != null ? widget.arguments["skuImg"] : "",
width: 95,
height: 95,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
Container(
padding: EdgeInsets.only(
@ -409,7 +430,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
String tripStatus = "assets/image/icon_sign.png";
if (type.contains("已签收")) {
tripStatus = "assets/image/icon_sign.png";
} else if (type.contains("派送中")) {
} else if (type.contains("派送中") || type.contains("派件中")) {
tripStatus = "assets/image/icon_delivery.png";
} else if (type.contains("运输中") || type.contains("发往")) {
tripStatus = "assets/image/icon_transport.png";
@ -425,7 +446,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
String logisticsTripStatus = "";
if (state.contains("已签收")) {
logisticsTripStatus = "已签收";
} else if (state.contains("派送中")) {
} else if (state.contains("派送中") || state.contains("派件中")) {
logisticsTripStatus = "派送中";
} else if (state.contains("运输中") || state.contains("发往")) {
logisticsTripStatus = "运输中";

77
lib/order/order_view/order_commodity.dart

@ -87,9 +87,21 @@ class _OrderCommodity extends State<OrderCommodity> {
);
}
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<OrderCommodity> {
),
);
}
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<OrderCommodity> {
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<OrderCommodity> {
);
}
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<OrderCommodity> {
),
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,
),

4
lib/order/write_off_page.dart

@ -138,12 +138,12 @@ class _WriteOffPage extends State<WriteOffPage> {
SizedBox(
height: 16.h,
),
QrImage(
Expanded(child: QrImage(
data: coupon != null ? coupon.id : "",
version: QrVersions.auto,
size: 200.w,
gapless: true,
),
),),
SizedBox(
height: 35.h,
),

248
lib/retrofit/data/achievement_detail_list.dart

@ -0,0 +1,248 @@
/// id : "1460450874352317701"
/// createTime : "2021-11-12 11:42:08"
/// createUser : "123"
/// updateTime : "2021-11-19 13:59:36"
/// updateUser : "1"
/// categoryId : "1460904379451179008"
/// name : "青铜"
/// level : 0
/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/dd1bd6f1-6079-46ab-8d0f-6a946048db9d.png"
/// score : 1
/// actived : true
/// sort : 0
/// isDelete : 0
/// 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({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String categoryId,
String name,
int level,
String icon,
int score,
bool actived,
int sort,
int isDelete,
String lessScore,
List<RewardList> rewardList,
bool max,
bool get,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_categoryId = categoryId;
_name = name;
_level = level;
_icon = icon;
_score = score;
_actived = actived;
_sort = sort;
_isDelete = isDelete;
_lessScore = lessScore;
_rewardList = rewardList;
_max = max;
_get = get;
}
AchievementDetailList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_categoryId = json['categoryId'];
_name = json['name'];
_level = json['level'];
_icon = json['icon'];
_score = json['score'];
_actived = json['actived'];
_sort = json['sort'];
_isDelete = json['isDelete'];
_lessScore = json['lessScore'];
if (json['rewardList'] != null) {
_rewardList = [];
json['rewardList'].forEach((v) {
_rewardList.add(RewardList.fromJson(v));
});
}
_max = json['max'];
_get = json['get'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _categoryId;
String _name;
int _level;
String _icon;
int _score;
bool _actived;
int _sort;
int _isDelete;
String _lessScore;
List<RewardList> _rewardList;
bool _max;
bool _get;
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 name => _name;
int get level => _level;
String get icon => _icon;
int get score => _score;
bool get actived => _actived;
int get sort => _sort;
int get isDelete => _isDelete;
String get lessScore => _lessScore;
List<RewardList> get rewardList => _rewardList;
bool get max => _max;
bool get get => _get;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['categoryId'] = _categoryId;
map['name'] = _name;
map['level'] = _level;
map['icon'] = _icon;
map['score'] = _score;
map['actived'] = _actived;
map['sort'] = _sort;
map['isDelete'] = _isDelete;
map['lessScore'] = _lessScore;
if (_rewardList != null) {
map['rewardList'] = _rewardList.map((v) => v.toJson()).toList();
}
map['max'] = _max;
map['get'] = _get;
return map;
}
}
/// 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
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;
}
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;
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;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
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;
}
}

12
lib/retrofit/data/exchange_order.dart

@ -12,7 +12,11 @@ class ExchangeOrder {
String mid;
String orderCode;
String amount;
String money;
int payStatus;
int sendStatus;
String address;
String recAddress;
int state;
int useTyped;
int isDelete;
@ -28,7 +32,11 @@ class ExchangeOrder {
..mid = json['mid'] as String
..orderCode = json['orderCode'] as String
..amount = json['amount'] as String
..money = json['money'] as String
..payStatus = json['payStatus'] as int
..sendStatus = json['sendStatus'] as int
..address = json['address'] as String
..recAddress = json['recAddress'] as String
..state = json['state'] as int
..useTyped = json['useTyped'] as int
..isDelete = json['isDelete'] as int
@ -48,7 +56,11 @@ class ExchangeOrder {
'mid': this.mid,
'orderCode': this.orderCode,
'amount': this.amount,
'money': this.money,
'payStatus': this.payStatus,
'sendStatus': this.sendStatus,
'address': this.address,
'recAddress': this.recAddress,
'state': this.state,
'useTyped': this.useTyped,
'isDelete': this.isDelete,

6
lib/retrofit/data/goods.dart

@ -42,6 +42,7 @@ class Goods {
String money,
String onePrice,
String oneMoney,
String orderId,
int stock,
int sales,
bool isHot,
@ -68,6 +69,7 @@ class Goods {
_money = money;
_onePrice = onePrice;
_oneMoney = oneMoney;
_orderId = orderId;
_stock = stock;
_sales = sales;
_isHot = isHot;
@ -97,6 +99,7 @@ class Goods {
_money = json['money'];
_onePrice = json['onePrice'];
_oneMoney = json['oneMoney'];
_orderId = json['orderId'];
_stock = json['stock'];
_sales = json['sales'];
_isHot = json['isHot'];
@ -124,6 +127,7 @@ class Goods {
String _money;
String _onePrice;
String _oneMoney;
String _orderId;
int _stock;
int _sales;
bool _isHot;
@ -151,6 +155,7 @@ class Goods {
String get money => _money;
String get onePrice => _onePrice;
String get oneMoney => _oneMoney;
String get orderId => _orderId;
int get stock => _stock;
int get sales => _sales;
bool get isHot => _isHot;
@ -180,6 +185,7 @@ class Goods {
map['money'] = _money;
map['onePrice'] = _onePrice;
map['oneMoney'] = _oneMoney;
map['orderId'] = _orderId;
map['stock'] = _stock;
map['sales'] = _sales;
map['isHot'] = _isHot;

99
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<String, dynamic> toJson() {
final map = <String, dynamic>{};
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;
}
}

99
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<String, dynamic> toJson() {
final map = <String, dynamic>{};
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;
}
}

5
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;

6
lib/retrofit/data/rank.dart

@ -18,6 +18,7 @@ class Rank {
String _rankImg;
String _rankName;
int _rankOrigin;
int _level;
bool _status;
String _updateTime;
String _updateUser;
@ -30,6 +31,7 @@ class Rank {
String get rankImg => _rankImg;
String get rankName => _rankName;
int get rankOrigin => _rankOrigin;
int get level => _level;
bool get status => _status;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
@ -42,6 +44,7 @@ class Rank {
String rankImg,
String rankName,
int rankOrigin,
int level,
bool status,
String updateTime,
String updateUser}){
@ -53,6 +56,7 @@ class Rank {
_rankImg = rankImg;
_rankName = rankName;
_rankOrigin = rankOrigin;
_level = level;
_status = status;
_updateTime = updateTime;
_updateUser = updateUser;
@ -67,6 +71,7 @@ class Rank {
_rankImg = json["rankImg"];
_rankName = json["rankName"];
_rankOrigin = json["rankOrigin"];
_level = json["level"];
_status = json["status"];
_updateTime = json["updateTime"];
_updateUser = json["updateUser"];
@ -82,6 +87,7 @@ class Rank {
map["rankImg"] = _rankImg;
map["rankName"] = _rankName;
map["rankOrigin"] = _rankOrigin;
map["level"] = _level;
map["status"] = _status;
map["updateTime"] = _updateTime;
map["updateUser"] = _updateUser;

73
lib/retrofit/data/second_card_list.dart

@ -0,0 +1,73 @@
/// id : "1438426197401796608"
/// phone : "18672306891"
/// nickname : "冬天的秘密"
/// headimg : ""
class SecondCardList {
SecondCardList({
String id,
String phone,
String nickname,
String headimg,
bool isAdd,
}) {
_id = id;
_phone = phone;
_nickname = nickname;
_headimg = headimg;
_isAdd = isAdd;
}
SecondCardList.fromJson(dynamic json) {
_id = json['id'];
_phone = json['phone'];
_nickname = json['nickname'];
_headimg = json['headimg'];
}
String _id;
String _phone;
String _nickname;
String _headimg;
bool _isAdd;
String get id => _id;
String get phone => _phone;
String get nickname => _nickname;
String get headimg => _headimg;
bool get isAdd => _isAdd;
set id(String value) {
_id = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['phone'] = _phone;
map['nickname'] = _nickname;
map['headimg'] = _headimg;
return map;
}
set phone(String value) {
_phone = value;
}
set nickname(String value) {
_nickname = value;
}
set headimg(String value) {
_headimg = value;
}
set isAdd(bool value) {
_isAdd = value;
}
}

11
lib/retrofit/data/settleOrderInfo.dart

@ -8,6 +8,7 @@ class SettleOrderInfo {
dynamic memberVO;
String postAge;
String price;
String benefitDiscountAmount;
String orderSum;
String discountAmount;
List<PromotionInfoListBean> promotionInfoList;
@ -25,6 +26,7 @@ class SettleOrderInfo {
settleOrderInfoBean.memberVO = map['memberVO'];
settleOrderInfoBean.postAge = map['postAge'];
settleOrderInfoBean.price = map['price'];
settleOrderInfoBean.benefitDiscountAmount = map['benefitDiscountAmount'];
settleOrderInfoBean.orderSum = map['orderSum'];
settleOrderInfoBean.discountAmount = map['discountAmount'];
settleOrderInfoBean.promotionInfoList = List()..addAll(
@ -48,6 +50,7 @@ class SettleOrderInfo {
"memberVO": memberVO,
"postAge": postAge,
"price": price,
"benefitDiscountAmount": benefitDiscountAmount,
"orderSum": orderSum,
"discountAmount": discountAmount,
"promotionInfoList": promotionInfoList,
@ -202,6 +205,7 @@ class SettleOrderInfo {
/// promotionName : "<EFBFBD><EFBFBD>10-8"
/// usable : true
/// allProduct : true
/// isMaxCoupon:true
/// productList : null
class CouponListBean {
@ -228,6 +232,7 @@ class CouponListBean {
String promotionName;
bool usable;
bool allProduct;
bool isMaxCoupon;
dynamic productList;
bool isEx;
@ -258,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;
}
@ -286,6 +292,7 @@ class CouponListBean {
"promotionName": promotionName,
"usable": usable,
"allProduct": allProduct,
"isMaxCoupon": isMaxCoupon,
"productList": productList,
};
@ -318,6 +325,7 @@ class CouponListBean {
/// isDelete : 0
/// tenantCode : "1175"
/// canPartake : true
/// isMaxPromotion : true
/// promotionProuctList : null
class PromotionInfoListBean {
@ -348,6 +356,7 @@ class PromotionInfoListBean {
int isDelete;
String tenantCode;
bool canPartake;
bool isMaxPromotion;
dynamic promotionProuctList;
static PromotionInfoListBean fromJson(Map<String, dynamic> map) {
@ -384,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;
}
@ -416,6 +426,7 @@ class PromotionInfoListBean {
"isDelete": isDelete,
"tenantCode": tenantCode,
"canPartake": canPartake,
"isMaxPromotion": isMaxPromotion,
"promotionProuctList": promotionProuctList,
};
}

264
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<ShoppingCartSkuItemListBean> shoppingCartSkuItemList;
String storeId;
int selectDiscount;
String storeName;
String tableId;
List<PromotionInfoListBean> promotionInfoList;
List<CouponListBean> couponList;
static ShoppingCart fromJson(Map<String, dynamic> 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,
};
}
@ -147,3 +162,252 @@ class PlatterListBean {
"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 : "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>"
/// 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<PromotionDetailBean> promotionDetail;
List<String> channels;
bool isVip;
int isDelete;
String tenantCode;
bool canPartake;
bool isMaxPromotion;
dynamic promotionProuctList;
static PromotionInfoListBean fromJson(Map<String, dynamic> 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 : "<EFBFBD><EFBFBD>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<String, dynamic> 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,
};
}

12
lib/retrofit/data/social_info.dart

@ -4,20 +4,25 @@
class SocialInfo {
SocialInfo({
int fans,
int follow,}){
int follow,
int achievementNumber}){
_fans = fans;
_follow = follow;
_achievementNumber = achievementNumber;
}
SocialInfo.fromJson(dynamic json) {
_fans = json['fans'];
_follow = json['follow'];
_achievementNumber = json['achievementNumber'];
}
int _fans;
int _follow;
int _achievementNumber;
int get fans => _fans;
int get follow => _follow;
int get achievementNumber => _achievementNumber;
set fans(int value) {
@ -28,10 +33,15 @@ class SocialInfo {
final map = <String, dynamic>{};
map['fans'] = _fans;
map['follow'] = _follow;
map['achievementNumber'] = _achievementNumber;
return map;
}
set follow(int value) {
_follow = value;
}
set achievementNumber(int value) {
_achievementNumber = value;
}
}

9
lib/retrofit/data/user_info.dart

@ -32,8 +32,11 @@ class UserInfo {
String birth;
dynamic balance;
String money;
String expendAmount;
String points;
bool isBind;
String masterId;
String masterCardRankName;
MemberRank memberRankVo;
factory UserInfo.fromJson(Map<String, dynamic> json) =>
@ -51,8 +54,11 @@ class UserInfo {
..birth = json['birth'] as String
..balance = json['balance']
..money = json['money'] as String
..expendAmount = json['expendAmount'] as String
..points = json['points'] as String
..isBind = json['isBind'] as bool
..masterId = json['masterId'] as String
..masterCardRankName = json['masterCardRankName'] as String
..memberRankVo = json['memberRankVo'] == null
? null
: MemberRank.fromJson(json['memberRankVo'] as Map<String, dynamic>);
@ -71,8 +77,11 @@ class UserInfo {
'birth': this.birth,
'balance': this.balance,
'money': this.money,
'expendAmount': this.expendAmount,
'points': this.points,
'isBind': this.isBind,
'masterId': this.masterId,
'masterCardRankName': this.masterCardRankName,
'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(),
};
}

147
lib/retrofit/data/vip_badges_list.dart

@ -0,0 +1,147 @@
/// id : "1460164746211753984"
/// createTime : "2021-11-15 16:36:19"
/// createUser : "1"
/// updateTime : "2021-11-17 11:39:54"
/// updateUser : "1"
/// name : "签到"
/// eachReward : 8
/// code : "SIGN"
/// icon : "https://pos.upload.gznl.top/admin/2021/11/93853f8d-ca0e-4c75-855b-d6245e4f6743.jpg"
/// actived : true
/// sort : 0
/// isDelete : 0
class VipBadgesList {
VipBadgesList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String name,
int eachReward,
String code,
String icon,
bool actived,
int sort,
int isDelete,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_name = name;
_eachReward = eachReward;
_code = code;
_icon = icon;
_actived = actived;
_sort = sort;
_isDelete = isDelete;
}
VipBadgesList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_name = json['name'];
_eachReward = json['eachReward'];
_code = json['code'];
_icon = json['icon'];
_actived = json['actived'];
_sort = json['sort'];
_isDelete = json['isDelete'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _name;
int _eachReward;
String _code;
String _icon;
bool _actived;
int _sort;
int _isDelete;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get name => _name;
int get eachReward => _eachReward;
String get code => _code;
String get icon => _icon;
bool get actived => _actived;
int get sort => _sort;
int get isDelete => _isDelete;
set id(String value) {
_id = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['name'] = _name;
map['eachReward'] = _eachReward;
map['code'] = _code;
map['icon'] = _icon;
map['actived'] = _actived;
map['sort'] = _sort;
map['isDelete'] = _isDelete;
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 name(String value) {
_name = value;
}
set eachReward(int value) {
_eachReward = value;
}
set code(String value) {
_code = value;
}
set icon(String value) {
_icon = value;
}
set actived(bool value) {
_actived = value;
}
set sort(int value) {
_sort = value;
}
set isDelete(int value) {
_isDelete = value;
}
}

127
lib/retrofit/data/vip_benefit_list.dart

@ -0,0 +1,127 @@
/// id : "5"
/// createTime : "2021-11-18 14:11:34"
/// createUser : "1"
/// updateTime : "2021-11-24 14:37:30"
/// updateUser : "1"
/// code : "DEPUTY"
/// name : "副卡"
/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/fb1e46d2-6213-4164-abbc-9aa24da24faf.png"
/// iconGrey : "https://pos.upload.gznl.top/MDAwMA==/2021/11/f50d211a-3d52-4663-bf8a-c4dff4f79310.png"
/// introduce : "<p>用户在成为金卡会员/共创会员之后, 即可经行副卡绑定。点击添加新副卡,输入需要绑定的用户手机号,输入需要绑定用户的手机号,输入验证码,验证通过后,即可绑定成功。点击头像右下方的解除,出现提示弹窗,点击确认即可解除绑定。</p>"
/// describes : "<ul>\n<li>副卡用户必须为平台注册用户</li>\n<li>每位主卡用户只可绑定5位副卡用户,同时,只能解绑3次</li>\n<li>副卡享受主卡的部分权益,主卡会员失效之后,副卡也失效</li>\n<li>副卡成为金卡会员后,自动与主卡解绑</li>\n</ul>"
/// actived : false
/// sort : 4
/// isDelete : 0
/// have : true
/// config : "5"
class VipBenefitList {
VipBenefitList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String code,
String name,
String icon,
String iconGrey,
String introduce,
String describes,
bool actived,
int sort,
int isDelete,
bool have,
String config,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_code = code;
_name = name;
_icon = icon;
_iconGrey = iconGrey;
_introduce = introduce;
_describes = describes;
_actived = actived;
_sort = sort;
_isDelete = isDelete;
_have = have;
_config = config;
}
VipBenefitList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_code = json['code'];
_name = json['name'];
_icon = json['icon'];
_iconGrey = json['iconGrey'];
_introduce = json['introduce'];
_describes = json['describes'];
_actived = json['actived'];
_sort = json['sort'];
_isDelete = json['isDelete'];
_have = json['have'];
_config = json['config'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _code;
String _name;
String _icon;
String _iconGrey;
String _introduce;
String _describes;
bool _actived;
int _sort;
int _isDelete;
bool _have;
String _config;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get code => _code;
String get name => _name;
String get icon => _icon;
String get iconGrey => _iconGrey;
String get introduce => _introduce;
String get describes => _describes;
bool get actived => _actived;
int get sort => _sort;
int get isDelete => _isDelete;
bool get have => _have;
String get config => _config;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['code'] = _code;
map['name'] = _name;
map['icon'] = _icon;
map['iconGrey'] = _iconGrey;
map['introduce'] = _introduce;
map['describes'] = _describes;
map['actived'] = _actived;
map['sort'] = _sort;
map['isDelete'] = _isDelete;
map['have'] = _have;
map['config'] = _config;
return map;
}
}

57
lib/retrofit/data/vip_rule_details.dart

@ -0,0 +1,57 @@
/// rule : ""
/// contrast : ""
/// qa : ""
class VipRuleDetails {
VipRuleDetails({
String rule,
String contrast,
String qa,
String recharge,}){
_rule = rule;
_contrast = contrast;
_qa = qa;
_recharge = recharge;
}
VipRuleDetails.fromJson(dynamic json) {
_rule = json['rule'];
_contrast = json['contrast'];
_qa = json['qa'];
_recharge = json['recharge'];
}
String _rule;
String _contrast;
String _qa;
String _recharge;
String get rule => _rule;
String get contrast => _contrast;
String get qa => _qa;
String get recharge => _recharge;
set rule(String value) {
_rule = value;
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['rule'] = _rule;
map['contrast'] = _contrast;
map['qa'] = _qa;
return map;
}
set contrast(String value) {
_contrast = value;
}
set qa(String value) {
_qa = value;
}
set recharge(String value) {
_recharge = value;
}
}

60
lib/retrofit/retrofit_api.dart

@ -17,6 +17,7 @@ import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import 'data/achievement_detail_list.dart';
import 'data/address.dart';
import 'data/banner.dart';
import 'data/brand_data.dart';
@ -29,18 +30,24 @@ 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';
import 'data/page.dart';
import 'data/rank.dart';
import 'data/second_card_list.dart';
import 'data/sign_info.dart';
import 'data/social_info.dart';
import 'data/store.dart';
import 'data/upload_result.dart';
import 'data/user_bill.dart';
import 'data/user_info.dart';
import 'data/vip_badges_list.dart';
import 'data/vip_benefit_list.dart';
import 'data/vip_card.dart';
import 'data/vip_rule_details.dart';
import 'data/wx_pay.dart';
part 'retrofit_api.g.dart';
@ -66,7 +73,7 @@ abstract class ApiService {
BuildContext context,
String token,
bool showLoading = true,
bool pay = false,
bool pay = true,
}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
@ -199,9 +206,9 @@ abstract class ApiService {
@GET("/member/signIn")
Future<BaseData> signIn();
///
///
@POST("/wallet/recharge")
Future<BaseData<WxPay>> recharge(@Body() Map<String, dynamic> param);
Future<BaseData<dynamic>> recharge(@Body() Map<String, dynamic> param);
///
@GET("/coupon/receive?couponId={couponId}")
@ -394,7 +401,7 @@ abstract class ApiService {
@DELETE("/information/trend/{id}")
Future<BaseData> deleteTrend(@Path("id") String id);
///(/)
///(//)
@GET("/member/socialInfo")
Future<BaseData<SocialInfo>> socialInfo();
@ -426,4 +433,49 @@ abstract class ApiService {
@GET("/course/likes/{courseId}")
Future<BaseData> courseLikes(@Path("courseId") String courseId);
/// APP查询所有成就徽章
@POST("/app-memberAchievement/findBadges")
Future<BaseData<List<VipBadgesList>>> findBadges(@Body() Map<String, dynamic> map);
///
@GET("/app-memberAchievement/getAchievementDetail?achievementCategoryId={achievementCategoryId}")
Future<BaseData<List<AchievementDetailList>>> getAchievementDetail(@Path("achievementCategoryId") String achievementCategoryId);
///
@GET("/member/benefitList")
Future<BaseData<List<VipBenefitList>>> benefitList();
///
@GET("/home/vipBenefit")
Future<BaseData<VipRuleDetails>> vipBenefit();
///
@GET("/member/secondCardList")
Future<BaseData<List<SecondCardList>>> secondCardList();
///
@GET("/member/bindSecondCard/{phone}")
Future<BaseData> bindSecondCard(@Path("phone") String phone);
///
@GET("/member/unbindSecondCard/{phone}")
Future<BaseData> unbindSecondCard(@Path("phone") String phone);
///
@GET("/creditOrder/getAppShippingTrace?orderId={orderId}")
Future<BaseData<Logistics>> getAppShippingTrace(@Path("orderId") String orderId);
///
@POST("/member/rankBuy")
Future<BaseData<dynamic>> rankBuy(@Body() Map<String, dynamic> param);
///
@GET("/information/categoryList")
Future<BaseData<List<HeadlinesList>>> headlinesList();
///
@GET("/information/category/{id}")
Future<BaseData<HeadlinesListDetails>> headlinesDetails(@Path("id") String id);
}

272
lib/retrofit/retrofit_api.g.dart

@ -271,7 +271,7 @@ class _ApiService implements ApiService {
}
@override
Future<BaseData<WxPay>> recharge(param) async {
Future<BaseData<dynamic>> recharge(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
@ -285,9 +285,9 @@ class _ApiService implements ApiService {
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<WxPay>.fromJson(
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => WxPay.fromJson(json),
(json) => json as dynamic,
);
return value;
}
@ -1393,29 +1393,6 @@ class _ApiService implements ApiService {
return value;
}
//
// @override
// Future<BaseData<dynamic>> catalogList(courseId) async {
// ArgumentError.checkNotNull(courseId, 'courseId');
// const _extra = <String, dynamic>{};
// final queryParameters = <String, dynamic>{};
// final _data = <String, dynamic>{};
// final _result = await _dio.request<Map<String, dynamic>>(
// '/course/catalogList/$courseId',
// queryParameters: queryParameters,
// options: RequestOptions(
// method: 'GET',
// headers: <String, dynamic>{},
// extra: _extra,
// baseUrl: baseUrl),
// data: _data);
// final value = BaseData<dynamic>.fromJson(
// _result.data,
// (json) => json as dynamic,
// );
// return value;
// }
@override
Future<BaseData<PageInfo<CourseList>>> courseList(map) async {
ArgumentError.checkNotNull(map, 'map');
@ -1531,4 +1508,247 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<List<VipBadgesList>>> findBadges(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('/app-memberAchievement/findBadges',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<VipBadgesList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<VipBadgesList>((i) => VipBadgesList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<List<AchievementDetailList>>> getAchievementDetail(achievementCategoryId) async {
ArgumentError.checkNotNull(achievementCategoryId, 'achievementCategoryId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/app-memberAchievement/getAchievementDetail?achievementCategoryId=$achievementCategoryId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<AchievementDetailList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<AchievementDetailList>((i) => AchievementDetailList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<List<VipBenefitList>>> benefitList() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/benefitList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<VipBenefitList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<VipBenefitList>((i) => VipBenefitList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<VipRuleDetails>> vipBenefit() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/home/vipBenefit',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<VipRuleDetails>.fromJson(
_result.data,
(json) => VipRuleDetails.fromJson(json),
);
return value;
}
@override
Future<BaseData<List<SecondCardList>>> secondCardList() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/secondCardList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<SecondCardList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<SecondCardList>((i) => SecondCardList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<dynamic>> bindSecondCard(phone) async {
ArgumentError.checkNotNull(phone, 'phone');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/bindSecondCard/$phone',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<dynamic>> unbindSecondCard(phone) async {
ArgumentError.checkNotNull(phone, 'phone');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/member/unbindSecondCard/$phone',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<Logistics>> getAppShippingTrace(orderId) async {
ArgumentError.checkNotNull(orderId, 'orderId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/creditOrder/getAppShippingTrace?orderId=$orderId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<Logistics>.fromJson(
_result.data,
(json) => Logistics.fromJson(json),
);
return value;
}
@override
Future<BaseData<dynamic>> rankBuy(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('/member/rankBuy',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<List<HeadlinesList>>> headlinesList() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/information/categoryList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<HeadlinesList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<HeadlinesList>((i) => HeadlinesList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<HeadlinesListDetails>> headlinesDetails(id) async {
ArgumentError.checkNotNull(id, 'id');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/information/category/$id',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<HeadlinesListDetails>.fromJson(
_result.data,
(json) => HeadlinesListDetails.fromJson(json),
);
return value;
}
}

5
lib/settlement/settlement.dart

@ -72,7 +72,8 @@ class _Settlement extends State<Settlement> {
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;
}
@ -397,7 +398,7 @@ class _Settlement extends State<Settlement> {
minOrderInfo,
),
////
/////
ActivityCouponRemarks(
couponCart,
activityCart,

46
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -35,7 +36,6 @@ class ActivityCouponRemarks extends StatefulWidget {
}
class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
@override
Widget build(BuildContext context) {
return Container(
@ -51,7 +51,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
],
borderRadius: BorderRadius.circular(8),
),
height: 122.h / (!widget.placeOrder ? 2 : 1),
// height: 122.h / (!widget.placeOrder ? 2 : 1),
margin: EdgeInsets.only(
left: 16,
right: 16,
@ -67,6 +67,36 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (widget.placeOrder && widget?.settleOrderInfo?.benefitDiscountAmount != null && widget?.settleOrderInfo?.benefitDiscountAmount != "0")
Container(
margin:EdgeInsets.only(bottom: 13),
child:Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Text(
"会员优惠金额",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
color: Color(0xFF353535),
),
),
),
Text(
widget.settleOrderInfo.benefitDiscountAmount,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
),
if (widget.placeOrder)
InkWell(
onTap: () {
@ -166,7 +196,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
),
),
),
Expanded(child:Text(
Expanded(
child: Text(
widget.remark,
textAlign: TextAlign.end,
style: TextStyle(
@ -174,7 +205,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
color: Color(0xFF353535),
fontWeight: MyFontWeight.semi_bold,
),
),),
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
@ -191,7 +223,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String promotion = "";
if (widget.promotions == null || widget.promotions == "") {
promotion = "未选择任何活动";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.promotionInfoList == null) {
if (widget.settleOrderInfo == null ||
widget.settleOrderInfo.promotionInfoList == null) {
promotion = "暂无可选活动";
} else if (widget.coupons != null && widget.coupons != "") {
promotion = "活动与优惠券不可同享";
@ -206,7 +239,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String coupon = "";
if (widget.coupons == null || widget.coupons == "") {
coupon = "未选择任何优惠券";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.couponList == null) {
if (widget.settleOrderInfo == null ||
widget.settleOrderInfo.couponList == null) {
coupon = "暂无可选优惠券";
} else if (widget.promotions != null && widget.promotions != "") {
coupon = "优惠券与活动不可同享";

25
lib/store/store_order.dart

@ -62,6 +62,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
int numberOfPeople = 0;
///token
String minToken;
String pid;
String cid;
@override
void initState() {
@ -243,7 +245,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
padding: EdgeInsets.all(10),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
@ -254,8 +256,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
flexibleSpace: FlexibleSpaceBar(
title: Title(
controller,
storeInfo != null ? storeInfo.storeName : '',
),
storeInfo != null ? storeInfo.storeName : ''),
collapseMode: CollapseMode.pin,
stretchModes: [
StretchMode.zoomBackground,
@ -546,7 +547,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
return;
}
}
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
@ -554,6 +554,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
"tableId": tableId,
"parentCode": parentCode,
"parentId": parentId,
"pid":pid,
"cid":cid,
"shoppingCart": shopCarGoods,
"numberOfPeople": numberOfPeople,
},
@ -731,12 +733,27 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
Future<ShoppingCart> queryShopCar() async {
pid="";
cid="";
BaseData<List<ShoppingCart>> 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;

6
lib/utils/flutter_utils.dart

@ -29,6 +29,12 @@ class AppUtils {
return exp.hasMatch(mobile);
}
static String phoneEncode(String phone){
if(phone == null || phone.length != 11)
return phone;
return phone.substring(0,3) + "****" + phone.substring(phone.length-4);
}
static double textScale(context) {
double textScaleFactor = MediaQuery.of(context).textScaleFactor;
// print("textScaleFactor: $textScaleFactor");

104
lib/view_widget/badge_attainment_dialog.dart

@ -0,0 +1,104 @@
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 BadgeAttainmentDialog extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _BadgeAttainmentDialog();
}
}
class _BadgeAttainmentDialog extends State<BadgeAttainmentDialog> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor:Colors.transparent,
appBar: MyAppBar(
title:"",
titleColor: Colors.white,
leadingColor: Colors.white,
background: Colors.transparent,
),
body: Container(
alignment:Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"恭喜您解锁新成就",
style: TextStyle(
color: Color(0xFFFFFFFF),
fontSize: 20.sp,
fontWeight: MyFontWeight.regular,
),
),
MImage(
"assets/image/by_badge.png",
width: 248,
height: 248,
// fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
Text(
"累计消费¥500",
style: TextStyle(
color: Color(0xFFFFFFFF),
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
Text(
"获得消费白银徽章",
style: TextStyle(
color: Color(0xFFFFFFFF),
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
Container(
margin: EdgeInsets.only(top:16),
width: 76,
height: 26.h,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(18),
color: Colors.white,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_gold_coin.png",
width: 20,
height: 20,
),
Text(
"+10",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF634815),
),
),
],
),
),
],
),
),
);
}
}

4
lib/view_widget/cupertino_date_picker.dart

@ -65,7 +65,7 @@ class CupertinoDatePickerWidget extends StatelessWidget {
height: 2.h,
color: Color(0xFFF4F4F4),
),
Container(
Expanded(child:Container(
height: 200.h,
child: CupertinoDatePicker(
mode: CupertinoDatePickerMode.date,
@ -77,7 +77,7 @@ class CupertinoDatePickerWidget extends StatelessWidget {
dateTime = data;
},
),
),
),),
],
),
);

56
lib/view_widget/item_input_widget.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/utils/font_weight.dart';
class ItemInputWidget extends StatelessWidget {
@ -15,7 +16,7 @@ class ItemInputWidget extends StatelessWidget {
final Function(String value) onChanged;
final Function() onTap;
final double discount;
final int inputLimit;
final bool isShowBtn;
@ -41,6 +42,7 @@ class ItemInputWidget extends StatelessWidget {
this.style = const TextStyle(),
this.radius = 4,
this.onTap,
this.discount,
this.textInputType,
this.errorText = "",
this.errorTextColor = const Color(0xFFFF441A),
@ -68,22 +70,27 @@ class ItemInputWidget extends StatelessWidget {
);
return Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h),
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h),
padding: padding,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0x000000).withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12.0,
),
],
color: Colors.white,
borderRadius: BorderRadius.circular(radius),
),
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// color: Color(0x000000).withAlpha(25),
// offset: Offset(0, 1),
// blurRadius: 12.0,
// ),
// ],
// color: Colors.white,
// borderRadius: BorderRadius.circular(radius),
// ),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
@ -93,6 +100,31 @@ class ItemInputWidget extends StatelessWidget {
color: titleColor,
),
),
Container(
margin: EdgeInsets.only(left: 5),
height: 20.h,
alignment: Alignment.center,
padding: EdgeInsets.only(left:3,right:4),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(9),
topRight: Radius.circular(9),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(9),
),
color: Color(0xFF32A060),
),
child: Text(
"当前折扣:${discount.toString()}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
],
),
SizedBox(
height: 5.h,
),

26
lib/view_widget/mine_vip_view.dart

@ -32,7 +32,7 @@ class MineVipView extends StatelessWidget {
});
String topLeft = "";
String levelText = "";
String levelText = "普通用户";
@override
Widget build(BuildContext context) {
@ -58,7 +58,6 @@ class MineVipView extends StatelessWidget {
} else {
topLeft = S.of(context).zanweikaitong;
}
switch (vipLevel) {
case 1:
{
@ -122,7 +121,7 @@ class MineVipView extends StatelessWidget {
: EdgeInsets.fromLTRB(padding.w, 16.h, padding.w, 0),
width: MediaQuery.of(context).size.width - 32.w,
height: ((MediaQuery.of(context).size.width - 32.w) /
(isUserVip ? 1.88 : 2.3) *
(isUserVip ? 1.88 : 1.90) *
AppUtils.textScale(context)),
decoration: BoxDecoration(
gradient: LinearGradient(
@ -218,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
: "消费¥20000 升级为金卡",
: "消费¥${rankMax - (rank ?? 0)}${S.of(context).daoxiayidengji}"),
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
@ -234,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(
@ -260,14 +259,14 @@ 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,
),
),
),
// if (isUserVip)
Row(
Expanded(child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -275,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,
@ -288,7 +289,7 @@ class MineVipView extends StatelessWidget {
color:textColor,
),
],
),
),),
],
),
),
@ -316,8 +317,9 @@ class MineVipView extends StatelessWidget {
Navigator.of(context)
.pushNamed('/router/mine_vip_core', arguments: {
"rankLevel": curLevel,
"userInfo":userInfo.masterCardRankName,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"points": (userInfo != null) ? int.tryParse(userInfo.points) : 0,
"expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(),
});
});
}

131
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<StatefulWidget> createState() {
return _ReceivingMethodDialog();
}
}
class _ReceivingMethodDialog extends State<ReceivingMethodDialog> {
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,
),
)
),
),
],
),
);
}
}

181
lib/view_widget/vip_dialog.dart

@ -1,9 +1,56 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'custom_image.dart';
class VipDialog extends StatefulWidget {
final String vipName;
VipDialog(this.vipName);
@override
State<StatefulWidget> createState() {
return _VipDialog();
}
}
class _VipDialog extends State<VipDialog> {
ApiService apiService;
List<VipBenefitList> vipBenefitList = [];
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryBenefitList();
});
}
///
queryBenefitList() async {
BaseData<List<VipBenefitList>> 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));
});
}
EasyLoading.dismiss();
}
class VipDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SimpleDialog(
@ -18,27 +65,27 @@ class VipDialog extends StatelessWidget {
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),),
child:SingleChildScrollView(
physics: BouncingScrollPhysics(),
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Container(
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(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),),
),
),
child: Text(
"${S.of(context).gongxinchengwei}银卡会员",
"${S.of(context).gongxinchengwei}${widget.vipName}",
style: TextStyle(
color: Colors.white,
fontSize: 18.sp,
@ -46,9 +93,6 @@ class VipDialog extends StatelessWidget {
),
),
),
Container(
child: Column(
children: [
Padding(
padding: EdgeInsets.only(top: 16.h, bottom: 19.h),
child: Text(
@ -60,8 +104,45 @@ class VipDialog extends StatelessWidget {
),
),
),
// vipUpgrade(),
Container(
width: MediaQuery.of(context).size.width,
height: ((((vipBenefitList == null
? 0
: vipBenefitList.length) ~/
3 +
((vipBenefitList == null
? 0
: vipBenefitList
.length) %
3 >
0
? 1
: 0)) *
90.h) >
MediaQuery.of(context).size.height / 2
? MediaQuery.of(context).size.height / 2
: (((vipBenefitList == null
? 0
: vipBenefitList.length) ~/
3 +
((vipBenefitList == null
? 0
: vipBenefitList.length) %
3 >
0
? 1
: 0)) *
90.h))
.toDouble(),
child: vipUpgrade()),
GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/legal_right_details', arguments: {
"vipBenefitList": vipBenefitList,
});
},
child: Container(
margin: EdgeInsets.only(left: 32, right: 32, bottom: 20),
decoration: BoxDecoration(
gradient: new LinearGradient(
@ -85,13 +166,10 @@ class VipDialog extends StatelessWidget {
),
),
),
],
),
),
],
),
),
),
Image.asset(
"assets/image/vip_yk.png",
fit: BoxFit.cover,
@ -107,30 +185,28 @@ class VipDialog extends StatelessWidget {
///
Widget vipUpgrade() {
return GridView.builder(
itemCount:9,
itemCount: vipBenefitList == null ? 0 : vipBenefitList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: BouncingScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量
crossAxisCount: 3,
//Widget之间间距
crossAxisSpacing:10,
crossAxisSpacing: 0,
//Widget之间间距
mainAxisSpacing: 10,
mainAxisSpacing: 0,
childAspectRatio: 1.5,
),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/legal_right_details', arguments: {});
},
child: vipUpgradeItem(),
onTap: () {},
child: vipUpgradeItem(vipBenefitList[index]),
);
},
);
}
Widget vipUpgradeItem() {
Widget vipUpgradeItem(VipBenefitList vipBenefitList) {
return Container(
alignment: Alignment.center,
child: Column(
@ -138,23 +214,15 @@ class VipDialog extends StatelessWidget {
Stack(
alignment: Alignment.bottomCenter,
children: [
Opacity(
opacity: 0.3,
// MImage(
// "assets/image/badge_img.png",
// width: 80,
// height: 80,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
child: Image.asset(
"assets/image/vip_qy.png",
MImage(
vipBenefitList?.icon ?? "",
width: 36,
height: 36,
fit: BoxFit.cover,
),
// 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),
@ -174,21 +242,49 @@ class VipDialog extends StatelessWidget {
Text(
"暂未开放",
style: TextStyle(
color: Color(0xFF181818),
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,
),
Text(
"暂未解锁",
style: TextStyle(
color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular,
fontSize: 9.sp,
),
),
],
),
),
],
),
SizedBox(
height: 5.h,
),
Text(
"储值优惠",
vipBenefitList?.name ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
@ -202,5 +298,4 @@ class VipDialog extends StatelessWidget {
),
);
}
}
Loading…
Cancel
Save