diff --git a/assets/image/2x/goods_cart.webp b/assets/image/2x/goods_cart.webp new file mode 100644 index 00000000..e43d96fc Binary files /dev/null and b/assets/image/2x/goods_cart.webp differ diff --git a/assets/image/2x/goods_phone.webp b/assets/image/2x/goods_phone.webp new file mode 100644 index 00000000..0dd1d86b Binary files /dev/null and b/assets/image/2x/goods_phone.webp differ diff --git a/assets/image/2x/jg.webp b/assets/image/2x/jg.webp new file mode 100644 index 00000000..6659f531 Binary files /dev/null and b/assets/image/2x/jg.webp differ diff --git a/assets/image/2x/kan_jia.webp b/assets/image/2x/kan_jia.webp new file mode 100644 index 00000000..a89449be Binary files /dev/null and b/assets/image/2x/kan_jia.webp differ diff --git a/assets/image/2x/ms.webp b/assets/image/2x/ms.webp new file mode 100644 index 00000000..a921f704 Binary files /dev/null and b/assets/image/2x/ms.webp differ diff --git a/assets/image/2x/ms_t.webp b/assets/image/2x/ms_t.webp new file mode 100644 index 00000000..ed3acb2d Binary files /dev/null and b/assets/image/2x/ms_t.webp differ diff --git a/assets/image/2x/pin_t.webp b/assets/image/2x/pin_t.webp new file mode 100644 index 00000000..97414fc3 Binary files /dev/null and b/assets/image/2x/pin_t.webp differ diff --git a/assets/image/2x/pin_tuan.webp b/assets/image/2x/pin_tuan.webp new file mode 100644 index 00000000..92eb9846 Binary files /dev/null and b/assets/image/2x/pin_tuan.webp differ diff --git a/assets/image/2x/shopping_cart.webp b/assets/image/2x/shopping_cart.webp new file mode 100644 index 00000000..665a4970 Binary files /dev/null and b/assets/image/2x/shopping_cart.webp differ diff --git a/assets/image/2x/shopping_cart_h.webp b/assets/image/2x/shopping_cart_h.webp new file mode 100644 index 00000000..e55c3161 Binary files /dev/null and b/assets/image/2x/shopping_cart_h.webp differ diff --git a/assets/image/2x/shopping_home.webp b/assets/image/2x/shopping_home.webp new file mode 100644 index 00000000..99378039 Binary files /dev/null and b/assets/image/2x/shopping_home.webp differ diff --git a/assets/image/2x/shopping_home_h.webp b/assets/image/2x/shopping_home_h.webp new file mode 100644 index 00000000..1b0d4b39 Binary files /dev/null and b/assets/image/2x/shopping_home_h.webp differ diff --git a/assets/image/2x/wx.webp b/assets/image/2x/wx.webp new file mode 100644 index 00000000..d8db66ce Binary files /dev/null and b/assets/image/2x/wx.webp differ diff --git a/assets/image/2x/yq_zt.webp b/assets/image/2x/yq_zt.webp new file mode 100644 index 00000000..6077776d Binary files /dev/null and b/assets/image/2x/yq_zt.webp differ diff --git a/assets/image/2x/zt_m.webp b/assets/image/2x/zt_m.webp new file mode 100644 index 00000000..e1608633 Binary files /dev/null and b/assets/image/2x/zt_m.webp differ diff --git a/assets/image/2x/zt_zf.webp b/assets/image/2x/zt_zf.webp new file mode 100644 index 00000000..1b23a0d2 Binary files /dev/null and b/assets/image/2x/zt_zf.webp differ diff --git a/assets/image/2x/zu_tuan.webp b/assets/image/2x/zu_tuan.webp new file mode 100644 index 00000000..9acfadf6 Binary files /dev/null and b/assets/image/2x/zu_tuan.webp differ diff --git a/assets/image/3x/goods_cart.webp b/assets/image/3x/goods_cart.webp new file mode 100644 index 00000000..34339a8f Binary files /dev/null and b/assets/image/3x/goods_cart.webp differ diff --git a/assets/image/3x/goods_phone.webp b/assets/image/3x/goods_phone.webp new file mode 100644 index 00000000..051e4a20 Binary files /dev/null and b/assets/image/3x/goods_phone.webp differ diff --git a/assets/image/3x/jg.webp b/assets/image/3x/jg.webp new file mode 100644 index 00000000..4c9c610b Binary files /dev/null and b/assets/image/3x/jg.webp differ diff --git a/assets/image/3x/kan_jia.webp b/assets/image/3x/kan_jia.webp new file mode 100644 index 00000000..c3a3ec9a Binary files /dev/null and b/assets/image/3x/kan_jia.webp differ diff --git a/assets/image/3x/ms.webp b/assets/image/3x/ms.webp new file mode 100644 index 00000000..98f6aa3e Binary files /dev/null and b/assets/image/3x/ms.webp differ diff --git a/assets/image/3x/ms_t.webp b/assets/image/3x/ms_t.webp new file mode 100644 index 00000000..55332b74 Binary files /dev/null and b/assets/image/3x/ms_t.webp differ diff --git a/assets/image/3x/pin_t.webp b/assets/image/3x/pin_t.webp new file mode 100644 index 00000000..cbe7701a Binary files /dev/null and b/assets/image/3x/pin_t.webp differ diff --git a/assets/image/3x/pin_tuan.webp b/assets/image/3x/pin_tuan.webp new file mode 100644 index 00000000..58ce53af Binary files /dev/null and b/assets/image/3x/pin_tuan.webp differ diff --git a/assets/image/3x/shopping_cart.webp b/assets/image/3x/shopping_cart.webp new file mode 100644 index 00000000..9b902ce2 Binary files /dev/null and b/assets/image/3x/shopping_cart.webp differ diff --git a/assets/image/3x/shopping_cart_h.webp b/assets/image/3x/shopping_cart_h.webp new file mode 100644 index 00000000..5d3e017f Binary files /dev/null and b/assets/image/3x/shopping_cart_h.webp differ diff --git a/assets/image/3x/shopping_home.webp b/assets/image/3x/shopping_home.webp new file mode 100644 index 00000000..3a195e71 Binary files /dev/null and b/assets/image/3x/shopping_home.webp differ diff --git a/assets/image/3x/shopping_home_h.webp b/assets/image/3x/shopping_home_h.webp new file mode 100644 index 00000000..9d59d24a Binary files /dev/null and b/assets/image/3x/shopping_home_h.webp differ diff --git a/assets/image/3x/yq_zt.webp b/assets/image/3x/yq_zt.webp new file mode 100644 index 00000000..a2f26596 Binary files /dev/null and b/assets/image/3x/yq_zt.webp differ diff --git a/assets/image/3x/zt_m.webp b/assets/image/3x/zt_m.webp new file mode 100644 index 00000000..593de4c6 Binary files /dev/null and b/assets/image/3x/zt_m.webp differ diff --git a/assets/image/3x/zt_zf.webp b/assets/image/3x/zt_zf.webp new file mode 100644 index 00000000..2317bed0 Binary files /dev/null and b/assets/image/3x/zt_zf.webp differ diff --git a/assets/image/3x/zu_tuan.webp b/assets/image/3x/zu_tuan.webp new file mode 100644 index 00000000..c523aa9e Binary files /dev/null and b/assets/image/3x/zu_tuan.webp differ diff --git a/assets/image/goods_cart.webp b/assets/image/goods_cart.webp new file mode 100644 index 00000000..c8a33a8e Binary files /dev/null and b/assets/image/goods_cart.webp differ diff --git a/assets/image/goods_phone.webp b/assets/image/goods_phone.webp new file mode 100644 index 00000000..11b33e59 Binary files /dev/null and b/assets/image/goods_phone.webp differ diff --git a/assets/image/jg.webp b/assets/image/jg.webp new file mode 100644 index 00000000..5be88f9d Binary files /dev/null and b/assets/image/jg.webp differ diff --git a/assets/image/kan_jia.webp b/assets/image/kan_jia.webp new file mode 100644 index 00000000..053248f3 Binary files /dev/null and b/assets/image/kan_jia.webp differ diff --git a/assets/image/ms.webp b/assets/image/ms.webp new file mode 100644 index 00000000..6a2cf82f Binary files /dev/null and b/assets/image/ms.webp differ diff --git a/assets/image/ms_t.webp b/assets/image/ms_t.webp new file mode 100644 index 00000000..e7377dea Binary files /dev/null and b/assets/image/ms_t.webp differ diff --git a/assets/image/pin_t.webp b/assets/image/pin_t.webp new file mode 100644 index 00000000..7b7a9ddd Binary files /dev/null and b/assets/image/pin_t.webp differ diff --git a/assets/image/pin_tuan.webp b/assets/image/pin_tuan.webp new file mode 100644 index 00000000..57476040 Binary files /dev/null and b/assets/image/pin_tuan.webp differ diff --git a/assets/image/shopping_cart.webp b/assets/image/shopping_cart.webp new file mode 100644 index 00000000..c8b12e94 Binary files /dev/null and b/assets/image/shopping_cart.webp differ diff --git a/assets/image/shopping_cart_h.webp b/assets/image/shopping_cart_h.webp new file mode 100644 index 00000000..623d7095 Binary files /dev/null and b/assets/image/shopping_cart_h.webp differ diff --git a/assets/image/shopping_home.webp b/assets/image/shopping_home.webp new file mode 100644 index 00000000..1103cf55 Binary files /dev/null and b/assets/image/shopping_home.webp differ diff --git a/assets/image/shopping_home_h.webp b/assets/image/shopping_home_h.webp new file mode 100644 index 00000000..52d4ca0b Binary files /dev/null and b/assets/image/shopping_home_h.webp differ diff --git a/assets/image/wx.webp b/assets/image/wx.webp new file mode 100644 index 00000000..6144699b Binary files /dev/null and b/assets/image/wx.webp differ diff --git a/assets/image/yq_zt.webp b/assets/image/yq_zt.webp new file mode 100644 index 00000000..d6c37355 Binary files /dev/null and b/assets/image/yq_zt.webp differ diff --git a/assets/image/zt_m.webp b/assets/image/zt_m.webp new file mode 100644 index 00000000..63dd5dc5 Binary files /dev/null and b/assets/image/zt_m.webp differ diff --git a/assets/image/zt_zf.webp b/assets/image/zt_zf.webp new file mode 100644 index 00000000..b4e2f456 Binary files /dev/null and b/assets/image/zt_zf.webp differ diff --git a/assets/image/zu_tuan.webp b/assets/image/zu_tuan.webp new file mode 100644 index 00000000..3ce86af8 Binary files /dev/null and b/assets/image/zu_tuan.webp differ diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 49b5a5f7..888d1667 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -16,7 +16,6 @@ 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/my_footer.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 'community_view/class_list_view.dart'; @@ -245,21 +244,6 @@ class _CommunityCourse extends State 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, - ), ], ); } diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index 90b61610..391b8702 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -127,7 +127,7 @@ class _CommunityDetails extends State with WidgetsBindingObser exitFull: () { setState(() {}); }, - userId:widget.arguments !=null ? widget.arguments["userId"] : widget.arguments["mid"], + userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"], itemCount: 3, isDetails: true, heightFun: (height) { diff --git a/lib/community/community_list.dart b/lib/community/community_list.dart index dd6e4558..4cb283e1 100644 --- a/lib/community/community_list.dart +++ b/lib/community/community_list.dart @@ -11,6 +11,7 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -85,6 +86,14 @@ class _CommunityList extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + (widget.comments == null || widget.comments.length == 0) + ? NoDataView( + src: widget.commentType == 1 ? "assets/image/dong_tai.webp" :"assets/image/guan_zhu.webp", + isShowBtn: false, + text:widget.commentType == 1 ? "目前暂无发布动态,要把开心的事讲出来哦~" :"目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), + ): ListView.builder( padding: EdgeInsets.zero, itemCount: widget.comments.length, diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index 355fb429..c19033c9 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -18,7 +18,6 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_footer.dart'; -import 'package:huixiang/view_widget/store_title_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart index c8343eba..a485fded 100644 --- a/lib/community/headlines/headlines_collection.dart +++ b/lib/community/headlines/headlines_collection.dart @@ -16,7 +16,7 @@ class HeadlinesCollection extends StatefulWidget { final List headlines; final List
articles; - HeadlinesCollection(this.headlines,this.articles); + HeadlinesCollection(this.headlines, this.articles); @override State createState() { @@ -44,13 +44,13 @@ class _HeadlinesCollection extends State { scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), padding: EdgeInsets.symmetric(horizontal: 10), - itemCount:widget.headlines == null ? 0 : widget.headlines.length, + 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}); + arguments: {"id": widget.headlines[position].id}); }, child: headlinesCollectionItem(widget.headlines[position]), ); diff --git a/lib/community/new_community_details.dart b/lib/community/new_community_details.dart index 6a07e675..45f58177 100644 --- a/lib/community/new_community_details.dart +++ b/lib/community/new_community_details.dart @@ -357,8 +357,8 @@ class _NewCommunityDetails extends State with WidgetsBindin fit: BoxFit.contain, width: MediaQuery.of(context).size.width / 1.5, height: MediaQuery.of(context).size.width, - errorSrc: "assets/image/default_2_1.png", - fadeSrc: "assets/image/default_2_1.png", + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", )), ); } else { @@ -395,8 +395,8 @@ class _NewCommunityDetails extends State with WidgetsBindin fit: BoxFit.cover, aspectRatio: 1, radius: BorderRadius.circular(1), - errorSrc: "assets/image/default_2_1.png", - fadeSrc: "assets/image/default_2_1.png", + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", ), ), ); diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index c1540276..d7adc5e3 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -190,7 +190,7 @@ class MessageLookup extends MessageLookupByLibrary { "dingdanyisongda" : MessageLookupByLibrary.simpleMessage("订单送达"), "dingdanyituikuan" : MessageLookupByLibrary.simpleMessage("订单已退款"), "dingdanyiwancheng" : MessageLookupByLibrary.simpleMessage("订单已完成"), - "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"), + "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单已支付"), "dingwei" : MessageLookupByLibrary.simpleMessage("定位"), "dizhi" : MessageLookupByLibrary.simpleMessage("地址"), "dongtai" : MessageLookupByLibrary.simpleMessage("动态"), @@ -565,8 +565,10 @@ class MessageLookup extends MessageLookupByLibrary { "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), + "wodekanjia" : MessageLookupByLibrary.simpleMessage("我的砍价"), "wodekaquan" : MessageLookupByLibrary.simpleMessage("我的卡券"), "wodenianling" : MessageLookupByLibrary.simpleMessage("我的年龄"), + "wodepintuan" : MessageLookupByLibrary.simpleMessage("我的拼团"), "wodeqianbao" : MessageLookupByLibrary.simpleMessage("我的钱包"), "wodeshengri" : MessageLookupByLibrary.simpleMessage("我的生日"), "wodexiaoxi" : MessageLookupByLibrary.simpleMessage("我的消息"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index c9029f55..30ab2e21 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -190,7 +190,7 @@ class MessageLookup extends MessageLookupByLibrary { "dingdanyisongda" : MessageLookupByLibrary.simpleMessage("订单送达"), "dingdanyituikuan" : MessageLookupByLibrary.simpleMessage("订单已退款"), "dingdanyiwancheng" : MessageLookupByLibrary.simpleMessage("订单已完成"), - "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"), + "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单已支付"), "dingwei" : MessageLookupByLibrary.simpleMessage("定位"), "dizhi" : MessageLookupByLibrary.simpleMessage("地址"), "dongtai" : MessageLookupByLibrary.simpleMessage("动态"), @@ -563,8 +563,10 @@ class MessageLookup extends MessageLookupByLibrary { "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), + "wodekanjia" : MessageLookupByLibrary.simpleMessage("我的砍价"), "wodekaquan" : MessageLookupByLibrary.simpleMessage("我的卡券"), "wodenianling" : MessageLookupByLibrary.simpleMessage("我的年龄"), + "wodepintuan" : MessageLookupByLibrary.simpleMessage("我的拼团"), "wodeqianbao" : MessageLookupByLibrary.simpleMessage("我的钱包"), "wodeshengri" : MessageLookupByLibrary.simpleMessage("我的生日"), "wodexiaoxi" : MessageLookupByLibrary.simpleMessage("我的消息"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index ec4ceb47..6b900b6c 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -190,7 +190,7 @@ class MessageLookup extends MessageLookupByLibrary { "dingdanyisongda" : MessageLookupByLibrary.simpleMessage("订单送达"), "dingdanyituikuan" : MessageLookupByLibrary.simpleMessage("订单已退款"), "dingdanyiwancheng" : MessageLookupByLibrary.simpleMessage("订单已完成"), - "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单待支付"), + "dingdanyizhifu" : MessageLookupByLibrary.simpleMessage("订单已支付"), "dingwei" : MessageLookupByLibrary.simpleMessage("定位"), "dizhi" : MessageLookupByLibrary.simpleMessage("地址"), "dongtai" : MessageLookupByLibrary.simpleMessage("动态"), @@ -563,8 +563,10 @@ class MessageLookup extends MessageLookupByLibrary { "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的会员等级"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的积分值"), + "wodekanjia" : MessageLookupByLibrary.simpleMessage("我的砍价"), "wodekaquan" : MessageLookupByLibrary.simpleMessage("我的卡券"), "wodenianling" : MessageLookupByLibrary.simpleMessage("我的年龄"), + "wodepintuan" : MessageLookupByLibrary.simpleMessage("我的拼团"), "wodeqianbao" : MessageLookupByLibrary.simpleMessage("我的钱包"), "wodeshengri" : MessageLookupByLibrary.simpleMessage("我的生日"), "wodexiaoxi" : MessageLookupByLibrary.simpleMessage("我的消息"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index d091902b..33977745 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -560,8 +560,10 @@ class MessageLookup extends MessageLookupByLibrary { "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"), + "wodekanjia" : MessageLookupByLibrary.simpleMessage("我的砍價"), "wodekaquan" : MessageLookupByLibrary.simpleMessage("我的卡券"), "wodenianling" : MessageLookupByLibrary.simpleMessage("我的年齡"), + "wodepintuan" : MessageLookupByLibrary.simpleMessage("我的拼團"), "wodeqianbao" : MessageLookupByLibrary.simpleMessage("我的錢包"), "wodeshengri" : MessageLookupByLibrary.simpleMessage("我的生日"), "wodexiaoxi" : MessageLookupByLibrary.simpleMessage("我的消息"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index c33444ae..825c0ccc 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -563,8 +563,10 @@ class MessageLookup extends MessageLookupByLibrary { "wodegongju" : MessageLookupByLibrary.simpleMessage("我的工具"), "wodehuiyuandengji" : MessageLookupByLibrary.simpleMessage("我的會員等級"), "wodejifenzhi" : MessageLookupByLibrary.simpleMessage("我的積分值"), + "wodekanjia" : MessageLookupByLibrary.simpleMessage("我的砍價"), "wodekaquan" : MessageLookupByLibrary.simpleMessage("我的卡券"), "wodenianling" : MessageLookupByLibrary.simpleMessage("我的年齡"), + "wodepintuan" : MessageLookupByLibrary.simpleMessage("我的拼團"), "wodeqianbao" : MessageLookupByLibrary.simpleMessage("我的錢包"), "wodeshengri" : MessageLookupByLibrary.simpleMessage("我的生日"), "wodexiaoxi" : MessageLookupByLibrary.simpleMessage("我的消息"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 0a00265e..a2d903fb 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -3165,10 +3165,10 @@ class S { ); } - /// `订单待支付` + /// `订单已支付` String get dingdanyizhifu { return Intl.message( - '订单待支付', + '订单已支付', name: 'dingdanyizhifu', desc: '', args: [], @@ -5635,6 +5635,26 @@ class S { ); } + /// `我的砍价` + String get wodekanjia { + return Intl.message( + '我的砍价', + name: 'wodekanjia', + desc: '', + args: [], + ); + } + + /// `我的拼团` + String get wodepintuan { + return Intl.message( + '我的拼团', + name: 'wodepintuan', + desc: '', + args: [], + ); + } + /// `播放次数` String get bofangcishu { return Intl.message( diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index ab0dd3cf..b168901e 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -1,15 +1,9 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/retrofit/data/activity.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/item_title.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:shared_preferences/shared_preferences.dart'; class ShortcutOperation extends StatefulWidget { final Function goToOrder; @@ -46,6 +40,8 @@ class _ShortcutOperation extends State { }, child: Container( width: 106, + margin: EdgeInsets.only(right:10), + padding: EdgeInsets.only(top: 8,bottom: 8), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -58,8 +54,6 @@ class _ShortcutOperation extends State { ], borderRadius: BorderRadius.circular(4), ), - margin: EdgeInsets.only(right:10), - padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ Text( @@ -95,6 +89,8 @@ class _ShortcutOperation extends State { }, child: Container( width: 106, + margin: EdgeInsets.only(right:10), + padding: EdgeInsets.only(top: 8,bottom: 8), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -107,8 +103,6 @@ class _ShortcutOperation extends State { ], borderRadius: BorderRadius.circular(4), ), - margin: EdgeInsets.only(right:10), - padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ Text( @@ -144,6 +138,7 @@ class _ShortcutOperation extends State { }, child:Container( width: 106, + padding: EdgeInsets.only(top: 8,bottom: 8), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -156,7 +151,6 @@ class _ShortcutOperation extends State { ], borderRadius: BorderRadius.circular(4), ), - padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ Text( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 26c93dc1..9cae031e 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -335,7 +335,7 @@ "dingdanyisongda": "订单送达", "dingdanyiwancheng": "订单已完成", "dingdandaizhifu": "订单待支付", - "dingdanyizhifu": "订单待支付", + "dingdanyizhifu": "订单已支付", "shangjiayifahuo": "商家已发货", "huopinyisongda": "货品已送达", "zhengzaipeisong": "正在配送", @@ -584,6 +584,11 @@ "invite_code_error": "邀请码输入错误", "yaoqingwancheng": "邀请完成", "xuanji": "选集", + "wodekanjia": "我的砍价", + "wodepintuan": "我的拼团", + + + "bofangcishu": "播放次数", "jiangshi" : "讲师", "quedingyaoshanchudongtai": "确定要删除这条动态?", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 4526e99a..a71c342b 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -336,7 +336,7 @@ "dingdanyisongda": "订单送达", "dingdanyiwancheng": "订单已完成", "dingdandaizhifu": "订单待支付", - "dingdanyizhifu": "订单待支付", + "dingdanyizhifu": "订单已支付", "shangjiayifahuo": "商家已发货", "huopinyisongda": "货品已送达", "zhengzaipeisong": "正在配送", @@ -581,6 +581,8 @@ "qingshuruyaoqingma": "请输入邀请码", "invite_code_error": "邀请码输入错误", "xuanji": "选集", + "wodekanjia": "我的砍价", + "wodepintuan": "我的拼团", "bofangcishu": "播放次数", "jiangshi" : "讲师", "quedingyaoshanchudongtai": "确定要删除这条动态?", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 86211058..4ca143d8 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -336,7 +336,7 @@ "dingdanyisongda": "订单送达", "dingdanyiwancheng": "订单已完成", "dingdandaizhifu": "订单待支付", - "dingdanyizhifu": "订单待支付", + "dingdanyizhifu": "订单已支付", "shangjiayifahuo": "商家已发货", "huopinyisongda": "货品已送达", "zhengzaipeisong": "正在配送", @@ -581,6 +581,8 @@ "qingshuruyaoqingma": "请输入邀请码", "invite_code_error": "邀请码输入错误", "xuanji": "选集", + "wodekanjia": "我的砍价", + "wodepintuan": "我的拼团", "bofangcishu": "播放次数", "jiangshi" : "讲师", "quedingyaoshanchudongtai": "确定要删除这条动态?", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 342a612c..562f4aa6 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -315,7 +315,7 @@ "gongjijianshangpin": "共{jian}件商品", "dingdanyiwancheng": "订单已完成", "peisongfangshi": "配送方式", - "dingdandaizhifu": "訂單待支付", + "dingdandaizhifu": "訂單已支付", "dingdanyizhifu": "訂單已支付", "shangjiazhengzaipeican": "商家正在配餐", "dengdaiyonghuqucan": "等待用戶取餐", @@ -575,6 +575,8 @@ "qingshuruyaoqingma": "請輸入邀請碼", "invite_code_error": "邀請碼輸入錯誤", "xuanji": "選集", + "wodekanjia": "我的砍價", + "wodepintuan": "我的拼團", "jiangshi" : "講師", "quedingyaoshanchudongtai": "確定要刪除這條動態?", "fenxiang": "分享", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index 01b4e297..706386e2 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -315,7 +315,7 @@ "gongjijianshangpin": "共{jian}件商品", "dingdanyiwancheng": "订单已完成", "peisongfangshi": "配送方式", - "dingdandaizhifu": "訂單待支付", + "dingdandaizhifu": "訂單已支付", "dingdanyizhifu": "訂單已支付", "shangjiazhengzaipeican": "商家正在配餐", "dengdaiyonghuqucan": "等待用戶取餐", @@ -575,6 +575,8 @@ "qingshuruyaoqingma": "請輸入邀請碼", "invite_code_error": "邀請碼輸入錯誤", "xuanji": "選集", + "wodekanjia": "我的砍價", + "wodepintuan": "我的拼團", "bofangcishu": "播放次數", "jiangshi" : "講師", "quedingyaoshanchudongtai": "確定要刪除這條動態?", diff --git a/lib/main.dart b/lib/main.dart index 317c33de..92aabe3b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -53,6 +53,13 @@ import 'package:huixiang/setting/logout_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; +import 'package:huixiang/store/shopping/activity_prefecture_details.dart'; +import 'package:huixiang/store/shopping/shopping_goods_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/bargain_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/group_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/group_page_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/search_page.dart'; +import 'package:huixiang/store/shopping/shopping_mall_home.dart'; import 'package:huixiang/setting/user_service_page.dart'; import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; @@ -93,6 +100,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/bargain_group_order.dart'; import 'mine/personal_page.dart'; import 'order/exchange_write_off_page.dart'; import 'mine/release_page.dart'; @@ -241,6 +249,8 @@ Map routers = { BindingAssistantCard(), '/router/order_history_page': (context, {arguments}) => OrderHistoryPage(arguments: arguments), + '/router/bargain_group_order': (context, {arguments}) => + BargainGroupOrder(arguments:arguments), '/router/union_detail_page': (context, {arguments}) => UnionDetailsPage(arguments: arguments), '/router/address_edit_page': (context, {arguments}) => @@ -256,6 +266,14 @@ Map routers = { HotArticleDetailsPage(), '/router/store_order': (context, {arguments}) => StoreOrderPage(arguments: arguments), + '/router/shopping_mall_home': (context, {arguments}) => + ShoppingMallHome(arguments: arguments), + '/router/activity_prefecture_details': (context, {arguments}) => + ActivityPrefectureDetails(arguments: arguments), + '/router/shopping_goods_details': (context, {arguments}) => + ShoppingGoodsDetails(arguments: arguments), + '/router/search_page': (context, {arguments}) => + SearchPage(arguments:arguments), '/router/vip_balance': (context, {arguments}) => VipBalancePage(arguments: arguments), '/router/exchange_order_details': (context, {arguments}) => @@ -318,6 +336,12 @@ Map routers = { MineAttainmentPage(arguments: arguments), '/router/headlines_column_details': (context, {arguments}) => HeadlinesColumnDetails(arguments: arguments), + '/router/group_details': (context, {arguments}) => + GroupDetails(arguments:arguments), + '/router/bargain_details': (context, {arguments}) => + BargainDetails(arguments:arguments), + '/router/group_page_details': (context, {arguments}) => + GroupPageDetails(arguments:arguments), '/router/photo_view_gallery_screen': (context, {arguments}) => PhotoViewGalleryScreen(), '/router/system_details': (context, {arguments}) => diff --git a/lib/message/system_details.dart b/lib/message/system_details.dart index 94a9d274..79f27255 100644 --- a/lib/message/system_details.dart +++ b/lib/message/system_details.dart @@ -502,8 +502,8 @@ class _SystemDetails extends State { height: 44, isCircle: true, fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), SizedBox(width: 8,), Expanded(child:Column( @@ -563,8 +563,8 @@ class _SystemDetails extends State { isCircle: true, fit: BoxFit.cover, radius: BorderRadius.circular(2), - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), SizedBox(width:2.w), Expanded(child:Text( @@ -649,8 +649,8 @@ class _SystemDetails extends State { height: 44, isCircle: true, fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), SizedBox(width: 8,), Expanded(child:Column( @@ -807,8 +807,8 @@ class _SystemDetails extends State { isCircle: true, fit: BoxFit.cover, radius: BorderRadius.circular(2), - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), SizedBox(width:2.w), Expanded(child:Text( @@ -892,8 +892,8 @@ class _SystemDetails extends State { height: 44, isCircle: true, fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), SizedBox(width: 8,), Expanded(child:Column( diff --git a/lib/mine/coupons_page.dart b/lib/mine/coupons_page.dart index faebd95b..0b434514 100644 --- a/lib/mine/coupons_page.dart +++ b/lib/mine/coupons_page.dart @@ -200,11 +200,11 @@ class _CouponsPage extends State { itemCount: coupons != null ? coupons.length : 0, ) : NoDataView( - src:"assets/image/ka.webp", + src: "assets/image/ka.webp", isShowBtn: false, - text: "你还没有券~", + text: "目前暂无优惠券,请到领劵中心领取哦~", fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + margin: EdgeInsets.only(top: 120.h,left:60,right:60), ), ), ), diff --git a/lib/mine/follow_page.dart b/lib/mine/follow_page.dart index dabe8033..63ab8c60 100644 --- a/lib/mine/follow_page.dart +++ b/lib/mine/follow_page.dart @@ -131,7 +131,6 @@ class _FollowPage extends State { }, ) ), - ), ); } diff --git a/lib/mine/manage_address_page.dart b/lib/mine/manage_address_page.dart index 4f8ab0e1..18a55a44 100644 --- a/lib/mine/manage_address_page.dart +++ b/lib/mine/manage_address_page.dart @@ -68,7 +68,7 @@ class _ManageAddressPage extends State { ? NoDataView( src:"assets/image/di_zhi.webp", isShowBtn: false, - text: "目前暂无送货地址,请添加", + text: "目前暂无收货地址,请添加~", fontSize: 16.sp, margin: EdgeInsets.only(top: 120.h), ) diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index c346c14c..22c898fa 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -35,22 +35,6 @@ class _MineItem extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // InkWell( - // onTap: () { - // SharedPreferences.getInstance().then((value) { - // if (value.getString("token") == null || - // value.getString("token") == "") { - // LoginTipsDialog().show(context); - // return; - // } - // Navigator.of(context).pushNamed('/router/mine_wallet'); - // }); - // }, - // child: mineItem( - // S.of(context).wodeqianbao, - // "assets/image/icon_mine_wallet.webp", - // ), - // ), Container( padding: EdgeInsets.only(left: 16,top:16,bottom:4), child: Text( @@ -85,6 +69,8 @@ class _MineItem extends State { // ), // ), // ), + + ///兑换历史 Expanded(child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { @@ -102,6 +88,7 @@ class _MineItem extends State { "assets/image/icon_mine_records_of_consumption.webp", ), ),), + ///我的卡券 Expanded(child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { @@ -118,6 +105,7 @@ class _MineItem extends State { "assets/image/icon_mine_card.webp", ), ),), + ///管理地址 Expanded(child: InkWell( onTap: () { SharedPreferences.getInstance().then((value) { @@ -134,48 +122,66 @@ class _MineItem extends State { "assets/image/icon_location_address.webp", ), ),), - Expanded(child:InkWell( + ///联系客服 + Expanded(child: InkWell( onTap: () { - Navigator.of(context).pushNamed('/router/qr_share', arguments: {}); + showCallMobile(); }, child: mineItem( - S.of(context).tuiguangma, - "assets/image/icon_mine_promotion_code.webp", + "联系客服", + "assets/image/icon_mine_online_service.webp", ), ),), ], ), + SizedBox(height: 10.h,), Row( - children: [ - Expanded(child:InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/invitation_record', arguments: {}); - }, - child: mineItem( - "邀请记录", - "assets/image/yao_q.webp", - ), - ),), - ///联系客服 - Expanded(child: InkWell( - onTap: () { - showCallMobile(); - }, - child: mineItem( - "联系客服", - "assets/image/icon_mine_online_service.webp", - ), - ),), - Expanded(child:Container()), - Expanded(child:Container()) - ], + children: [ + Expanded(child: + InkWell( + onTap: () { + Navigator.of(context) + .pushNamed('/router/bargain_group_order', + arguments: {"type":3}); + }, + child: mineItem( + S.of(context).wodekanjia, + "assets/image/icon_mine_records_of_consumption.webp", + ), + ),), + Expanded(child: InkWell( + onTap: () { + Navigator.of(context).pushNamed('/router/bargain_group_order', + arguments: {"type":1}); + }, + child: mineItem( + S.of(context).wodepintuan, + "assets/image/kan_jia.webp", + ), + ),), + Expanded(child: InkWell( + onTap: () { + Navigator.of(context).pushNamed('/router/qr_share', arguments: {}); + }, + child: mineItem( + S.of(context).tuiguangma, + "assets/image/pin_tuan.webp", + ), + ),), + Expanded(child:InkWell( + onTap: () { + Navigator.of(context).pushNamed('/router/invitation_record', arguments: {}); + }, + child: mineItem( + "邀请记录", + "assets/image/yao_q.webp", + ), + ),), + ], + ), + SizedBox(height: 10.h,), + ], ), - // mineItem( - // S.of(context).bangzhuyufankui, - // "assets/image/icon_mine_feedback.webp", - // ), - ], - ), ); } @@ -204,11 +210,6 @@ class _MineItem extends State { color: Color(0xFF353535), ), ), - // Icon( - // Icons.keyboard_arrow_right, - // size: 20, - // color: Colors.black, - // ) ], ), ); @@ -221,15 +222,15 @@ class _MineItem extends State { return CupertinoActionSheet( title: Text(S.of(context).bodadianhua), actions: [ - CupertinoActionSheetAction( - child: Text("15392949097"), - onPressed: () { - callMobile("15392949097"); - Navigator.of(context).pop(); - }, - isDefaultAction: true, - isDestructiveAction: false, - ), + CupertinoActionSheetAction( + child: Text("15392949097"), + onPressed: () { + callMobile("15392949097"); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), ], cancelButton: CupertinoActionSheetAction( onPressed: () { diff --git a/lib/mine/mine_view/mine_order.dart b/lib/mine/mine_view/mine_order.dart index 657e7e13..bc826e3e 100644 --- a/lib/mine/mine_view/mine_order.dart +++ b/lib/mine/mine_view/mine_order.dart @@ -115,8 +115,8 @@ class _MineOrderView extends State { Image.asset( orderStatusImg[status], fit: BoxFit.contain, - width: 32.w, - height: 32.w, + width: 36.w, + height: 36.w, ), SizedBox(height: 4.h,), Text( diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart index 36e14868..02712a00 100644 --- a/lib/mine/release_page.dart +++ b/lib/mine/release_page.dart @@ -114,7 +114,7 @@ class _ReleasePage extends State { enablePullUp: true, physics: BouncingScrollPhysics(), header: MyHeader(), - footer: CustomFooter( + footer:CustomFooter( builder: (context, mode) { return MyFooter(mode); }, diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index b41f109a..b04a1d6a 100644 --- a/lib/mine/vip_detail_page.dart +++ b/lib/mine/vip_detail_page.dart @@ -550,7 +550,7 @@ class _VipDetailPage extends State { return "$totalPrice"; } - List goodsItem(List products) { + List goodsItem(List products) { if (products == null) return []; if (products.length > 3) { products = products.sublist(0, 3); diff --git a/lib/order/bargain_group_order.dart b/lib/order/bargain_group_order.dart new file mode 100644 index 00000000..c49b47a1 --- /dev/null +++ b/lib/order/bargain_group_order.dart @@ -0,0 +1,476 @@ +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/activity.dart'; +import 'package:huixiang/retrofit/data/activity_order_list.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; +import 'package:huixiang/view_widget/no_data_view.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 BargainGroupOrder extends StatefulWidget { + final Map arguments; + + BargainGroupOrder({this.arguments}); + @override + State createState() { + return _BargainGroupOrder(); + } +} + +class _BargainGroupOrder extends State + with SingleTickerProviderStateMixin { + List tabs; + List _pages; + TabController tabcontroller; + int type = 0; + + @override + void initState() { + super.initState(); + type = widget.arguments["type"]; + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (tabcontroller == null) + tabcontroller = TabController(length: 4, vsync: this); + tabs = [ + MyTab( + text: S.of(context).quanbu, + ), + MyTab( + text: "进行中", + ), + MyTab( + text: "成功", + ), + MyTab( + text: "失败", + ) + ]; + _pages = [ + ExchangeHistoryList(0,type), + ExchangeHistoryList(2,type), + ExchangeHistoryList(3,type), + ExchangeHistoryList(4,type) + ]; + } + + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 4, + child: Scaffold( + appBar: MyAppBar( + title:type == 1 ? S.of(context).wodepintuan :S.of(context).wodekanjia, + titleColor: Colors.black, + titleSize: 18.sp, + background: Color(0xFFFFFFFF), + leadingColor: Colors.black, + toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, + bottom: PreferredSize( + preferredSize: Size(double.infinity, 38.h), + child: TabBar( + controller: tabcontroller, + indicatorWeight: 2, + indicatorColor: Color(0xFF39B54A), + indicatorSize: TabBarIndicatorSize.label, + indicatorPadding: EdgeInsets.only(top: 3), + unselectedLabelStyle: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.normal, + ), + labelStyle: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold), + labelColor: Colors.black, + tabs: tabs, + ), + ), + ), + body: TabBarView( + children: _pages, + controller: tabcontroller, + ), + ), + ); + } +} + +class ExchangeHistoryList extends StatefulWidget { + final int orderStatus; + final int type; + + ExchangeHistoryList(this.orderStatus,this.type); + + @override + State createState() { + return _ExchangeHistoryList(); + } +} + +class _ExchangeHistoryList extends State { + MinApiService minService; + List activityOrderList = []; + RefreshController _refreshController = RefreshController(initialRefresh: false); + ApiService apiService; + StoreInfo storeInfo; + List activitys; + String storeId; + + @override + void initState() { + super.initState(); + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: true + ); + queryShowMyActList(); + }); + } + + ///查看我的拼团、砍价、列表 + queryShowMyActList() async { + BaseData> baseData = + await minService.showMyActList({ + "state":widget.orderStatus, + "type" :widget.type, + }).catchError((error) { + _refreshController.loadFailed(); + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + _refreshController.refreshCompleted(); + setState(() { + activityOrderList.clear(); + if(baseData.data.length > 0) + activityOrderList.addAll(baseData.data); + queryStoreInfo(); + }); + } else { + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + } + } + + /// 查询店铺信息 + queryStoreInfo() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = + await apiService.queryStoreInfo(activityOrderList[0].storeId).catchError((error) { + debugPrint(error.toString()); + }); + if (baseData != null && baseData.isSuccess) { + storeInfo = StoreInfo.fromJson(baseData.data); + activitys = storeInfo.informationVOPageVO.list + .map((e) => Activity.fromJson(e)) + .toList(); + if (mounted) { + setState(() {}); + } + } + EasyLoading.dismiss(); + } + + _refresh() { + queryShowMyActList(); + } + + @override + Widget build(BuildContext context) { + return Container( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (BuildContext context, LoadStatus mode) { + return MyFooter(mode); + }, + ), + controller: _refreshController, + physics: BouncingScrollPhysics(), + // onLoading: _refresh, + onRefresh: _refresh, + child: (activityOrderList != null && activityOrderList.length > 0) + ? + ListView.builder( + itemCount: activityOrderList?.length ?? 0, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return bargainOrder(activityOrderList[position]); + }, + ):NoDataView( + src: "assets/image/ding_dan.webp", + isShowBtn: false, + text: "还没有订单,快去下一单吧~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h), + ), + ), + ); + } + + + Widget bargainOrder(ActivityOrderList activityOrderList) { + return Container( + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(25), + offset: Offset(0, 1), + blurRadius: 12, + spreadRadius: 0, + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Container( + // width: 19.w, + // height:21.h, + // margin: EdgeInsets.only(left: 12.w, top: 12.h), + // alignment: Alignment.center, + // decoration: BoxDecoration( + // color: Color(0xff32A060), + // borderRadius: BorderRadius.circular(2), + // ), + // child: Text( + // (orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外", + // // "自", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: FontWeight.bold, + // color: Colors.white, + // ), + // ), + // ), + Expanded( + child: Container( + width: double.infinity, + margin: EdgeInsets.only(left: 6.w, top: 12.h), + alignment: Alignment.centerLeft, + child: Text( + activityOrderList?.storeName ?? "", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + flex: 1, + ), + Padding( + padding: EdgeInsets.only(top: 12.h, right: 12.w), + child:Text( + (widget.type == 1)?(widget.orderStatus == 4 ? "拼团失败" :(activityOrderList.howManyMore != 0 ? "还差${activityOrderList?.howManyMore ?? 0}人拼团成功" : "拼团成功")) + :(activityOrderList.actRecordState == 1 ? "待支付" :(widget.orderStatus == 4 ? "砍价失败" : (activityOrderList.howManyMoney != "0.00" ? "还差¥${activityOrderList?.howManyMoney ?? 0}砍价成功" : "砍价成功"))), + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: widget.orderStatus == 4 ? Color(0xff32A060) : Color(0xffFE951E), + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 37.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).xiadanshijian_(activityOrderList?.joinTime ?? ""), + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF727272), + ), + ), + SizedBox( + height: 8.h, + ), + Container( + height: 81.h, + margin: EdgeInsets.only(right: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + activityOrderList?.productImg ?? "", + width: 81.w, + height: 81.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + activityOrderList?.storeName ?? "", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Text( + activityOrderList?.productSkuName ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF727272), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "x1", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF727272), + ), + ), + Text.rich( + TextSpan( + children: [ + TextSpan( + // text: "已砍至:", + text: S.of(context).heji, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF868686), + ), + ), + TextSpan( + text:activityOrderList?.orderSum ?? "0", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF868686), + ), + ), + ], + ), + ), + ], + ), + ], + )), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 12.h, + ), + Container( + margin: EdgeInsets.only(right: 12.w, bottom: 16.h), + child: Directionality( + textDirection: TextDirection.rtl, + child: Row( + children: [ + GestureDetector( + onTap: () { + if(widget.type == 1) { + Navigator.of(context) + .pushNamed('/router/group_details', arguments: { + "actRecordId": activityOrderList.actRecordId, + "limitNumber":activityOrderList.successNumber, + }); + }else{ + Navigator.of(context) + .pushNamed('/router/bargain_details',arguments: { + "actRecordId": activityOrderList.actRecordId, + "limitNumber":activityOrderList.successNumber, + "storeInfo":storeInfo, + }).then((value) { + _refresh(); + setState(() {}); + }); + } + }, + child: RoundButton( + height: 25.h, + text: "查看详情", + textColor: Colors.white, + fontSize: 12.sp, + backgroup: Color(0xFF32A060), + radius: 2, + padding: EdgeInsets.fromLTRB(17.w,0, 17.w,0), + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/order/exchange_history_page.dart b/lib/order/exchange_history_page.dart index 84625777..3b00cb07 100644 --- a/lib/order/exchange_history_page.dart +++ b/lib/order/exchange_history_page.dart @@ -194,9 +194,9 @@ class _ExchangeHistoryList extends State { ? NoDataView( src: "assets/image/ding_dan.webp", isShowBtn: false, - text: "暂无已完成的订单", + text: "目前暂无记录,手上那么多积分要赶紧用掉哦~", fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h), + margin: EdgeInsets.only(top: 120.h,left: 72,right: 72), ) : ListView.builder( itemCount: orders == null ? 0 : orders.length, diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index beebb515..6d703001 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -350,9 +350,7 @@ class _OrderDetailPage extends State { ), ), Text( - S - .of(context) - .yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), + S.of(context).yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), style: TextStyle( fontSize: 20.sp, color: Color(0xFF32A060), diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 9943d460..a31a6f5d 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -156,9 +156,9 @@ class _OrderHistoryList extends State ); }) : NoDataView( - src: "assets/image/ding_dan.webp", + src: "assets/image/ding_dan.webp", isShowBtn: false, - text: "还没有订单,快去下一单吧~", + text: "目前暂无订单,快去下一单吧~", fontSize: 16.sp, margin: EdgeInsets.only(top: 120), ), @@ -194,6 +194,10 @@ class _OrderHistoryList extends State orderInfos.clear(); } orderInfos.addAll(baseData.data.records); + // baseData.data.records.forEach((element) { + // if(element.orderType==0||(element.orderType==1 && element.payStatus==1 && element.refundStatus == 0)||(element.orderType==2 && element.payStatus==1&& element.refundStatus == 0)||(element.orderType==3 && element.payStatus==1&& element.refundStatus == 0)) + // orderInfos.add(element); + // }); refreshController.refreshCompleted(); refreshController.loadComplete(); if (current * 10 > int.tryParse(baseData.data.total)) { @@ -215,7 +219,8 @@ class _OrderHistoryList extends State SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), showLoading: true, - context: context, token: value.getString("token")), + context: context, + token: value.getString("token")), queryOrder(), }); } @@ -243,17 +248,49 @@ class _OrderHistoryList extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ + (orderInfo != null && orderInfo.orderType == 0) + ? Container() + : Container( + width: 19, + height: 21, + margin: EdgeInsets.only(left: 12.w, top: 12.h), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + )), + child: Text( + (orderInfo != null && orderInfo.orderType == 1) + ? "团" + : ((orderInfo != null && orderInfo.orderType == 2) + ? "秒" + : "砍"), + style: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF32A060), + ), + ), + ), Container( - width: 19.w, - height: 19.h, - margin: EdgeInsets.only(left: 12.w, top: 12.h), + width: 19, + height: 21, + margin: EdgeInsets.only(left: 7.w, top: 12.h), alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xff32A060), borderRadius: BorderRadius.circular(2), ), child: Text( - (orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外", + (orderInfo != null && orderInfo.isTakeOut == 0) + ? "自" + : ((orderInfo != null && orderInfo.isTakeOut == 1) + ? "外" + : "物"), style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, @@ -413,7 +450,7 @@ class _OrderHistoryList extends State ), TextSpan( // text: totalPrice(orderInfo), - text:orderInfo.finalPayPrice, + text: orderInfo.finalPayPrice, style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, @@ -522,21 +559,25 @@ class _OrderHistoryList extends State }, ); if (payChannel != null && payChannel > 0) { - OrderUtils.carryOnPay(payChannel, minService, orderInfo, () { - SmartDialog.showToast("订单支付成功"); - Future.delayed(Duration(seconds: 1), () { - _onRefresh(); - }); - },); + OrderUtils.carryOnPay( + payChannel, + minService, + orderInfo, + () { + SmartDialog.showToast("订单支付成功"); + Future.delayed(Duration(seconds: 1), () { + _onRefresh(); + }); + }, + ); } } - payResult(BaseData baseData) { - - } + payResult(BaseData baseData) {} orderCancel(String orderId) async { - BaseData baseData = await apiService.orderCancel(orderId).catchError((onError) {}); + BaseData baseData = + await apiService.orderCancel(orderId).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("订单取消成功"); _onRefresh(); @@ -553,7 +594,7 @@ class _OrderHistoryList extends State // ? (orderInfo.storeVO.id ?? "") // : ""; - if(orderInfo.storeVO.posType.code == "NORMALSTORE") { + if (orderInfo.storeVO.posType.code == "NORMALSTORE") { Scan.toScan( context, orderInfo.storeVO.id, diff --git a/lib/order/order_view/order_status.dart b/lib/order/order_view/order_status.dart index cc5d1947..55cbfa7d 100644 --- a/lib/order/order_view/order_status.dart +++ b/lib/order/order_view/order_status.dart @@ -68,7 +68,7 @@ class _OrderStatus extends State { ? S.of(context).ziqu : widget.isTakeOut == 1 ? S.of(context).waimai - : S.of(context).kuaidi, + : "物流", width: 42.w * AppUtils.textScale(context), height: 20.h * AppUtils.textScale(context), textColor: Colors.white, diff --git a/lib/retrofit/data/activity_actRecord_details.dart b/lib/retrofit/data/activity_actRecord_details.dart new file mode 100644 index 00000000..27eea174 --- /dev/null +++ b/lib/retrofit/data/activity_actRecord_details.dart @@ -0,0 +1,536 @@ +/// actRecord : {"id":"1496692045555695616","createTime":"2022-02-24 11:42:46","createUser":"1496056013827080192","updateTime":"2022-02-24 11:42:46","updateUser":"1496056013827080192","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actProductId":"1494198261018263552","mid":"1496056013827080192","isDirectBuy":false,"joinNum":1,"startTime":"2022-02-24 11:42:46","endTime":"2022-02-24 13:42:46","state":4,"isDelete":0} +/// actRecordJoinList : [{"id":"1496692045677330432","createTime":"2022-02-24 11:42:46","createUser":"1496056013827080192","updateTime":"2022-02-24 11:42:46","updateUser":"1496056013827080192","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actRecordId":"1496692045555695616","mid":"1496056013827080192","orderId":null,"isLeader":true,"memberAvatar":"","memberNickname":"","productId":"1494198261018263552","actPrice":"54.45","state":true,"isDelete":0}] +/// actProduct : {"id":"1494198261018263552","createTime":"2022-02-17 14:33:21","createUser":"1364043181062094848","updateTime":"2022-02-17 14:33:21","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1490572026815971328","timeId":"1490572027034075136","productId":"1461246266586431488","productName":"野生羊肚菌","productImg":"https://pos.upload.gznl.top/1179/2021/11/298d1e1c-2a5f-4b9d-95a7-87b3f88a9cd1.jpg","productPrice":"150.00","promotionPrice":"11.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461246266661928960","skuPrice":11,"skuStock":100},{"skuId":"1461246266687094784","skuPrice":100,"skuStock":100}],"isDelete":0} +/// skuName : null +/// isBargain : true + +class ActivityActRecordDetails { + ActivityActRecordDetails({ + ActRecord actRecord, + List actRecordJoinList, + ActProduct actProduct, + dynamic skuName, + String skuId, + bool isBargain, + int successNumber}){ + _actRecord = actRecord; + _actRecordJoinList = actRecordJoinList; + _actProduct = actProduct; + _skuName = skuName; + _skuId = skuId; + _isBargain = isBargain; + _successNumber = successNumber; + +} + + ActivityActRecordDetails.fromJson(dynamic json) { + _actRecord = json['actRecord'] != null ? ActRecord.fromJson(json['actRecord']) : null; + if (json['actRecordJoinList'] != null) { + _actRecordJoinList = []; + json['actRecordJoinList'].forEach((v) { + _actRecordJoinList.add(ActRecordJoinList.fromJson(v)); + }); + } + _actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null; + _skuName = json['skuName']; + _skuId = json['skuId']; + _isBargain = json['isBargain']; + _successNumber = json['successNumber']; + } + ActRecord _actRecord; + List _actRecordJoinList; + ActProduct _actProduct; + dynamic _skuName; + String _skuId; + bool _isBargain; + int _successNumber; + + ActRecord get actRecord => _actRecord; + List get actRecordJoinList => _actRecordJoinList; + ActProduct get actProduct => _actProduct; + dynamic get skuName => _skuName; + String get skuId => _skuId; + bool get isBargain => _isBargain; + int get successNumber => _successNumber; + + Map toJson() { + final map = {}; + if (_actRecord != null) { + map['actRecord'] = _actRecord.toJson(); + } + if (_actRecordJoinList != null) { + map['actRecordJoinList'] = _actRecordJoinList.map((v) => v.toJson()).toList(); + } + if (_actProduct != null) { + map['actProduct'] = _actProduct.toJson(); + } + map['skuId'] = _skuId; + map['isBargain'] = _isBargain; + map['successNumber'] = _successNumber; + return map; + } + +} + +/// id : "1494198261018263552" +/// createTime : "2022-02-17 14:33:21" +/// createUser : "1364043181062094848" +/// updateTime : "2022-02-17 14:33:21" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1490572026815971328" +/// timeId : "1490572027034075136" +/// productId : "1461246266586431488" +/// productName : "野生羊肚菌" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/298d1e1c-2a5f-4b9d-95a7-87b3f88a9cd1.jpg" +/// productPrice : "150.00" +/// promotionPrice : "11.00" +/// productStock : 200 +/// sellCount : 0 +/// skuJson : [{"skuId":"1461246266661928960","skuPrice":11,"skuStock":100},{"skuId":"1461246266687094784","skuPrice":100,"skuStock":100}] +/// isDelete : 0 + +class ActProduct { + ActProduct({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String templateId, + String timeId, + String productId, + String productName, + String productImg, + String productPrice, + String promotionPrice, + int productStock, + int sellCount, + List skuJson, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _templateId = templateId; + _timeId = timeId; + _productId = productId; + _productName = productName; + _productImg = productImg; + _productPrice = productPrice; + _promotionPrice = promotionPrice; + _productStock = productStock; + _sellCount = sellCount; + _skuJson = skuJson; + _isDelete = isDelete; +} + + ActProduct.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _templateId = json['templateId']; + _timeId = json['timeId']; + _productId = json['productId']; + _productName = json['productName']; + _productImg = json['productImg']; + _productPrice = json['productPrice']; + _promotionPrice = json['promotionPrice']; + _productStock = json['productStock']; + _sellCount = json['sellCount']; + if (json['skuJson'] != null) { + _skuJson = []; + json['skuJson'].forEach((v) { + _skuJson.add(SkuJson.fromJson(v)); + }); + } + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _templateId; + String _timeId; + String _productId; + String _productName; + String _productImg; + String _productPrice; + String _promotionPrice; + int _productStock; + int _sellCount; + List _skuJson; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get templateId => _templateId; + String get timeId => _timeId; + String get productId => _productId; + String get productName => _productName; + String get productImg => _productImg; + String get productPrice => _productPrice; + String get promotionPrice => _promotionPrice; + int get productStock => _productStock; + int get sellCount => _sellCount; + List get skuJson => _skuJson; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['templateId'] = _templateId; + map['timeId'] = _timeId; + map['productId'] = _productId; + map['productName'] = _productName; + map['productImg'] = _productImg; + map['productPrice'] = _productPrice; + map['promotionPrice'] = _promotionPrice; + map['productStock'] = _productStock; + map['sellCount'] = _sellCount; + if (_skuJson != null) { + map['skuJson'] = _skuJson.map((v) => v.toJson()).toList(); + } + map['isDelete'] = _isDelete; + return map; + } + +} + +/// skuId : "1461246266661928960" +/// skuPrice : 11 +/// skuStock : 100 + +class SkuJson { + SkuJson({ + String skuId, + int skuPrice, + int skuStock,}){ + _skuId = skuId; + _skuPrice = skuPrice; + _skuStock = skuStock; +} + + SkuJson.fromJson(dynamic json) { + _skuId = json['skuId']; + _skuPrice = json['skuPrice']; + _skuStock = json['skuStock']; + } + String _skuId; + int _skuPrice; + int _skuStock; + + String get skuId => _skuId; + int get skuPrice => _skuPrice; + int get skuStock => _skuStock; + + Map toJson() { + final map = {}; + map['skuId'] = _skuId; + map['skuPrice'] = _skuPrice; + map['skuStock'] = _skuStock; + return map; + } + +} + +/// id : "1496692045677330432" +/// createTime : "2022-02-24 11:42:46" +/// createUser : "1496056013827080192" +/// updateTime : "2022-02-24 11:42:46" +/// updateUser : "1496056013827080192" +/// storeId : "1460885296764682240" +/// type : 3 +/// actTemplateId : "1490572026815971328" +/// actTimeId : "1490572027034075136" +/// actRecordId : "1496692045555695616" +/// mid : "1496056013827080192" +/// orderId : null +/// isLeader : true +/// memberAvatar : "" +/// memberNickname : "" +/// productId : "1494198261018263552" +/// actPrice : "54.45" +/// state : true +/// isDelete : 0 + +class ActRecordJoinList { + ActRecordJoinList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + String actTemplateId, + String actTimeId, + String actRecordId, + String mid, + dynamic orderId, + bool isLeader, + String memberAvatar, + String memberNickname, + String productId, + String actPrice, + bool state, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _type = type; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actRecordId = actRecordId; + _mid = mid; + _orderId = orderId; + _isLeader = isLeader; + _memberAvatar = memberAvatar; + _memberNickname = memberNickname; + _productId = productId; + _actPrice = actPrice; + _state = state; + _isDelete = isDelete; +} + + ActRecordJoinList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _type = json['type']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actRecordId = json['actRecordId']; + _mid = json['mid']; + _orderId = json['orderId']; + _isLeader = json['isLeader']; + _memberAvatar = json['memberAvatar']; + _memberNickname = json['memberNickname']; + _productId = json['productId']; + _actPrice = json['actPrice']; + _state = json['state']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + int _type; + String _actTemplateId; + String _actTimeId; + String _actRecordId; + String _mid; + dynamic _orderId; + bool _isLeader; + String _memberAvatar; + String _memberNickname; + String _productId; + String _actPrice; + bool _state; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + int get type => _type; + String get actTemplateId => _actTemplateId; + String get actTimeId => _actTimeId; + String get actRecordId => _actRecordId; + String get mid => _mid; + dynamic get orderId => _orderId; + bool get isLeader => _isLeader; + String get memberAvatar => _memberAvatar; + String get memberNickname => _memberNickname; + String get productId => _productId; + String get actPrice => _actPrice; + bool get state => _state; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['type'] = _type; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actRecordId'] = _actRecordId; + map['mid'] = _mid; + map['orderId'] = _orderId; + map['isLeader'] = _isLeader; + map['memberAvatar'] = _memberAvatar; + map['memberNickname'] = _memberNickname; + map['productId'] = _productId; + map['actPrice'] = _actPrice; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + +} + +/// id : "1496692045555695616" +/// createTime : "2022-02-24 11:42:46" +/// createUser : "1496056013827080192" +/// updateTime : "2022-02-24 11:42:46" +/// updateUser : "1496056013827080192" +/// storeId : "1460885296764682240" +/// type : 3 +/// actTemplateId : "1490572026815971328" +/// actTimeId : "1490572027034075136" +/// actProductId : "1494198261018263552" +/// mid : "1496056013827080192" +/// isDirectBuy : false +/// joinNum : 1 +/// startTime : "2022-02-24 11:42:46" +/// endTime : "2022-02-24 13:42:46" +/// state : 4 +/// isDelete : 0 + +class ActRecord { + ActRecord({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + String actTemplateId, + String actTimeId, + String actProductId, + String mid, + bool isDirectBuy, + int joinNum, + String startTime, + String endTime, + int state, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _type = type; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actProductId = actProductId; + _mid = mid; + _isDirectBuy = isDirectBuy; + _joinNum = joinNum; + _startTime = startTime; + _endTime = endTime; + _state = state; + _isDelete = isDelete; +} + + ActRecord.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _type = json['type']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actProductId = json['actProductId']; + _mid = json['mid']; + _isDirectBuy = json['isDirectBuy']; + _joinNum = json['joinNum']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _state = json['state']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + int _type; + String _actTemplateId; + String _actTimeId; + String _actProductId; + String _mid; + bool _isDirectBuy; + int _joinNum; + String _startTime; + String _endTime; + int _state; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + int get type => _type; + String get actTemplateId => _actTemplateId; + String get actTimeId => _actTimeId; + String get actProductId => _actProductId; + String get mid => _mid; + bool get isDirectBuy => _isDirectBuy; + int get joinNum => _joinNum; + String get startTime => _startTime; + String get endTime => _endTime; + int get state => _state; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['type'] = _type; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actProductId'] = _actProductId; + map['mid'] = _mid; + map['isDirectBuy'] = _isDirectBuy; + map['joinNum'] = _joinNum; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/activity_area_list.dart b/lib/retrofit/data/activity_area_list.dart new file mode 100644 index 00000000..322f0bd6 --- /dev/null +++ b/lib/retrofit/data/activity_area_list.dart @@ -0,0 +1,498 @@ +/// actTemplate : {"id":"1478267568996220928","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","actName":"砍价","actDesc":"","type":3,"limitTime":2,"limitNumber":5,"coverImg":"https://pos.upload.gznl.top/1179/2022/01/792bda39-3c2e-434f-8e57-02c62163add4.png","shareImg":"https://pos.upload.gznl.top/1179/2022/01/68f9b6d4-16a8-4bcf-aab6-09f95d1d2a9a.png","bannerImg":"https://pos.upload.gznl.top/1179/2022/01/5efd74a8-be45-4723-a878-0513d6bfd9f8.png","state":1,"allDay":true,"startTime":"2022-01-01 00:00:00","endTime":"2022-01-31 00:00:00","isDelete":0} +/// timeProductList : [{"actTime":{"id":"1478267569205936128","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","allDay":true,"startHour":null,"endHour":null,"isDelete":0},"productList":[{"id":"1478267723770232832","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460886580993458176","productName":"无花果礼盒","productImg":"https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png","productPrice":"88.00","promotionPrice":"88.00","productStock":0,"sellCount":0,"skuJson":[{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}],"isDelete":0},{"id":"1478267723787010048","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460896670593056768","productName":"甄果酥","productImg":"https://pos.upload.gznl.top/1179/2021/11/c4e6ea91-9cc1-4f5f-86e3-91e323ab2d53.jpg","productPrice":"78.00","promotionPrice":"78.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460896670697914368","skuPrice":78,"skuStock":100}],"isDelete":0},{"id":"1478267723791204352","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460899864027070464","productName":"肺宝酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/ccf4293f-004c-4450-bcc7-c45e47444fe3.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460899864102567936","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398656","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460901466356056064","productName":"纤盈酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/49931aa8-7eda-4df2-876f-a6fa19ac0682.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460901466435747840","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398657","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461168275898499072","productName":"生态桂圆","productImg":"https://pos.upload.gznl.top/1179/2021/11/eeef5404-5533-46fc-b650-0901e0cf4580.jpg","productPrice":"60.00","promotionPrice":"60.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461168275957219328","skuPrice":60,"skuStock":100},{"skuId":"1461168275982385152","skuPrice":170,"skuStock":100}],"isDelete":0},{"id":"1478267723799592960","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461261296568631296","productName":"麦芽糖","productImg":"https://pos.upload.gznl.top/1179/2021/11/2dd21e14-f221-46b5-8d88-2812fbe9ab45.jpg","productPrice":"29.80","promotionPrice":"29.80","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1461261296623157248","skuPrice":29.8,"skuStock":100}],"isDelete":0},{"id":"1478267723803787264","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461263843052224512","productName":"心耕年糕400g/袋*6","productImg":"https://pos.upload.gznl.top/1179/2021/11/3f3fcf7a-c477-4a6b-a689-89b1ff4c3528.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461263843098361856","skuPrice":88,"skuStock":50}],"isDelete":0},{"id":"1478267723807981568","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461626570010525696","productName":"枣糕方芝麻丸 150g/罐","productImg":"https://pos.upload.gznl.top/1179/2021/11/dad36dd4-e859-4d19-8c75-7d3702d8a2b4.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461626570077634560","skuPrice":88,"skuStock":50}],"isDelete":0}]}] + +class ActivityAreaList { + ActivityAreaList({ + ActTemplate actTemplate, + List timeProductList,}){ + _actTemplate = actTemplate; + _timeProductList = timeProductList; +} + + ActivityAreaList.fromJson(dynamic json) { + _actTemplate = json['actTemplate'] != null ? ActTemplate.fromJson(json['actTemplate']) : null; + if (json['timeProductList'] != null) { + _timeProductList = []; + json['timeProductList'].forEach((v) { + _timeProductList.add(TimeProductList.fromJson(v)); + }); + } + } + ActTemplate _actTemplate; + List _timeProductList; + + ActTemplate get actTemplate => _actTemplate; + List get timeProductList => _timeProductList; + + Map toJson() { + final map = {}; + if (_actTemplate != null) { + map['actTemplate'] = _actTemplate.toJson(); + } + if (_timeProductList != null) { + map['timeProductList'] = _timeProductList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// actTime : {"id":"1478267569205936128","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","allDay":true,"startHour":null,"endHour":null,"isDelete":0} +/// productList : [{"id":"1478267723770232832","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460886580993458176","productName":"无花果礼盒","productImg":"https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png","productPrice":"88.00","promotionPrice":"88.00","productStock":0,"sellCount":0,"skuJson":[{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}],"isDelete":0},{"id":"1478267723787010048","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460896670593056768","productName":"甄果酥","productImg":"https://pos.upload.gznl.top/1179/2021/11/c4e6ea91-9cc1-4f5f-86e3-91e323ab2d53.jpg","productPrice":"78.00","promotionPrice":"78.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460896670697914368","skuPrice":78,"skuStock":100}],"isDelete":0},{"id":"1478267723791204352","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460899864027070464","productName":"肺宝酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/ccf4293f-004c-4450-bcc7-c45e47444fe3.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460899864102567936","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398656","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460901466356056064","productName":"纤盈酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/49931aa8-7eda-4df2-876f-a6fa19ac0682.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460901466435747840","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398657","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461168275898499072","productName":"生态桂圆","productImg":"https://pos.upload.gznl.top/1179/2021/11/eeef5404-5533-46fc-b650-0901e0cf4580.jpg","productPrice":"60.00","promotionPrice":"60.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461168275957219328","skuPrice":60,"skuStock":100},{"skuId":"1461168275982385152","skuPrice":170,"skuStock":100}],"isDelete":0},{"id":"1478267723799592960","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461261296568631296","productName":"麦芽糖","productImg":"https://pos.upload.gznl.top/1179/2021/11/2dd21e14-f221-46b5-8d88-2812fbe9ab45.jpg","productPrice":"29.80","promotionPrice":"29.80","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1461261296623157248","skuPrice":29.8,"skuStock":100}],"isDelete":0},{"id":"1478267723803787264","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461263843052224512","productName":"心耕年糕400g/袋*6","productImg":"https://pos.upload.gznl.top/1179/2021/11/3f3fcf7a-c477-4a6b-a689-89b1ff4c3528.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461263843098361856","skuPrice":88,"skuStock":50}],"isDelete":0},{"id":"1478267723807981568","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461626570010525696","productName":"枣糕方芝麻丸 150g/罐","productImg":"https://pos.upload.gznl.top/1179/2021/11/dad36dd4-e859-4d19-8c75-7d3702d8a2b4.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461626570077634560","skuPrice":88,"skuStock":50}],"isDelete":0}] + +class TimeProductList { + TimeProductList({ + ActTime actTime, + List productList,}){ + _actTime = actTime; + _productList = productList; +} + + TimeProductList.fromJson(dynamic json) { + _actTime = json['actTime'] != null ? ActTime.fromJson(json['actTime']) : null; + if (json['productList'] != null) { + _productList = []; + json['productList'].forEach((v) { + _productList.add(ProductList.fromJson(v)); + }); + } + } + ActTime _actTime; + List _productList; + + ActTime get actTime => _actTime; + List get productList => _productList; + + Map toJson() { + final map = {}; + if (_actTime != null) { + map['actTime'] = _actTime.toJson(); + } + if (_productList != null) { + map['productList'] = _productList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1478267723770232832" +/// createTime : "2022-01-04 15:31:05" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:31:05" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1478267568996220928" +/// timeId : "1478267569205936128" +/// productId : "1460886580993458176" +/// productName : "无花果礼盒" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png" +/// productPrice : "88.00" +/// promotionPrice : "88.00" +/// productStock : 0 +/// sellCount : 0 +/// skuJson : [{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}] +/// isDelete : 0 + +class ProductList { + ProductList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String templateId, + String timeId, + String productId, + String productName, + String productImg, + String productPrice, + String promotionPrice, + int productStock, + dynamic sellCount, + List skuJson, + dynamic isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _templateId = templateId; + _timeId = timeId; + _productId = productId; + _productName = productName; + _productImg = productImg; + _productPrice = productPrice; + _promotionPrice = promotionPrice; + _productStock = productStock; + _sellCount = sellCount; + _skuJson = skuJson; + _isDelete = isDelete; +} + + ProductList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _templateId = json['templateId']; + _timeId = json['timeId']; + _productId = json['productId']; + _productName = json['productName']; + _productImg = json['productImg']; + _productPrice = json['productPrice']; + _promotionPrice = json['promotionPrice']; + _productStock = json['productStock']; + _sellCount = json['sellCount']; + if (json['skuJson'] != null) { + _skuJson = []; + json['skuJson'].forEach((v) { + _skuJson.add(SkuJson.fromJson(v)); + }); + } + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _templateId; + String _timeId; + String _productId; + String _productName; + String _productImg; + String _productPrice; + String _promotionPrice; + int _productStock; + int _sellCount; + List _skuJson; + dynamic _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get templateId => _templateId; + String get timeId => _timeId; + String get productId => _productId; + String get productName => _productName; + String get productImg => _productImg; + String get productPrice => _productPrice; + String get promotionPrice => _promotionPrice; + int get productStock => _productStock; + int get sellCount => _sellCount; + List get skuJson => _skuJson; + dynamic get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['templateId'] = _templateId; + map['timeId'] = _timeId; + map['productId'] = _productId; + map['productName'] = _productName; + map['productImg'] = _productImg; + map['productPrice'] = _productPrice; + map['promotionPrice'] = _promotionPrice; + map['productStock'] = _productStock; + map['sellCount'] = _sellCount; + if (_skuJson != null) { + map['skuJson'] = _skuJson.map((v) => v.toJson()).toList(); + } + map['isDelete'] = _isDelete; + return map; + } + +} + +/// skuId : "1460886581089927168" +/// skuPrice : 88 +/// skuStock : 0 + +class SkuJson { + SkuJson({ + String skuId, + dynamic skuPrice, + dynamic skuStock,}){ + _skuId = skuId; + _skuPrice = skuPrice; + _skuStock = skuStock; +} + + SkuJson.fromJson(dynamic json) { + _skuId = json['skuId']; + _skuPrice = json['skuPrice']; + _skuStock = json['skuStock']; + } + String _skuId; + dynamic _skuPrice; + dynamic _skuStock; + + String get skuId => _skuId; + dynamic get skuPrice => _skuPrice; + dynamic get skuStock => _skuStock; + + Map toJson() { + final map = {}; + map['skuId'] = _skuId; + map['skuPrice'] = _skuPrice; + map['skuStock'] = _skuStock; + return map; + } + +} + +/// id : "1478267569205936128" +/// createTime : "2022-01-04 15:30:28" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:30:28" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1478267568996220928" +/// allDay : true +/// startHour : null +/// endHour : null +/// isDelete : 0 + +class ActTime { + ActTime({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String templateId, + bool allDay, + dynamic startHour, + dynamic endHour, + dynamic isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _templateId = templateId; + _allDay = allDay; + _startHour = startHour; + _endHour = endHour; + _isDelete = isDelete; +} + + ActTime.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _templateId = json['templateId']; + _allDay = json['allDay']; + _startHour = json['startHour']; + _endHour = json['endHour']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _templateId; + bool _allDay; + dynamic _startHour; + dynamic _endHour; + dynamic _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get templateId => _templateId; + bool get allDay => _allDay; + dynamic get startHour => _startHour; + dynamic get endHour => _endHour; + dynamic get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['templateId'] = _templateId; + map['allDay'] = _allDay; + map['startHour'] = _startHour; + map['endHour'] = _endHour; + map['isDelete'] = _isDelete; + return map; + } + +} + +/// id : "1478267568996220928" +/// createTime : "2022-01-04 15:30:28" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:30:28" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// actName : "砍价" +/// actDesc : "" +/// type : 3 +/// limitTime : 2 +/// limitNumber : 5 +/// coverImg : "https://pos.upload.gznl.top/1179/2022/01/792bda39-3c2e-434f-8e57-02c62163add4.png" +/// shareImg : "https://pos.upload.gznl.top/1179/2022/01/68f9b6d4-16a8-4bcf-aab6-09f95d1d2a9a.png" +/// bannerImg : "https://pos.upload.gznl.top/1179/2022/01/5efd74a8-be45-4723-a878-0513d6bfd9f8.png" +/// state : 1 +/// allDay : true +/// startTime : "2022-01-01 00:00:00" +/// endTime : "2022-01-31 00:00:00" +/// isDelete : 0 + +class ActTemplate { + ActTemplate({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String actName, + String actDesc, + dynamic type, + dynamic limitTime, + dynamic limitNumber, + String coverImg, + String shareImg, + String bannerImg, + dynamic state, + bool allDay, + String startTime, + String endTime, + dynamic isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _actName = actName; + _actDesc = actDesc; + _type = type; + _limitTime = limitTime; + _limitNumber = limitNumber; + _coverImg = coverImg; + _shareImg = shareImg; + _bannerImg = bannerImg; + _state = state; + _allDay = allDay; + _startTime = startTime; + _endTime = endTime; + _isDelete = isDelete; +} + + ActTemplate.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _actName = json['actName']; + _actDesc = json['actDesc']; + _type = json['type']; + _limitTime = json['limitTime']; + _limitNumber = json['limitNumber']; + _coverImg = json['coverImg']; + _shareImg = json['shareImg']; + _bannerImg = json['bannerImg']; + _state = json['state']; + _allDay = json['allDay']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _actName; + String _actDesc; + dynamic _type; + dynamic _limitTime; + dynamic _limitNumber; + String _coverImg; + String _shareImg; + String _bannerImg; + dynamic _state; + bool _allDay; + String _startTime; + String _endTime; + dynamic _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get actName => _actName; + String get actDesc => _actDesc; + dynamic get type => _type; + dynamic get limitTime => _limitTime; + dynamic get limitNumber => _limitNumber; + String get coverImg => _coverImg; + String get shareImg => _shareImg; + String get bannerImg => _bannerImg; + dynamic get state => _state; + bool get allDay => _allDay; + String get startTime => _startTime; + String get endTime => _endTime; + dynamic get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['actName'] = _actName; + map['actDesc'] = _actDesc; + map['type'] = _type; + map['limitTime'] = _limitTime; + map['limitNumber'] = _limitNumber; + map['coverImg'] = _coverImg; + map['shareImg'] = _shareImg; + map['bannerImg'] = _bannerImg; + map['state'] = _state; + map['allDay'] = _allDay; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['isDelete'] = _isDelete; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/activity_details.dart b/lib/retrofit/data/activity_details.dart new file mode 100644 index 00000000..cdab41cd --- /dev/null +++ b/lib/retrofit/data/activity_details.dart @@ -0,0 +1,657 @@ +/// actProduct : {"id":"1479377402042777600","createTime":"2022-01-07 17:00:33","createUser":"1364043181062094848","updateTime":"2022-01-07 17:00:33","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1479377328797646848","timeId":"1479377329099636736","productId":"1460886580993458176","productName":"无花果礼盒","productImg":"https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png","productPrice":"88.00","promotionPrice":"88.00","productStock":0,"sellCount":0,"skuJson":[{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}],"isDelete":0} +/// actRecordAndJoinlDTOList : [{"actRecord":{"id":"1479399513473941504","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1478548720785031168","joinNum":0,"startTime":"2022-01-07 18:28:25","endTime":"2022-01-08 16:28:25","state":2,"isDelete":0},"actRecordJoinList":[{"id":"1479399514073726976","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479399513473941504","mid":"1478548720785031168","orderId":"1479399514677706752","isLeader":true,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}]},{"actRecord":{"id":"1479401111025614848","createTime":"2022-01-07 18:34:45","createUser":"1468903135782109184","updateTime":"2022-01-07 18:34:45","updateUser":"1468903135782109184","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1468903135782109184","joinNum":0,"startTime":"2022-01-07 18:34:45","endTime":"2022-01-08 16:34:45","state":2,"isDelete":0},"actRecordJoinList":[{"id":"1479401111688314880","createTime":"2022-01-07 18:34:46","createUser":"1468903135782109184","updateTime":"2022-01-07 18:34:46","updateUser":"1468903135782109184","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479401111025614848","mid":"1468903135782109184","orderId":"1479401112292294656","isLeader":true,"memberAvatar":"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg","memberNickname":"哈哈哈","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}]}] + +class ActivityDetails { + ActivityDetails({ + String endTime, + ActProduct actProduct, + List actRecordAndJoinlDTOList, + }) { + _endTime = endTime; + _actProduct = actProduct; + _actRecordAndJoinlDTOList = actRecordAndJoinlDTOList; + } + + ActivityDetails.fromJson(dynamic json) { + _endTime = json['endTime']; + _actProduct = json['actProduct'] != null + ? ActProduct.fromJson(json['actProduct']) + : null; + if (json['actRecordAndJoinlDTOList'] != null) { + _actRecordAndJoinlDTOList = []; + json['actRecordAndJoinlDTOList'].forEach((v) { + _actRecordAndJoinlDTOList.add(ActRecordAndJoinlDTOList.fromJson(v)); + }); + } + } + + String _endTime; + ActProduct _actProduct; + List _actRecordAndJoinlDTOList; + + String get endTime => _endTime; + + ActProduct get actProduct => _actProduct; + + List get actRecordAndJoinlDTOList => + _actRecordAndJoinlDTOList; + + Map toJson() { + final map = {}; + map['endTime'] = _endTime; + + if (_actProduct != null) { + map['actProduct'] = _actProduct.toJson(); + } + if (_actRecordAndJoinlDTOList != null) { + map['actRecordAndJoinlDTOList'] = + _actRecordAndJoinlDTOList.map((v) => v.toJson()).toList(); + } + return map; + } +} + +/// actRecord : {"id":"1479399513473941504","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1478548720785031168","joinNum":0,"startTime":"2022-01-07 18:28:25","endTime":"2022-01-08 16:28:25","state":2,"isDelete":0} +/// actRecordJoinList : [{"id":"1479399514073726976","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479399513473941504","mid":"1478548720785031168","orderId":"1479399514677706752","isLeader":true,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}] + +class ActRecordAndJoinlDTOList { + ActRecordAndJoinlDTOList({ + ActRecord actRecord, + List actRecordJoinList, + }) { + _actRecord = actRecord; + _actRecordJoinList = actRecordJoinList; + } + + ActRecordAndJoinlDTOList.fromJson(dynamic json) { + _actRecord = json['actRecord'] != null + ? ActRecord.fromJson(json['actRecord']) + : null; + if (json['actRecordJoinList'] != null) { + _actRecordJoinList = []; + json['actRecordJoinList'].forEach((v) { + _actRecordJoinList.add(ActRecordJoinList.fromJson(v)); + }); + } + } + + ActRecord _actRecord; + List _actRecordJoinList; + + ActRecord get actRecord => _actRecord; + + List get actRecordJoinList => _actRecordJoinList; + + Map toJson() { + final map = {}; + if (_actRecord != null) { + map['actRecord'] = _actRecord.toJson(); + } + if (_actRecordJoinList != null) { + map['actRecordJoinList'] = + _actRecordJoinList.map((v) => v.toJson()).toList(); + } + return map; + } +} + +/// id : "1479399514073726976" +/// createTime : "2022-01-07 18:28:25" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-07 18:28:25" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actRecordId : "1479399513473941504" +/// mid : "1478548720785031168" +/// orderId : "1479399514677706752" +/// isLeader : true +/// memberAvatar : "" +/// memberNickname : "斯基" +/// productId : "1479377402042777600" +/// actPrice : "88.00" +/// state : false +/// isDelete : 0 + +class ActRecordJoinList { + ActRecordJoinList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String actTemplateId, + String actTimeId, + String actRecordId, + String mid, + String orderId, + bool isLeader, + String memberAvatar, + String memberNickname, + String productId, + String actPrice, + bool state, + int isDelete, + }) { + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actRecordId = actRecordId; + _mid = mid; + _orderId = orderId; + _isLeader = isLeader; + _memberAvatar = memberAvatar; + _memberNickname = memberNickname; + _productId = productId; + _actPrice = actPrice; + _state = state; + _isDelete = isDelete; + } + + ActRecordJoinList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actRecordId = json['actRecordId']; + _mid = json['mid']; + _orderId = json['orderId']; + _isLeader = json['isLeader']; + _memberAvatar = json['memberAvatar']; + _memberNickname = json['memberNickname']; + _productId = json['productId']; + _actPrice = json['actPrice']; + _state = json['state']; + _isDelete = json['isDelete']; + } + + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _actTemplateId; + String _actTimeId; + String _actRecordId; + String _mid; + String _orderId; + bool _isLeader; + String _memberAvatar; + String _memberNickname; + String _productId; + String _actPrice; + bool _state; + int _isDelete; + + String get id => _id; + + String get createTime => _createTime; + + String get createUser => _createUser; + + String get updateTime => _updateTime; + + String get updateUser => _updateUser; + + String get storeId => _storeId; + + String get actTemplateId => _actTemplateId; + + String get actTimeId => _actTimeId; + + String get actRecordId => _actRecordId; + + String get mid => _mid; + + String get orderId => _orderId; + + bool get isLeader => _isLeader; + + String get memberAvatar => _memberAvatar; + + String get memberNickname => _memberNickname; + + String get productId => _productId; + + String get actPrice => _actPrice; + + bool get state => _state; + + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actRecordId'] = _actRecordId; + map['mid'] = _mid; + map['orderId'] = _orderId; + map['isLeader'] = _isLeader; + map['memberAvatar'] = _memberAvatar; + map['memberNickname'] = _memberNickname; + map['productId'] = _productId; + map['actPrice'] = _actPrice; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } +} + +/// id : "1479399513473941504" +/// createTime : "2022-01-07 18:28:25" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-07 18:28:25" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// type : 1 +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actProductId : "1479377402042777600" +/// mid : "1478548720785031168" +/// joinNum : 0 +/// startTime : "2022-01-07 18:28:25" +/// endTime : "2022-01-08 16:28:25" +/// state : 2 +/// isDelete : 0 + +class ActRecord { + ActRecord({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + String actTemplateId, + String actTimeId, + String actProductId, + String mid, + int joinNum, + String startTime, + String endTime, + int state, + int isDelete, + }) { + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _type = type; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actProductId = actProductId; + _mid = mid; + _joinNum = joinNum; + _startTime = startTime; + _endTime = endTime; + _state = state; + _isDelete = isDelete; + } + + ActRecord.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _type = json['type']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actProductId = json['actProductId']; + _mid = json['mid']; + _joinNum = json['joinNum']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _state = json['state']; + _isDelete = json['isDelete']; + } + + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + int _type; + String _actTemplateId; + String _actTimeId; + String _actProductId; + String _mid; + int _joinNum; + String _startTime; + String _endTime; + int _state; + int _isDelete; + int _tempDay; + int _tempHour; + int _tempM; + int _tempS; + + + int get tempDay => _tempDay; + + set tempDay(int value) { + _tempDay = value; + } + + String get id => _id; + + String get createTime => _createTime; + + String get createUser => _createUser; + + String get updateTime => _updateTime; + + String get updateUser => _updateUser; + + String get storeId => _storeId; + + int get type => _type; + + String get actTemplateId => _actTemplateId; + + String get actTimeId => _actTimeId; + + String get actProductId => _actProductId; + + String get mid => _mid; + + int get joinNum => _joinNum; + + String get startTime => _startTime; + + String get endTime => _endTime; + + int get state => _state; + + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['type'] = _type; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actProductId'] = _actProductId; + map['mid'] = _mid; + map['joinNum'] = _joinNum; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + + int get tempHour => _tempHour; + + set tempHour(int value) { + _tempHour = value; + } + + int get tempM => _tempM; + + set tempM(int value) { + _tempM = value; + } + + int get tempS => _tempS; + + set tempS(int value) { + _tempS = value; + } + +} + +/// id : "1479377402042777600" +/// createTime : "2022-01-07 17:00:33" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-07 17:00:33" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1479377328797646848" +/// timeId : "1479377329099636736" +/// productId : "1460886580993458176" +/// productName : "无花果礼盒" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png" +/// productPrice : "88.00" +/// promotionPrice : "88.00" +/// productStock : 0 +/// sellCount : 0 +/// skuJson : [{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}] +/// isDelete : 0 + +class ActProduct { + ActProduct({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String templateId, + String timeId, + String productId, + String productName, + String productImg, + String productPrice, + String promotionPrice, + int productStock, + int sellCount, + List skuJson, + int isDelete, + String shortName, + String supplierName, + String detail, + String rightImg, + }) { + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _templateId = templateId; + _timeId = timeId; + _productId = productId; + _productName = productName; + _productImg = productImg; + _productPrice = productPrice; + _promotionPrice = promotionPrice; + _productStock = productStock; + _sellCount = sellCount; + _skuJson = skuJson; + _isDelete = isDelete; + _shortName = shortName; + _supplierName =supplierName; + _detail = detail; + _rightImg = rightImg; + } + + ActProduct.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _templateId = json['templateId']; + _timeId = json['timeId']; + _productId = json['productId']; + _productName = json['productName']; + _productImg = json['productImg']; + _productPrice = json['productPrice']; + _promotionPrice = json['promotionPrice']; + _productStock = json['productStock']; + _sellCount = json['sellCount']; + if (json['skuJson'] != null) { + _skuJson = []; + json['skuJson'].forEach((v) { + _skuJson.add(SkuJson.fromJson(v)); + }); + } + _isDelete = json['isDelete']; + _shortName = json['shortName']; + _supplierName = json['supplierName']; + _detail = json['detail']; + _rightImg = json['rightImg']; + } + + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _templateId; + String _timeId; + String _productId; + String _productName; + String _productImg; + String _productPrice; + String _promotionPrice; + int _productStock; + int _sellCount; + List _skuJson; + int _isDelete; + String _shortName; + String _supplierName; + String _detail; + String _rightImg; + + String get id => _id; + + String get createTime => _createTime; + + String get createUser => _createUser; + + String get updateTime => _updateTime; + + String get updateUser => _updateUser; + + String get storeId => _storeId; + + String get templateId => _templateId; + + String get timeId => _timeId; + + String get productId => _productId; + + String get productName => _productName; + + String get productImg => _productImg; + + String get productPrice => _productPrice; + + String get promotionPrice => _promotionPrice; + + int get productStock => _productStock; + + int get sellCount => _sellCount; + + List get skuJson => _skuJson; + + int get isDelete => _isDelete; + + String get shortName => _shortName; + + String get supplierName => _supplierName; + + String get detail => _detail; + + String get rightImg => _rightImg; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['templateId'] = _templateId; + map['timeId'] = _timeId; + map['productId'] = _productId; + map['productName'] = _productName; + map['productImg'] = _productImg; + map['productPrice'] = _productPrice; + map['promotionPrice'] = _promotionPrice; + map['productStock'] = _productStock; + map['sellCount'] = _sellCount; + if (_skuJson != null) { + map['skuJson'] = _skuJson.map((v) => v.toJson()).toList(); + } + map['isDelete'] = _isDelete; + map['shortName'] = _shortName; + map['supplierName'] = _supplierName; + map['detail'] = _detail; + map['rightImg'] = _rightImg; + return map; + } +} + +/// skuId : "1460886581089927168" +/// skuPrice : 88 +/// skuStock : 0 + +class SkuJson { + SkuJson({ + String skuId, + String skuPrice, + int skuStock, + }) { + _skuId = skuId; + _skuPrice = skuPrice; + _skuStock = skuStock; + } + + SkuJson.fromJson(dynamic json) { + _skuId = json['skuId']; + _skuPrice = json['skuPrice']; + _skuStock = json['skuStock']; + } + + String _skuId; + String _skuPrice; + int _skuStock; + + String get skuId => _skuId; + + String get skuPrice => _skuPrice; + + int get skuStock => _skuStock; + + Map toJson() { + final map = {}; + map['skuId'] = _skuId; + map['skuPrice'] = _skuPrice; + map['skuStock'] = _skuStock; + return map; + } +} diff --git a/lib/retrofit/data/activity_order_list.dart b/lib/retrofit/data/activity_order_list.dart new file mode 100644 index 00000000..f2432d45 --- /dev/null +++ b/lib/retrofit/data/activity_order_list.dart @@ -0,0 +1,111 @@ +/// storeName : "一心回乡商城" +/// joinTime : "2022-01-07 18:28:25" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png" +/// productName : "无花果礼盒" +/// productSkuName : "" +/// actRecordId : "1479399513473941504" +/// actRecordState : 4 +/// actRecordJoinState : false +/// howManyMore : 2 +/// orderSum : null +/// bargainMoney : null +/// howManyMoney : null + +class ActivityOrderList { + ActivityOrderList({ + String storeName, + String storeId, + String joinTime, + String productImg, + String productName, + String productSkuName, + String actRecordId, + int actRecordState, + bool actRecordJoinState, + int howManyMore, + int successNumber, + dynamic orderSum, + dynamic bargainMoney, + dynamic howManyMoney,}){ + _storeName = storeName; + _storeId = storeId; + _joinTime = joinTime; + _productImg = productImg; + _productName = productName; + _productSkuName = productSkuName; + _actRecordId = actRecordId; + _actRecordState = actRecordState; + _actRecordJoinState = actRecordJoinState; + _howManyMore = howManyMore; + _successNumber = successNumber; + _orderSum = orderSum; + _bargainMoney = bargainMoney; + _howManyMoney = howManyMoney; +} + + ActivityOrderList.fromJson(dynamic json) { + _storeName = json['storeName']; + _storeId = json['storeId']; + _joinTime = json['joinTime']; + _productImg = json['productImg']; + _productName = json['productName']; + _productSkuName = json['productSkuName']; + _actRecordId = json['actRecordId']; + _actRecordState = json['actRecordState']; + _actRecordJoinState = json['actRecordJoinState']; + _howManyMore = json['howManyMore']; + _successNumber = json['successNumber']; + _orderSum = json['orderSum']; + _bargainMoney = json['bargainMoney']; + _howManyMoney = json['howManyMoney']; + } + String _storeName; + String _storeId; + String _joinTime; + String _productImg; + String _productName; + String _productSkuName; + String _actRecordId; + int _actRecordState; + bool _actRecordJoinState; + int _howManyMore; + int _successNumber; + dynamic _orderSum; + dynamic _bargainMoney; + dynamic _howManyMoney; + + String get storeName => _storeName; + String get storeId => _storeId; + String get joinTime => _joinTime; + String get productImg => _productImg; + String get productName => _productName; + String get productSkuName => _productSkuName; + String get actRecordId => _actRecordId; + int get actRecordState => _actRecordState; + bool get actRecordJoinState => _actRecordJoinState; + int get howManyMore => _howManyMore; + int get successNumber => _successNumber; + dynamic get orderSum => _orderSum; + dynamic get bargainMoney => _bargainMoney; + dynamic get howManyMoney => _howManyMoney; + + Map toJson() { + final map = {}; + map['storeName'] = _storeName; + map['storeId'] = _storeId; + map['joinTime'] = _joinTime; + map['productImg'] = _productImg; + map['productName'] = _productName; + map['productSkuName'] = _productSkuName; + map['actRecordId'] = _actRecordId; + map['actRecordState'] = _actRecordState; + map['actRecordJoinState'] = _actRecordJoinState; + map['howManyMore'] = _howManyMore; + map ['successNumber'] = _successNumber; + map['orderSum'] = _orderSum; + map['bargainMoney'] = _bargainMoney; + map['howManyMoney'] = _howManyMoney; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/home_recommend_list.dart b/lib/retrofit/data/home_recommend_list.dart new file mode 100644 index 00000000..9b45b10c --- /dev/null +++ b/lib/retrofit/data/home_recommend_list.dart @@ -0,0 +1,416 @@ +/// id : "1473532263365869568" +/// createTime : "2021-12-22 13:54:03" +/// createUser : "1364043181062094848" +/// updateTime : "2021-12-22 13:54:03" +/// updateUser : "1364043181062094848" +/// supplierName : "测试" +/// storeId : "1364043181120815104" +/// categoryId : "1343391656220557312" +/// groupId : "1473531667711787008" +/// shortName : "可爱" +/// productName : "回乡牛公仔" +/// sellDesc : "" +/// productCode : "PRO202112221354030000000000004" +/// weight : "0" +/// applyPrice : "0.00" +/// price : "49.00" +/// stock : 0 +/// sellCount : 0 +/// needLogistics : 1 +/// oversold : 1 +/// organic : 0 +/// status : 1 +/// posShow : true +/// productType : 0 +/// productNumber : 1 +/// setMeal : 1 +/// attrStyle : 0 +/// detail : "" +/// isDelete : 0 +/// printerFlag : "DEFAULT" +/// materialId : null +/// imgs : ["https://pos.upload.gznl.top/1179/2021/12/1bff0936-f2a2-401e-befd-e00b416763ad.png"] +/// productSkuList : [{"id":"1473532264519303168","createTime":"2021-12-22 13:54:03","createUser":"1364043181062094848","updateTime":"2021-12-22 13:54:03","updateUser":"1364043181062094848","storeId":"1364043181120815104","skuCode":"P202112221354035","skuNameStr":"","productId":"1473532263365869568","skuPrice":"49.00","applyPrice":"0.00","vipPrice":null,"skuImg":null,"skuStock":0,"sort":50,"setMeal":"","weight":0.0,"volume":0.0,"isDelete":0,"material":null,"version":0}] + +class HomeRecommendList { + HomeRecommendList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String supplierName, + String storeId, + String categoryId, + String groupId, + String shortName, + String productName, + String sellDesc, + String productCode, + String weight, + String applyPrice, + String price, + int stock, + int sellCount, + int needLogistics, + int oversold, + int organic, + int status, + bool posShow, + int productType, + int productNumber, + int setMeal, + int attrStyle, + String detail, + int isDelete, + String printerFlag, + dynamic materialId, + List imgs, + List productSkuList,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _supplierName = supplierName; + _storeId = storeId; + _categoryId = categoryId; + _groupId = groupId; + _shortName = shortName; + _productName = productName; + _sellDesc = sellDesc; + _productCode = productCode; + _weight = weight; + _applyPrice = applyPrice; + _price = price; + _stock = stock; + _sellCount = sellCount; + _needLogistics = needLogistics; + _oversold = oversold; + _organic = organic; + _status = status; + _posShow = posShow; + _productType = productType; + _productNumber = productNumber; + _setMeal = setMeal; + _attrStyle = attrStyle; + _detail = detail; + _isDelete = isDelete; + _printerFlag = printerFlag; + _materialId = materialId; + _imgs = imgs; + _productSkuList = productSkuList; +} + + HomeRecommendList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _supplierName = json['supplierName']; + _storeId = json['storeId']; + _categoryId = json['categoryId']; + _groupId = json['groupId']; + _shortName = json['shortName']; + _productName = json['productName']; + _sellDesc = json['sellDesc']; + _productCode = json['productCode']; + _weight = json['weight']; + _applyPrice = json['applyPrice']; + _price = json['price']; + _stock = json['stock']; + _sellCount = json['sellCount']; + _needLogistics = json['needLogistics']; + _oversold = json['oversold']; + _organic = json['organic']; + _status = json['status']; + _posShow = json['posShow']; + _productType = json['productType']; + _productNumber = json['productNumber']; + _setMeal = json['setMeal']; + _attrStyle = json['attrStyle']; + _detail = json['detail']; + _isDelete = json['isDelete']; + _printerFlag = json['printerFlag']; + _materialId = json['materialId']; + _imgs = json['imgs'] != null ? json['imgs'].cast() : []; + if (json['productSkuList'] != null) { + _productSkuList = []; + json['productSkuList'].forEach((v) { + _productSkuList.add(ProductSkuList.fromJson(v)); + }); + } + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _supplierName; + String _storeId; + String _categoryId; + String _groupId; + String _shortName; + String _productName; + String _sellDesc; + String _productCode; + String _weight; + String _applyPrice; + String _price; + int _stock; + int _sellCount; + int _needLogistics; + int _oversold; + int _organic; + int _status; + bool _posShow; + int _productType; + int _productNumber; + int _setMeal; + int _attrStyle; + String _detail; + int _isDelete; + String _printerFlag; + dynamic _materialId; + List _imgs; + List _productSkuList; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get supplierName => _supplierName; + String get storeId => _storeId; + String get categoryId => _categoryId; + String get groupId => _groupId; + String get shortName => _shortName; + String get productName => _productName; + String get sellDesc => _sellDesc; + String get productCode => _productCode; + String get weight => _weight; + String get applyPrice => _applyPrice; + String get price => _price; + int get stock => _stock; + int get sellCount => _sellCount; + int get needLogistics => _needLogistics; + int get oversold => _oversold; + int get organic => _organic; + int get status => _status; + bool get posShow => _posShow; + int get productType => _productType; + int get productNumber => _productNumber; + int get setMeal => _setMeal; + int get attrStyle => _attrStyle; + String get detail => _detail; + int get isDelete => _isDelete; + String get printerFlag => _printerFlag; + dynamic get materialId => _materialId; + List get imgs => _imgs; + List get productSkuList => _productSkuList; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['supplierName'] = _supplierName; + map['storeId'] = _storeId; + map['categoryId'] = _categoryId; + map['groupId'] = _groupId; + map['shortName'] = _shortName; + map['productName'] = _productName; + map['sellDesc'] = _sellDesc; + map['productCode'] = _productCode; + map['weight'] = _weight; + map['applyPrice'] = _applyPrice; + map['price'] = _price; + map['stock'] = _stock; + map['sellCount'] = _sellCount; + map['needLogistics'] = _needLogistics; + map['oversold'] = _oversold; + map['organic'] = _organic; + map['status'] = _status; + map['posShow'] = _posShow; + map['productType'] = _productType; + map['productNumber'] = _productNumber; + map['setMeal'] = _setMeal; + map['attrStyle'] = _attrStyle; + map['detail'] = _detail; + map['isDelete'] = _isDelete; + map['printerFlag'] = _printerFlag; + map['materialId'] = _materialId; + map['imgs'] = _imgs; + if (_productSkuList != null) { + map['productSkuList'] = _productSkuList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1473532264519303168" +/// createTime : "2021-12-22 13:54:03" +/// createUser : "1364043181062094848" +/// updateTime : "2021-12-22 13:54:03" +/// updateUser : "1364043181062094848" +/// storeId : "1364043181120815104" +/// skuCode : "P202112221354035" +/// skuNameStr : "" +/// productId : "1473532263365869568" +/// skuPrice : "49.00" +/// applyPrice : "0.00" +/// vipPrice : null +/// skuImg : null +/// skuStock : 0 +/// sort : 50 +/// setMeal : "" +/// weight : 0.0 +/// volume : 0.0 +/// isDelete : 0 +/// material : null +/// version : 0 + +class ProductSkuList { + ProductSkuList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String skuCode, + String skuNameStr, + String productId, + String skuPrice, + String applyPrice, + dynamic vipPrice, + dynamic skuImg, + int skuStock, + int sort, + String setMeal, + double weight, + double volume, + int isDelete, + dynamic material, + int version,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _skuCode = skuCode; + _skuNameStr = skuNameStr; + _productId = productId; + _skuPrice = skuPrice; + _applyPrice = applyPrice; + _vipPrice = vipPrice; + _skuImg = skuImg; + _skuStock = skuStock; + _sort = sort; + _setMeal = setMeal; + _weight = weight; + _volume = volume; + _isDelete = isDelete; + _material = material; + _version = version; +} + + ProductSkuList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _skuCode = json['skuCode']; + _skuNameStr = json['skuNameStr']; + _productId = json['productId']; + _skuPrice = json['skuPrice']; + _applyPrice = json['applyPrice']; + _vipPrice = json['vipPrice']; + _skuImg = json['skuImg']; + _skuStock = json['skuStock']; + _sort = json['sort']; + _setMeal = json['setMeal']; + _weight = json['weight']; + _volume = json['volume']; + _isDelete = json['isDelete']; + _material = json['material']; + _version = json['version']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _skuCode; + String _skuNameStr; + String _productId; + String _skuPrice; + String _applyPrice; + dynamic _vipPrice; + dynamic _skuImg; + int _skuStock; + int _sort; + String _setMeal; + double _weight; + double _volume; + int _isDelete; + dynamic _material; + int _version; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get skuCode => _skuCode; + String get skuNameStr => _skuNameStr; + String get productId => _productId; + String get skuPrice => _skuPrice; + String get applyPrice => _applyPrice; + dynamic get vipPrice => _vipPrice; + dynamic get skuImg => _skuImg; + int get skuStock => _skuStock; + int get sort => _sort; + String get setMeal => _setMeal; + double get weight => _weight; + double get volume => _volume; + int get isDelete => _isDelete; + dynamic get material => _material; + int get version => _version; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['skuCode'] = _skuCode; + map['skuNameStr'] = _skuNameStr; + map['productId'] = _productId; + map['skuPrice'] = _skuPrice; + map['applyPrice'] = _applyPrice; + map['vipPrice'] = _vipPrice; + map['skuImg'] = _skuImg; + map['skuStock'] = _skuStock; + map['sort'] = _sort; + map['setMeal'] = _setMeal; + map['weight'] = _weight; + map['volume'] = _volume; + map['isDelete'] = _isDelete; + map['material'] = _material; + map['version'] = _version; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/launch_join_act.dart b/lib/retrofit/data/launch_join_act.dart new file mode 100644 index 00000000..1c980954 --- /dev/null +++ b/lib/retrofit/data/launch_join_act.dart @@ -0,0 +1,148 @@ +/// id : "1491606527402835968" +/// createTime : "2022-02-10 10:54:43" +/// createUser : "1478548720785031168" +/// updateTime : "2022-02-10 10:54:43" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// type : 1 +/// actTemplateId : "1490571620652154880" +/// actTimeId : "1490571620887035904" +/// actRecordId : "1491606526735941632" +/// mid : "1478548720785031168" +/// orderId : "1491606528052953088" +/// isLeader : true +/// memberAvatar : "" +/// memberNickname : "斯基" +/// productId : "1490571670107193344" +/// actPrice : "60" +/// state : false +/// isDelete : null + +class LaunchJoinAct { + LaunchJoinAct({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + String actTemplateId, + String actTimeId, + String actRecordId, + String mid, + String orderId, + bool isLeader, + String memberAvatar, + String memberNickname, + String productId, + String actPrice, + bool state, + dynamic isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _type = type; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actRecordId = actRecordId; + _mid = mid; + _orderId = orderId; + _isLeader = isLeader; + _memberAvatar = memberAvatar; + _memberNickname = memberNickname; + _productId = productId; + _actPrice = actPrice; + _state = state; + _isDelete = isDelete; +} + + LaunchJoinAct.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _type = json['type']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actRecordId = json['actRecordId']; + _mid = json['mid']; + _orderId = json['orderId']; + _isLeader = json['isLeader']; + _memberAvatar = json['memberAvatar']; + _memberNickname = json['memberNickname']; + _productId = json['productId']; + _actPrice = json['actPrice']; + _state = json['state']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + int _type; + String _actTemplateId; + String _actTimeId; + String _actRecordId; + String _mid; + String _orderId; + bool _isLeader; + String _memberAvatar; + String _memberNickname; + String _productId; + String _actPrice; + bool _state; + dynamic _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + int get type => _type; + String get actTemplateId => _actTemplateId; + String get actTimeId => _actTimeId; + String get actRecordId => _actRecordId; + String get mid => _mid; + String get orderId => _orderId; + bool get isLeader => _isLeader; + String get memberAvatar => _memberAvatar; + String get memberNickname => _memberNickname; + String get productId => _productId; + String get actPrice => _actPrice; + bool get state => _state; + dynamic get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['type'] = _type; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actRecordId'] = _actRecordId; + map['mid'] = _mid; + map['orderId'] = _orderId; + map['isLeader'] = _isLeader; + map['memberAvatar'] = _memberAvatar; + map['memberNickname'] = _memberNickname; + map['productId'] = _productId; + map['actPrice'] = _actPrice; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index 8f976447..e5c02685 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -61,12 +61,14 @@ class MiNiDetail { int sellCount; int needLogistics; int oversold; + int organic; int status; bool posShow; int productType; int productNumber; int setMeal; int attrStyle; + String detail; int isDelete; String printerFlag; dynamic materialId; @@ -106,12 +108,14 @@ class MiNiDetail { miNiDetailBean.sellCount = map['sellCount']; miNiDetailBean.needLogistics = map['needLogistics']; miNiDetailBean.oversold = map['oversold']; + miNiDetailBean.organic = map['organic']; miNiDetailBean.status = map['status']; miNiDetailBean.posShow = map['posShow']; miNiDetailBean.productType = map['productType']; miNiDetailBean.productNumber = map['productNumber']; miNiDetailBean.setMeal = map['setMeal']; miNiDetailBean.attrStyle = map['attrStyle']; + miNiDetailBean.detail = map['detail']; miNiDetailBean.isDelete = map['isDelete']; miNiDetailBean.printerFlag = map['printerFlag']; miNiDetailBean.materialId = map['materialId']; @@ -157,12 +161,14 @@ class MiNiDetail { "sellCount": sellCount, "needLogistics": needLogistics, "oversold": oversold, + "organic" : organic, "status": status, "posShow": posShow, "productType": productType, "productNumber": productNumber, "setMeal": setMeal, "attrStyle": attrStyle, + "detail" :detail, "isDelete": isDelete, "printerFlag": printerFlag, "materialId": materialId, diff --git a/lib/retrofit/data/product.dart b/lib/retrofit/data/product.dart index afd86b87..093e9794 100644 --- a/lib/retrofit/data/product.dart +++ b/lib/retrofit/data/product.dart @@ -1,5 +1,5 @@ -class ProductList { +class ProductsList { String _id; String _createTime; String _createUser; @@ -124,7 +124,7 @@ class ProductList { _batch = batch; } - ProductList.fromJson(dynamic json) { + ProductsList.fromJson(dynamic json) { _id = json["id"]; _createTime = json["createTime"]; _createUser = json["createUser"]; diff --git a/lib/retrofit/data/shopping_home_config.dart b/lib/retrofit/data/shopping_home_config.dart new file mode 100644 index 00000000..7ebb21ad --- /dev/null +++ b/lib/retrofit/data/shopping_home_config.dart @@ -0,0 +1,740 @@ +/// specialArea : [{"img":"https://pos.upload.gznl.top/1179/2021/12/fe209ded-a504-4319-9c8d-6d8478785e78.jpg","id":"1064355492","productList":[{"productImg":"https://pos.upload.gznl.top/1179/2021/12/755b69d6-0047-44fe-9593-edac72fb9982.png","productSkuVOList":[{"productId":"1473532887297949696","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"25.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:56:32","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888409440256","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532887918706688","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:56:32","attrId":"1473532887704797184","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888619155456","skuId":"1473532888409440256"}],"skuCode":"P202112221356324"}],"productName":"有机草莓干","posShow":true,"attrList":[{"productId":"1473532887297949696","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532887704797184","id":"1473532887918706688","attrValue":"","attrValueImg":""}],"id":"1473532887704797184","attrName":""}],"price":"25.00","sellCount":0,"id":"1473532887297949696","applyPrice":"0.00","stock":0,"status":1},{"productImg":"https://pos.upload.gznl.top/1179/2021/12/c24dbb2c-91b9-47be-85c5-d9f05ffa4d59.png","productSkuVOList":[{"productId":"1473532682649468928","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"35.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:55:44","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684721455104","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532683257643008","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:55:44","attrId":"1473532683052122112","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684935364608","skuId":"1473532684721455104"}],"skuCode":"P202112221355432"}],"productName":"有机午餐一顿","posShow":true,"attrList":[{"productId":"1473532682649468928","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532683052122112","id":"1473532683257643008","attrValue":"","attrValueImg":""}],"id":"1473532683052122112","attrName":""}],"price":"35.00","sellCount":0,"id":"1473532682649468928","applyPrice":"0.00","stock":0,"status":1}]},{"img":"https://pos.upload.gznl.top/1179/2021/12/24fe72c9-8a2b-4a9d-968f-2037d71a1705.jpg","id":"8828438334","productList":[{"productImg":"https://pos.upload.gznl.top/1179/2021/12/755b69d6-0047-44fe-9593-edac72fb9982.png","productSkuVOList":[{"productId":"1473532887297949696","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"25.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:56:32","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888409440256","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532887918706688","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:56:32","attrId":"1473532887704797184","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888619155456","skuId":"1473532888409440256"}],"skuCode":"P202112221356324"}],"productName":"有机草莓干","posShow":true,"attrList":[{"productId":"1473532887297949696","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532887704797184","id":"1473532887918706688","attrValue":"","attrValueImg":""}],"id":"1473532887704797184","attrName":""}],"price":"25.00","sellCount":0,"id":"1473532887297949696","applyPrice":"0.00","stock":0,"status":1},{"productImg":"https://pos.upload.gznl.top/1179/2021/12/c24dbb2c-91b9-47be-85c5-d9f05ffa4d59.png","productSkuVOList":[{"productId":"1473532682649468928","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"35.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:55:44","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684721455104","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532683257643008","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:55:44","attrId":"1473532683052122112","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684935364608","skuId":"1473532684721455104"}],"skuCode":"P202112221355432"}],"productName":"有机午餐一顿","posShow":true,"attrList":[{"productId":"1473532682649468928","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532683052122112","id":"1473532683257643008","attrValue":"","attrValueImg":""}],"id":"1473532683052122112","attrName":""}],"price":"35.00","sellCount":0,"id":"1473532682649468928","applyPrice":"0.00","stock":0,"status":1},{"productImg":"https://pos.upload.gznl.top/1179/2021/12/1bff0936-f2a2-401e-befd-e00b416763ad.png","productSkuVOList":[{"productId":"1473532263365869568","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"49.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:54:03","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:54:03","createUser":"1364043181062094848","id":"1473532264519303168","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532264032763904","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:54:03","attrId":"1473532263827243008","createTime":"2021-12-22 13:54:03","createUser":"1364043181062094848","id":"1473532264716435456","skuId":"1473532264519303168"}],"skuCode":"P202112221354035"}],"productName":"回乡牛公仔","posShow":true,"attrList":[{"productId":"1473532263365869568","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532263827243008","id":"1473532264032763904","attrValue":"","attrValueImg":""}],"id":"1473532263827243008","attrName":""}],"price":"49.00","sellCount":0,"id":"1473532263365869568","applyPrice":"0.00","stock":0,"status":1},{"productImg":"https://pos.upload.gznl.top/1179/2021/12/eff19bf8-8986-4b14-aa3a-b39dd7df70ab.png","productSkuVOList":[{"productId":"1473532108914819072","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"66.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:53:27","storeId":"1364043181120815104","volume":0,"skuNameStr":"箱装5000g","createTime":"2021-12-22 13:53:27","createUser":"1364043181062094848","id":"1473532110689009664","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532109816594432","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:53:27","attrId":"1473532109514604544","createTime":"2021-12-22 13:53:27","createUser":"1364043181062094848","id":"1473532110915502080","skuId":"1473532110689009664"}],"skuCode":"P202112221353262"},{"productId":"1473532108914819072","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"15.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:53:27","storeId":"1364043181120815104","volume":0,"skuNameStr":"袋装1000g","createTime":"2021-12-22 13:53:27","createUser":"1364043181062094848","id":"1473532111414624256","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532110051475456","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:53:27","attrId":"1473532109514604544","createTime":"2021-12-22 13:53:27","createUser":"1364043181062094848","id":"1473532111624339456","skuId":"1473532111414624256"}],"skuCode":"P202112221353263"}],"productName":"正宗芒果干","posShow":true,"attrList":[{"productId":"1473532108914819072","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532109514604544","id":"1473532109816594432","attrValue":"箱装5000g","attrValueImg":""},{"isDelete":0,"attrId":"1473532109514604544","id":"1473532110051475456","attrValue":"袋装1000g","attrValueImg":""}],"id":"1473532109514604544","attrName":"规格"}],"price":"15.00","sellCount":0,"id":"1473532108914819072","applyPrice":"0.00","stock":0,"status":1}]}] +/// quickEntry : [{"img":"https://pos.upload.gznl.top/1179/2021/12/df9db6ba-4ef8-4962-8ae0-57a7d8140462.png","url":"/router/activity_prefecture_details?type=1","id":"4072162773"},{"img":"https://pos.upload.gznl.top/1179/2021/12/56d86c69-4044-4b08-818f-7cda2ae384d0.png","url":"/router/activity_prefecture_details?type=2","id":"4166165221"},{"img":"https://pos.upload.gznl.top/1179/2021/12/ef7da2a6-d501-424e-bc45-4d9f3f315f36.png","url":"/router/activity_prefecture_d3tails?type=3","id":"2717561527"}] +/// hotSearch : ["好","可以","verygod ","ssad","asda"] +/// categoryGroup : [{"groupList":[{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:50:12","groupImg":"https://pos.upload.gznl.top/1179/2021/12/4ff84bf7-1fca-4034-94e7-1c657917716f.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡水果","createTime":"2021-12-22 13:50:12","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473531295907708928"},{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:51:41","groupImg":"https://pos.upload.gznl.top/1179/2021/12/506f72e7-86b8-4bcb-a55b-b48572675d2f.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡周边","createTime":"2021-12-22 13:51:41","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473531667711787008"},{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:55:04","groupImg":"https://pos.upload.gznl.top/1179/2021/12/9864e0ba-dbb2-4bfd-935e-7fc4c0580760.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡门票","createTime":"2021-12-22 13:55:04","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473532517066735616"}],"groupCommodityName":"22","name":"22"},{"groupList":[],"groupCommodityName":"2244","name":"2244"},{"groupList":[],"groupCommodityName":"224455","name":"224455"},{"groupList":[],"groupCommodityName":"22445566","name":"22445566"}] + +class ShoppingHomeConfig { + ShoppingHomeConfig({ + List specialArea, + List quickEntry, + List hotSearch, + List categoryGroup,}){ + _specialArea = specialArea; + _quickEntry = quickEntry; + _hotSearch = hotSearch; + _categoryGroup = categoryGroup; +} + + ShoppingHomeConfig.fromJson(dynamic json) { + if (json['specialArea'] != null) { + _specialArea = []; + json['specialArea'].forEach((v) { + _specialArea.add(SpecialArea.fromJson(v)); + }); + } + if (json['quickEntry'] != null) { + _quickEntry = []; + json['quickEntry'].forEach((v) { + _quickEntry.add(QuickEntry.fromJson(v)); + }); + } + _hotSearch = json['hotSearch'] != null ? json['hotSearch'].cast() : []; + if (json['categoryGroup'] != null) { + _categoryGroup = []; + json['categoryGroup'].forEach((v) { + _categoryGroup.add(CategoryGroup.fromJson(v)); + }); + } + } + List _specialArea; + List _quickEntry; + List _hotSearch; + List _categoryGroup; + + List get specialArea => _specialArea; + List get quickEntry => _quickEntry; + List get hotSearch => _hotSearch; + List get categoryGroup => _categoryGroup; + + Map toJson() { + final map = {}; + if (_specialArea != null) { + map['specialArea'] = _specialArea.map((v) => v.toJson()).toList(); + } + if (_quickEntry != null) { + map['quickEntry'] = _quickEntry.map((v) => v.toJson()).toList(); + } + map['hotSearch'] = _hotSearch; + if (_categoryGroup != null) { + map['categoryGroup'] = _categoryGroup.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// groupList : [{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:50:12","groupImg":"https://pos.upload.gznl.top/1179/2021/12/4ff84bf7-1fca-4034-94e7-1c657917716f.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡水果","createTime":"2021-12-22 13:50:12","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473531295907708928"},{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:51:41","groupImg":"https://pos.upload.gznl.top/1179/2021/12/506f72e7-86b8-4bcb-a55b-b48572675d2f.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡周边","createTime":"2021-12-22 13:51:41","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473531667711787008"},{"isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:55:04","groupImg":"https://pos.upload.gznl.top/1179/2021/12/9864e0ba-dbb2-4bfd-935e-7fc4c0580760.png","sort":1,"storeId":"1364043181120815104","groupName":"回乡门票","createTime":"2021-12-22 13:55:04","kitchenGroup":0,"printerId":"1473531135496552448","createUser":"1364043181062094848","isCharge":0,"id":"1473532517066735616"}] +/// groupCommodityName : "22" +/// name : "22" + +class CategoryGroup { + CategoryGroup({ + List groupList, + String groupCommodityName, + String name,}){ + _groupList = groupList; + _groupCommodityName = groupCommodityName; + _name = name; +} + + CategoryGroup.fromJson(dynamic json) { + if (json['groupList'] != null) { + _groupList = []; + json['groupList'].forEach((v) { + _groupList.add(GroupList.fromJson(v)); + }); + } + _groupCommodityName = json['groupCommodityName']; + _name = json['name']; + } + List _groupList; + String _groupCommodityName; + String _name; + + List get groupList => _groupList; + String get groupCommodityName => _groupCommodityName; + String get name => _name; + + Map toJson() { + final map = {}; + if (_groupList != null) { + map['groupList'] = _groupList.map((v) => v.toJson()).toList(); + } + map['groupCommodityName'] = _groupCommodityName; + map['name'] = _name; + return map; + } + +} + +/// isDelete : 0 +/// updateUser : "1364043181062094848" +/// updateTime : "2021-12-22 13:50:12" +/// groupImg : "https://pos.upload.gznl.top/1179/2021/12/4ff84bf7-1fca-4034-94e7-1c657917716f.png" +/// sort : 1 +/// storeId : "1364043181120815104" +/// groupName : "回乡水果" +/// createTime : "2021-12-22 13:50:12" +/// kitchenGroup : 0 +/// printerId : "1473531135496552448" +/// createUser : "1364043181062094848" +/// isCharge : 0 +/// id : "1473531295907708928" + +class GroupList { + GroupList({ + int isDelete, + String updateUser, + String updateTime, + String groupImg, + int sort, + String storeId, + String groupName, + String createTime, + int kitchenGroup, + String printerId, + String createUser, + int isCharge, + String id,}){ + _isDelete = isDelete; + _updateUser = updateUser; + _updateTime = updateTime; + _groupImg = groupImg; + _sort = sort; + _storeId = storeId; + _groupName = groupName; + _createTime = createTime; + _kitchenGroup = kitchenGroup; + _printerId = printerId; + _createUser = createUser; + _isCharge = isCharge; + _id = id; +} + + GroupList.fromJson(dynamic json) { + _isDelete = json['isDelete']; + _updateUser = json['updateUser']; + _updateTime = json['updateTime']; + _groupImg = json['groupImg']; + _sort = json['sort']; + _storeId = json['storeId']; + _groupName = json['groupName']; + _createTime = json['createTime']; + _kitchenGroup = json['kitchenGroup']; + _printerId = json['printerId']; + _createUser = json['createUser']; + _isCharge = json['isCharge']; + _id = json['id']; + } + int _isDelete; + String _updateUser; + String _updateTime; + String _groupImg; + int _sort; + String _storeId; + String _groupName; + String _createTime; + int _kitchenGroup; + String _printerId; + String _createUser; + int _isCharge; + String _id; + + int get isDelete => _isDelete; + String get updateUser => _updateUser; + String get updateTime => _updateTime; + String get groupImg => _groupImg; + int get sort => _sort; + String get storeId => _storeId; + String get groupName => _groupName; + String get createTime => _createTime; + int get kitchenGroup => _kitchenGroup; + String get printerId => _printerId; + String get createUser => _createUser; + int get isCharge => _isCharge; + String get id => _id; + + Map toJson() { + final map = {}; + map['isDelete'] = _isDelete; + map['updateUser'] = _updateUser; + map['updateTime'] = _updateTime; + map['groupImg'] = _groupImg; + map['sort'] = _sort; + map['storeId'] = _storeId; + map['groupName'] = _groupName; + map['createTime'] = _createTime; + map['kitchenGroup'] = _kitchenGroup; + map['printerId'] = _printerId; + map['createUser'] = _createUser; + map['isCharge'] = _isCharge; + map['id'] = _id; + return map; + } + +} + +/// img : "https://pos.upload.gznl.top/1179/2021/12/df9db6ba-4ef8-4962-8ae0-57a7d8140462.png" +/// url : "/router/activity_prefecture_details?type=1" +/// id : "4072162773" + +class QuickEntry { + QuickEntry({ + String img, + String url, + String id,}){ + _img = img; + _url = url; + _id = id; +} + + QuickEntry.fromJson(dynamic json) { + _img = json['img']; + _url = json['url']; + _id = json['id']; + } + String _img; + String _url; + String _id; + + String get img => _img; + String get url => _url; + String get id => _id; + + Map toJson() { + final map = {}; + map['img'] = _img; + map['url'] = _url; + map['id'] = _id; + return map; + } + +} + +/// img : "https://pos.upload.gznl.top/1179/2021/12/fe209ded-a504-4319-9c8d-6d8478785e78.jpg" +/// id : "1064355492" +/// productList : [{"productImg":"https://pos.upload.gznl.top/1179/2021/12/755b69d6-0047-44fe-9593-edac72fb9982.png","productSkuVOList":[{"productId":"1473532887297949696","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"25.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:56:32","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888409440256","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532887918706688","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:56:32","attrId":"1473532887704797184","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888619155456","skuId":"1473532888409440256"}],"skuCode":"P202112221356324"}],"productName":"有机草莓干","posShow":true,"attrList":[{"productId":"1473532887297949696","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532887704797184","id":"1473532887918706688","attrValue":"","attrValueImg":""}],"id":"1473532887704797184","attrName":""}],"price":"25.00","sellCount":0,"id":"1473532887297949696","applyPrice":"0.00","stock":0,"status":1},{"productImg":"https://pos.upload.gznl.top/1179/2021/12/c24dbb2c-91b9-47be-85c5-d9f05ffa4d59.png","productSkuVOList":[{"productId":"1473532682649468928","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"35.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:55:44","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684721455104","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532683257643008","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:55:44","attrId":"1473532683052122112","createTime":"2021-12-22 13:55:44","createUser":"1364043181062094848","id":"1473532684935364608","skuId":"1473532684721455104"}],"skuCode":"P202112221355432"}],"productName":"有机午餐一顿","posShow":true,"attrList":[{"productId":"1473532682649468928","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532683052122112","id":"1473532683257643008","attrValue":"","attrValueImg":""}],"id":"1473532683052122112","attrName":""}],"price":"35.00","sellCount":0,"id":"1473532682649468928","applyPrice":"0.00","stock":0,"status":1}] + +class SpecialArea { + SpecialArea({ + String img, + String id, + List productList,}){ + _img = img; + _id = id; + _productList = productList; +} + + SpecialArea.fromJson(dynamic json) { + _img = json['img']; + _id = json['id']; + if (json['productList'] != null) { + _productList = []; + json['productList'].forEach((v) { + _productList.add(ProductList.fromJson(v)); + }); + } + } + String _img; + String _id; + List _productList; + + String get img => _img; + String get id => _id; + List get productList => _productList; + + Map toJson() { + final map = {}; + map['img'] = _img; + map['id'] = _id; + if (_productList != null) { + map['productList'] = _productList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// productImg : "https://pos.upload.gznl.top/1179/2021/12/755b69d6-0047-44fe-9593-edac72fb9982.png" +/// productSkuVOList : [{"productId":"1473532887297949696","isDelete":0,"setMeal":"","updateUser":"1364043181062094848","skuPrice":"25.00","skuStock":0,"weight":0,"updateTime":"2021-12-22 13:56:32","storeId":"1364043181120815104","volume":0,"skuNameStr":"","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888409440256","applyPrice":"0.00","skuAttrList":[{"attrValueId":"1473532887918706688","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:56:32","attrId":"1473532887704797184","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888619155456","skuId":"1473532888409440256"}],"skuCode":"P202112221356324"}] +/// productName : "有机草莓干" +/// posShow : true +/// attrList : [{"productId":"1473532887297949696","isDelete":0,"needImg":false,"attrValueList":[{"isDelete":0,"attrId":"1473532887704797184","id":"1473532887918706688","attrValue":"","attrValueImg":""}],"id":"1473532887704797184","attrName":""}] +/// price : "25.00" +/// sellCount : 0 +/// id : "1473532887297949696" +/// applyPrice : "0.00" +/// stock : 0 +/// status : 1 + +class ProductList { + ProductList({ + String productImg, + List productSkuVOList, + String productName, + bool posShow, + List attrList, + String price, + int sellCount, + String id, + String applyPrice, + int stock, + int status,}){ + _productImg = productImg; + _productSkuVOList = productSkuVOList; + _productName = productName; + _posShow = posShow; + _attrList = attrList; + _price = price; + _sellCount = sellCount; + _id = id; + _applyPrice = applyPrice; + _stock = stock; + _status = status; +} + + ProductList.fromJson(dynamic json) { + _productImg = json['productImg']; + if (json['productSkuVOList'] != null) { + _productSkuVOList = []; + json['productSkuVOList'].forEach((v) { + _productSkuVOList.add(ProductSkuVOList.fromJson(v)); + }); + } + _productName = json['productName']; + _posShow = json['posShow']; + if (json['attrList'] != null) { + _attrList = []; + json['attrList'].forEach((v) { + _attrList.add(AttrList.fromJson(v)); + }); + } + _price = json['price']; + _sellCount = json['sellCount']; + _id = json['id']; + _applyPrice = json['applyPrice']; + _stock = json['stock']; + _status = json['status']; + } + String _productImg; + List _productSkuVOList; + String _productName; + bool _posShow; + List _attrList; + String _price; + int _sellCount; + String _id; + String _applyPrice; + int _stock; + int _status; + + String get productImg => _productImg; + List get productSkuVOList => _productSkuVOList; + String get productName => _productName; + bool get posShow => _posShow; + List get attrList => _attrList; + String get price => _price; + int get sellCount => _sellCount; + String get id => _id; + String get applyPrice => _applyPrice; + int get stock => _stock; + int get status => _status; + + Map toJson() { + final map = {}; + map['productImg'] = _productImg; + if (_productSkuVOList != null) { + map['productSkuVOList'] = _productSkuVOList.map((v) => v.toJson()).toList(); + } + map['productName'] = _productName; + map['posShow'] = _posShow; + if (_attrList != null) { + map['attrList'] = _attrList.map((v) => v.toJson()).toList(); + } + map['price'] = _price; + map['sellCount'] = _sellCount; + map['id'] = _id; + map['applyPrice'] = _applyPrice; + map['stock'] = _stock; + map['status'] = _status; + return map; + } + +} + +/// productId : "1473532887297949696" +/// isDelete : 0 +/// needImg : false +/// attrValueList : [{"isDelete":0,"attrId":"1473532887704797184","id":"1473532887918706688","attrValue":"","attrValueImg":""}] +/// id : "1473532887704797184" +/// attrName : "" + +class AttrList { + AttrList({ + String productId, + int isDelete, + bool needImg, + List attrValueList, + String id, + String attrName,}){ + _productId = productId; + _isDelete = isDelete; + _needImg = needImg; + _attrValueList = attrValueList; + _id = id; + _attrName = attrName; +} + + AttrList.fromJson(dynamic json) { + _productId = json['productId']; + _isDelete = json['isDelete']; + _needImg = json['needImg']; + if (json['attrValueList'] != null) { + _attrValueList = []; + json['attrValueList'].forEach((v) { + _attrValueList.add(AttrValueList.fromJson(v)); + }); + } + _id = json['id']; + _attrName = json['attrName']; + } + String _productId; + int _isDelete; + bool _needImg; + List _attrValueList; + String _id; + String _attrName; + + String get productId => _productId; + int get isDelete => _isDelete; + bool get needImg => _needImg; + List get attrValueList => _attrValueList; + String get id => _id; + String get attrName => _attrName; + + Map toJson() { + final map = {}; + map['productId'] = _productId; + map['isDelete'] = _isDelete; + map['needImg'] = _needImg; + if (_attrValueList != null) { + map['attrValueList'] = _attrValueList.map((v) => v.toJson()).toList(); + } + map['id'] = _id; + map['attrName'] = _attrName; + return map; + } + +} + +/// isDelete : 0 +/// attrId : "1473532887704797184" +/// id : "1473532887918706688" +/// attrValue : "" +/// attrValueImg : "" + +class AttrValueList { + AttrValueList({ + int isDelete, + String attrId, + String id, + String attrValue, + String attrValueImg,}){ + _isDelete = isDelete; + _attrId = attrId; + _id = id; + _attrValue = attrValue; + _attrValueImg = attrValueImg; +} + + AttrValueList.fromJson(dynamic json) { + _isDelete = json['isDelete']; + _attrId = json['attrId']; + _id = json['id']; + _attrValue = json['attrValue']; + _attrValueImg = json['attrValueImg']; + } + int _isDelete; + String _attrId; + String _id; + String _attrValue; + String _attrValueImg; + + int get isDelete => _isDelete; + String get attrId => _attrId; + String get id => _id; + String get attrValue => _attrValue; + String get attrValueImg => _attrValueImg; + + Map toJson() { + final map = {}; + map['isDelete'] = _isDelete; + map['attrId'] = _attrId; + map['id'] = _id; + map['attrValue'] = _attrValue; + map['attrValueImg'] = _attrValueImg; + return map; + } + +} + +/// productId : "1473532887297949696" +/// isDelete : 0 +/// setMeal : "" +/// updateUser : "1364043181062094848" +/// skuPrice : "25.00" +/// skuStock : 0 +/// weight : 0 +/// updateTime : "2021-12-22 13:56:32" +/// storeId : "1364043181120815104" +/// volume : 0 +/// skuNameStr : "" +/// createTime : "2021-12-22 13:56:32" +/// createUser : "1364043181062094848" +/// id : "1473532888409440256" +/// applyPrice : "0.00" +/// skuAttrList : [{"attrValueId":"1473532887918706688","isDelete":0,"updateUser":"1364043181062094848","updateTime":"2021-12-22 13:56:32","attrId":"1473532887704797184","createTime":"2021-12-22 13:56:32","createUser":"1364043181062094848","id":"1473532888619155456","skuId":"1473532888409440256"}] +/// skuCode : "P202112221356324" + +class ProductSkuVOList { + ProductSkuVOList({ + String productId, + int isDelete, + String setMeal, + String updateUser, + String skuPrice, + int skuStock, + int weight, + String updateTime, + String storeId, + int volume, + String skuNameStr, + String createTime, + String createUser, + String id, + String applyPrice, + List skuAttrList, + String skuCode,}){ + _productId = productId; + _isDelete = isDelete; + _setMeal = setMeal; + _updateUser = updateUser; + _skuPrice = skuPrice; + _skuStock = skuStock; + _weight = weight; + _updateTime = updateTime; + _storeId = storeId; + _volume = volume; + _skuNameStr = skuNameStr; + _createTime = createTime; + _createUser = createUser; + _id = id; + _applyPrice = applyPrice; + _skuAttrList = skuAttrList; + _skuCode = skuCode; +} + + ProductSkuVOList.fromJson(dynamic json) { + _productId = json['productId']; + _isDelete = json['isDelete']; + _setMeal = json['setMeal']; + _updateUser = json['updateUser']; + _skuPrice = json['skuPrice']; + _skuStock = json['skuStock']; + _weight = json['weight']; + _updateTime = json['updateTime']; + _storeId = json['storeId']; + _volume = json['volume']; + _skuNameStr = json['skuNameStr']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _id = json['id']; + _applyPrice = json['applyPrice']; + if (json['skuAttrList'] != null) { + _skuAttrList = []; + json['skuAttrList'].forEach((v) { + _skuAttrList.add(SkuAttrList.fromJson(v)); + }); + } + _skuCode = json['skuCode']; + } + String _productId; + int _isDelete; + String _setMeal; + String _updateUser; + String _skuPrice; + int _skuStock; + int _weight; + String _updateTime; + String _storeId; + int _volume; + String _skuNameStr; + String _createTime; + String _createUser; + String _id; + String _applyPrice; + List _skuAttrList; + String _skuCode; + + String get productId => _productId; + int get isDelete => _isDelete; + String get setMeal => _setMeal; + String get updateUser => _updateUser; + String get skuPrice => _skuPrice; + int get skuStock => _skuStock; + int get weight => _weight; + String get updateTime => _updateTime; + String get storeId => _storeId; + int get volume => _volume; + String get skuNameStr => _skuNameStr; + String get createTime => _createTime; + String get createUser => _createUser; + String get id => _id; + String get applyPrice => _applyPrice; + List get skuAttrList => _skuAttrList; + String get skuCode => _skuCode; + + Map toJson() { + final map = {}; + map['productId'] = _productId; + map['isDelete'] = _isDelete; + map['setMeal'] = _setMeal; + map['updateUser'] = _updateUser; + map['skuPrice'] = _skuPrice; + map['skuStock'] = _skuStock; + map['weight'] = _weight; + map['updateTime'] = _updateTime; + map['storeId'] = _storeId; + map['volume'] = _volume; + map['skuNameStr'] = _skuNameStr; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['id'] = _id; + map['applyPrice'] = _applyPrice; + if (_skuAttrList != null) { + map['skuAttrList'] = _skuAttrList.map((v) => v.toJson()).toList(); + } + map['skuCode'] = _skuCode; + return map; + } + +} + +/// attrValueId : "1473532887918706688" +/// isDelete : 0 +/// updateUser : "1364043181062094848" +/// updateTime : "2021-12-22 13:56:32" +/// attrId : "1473532887704797184" +/// createTime : "2021-12-22 13:56:32" +/// createUser : "1364043181062094848" +/// id : "1473532888619155456" +/// skuId : "1473532888409440256" + +class SkuAttrList { + SkuAttrList({ + String attrValueId, + int isDelete, + String updateUser, + String updateTime, + String attrId, + String createTime, + String createUser, + String id, + String skuId,}){ + _attrValueId = attrValueId; + _isDelete = isDelete; + _updateUser = updateUser; + _updateTime = updateTime; + _attrId = attrId; + _createTime = createTime; + _createUser = createUser; + _id = id; + _skuId = skuId; +} + + SkuAttrList.fromJson(dynamic json) { + _attrValueId = json['attrValueId']; + _isDelete = json['isDelete']; + _updateUser = json['updateUser']; + _updateTime = json['updateTime']; + _attrId = json['attrId']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _id = json['id']; + _skuId = json['skuId']; + } + String _attrValueId; + int _isDelete; + String _updateUser; + String _updateTime; + String _attrId; + String _createTime; + String _createUser; + String _id; + String _skuId; + + String get attrValueId => _attrValueId; + int get isDelete => _isDelete; + String get updateUser => _updateUser; + String get updateTime => _updateTime; + String get attrId => _attrId; + String get createTime => _createTime; + String get createUser => _createUser; + String get id => _id; + String get skuId => _skuId; + + Map toJson() { + final map = {}; + map['attrValueId'] = _attrValueId; + map['isDelete'] = _isDelete; + map['updateUser'] = _updateUser; + map['updateTime'] = _updateTime; + map['attrId'] = _attrId; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['id'] = _id; + map['skuId'] = _skuId; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index ebe58ba5..d518dcc5 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -14,10 +14,17 @@ import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; +import 'data/activity_actRecord_details.dart'; +import 'data/activity_area_list.dart'; +import 'data/activity_details.dart'; +import 'data/activity_order_list.dart'; import 'data/findMiNiGroupList.dart'; +import 'data/home_recommend_list.dart'; +import 'data/launch_join_act.dart'; import 'data/miNiDetail.dart'; import 'data/settleOrderInfo.dart'; import 'data/shoppingCart.dart'; +import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; @@ -58,8 +65,8 @@ abstract class MinApiService { } headers["Environment"] = "app"; dio.options = BaseOptions( - connectTimeout: 10000, - receiveTimeout: 10000, + connectTimeout: 15000, + receiveTimeout: 15000, headers: headers, responseType: ResponseType.json, ); @@ -119,7 +126,7 @@ abstract class MinApiService { ); if (kReleaseMode) { - baseUrl = serviceBaseUrl; + baseUrl = base_url; } return _MinApiService(dio, baseUrl: baseUrl); } @@ -202,4 +209,42 @@ abstract class MinApiService { @GET("order/getParentInfo?tableId={tableId}") Future getParentInfo(@Path("tableId") String tableId); + /// 小程序商品推荐/为你推荐 + @GET("product/recommendList") + Future>> recommendList(); + + ///获取门店首页配置 + @GET("store/homeConfig") + Future> homeConfig(); + + ///活动专区,秒杀,砍价,拼团 + @GET("actTemplate/findActListByType?allDay={allDay}&type={type}") + Future> findActListByType(@Path("allDay") bool allDay, + @Path("type") String type); + + /// APP、小程序点击查看活动列表的某一个活动详情 + @GET("actTemplate/viewProduct?actProductId={actProductId}&type={type}") + Future> viewProduct(@Path("actProductId") String actProductId, + @Path("type") String type); + + /// 发起活动 + @POST("actTemplate/launchAct") + Future> launchAct(@Body() Map param); + + /// 参与活动 + @POST("actTemplate/joinAct") + Future> joinAct(@Body() Map param); + + /// 活动付款 + @POST("actTemplate/actPay") + Future actPay(@Body() Map param); + + /// 查看我的拼团、砍价、列表 + @POST("actTemplate/showMyActList") + Future>> showMyActList(@Body() Map param); + + /// 查看某一个发起的拼团、砍价详情 + @GET("actTemplate/showOneAct?actRecordId={actRecordId}") + Future> showOneAct(@Path("actRecordId") String actRecordId); + } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 0e6494d9..8109d5fa 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -400,4 +400,209 @@ class _MinApiService implements MinApiService { ); return value; } + + @override + Future>> recommendList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'product/recommendList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => HomeRecommendList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> homeConfig() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('store/homeConfig', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ShoppingHomeConfig.fromJson(json), + ); + return value; + } + + @override + Future> findActListByType(allDay, type) async { + ArgumentError.checkNotNull(allDay, 'allDay'); + ArgumentError.checkNotNull(type, 'type'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'actTemplate/findActListByType?allDay=$allDay&type=$type', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityAreaList.fromJson(json), + ); + return value; + } + + @override + Future> viewProduct(actProductId, type) async { + ArgumentError.checkNotNull(actProductId, 'actProductId'); + ArgumentError.checkNotNull(type, 'type'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'actTemplate/viewProduct?actProductId=$actProductId&type=$type', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityDetails.fromJson(json), + ); + return value; + } + + @override + Future> launchAct(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'actTemplate/launchAct', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => LaunchJoinAct.fromJson(json), + ); + return value; + } + + @override + Future> joinAct(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'actTemplate/joinAct', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => LaunchJoinAct.fromJson(json), + ); + return value; + } + + @override + Future> actPay(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'actTemplate/actPay', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future>> showMyActList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'actTemplate/showMyActList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => ActivityOrderList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> showOneAct(actRecordId) async { + ArgumentError.checkNotNull(actRecordId, 'actRecordId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'actTemplate/showOneAct?actRecordId=$actRecordId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityActRecordDetails.fromJson(json), + ); + return value; + } } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 65a3ccda..60e7b337 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -55,6 +55,7 @@ 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'; @@ -144,7 +145,7 @@ abstract class ApiService { ); if (kReleaseMode) { - baseUrl = serviceBaseUrl; + baseUrl = base_url; } return _ApiService(dio, baseUrl: baseUrl); } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 6bd2185e..ae4133e9 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -9,15 +9,18 @@ import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.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/activity_details.dart'; import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/down_order.dart'; +import 'package:huixiang/retrofit/data/launch_join_act.dart'; import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/settlement/settlement_model.dart'; import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart'; import 'package:huixiang/settlement/settlement_view/distribution.dart'; import 'package:huixiang/settlement/settlement_view/pay_method.dart'; @@ -47,8 +50,6 @@ class _Settlement extends State { MinApiService minService; Function(int type) callback; StoreInfo storeInfo; - - // ShoppingCart shopCarGoods; SettleOrderInfo settleOrderInfo; MinOrderInfo minOrderInfo; int selectedBtn = 0; @@ -58,12 +59,23 @@ class _Settlement extends State { int payChannel = 1; int tableId = 0; int numberOfPeople = 0; - + String pageType; Address address; CouponListBean couponListBean; PromotionInfoListBean promotion; String mobile; bool placeOrder = false; + String actProductId; + String actProductSkuId; + ActivityDetails activityDetails; + BargainType bargainType = BargainType.BargainZBug; + LaunchJoinAct launchJoinAct; + String skuPrice1; + JoinActivity joinA = JoinActivity.GoJoin; + String bargainOrderId; + String productSkuId; + int count1 = 0; + String productId; @override void initState() { @@ -75,6 +87,17 @@ class _Settlement extends State { numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; promotions = widget.arguments["pName"] ?? ""; coupons = widget.arguments["cName"] ?? ""; + pageType = widget.arguments["pageType"]; + actProductId = widget.arguments["actProductId"]; + actProductSkuId = widget.arguments["actProductSkuId"]; + activityDetails = widget.arguments["activityDetails"]; + bargainType = widget.arguments["bargainType"]; + skuPrice1 = widget.arguments["skuPrice1"]; + joinA = widget.arguments["joinA"]; + bargainOrderId = widget.arguments["bargainOrderId"]; + productSkuId = widget.arguments["productSkuId"]; + count1 = widget.arguments["buyNum"]; + productId = widget.arguments["productId"]; if (tableId == 0) { placeOrder = true; } @@ -95,7 +118,11 @@ class _Settlement extends State { selectedBtn, null, 0, - widget.arguments["pid"], + widget.arguments["pid"] ?? (productId?? ""), + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1, ); } else if (coupons != null && coupons != "" || tableId <= 0) { queryOrderInfo( @@ -103,10 +130,24 @@ class _Settlement extends State { selectedBtn, widget.arguments["cid"], 0, - null, + productId?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1, ); } else - queryOrderInfo(null, selectedBtn, null, 0, null); + queryOrderInfo( + null, + selectedBtn, + null, + 0, + productId ?? "", + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1, + ); }); weChatResponseEventHandler.listen((event) async { @@ -122,13 +163,21 @@ class _Settlement extends State { memberCouponId, orderId, promotionId, + productSkuId, + actProductId, + actProductSkuId, + buyNum, ) async { BaseData baseData = await minService.getOrderInfo({ "addressId": addressId, "isTake": isTake, "memberCouponId": memberCouponId, "orderId": orderId, - "promotionId": promotionId + "promotionId": promotionId, + "productSkuId":productSkuId, + "actProductId": actProductId, + "actProductSkuId": actProductSkuId, + "buyNum":buyNum }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { @@ -136,7 +185,8 @@ class _Settlement extends State { if (settleOrderInfo.orderProductList == null || settleOrderInfo.orderProductList.length == 0) { placeOrder = true; - queryOrderDetails(parentId); + queryOrderDetails( + pageType != null ? widget.arguments["orderId"] : parentId); } }); } @@ -146,14 +196,14 @@ class _Settlement extends State { queryOrderDetails(id) async { print("ididididididid: $id"); BaseData baseData = await minService.getOrderDetails({ - "id": id, + "id": widget.arguments["orderId"], }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { minOrderInfo = baseData.data; }); - }else{ - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); } } @@ -162,7 +212,17 @@ class _Settlement extends State { this.selectedBtn = selectedBtn; }); if (address != null) { - queryOrderInfo(address.id, selectedBtn, null, 0, null); + queryOrderInfo( + address.id, + selectedBtn, + null, + 0, + productId?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 + ); return; } BaseData> baseDate = @@ -206,7 +266,17 @@ class _Settlement extends State { } } - queryOrderInfo(address.id, selectedBtn, null, 0, null); + queryOrderInfo( + address.id, + selectedBtn, + null, + 0, + productId?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 + ); } } @@ -222,13 +292,82 @@ class _Settlement extends State { }); }); - queryOrderInfo(address.id, selectedBtn, null, 0, null); + queryOrderInfo( + address.id, + selectedBtn, + null, + 0, + productId?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 + ); } } PlaceOrderFirst placeOrderFirst; DownOrder downOrder; + ///发起活动 + queryLaunchAct() async { + BaseData baseData = await minService.launchAct({ + "actProductId": activityDetails.actProduct.id, + "actRecordId": 0, + "actTemplateId": activityDetails.actProduct.templateId, + "actTimeId": activityDetails.actProduct.timeId, + "addressId": address == null ? null : address.id, + "isDirectBuy": (bargainType == BargainType.BargainBug || + bargainType == BargainType.CollageBug) + ? false + : true, + "getType": selectedBtn, + "productId": activityDetails.actProduct.productId, + "skuId": actProductSkuId ?? "", + "skuPrice": settleOrderInfo.price, + "templateType": pageType, + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + launchJoinAct = baseData.data; + if (bargainType == BargainType.BargainBug) { + toBargain(); + } else { + activityPay(); + } + }); + } else { + if ((activityDetails?.actProduct?.productStock ?? 0) == 0) + SmartDialog.showToast("活动商品售罄", alignment: Alignment.center); + } + } + + ///参与活动 + queryJoinAct() async { + BaseData baseData = await minService.joinAct({ + "actProductId": activityDetails.actProduct.id, + "actRecordId": widget.arguments["indexP"], + "actTemplateId": activityDetails.actProduct.templateId, + "actTimeId": activityDetails.actProduct.timeId, + "addressId": address == null ? null : address.id, + "isDirectBuy": (bargainType == BargainType.BargainBug || + bargainType == BargainType.CollageBug) + ? false + : true, + "getType": selectedBtn, + "productId": activityDetails.actProduct.productId, + "skuId": actProductSkuId ?? "", + "skuPrice": skuPrice1, + "templateType": pageType + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + launchJoinAct = baseData.data; + activityPay(); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + ///小程序下单 queryPlaceOrderFirst() async { for (int i = 0; i < settleOrderInfo.orderProductList.length; i++) { @@ -385,6 +524,66 @@ class _Settlement extends State { } } + ///活动结算 + activityPay() async { + if (payChannel == 1) { + if (Platform.isAndroid) { + if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + await Min.initialize(); + } + } + BaseData baseData = await minService.actPay({ + "orderId": + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId, + "payChannel": placeOrderFirst.payChannel + }).catchError((error) { + print(error); + }); + if (baseData != null && baseData.isSuccess) { + WxPay wxPay = baseData.data; + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + } + } else { + BaseData baseData = await minService.actPay({ + "orderId": + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId, + "payChannel": payChannel + }).catchError((error) { + print(error); + }); + if (baseData != null && baseData.isSuccess) { + toOrderDetails( + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId); + } else { + SmartDialog.show( + widget: Tips( + () { + toOrderDetails(bargainOrderId != null + ? bargainOrderId + : launchJoinAct.orderId); + }, + text: "${baseData.msg}", + )); + } + } + } + toOrderDetails(String orderId) { Navigator.of(context).popAndPushNamed( '/router/order_details', @@ -395,6 +594,16 @@ class _Settlement extends State { // Navigator.of(context).pop(); } + ///去砍价详情页面 + toBargain() async { + await Navigator.of(context) + .popAndPushNamed('/router/bargain_details', arguments: { + "actRecordId": launchJoinAct.actRecordId, + // "limitNumber": limitNumber, + "storeInfo": storeInfo, + }); + } + @override Widget build(BuildContext context) { return Container( @@ -437,10 +646,19 @@ class _Settlement extends State { setState(() { this.selectedBtn = 0; }); - queryOrderInfo(addressId, isTake, - memberCouponId, orderId, promotionId); + queryOrderInfo( + addressId, + isTake, + memberCouponId, + orderId, + promotionId ?? (productId?? ""), + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 + ); }, queryAddress, storeInfo, address, - selectedAddress), + selectedAddress, pageType), SizedBox( height: 16, @@ -458,6 +676,7 @@ class _Settlement extends State { settleOrderInfo, minOrderInfo, tableId, + pageType, ), ///优惠券/备注/会员优惠金额 @@ -483,7 +702,8 @@ class _Settlement extends State { tableId, ), - if (placeOrder) + if (placeOrder && + joinA != JoinActivity.BargainBug) ///支付方式 PayMethod(payChannelCheck), @@ -510,9 +730,9 @@ class _Settlement extends State { ), ), Text( - minOrderInfo != null + (minOrderInfo != null ? "¥${minOrderInfo.orderSumPrice}" - : "¥${settleOrderInfo == null ? "0" : settleOrderInfo.price}", + : "¥${settleOrderInfo == null ? "0" : settleOrderInfo.price}"), style: TextStyle( fontSize: 20.sp, fontWeight: MyFontWeight.semi_bold, @@ -525,7 +745,9 @@ class _Settlement extends State { RoundButton( width: 103.w, height: 54.h, - text: placeOrder ? S.current.jiesuan : "下单", + text: joinA == JoinActivity.BargainBug + ? "发起砍价" + : (placeOrder ? S.current.jiesuan : "下单"), textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFF32A060), @@ -534,7 +756,13 @@ class _Settlement extends State { vertical: 5.h, ), callback: () { - queryPlaceOrderFirst(); + pageType != null + ? bargainOrderId != null + ? activityPay() + : joinA == JoinActivity.GoJoin + ? queryJoinAct() + : queryLaunchAct() + : queryPlaceOrderFirst(); }, ), ], @@ -597,7 +825,11 @@ class _Settlement extends State { selectedBtn, couponListBean != null ? couponListBean.id : null, 0, - null, + productId?? null, + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 ); } } @@ -621,7 +853,11 @@ class _Settlement extends State { selectedBtn, null, 0, - promotion != null ? promotion.id : null, + promotion != null ? promotion.id : (productId?? null), + productSkuId ?? "", + actProductId ?? "", + actProductSkuId ?? "", + count1 ); } } diff --git a/lib/settlement/settlement_model.dart b/lib/settlement/settlement_model.dart new file mode 100644 index 00000000..57147d92 --- /dev/null +++ b/lib/settlement/settlement_model.dart @@ -0,0 +1,15 @@ +enum BargainType { + BargainZBug, + BargainBug, + CollageBug, +} + +enum JoinActivity { + GoJoin, + CollageBug, + CollageZBug, + BargainZBug, + MZBug, + MBug, + BargainBug, +} diff --git a/lib/settlement/settlement_view/distribution.dart b/lib/settlement/settlement_view/distribution.dart index 48b9a07d..ec1a4298 100644 --- a/lib/settlement/settlement_view/distribution.dart +++ b/lib/settlement/settlement_view/distribution.dart @@ -23,9 +23,10 @@ class DistributionMode extends StatefulWidget { final Function(String addId) selectedNewAddress; final StoreInfo storeInfo; final Address address; + final String pageType; DistributionMode(this.queryOrderInfo, this.queryAddress, this.storeInfo, - this.address, this.selectedNewAddress); + this.address, this.selectedNewAddress, this.pageType); @override State createState() { @@ -153,10 +154,13 @@ class _DistributionMode extends State { flex: 1, child: GestureDetector( onTap: () { - setState(() { - selectedBtn = 1; - widget.queryAddress(selectedBtn); - }); + if (widget.storeInfo.storeName == "一心回乡商城") { + SmartDialog.showToast("该功能暂未开放!", + alignment: Alignment.center); + return; + } + selectedBtn = 1; + widget.queryAddress(selectedBtn); }, child: Container( height: 50.h, @@ -176,6 +180,11 @@ class _DistributionMode extends State { flex: 1, child: GestureDetector( onTap: () { + if (widget.storeInfo.storeName == "一心回乡商城") { + selectedBtn = 2; + widget.queryAddress(selectedBtn); + return; + } SmartDialog.showToast("该功能暂未开放!", alignment: Alignment.center); }, @@ -307,11 +316,17 @@ class _DistributionMode extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset( + (widget.storeInfo.storeName == "一心回乡商城") ? + Icon( + Icons.local_shipping, + color: Color(0xFF727272), + size: 24, + ):Image.asset( "assets/image/icon_permission_location.webp", height: 24.h, width: 24.w, ), + SizedBox(width: 5), Text( widget?.address?.username ?? "", overflow: TextOverflow.ellipsis, @@ -350,7 +365,8 @@ class _DistributionMode extends State { }); }, child: Container( - padding:EdgeInsets.symmetric(horizontal:15.w,vertical: 5.h), + padding: EdgeInsets.symmetric( + horizontal: 15.w, vertical: 5.h), child: Icon( Icons.keyboard_arrow_right, size: 24, diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 97933282..d9b5e8c1 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; @@ -14,9 +15,10 @@ class SettlementOrderCommodity extends StatefulWidget { final SettleOrderInfo settleOrderInfo; final MinOrderInfo minOrderInfo; + final String pageType; SettlementOrderCommodity( - this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId); + this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId,this.pageType,); @override State createState() { @@ -111,7 +113,7 @@ class _SettlementOrderCommodity extends State { color: Colors.grey, ), )); - widgets.add(buildTotalPrice()); + // widgets.add(buildTotalPrice()); return widgets; } @@ -315,71 +317,71 @@ class _SettlementOrderCommodity extends State { ); } - Widget buildTotalPrice() { - return Container( - margin: EdgeInsets.only(top: 7.h, bottom: 11.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, - children: [ - Expanded( - child: Text( - S.of(context).gongjijianshangpin((widget.minOrderInfo != null) - ? ((widget.minOrderInfo != null) - ? widget.minOrderInfo.orderProductVOList.length - : "0") - : (widget.settleOrderInfo != null) - ? widget.settleOrderInfo.orderProductList.length - : "0"), - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFFA29E9E), - fontWeight: MyFontWeight.semi_bold, - ), - ), - flex: 1, - ), - Container( - child: Text( - "已优惠:¥${discountPrice()}", - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF7B7B7B), - fontWeight: MyFontWeight.medium, - ), - ), - ), - SizedBox( - width: 15.w, - ), - - Container( - child: Text( - S.of(context).jiesuanjine, - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ), - SizedBox( - width: 5.w, - ), - Text( - totalPrice(), - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], - ), - ); - } + // Widget buildTotalPrice() { + // return Container( + // margin: EdgeInsets.only(top: 7.h, bottom: 11.h), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // crossAxisAlignment: CrossAxisAlignment.baseline, + // textBaseline: TextBaseline.alphabetic, + // children: [ + // Expanded( + // child: Text( + // S.of(context).gongjijianshangpin((widget.minOrderInfo != null) + // ? ((widget.minOrderInfo != null) + // ? widget.minOrderInfo.orderProductVOList.length + // : "0") + // : (widget.settleOrderInfo != null) + // ? widget.settleOrderInfo.orderProductList.length + // : "0"), + // style: TextStyle( + // fontSize: 10.sp, + // color: Color(0xFFA29E9E), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // flex: 1, + // ), + // Container( + // child: Text( + // "已优惠:¥${discountPrice()}", + // style: TextStyle( + // fontSize: 12.sp, + // color: Color(0xFF7B7B7B), + // fontWeight: MyFontWeight.medium, + // ), + // ), + // ), + // SizedBox( + // width: 15.w, + // ), + // + // Container( + // child: Text( + // S.of(context).jiesuanjine, + // style: TextStyle( + // fontSize: 12.sp, + // color: Color(0xFF353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ), + // SizedBox( + // width: 5.w, + // ), + // Text( + // totalPrice(), + // textAlign: TextAlign.end, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF32A060), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ], + // ), + // ); + // } String discountPrice(){ if(widget.minOrderInfo != null){ diff --git a/lib/store/shopping/activity_prefecture_details.dart b/lib/store/shopping/activity_prefecture_details.dart new file mode 100644 index 00000000..4304833c --- /dev/null +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -0,0 +1,1097 @@ +import 'dart:async'; + +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/activity.dart'; +import 'package:huixiang/retrofit/data/activity_area_list.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.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 ActivityPrefectureDetails extends StatefulWidget { + final Map arguments; + + ActivityPrefectureDetails({this.arguments}); + + @override + State createState() { + return _ActivityPrefectureDetails(); + } +} + +class _ActivityPrefectureDetails extends State { + ApiService apiService; + MinApiService minService; + int seckillIndex = 0; + RefreshController refreshController = RefreshController(); + ScrollController _scrollController; + ScrollPhysics _scrollPhysics = NeverScrollableScrollPhysics(); + bool scrollFlag = false; + List actTimeList = []; + List productList = []; + List activitys; + ActTemplate actTemplate; + int actTimeListIndex = 0; + StoreInfo storeInfo; + String pageType = "1"; + String storeId; + String tenant; + String minToken; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + int tempDay = 0; + int tempHour = 0; + int tempM = 0; + int tempS = 0; + bool isDispose = false; + + @override + void dispose() { + super.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + + @override + void initState() { + super.initState(); + _scrollController = ScrollController(); + if(pageType != "2"){ + _scrollPhysics = BouncingScrollPhysics(); + }else{ + _scrollController.addListener(() { + setState(() { + if (_scrollController.offset < + (325.h - MediaQuery.of(context).padding.top)) { + _scrollPhysics = NeverScrollableScrollPhysics(); + } else { + _scrollPhysics = BouncingScrollPhysics(); + } + }); + }); + } + + pageType = widget.arguments["type"]; + storeId = widget.arguments["storeId"]; + tenant = widget.arguments["tenant"]; + + SharedPreferences.getInstance().then((value) { + minLogin(value); + queryStoreInfo(); + }); + } + + /// 小程序登录 + minLogin(SharedPreferences shared) async { + EasyLoading.show(status: S.of(context).zhengzaijiazai); + apiService = ApiService( + Dio(), + context: context, + token: shared.getString('token'), + showLoading: false, + ); + apiService.minLogin(storeId).catchError((onError) { + debugPrint(onError.toString()); + }).then((baseData) { + if (baseData != null && baseData.isSuccess) { + minToken = baseData.data["token"]; + queryStoreInfo(); + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + queryFindActListByType(pageType == "2" ? false : true); + + EasyLoading.dismiss(); + } + }); + } + + /// 查询店铺信息 + queryStoreInfo() async { + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error.toString()); + }); + if (baseData != null && baseData.isSuccess) { + storeInfo = StoreInfo.fromJson(baseData.data); + activitys = storeInfo.informationVOPageVO.list + .map((e) => Activity.fromJson(e)) + .toList(); + if (mounted) { + setState(() {}); + } + } + EasyLoading.dismiss(); + } + + ///秒杀/砍价/拼团列表 + queryFindActListByType(allDay) async { + BaseData baseData = await minService + .findActListByType(allDay, pageType) + .catchError((error) { + refreshController.refreshFailed(); + }); + setState(() { + actTimeList.clear(); + productList.clear(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + actTemplate = baseData.data.actTemplate; + actTimeList.addAll(baseData.data.timeProductList); + actTimeListIndex = 0; + for (var i = 0; i < actTimeList.length; i++) { + if (timeFlag(actTimeList[i].actTime.startHour) == 1) { + actTimeListIndex = i; + break; + } + } + if (actTimeList.length > actTimeListIndex) + productList.addAll(actTimeList[actTimeListIndex].productList); + startCountdownTimer(); + refreshController.refreshCompleted(); + }); + } else { + refreshController.refreshCompleted(); + } + } + + ///限天秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + var tempDateTime = + DateTime.parse(actTemplate.endTime).difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + tempDay = 0; + tempHour = 0; + tempM = 0; + tempS = 0; + return; + } + tempDay = tempDateTime.inDays; + tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + + @override + Widget build(BuildContext context) { + return Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + queryFindActListByType((pageType == "2" && seckillIndex == 0) ? false : true); + }); + }, + child:SingleChildScrollView( + physics: BouncingScrollPhysics(), + controller: _scrollController, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + seckillProduct(), + seckilList(), + ], + ), + ), + ), + ); + } + + Widget seckillProduct() { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(8.h), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + child: Column( + children: [ + swiper(), + pageType == "2" + ? (seckillIndex == 0 + ? Container( + width: double.infinity, + alignment: Alignment.center, + height: 62.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: BoxDecoration(color: Color(0xFFFFEED9)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/ms.webp", + width: 38, + height: 38, + fit: BoxFit.contain, + ), + SizedBox( + width: 14.w, + ), + Expanded( + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemCount: actTimeList?.length ?? 0, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + actTimeListIndex = position; + productList.clear(); + productList.addAll( + actTimeList[actTimeListIndex] + .productList); + }); + }, + child: + timeItem(actTimeList[position], position), + ); + }, + )), + ], + ), + ) + : Container( + width: double.infinity, + alignment: Alignment.center, + height: 62.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: BoxDecoration(color: Color(0xFFFFEED9)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/ms_t.webp", + width: 38, + height: 38, + fit: BoxFit.contain, + ), + Spacer(), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "距秒杀结束还有", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + TextSpan( + text: tempDay.toString(), + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFFB312B), + ), + ), + TextSpan( + text: "天", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ], + ), + ), + SizedBox(width: 4.w), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempHour.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFFFB312B), + ), + ), + ), + Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempM.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFFFB312B), + ), + ), + ), + InkWell( + onTap: () {}, + child: Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempS.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + ], + ) + ], + ), + )) + : Container(), + ], + ), + ); + } + + ///头部图片 + Widget swiper() { + return Container( + child: AspectRatio( + aspectRatio: 1.3698, + child: Stack( + children: [ + Positioned( + top: 0, + left: 0, + right: 0, + bottom: 0, + child: MImage( + actTemplate?.coverImg ?? "", + width: double.infinity, + height: 330.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + )), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + margin: EdgeInsets.only(left: 16, top: 52), + padding: EdgeInsets.all(5), + child: Icon( + Icons.arrow_back_ios, + size: 24, + color: Colors.black, + ), + ), + ), + pageType == "2" + ? Align( + alignment: Alignment.topCenter, + child: Container( + margin: EdgeInsets.only(top: 52), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Color.fromRGBO(0, 0, 0, 69000000), + ), + width: 160.w, + height: 35.h, + child: Row( + children: [ + GestureDetector( + onTap: () { + setState(() { + seckillIndex = 0; + queryFindActListByType(false); + }); + }, + child: Container( + alignment: Alignment.center, + width: 72.w, + height: 25.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + seckillIndex == 0 + ? Color(0xFFF67E5F) + : Colors.transparent, + seckillIndex == 0 + ? Color(0xFFFC5237) + : Colors.transparent, + ]), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Opacity( + opacity: seckillIndex == 0 ? 1 : 0.5, + child: Text( + "限时秒杀", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ))), + GestureDetector( + onTap: () { + setState(() { + seckillIndex = 1; + queryFindActListByType(true); + }); + }, + child: Container( + alignment: Alignment.center, + width: 72.w, + height: 25.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + seckillIndex == 1 + ? Color(0xFFF67E5F) + : Colors.transparent, + seckillIndex == 1 + ? Color(0xFFFC5237) + : Colors.transparent, + ]), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Opacity( + opacity: seckillIndex == 1 ? 1 : 0.5, + child: Text( + "限天秒杀", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ))), + ], + ), + ), + ) + : Container(), + ], + ), + ), + ); + } + + ///秒杀列表 + Widget seckilList() { + return (pageType == "2")?Container( + height: MediaQuery.of(context).size.height - + 62.h - + MediaQuery.of(context).padding.top, + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + color: Colors.white, + child: seckilListChild(), + ):Container( + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + color: Colors.white, + child: seckilListChild(), + ); + } + + Widget seckilListChild() { + return productList.length == 0 + ? Container( + width: double.infinity, + alignment: Alignment.topCenter, + child: Text( + "暂无商品参与活动", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + ) + : ListView.builder( + padding: EdgeInsets.zero, + itemCount: productList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: _scrollPhysics, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pushNamed( + '/router/shopping_goods_details', + arguments: { + "actProductId": productList[position].id, + "productId":productList[position].productId, + "type":pageType, + "storeId": storeId, + "tenant": tenant, + "limitNumber":actTemplate.limitNumber, + "limitTime":actTemplate.limitTime, + "bannerImg":actTemplate.bannerImg, + }, + ); + }); + }, + child: seckilItem(productList[position]), + ); + }, + ); + } + + int timeFlag(String time) { + if (time == null) return 0; + var now = DateTime.now().hour; + var tHour = int.tryParse(time.substring(0, 2)); + if (now < tHour) + return 0; + else if (now == tHour) + return 1; + else + return 2; + } + + Widget timeItem(TimeProductList actTimeList, index) { + var tStatus = timeFlag(actTimeList.actTime.startHour); + return Container( + margin: EdgeInsets.only(right: 12.w, top: 8.h, bottom: 8.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + actTimeList?.actTime?.startHour ?? "", + style: TextStyle( + fontSize: 17.sp, + fontWeight: MyFontWeight.semi_bold, + color: index == actTimeListIndex + ? Color(0xFFFC3127) + : Color(0xFF4D4D4D), + ), + ), + Expanded( + child: tStatus == 0 + ? Container( + alignment: Alignment.center, + width: 48.w, + height: 15.h, + decoration: BoxDecoration( + color: index == actTimeListIndex + ? Color(0xFFFB312B) + : Colors.transparent, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "即将开始", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: index == actTimeListIndex + ? Colors.white + : Color(0xFF4D4D4D), + ), + ), + ) + : (tStatus == 1 + ? Container( + alignment: Alignment.center, + width: 48.w, + height: 15.h, + decoration: BoxDecoration( + color: index == actTimeListIndex + ? Color(0xFFFB312B) + : Colors.transparent, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "马上抢", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: index == actTimeListIndex + ? Colors.white + : Color(0xFF4D4D4D), + ), + ), + ) + : Container( + alignment: Alignment.center, + width: 48.w, + height: 15.h, + decoration: BoxDecoration( + color: index == actTimeListIndex + ? Color(0xFFFB312B) + : Colors.transparent, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "已结束", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: index == actTimeListIndex + ? Colors.white + : Color(0xFF4D4D4D), + ), + ), + ))) + ], + ), + ); + } + + Widget seckilItem(ProductList productList) { + var tStatus = timeFlag(actTimeList[actTimeListIndex].actTime.startHour); + return Container( + // height:94.h, + margin: EdgeInsets.only(right: 12.w, top: 12.h, bottom: 12.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + productList.productImg, + width: 94, + height: 94, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + productList.productName, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Text( + "限量${productList.productStock}件", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + ), + if (pageType == "2") + Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(6.5), + child: Stack( + children: [ + Container( + width: 180.w, + height: 8.h, + color: Color(0xFFF5F5F5), + ), + Container( + width: productList.sellCount == 0 + ? 0 + : (((productList?.sellCount ?? 0) / + (productList?.productStock ?? + 0)) * + 180.w) + .toDouble(), + height: 8.h, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFDBA56), + Color(0xFFFB2B2B) + ])), + ) + ], + )), + SizedBox( + width: 5, + ), + Text( + "已售${productList.sellCount}件", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + if (pageType == "3") + Row( + children: [ + Container( + padding: EdgeInsets.only(left: 2, right: 2), + height: 22.h, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFFCD00), + ), + child: Text( + "最高可砍${(double.parse(productList?.productPrice ?? "0") - double.parse(productList?.promotionPrice ?? "0")).toStringAsFixed(2)}元", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + ), + Spacer(), + ], + ), + if (pageType == "1") + Container( + height: 22.h, + ), + Row( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: pageType == "3" + ? Color(0xFF9476F7) + : Color(0xFFFB2E2C), + ), + ), + TextSpan( + text: productList.promotionPrice, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: pageType == "3" + ? Color(0xFF9476F7) + : Color(0xFFFB2E2C), + ), + ), + ], + ), + ), + SizedBox(width:2.w,), + Expanded( + child: Text( + productList.productPrice, + style: TextStyle( + fontSize: 11.sp, + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + if (pageType == "2") + (seckillIndex == 0 + ? (tStatus == 0 + ? Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFE2F6EA), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "即将开始", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF52AF79), + ), + ), + ) + : (tStatus == 1 + ? Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "马上抢", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ) + : Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "已结束", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFADADAD), + ), + ), + ))) + : Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "马上抢", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + )), + if (pageType == "1") + Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFFB2E2C), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "立即开团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + if (pageType == "3") + Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "我要砍价", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ) + ], + ), + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/store/shopping/shopping_cart/shopping_cart_page.dart b/lib/store/shopping/shopping_cart/shopping_cart_page.dart new file mode 100644 index 00000000..b50a2d98 --- /dev/null +++ b/lib/store/shopping/shopping_cart/shopping_cart_page.dart @@ -0,0 +1,599 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.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/shoppingCart.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ShoppingCartPage extends StatefulWidget { + final String minToken; + final String storeId; + final String tenant; + final StoreInfo storeInfo; + + ShoppingCartPage(this.minToken, this.storeId, this.tenant, this.storeInfo); + + @override + State createState() { + return _ShoppingCartPage(); + } +} + +class _ShoppingCartPage extends State + with AutomaticKeepAliveClientMixin { + ApiService apiService; + MinApiService minService; + List shopCarGoods = []; + String pName; + String pid; + String cName; + String cid; + int tableId = 0; + bool topIndex = false; + bool isAllSelect = false; + int bIndex = 0; + + @override + void initState() { + super.initState(); + queryShopCar(); + } + + ///清空购物车 + clearShopCar() async { + shopCarGoods[0].shoppingCartSkuItemList.forEach((element) { + if (element.selected == 1) { + shopCartAdd(element, -element.buyNum, element.selected); + } + }); + queryShopCar(); + } + + ///去下单结算页面 + toDownOrder() async { + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": widget.storeInfo, + "tableId": tableId, + "pName": pName, + "pid": pid, + "cName": cName, + "cid": cid, + }, + ); + queryShopCar(); + } + + ///查询购物车商品 + queryShopCar() async { + if (widget.minToken == null) return; + if (minService == null) + minService = MinApiService( + Dio(), + context: context, + token: widget.minToken, + tenant: widget.tenant, + storeId: widget.storeId, + showLoading: false, + ); + BaseData> baseData = + await minService.getShoppingCart(tableId).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + shopCarGoods.clear(); + shopCarGoods.addAll(baseData.data); + refreshController.refreshCompleted(); + }); + } else { + refreshController.refreshFailed(); + } + } + + ///购物车数量修改 + shopCartAdd( + ShoppingCartSkuItemListBean cartSkuItem, int count, int selected) async { + Map shopCarTemp = shopCarGoods[0].toJson(); + cartSkuItem.buyNum += count; + cartSkuItem.selected = selected; + shopCarTemp["selected"] = selected; + shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; + BaseData baseDate = await minService.shoppingCartSingle(shopCarTemp); + if (baseDate.isSuccess) { + setState(() { + queryShopCar(); + }); + } + refreshController.refreshFailed(); + } + + final SwiperController controller = SwiperController(); + + @override + void dispose() { + super.dispose(); + if (refreshController != null) refreshController.dispose(); + } + + final RefreshController refreshController = RefreshController(); + + @override + Widget build(BuildContext context) { + super.build(context); + return Stack( + children: [ + Column( + children: [ + MyAppBar( + title: "购物车", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.transparent, + actions: [ + GestureDetector( + onTap: () { + setState(() { + topIndex = !topIndex; + }); + }, + child: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(right: 12.w), + padding: EdgeInsets.only(left:35,), + child: Text( + !topIndex ? "管理" : S.of(context).quxiao, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ), + ) + ], + ), + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + queryShopCar(); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: FutureBuilder( + // future: queryShopCar(), + builder: (context, snapshot) { + return Column( + children: [ + ///购物车商品列表 + cartGoodsList(), + ], + ); + }, + ), + ), + ), + ), + ), + ], + ), + Align( + alignment: Alignment(0.8, 0.8), + child: Container( + height: 70.h, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + color: Color(0xFFFAFAFA), + ), + padding: EdgeInsets.only(left: 16.w, right: 16.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + setState(() { + isAllSelect = !isAllSelect; + shopCarGoods[0] + .shoppingCartSkuItemList + .forEach((element) { + element.selected = isAllSelect ? 1 : 0; + shopCartAdd(element, 0, element.selected); + }); + }); + }, + child: Container( + height:70, + child: Image.asset( + isAllSelect + ? "assets/image/icon_radio_selected.webp" + : "assets/image/icon_radio_unselected.webp", + width: 16, + height: 16, + ),), + ), + SizedBox(width: 5.w), + Expanded( + child: Text( + "全选", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA29E9E), + ), + ), + ), + !topIndex + ? Row( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "合计:", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + TextSpan( + text: ((shopCarGoods?.length ?? 0) > 0) + ? (shopCarGoods[0]?.cartSum ?? "") + : "", + style: TextStyle( + fontSize: 20.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + GestureDetector( + onTap: () { + toDownOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 70.w, + height: 32.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "结算", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + ), + ], + ) + : GestureDetector( + onTap: () { + if(isAllItemUnSelected()) + return; + clearShopCar(); + }, + child: Container( + alignment: Alignment.center, + width: 70.w, + height: 32.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color:isAllItemUnSelected()?Color(0xFFE5E5E5):Color(0xFFFB312B), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "删除", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ); + } + + ///按钮选中/未选中 + bool isAllItemUnSelected(){ + bool unAllSelectedFlag = true; + bool allSelectedFlag = true; + if(shopCarGoods == null || shopCarGoods.length == 0){ + setState(() { + isAllSelect = false; + }); + return unAllSelectedFlag; + } + shopCarGoods[0] + .shoppingCartSkuItemList + .forEach((element) { + if(element.selected == 1) + unAllSelectedFlag = false; + else allSelectedFlag = false; + }); + setState(() { + isAllSelect = allSelectedFlag; + }); + return unAllSelectedFlag; + } + + Widget cartGoodsList() { + return (shopCarGoods == null || shopCarGoods.length == 0) + ? NoDataView( + src: "assets/image/shopping_k.webp", + isShowBtn: false, + text: "目前暂无商品,要快去买点好吃的哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 150.h), + ) + : Container( + margin: EdgeInsets.only(bottom: 50.h), + child: ListView.builder( + itemCount: ((shopCarGoods?.length ?? 0) > 0) + ? (shopCarGoods[0]?.shoppingCartSkuItemList?.length ?? 0) + : 0, + shrinkWrap: true, + padding: EdgeInsets.only( + top: 8.h, + bottom: 84.h, /* + (375.h - 88.h) + 4.h*/ + ), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + bIndex = position; + }, + child: cartGoodsItem(position), + ); + }), + ); + } + + Widget cartGoodsItem(index) { + return Container( + margin: EdgeInsets.all(16), + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + setState(() { + shopCarGoods[0].shoppingCartSkuItemList[index].selected = + (shopCarGoods[0].shoppingCartSkuItemList[index].selected == + 0) + ? 1 + : 0; + shopCartAdd(shopCarGoods[0].shoppingCartSkuItemList[index], 0, + shopCarGoods[0].shoppingCartSkuItemList[index].selected); + }); + }, + child:Container( + height: 60, + child:Image.asset( + (shopCarGoods[0].shoppingCartSkuItemList[index].selected == 1) + ? "assets/image/icon_radio_selected.webp" + : "assets/image/icon_radio_unselected.webp", + width: 16, + height: 16, + ),), + ), + SizedBox(width: 16.w), + MImage( + shopCarGoods[0].shoppingCartSkuItemList[index]?.skuImg ?? "", + isCircle: true, + width: 81, + height: 81, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox(width: 10.w), + Expanded( + child: Container( + height: 81.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + shopCarGoods[0] + .shoppingCartSkuItemList[index] + ?.productName ?? + "", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + // SizedBox(height: 5.h), + Text( + shopCarGoods[0].shoppingCartSkuItemList[index]?.skuName ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF727272), + ), + ), + // SizedBox(height: 5.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: shopCarGoods[0] + .shoppingCartSkuItemList[index] + ?.skuPrice ?? + "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + ], + ), + )), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() { + if (shopCarGoods[0] + .shoppingCartSkuItemList[index] + .buyNum > + 1) + shopCartAdd( + shopCarGoods[0] + .shoppingCartSkuItemList[index], + -1, + shopCarGoods[0] + .shoppingCartSkuItemList[index] + .selected); + }); + }, + child: Image.asset( + "assets/image/reduce.webp", + width: 22, + height: 22, + ), + ), + Container( + width: 30, + alignment: Alignment.center, + child: Text( + shopCarGoods[0] + .shoppingCartSkuItemList[index] + ?.buyNum + .toString() ?? + 0, + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + InkWell( + onTap: () { + setState(() { + shopCartAdd( + shopCarGoods[0] + .shoppingCartSkuItemList[index], + 1, + shopCarGoods[0] + .shoppingCartSkuItemList[index] + .selected); + }); + }, + child: Image.asset( + "assets/image/add.webp", + width: 22, + height: 22, + ), + ), + ], + ) + ], + ), + ], + )), + ), + ], + ), + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart new file mode 100644 index 00000000..5c4d4b88 --- /dev/null +++ b/lib/store/shopping/shopping_goods_details.dart @@ -0,0 +1,2310 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package: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/activity.dart'; +import 'package:huixiang/retrofit/data/activity_details.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/launch_join_act.dart'; +import 'package:huixiang/retrofit/data/miNiDetail.dart'; +import 'package:huixiang/retrofit/data/shoppingCart.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/settlement/settlement_model.dart'; +import 'package:huixiang/store/store_view/product_sku.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class ShoppingGoodsDetails extends StatefulWidget { + final Map arguments; + + ShoppingGoodsDetails({this.arguments}); + + @override + State createState() { + return _ShoppingGoodsDetails(); + } +} + +class _ShoppingGoodsDetails extends State { + final RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + ApiService apiService; + MinApiService minService; + String tenant; + String storeId; + String minToken; + String id; + StoreInfo storeInfo; + MiNiDetail miNiDetail; + bool dialogShowing = false; + String skuId1; + String skuPrice1; + String skuValue1; + int count1 = 0; + int tableId = 0; + String parentId = ""; + String parentCode = ""; + int numberOfPeople = 0; + List activitys; + ProductSkuVOListBean productSku; + String actProductId; + String productId; + String pageType = "1"; + ActivityDetails activityDetails; + int limitNumber = 0; + int limitTime = 0; + String bannerImg; + String pName; + String pid; + String cName; + String cid; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + int tempDay = 0; + int tempHour = 0; + int tempM = 0; + int tempS = 0; + BargainType bargainType = BargainType.BargainZBug; + String indexP; + JoinActivity joinA = JoinActivity.GoJoin; + + @override + void dispose() { + super.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + + @override + void initState() { + super.initState(); + storeId = widget.arguments["storeId"]; + tenant = widget.arguments["tenant"]; + id = widget.arguments["id"]; + pageType = widget.arguments["type"]; + actProductId = widget.arguments["actProductId"]; + limitNumber = widget.arguments["limitNumber"]; + limitTime = widget.arguments["limitTime"]; + bannerImg = widget.arguments["bannerImg"]; + productId = widget.arguments["productId"]; + if (pageType == "1") startCountdownTimer(); + debugPrint("store_param tenant:$tenant storeId:$storeId"); + + SharedPreferences.getInstance().then((value) { + minLogin(value); + queryStoreInfo(); + }); + } + + /// 小程序登录 + minLogin(SharedPreferences shared) async { + EasyLoading.show(status: S.of(context).zhengzaijiazai); + apiService = ApiService( + Dio(), + context: context, + token: shared.getString('token'), + showLoading: false, + ); + apiService.minLogin(storeId).catchError((onError) { + debugPrint(onError.toString()); + }).then((baseData) { + if (baseData != null && baseData.isSuccess) { + minToken = baseData.data["token"]; + queryStoreInfo(); + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + queryMemberInfo(); + if (pageType == null) { + queryMiNiDetail(id); + } else { + queryMiNiDetail(productId); + } + EasyLoading.dismiss(); + } + }); + } + + ///会员信息 + queryMemberInfo() async { + BaseData baseData = await minService.memberInfo().catchError((error) { + debugPrint(error); + }); + if (baseData != null && baseData.isSuccess) { + SharedPreferences.getInstance().then( + (value) => { + value.setString('minMember', jsonEncode(baseData.data)), + }, + ); + } + } + + /// 查询店铺信息 + queryStoreInfo() async { + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error.toString()); + }); + if (baseData != null && baseData.isSuccess) { + storeInfo = StoreInfo.fromJson(baseData.data); + activitys = storeInfo.informationVOPageVO.list + .map((e) => Activity.fromJson(e)) + .toList(); + if (mounted) { + setState(() {}); + } + } + EasyLoading.dismiss(); + } + + ///商品详情 + queryMiNiDetail(id) async { + if (minService == null) + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + BaseData baseData = + await minService.miNiDetail(id).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + miNiDetail = baseData.data; + if (pageType != null) queryViewProduct(actProductId, pageType); + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + + ///活动商品详情 + queryViewProduct(actProductId, pageType) async { + if (minService == null) + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + BaseData baseData = await minService + .viewProduct(actProductId, pageType) + .catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + activityDetails = baseData.data; + miNiDetail.productSkuVOList.forEach((element) { + var sku = activityDetails.actProduct.skuJson + .firstWhere((ele) => ele.skuId == element.id); + if (sku == null) { + miNiDetail.productSkuVOList.remove(sku); + } else { + element.skuPrice = sku.skuPrice.toString(); + element.skuStock = sku.skuStock.toInt(); + } + }); + goodsCountdownTimer(); + refreshController.refreshCompleted(); + }); + } else { + refreshController.refreshFailed(); + } + } + + ///选规格弹窗 + showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1) { + _addShopCar(miNiDetail, [], count); + } else { + EasyLoading.dismiss(); + dialogShowing = true; + SmartDialog.show( + widget: ProductSku( + miNiDetail, + null, + id, + _addShopCar, + add, + reduce, + buttonType: 1, + ), + onDismiss: () { + dialogShowing = false; + }, + alignmentTemp: Alignment.bottomCenter, + ); + } + } + + ///选规格添加购物车 + Future _addShopCar( + MiNiDetail miNiDetail, + selectSkus, + int count, + ) async { + if (selectSkus != null && selectSkus.length == 0) { + productSku = miNiDetail.productSkuVOList.first; + } else { + productSku = miNiDetail.productSkuVOList.firstWhere((element) { + bool gg = true; + selectSkus.forEach((element1) { + if (element.skuNameStr.indexOf(element1) < 0) { + gg = false; + return gg; + } + }); + return gg; + }); + } + if (productSku == null) return; + String skuId = productSku.id; + String skuValue = selectSkus + .toString() + .replaceAll("[", "") + .replaceAll("]", "") + .replaceAll(",", ""); + String skuPrice = productSku.skuPrice; + setState(() { + skuId1 = skuId; + skuValue1 = skuValue; + skuPrice1 = skuPrice; + count1 = count; + }); + } + + ///商品➕1 + add(MiNiDetail miNiDetail, selectSkus) async {} + + ///商品➖1 + reduce(MiNiDetail miNiDetail, selectSkus) async {} + + ///添加购物车按钮 + addShoppingCar() async { + BaseData> baseDate = await minService.addShoppingCart({ + "storeId": storeId, + "storeName": storeInfo?.storeName ?? "", + "numberOfPeople": numberOfPeople, + "tableId": tableId, + "parentId": parentId, + "parentCode": parentCode, + "shoppingCartSkuItemList": [ + { + "buyNum": count1, + "id": skuId1, + "productId": miNiDetail.id, + "productName": miNiDetail.productName, + "skuName": skuValue1, + "storeId": storeId, + "skuPrice": productSku.skuPrice, + "skuStock": productSku.skuStock, + "tableId": tableId, + }, + ], + }); + EasyLoading.dismiss(); + if (baseDate != null && baseDate.isSuccess) { + SmartDialog.showToast("添加购物车成功", alignment: Alignment.center); + } + } + + _onRefresh() { + if (pageType == null) { + queryMiNiDetail(id); + } else { + queryViewProduct(actProductId, pageType); + } + } + + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + if ((activityDetails?.actRecordAndJoinlDTOList) != null) + activityDetails.actRecordAndJoinlDTOList.forEach((element) { + var tempDateTime = DateTime.parse(element.actRecord.endTime) + .difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + element.actRecord.tempDay = 0; + element.actRecord.tempHour = 0; + element.actRecord.tempM = 0; + element.actRecord.tempS = 0; + return; + } + element.actRecord.tempDay = tempDateTime.inDays; + element.actRecord.tempHour = + tempDateTime.inHours - (tempDateTime.inDays * 24); + element.actRecord.tempM = + tempDateTime.inMinutes - (tempDateTime.inHours * 60); + element.actRecord.tempS = + tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + ///商品秒杀时间 + goodsCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + var tempDateTime = + DateTime.parse(activityDetails.endTime).difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + tempDay = 0; + tempHour = 0; + tempM = 0; + tempS = 0; + return; + } + tempDay = tempDateTime.inDays; + tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + ///去下单结算页面 + toDownOrder() async { + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "tableId": tableId, + "parentCode": parentCode, + "parentId": parentId, + "pName": pName, + "pid": pid, + "cName": cName, + "cid": cid, + "pageType": pageType, + "shoppingCartSkuItemList": [ + { + "buyNum": count1, + "id": skuId1, + "productId": miNiDetail.id, + "productName": miNiDetail.productName, + "skuName": skuValue1, + "storeId": storeId, + "skuPrice": productSku.skuPrice, + "skuStock": productSku.skuStock, + "tableId": tableId, + }, + ], + }, + ); + } + + ///普通商品直接购买去下单结算页面 + toGoods() async { + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "productId": miNiDetail.id, + "productSkuId": skuId1, + "buyNum": count1, + }, + ); + } + + ///直接购买去下单结算页面 + toOrder() async { + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "pageType": pageType, + "isDirectBuy": true, + "productId": (pageType != null) + ? activityDetails.actProduct.productId + : miNiDetail.id, + "skuId": skuId1, + "buyNum": count1, + "skuValue1": skuValue1, + "actProductId": actProductId, + "actProductSkuId": skuId1, + "activityDetails": activityDetails, + "bargainType": bargainType, + "skuPrice1": skuPrice1, + "joinA": joinA, + "indexP": indexP + }, + ).then((value) { + _onRefresh(); + setState(() {}); + }); + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + color: Color(0xFFF7F7F7), + child: Column( + children: [ + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + physics: BouncingScrollPhysics(), + scrollController: scrollController, + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + setState(() { + _onRefresh(); + }); + }, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildColumn(), + + ///拼团 + if (pageType == "1") groupOption(), + + ///拼团规则 + if (pageType == "1") groupRule(), + goodsOption(), + Padding( + padding: EdgeInsets.only(top: 16.h, bottom: 12.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 21, + height: 1.h, + color: Color(0xFF979797), + ), + Text( + "商品详情", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF585858), + ), + ), + Container( + width: 21, + height: 1.h, + color: Color(0xFF979797), + ), + ], + ), + ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 72.h), + child: Html( + data: pageType != null + ? (activityDetails?.actProduct?.detail ?? "") + : (miNiDetail?.detail ?? ""), + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ], + ), + ), + ), + ), + flex: 1, + ), + ], + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: 80.h, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + color: Color(0xFFFAFAFA), + ), + padding: EdgeInsets.only(left: 16.w, right: 16.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + Navigator.of(context) + .pushNamed('/router/shopping_mall_home', arguments: { + "type": 1, + "id": storeId, + "tenant": tenant + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/goods_cart.webp", + width: 24, + height: 24, + ), + Text( + "购物车", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + ], + ), + ), + GestureDetector( + onTap: () { + setState(() { + showCallMobile(); + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/goods_phone.webp", + width: 24, + height: 24, + ), + Text( + "联系平台", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + ], + ), + ), + payButton(), + ], + ), + ), + ), + ], + ); + } + + ///购买按钮 + Widget payButton() { + return Container( + child: Row( + children: [ + if (pageType == null) + Row( + children: [ + GestureDetector( + onTap: () { + if (productSku == null) + SmartDialog.showToast("请选择規格!", + alignment: Alignment.center); + addShoppingCar(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 37.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Text( + "加入购物车", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), + ), + ), + ), + ), + GestureDetector( + onTap: () { + toGoods(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 37.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "立即购买", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + )), + ], + ), + + ///秒杀按钮 + if (pageType == "2") + Row( + children: [ + GestureDetector( + onTap: () { + joinA = JoinActivity.MZBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: + activityDetails?.actProduct?.productPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded( + child: Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ), + GestureDetector( + onTap: () { + joinA = JoinActivity.MBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: activityDetails + ?.actProduct?.promotionPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Text( + "我要秒杀", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ], + ), + )), + ], + ), + + ///砍价 + if (pageType == "3") + Row( + children: [ + GestureDetector( + onTap: () { + bargainType = BargainType.BargainZBug; + joinA = JoinActivity.BargainZBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: + activityDetails?.actProduct?.productPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded( + child: Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ), + GestureDetector( + onTap: () { + bargainType = BargainType.BargainBug; + joinA = JoinActivity.BargainBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: activityDetails + ?.actProduct?.promotionPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Text( + "我要砍价", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ], + ), + )), + ], + ), + + ///拼团按钮 + if (pageType == "1") + Row( + children: [ + GestureDetector( + onTap: () { + joinA = JoinActivity.CollageZBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: + activityDetails?.actProduct?.productPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded( + child: Text( + "单人购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ), + GestureDetector( + onTap: () { + bargainType = BargainType.CollageBug; + joinA = JoinActivity.CollageBug; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: activityDetails + ?.actProduct?.promotionPrice ?? + "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded( + child: Text( + "我要开团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ], + ), + )), + ], + ), + ], + ), + ); + } + + ///商品top + Widget buildColumn() { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(8.h), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + child: Column( + children: [ + swiper(), + Container( + width: double.infinity, + alignment: Alignment.center, + height: 50.h, + padding: EdgeInsets.only(left: 16.w), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [Color(0xFF32A057), Color(0xFF61CE6B)])), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + TextSpan( + text: pageType == null + ? (miNiDetail?.price ?? "") + : (activityDetails?.actProduct?.promotionPrice ?? + ""), + style: TextStyle( + fontSize: 28.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + ], + ), + ), + SizedBox(width: 4.w), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + pageType == null + ? ("原价¥283.00") + : ("单买价 ${activityDetails?.actProduct?.productPrice ?? ""}"), + style: TextStyle( + fontWeight: MyFontWeight.regular, + decoration: TextDecoration.lineThrough, + decorationColor: Colors.white, + fontSize: 9.sp, + color: Colors.white, + ), + ), + pageType == null + ? Text( + "已售${miNiDetail?.sellCount ?? 0}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Colors.white, + ), + ) + : (pageType == "1" + ? Row( + children: [ + Container( + margin: EdgeInsets.only(right: 2), + padding: EdgeInsets.only(left: 2, right: 2), + height: 15.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFFFFFFFF), + ), + child: Text( + "${limitNumber ?? 0}人团", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), + ), + ), + Text( + "已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, + ), + ), + ], + ) + : (pageType == "3" + ? Row( + children: [ + Container( + margin: EdgeInsets.only(right: 2), + padding: + EdgeInsets.only(left: 2, right: 2), + height: 15.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFFFFFFFF), + ), + child: Text( + "最高可砍${(double.parse(activityDetails?.actProduct?.productPrice ?? "0") - double.parse(activityDetails?.actProduct?.promotionPrice ?? "0")).toStringAsFixed(2)}元", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), + ), + ), + Text( + "已砍${(activityDetails?.actProduct?.sellCount ?? 0)}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, + ), + ), + ], + ) + : Text( + "已秒${activityDetails?.actProduct?.sellCount ?? 0}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Colors.white, + ), + ))) + ], + )), + pageType != null + ? (pageType == "2" + ? Row( + children: [ + MImage( + activityDetails?.actProduct?.rightImg ?? "", + width: 72, + height: 30.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + Container( + width: 91, + height: 50, + color: Color(0xFFB1F6CD), + margin: EdgeInsets.only(left: 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "距离结束", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + SizedBox(height: 3), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempDay.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempHour.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempM.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempS.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ) + : Padding( + padding: EdgeInsets.only(right: 16), + child: MImage( + activityDetails?.actProduct?.rightImg ?? "", + width: 72, + height: 30.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + )) + : Container(), + ], + ), + ), + Container( + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + pageType == null + ? (miNiDetail?.productName ?? "") + : (activityDetails?.actProduct?.productName ?? ""), + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 15.sp, + color: Color(0xFF353535), + ), + ), + ), + Container( + margin: EdgeInsets.only(right: 8), + padding: EdgeInsets.only(left: 3, right: 3), + height: 17.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFF5A5A5A), + ), + child: Text( + pageType == null + ? (miNiDetail?.supplierName ?? "") + : (activityDetails?.actProduct?.supplierName ?? ""), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + ], + ), + SizedBox( + height: 8.h, + ), + Text( + pageType == null + ? (miNiDetail?.shortName ?? "") + : (activityDetails?.actProduct?.shortName ?? ""), + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 13.sp, + color: Color(0xFF585858), + ), + ), + ], + ), + ), + ], + ), + ); + } + + Widget swiper() { + return Container( + child: AspectRatio( + aspectRatio: 1.3698, + child: Stack( + children: [ + if ((miNiDetail?.imgs?.length ?? 0) > 0 || pageType != null) + pageType == null + ? Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + itemBuilder: (context, position) { + return miNiDetail == null + ? Container() + : Image.network( + miNiDetail.imgs.elementAt(position), + fit: BoxFit.cover, + ); + }, + itemCount: miNiDetail?.imgs?.length ?? 0, + ) + : Positioned( + child: MImage( + activityDetails?.actProduct?.productImg ?? "", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + margin: EdgeInsets.only(left: 16, top: 52), + padding: EdgeInsets.all(5), + child: Image.asset( + "assets/image/integral_return.webp", + // alignment: Alignment.center, + width: 24, + height: 24, + ), + ), + ), + ], + ), + ), + ); + } + + ///快递/規格/退款 + Widget goodsOption() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(8.h), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(top: 16.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "快递", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA2A2A2), + ), + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + "免邮费(吉林省、黑龙江省、西藏自治区、新疆维吾尔自治区、香港特别行政区除外)", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 32.w, top: 8.h, bottom: 8.h), + width: double.infinity, + height: 1.h, + color: Color(0xFFF1F1F1), + ), + GestureDetector( + onTap: () { + setState(() { + if (pageType == null) { + showStoreSelector(miNiDetail, id, 1); + } else { + showStoreSelector(miNiDetail, productId, 1); + } + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "规格", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA2A2A2), + ), + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + (skuValue1 ?? "请选择規格") + + (count1 > 0 ? "x${count1.toInt()}" : ""), + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + color: Colors.black, + size: 16.sp, + ), + ], + )), + Container( + margin: EdgeInsets.only(left: 32.w, top: 8.h, bottom: 8.h), + width: double.infinity, + height: 1.h, + color: Color(0xFFF1F1F1), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "退款", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA2A2A2), + ), + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + "如需退款请联系商家,待商家确认后,将进行退款。", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ), + ], + ), + ], + ), + ); + } + + ///拼团 + Widget groupOption() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(8.h), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(top: 16.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context) + .pushNamed('/router/group_page_details', arguments: { + "actRecordAndJoinlDTOList": + json.encode(activityDetails.actRecordAndJoinlDTOList), + }); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + "可参加的团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + ), + Text( + "更多", + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF585858), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 16, + color: Colors.black, + ), + ], + ), + ), + SizedBox(height: 12.h), + ListView.builder( + padding: EdgeInsets.zero, + itemCount: activityDetails?.actRecordAndJoinlDTOList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() {}); + }, + child: groupItem( + activityDetails.actRecordAndJoinlDTOList[position]), + ); + }, + ), + ], + ), + ); + } + + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) { + return Container( + margin: EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + MImage( + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberAvatar ?? "", + width: 30, + height: 30, + fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox(width: 4.w), + Expanded( + child: Text( + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberNickname ?? + "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + )), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "还差:", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + TextSpan( + text: (limitNumber - + (activityDetails.actRecordAndJoinlDTOList[0] + .actRecord.joinNum)) + .toString(), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "人", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + ), + Text( + "剩余${(actRecordAndJoinlDTOList?.actRecord?.tempDay != 0) ? actRecordAndJoinlDTOList.actRecord.tempDay : ""}:${actRecordAndJoinlDTOList?.actRecord?.tempHour ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempM ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempS ?? 0}", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + GestureDetector( + onTap: () { + joinA = JoinActivity.GoJoin; + indexP = actRecordAndJoinlDTOList.actRecord.id; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 53.w, + height: 22.h, + margin: EdgeInsets.only(left: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(13), + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFF61CE6B), + Color(0xFF32A057), + ]), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "去参团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ), + ], + ), + ); + } + + ///拼团规则 + Widget groupRule() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(8.h), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(top: 16.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "拼团规则", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 12.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/zu_tuan.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 51, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "开团/参团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "拼团享低价", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 43, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + ], + ), + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/zt_zf.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 51, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "成功支付", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "下单可开团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 43, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + ], + ), + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/yq_zt.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 51, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "邀请参团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "一起享优惠", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 43, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + ], + ), + Column( + children: [ + Image.asset( + "assets/image/zt_m.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + SizedBox(height: 8.h), + Text( + "人满成团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "人不满退款", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + ], + ), + ], + ), + ); + } + + ///联系电话 + showCallMobile() { + showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + title: Text(S.of(context).bodadianhua), + actions: [ + if (storeInfo != null && + storeInfo.tel != null && + storeInfo.tel != "") + CupertinoActionSheetAction( + child: Text(storeInfo.tel), + onPressed: () { + callMobile(storeInfo.tel); + Navigator.of(context).pop(); + }, + isDefaultAction: true, + isDestructiveAction: false, + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(S.of(context).quxiao), + isDestructiveAction: true, + ), + ); + }); + } + + callMobile(mobile) async { + String url = "tel:$mobile"; + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } + } +} diff --git a/lib/store/shopping/shopping_home/activity_banner.dart b/lib/store/shopping/shopping_home/activity_banner.dart new file mode 100644 index 00000000..0dba3317 --- /dev/null +++ b/lib/store/shopping/shopping_home/activity_banner.dart @@ -0,0 +1,174 @@ +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/shopping_home_config.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'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ActivityBanner extends StatefulWidget { + final List specialArea; + final String minToken; + final String storeId; + final String tenant; + + ActivityBanner(this.specialArea,this.minToken,this.storeId,this.tenant); + + @override + State createState() { + return _ActivityBanner(); + } +} + +class _ActivityBanner extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(bottom:10), + child: AspectRatio( + aspectRatio: 1.32, + child: Swiper( + viewportFraction: 0.9, + scale: 0.7, + 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 Column( + children: [ + InkWell( + onTap: () { + setState(() { + }); + }, + child: ClipRRect( + child:Image.network( + widget?.specialArea[position]?.img ?? "", + width: double.infinity, + height: 165.h, + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + bottomLeft: Radius.circular(0), + bottomRight: Radius.circular(0), + ), + ) + ), + Container( + height: 143, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical(bottom: Radius.circular(8)), + ), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 12), + itemCount:widget?.specialArea[position]?.productList?.length ?? 0, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/shopping_goods_details', + arguments: { + "id":widget.specialArea[position].productList[index].id, + "storeId":widget.storeId, + "tenant":widget.tenant, + }, + ); + }, + child: activityBannerItem(widget.specialArea[position].productList[index]), + ); + }, + ), + ), + ], + ); + }, + itemCount:widget?.specialArea?.length ?? 0, + ), + ), + ); + } + + Widget activityBannerItem(ProductList productList) { + return Container( + margin: EdgeInsets.only(right:7.w,left:7.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical(top: Radius.circular(8)), + ), + child: + MImage( + productList?.productImg ?? "", + isCircle: true, + width: 70, + height: 70, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + )), + SizedBox( + height: 4, + ), + Text( + productList?.productName ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text:productList?.price ?? "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/store/shopping/shopping_home/bargain_details.dart b/lib/store/shopping/shopping_home/bargain_details.dart new file mode 100644 index 00000000..c19695bf --- /dev/null +++ b/lib/store/shopping/shopping_home/bargain_details.dart @@ -0,0 +1,976 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/launch_join_act.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.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 BargainDetails extends StatefulWidget { + final Map arguments; + + BargainDetails({this.arguments}); + + @override + State createState() { + return _BargainDetails(); + } +} + +class _BargainDetails extends State { + MinApiService minService; + String actRecordId; + ActivityActRecordDetails activityActRecordDetails; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + int tempDay = 0; + int tempHour = 0; + int tempM = 0; + int tempS = 0; + final SwiperController controller = SwiperController(); + final RefreshController refreshController = RefreshController(); + int limitNumber = 0; + double bargainNum = 0; + StoreInfo storeInfo; + + @override + void dispose() { + super.dispose(); + if (refreshController != null) refreshController.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + + @override + void initState() { + super.initState(); + actRecordId = widget.arguments["actRecordId"]; + limitNumber = widget.arguments["limitNumber"]; + storeInfo = widget.arguments["storeInfo"]; + // skuId = widget.arguments["skuId"]; + startCountdownTimer(); + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + ); + queryShowOneAct(actRecordId); + }); + } + + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + var tempDateTime = + DateTime.parse(activityActRecordDetails?.actRecord?.endTime) + .difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + tempDay = 0; + tempHour = 0; + tempM = 0; + tempS = 0; + return; + } + tempDay = tempDateTime.inDays; + tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + ///查看某一个发起的拼团、砍价详情 + queryShowOneAct(actRecordId) async { + BaseData baseData = + await minService.showOneAct(actRecordId).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + bargainNum = 0; + activityActRecordDetails = baseData.data; + activityActRecordDetails.actRecordJoinList.forEach((element) { + bargainNum += double.tryParse(element.actPrice); + }); + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + } + + ///直接购买去下单结算页面 + toOrder() async { + await Navigator.of(context).popAndPushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "pageType": "3", + "isDirectBuy": true, + "productId": activityActRecordDetails.actProduct.productId, + "skuId": activityActRecordDetails.skuId, + "buyNum": 1, + "skuValue1": activityActRecordDetails.skuName, + "bargainOrderId": activityActRecordDetails.actRecordJoinList[0].orderId, + "actProductId": activityActRecordDetails.actProduct.id, + "actProductSkuId": activityActRecordDetails.skuId, + }, + ); + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + color: Color(0xFFF7F7F7), + ), + Stack( + children: [ + Container( + height: 330.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFFE8F5E9), + Color(0xFFE5F7FF), + ]), + ), + ), + Column( + children: [ + MyAppBar( + title: "砍价详情", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.transparent, + ), + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + queryShowOneAct(actRecordId); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: FutureBuilder( + // future: queryHome(), + builder: (context, snapshot) { + return Column( + children: [ + bargainGoodsInfo(), + bargainProgress(), + bargainRule(), + bargainFriendsList(), + ], + ); + }, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ], + ); + } + + ///商品信息b + Widget bargainGoodsInfo() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + activityActRecordDetails?.actProduct?.productImg ?? "", + width: 85, + height: 85, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 10, + ), + Expanded( + child: Container( + height: 85, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + activityActRecordDetails?.actProduct?.productName ?? "", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Text( + (activityActRecordDetails?.skuName ?? "x1"), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), + ), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF9476F7), + ), + ), + TextSpan( + text: activityActRecordDetails + ?.actProduct?.productPrice ?? + "", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF9476F7), + ), + ), + ], + ), + ), + ], + ), + )) + ], + ), + ); + } + + ///砍价进度 + Widget bargainProgress() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 10), + child: Stack( + alignment: Alignment.bottomLeft, + children: [ + Container( + alignment: Alignment.center, + width: 67, + height: 23.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Color(0xFF9476F7), + ), + child: Text( + ((activityActRecordDetails?.actRecord?.joinNum ?? 0) != + (activityActRecordDetails?.successNumber ?? 0)) + ? "已砍${bargainNum.toStringAsFixed(2)}" + : "砍价成功", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + Align( + alignment: Alignment.bottomLeft, + child: Container( + height: 8, + child: Icon( + Icons.arrow_drop_down, + color: Color(0xFF9476F7), + size: 18, + ), + ), + ), + ], + ), + ), + SizedBox(height: 10), + ClipRRect( + borderRadius: BorderRadius.circular(6.5), + child: Stack( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.8, + height: 8.h, + color: Color(0xFFF5F5F5), + ), + if (double.tryParse(activityActRecordDetails + ?.actProduct?.productPrice ?? + "0") > + 0 && + double.tryParse(activityActRecordDetails + ?.actProduct?.promotionPrice ?? + "0") > + 0) + Container( + width: (bargainNum / + (double.tryParse(activityActRecordDetails + ?.actProduct?.productPrice ?? + "0") - + double.tryParse(activityActRecordDetails + ?.actProduct?.promotionPrice ?? + "0"))) * + (MediaQuery.of(context).size.width * 0.8), + height: 8.h, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [Color(0xFFFEC401), Color(0xFF9274F7)])), + ) + ], + )), + SizedBox( + height: 3, + ), + Row( + children: [ + Expanded( + child: Text( + "原价¥${activityActRecordDetails?.actProduct?.productPrice ?? ""}", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + ), + ), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "最低价¥", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF9476F7), + ), + ), + TextSpan( + text: activityActRecordDetails + ?.actProduct?.promotionPrice ?? + "", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF9476F7), + ), + ), + ], + ), + ), + ], + ), + SizedBox(height: 16), + if ((activityActRecordDetails?.actRecord?.mid ?? "") != + (activityActRecordDetails?.actRecordJoinList != null + ? (activityActRecordDetails?.actRecordJoinList[0]?.mid ?? "") + : "")) + Row( + children: [ + Expanded( + child: GestureDetector( + child: Container( + alignment: Alignment.center, + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(27), + border: Border.all( + width: 1, + color: Color(0xFF9476F7), + style: BorderStyle.solid, + ), + ), + child: Text( + "我也要砍", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF9476F7), + ), + ), + ), + )), + if (activityActRecordDetails?.isBargain ?? false) + Expanded( + child: GestureDetector( + child: Container( + alignment: Alignment.center, + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.circular(27), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "帮他砍价", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + )), + ), + if (activityActRecordDetails?.isBargain ?? true) + Expanded( + child: GestureDetector( + child: Container( + alignment: Alignment.center, + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFFE5E5E5), + borderRadius: BorderRadius.circular(27), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "已帮TA砍价", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF858585), + ), + ), + )), + ), + ], + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) == + (activityActRecordDetails?.successNumber ?? 0) && + (activityActRecordDetails?.actRecord?.state ?? 0) != 3) + GestureDetector( + onTap: () { + toOrder(); + }, + child: Container( + alignment: Alignment.center, + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.circular(27), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "立即购买", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + )), + if ((activityActRecordDetails?.actRecord?.state ?? 0) == 3) + Text( + "恭喜您砍价成功", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) != + (activityActRecordDetails?.successNumber ?? 0)) + GestureDetector( + child: Container( + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(bottom: 28), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.circular(27)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset("assets/image/wx.webp", + width: 24, + height: 24, + fit: BoxFit.cover, + color: Colors.white), + SizedBox( + width: 8, + ), + Text( + "邀请微信好友帮忙砍价", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ) + ], + ))), + SizedBox(height: 11.h), + Text( + "剩余时间 ${((tempDay == 0) ? "" : (tempDay.toString() + ":")).toString()} ${tempHour.toString()} : ${tempM.toString()} : ${tempS.toString()}", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + ], + ), + ); + } + + ///砍价规则 + Widget bargainRule() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 3, + height: 3, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 4), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Text( + "砍价规则", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 10, left: 4), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 3, + height: 3, + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + ], + ), + SizedBox( + height: 12, + ), + Text( + "1.选择自己喜欢的商品,邀请好友砍价,每次砍价金额以页面显示为主,邀请的越多,砍价成功的几率越高。", + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 12.sp, + height: 1.5, + fontWeight: MyFontWeight.medium, + ), + ), + Text( + "2.砍价成功后,点击立即购买,将以最终价格进行结算。", + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 12.sp, + height: 1.5, + fontWeight: MyFontWeight.medium, + ), + ), + Text( + "3.砍价商品不享受平台活动,优惠券以及会员折扣。", + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 12.sp, + height: 1.5, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ); + } + + ///砍价好友榜 + Widget bargainFriendsList() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 3, + height: 3, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 4), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Text( + "好友砍价榜", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 10, left: 4), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 3, + height: 3, + decoration: BoxDecoration( + color: Color(0xFF9476F7), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + ], + ), + SizedBox( + height: 20, + ), + Container( + alignment: Alignment.center, + width: double.infinity, + child: ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.zero, + scrollDirection: Axis.vertical, + physics: BouncingScrollPhysics(), + itemCount: activityActRecordDetails?.actRecordJoinList != null + ? activityActRecordDetails.actRecordJoinList.length + : 0, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: bargainFriendsItem(activityActRecordDetails, position), + ); + }, + ), + // NoDataView( + // isShowBtn: false, + // text: "暂无好友帮忙砍价~", + // fontSize: 16.sp, + // margin: EdgeInsets.only(top: 120.h), + // ), + ), + SizedBox( + height: 20, + ), + ], + ), + ); + } + + Widget bargainFriendsItem( + ActivityActRecordDetails activityActRecordDetails, index) { + return Container( + height: 36.h, + margin: EdgeInsets.only(bottom: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + MImage( + activityActRecordDetails.actRecordJoinList[index]?.memberAvatar ?? + "", + width: 34, + height: 34, + fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox( + width: 4, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + activityActRecordDetails + .actRecordJoinList[index]?.memberNickname ?? + "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Text( + handleDate(activityActRecordDetails + .actRecordJoinList[index].createTime), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFACACAC), + ), + ), + ], + )), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "已砍", + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + TextSpan( + text: activityActRecordDetails + .actRecordJoinList[index]?.actPrice ?? + "0", + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF9476F7), + ), + ), + TextSpan( + text: "元", + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF9476F7), + ), + ), + ], + ), + ), + ], + )); + } + + static handleDate(String oldTime) { + String nowTime = new DateTime.now().toString().split('.')[0]; + + int nowyear = int.parse(nowTime.split(" ")[0].split('-')[0]); + int nowmonth = int.parse(nowTime.split(" ")[0].split('-')[1]); + int nowday = int.parse(nowTime.split(" ")[0].split('-')[2]); + int nowhour = int.parse(nowTime.split(" ")[1].split(':')[0]); + int nowmin = int.parse(nowTime.split(" ")[1].split(':')[1]); + + int oldyear = int.parse(oldTime.split(" ")[0].split('-')[0]); + int oldmonth = int.parse(oldTime.split(" ")[0].split('-')[1]); + int oldday = int.parse(oldTime.split(" ")[0].split('-')[2]); + int oldhour = int.parse(oldTime.split(" ")[1].split(':')[0]); + int oldmin = int.parse(oldTime.split(" ")[1].split(':')[1]); + + var now = new DateTime(nowyear, nowmonth, nowday, nowhour, nowmin); + var old = new DateTime(oldyear, oldmonth, oldday, oldhour, oldmin); + var difference = now.difference(old); + + if (difference.inDays > 1) { + return (difference.inDays).toString() + '天前'; + } else if (difference.inDays == 1) { + return '昨天'.toString(); + } else if (difference.inHours >= 1 && difference.inHours < 24) { + return (difference.inHours).toString() + '小时前'; + } else if (difference.inMinutes > 5 && difference.inMinutes < 60) { + return (difference.inMinutes).toString() + '分钟前'; + } else if (difference.inMinutes <= 5) { + return '刚刚'; + } + } +} diff --git a/lib/store/shopping/shopping_home/classify_list.dart b/lib/store/shopping/shopping_home/classify_list.dart new file mode 100644 index 00000000..b1012485 --- /dev/null +++ b/lib/store/shopping/shopping_home/classify_list.dart @@ -0,0 +1,102 @@ +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/shopping_home_config.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'; + +class ClassifyList extends StatefulWidget { + final List groupList; + final String minToken; + final String storeId; + final String tenant; + + ClassifyList(this.groupList,this.minToken,this.storeId,this.tenant); + + @override + State createState() { + return _ClassifyList(); + } +} + +class _ClassifyList extends State { + ApiService apiService; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + height: 110.h, + margin: EdgeInsets.only(top:12.h,left: 16.w,right: 16.w), + padding: EdgeInsets.only(bottom: 3.h, top: 16.h,), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + color: Colors.white, + ), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 14), + itemCount:widget?.groupList?.length ?? 0, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context) + .pushNamed('/router/search_page', + arguments: { + "minToken": widget.minToken, + "tenant": widget.tenant, + "storeId": widget.storeId, + "searchKey":widget.groupList[position].groupName, + }); + }, + child: classifyItem(widget.groupList[position]), + ); + }, + ), + ); + } + + Widget classifyItem(GroupList groupList) { + return Container( + height:110.h, + margin: EdgeInsets.only(right: 19.w), + child: Column( + children: [ + MImage( + groupList?.groupImg ?? "", + isCircle: true, + width: 48, + height: 48, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox(height: 4,), + Text( + groupList?.groupName ?? "", + style: TextStyle( + fontSize: 11.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF1A1A1A), + ), + ), + ], + ), + ); + } +} diff --git a/lib/store/shopping/shopping_home/group_details.dart b/lib/store/shopping/shopping_home/group_details.dart new file mode 100644 index 00000000..b467cad4 --- /dev/null +++ b/lib/store/shopping/shopping_home/group_details.dart @@ -0,0 +1,1009 @@ +import 'dart:async'; +import 'dart:core'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; +import 'package:huixiang/retrofit/data/activity_details.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/launch_join_act.dart'; +import 'package:huixiang/retrofit/data/miNiDetail.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.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 GroupDetails extends StatefulWidget { + final Map arguments; + + GroupDetails({this.arguments}); + + @override + State createState() { + return _GroupDetails(); + } +} + +class _GroupDetails extends State { + MinApiService minService; + String actRecordId; + ActivityActRecordDetails activityActRecordDetails; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + int tempDay = 0; + int tempHour = 0; + int tempM = 0; + int tempS = 0; + + @override + void dispose() { + super.dispose(); + if (refreshController != null) refreshController.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + + @override + void initState() { + super.initState(); + actRecordId = widget.arguments["actRecordId"]; + startCountdownTimer(); + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + ); + queryShowOneAct(actRecordId); + }); + } + + final SwiperController controller = SwiperController(); + + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + var tempDateTime = + DateTime.parse(activityActRecordDetails?.actRecord?.endTime) + .difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + tempDay = 0; + tempHour = 0; + tempM = 0; + tempS = 0; + return; + } + tempDay = tempDateTime.inDays; + tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + ///查看某一个发起的拼团、砍价详情 + queryShowOneAct(actRecordId) async { + BaseData baseData = + await minService.showOneAct(actRecordId).catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + activityActRecordDetails = baseData.data; + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + + final RefreshController refreshController = RefreshController(); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + color: Color(0xFFF7F7F7), + ), + Stack( + children: [ + Container( + height: 330.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFFE8F5E9), + Color(0xFFE5F7FF), + ]), + ), + ), + Column( + children: [ + MyAppBar( + title: "拼团详情", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.transparent, + ), + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + queryShowOneAct(actRecordId); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: FutureBuilder( + builder: (context, snapshot) { + return Column( + children: [ + inviteGroup(), + groupRule(), + ], + ); + }, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ], + ); + } + + ///邀请好友拼团 + Widget inviteGroup() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 3, + height: 3, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 4), + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Text( + "拼团剩余时间", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + Container( + width: 8, + height: 8, + margin: EdgeInsets.only(right: 10, left: 4), + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 5, + height: 5, + margin: EdgeInsets.only(right: 10), + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + Container( + width: 3, + height: 3, + decoration: BoxDecoration( + color: Color(0xFFB8BAC1), + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + ], + ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (tempDay != 0) + Row( + children: [ + InkWell( + onTap: () {}, + child: Container( + width: 27, + height: 28, + alignment: Alignment.center, + decoration: BoxDecoration( + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails + ?.actRecord?.joinNum ?? + 0) == + 0) || + tempDay == 0) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + borderRadius: BorderRadius.circular(4)), + child: Text( + tempDay.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Text( + ":", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + // color: Color(0xFFD2D2D2), + color: + (activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails + ?.successNumber ?? + 0 + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + ), + )), + ], + ), + InkWell( + onTap: () {}, + child: Container( + width: 27, + height: 28, + alignment: Alignment.center, + decoration: BoxDecoration( + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails?.successNumber ?? + 0) || + (tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0)) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + borderRadius: BorderRadius.circular(4)), + child: Text( + tempHour.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Text( + ":", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails?.successNumber ?? + 0) || + (tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0)) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + ), + )), + InkWell( + onTap: () {}, + child: Container( + width: 27, + height: 28, + alignment: Alignment.center, + decoration: BoxDecoration( + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails?.successNumber ?? + 0) || + (tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0)) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + borderRadius: BorderRadius.circular(4)), + child: Text( + tempM.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Text( + ":", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails?.successNumber ?? + 0) || + (tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0)) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + ), + )), + InkWell( + onTap: () {}, + child: Container( + width: 27, + height: 28, + alignment: Alignment.center, + decoration: BoxDecoration( + // color: Color(0xFFD2D2D2), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? + 0) == + activityActRecordDetails?.successNumber ?? + 0) || + (tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0)) + ? Color(0xFFD2D2D2) + : Color(0xFFF8961E), + borderRadius: BorderRadius.circular(4)), + child: Text( + tempS.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + ], + ), + SizedBox( + height: 24, + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) == + activityActRecordDetails?.successNumber ?? + 0) + Text( + "恭喜您拼团成功", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) < + (activityActRecordDetails?.successNumber ?? 0) && + tempDay != 0 && + tempHour != 0 && + tempM != 0 && + tempS != 0) + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "距离拼团成功还差", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + TextSpan( + text: ((activityActRecordDetails?.successNumber ?? 0) - + (activityActRecordDetails?.actRecord?.joinNum ?? 0)) + .toString(), + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFF8961E), + ), + ), + TextSpan( + text: "人", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ], + ), + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) != + (activityActRecordDetails?.successNumber ?? 0) && + tempDay == 0 && + tempHour == 0 && + tempM == 0 && + tempS == 0) + Text( + "很遗憾,拼团失败", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + SizedBox( + height: 32, + ), + Container( + alignment: Alignment.center, + width: double.infinity, + height: 80.h, + child: ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.zero, + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemCount: (activityActRecordDetails?.successNumber ?? 0), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: groupItem(position), + ); + }, + ), + ), + SizedBox( + height: 54.h, + ), + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) == + activityActRecordDetails?.successNumber ?? + 0) + InkWell( + onTap: () { + Navigator.of(context) + .pushNamed('/router/order_details', arguments: { + "id": activityActRecordDetails.actRecordJoinList[0].orderId + }); + }, + child: Container( + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(bottom: 28), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF00A359), + borderRadius: BorderRadius.circular(27)), + child: Text( + "查看拼团订单", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + )), + ), + if ((activityActRecordDetails?.actRecord?.state ?? 0) == 2) + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(bottom: 28), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF00A359), + borderRadius: BorderRadius.circular(27)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/wx.webp", + width: 24, + height: 24, + fit: BoxFit.cover, + ), + SizedBox( + width: 8, + ), + Text( + "邀请微信好友一起拼团", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ) + ], + )), + ), + if ((activityActRecordDetails?.actRecord?.state ?? 0) == 4) + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: double.infinity, + height: 54.h, + margin: EdgeInsets.only(bottom: 28), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF00A359), + borderRadius: BorderRadius.circular(27)), + child: Text( + "联系客服退款", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + )), + ), + ], + ), + ); + } + + Widget groupItem(position) { + return Container( + margin: EdgeInsets.only(right: 25), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (position < (activityActRecordDetails?.actRecord?.joinNum ?? 0)) + Stack( + children: [ + Container( + width: 70, + height: 70, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(60), + border: Border.all( + width: 1, + color: Color(0xFFF8961E), + // style: BorderStyle.solid, + ), + ), + child: MImage( + activityActRecordDetails + .actRecordJoinList[position]?.memberAvatar ?? + "", + width: 60, + height: 60, + fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + activityActRecordDetails.actRecordJoinList[position].isLeader + ? Align( + alignment: Alignment.bottomCenter, + child: Container( + width: 60.w, + child: Container( + width: 34.w, + height: 14.h, + alignment: Alignment.center, + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + color: Color(0xFFF8961E), + borderRadius: BorderRadius.circular(7)), + child: Text( + "团长", + style: TextStyle( + fontSize: 8.sp, + fontWeight: MyFontWeight.light, + color: Colors.white, + ), + )), + ), + ) + : Container(), + ], + ), + if (position >= (activityActRecordDetails?.actRecord?.joinNum ?? 0)) + Container( + width: 60, + height: 67, + margin: EdgeInsets.only(left: 20), + child: Image.asset( + "assets/image/pin_t.webp", + width: 60.w, + height: 60.h, + fit: BoxFit.cover, + ), + ), + ], + )); + } + + ///拼团规则 + Widget groupRule() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white), + margin: + EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h, bottom: 40.h), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "拼团规则", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 12.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/zu_tuan.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 45, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "开团/参团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "拼团享低价", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 35, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + ], + ), + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/zt_zf.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 45, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "成功支付", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "下单可开团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 35, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + ], + ), + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/yq_zt.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + Container( + width: 45, + child: Flex( + children: List.generate(8, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Color(0xFF32A060)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + children: [ + Text( + "邀请参团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "一起享优惠", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + Container( + width: 35, + child: Flex( + children: List.generate(0, (_) { + return SizedBox( + width: 3, + height: 1, + child: DecoratedBox( + decoration: + BoxDecoration(color: Colors.white), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + ], + ) + ], + ), + Column( + children: [ + Image.asset( + "assets/image/zt_m.webp", + width: 42, + height: 42, + fit: BoxFit.cover, + ), + SizedBox(height: 8.h), + Text( + "人满成团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + Text( + "人不满退款", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5F5F5F), + ), + ), + ], + ), + ], + ), + ], + )); + } +} diff --git a/lib/store/shopping/shopping_home/group_page_details.dart b/lib/store/shopping/shopping_home/group_page_details.dart new file mode 100644 index 00000000..706a8c0e --- /dev/null +++ b/lib/store/shopping/shopping_home/group_page_details.dart @@ -0,0 +1,286 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/activity_details.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/my_appbar.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class GroupPageDetails extends StatefulWidget { + final Map arguments; + + GroupPageDetails({this.arguments}); + + @override + State createState() { + return _GroupPageDetails(); + } +} + +class _GroupPageDetails extends State { + RefreshController refreshController = RefreshController(); + List actRecordAndJoinlDTOList = []; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + + @override + void dispose() { + super.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + + @override + void initState() { + super.initState(); + // _onRefresh(); + actRecordAndJoinlDTOList.addAll((json.decode( + widget.arguments["actRecordAndJoinlDTOList"]) as List) + .map( + (i) => ActRecordAndJoinlDTOList.fromJson(i as Map)) + .toList()); + startCountdownTimer(); + } + + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + actRecordAndJoinlDTOList.forEach((element) { + var tempDateTime = DateTime.parse(element.actRecord.endTime) + .difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + element.actRecord.tempDay = 0; + element.actRecord.tempHour = 0; + element.actRecord.tempM = 0; + element.actRecord.tempS = 0; + return; + } + element.actRecord.tempDay = tempDateTime.inDays; + element.actRecord.tempHour = + tempDateTime.inHours - (tempDateTime.inDays * 24); + element.actRecord.tempM = + tempDateTime.inMinutes - (tempDateTime.inHours * 60); + element.actRecord.tempS = + tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + _onRefresh() { + refreshController.refreshCompleted(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Column( + children: [ + MyAppBar( + title: "可参加的团", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.transparent, + ), + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + _onRefresh(); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: FutureBuilder( + // future: queryHome(), + builder: (context, snapshot) { + return Column( + children: [ + groupList(), + ], + ); + }, + ), + ), + ), + ), + ), + ], + ), + ); + } + + ///参团列表 + Widget groupList() { + return Container( + height: MediaQuery.of(context).size.height - + 62.h - + MediaQuery.of(context).padding.top, + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: (actRecordAndJoinlDTOList == null || actRecordAndJoinlDTOList?.length == 0) + ? NoDataView( + src:"assets/image/ding_dan.webp", + isShowBtn: false, + text:"目前暂无参团列表,可下单发起拼团哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), + ):ListView.builder( + padding: EdgeInsets.zero, + itemCount: actRecordAndJoinlDTOList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() {}); + }, + child: groupItem(actRecordAndJoinlDTOList[position]), + ); + }, + ), + ); + } + + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) { + return Container( + height: 44.h, + margin: EdgeInsets.only(top: 8.h, bottom: 8.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + MImage( + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberAvatar ?? + "", + width: 44, + height: 44, + fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + SizedBox(width: 4.w), + Expanded( + child: Text( + actRecordAndJoinlDTOList + ?.actRecordJoinList[0]?.memberNickname ?? + "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + )), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "还差:", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + TextSpan( + text: + actRecordAndJoinlDTOList.actRecord.joinNum.toString(), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "人", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + ), + Text( + "剩余${(actRecordAndJoinlDTOList.actRecord.tempDay != 0) ? actRecordAndJoinlDTOList.actRecord.tempDay : ""}:${actRecordAndJoinlDTOList?.actRecord?.tempHour ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempM ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempS ?? 0}", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + ], + ), + GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/group_details', + arguments: { + "actRecordId": actRecordAndJoinlDTOList + .actRecordJoinList[0].actRecordId, + }); + }, + child: Container( + alignment: Alignment.center, + width: 53.w, + height: 22.h, + margin: EdgeInsets.only(left: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(13), + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFF61CE6B), + Color(0xFF32A057), + ]), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "去参团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/store/shopping/shopping_home/recommend_goods_list_view.dart b/lib/store/shopping/shopping_home/recommend_goods_list_view.dart new file mode 100644 index 00000000..9d294085 --- /dev/null +++ b/lib/store/shopping/shopping_home/recommend_goods_list_view.dart @@ -0,0 +1,231 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/home_recommend_list.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; + +class RecommendGoodsListView extends StatefulWidget { + final List homeRecommendList; + final String storeId; + final String tenant; + + + RecommendGoodsListView(this.homeRecommendList,this.storeId,this.tenant); + + @override + State createState() { + return _RecommendGoodsListView(); + } +} + +class _RecommendGoodsListView extends State { + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Text( + "为你推荐", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A), + ), + ), + Container( + margin: EdgeInsets.only(top:5.h), + color: Color(0xFF32A060), + width: 35.w, + height: 5.h, + ), + GridView.builder( + itemCount:widget.homeRecommendList == null ? 0 : widget.homeRecommendList.length, + padding: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 13.h, + bottom: 16.h, + ), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 2, + //水平子Widget之间间距 + crossAxisSpacing: 11.w, + //垂直子Widget之间间距 + mainAxisSpacing: 16.w, + //子Widget宽高比例 0.59 + childAspectRatio: + 185 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/shopping_goods_details', + arguments: { + "id":widget.homeRecommendList[index].id, + "storeId":widget.storeId, + "tenant":widget.tenant, + }, + ); + }, + child: goodsListItem(widget.homeRecommendList[index]), + ); + }, + ) + ], + ); + } + + Widget goodsListItem(HomeRecommendList homeRecommendList) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white, + ), + margin: EdgeInsets.symmetric( + vertical: 3, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), + child: + MImage( + homeRecommendList.imgs[0], + width: double.infinity, + height: 166, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 12.w, right: 12.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + margin: EdgeInsets.only(top: 8, right: 8), + padding: EdgeInsets.only(left: 2, right: 2), + height: 18.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFF5A5A5A), + ), + child: Text( + AppUtils.textSubStr(homeRecommendList?.supplierName ?? "",8), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + Text( + "已售${homeRecommendList?.sellCount ?? 0}件", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5D5D5D), + ), + ), + ], + ), + Text( + homeRecommendList?.productName ?? "", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text:homeRecommendList?.price ??"", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Text( + "¥283.00", + style: TextStyle( + fontSize: 14.sp, + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFF585858), + fontWeight: MyFontWeight.regular, + color: Color(0xFFA2A2A2), + ), + ), + ], + ), + ], + ), + ), + ) + ], + ), + ); + } + +} diff --git a/lib/store/shopping/shopping_home/search_page.dart b/lib/store/shopping/shopping_home/search_page.dart new file mode 100644 index 00000000..ee067d04 --- /dev/null +++ b/lib/store/shopping/shopping_home/search_page.dart @@ -0,0 +1,865 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:huixiang/view_widget/round_button.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class SearchPage extends StatefulWidget { + final Map arguments; + + SearchPage({this.arguments}); + + @override + State createState() { + return _SearchPage(); + } +} + +class _SearchPage extends State + with AutomaticKeepAliveClientMixin, WidgetsBindingObserver { + ApiService apiService; + MinApiService minService; + final TextEditingController editingController = TextEditingController(); + final RefreshController refreshController = RefreshController(); + int optionIndex = 0; + bool isKeyBoardShow = false; + List productListBeans = []; + List hotSearch = []; + List historySearch = []; + FocusNode _focusNode = FocusNode(); + bool hasFocus = true; + int priceOrder = 0; + + @override + void didChangeMetrics() { + super.didChangeMetrics(); + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() { + print("object: ${MediaQuery.of(context).viewInsets.bottom}"); + if (MediaQuery.of(context).viewInsets.bottom == 0) { + if (isKeyBoardShow) { + isKeyBoardShow = false; + //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 + FocusScope.of(context).requestFocus(FocusNode()); + } + } else { + isKeyBoardShow = true; + } + }); + }); + } + + ///离开页面记着销毁和清除 + @override + void dispose() { + _focusNode.unfocus(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + setState(() { + if (widget.arguments["hotSearch"] != null) + hotSearch.addAll(widget.arguments["hotSearch"]); + }); + _focusNode.addListener(() { + setState(() { + hasFocus = _focusNode.hasFocus; + }); + }); + if (widget.arguments["searchKey"] != null) { + setState(() { + editingController.text = widget.arguments["searchKey"]; + }); + appletGoods(widget.arguments["searchKey"]); + } + getHistorySearch(); + } + + ///获取保存列表 + getHistorySearch() async { + SharedPreferences value = await SharedPreferences.getInstance(); + var str = value.getString("historySearch"); + if (str == null) return; + var strArr = str.split("&"); + strArr.removeAt(strArr.length - 1); + setState(() { + historySearch.clear(); + historySearch.addAll(strArr.reversed); + }); + } + + ///保存列表 + setHistorySearch(String text) async { + if (text == null || text.trim() == "") return; + SharedPreferences value = await SharedPreferences.getInstance(); + var str = value.getString("historySearch"); + if (str == null) str = ""; + var strArr = str.split("&"); + if (strArr.length > 60) { + str = strArr.getRange(0, 59).join("&"); + } else { + str = strArr.join("&"); + } + str += text + "&"; + value.setString("historySearch", str); + getHistorySearch(); + } + + ///删除历史列表 + delHistorySearch() async { + SharedPreferences value = await SharedPreferences.getInstance(); + value.setString("historySearch", ""); + getHistorySearch(); + } + + ///小程序查询分组及商品列表 + appletGoods(String text) async { + if (editingController.text.trim() == "") { + return; + } + if (minService == null) + minService = MinApiService( + Dio(), + context: context, + token: widget.arguments["minToken"], + tenant: widget.arguments["tenant"], + storeId: widget.arguments["storeId"], + ); + + BaseData> baseData = await minService + .findMiNiGroupList({ + "id": widget.arguments["storeId"], + "searchKey": text, + "sortType": optionIndex == 0 + ? "" + : (optionIndex == 1) + ? productListBeans[0].sellCount + : productListBeans[0].price, + "asc": optionIndex == 0 + ? "" + : (priceOrder == 2) + ? true + : "" + }) + .catchError((error) {}) + .catchError((error) { + refreshController.refreshFailed(); + }); + + if (baseData != null && baseData.isSuccess) { + refreshController.refreshCompleted(); + setState(() { + productListBeans.clear(); + if (baseData.data.length > 0) + productListBeans.addAll(baseData.data[0].productList); + }); + } else { + refreshController.refreshFailed(); + } + + setHistorySearch(text); + setState(() { + hasFocus = false; + FocusScope.of(context).requestFocus(FocusNode()); + }); + } + + _onRefresh() { + appletGoods(editingController.text); + refreshController.refreshCompleted(); + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.transparent, + ), + color: Colors.transparent, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), + ), + ), + Stack( + children: [ + Container( + // padding: EdgeInsets.only(top: 40.h), + height: 140.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFFE8F5E9), + Color(0xFFE5F7FF), + ]), + ), + ), + Column( + children: [ + Container( + height: 100.h, + color: Colors.transparent, + margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 15.h), + child: Row( + children: [ + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Icon( + Icons.arrow_back_ios, + size: 24, + color: Colors.black, + ), + ), + Expanded( + child: Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: TextField( + focusNode: _focusNode, + textInputAction: TextInputAction.search, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF292929), + ), + onEditingComplete: () { + // startLocation(); + }, + controller: editingController, + // cursorHeight: 30.h, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 12.h, + ), + prefixIcon: Icon( + Icons.search, + size: 24, + color: Colors.black, + ), + suffixIcon: InkWell( + onTap: () { + editingController.clear(); + }, + child: Icon( + Icons.close, + size: 19, + color: Colors.grey, + ), + ), + border: InputBorder.none, + ), + ), + )), + Container( + alignment: Alignment.center, + child: GestureDetector( + onTap: () { + setState(() { + if (editingController.text.trim() == "") { + SmartDialog.showToast("请输入搜索内容", + alignment: Alignment.center); + return; + } + appletGoods(editingController.text); + }); + }, + child: Text( + "搜索", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ), + ), + ], + )), + Expanded( + child: Container( + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.white, + ), + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + padding: + EdgeInsets.only(left: 17.w, top: 16.h, right: 17.w), + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + setState(() { + _onRefresh(); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: FutureBuilder( + builder: (context, snapshot) { + return Column( + children: [ + if (hasFocus) hotSearchWords(), + if (hasFocus) historySearchWords(), + if (!hasFocus) searchList() + ], + ); + }, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ], + ); + } + + ///热门搜索 + Widget hotSearchWords() { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "热门搜索", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + SizedBox(height: 16.h), + GridView.builder( + itemCount: hotSearch?.length ?? 0, + shrinkWrap: true, + padding: EdgeInsets.zero, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 4, + //水平子Widget之间间距 + crossAxisSpacing: 6.w, + //垂直子Widget之间间距 + mainAxisSpacing: 12.w, + //垂直单个子Widget之间间距 + childAspectRatio: 3 / 1, + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + setState(() { + if (hotSearch[index] != null) { + editingController.text = hotSearch[index]; + appletGoods(hotSearch[index]); + } + }); + }, + child: hotSearchItem(hotSearch[index]), + ); + }, + ), + ], + ), + ); + } + + Widget hotSearchItem(String hotSearch) { + return Container( + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RoundButton( + padding: EdgeInsets.only(left: 4, right: 4), + height: 29.h, + text: hotSearch, + textColor: Color(0xFF181818), + fontWeight: MyFontWeight.regular, + radius: 4, + backgroup: Color(0xFFF5F5F5), + fontSize: 12.sp, + ), + ], + ), + ); + } + + ///历史搜索 + Widget historySearchWords() { + return Container( + // width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + "历史搜索", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + )), + Image.asset( + "assets/image/icon_delete.webp", + width: 22.w, + height: 20.h, + ), + GestureDetector( + onTap: () { + setState(() { + delHistorySearch(); + }); + }, + child: Text( + "删除", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF181818), + ), + ), + ) + ], + ), + SizedBox(height: 16.h), + GridView.builder( + itemCount: historySearch?.length ?? 0, + shrinkWrap: true, + padding: EdgeInsets.zero, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 4, + //水平子Widget之间间距 + crossAxisSpacing: 6.w, + //垂直子Widget之间间距 + mainAxisSpacing: 12.w, + //垂直单个子Widget之间间距 + childAspectRatio: 3 / 1, + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + setState(() { + if (historySearch[index] != null) { + editingController.text = historySearch[index]; + appletGoods(historySearch[index]); + } + }); + }, + child: historySearchItem(historySearch[index]), + ); + }, + ), + ], + ), + ); + } + + Widget historySearchItem(String historySearch) { + return Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + padding: EdgeInsets.only(left: 4, right: 4), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Color(0xFFF5F5F5)), + child: Text( + historySearch, + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF181818), + ), + ), + ), + ) + ], + ), + ); + } + + ///搜索列表 + Widget searchList() { + return Container( + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: () { + setState(() { + optionIndex = 0; + appletGoods(widget.arguments["searchKey"]); + }); + }, + child: Text( + "默认推荐", + style: TextStyle( + fontSize: optionIndex == 0 ? 15.sp : 14.sp, + fontWeight: optionIndex == 0 + ? MyFontWeight.semi_bold + : MyFontWeight.regular, + color: optionIndex == 0 + ? Color(0xFF181818) + : Color(0xFF4D4D4D), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + optionIndex = 1; + appletGoods(widget.arguments["searchKey"]); + }); + }, + child: Text( + "销量", + style: TextStyle( + fontSize: optionIndex == 1 ? 15.sp : 14.sp, + fontWeight: optionIndex == 1 + ? MyFontWeight.semi_bold + : MyFontWeight.regular, + color: optionIndex == 1 + ? Color(0xFF181818) + : Color(0xFF4D4D4D), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + optionIndex = 2; + // priceOrder = 1; + // appletGoods(widget.arguments["searchKey"]); + }); + }, + child: Row( + children: [ + Text( + "价格", + style: TextStyle( + fontSize: optionIndex == 2 ? 15.sp : 14.sp, + fontWeight: optionIndex == 2 + ? MyFontWeight.semi_bold + : MyFontWeight.regular, + color: optionIndex == 2 + ? Color(0xFF181818) + : Color(0xFF4D4D4D), + ), + ), + Column( + children: [ + GestureDetector( + onTap: () { + priceOrder = 1; + appletGoods(widget.arguments["searchKey"]); + }, + child: Icon( + Icons.arrow_drop_up, + color: (optionIndex == 2 && priceOrder == 1) + ? Color(0xFF33A061) + : Color(0xFF4D4D4D), + size: 16, + ), + ), + GestureDetector( + onTap: () { + priceOrder = 2; + appletGoods(widget.arguments["searchKey"]); + }, + child: Icon( + Icons.arrow_drop_down, + color: (optionIndex == 2 && priceOrder == 2) + ? Color(0xFF33A061) + : Color(0xFF4D4D4D), + size: 16, + ), + ) + ], + ) + // Image.asset( + // "assets/image/jg.png", + // width: 16, + // height: 16, + // ), + ], + ), + ), + // GestureDetector( + // onTap: () { + // setState(() { + // optionIndex = 3; + // }); + // }, + // child: Text( + // "专区", + // style: TextStyle( + // fontSize: optionIndex == 3 ? 15.sp : 14.sp, + // fontWeight: optionIndex == 3 + // ? MyFontWeight.semi_bold + // : MyFontWeight.regular, + // color: optionIndex == 3 + // ? Color(0xFF181818) + // : Color(0xFF4D4D4D), + // ), + // ), + // ), + ], + ), + SizedBox(height: 16.h), + (productListBeans == null || productListBeans?.length == 0) + ? NoDataView( + src: "assets/image/ding_dan.webp", + isShowBtn: false, + text: "该关键词未搜索到相关商品~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), + ) + : GridView.builder( + itemCount: productListBeans?.length ?? 0, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 2, + //水平子Widget之间间距 + crossAxisSpacing: 11.w, + //垂直子Widget之间间距 + mainAxisSpacing: 16.w, + //子Widget宽高比例 0.59 + childAspectRatio: 185 / + (281 / 2 + (281 / 2) * AppUtils.textScale(context)), + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/shopping_goods_details', + arguments: { + "id": productListBeans[index].id, + "storeId": widget.arguments["storeId"], + "tenant": widget.arguments["tenant"], + }, + ); + }, + child: searchListItem(productListBeans[index]), + ); + }, + ) + ], + ), + ); + } + + Widget searchListItem(ProductListBean productListBeans) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white, + ), + margin: EdgeInsets.symmetric( + vertical: 3, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), + child: MImage( + productListBeans?.imgPath ?? "", + width: double.infinity, + height: 166, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.w, right: 8.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + margin: EdgeInsets.only(top: 8, right: 8), + padding: EdgeInsets.only(left: 2, right: 2), + height: 18.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFF5A5A5A), + ), + child: Text( + AppUtils.textSubStr( productListBeans.supplierName ?? "",8), + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ), + Text( + "已售${productListBeans?.sellCount ?? 0}件", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF5D5D5D), + ), + ), + ], + ), + Text( + productListBeans?.productName ?? "", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: productListBeans?.price ?? "", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Text( + "¥283.00", + style: TextStyle( + fontSize: 14.sp, + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFF585858), + fontWeight: MyFontWeight.regular, + color: Color(0xFFA2A2A2), + ), + ), + ], + ), + ], + ), + ), + ) + ], + ), + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/store/shopping/shopping_home/shopping_acticvity.dart b/lib/store/shopping/shopping_home/shopping_acticvity.dart new file mode 100644 index 00000000..54ee3326 --- /dev/null +++ b/lib/store/shopping/shopping_home/shopping_acticvity.dart @@ -0,0 +1,375 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/activity.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/data/shopping_home_config.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/item_title.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ShoppingActivity extends StatefulWidget { + final String storeId; + final String tenant; + final List quickEntry; + + ShoppingActivity(this.storeId,this.tenant,this.quickEntry); + @override + State createState() { + return _ShoppingActivity(); + } +} + +class _ShoppingActivity extends State { + ApiService apiService; + + @override + void initState() { + super.initState(); + } + + ///url跳转 + jumpActivity(String url) { + var router = url.substring(0,url.contains("?")?url.indexOf("?") : (url.length - 1)); + Map argumentsMap = Map(); + argumentsMap["storeId"] =widget.storeId; + argumentsMap["tenant"] =widget.tenant; + if(url.contains("?")){ + var data = url.substring(url.indexOf("?") + 1); + var dataArr = data.split("&"); + dataArr.forEach((element) { + if(element.contains("=")){ + var tempData = element.split("="); + if(tempData.length == 2){ + argumentsMap[tempData[0]] = tempData[1]; + } + } + }); + } + Navigator.of(context).pushNamed(router, + arguments:argumentsMap); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox( + height: 10.h, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 9.w), + child: Row( + children: [ + GestureDetector( + onTap: () { + jumpActivity(widget?.quickEntry[0].url); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 5.w ), + // padding: EdgeInsets.only(left: 12.w), + width: (MediaQuery.of(context).size.width - 42) / 2, + height: 195.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white, + ), + child: MImage( + widget?.quickEntry[0]?.img ?? "", + width:double.infinity, + fit: BoxFit.contain, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + // Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "回乡秒杀", + // style: TextStyle( + // fontSize: 15.sp, + // fontWeight: MyFontWeight.medium, + // color: Colors.black, + // ), + // ), + // Text( + // "超多好物,等你来秒", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF7B7B7B), + // ), + // ), + // GestureDetector( + // onTap: (){ + // }, + // child: Container( + // height:20.h, + // width: 60.w, + // decoration: BoxDecoration( + // color: Color(0xFF32A060), + // borderRadius: BorderRadius.circular(11.5), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ), + // ], + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // "10点场", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.white, + // ), + // ), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Colors.white, + // ), + // ], + // ), + // ), + // ), + // Padding(padding: EdgeInsets.only(bottom: 10.h),child: + // Image.asset( + // "assets/image/icon_story_td.png", + // width: 87, + // height: 87, + // fit: BoxFit.cover, + // ),) + // ], + // ), + ), + ), + Expanded( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + jumpActivity(widget?.quickEntry[1].url); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 5.w), + // padding: EdgeInsets.only(left: 12.w,right: 11.w), + width: (MediaQuery.of(context).size.width - 42) / 2, + height: 195.h / 2, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white, + ), + child: MImage( + widget?.quickEntry[1]?.img ?? "", + width:double.infinity, + fit: BoxFit.contain, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Expanded(child: + // Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "好价我砍", + // style: TextStyle( + // fontSize: 15.sp, + // fontWeight: MyFontWeight.medium, + // color: Colors.black, + // ), + // ), + // Text( + // "拉友同优", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF7B7B7B), + // ), + // ), + // GestureDetector( + // onTap: (){ + // }, + // child: Container( + // height: 18.h, + // width: 48.w, + // decoration: BoxDecoration( + // color: Color(0xFF32A060), + // borderRadius: BorderRadius.circular(11.5), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ), + // ], + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // "GO", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.white, + // ), + // ), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Colors.white, + // ), + // ], + // ), + // ), + // ), + // ], + // ), + // ), + // Padding(padding: EdgeInsets.only(bottom: 10.h),child: + // Image.asset( + // "assets/image/icon_story_td.png", + // width: 44, + // height: 44, + // fit: BoxFit.cover, + // ),) + // ], + // ), + ), + ), + SizedBox( + height: 5, + ), + GestureDetector( + onTap: () { + jumpActivity(widget?.quickEntry[2].url); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 5.w), + // padding: EdgeInsets.only(left: 12.w,right: 11.w), + width: (MediaQuery.of(context).size.width - 42) / 2, + height: 195.h / 2, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white, + ), + child:MImage( + widget?.quickEntry[2]?.img ?? "", + width:double.infinity, + fit: BoxFit.contain, + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Expanded(child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // "拼团专场", + // style: TextStyle( + // fontSize: 15.sp, + // fontWeight: MyFontWeight.medium, + // color: Colors.black, + // ), + // ), + // Text( + // "优惠齐享", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF7B7B7B), + // ), + // ), + // GestureDetector( + // onTap: (){ + // }, + // child: Container( + // height: 18.h, + // width: 48.w, + // decoration: BoxDecoration( + // color: Color(0xFF32A060), + // borderRadius: BorderRadius.circular(11.5), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ), + // ], + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // "GO", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.white, + // ), + // ), + // Icon( + // Icons.keyboard_arrow_right, + // size: 16, + // color: Colors.white, + // ), + // ], + // ), + // ), + // ), + // ], + // ),), + // Padding(padding: EdgeInsets.only(bottom: 10.h),child: + // Image.asset( + // "assets/image/icon_story_td.png", + // width: 44, + // height: 44, + // fit: BoxFit.cover, + // ),) + // ], + // ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + SizedBox( + height: 28.h, + ), + ], + ); + } + +} diff --git a/lib/store/shopping/shopping_home/shopping_home_banner.dart b/lib/store/shopping/shopping_home/shopping_home_banner.dart new file mode 100644 index 00000000..c544541b --- /dev/null +++ b/lib/store/shopping/shopping_home/shopping_home_banner.dart @@ -0,0 +1,120 @@ + +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 ShoppingHomeBanner extends StatefulWidget { + + final List bannerData; + final SwiperController controller; + + ShoppingHomeBanner(this.bannerData,this.controller); + + @override + State createState() { + return _ShoppingHomeBanner(); + } + +} + +class _ShoppingHomeBanner extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + List bannerData = []; + + + @override + Widget build(BuildContext context) { + return Container( + child: AspectRatio( + aspectRatio: 2.08, + child: Swiper( + viewportFraction: 0.88, + scale: 0.93, + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + bannerClick(widget.bannerData[position]); + }, + child: MImage( + (widget.bannerData != null && position < widget.bannerData.length) + ? widget.bannerData[position].imgUrl + : "", + fit: BoxFit.cover, + radius: BorderRadius.circular(8), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + ); + }, + itemCount: (widget.bannerData != null && widget.bannerData.length > 0) + ? widget.bannerData.length + : 1), + ), + ); + } + + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) + bannerClick(BannerData bannerData) async { + switch (bannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": bannerData.content}); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "activityId": bannerData.content, + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "articleId": bannerData.content, + }); + break; + case 4: + String router = bannerData.content; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?")); + params = params.replaceAll("?", ""); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed(router, arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context) + .pushNamed('/router/class_details', arguments: { + "id": bannerData.content, + }); + break; + } + } +} + + + + + + + diff --git a/lib/store/shopping/shopping_home/shopping_home_page.dart b/lib/store/shopping/shopping_home/shopping_home_page.dart new file mode 100644 index 00000000..e5a956b9 --- /dev/null +++ b/lib/store/shopping/shopping_home/shopping_home_page.dart @@ -0,0 +1,289 @@ +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_swiper/flutter_swiper.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/home_recommend_list.dart'; +import 'package:huixiang/retrofit/data/shopping_home_config.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart'; +import 'package:huixiang/store/shopping/shopping_home/shopping_acticvity.dart'; +import 'package:huixiang/store/shopping/shopping_home/shopping_title_tab.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'activity_banner.dart'; +import 'classify_list.dart'; + +class ShoppingHomePage extends StatefulWidget { + final String minToken; + final StoreInfo storeInfo; + final String storeId; + final String tenant; + + ShoppingHomePage(this.minToken, this.storeInfo, this.storeId, this.tenant); + + @override + State createState() { + return _ShoppingHomePage(); + } +} + +class _ShoppingHomePage extends State + with AutomaticKeepAliveClientMixin { + ApiService apiService; + MinApiService minService; + final SwiperController controller = SwiperController(); + final RefreshController refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + ShoppingHomeConfig shoppingHomeConfig; + int checkNC = 0; + List homeRecommendList = []; + + @override + void initState() { + super.initState(); + SharedPreferences.getInstance().then((value) { + minService = MinApiService( + Dio(), + context: context, + token: widget.minToken, + tenant: widget.tenant, + storeId: widget.storeId, + showLoading: false, + ); + queryHomeConfig(); + queryRecommendList(); + }); + } + + @override + void dispose() { + super.dispose(); + if (refreshController != null) refreshController.dispose(); + } + + ///获取门店首页配置 + queryHomeConfig() async { + BaseData baseData = + await minService.homeConfig().catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + shoppingHomeConfig = baseData.data; + refreshController.refreshCompleted(); + }); + } else { + refreshController.refreshFailed(); + } + } + + ///首页为你推荐列表 + queryRecommendList() async { + BaseData> baseData = + await minService.recommendList().catchError((onError) { + refreshController.loadFailed(); + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + homeRecommendList.clear(); + homeRecommendList.addAll(baseData.data); + }); + }else { + refreshController.refreshFailed(); + } + } + + _onRefresh(){ + queryHomeConfig(); + queryRecommendList(); + } + + @override + Widget build(BuildContext context) { + super.build(context); + return Column( + children: [ + MyAppBar( + title: widget?.storeInfo?.storeName ?? "一心回乡商城", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.transparent, + ), + Expanded( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + scrollController: scrollController, + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + setState(() { + _onRefresh(); + }); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + if(shoppingHomeConfig != null) + buildSearchItem(), + + buildSwiper(), + + ///分类导航栏 + if(shoppingHomeConfig != null) + ShoppingTitleTab(shoppingHomeConfig.categoryGroup, + (index) { + setState(() { + checkNC = index; + }); + }), + + ///分类列表 + if(shoppingHomeConfig != null) + ClassifyList( + shoppingHomeConfig.categoryGroup[checkNC].groupList, + widget.minToken, + widget.storeId, + widget.tenant + ), + + ///专区活动 + if(shoppingHomeConfig != null) + ShoppingActivity(widget.storeId, widget.tenant, + shoppingHomeConfig.quickEntry), + + ///严选活动 + if(shoppingHomeConfig != null) + ActivityBanner(shoppingHomeConfig.specialArea, widget.minToken, + widget.storeId, + widget.tenant), + + ///为你推荐 + RecommendGoodsListView(homeRecommendList, + widget.storeId, widget.tenant), + ], + )), + ), + ), + ), + SizedBox( + height: 76.h, + ), + ], + ); + } + + Widget buildSearchItem() { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/search_page', arguments: { + "minToken": widget.minToken, + "tenant": widget.tenant, + "storeId": widget.storeId, + "hotSearch":shoppingHomeConfig.hotSearch, + }); + }, + child:Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h), + padding: EdgeInsets.fromLTRB(12.w, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(18), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Row( + children: [ + Icon( + Icons.search, + size: 24, + color: Color(0xFFABACAB), + ), + SizedBox( + width: 3.w, + ), + Text( + "生态好物", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF727272), + ), + ), + ], + ), + ), + ); + } + + Widget buildSwiper() { + return Container( + width: double.infinity, + height: 160.h, + margin: EdgeInsets.only(left: 16, right: 16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + ), + child: Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8.w, + activeSize: 8.w, + space: 5.w, + activeColor: Colors.white, + color: Colors.white.withAlpha(76), + ), + ), + itemBuilder: (context, position) { + return Container( + child: MImage( + (widget.storeInfo != null && + widget.storeInfo.bannerList != null && + position < widget.storeInfo.bannerList.length) + ? widget.storeInfo.bannerList[position].imgUrl + : "", + fit: BoxFit.cover, + radius: BorderRadius.circular(8), + errorSrc: "assets/image/default_2_1.webp", + fadeSrc: "assets/image/default_2_1.webp", + ), + ); + }, + itemCount: + (widget.storeInfo != null && widget.storeInfo.bannerList != null) + ? widget.storeInfo.bannerList.length + : 1, + ), + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/store/shopping/shopping_home/shopping_title_tab.dart b/lib/store/shopping/shopping_home/shopping_title_tab.dart new file mode 100644 index 00000000..a9f931af --- /dev/null +++ b/lib/store/shopping/shopping_home/shopping_title_tab.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/shopping_home_config.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; + +class ShoppingTitleTab extends StatefulWidget { + final List categoryGroup; + final Function notifyClassSelectList; + + ShoppingTitleTab(this.categoryGroup,this.notifyClassSelectList); + + @override + State createState() { + return _ClassTitleTab(); + } +} + +class _ClassTitleTab extends State + with SingleTickerProviderStateMixin { + TabController tabController; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + alignment: Alignment.centerLeft, + child: DefaultTabController( + length:widget?.categoryGroup?.length ?? 0, + child: TabBar( + isScrollable: true, + //可滚动 + indicatorColor: Color(0xff39B54A), + labelColor: Color(0xff32A060), + labelStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xff4D4D4D), + indicatorSize: TabBarIndicatorSize.label, + onTap: (index){ + widget.notifyClassSelectList(index); + }, + //指示器与文字等宽 + tabs:widget.categoryGroup == null + ? [] + : widget.categoryGroup + .map((e) => MyTab(text: e.name)) + .toList(), + ), + ), + ); + } + +} diff --git a/lib/store/shopping/shopping_mall_home.dart b/lib/store/shopping/shopping_mall_home.dart new file mode 100644 index 00000000..b761fedf --- /dev/null +++ b/lib/store/shopping/shopping_mall_home.dart @@ -0,0 +1,230 @@ +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/activity.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/shopping/shopping_cart/shopping_cart_page.dart'; +import 'package:huixiang/store/shopping/shopping_home/shopping_home_page.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ShoppingMallHome extends StatefulWidget { + final arguments; + + ShoppingMallHome({this.arguments}); + + @override + State createState() { + return _ShoppingMallHome(); + } +} + +class _ShoppingMallHome extends State + with AutomaticKeepAliveClientMixin { + ApiService apiService; + MinApiService minService; + int choiceIndex = 0; + String storeId = ""; + String tenant = ""; + ///小程序token + String minToken; + StoreInfo storeInfo; + List activitys; + + @override + void initState() { + super.initState(); + if (widget.arguments != null) choiceIndex = widget.arguments["type"]; + tenant = widget.arguments["tenant"]; + storeId = widget.arguments["id"]; + + debugPrint( + "store_param tenant:$tenant storeId:$storeId"); + + SharedPreferences.getInstance().then((value) { + minLogin(value); + queryStoreInfo(); + }); + } + + /// 小程序登录 + minLogin(SharedPreferences shared) async { + EasyLoading.show(status: S.of(context).zhengzaijiazai); + apiService = ApiService( + Dio(), + context: context, + token: shared.getString('token'), + showLoading: false, + ); + apiService.minLogin(storeId).catchError((onError) { + debugPrint(onError.toString()); + }).then((baseData) { + if (baseData != null && baseData.isSuccess) { + setState(() { + minToken = baseData.data["token"]; + }); + queryStoreInfo(); + SharedPreferences.getInstance().then( + (value) => { + value.setString('minToken', minToken), + value.setString('tenant', tenant), + value.setString('storeId', storeId), + }, + ); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + + EasyLoading.dismiss(); + } + }); + } + + /// 查询店铺信息 + queryStoreInfo() async { + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error.toString()); + }); + if (baseData != null && baseData.isSuccess) { + storeInfo = StoreInfo.fromJson(baseData.data); + activitys = storeInfo.informationVOPageVO.list + .map((e) => Activity.fromJson(e)) + .toList(); + if (mounted) { + setState(() {}); + } + } + EasyLoading.dismiss(); + } + + @override + Widget build(BuildContext context) { + super.build(context); + return Stack( + children: [ + Container( + color: Color(0xFFF7F7F7), + ), + Stack( + children: [ + Container( + // padding: EdgeInsets.only(top: 40.h), + height: 230.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFFE8F5E9), + Color(0xFFE5F7FF), + ]), + ), + ), + if (minToken != null && choiceIndex == 0) + ShoppingHomePage( + minToken, + storeInfo, + storeId, + tenant, + ), + if (minToken != null && choiceIndex == 1) + ShoppingCartPage( + minToken, + storeId, + tenant, + storeInfo, + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + color: Colors.white, + height: 83.h, + width: double.infinity, + padding: EdgeInsets.only(top: 10.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + choiceIndex = 0; + }); + }, + child: Column( + children: [ + Image.asset( + choiceIndex == 0 + ? "assets/image/shopping_home.webp" + : "assets/image/shopping_home_h.webp", + width: 30, + height: 30, + ), + Text( + "首页", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: choiceIndex == 0 + ? Color(0xFF4C4C4C) + : Color(0xFFC6C6C6), + ), + ), + ], + )), + ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + choiceIndex = 1; + }); + }, + child: Column( + children: [ + Image.asset( + choiceIndex == 0 + ? "assets/image/shopping_cart_h.webp" + : "assets/image/shopping_cart.webp", + width: 30, + height: 30, + ), + Text( + "购物车", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: choiceIndex == 0 + ? Color(0xFFC6C6C6) + : Color(0xFF4C4C4C), + ), + ), + ], + ), + )) + ], + ), + ), + ), + ], + ), + ], + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index abd6ae69..b3fe6f5e 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -136,13 +136,13 @@ class _StoreOrderPage extends State }); } + ///会员信息 queryMemberInfo() async { - BaseData baseData = await minService.memberInfo().catchError((error) { - debugPrint(error); - }); + BaseData baseData = await minService.memberInfo() + .catchError((error){debugPrint(error);}); if (baseData != null && baseData.isSuccess) { SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minMember', jsonEncode(baseData.data)), }, ); @@ -151,10 +151,8 @@ class _StoreOrderPage extends State ///获取父订单(火锅订单加菜前调用) getParentInfo() async { - BaseData baseData = - await minService.getParentInfo("$tableId").catchError((error) { - debugPrint(error); - }); + BaseData baseData = await minService.getParentInfo("$tableId") + .catchError((error) {debugPrint(error);}); if (baseData != null && baseData.isSuccess) { if (baseData.data != null) { parentId = baseData.data["id"]; @@ -185,8 +183,7 @@ class _StoreOrderPage extends State /// 查询店铺信息 queryStoreInfo() async { - BaseData baseData = - await apiService.queryStoreInfo(storeId).catchError((error) { + BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { debugPrint(error); }); if (baseData != null && baseData.isSuccess) { @@ -206,19 +203,17 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - // WillPopScope( - // onWillPop: () async { - // if (dialogShowing) { - // debugPrint("ssssasdadsasdadasd"); - // SmartDialog.dismiss(); - // return false; - // } else { - // return true; - // } - // }, - // child: , - // ); - return Container( + return WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child: Container( color: Colors.white, child: Stack( children: [ @@ -231,8 +226,7 @@ class _StoreOrderPage extends State controller: controller, dragStartBehavior: DragStartBehavior.start, physics: BouncingScrollPhysics(), - headerSliverBuilder: - (BuildContext context, bool innerScrolled) { + headerSliverBuilder: (BuildContext context, bool innerScrolled) { return [ SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor( @@ -494,6 +488,7 @@ class _StoreOrderPage extends State ), ], ), + ), ); } diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 0a6ed333..16f971ca 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -16,6 +16,7 @@ class ProductSku extends StatefulWidget { final Function(MiNiDetail miNiDetail, List selectSkus) add; final Function(MiNiDetail miNiDetail, List selectSkus) reduce; final ShoppingCart shopCarGoods; + final int buttonType; ProductSku( this.miNiDetail, @@ -24,6 +25,7 @@ class ProductSku extends StatefulWidget { this.addShopCar, this.add, this.reduce, + { this.buttonType} ); @override @@ -270,20 +272,390 @@ class _ProductSku extends State { SizedBox( height: 24, ), - RoundButton( - width: double.infinity, - height: 54.h, - text: "加入购物车", - textColor: Colors.white, - fontWeight: MyFontWeight.semi_bold, - radius: 27, - backgroup: Color(0xFF32A060), - fontSize: 16.sp, - callback: () { - // Navigator.of(context).pop(); - SmartDialog.dismiss(); - widget.addShopCar(widget.miNiDetail, selectSkus, 1); - }, + if(widget.buttonType != 1) + RoundButton( + width: double.infinity, + height: 54.h, + text: "加入购物车", + textColor: Colors.white, + fontWeight: MyFontWeight.semi_bold, + radius: 27, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + callback: () { + // Navigator.of(context).pop(); + SmartDialog.dismiss(); + widget.addShopCar(widget.miNiDetail, selectSkus, 1); + }, + ), + if(widget.buttonType == 1) + RoundButton( + width: double.infinity, + height: 54.h, + text: "确认", + textColor: Colors.white, + fontWeight: MyFontWeight.semi_bold, + radius: 27, + backgroup: Color(0xFF32A060), + fontSize: 16.sp, + callback: () { + // Navigator.of(context).pop(); + SmartDialog.dismiss(); + widget.addShopCar(widget.miNiDetail, selectSkus,count); + }, + ), + ///秒杀按钮 + if(widget.buttonType == 2) + Row( + children: [ + Expanded(child: GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ),), + Expanded(child: GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要砍价", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )),), + + + ], + ), + ///砍价 + if(widget.buttonType == 3) + Row( + children: [ + Expanded(child:GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ),), + Expanded(child:GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要秒杀", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )),), + ], + ), + ///拼团按钮 + if(widget.buttonType == 4) + Row( + children: [ + Expanded(child: GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "单人购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + )), + Expanded(child:GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: "284.00", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要开团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )),), + ], ), SizedBox( height: 21.h, diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index 97fa5013..fc56e83c 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -30,7 +30,7 @@ class _StoreInfoView extends State { top: 5.h, bottom: 6.h, ), - height: 154.h, + height: 162.h, padding: EdgeInsets.all(12.w), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 541b4dad..ff8c135d 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -13,6 +13,7 @@ import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -231,16 +232,64 @@ class _UnionPage extends State ), body: Column( children: [ - PreferredSize( - preferredSize: Size(double.infinity, 52.h), - child: Container( - padding: EdgeInsets.only(top:15.h), - color: Color(0xFFFAFAFA), - child: ItemTitle( - text: S.of(context).jingbilianmenghuiyuandian, - imgPath: "assets/image/icon_union_store.webp", + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(child:PreferredSize( + preferredSize: Size(double.infinity, 52.h), + child: Container( + padding: EdgeInsets.only(top:15.h), + color: Color(0xFFFAFAFA), + child: ItemTitle( + text: S.of(context).jingbilianmenghuiyuandian, + imgPath: "assets/image/icon_union_store.webp", + ), + ), + )), + GestureDetector( + onTap: (){ + setState(() { + var storeName = storeList.firstWhere((x)=>x.storeName == "一心回乡商城"); + if(storeName == null) + return; + Navigator.of(context).pushNamed( + '/router/shopping_mall_home', + arguments: { + "type":0, + "id":storeName.id, + "tenant": storeName.tenantCode, + "storeName":storeName.storeName + }, + ); + }); + }, + child:Container( + margin: EdgeInsets.only(right: 18), + height: 25.h, + width: 102.w, + color: Colors.white, + child:Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "一心回乡商城", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + ), + ], + ), + ), ), - ), + ], ), buildItem(), ], @@ -525,9 +574,6 @@ class _UnionPage extends State ), ], ), - SizedBox( - height: 4.h, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 47711755..047587c1 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -212,4 +212,11 @@ class AppUtils { errorStr += ",请检查手机网络是否正常"; return errorStr; } + + static String textSubStr(String input, int length) { + length -= 1; + if(length < 0 || input.length < length) + return input; + return "${input.substring(0,length)}..."; + } } diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index 0a9d3130..df78bc0c 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -79,14 +79,6 @@ class CommentListState extends State { Container( decoration: BoxDecoration( color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 2), - blurRadius: 14, - spreadRadius: 0, - ), - ], ), child: Column( mainAxisAlignment: MainAxisAlignment.start, diff --git a/pubspec.yaml b/pubspec.yaml index d8d27303..60f2903d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -91,6 +91,9 @@ dependencies: ai_decimal_accuracy: ^1.1.0 + + + dev_dependencies: flutter_test: sdk: flutter