From b413b53eed409c01625c044c27a6c5fd25af0c67 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 15 Dec 2023 10:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=88=97=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=A4=E4=B8=AA=E6=8C=89=E9=92=AE=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E7=83=AD=E9=94=80=E6=A6=9C?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=EF=BC=9B=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=9A=E5=91=98=E9=A1=B5=E9=9D=A2=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/hot _selling_page.dart | 53 +++++ .../home/overview/trade_goods.dart | 4 +- .../home/overview/trade_overview_page.dart | 2 +- lib/business_system/home/vip/add_vip.dart | 225 ++++++++++++++++++ .../home/vip/bus_vip_list.dart | 48 +++- lib/main.dart | 6 + 6 files changed, 335 insertions(+), 3 deletions(-) create mode 100644 lib/business_system/home/hot _selling_page.dart create mode 100644 lib/business_system/home/vip/add_vip.dart diff --git a/lib/business_system/home/hot _selling_page.dart b/lib/business_system/home/hot _selling_page.dart new file mode 100644 index 00000000..3ec7e2d0 --- /dev/null +++ b/lib/business_system/home/hot _selling_page.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; + +import '../../../retrofit/business_api.dart'; +import 'overview/trade_goods.dart'; + +class HotSellingPage extends StatefulWidget { + final Map arguments; + + HotSellingPage({this.arguments}); + + @override + State createState() { + return _HotSellingPage(); + } +} + +class _HotSellingPage extends State { + BusinessApiService businessService; + + @override + void initState() { + super.initState(); + } + + ///离开页面记着销毁和清除 + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.white, + appBar: MyAppBar( + title: "热销榜单", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + brightness: Brightness.dark, + ), + body: TradeGoods(widget.arguments["storeId"],"热销榜单"), + ), + ); + } +} diff --git a/lib/business_system/home/overview/trade_goods.dart b/lib/business_system/home/overview/trade_goods.dart index c0e8629f..61af791f 100644 --- a/lib/business_system/home/overview/trade_goods.dart +++ b/lib/business_system/home/overview/trade_goods.dart @@ -22,8 +22,9 @@ import '../../../view_widget/no_data_view.dart'; class TradeGoods extends StatefulWidget { final storeId; + final titleName; - TradeGoods(this.storeId); + TradeGoods(this.storeId,this.titleName); @override State createState() { @@ -250,6 +251,7 @@ class _TradeGoods extends State { backgroundColor: Colors.white, body: Column( children: [ + if(widget.titleName != "热销榜单") Container( color: Color(0xFFD8D8D8), width: double.infinity, diff --git a/lib/business_system/home/overview/trade_overview_page.dart b/lib/business_system/home/overview/trade_overview_page.dart index d387ed07..c5035d9e 100644 --- a/lib/business_system/home/overview/trade_overview_page.dart +++ b/lib/business_system/home/overview/trade_overview_page.dart @@ -71,7 +71,7 @@ class _TradeOverviewPage extends State with SingleTickerProvi children: [ TradeSummary(storeId), TradeOrder(storeId), - TradeGoods(storeId),], + TradeGoods(storeId,"")], ), ), ); diff --git a/lib/business_system/home/vip/add_vip.dart b/lib/business_system/home/vip/add_vip.dart new file mode 100644 index 00000000..aec48522 --- /dev/null +++ b/lib/business_system/home/vip/add_vip.dart @@ -0,0 +1,225 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../retrofit/business_api.dart'; + +class AddVip extends StatefulWidget { + final Map arguments; + + AddVip({this.arguments}); + + @override + State createState() { + return _AddVip(); + } +} + +class _AddVip extends State { + final TextEditingController vipPhoneController = TextEditingController(); + final TextEditingController vipNameController = TextEditingController(); + bool isKeyBoardShow = false; + FocusNode _focusNode = FocusNode(); + BusinessApiService businessService; + + @override + void initState() { + super.initState(); + 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 + Widget build(BuildContext context) { + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.white, + appBar: MyAppBar( + title: "新增会员", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + brightness: Brightness.dark, + ), + body: Container( + margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w), + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(8), + ), + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: Row( + children: [ + Expanded( + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "会员手机号", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + TextSpan( + text: "*", + style: TextStyle( + color: Color(0xFFFA5151), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + Expanded( + child: TextField( + controller: vipPhoneController, + decoration: InputDecoration( + hintText: "请输入会员手机号", + hintTextDirection: TextDirection.rtl, + hintStyle: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + border: InputBorder.none, + contentPadding: EdgeInsets.only(left: 16.w), + ), + textAlign: TextAlign.right, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular), + ), + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x0F06152E), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(8), + ), + padding: EdgeInsets.symmetric(horizontal: 16.w), + margin: EdgeInsets.only(top: 16.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Text( + "会员姓名", + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), + ), + ), + Expanded( + child: TextField( + controller: vipNameController, + decoration: InputDecoration( + hintText: "请输入会员姓名", + hintTextDirection: TextDirection.rtl, + hintStyle: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular), + border: InputBorder.none, + contentPadding: EdgeInsets.only(left: 16.w), + ), + textAlign: TextAlign.right, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular), + ), + ), + ], + )), + Spacer(), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (vipPhoneController.text == "") { + SmartDialog.showToast("请输入会员手机号", + alignment: Alignment.center); + return; + } else { + print("新增成功"); + } + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(27), + color: Color(0xFF30415B), + ), + width: double.infinity, + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 16.h), + margin: EdgeInsets.only(bottom: 34.h), + child: Text( + "确认新增", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/business_system/home/vip/bus_vip_list.dart b/lib/business_system/home/vip/bus_vip_list.dart index 8a246180..009d56d0 100644 --- a/lib/business_system/home/vip/bus_vip_list.dart +++ b/lib/business_system/home/vip/bus_vip_list.dart @@ -173,7 +173,7 @@ class _BusVipList extends State { ), Expanded( child: Text( - "会员管理", + "会员列表", style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, @@ -181,6 +181,52 @@ class _BusVipList extends State { ), ), ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){}, + child:Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 5..h), + margin: EdgeInsets.only(right: 8.w), + child:Text( + "会员充值", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ) + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pushNamed('/router/hot_selling_page', + arguments: {"storeId": widget.storeId}).then((value){ + _current = 1; + records.clear(); + _onRefresh(isShowLoad: false); + }); + }, + child:Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4), + ), + padding: EdgeInsets.symmetric(horizontal: 14.w,vertical: 5..h), + margin: EdgeInsets.only(right:16.w), + child:Text( + "新增会员", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + )), ], ), ), diff --git a/lib/main.dart b/lib/main.dart index e80c7a9a..bfee594c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -97,8 +97,10 @@ import 'business_system/goods/on_sale/goods_assort.dart'; import 'business_system/goods/on_sale/goods_sort.dart'; import 'business_system/goods/reservation_ page.dart'; import 'business_system/home/flow_page.dart'; +import 'business_system/home/hot _selling_page.dart'; import 'business_system/home/select_shop.dart'; import 'business_system/home/overview/trade_overview_page.dart'; +import 'business_system/home/vip/add_vip.dart'; import 'business_system/home/vip/business_vip_page.dart'; import 'business_system/login/business_login_page.dart'; import 'business_system/mine/account_information.dart'; @@ -518,4 +520,8 @@ Map routers = { BusinessVipPage(arguments:arguments), '/router/reservation_page': (context, {arguments}) => ReservationPage(arguments:arguments), + '/router/add_vip': (context, {arguments}) => + AddVip(arguments:arguments), + '/router/hot_selling_page': (context, {arguments}) => + HotSellingPage(arguments:arguments), };