diff --git a/assets/image/2x/closed_bill.png b/assets/image/2x/closed_bill.png new file mode 100644 index 00000000..42799000 Binary files /dev/null and b/assets/image/2x/closed_bill.png differ diff --git a/assets/image/2x/distribution.png b/assets/image/2x/distribution.png new file mode 100644 index 00000000..f81a0b33 Binary files /dev/null and b/assets/image/2x/distribution.png differ diff --git a/assets/image/2x/service.png b/assets/image/2x/service.png new file mode 100644 index 00000000..52af324f Binary files /dev/null and b/assets/image/2x/service.png differ diff --git a/assets/image/3x/closed_bill.png b/assets/image/3x/closed_bill.png new file mode 100644 index 00000000..6601bbb1 Binary files /dev/null and b/assets/image/3x/closed_bill.png differ diff --git a/assets/image/3x/distribution.png b/assets/image/3x/distribution.png new file mode 100644 index 00000000..f90a99b9 Binary files /dev/null and b/assets/image/3x/distribution.png differ diff --git a/assets/image/3x/service.png b/assets/image/3x/service.png new file mode 100644 index 00000000..b977862f Binary files /dev/null and b/assets/image/3x/service.png differ diff --git a/assets/image/closed_bill.png b/assets/image/closed_bill.png new file mode 100644 index 00000000..bf2dd754 Binary files /dev/null and b/assets/image/closed_bill.png differ diff --git a/assets/image/distribution.png b/assets/image/distribution.png new file mode 100644 index 00000000..1723467c Binary files /dev/null and b/assets/image/distribution.png differ diff --git a/assets/image/service.png b/assets/image/service.png new file mode 100644 index 00000000..44d9b7cf Binary files /dev/null and b/assets/image/service.png differ diff --git a/lib/main.dart b/lib/main.dart index d7ff1d43..fce7add2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -72,7 +72,11 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'home/guide_page.dart'; import 'main_page.dart'; +import 'mine/fans_page.dart'; +import 'mine/follow_page.dart'; import 'mine/manage_address_page.dart'; +import 'mine/mine_view/community_follow.dart'; +import 'mine/release_page.dart'; import 'mine/roll_center_page.dart'; void main() async { @@ -267,4 +271,8 @@ Map routers = { '/router/main_page': (context, {arguments}) => MainPage(), '/router/test_page': (context, {arguments}) => TestPage(), // '/router/ui_test': (context, {arguments}) => UITest(), + '/router/communityFollow': (context, {arguments}) => CommunityFollow(), + '/router/followPage': (context, {arguments}) => FollowPage(), + '/router/fansPage': (context, {arguments}) => FansPage(), + '/router/releasePage': (context, {arguments}) => ReleasePage(), }; diff --git a/lib/mine/fans_page.dart b/lib/mine/fans_page.dart new file mode 100644 index 00000000..72362b2a --- /dev/null +++ b/lib/mine/fans_page.dart @@ -0,0 +1,144 @@ +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/base_data.dart'; +import 'package:huixiang/retrofit/data/vip_card.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_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class FansPage extends StatefulWidget { + @override + State createState() { + return _FansPage(); + } +} + +class _FansPage extends State { + RefreshController _refreshController; + + ApiService apiService; + + @override + void initState() { + super.initState(); + _refreshController = RefreshController(); + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + + }); + } + + + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: _refreshController, + // onRefresh: , + physics: BouncingScrollPhysics(), + child: ListView.builder( + padding: EdgeInsets.symmetric(vertical: 8.h), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + + }, + child: fansItem(), + ); + }, + itemCount:5, + ) + // NoDataView( + // isShowBtn: false, + // text: "共关注0人", + // fontSize: 16.sp, + // margin: EdgeInsets.only(top: 120.h), + // ), + ), + ), + ); + } + + + Widget fansItem() { + return Container( + margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), + child:Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment:CrossAxisAlignment.center, + children: [ + MImage( + "assets/image/default_1.png", + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + width:8, + ), + Expanded(child:Text( + "百花谷", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + )), + Container( + width: 56.w, + height: 21.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11.w), + color: Color(0xFF32A060), + ), + child:Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment:CrossAxisAlignment.center, + children: [ + Icon( + Icons.add, + color: Colors.white, + size: 14, + ), + SizedBox( + width:4, + ), + Text( + "关注", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/mine/follow_page.dart b/lib/mine/follow_page.dart new file mode 100644 index 00000000..633d8309 --- /dev/null +++ b/lib/mine/follow_page.dart @@ -0,0 +1,144 @@ +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/base_data.dart'; +import 'package:huixiang/retrofit/data/vip_card.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_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class FollowPage extends StatefulWidget { + @override + State createState() { + return _FollowPage(); + } +} + +class _FollowPage extends State { + RefreshController _refreshController; + + ApiService apiService; + + @override + void initState() { + super.initState(); + _refreshController = RefreshController(); + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + + }); + } + + + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: _refreshController, + // onRefresh: , + physics: BouncingScrollPhysics(), + child: ListView.builder( + padding: EdgeInsets.symmetric(vertical: 8.h), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + + }, + child: followItem(), + ); + }, + itemCount:5, + ) + // NoDataView( + // isShowBtn: false, + // text: "共关注0人", + // fontSize: 16.sp, + // margin: EdgeInsets.only(top: 120.h), + // ), + ), + ), + ); + } + + + Widget followItem() { + return Container( + margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), + child:Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment:CrossAxisAlignment.center, + children: [ + MImage( + "assets/image/default_1.png", + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + width:8, + ), + Expanded(child:Text( + "百花谷", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + )), + Container( + width: 69.w, + height: 21.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11.w), + color: Color(0xFFE6E6E6), + ), + child:Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment:CrossAxisAlignment.center, + children: [ + Icon( + Icons.check, + color: Color(0xFF808080), + size: 14, + ), + SizedBox( + width:4, + ), + Text( + "已关注", + style: TextStyle( + color: Color(0xFF808080), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index c7bb2a89..6fb622f8 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -164,6 +164,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }, ), + ///关注度/粉丝/发布 + attention(), + ///我的 VIP等级信息 MineVipView( tag: "vip", @@ -205,6 +208,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); } + ///横向的提示 Widget buildNotice() { return Container( @@ -278,6 +282,87 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); } + ///关注度/粉丝/发布 + Widget attention(){ + return Container( + margin: EdgeInsets.only(left: 16,right: 17,top: 10), + child:GestureDetector( + onTap:(){ + Navigator.of(context).pushNamed( + '/router/communityFollow', + arguments: {}, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + "关注", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Text( + "45", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + Row( + children: [ + Text( + "粉丝", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Text( + "666", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + Row( + children: [ + Text( + "发布", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Text( + "666", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ], + ), + ), + ); + } + toIntegralPage() async { SharedPreferences shared = await SharedPreferences.getInstance(); if (shared.getString("token") == null || shared.getString("token") == "") { diff --git a/lib/mine/mine_view/community_follow.dart b/lib/mine/mine_view/community_follow.dart new file mode 100644 index 00000000..3ea67a39 --- /dev/null +++ b/lib/mine/mine_view/community_follow.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/mine/follow_page.dart'; +import 'package:huixiang/mine/release_page.dart'; +import 'package:huixiang/mine/vip_card_page.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; + +import '../fans_page.dart'; + + +class CommunityFollow extends StatefulWidget { + @override + State createState() { + return _CommunityFollow(); + } +} + +class _CommunityFollow extends State + with SingleTickerProviderStateMixin { + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 3, + child: Scaffold( + appBar: MyAppBar( + title: "", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, + bottom: TabBar( + // isScrollable: true, //可滚动 + indicatorColor: Color(0xff39B54A), + labelColor: Colors.black, + labelStyle: TextStyle( + fontSize: 17.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + ), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xffA29E9E), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: [ + MyTab(text:"关注(23)"), + MyTab(text: "粉丝(55)"), + MyTab(text: "发布(26)"), + ], + ), + ), + body: TabBarView( + children: [FollowPage(),FansPage(),ReleasePage()], + ), + ), + ); + } +} diff --git a/lib/mine/release_page.dart b/lib/mine/release_page.dart new file mode 100644 index 00000000..dd99cb28 --- /dev/null +++ b/lib/mine/release_page.dart @@ -0,0 +1,226 @@ +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/base_data.dart'; +import 'package:huixiang/retrofit/data/vip_card.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_footer.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ReleasePage extends StatefulWidget { + @override + State createState() { + return _ReleasePage(); + } +} + +class _ReleasePage extends State { + RefreshController _refreshController; + var isShowShrink = false; + ApiService apiService; + + @override + void initState() { + super.initState(); + _refreshController = RefreshController(); + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + + }); + } + + + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + controller: _refreshController, + // onRefresh: , + physics: BouncingScrollPhysics(), + child: ListView.builder( + padding: EdgeInsets.symmetric(vertical: 8.h), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + + }, + child: releaseItem(), + ); + }, + itemCount:5, + ) + // NoDataView( + // isShowBtn: false, + // text: "共关注0人", + // fontSize: 16.sp, + // margin: EdgeInsets.only(top: 120.h), + // ), + ), + ), + ); + } + + + Widget releaseItem() { + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 16.w), + margin: EdgeInsets.symmetric(vertical: 16.w), + child:Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment:CrossAxisAlignment.start, + children: [ + Row( + children: [ + ClipOval( + child: Image.network( + "https://t7.baidu.com/it/u=2841334870,333581502&fm=193&f=GIF", + fit: BoxFit.cover, + width: 44.w, + height: 44.h, + ), + clipBehavior: Clip.hardEdge, + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Container( + height: 60.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded(child: Text( + "百花谷", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xff808080), + ), + ), ), + InkWell( + onTap: () { + }, + child: Icon( + Icons.close, + color: Colors.black, + size: 16, + ), + ), + ], + ), + Text( + "2021.04.12 12:12", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xff808080), + ), + ), + ], + ), + ), + flex: 1, + ), + ], + ), + SizedBox(height: 12), + Text( + "文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组合。" + "一个文本可以是一个句子(Sentence)、一个段落(Paragraph)或者一个篇章(Discourse)。广义“文本”:" + "任何由书写所固定下来的任何话语。(利科尔) 狭义“文本”:由语言文字组成的文学实体,代指“作品”,相对于作者、世界构成一个独立、自足的系统。", + overflow: isShowShrink + ? TextOverflow.visible + : TextOverflow.ellipsis, + maxLines: isShowShrink ? 10 :5, + style: TextStyle( + fontSize: 14.sp, + color:Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular, + ), + ), + SizedBox(height: 4.h), + GestureDetector( + onTap: () { + setState(() { + isShowShrink = !isShowShrink; + }); + }, + child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + (isShowShrink != null && !isShowShrink) + ?"查看全文":"收起", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + fontWeight: MyFontWeight.medium, + ), + ), + ], + ), + ), + SizedBox(height:16.h), + Image.asset( + "assets/image/laoban.png", + height: 310.h, + ), + SizedBox(height: 17.h), + Row( + children: [ + Row( + children: [ + InkWell( + onTap: () { + }, + child: Icon( + Icons.close, + color: Colors.black, + size: 16, + ), + ), + SizedBox(width:4), + Text( + "52", + style: TextStyle( + fontSize: 12.sp, + color:Color(0xFF1A1A1A), + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), + ], + ), + SizedBox(height: 16.h), + ], + ), + ); + } +} diff --git a/lib/order/order_view/order_status.dart b/lib/order/order_view/order_status.dart index ab3af21a..2dabdf1f 100644 --- a/lib/order/order_view/order_status.dart +++ b/lib/order/order_view/order_status.dart @@ -211,10 +211,16 @@ class _OrderStatus extends State { tripStatus = "assets/image/order_ok.png"; } else if (status.contains(S.of(context).dingdanyituikuan)) { tripStatus = "assets/image/order_refund.png"; - } else if (status.contains(S.of(context).quxiaodingdan)) { + } else if (status.contains(S.of(context).yiquxiao)) { tripStatus = "assets/image/oeder_cancel.png"; } else if (status.contains(S.of(context).dengdaiyonghuqucan)) { tripStatus = "assets/image/wait_meal.png"; + }else if (status.contains(S.of(context).zhengzaihujiaoqishou)) { + tripStatus = "assets/image/distribution.png"; + }else if (status.contains(S.of(context).qishouyijiedanquhuozhong)) { + tripStatus = "assets/image/closed_bill.png"; + } else if (status.contains(S.of(context).dingdanyisongda)) { + tripStatus = "assets/image/service.png"; } return tripStatus; } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart new file mode 100644 index 00000000..0ca13580 --- /dev/null +++ b/lib/retrofit/min_api.g.dart @@ -0,0 +1,111 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'min_api.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +class _MinApiService implements MinApiService { + _MinApiService(this._dio, {this.baseUrl}) { + ArgumentError.checkNotNull(_dio, '_dio'); + baseUrl ??= 'http://192.168.10.236:8765/app/'; + } + + final Dio _dio; + + String baseUrl; + + @override + Future>> findMiNiGroupList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'product/findMiNiGroupList', + 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) => FindMiNiGroupList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> miNiDetail(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/product/queryMiNiProductDetail?id=$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => MiNiDetail.fromJson(json), + ); + return value; + } + + @override + Future> shoppingCart(param, header) async { + ArgumentError.checkNotNull(param, 'param'); + ArgumentError.checkNotNull(header, 'header'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('shoppingcart', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ShoppingCart.fromJson(json), + ); + return value; + } + + @override + Future> getOrderInfo(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + 'order/getOrderInfo', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => SettleOrderInfo.fromJson(json), + ); + return value; + } +} diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 92f190d7..e7768863 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -241,16 +241,12 @@ class _StoreOrderPage extends State coupon: true, ), - SizedBox( - height: 8, - ), - ///门店对应VIP信息 Vip(storeInfo, () {}, false), ], ), ), - top: 110.h, + top: 100.h, bottom: 0, left: 0, right: 0, diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 86385dac..410cf977 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -4,24 +4,27 @@ import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/order/order_view/order_commodity.dart'; +import 'package:huixiang/order/order_view/order_info.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/coupon.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.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/my_appbar.dart'; import 'package:huixiang/view_widget/rename_dialog.dart'; import 'package:huixiang/view_widget/rename_dialog_content.dart'; import 'package:huixiang/view_widget/round_button.dart'; +import 'package:huixiang/view_widget/separator.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class Settlement extends StatefulWidget { final arguments; + final OrderInfo orderInfo; - Settlement({this.arguments}); + Settlement({this.arguments,this.orderInfo}); @override State createState() { @@ -33,6 +36,10 @@ class _Settlement extends State { MinApiService minService; int selectedBtn = 0; OrderInfo orderInfo; + Coupon coupon; + Function(int type) callback; + GestureTapCallback callbackEx; + int isSelected = 0; @override void initState() { @@ -44,21 +51,23 @@ class _Settlement extends State { context: context, token: value.getString("token"), ); - // queryOrderInfo(); + queryOrderInfo(); }); storeInfo = widget.arguments["storeInfo"]; } StoreInfo storeInfo; + SettleOrderInfo settleOrderInfo; int payStatus = 0; int orderStatus = 0; int sendStatus = 0; int isTakeOut = 0; int refundStatus = 0; + // String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE // queryDetails() async { - // BaseData baseData = await minService.orderDetail(widget.arguments["id"]); + // BaseData baseData = await apiService.orderDetail(widget.arguments["id"]); // if (baseData != null && baseData.isSuccess) { // orderInfo = baseData.data; // payStatus = orderInfo.payStatus; @@ -81,16 +90,18 @@ class _Settlement extends State { ///订单结算信息 queryOrderInfo() async { - // BaseData baseData = await minService.getOrderInfo({ - // "addressId":0, - // "isTake": 0, - // "memberCouponId": 0, - // "orderId": widget.arguments["orderId"], - // "promotionId": 0 - // }); - // if (baseData != null && baseData.isSuccess) { - // setState(() {}); - // } + BaseData baseData = await minService.getOrderInfo({ + "addressId":0, + "isTake": 0, + "memberCouponId": 0, + "orderId": widget.arguments["orderId"], + "promotionId": 0 + }); + if (baseData != null && baseData.isSuccess) { + settleOrderInfo = baseData.data; + setState(() { + }); + } } @override @@ -140,8 +151,6 @@ class _Settlement extends State { ///支付方式 payMethod(), - - ], ), ), @@ -209,6 +218,7 @@ class _Settlement extends State { String center = ""; TextEditingController _vc = TextEditingController(); + statusTitle() { if (isTakeOut == 0) { if (payStatus == 0) { @@ -643,10 +653,18 @@ class _Settlement extends State { fontWeight: MyFontWeight.semi_bold ), ), - Icon( - Icons.keyboard_arrow_right, - size: 16, + InkWell( + onTap: () { + setState(() { + couponCart(); + }); + }, + child: Icon( + Icons.keyboard_arrow_right, + size: 16, + ), ), + ], ), SizedBox(height: 13, @@ -802,6 +820,7 @@ class _Settlement extends State { ); } + ///手机号编辑 showAlertDialog() { //显示对话框 showDialog( @@ -823,6 +842,335 @@ class _Settlement extends State { }); } + ///优惠券弹窗 + couponCart() { + showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return StatefulBuilder(builder: (context1, state) { + return Container( + alignment: Alignment.topCenter, + width: double.infinity, + height: MediaQuery.of(context).size.height / 2, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + top: 16, + left: 16, + right: 16, + bottom: 8, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "可用优惠券", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox(width: 4,), + Expanded(child: Text( + "(1)", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ),), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Image.asset( + "assets/image/cancel.png", + width: 24, + height: 24, + ), + ), + ], + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only( + top: 8, + left: 16, + right: 16, + ), + child: ListView.builder( + itemCount:5, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + // return shoppGoodsItem(); + return GestureDetector( + onTap: () { + }, + child: couponItem(position), + ); + }, + ), + ), + ), + ], + ), + ); + }); + }, + ); + } + + ///优惠券列表 + Widget couponItem(int index) { + return StatefulBuilder(builder: (context1, state){ + return Container( + height:170, + width: double.infinity, + margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 14.h, bottom: 8.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child:Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Text( + "¥", + style: TextStyle( + fontSize: 22.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xff32A060), + ), + ), + SizedBox( + height: 4.h, + ), + Text( + "5", + style: TextStyle( + fontSize: 40.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xff32A060), + ), + ), + ], + ), + ), + Text( + S.of(context).manyuankeyong(30), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xff32A060), + ), + ), + ], + ), + flex: 1, + ), + Expanded( + flex: 2, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + padding: EdgeInsets.fromLTRB(4, 2, 4, 2), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFFF7A1A), + style: BorderStyle.solid, + ), + ), + child: Text( + S.of(context).shangjiaquan, + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFFF7A1A), + ), + ), + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + "百年川椒火锅店", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xff353535), + ), + ), + flex: 1, + ) + ], + ), + Text( + "#新客户满减优惠#", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff727272), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + S.of(context).quanchangtongyong, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + ), + ), + Container( + margin: EdgeInsets.only(right: 23.w), + child:GestureDetector( + onTap: (){ + state(() { + isSelected = index; + }); + }, + child:Image.asset( + isSelected != index + ? "assets/image/icon_radio_unselected.png" + : "assets/image/icon_radio_selected.png", + width: 24, + height: 24, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + flex: (coupon != null && coupon.isEx) ? 97 : 97, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 23.w), + child: MySeparator( + width: 5.w, + height: 1.h, + color: Color(0xFF353535), + ), + ), + Expanded( + flex: (coupon != null && coupon.isEx) ? 56 : 42, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 23.w, vertical: 8.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + S.of(context).xiangqing, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 10.sp, + ), + ), + GestureDetector( + child: Icon( + (coupon != null && !coupon.isEx) + ? Icons.keyboard_arrow_down + : Icons.keyboard_arrow_up, + color: Colors.black, + size: 18, + ), //点击按钮布局 + onTap: callbackEx, + ), + ], + ), + if (coupon != null && coupon.isEx) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + S.of(context).shiyongriqi, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 10.sp, + ), + ), + Text( + (coupon.useStartTime == null && + coupon.useEndTime == null) + ? S.of(context).quantian + : "${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]} - ${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 10.sp, + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ); + }); + } + var checkIndex = 1; Widget checkView(var index) { diff --git a/lib/store/store_view/store_activity.dart b/lib/store/store_view/store_activity.dart index c79863a1..4bf0e441 100644 --- a/lib/store/store_view/store_activity.dart +++ b/lib/store/store_view/store_activity.dart @@ -31,6 +31,7 @@ class _StoreActivity extends State { : Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, + margin: EdgeInsets.only(top: 160.h), color: Colors.white, child: Swiper( viewportFraction: 0.95, @@ -53,7 +54,7 @@ class _StoreActivity extends State { child: Container( margin: EdgeInsets.symmetric(horizontal: 5.w), decoration: BoxDecoration( - color: Colors.white, + // color: Colors.white, borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow(