Browse Source

Merge remote-tracking branch 'origin/wr_2023_business' into wr_2023_business

# Conflicts:
#	lib/home/home_page.dart
#	pubspec.lock
wr_2023_business
wurong 1 year ago
parent
commit
9b6575017e
  1. BIN
      assets/image/2x/icon_new_vip.webp
  2. BIN
      assets/image/2x/icon_vip_total.webp
  3. BIN
      assets/image/2x/ion_vip_recharge.webp
  4. BIN
      assets/image/3x/icon_new_vip.webp
  5. BIN
      assets/image/3x/icon_vip_total.webp
  6. BIN
      assets/image/3x/ion_vip_recharge.webp
  7. BIN
      assets/image/icon_new_vip.webp
  8. BIN
      assets/image/icon_vip_total.webp
  9. BIN
      assets/image/ion_vip_recharge.webp
  10. 1
      ios/Podfile.lock
  11. 81
      lib/business_system/business_page.dart
  12. 354
      lib/business_system/home/business_home_page.dart
  13. 170
      lib/business_system/home/home_view/home_sideslip_dialog.dart
  14. 89
      lib/business_system/home/select_shop.dart
  15. 278
      lib/business_system/login/business_login_page.dart
  16. 3
      lib/home/home_page.dart
  17. 2
      lib/main.dart
  18. 138
      lib/mine/mine_view/mine_item.dart
  19. 150
      lib/retrofit/business_api.dart
  20. 137
      lib/retrofit/business_api.g.dart
  21. 281
      lib/retrofit/data/business_login_info.dart
  22. 177
      lib/retrofit/data/day_count.dart
  23. 33
      lib/retrofit/data/order_trend.dart
  24. 311
      lib/retrofit/data/popular_sales_list.dart
  25. 141
      lib/retrofit/data/vip_counts_info.dart
  26. 34
      lib/utils/business_instance.dart
  27. 46
      pubspec.lock

BIN
assets/image/2x/icon_new_vip.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/2x/icon_vip_total.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/2x/ion_vip_recharge.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/3x/icon_new_vip.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/image/3x/icon_vip_total.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/image/3x/ion_vip_recharge.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
assets/image/icon_new_vip.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

BIN
assets/image/icon_vip_total.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

BIN
assets/image/ion_vip_recharge.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

1
ios/Podfile.lock

@ -1,4 +1,5 @@
PODS:
- AEINFoundation (3.2.40)
- AFNetworking (4.0.1):
- AFNetworking/NSURLSession (= 4.0.1)
- AFNetworking/Reachability (= 4.0.1)

81
lib/business_system/business_page.dart

@ -6,6 +6,7 @@ import 'package:huixiang/business_system/order/business_order_page.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/business_login_info.dart';
import 'home/business_home_page.dart';
class BusinessPage extends StatefulWidget {
@ -22,9 +23,14 @@ class BusinessPage extends StatefulWidget {
class _BusinessPage extends State<BusinessPage>
with AutomaticKeepAliveClientMixin {
int choiceIndex = 0;
BusinessLoginInfo businessLoginInfo;
int selectStoreIndex = 0;
@override
void initState() {
super.initState();
businessLoginInfo = widget?.arguments["businessLoginInfo"];
selectStoreIndex = widget.arguments["selectStoreIndex"] ?? 0;
}
@override
@ -37,28 +43,23 @@ class _BusinessPage extends State<BusinessPage>
),
Stack(
children: [
if(choiceIndex == 0)
BusinessHomePage(),
if(choiceIndex == 1)
BusinessOrderPage(),
if(choiceIndex == 2)
BusinessHomePage(),
if(choiceIndex == 3)
BusinessGoodsPage(),
if(choiceIndex == 4)
BusinessMinePage(),
if (choiceIndex == 0)
BusinessHomePage(businessLoginInfo, selectStoreIndex, (index) {
setState(() {
selectStoreIndex = index;
});
}),
if (choiceIndex == 1) BusinessOrderPage(),
if (choiceIndex == 2) BusinessOrderPage(),
if (choiceIndex == 3) BusinessGoodsPage(),
if (choiceIndex == 4) BusinessMinePage(),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height:85.h,
height: 85.h,
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.only(top:20.h),
padding: EdgeInsets.only(top: 20.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@ -80,7 +81,9 @@ class _BusinessPage extends State<BusinessPage>
width: 30,
height: 30,
),
SizedBox(height: 5.h,),
SizedBox(
height: 5.h,
),
Text(
"首页",
style: TextStyle(
@ -105,19 +108,27 @@ class _BusinessPage extends State<BusinessPage>
child: Column(
children: [
Image.asset(
(choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4)
(choiceIndex == 0 ||
choiceIndex == 2 ||
choiceIndex == 3 ||
choiceIndex == 4)
? "assets/image/business_order_h.webp"
: "assets/image/business_order.webp",
width: 30,
height: 30,
),
SizedBox(height: 5.h,),
SizedBox(
height: 5.h,
),
Text(
"订单",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4)
color: (choiceIndex == 0 ||
choiceIndex == 2 ||
choiceIndex == 3 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
@ -150,19 +161,27 @@ class _BusinessPage extends State<BusinessPage>
child: Column(
children: [
Image.asset(
(choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4)
(choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 4)
? "assets/image/business_goods_h.webp"
: "assets/image/business_goods.webp",
width: 30,
height: 30,
),
SizedBox(height: 5.h,),
SizedBox(
height: 5.h,
),
Text(
"商品",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4)
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
@ -181,19 +200,27 @@ class _BusinessPage extends State<BusinessPage>
child: Column(
children: [
Image.asset(
(choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3)
(choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 3)
? "assets/image/business_mine_h.webp"
: "assets/image/business_mine.webp",
width: 30,
height: 30,
),
SizedBox(height: 5.h,),
SizedBox(
height: 5.h,
),
Text(
"我的",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3)
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 3)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),

354
lib/business_system/home/business_home_page.dart

@ -1,15 +1,34 @@
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/business_system/home/home_view/home_sideslip_dialog.dart';
import 'package:huixiang/utils/business_instance.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:intl/intl.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 '../../generated/l10n.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/day_count.dart';
import '../../retrofit/data/order_trend.dart';
import '../../retrofit/data/popular_sales_list.dart';
import '../../utils/font_weight.dart';
import 'home_view/my_line_chart.dart';
class BusinessHomePage extends StatefulWidget {
final BusinessLoginInfo businessLoginInfo;
final int selectStoreIndex;
final Function changeIndex;
BusinessHomePage(
this.businessLoginInfo, this.selectStoreIndex, this.changeIndex);
@override
State<StatefulWidget> createState() {
return _BusinessHomePage();
@ -17,21 +36,28 @@ class BusinessHomePage extends StatefulWidget {
}
class _BusinessHomePage extends State<BusinessHomePage>
with AutomaticKeepAliveClientMixin{
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
List<LineChartSample2Data> lineChartSample2Data =
[LineChartSample2Data(0,100,"2023-03-09"),
LineChartSample2Data(1,200,"2023-03-10"),
LineChartSample2Data(2,400,"2023-03-11"),
LineChartSample2Data(3,10,"2023-03-12"),
LineChartSample2Data(4,250,"2023-03-13"),
LineChartSample2Data(5,175,"2023-03-14"),
LineChartSample2Data(6,500,"2023-03-15")];
BusinessApiService businessService;
DayCount dayCount;
int _loadCount = 0;
PopularSalesList popularSalesList;
List<OrderTrend> orderTrend = [];
List<LineChartSample2Data> lineChartSample2Data = [
LineChartSample2Data(0, 0, "2023-03-09"),
LineChartSample2Data(1, 0, "2023-03-10"),
LineChartSample2Data(2, 0, "2023-03-11"),
LineChartSample2Data(3, 0, "2023-03-12"),
LineChartSample2Data(4, 0, "2023-03-13"),
LineChartSample2Data(5, 0, "2023-03-14"),
LineChartSample2Data(6, 0, "2023-03-15")
];
@override
void initState() {
super.initState();
_onRefresh();
}
@override
@ -39,6 +65,83 @@ class _BusinessHomePage extends State<BusinessHomePage>
super.dispose();
}
_onRefresh() async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.name ==
"所有门店"
? "0"
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id);
queryDayAmount();
queryPopularList();
queryOrderTrend();
});
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 3) {
_loadCount = 0;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
}
}
/////退/退
queryDayAmount() async {
try {
BaseData<DayCount> baseData = await businessService.getDayCounts({
"summaryDate": "${DateFormat("yyyy-MM-dd").format(DateTime.now())}"
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
dayCount = baseData.data;
}
} finally {
addLoadCount();
}
}
///
queryPopularList() async {
try {
BaseData<PopularSalesList> baseData =
await businessService.popularList("30").catchError((error) {});
if (baseData != null && baseData.isSuccess) {
popularSalesList = baseData.data;
}
} finally {
addLoadCount();
}
}
///
queryOrderTrend() async {
try {
BaseData<List<OrderTrend>> baseData =
await businessService.orderTrend().catchError((error) {});
if (baseData != null && baseData.isSuccess) {
double index = 0;
if(baseData.data.isNotEmpty){
orderTrend.clear();
}
orderTrend = baseData.data;
orderTrend.forEach((element) {
lineChartSample2Data.add(LineChartSample2Data(index,element.number,element.date));
index += 1;
});
}
} finally {
addLoadCount();
}
}
@override
Widget build(BuildContext context) {
super.build(context);
@ -58,9 +161,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {});
},
onRefresh: _onRefresh,
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -94,10 +195,16 @@ class _BusinessHomePage extends State<BusinessHomePage>
right: 16.w),
child: Column(
children: [
GestureDetector(
Row(
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
showAlertDialog();
onTap: () {
showAlertDialog(
widget.selectStoreIndex,
widget.businessLoginInfo,
);
//
// SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), );
// Navigator.of(context).pushNamed('/router/select_shop');
@ -112,7 +219,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
"海峽姐妹茶 郑州新田360店",
widget?.businessLoginInfo
?.storeList[widget.selectStoreIndex].name ??
"",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
@ -122,12 +231,23 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
],
),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: Image.asset(
"assets/image/icon_scan_qr_code.webp",
width: 28.h,
height: 28.h,
),
)
],
),
SizedBox(
height: 14.h,
),
Container(
padding: EdgeInsets.symmetric(horizontal: 23.w, vertical: 12.h),
padding: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
@ -136,7 +256,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
Padding(
padding: EdgeInsets.symmetric(horizontal: 23.w),
child: Row(
children: [
Image.asset(
"assets/image/bs_home_bill.webp",
@ -155,11 +277,12 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
),
],
),
)),
Padding(
padding: EdgeInsets.only(top: 6.h, bottom: 17.h),
padding: EdgeInsets.only(
top: 6.h, bottom: 17.h, left: 23.w, right: 23.w),
child: Text(
"1288890.00",
dayCount?.paySum ?? "0",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
@ -171,9 +294,10 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/bs_trade_num.webp",
@ -194,9 +318,10 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
padding: EdgeInsets.only(
top: 5.h, left: 20.w, right: 20.w),
child: Text(
"12",
(dayCount?.orderNum ?? 0).toString(),
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
@ -232,9 +357,12 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
padding: EdgeInsets.only(
top: 5.h, left: 20.w, right: 20.w),
child: Text(
"12999.00",
(dayCount?.refundMoney ?? "0.00") == "0"
? "0.00"
: (dayCount?.refundMoney ?? "0.00"),
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
@ -249,7 +377,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/bs_refund_num.webp",
@ -270,9 +398,10 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
padding: EdgeInsets.only(
top: 5.h, left: 20.w, right: 20.w),
child: Text(
"129",
(dayCount?.refundOrderNum ?? 0).toString(),
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
@ -293,11 +422,22 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///
showAlertDialog() {
showCupertinoModalPopup(
showAlertDialog(
selectStoreIndex,
businessLoginInfo,
) async {
int index = await showCupertinoModalPopup(
builder: (context) {
return HomeSideslipDialog();},
return HomeSideslipDialog(selectStoreIndex, businessLoginInfo);
},
context: context);
if (index != null) {
if (index == -1) {
Navigator.of(context).pop();
return;
}
widget.changeIndex(index);
}
}
///
@ -333,8 +473,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
Navigator.of(context).pushNamed('/router/trade_overview_page');
onTap: () {
Navigator.of(context)
.pushNamed('/router/trade_overview_page');
},
child: Row(
children: [
@ -346,7 +487,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xFF252626),
),
),
SizedBox(width: 5.w,),
SizedBox(
width: 5.w,
),
Image.asset(
"assets/image/bs_right.webp",
width: 8.w,
@ -360,7 +503,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
SizedBox(
height: 18.h,
),
LineChartSample2(lineChartSample2Data,"销售量"),
if(lineChartSample2Data.isNotEmpty)
LineChartSample2(lineChartSample2Data, "销售量"),
],
),
);
@ -371,7 +515,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h),
padding:
EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h),
child: Column(
children: [
Row(
@ -399,7 +544,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFC5A58), Color(0xFFFF716F)],
@ -413,7 +558,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日会员充值",
style: TextStyle(
@ -421,7 +567,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
@ -443,10 +590,12 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
)),
SizedBox(width:9.w,),
SizedBox(
width: 9.w,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
@ -460,7 +609,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日新增会员",
style: TextStyle(
@ -468,7 +618,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
@ -490,10 +641,12 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
)),
SizedBox(width:9.w,),
SizedBox(
width: 9.w,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],
@ -507,7 +660,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"总会员数",
style: TextStyle(
@ -515,7 +669,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
@ -545,18 +700,21 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///
Widget hotSellHotCharts(){
Widget hotSellHotCharts() {
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h),
padding:
EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h),
child: Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(left: 12.w,),
padding: EdgeInsets.only(
left: 12.w,
),
child: Text(
"热销榜单",
style: TextStyle(
@ -568,18 +726,19 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
],
),
SizedBox(height:14.h,),
SizedBox(
height: 14.h,
),
Container(
height:25.h,
margin:EdgeInsets.only(bottom:26.h),
height: 25.h,
margin: EdgeInsets.only(bottom: 26.h),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount:4,
itemCount: 4,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: dayItem(),
);
},
@ -587,14 +746,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
itemCount: 5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: salesVolumeItem(),
);
},
@ -605,11 +763,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///item
Widget dayItem(){
Widget dayItem() {
return Container(
padding: EdgeInsets.symmetric(horizontal:19.w,),
padding: EdgeInsets.symmetric(
horizontal: 19.w,
),
alignment: Alignment.center,
margin: EdgeInsets.only(right:16.w),
margin: EdgeInsets.only(right: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
// color: Color(0xFF30415B),
@ -630,15 +790,15 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///item
Widget salesVolumeItem(){
Widget salesVolumeItem() {
return Container(
padding: EdgeInsets.only(bottom:12.h),
padding: EdgeInsets.only(bottom: 12.h),
child: Row(
children: [
Image.asset(
"assets/image/bs_trophy_one.webp",
width:26,
height:26,
width: 26,
height: 26,
),
// Text(
// "1",
@ -648,15 +808,19 @@ class _BusinessHomePage extends State<BusinessHomePage>
// color: Color(0xFF0D0D0D),
// ),
// ),
SizedBox(width:8.w,),
Expanded(child:Text(
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
"满杯花青素",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),),
),
),
Text(
"已售",
style: TextStyle(
@ -665,7 +829,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xFF0D0D0D),
),
),
Padding(padding:EdgeInsets.only(left: 7.w),
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
"1888件",
style: TextStyle(
@ -673,23 +838,30 @@ class _BusinessHomePage extends State<BusinessHomePage>
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),)
),
)
],
),
);
}
///
Widget todayFlow(){
Widget todayFlow() {
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h,bottom: 26.h),
padding: EdgeInsets.only(left: 16.w, right:21.w, top: 12.h, bottom: 16.h),
child:Column(
margin: EdgeInsets.only(top: 16.h, bottom: 26.h),
padding:
EdgeInsets.only(left: 16.w, right: 21.w, top: 12.h, bottom: 16.h),
child: Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B),margin: EdgeInsets.only(right:12.w),),
Container(
width: 4.w,
height: 16.h,
color: Color(0xFF30415B),
margin: EdgeInsets.only(right: 12.w),
),
Expanded(
child: Text(
"今日流水",
@ -714,7 +886,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xFF252626),
),
),
SizedBox(width:5.w,),
SizedBox(
width: 5.w,
),
Image.asset(
"assets/image/bs_right.webp",
width: 8.w,
@ -725,17 +899,18 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
],
),
SizedBox(height:20.h,),
SizedBox(
height: 20.h,
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
itemCount: 5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: flowItem(),
);
},
@ -746,17 +921,18 @@ class _BusinessHomePage extends State<BusinessHomePage>
}
///item
Widget flowItem(){
Widget flowItem() {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0.w),
color: Color(0xFFF3F7FF),
),
margin: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.symmetric(horizontal: 17.w, vertical:8.h),
child:Row(
padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 8.h),
child: Row(
children: [
Expanded(child:Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@ -767,7 +943,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xD9000000),
),
),
SizedBox(height:7.h,),
SizedBox(
height: 7.h,
),
Text(
"海峽姐妹茶 郑州新田360店",
style: TextStyle(
@ -782,7 +960,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
TextSpan(
children: [
TextSpan(
text:"+",
text: "+",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,

170
lib/business_system/home/home_view/home_sideslip_dialog.dart

@ -2,8 +2,20 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../retrofit/data/business_login_info.dart';
import '../../../utils/flutter_utils.dart';
import '../../../view_widget/custom_image.dart';
class HomeSideslipDialog extends StatefulWidget {
final int selectStoreIndex;
final BusinessLoginInfo businessLoginInfo;
HomeSideslipDialog(
this.selectStoreIndex,
this.businessLoginInfo,
);
@override
State<StatefulWidget> createState() {
@ -11,9 +23,12 @@ class HomeSideslipDialog extends StatefulWidget {
}
}
class _HomeSideslipDialog extends State<HomeSideslipDialog> with SingleTickerProviderStateMixin{
class _HomeSideslipDialog extends State<HomeSideslipDialog>
with SingleTickerProviderStateMixin {
AnimationController _animationController;
Animation<Offset> _animation;
int selectIndex = 0;
final ScrollController scrollController = ScrollController();
@override
void initState() {
@ -30,6 +45,13 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog> with SingleTickerPro
curve: Curves.fastOutSlowIn,
));
_animationController.forward();
selectIndex = widget.selectStoreIndex;
if (selectIndex != 0)
Future.delayed(Duration(milliseconds: 100), () {
scrollController.jumpTo((scrollController.position.maxScrollExtent /
widget.businessLoginInfo.storeList.length) *
selectIndex);
});
}
@override
@ -40,7 +62,8 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog> with SingleTickerPro
@override
Widget build(BuildContext context) {
return SlideTransition(position: _animation,
return SlideTransition(
position: _animation,
child: WillPopScope(
///
onWillPop: () async {
@ -50,133 +73,178 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog> with SingleTickerPro
},
child: Container(
width: double.infinity,
margin: EdgeInsets.only(right:61.w),
margin: EdgeInsets.only(right: 61.w),
height: double.infinity,
padding: EdgeInsets.only(top: 55.h),
decoration: new BoxDecoration(
color: Colors.white,
),
child:Container(
child:
Column(
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:EdgeInsets.only(left:14.w,bottom: 33.h),
padding: EdgeInsets.only(left: 14.w, bottom: 33.h),
child: Row(
children: [
Image.asset(
"assets/image/default_user.webp",
width:57,
height:57,
MImage(
widget?.businessLoginInfo?.avatar ?? "",
fit: BoxFit.cover,
width: 57.h,
height: 57.h,
radius: BorderRadius.circular(100),
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
),
SizedBox(
width: 10.w,
),
SizedBox(width: 10.w,),
Expanded(child:
Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:[
Text("前进麦味烘焙*海峡姐妹茶",
children: [
Text(
widget?.businessLoginInfo
?.storeList[widget.selectStoreIndex].name ??
"",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A)
),),
SizedBox(height: 5.h,),
Text("123****1234",
color: Color(0xFF1A1A1A)),
),
SizedBox(
height: 5.h,
),
Text(
AppUtils.phoneEncode(
widget?.businessLoginInfo?.account ?? ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D)
),),
color: Color(0xFF4D4D4D)),
),
],
))
],
),
),
Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h),
child:
Row(
Padding(
padding: EdgeInsets.only(left: 16.w, bottom: 22.h),
child: Row(
children: [
Image.asset(
"assets/image/bs_switch_shop.webp",
width:24,
height:24,
width: 24,
height: 24,
),
SizedBox(
width: 4.w,
),
SizedBox(width: 4.w,),
Text("门店切换",
Text(
"门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)
),),
color: Color(0xFF1A1A1A)),
),
],
),),
Expanded(child:ListView.builder(
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
controller: scrollController,
itemCount: widget?.businessLoginInfo?.storeList?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
selectIndex = position;
Navigator.of(context).pop(selectIndex);
});
},
child: shopItem(),
child: shopItem(
widget.businessLoginInfo.storeList[position],
position),
);
},
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
onTap: () {
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
// statusBarColor: Colors.transparent));
SharedPreferences.getInstance().then((value) {
value.setString("account", "");
value.setString("password", "");
Navigator.of(context).pop(-1);
});
},
child: Container(
alignment: Alignment.center,
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 9.h),
margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h),
margin: EdgeInsets.only(
left: 16.w,
right: 16.w,
bottom: (widget.businessLoginInfo.storeList.length > 20)
? 20.h
: 103.h,
top: 20.h),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4.w),
),
child:Text("退出登录",
child: Text(
"退出登录",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white
),),),
color: Colors.white),
),
),
),
],
),
),
),),);
),
),
);
}
///
Widget shopItem(){
Widget shopItem(StoreList storeList, index) {
return Container(
decoration: BoxDecoration(
color: Color(0xFFF8F9FA),
color: selectIndex == index ? Color(0xFFF8F9FA) : Colors.transparent,
borderRadius: BorderRadius.circular(4.w),
),
margin:EdgeInsets.only(bottom: 11.h),
padding: EdgeInsets.only(top: 5.h,bottom: 8.h,left: 16.w,right: 17.w),
margin: EdgeInsets.only(bottom: 11.h),
padding: EdgeInsets.only(top: 5.h, bottom: 8.h, left: 16.w, right: 17.w),
child: Row(
children: [
Expanded(child:Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)",
Expanded(
child: Text(
storeList?.name ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B)
),)),
color: selectIndex == index
? Color(0xFF30415B)
: Color(0xFF4D4D4D)),
)),
if (selectIndex == index)
Icon(
Icons.check,
size: 20,
color: Color(0xFF4D4D4D),)
color: Color(0xFF4D4D4D),
)
],
),
);

89
lib/business_system/home/select_shop.dart

@ -5,10 +5,15 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class SelectShop extends StatefulWidget {
final arguments;
SelectShop({this.arguments});
@override
State<StatefulWidget> createState() {
return _SelectShop();
@ -17,16 +22,18 @@ class SelectShop extends StatefulWidget {
class _SelectShop extends State<SelectShop> {
final RefreshController refreshController = RefreshController();
BusinessLoginInfo businessLoginInfo;
int selectIndex = 0;
@override
void initState() {
super.initState();
businessLoginInfo = widget.arguments["businessLoginInfo"];
}
@override
Widget build(BuildContext context) {
return
Scaffold(
return Scaffold(
backgroundColor: Colors.white,
appBar: MyAppBar(
title: "选择门店",
@ -47,56 +54,75 @@ class _SelectShop extends State<SelectShop> {
return MyFooter(mode);
},
),
onRefresh: () {
},
onRefresh: () {},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
height: double.infinity,
padding: EdgeInsets.only(top: 13.h,left:16.w,right:16.w),
child:Column(
padding: EdgeInsets.only(top: 13.h, left: 16.w, right: 16.w),
child: Column(
children: [
Row(
children: [
Image.asset(
"assets/image/bs_switch_shop.webp",
width:24,
height:24,
width: 24,
height: 24,
),
SizedBox(
width: 4.w,
),
SizedBox(width: 4.w,),
Text("门店切换",
Text(
"门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)
),),
color: Color(0xFF1A1A1A)),
),
],
),
SizedBox(height:20.h,),
Expanded(child: ListView.builder(
SizedBox(
height: 20.h,
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:20,
itemCount: businessLoginInfo?.storeList?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
selectIndex = position;
});
},
child: shopsItem(),
child: shopsItem(
businessLoginInfo?.storeList[position], position),
);
},
)),
Container(
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushReplacementNamed(
'/router/business_page',
arguments: {
"selectStoreIndex": selectIndex,
"businessLoginInfo": businessLoginInfo,
});
},
child: Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical:16.h),
margin: EdgeInsets.only(bottom:34.h,top: 10.h),
padding: EdgeInsets.symmetric(vertical: 16.h),
margin: EdgeInsets.only(bottom: 34.h, top: 10.h),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(27.w),
),
child:Text(
child: Text(
S.of(context).queding,
style: TextStyle(
fontWeight: MyFontWeight.bold,
@ -105,6 +131,7 @@ class _SelectShop extends State<SelectShop> {
),
),
),
),
],
),
),
@ -112,7 +139,7 @@ class _SelectShop extends State<SelectShop> {
);
}
Widget shopsItem(){
Widget shopsItem(StoreList storeList, index) {
return Container(
height: 52.h,
margin: EdgeInsets.only(bottom: 12),
@ -123,21 +150,26 @@ class _SelectShop extends State<SelectShop> {
height: 52.h,
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFEFF5FF),
color: selectIndex == index ? Color(0xFFEFF5FF) : Colors.white,
borderRadius: BorderRadius.circular(4.w),
border: Border.all(
color: Color(0xFF30415B),
width: 1.w,
color: selectIndex == index ? Color(0xFF30415B) : Colors.white,
width: selectIndex == index ? 1.w : 0,
),
),
padding: EdgeInsets.only(top:16.h,bottom:16.h,left: 16.w,right: 17.w),
child: Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)",
padding: EdgeInsets.only(
top: 16.h, bottom: 16.h, left: 16.w, right: 17.w),
child: Text(
storeList?.name ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B)
),),
color: selectIndex == index
? Color(0xFF30415B)
: Color(0xFF0D0D0D)),
),
),
if (selectIndex == index)
Image.asset(
"assets/image/bs_shop.webp",
width: 20,
@ -148,5 +180,4 @@ class _SelectShop extends State<SelectShop> {
),
);
}
}

278
lib/business_system/login/business_login_page.dart

@ -1,11 +1,22 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/utils/business_instance.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
import '../../generated/l10n.dart';
import '../../retrofit/retrofit_api.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/border_text.dart';
import '../../view_widget/round_button.dart';
class BusinessLoginPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -21,14 +32,10 @@ class BusinessLoginPage extends StatefulWidget {
class _BusinessLoginPage extends State<BusinessLoginPage> {
TextEditingController _userPhoneController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
bool _isShowPassword = false;
bool _isShowUserNameDel = false;
bool _agree = false;
bool _canClick = true;
DateTime _lastQuitTime;
String _phoneInputTips, _pwdInputTips;
String phoneInputTips, pwdInputTips;
final TapGestureRecognizer tapGestureRecognizer = TapGestureRecognizer();
var checkStatus = false;
BusinessApiService businessService;
@override
void initState() {
@ -48,19 +55,86 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
setState(() {});
}
login() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) {
showAlertDialog();
return;
}
if (_userPhoneController.text == "") {
SmartDialog.showToast(S.of(context).qingshurushoujihao,
alignment: Alignment.center);
return;
}
if (_passwordController.text == "") {
SmartDialog.showToast("请输入密码", alignment: Alignment.center);
return;
}
if (!checkStatus) {
SmartDialog.showToast(S.of(context).gouxuanxieyi,
alignment: Alignment.center);
return;
}
var param = {
"grantType": "password",
"account": _userPhoneController.text,
"password": _passwordController.text,
};
EasyLoading.show(
status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
businessService = BusinessApiService(Dio(), context: context);
BaseData baseData =
await businessService.annoToken(param).catchError((error) {
print(error.message);
});
if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data);
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('account', _userPhoneController.text);
sharedPreferences.setString('password', _passwordController.text);
if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context)
.pushReplacementNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
});
} else {
Navigator.of(context)
.pushReplacementNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo,
});
}
} else {
if (baseData.msg != null)
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: false,
body: SingleChildScrollView(
body: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
child: Stack(
children: [
Container(
padding: EdgeInsets.only(top: 54.h, left: 16.w, right: 17.w),
padding:
EdgeInsets.only(top: 54.h, left: 16.w, right: 17.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -85,10 +159,10 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
children: [
Image.asset(
"assets/image/business_phone.webp",
width:10.w,
height:15.h,
width: 10.w,
height: 15.h,
),
SizedBox(width:4.w),
SizedBox(width: 4.w),
Text("手机号码",
style: TextStyle(
fontSize: 14.sp,
@ -121,22 +195,25 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
),
onChanged: (value) {
if (value.isEmpty) {
_phoneInputTips = "请输入手机号码";
phoneInputTips = "请输入手机号码";
} else {
_phoneInputTips = null;
phoneInputTips = null;
}
refresh();
},
inputFormatters: [
LengthLimitingTextInputFormatter(11)
],
),
),
Row(
children: [
Image.asset(
"assets/image/business_code.webp",
width:12.w,
height:15.h,
width: 12.w,
height: 15.h,
),
SizedBox(width:4.w),
SizedBox(width: 4.w),
Text("密码",
style: TextStyle(
fontSize: 14.sp,
@ -169,9 +246,9 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
),
onChanged: (value) {
if (value.isEmpty) {
_pwdInputTips = "请输入密码";
pwdInputTips = "请输入密码";
} else {
_pwdInputTips = null;
pwdInputTips = null;
}
refresh();
},
@ -180,7 +257,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushReplacementNamed('/router/business_page');
login();
},
child: Container(
width: double.infinity,
@ -228,8 +305,8 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
text: "《一心回乡用户协议》",
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.pushNamed('/router/user_service_page');
Navigator.of(context).pushNamed(
'/router/user_service_page');
},
style: TextStyle(
fontSize: 11.sp,
@ -281,7 +358,164 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
],
),
),
)),
);
}
showAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: SimpleDialog(
titlePadding: EdgeInsets.all(10),
backgroundColor: Colors.transparent,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
children: <Widget>[
Stack(
alignment: Alignment.bottomCenter,
children: [
Container(
alignment: Alignment.center,
width: double.infinity,
height: 325.h,
padding: EdgeInsets.only(left: 16.w, right: 16.w),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(top: 24.h, bottom: 10.h),
child: Text(
S.of(context).xieyitanchuang,
style: TextStyle(
color: Color(0xff4D4D4D),
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
),
),
Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).yinsizhengce1,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
height: 1.3.h,
color: Color(0xff727272),
),
),
TextSpan(
text: S.of(context).yinsixieyi,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xff32A060)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.popAndPushNamed('/router/treaty_page');
},
),
]),
),
SizedBox(
height: 10.h,
),
Text(
S.of(context).yinsizhengce2,
style: TextStyle(
color: Color(0xff727272),
fontSize: 14.sp,
height: 1.3.h,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
height: 16.h,
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
Navigator.of(context).pop();
// exit(0);
},
child: Container(
height: 40.h,
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom: 20.h),
child: BorderText(
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 36.w,
right: 36.w,
),
text: S.of(context).jujue,
fontSize: 12.sp,
textColor: Color(0xFF32A060),
borderColor: Color(0xFF32A060),
borderWidth: 1.w,
radius: 23,
),
),
),
SizedBox(
width: 21.w,
),
Container(
height: 40.h,
margin: EdgeInsets.only(bottom: 20.h),
alignment: Alignment.bottomCenter,
child: RoundButton(
text: S.of(context).tongyibingjixu,
textColor: Colors.white,
fontSize: 12.sp,
callback: () {
SharedPreferences.getInstance().then((value) {
value.setBool("isShowPrivacyPolicy", true);
});
SharesdkPlugin.uploadPrivacyPermissionStatus(
1,
(success) => {
Navigator.of(context).pop(),
},
);
},
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 21.5.w,
right: 21.5.w,
),
backgroup: Color(0xff32A060),
radius: 23,
),
),
SizedBox(
height: 20.h,
),
],
),
],
)
],
),
);
},
);
}
}

3
lib/home/home_page.dart

@ -503,6 +503,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
homeRank.commodityZone.length != 0)
HomeRecommendGoods(homeRank),
if((homeRank?.commodityZone?.length ??0) == 0)
SizedBox(height: 20.h,),
///
// if(mRaiseMoney != 0)
HappyHelpFarmers(),

2
lib/main.dart

@ -475,7 +475,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/flow_page': (context, {arguments}) =>
FlowPage(),
'/router/select_shop': (context, {arguments}) =>
SelectShop(),
SelectShop(arguments:arguments),
'/router/trade_overview_page': (context, {arguments}) =>
TradeOverviewPage(),
'/router/goods_search_page': (context, {arguments}) =>

138
lib/mine/mine_view/mine_item.dart

@ -1,5 +1,8 @@
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_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
@ -7,6 +10,11 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../utils/business_instance.dart';
class MineItem extends StatefulWidget {
@override
State<StatefulWidget> createState() {
@ -16,10 +24,50 @@ class MineItem extends StatefulWidget {
class _MineItem extends State<MineItem> {
var isShowMore = false;
login(account, password) async {
var param = {
"grantType": "password",
"account": account,
"password": password,
};
EasyLoading.show(
status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BusinessApiService businessService =
BusinessApiService(Dio(), context: context);
BaseData baseData =
await businessService.annoToken(param).catchError((error) {
print(error.message);
});
if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data);
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
if (businessLoginInfo.storeList.length > 1) {
Navigator.of(context)
.pushNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
});
} else {
Navigator.of(context)
.pushNamed('/router/business_page', arguments: {
"businessLoginInfo": businessLoginInfo,
});
}
} else {
Navigator.of(context).pushNamed('/router/business_login_page');
}
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16.w,0.h, 16.w,30.h),
margin: EdgeInsets.fromLTRB(16.w, 0.h, 16.w, 30.h),
// padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration(
color: Colors.white,
@ -37,8 +85,8 @@ class _MineItem extends State<MineItem> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 16,top:16,bottom:13,right: 16),
child:Text(
padding: EdgeInsets.only(left: 16, top: 16, bottom: 13, right: 16),
child: Text(
S.of(context).qita,
style: TextStyle(
color: Color(0xFF353535),
@ -133,8 +181,8 @@ class _MineItem extends State<MineItem> {
// ),
// ),),
///
Expanded(child:
InkWell(
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -151,8 +199,10 @@ class _MineItem extends State<MineItem> {
),
),
),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -167,9 +217,12 @@ class _MineItem extends State<MineItem> {
S.of(context).huixiangqianbao,
"assets/image/platform_yue.webp",
),
),),
),
),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -184,9 +237,12 @@ class _MineItem extends State<MineItem> {
S.of(context).dianpuchongzhi,
"assets/image/shop_yue.webp",
),
),),
),
),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -202,7 +258,8 @@ class _MineItem extends State<MineItem> {
S.of(context).duihuanlishi,
"assets/image/icon_mine_records_of_consumption.webp",
),
),),
),
),
////
// Expanded(child: InkWell(
// onTap: () {
@ -222,7 +279,9 @@ class _MineItem extends State<MineItem> {
// ),),
],
),
SizedBox(height: 12.h,),
SizedBox(
height: 12.h,
),
// if(isShowMore)
Row(
children: [
@ -262,17 +321,22 @@ class _MineItem extends State<MineItem> {
// ),
// ),),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/help_feedback_page');
Navigator.of(context)
.pushNamed('/router/help_feedback_page');
},
child: mineItem(
S.of(context).bangzhuyufankui,
"assets/image/fan_kui.webp",
),
),),
),
),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
showCallMobile();
},
@ -280,18 +344,33 @@ class _MineItem extends State<MineItem> {
S.of(context).lianxikefu,
"assets/image/icon_mine_online_service.webp",
),
),),
),
),
///
Expanded(child: InkWell(
Expanded(
child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/business_login_page');
SharedPreferences.getInstance().then((value) {
if (value.getString("account") == "" ||
value.getString("password") == "") {
Navigator.of(context)
.pushNamed('/router/business_login_page');
} else {
login(value.getString("account"),
value.getString("password"));
}
});
},
child: mineItem(
"商家管理",
"assets/image/business.webp",
),
),),
Expanded(child:Container(),),
),
),
Expanded(
child: Container(),
),
// ///
// Expanded(child: InkWell(
// onTap: () {
@ -323,7 +402,9 @@ class _MineItem extends State<MineItem> {
],
),
// if(isShowMore)
SizedBox(height: 12.h,),
SizedBox(
height: 12.h,
),
// if(isShowMore)
Row(
children: [
@ -348,11 +429,18 @@ class _MineItem extends State<MineItem> {
// "assets/image/icon_mine_online_service.webp",
// ),
// ),),
Expanded(child:Container(),),
Expanded(child:Container(),),
Expanded(child:Container(),),
Expanded(
child: Container(),
),
Expanded(
child: Container(),
),
Expanded(
child: Container(),
),
],
),
///
// GestureDetector(
// behavior: HitTestBehavior.opaque,

150
lib/retrofit/business_api.dart

@ -0,0 +1,150 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/business_login_info.dart';
import 'package:huixiang/retrofit/data/day_count.dart';
import 'package:huixiang/retrofit/data/order_trend.dart';
import 'package:huixiang/retrofit/data/vip_counts_info.dart';
import 'package:retrofit/retrofit.dart';
import '../utils/flutter_utils.dart';
import 'data/base_data.dart';
import 'data/popular_sales_list.dart';
part 'business_api.g.dart';
///
const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/";
///
// const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/";
///线
const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/";
@RestApi(baseUrl: localBaseUrl)
abstract class BusinessApiService {
factory BusinessApiService(
Dio dio, {
String baseUrl,
BuildContext context,
String token,
bool showLoading = false,
String url,
String tenant,
String storeId,
bool showErrorToast = true,
}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
if (tenant != null && tenant != "") {
headers["tenant"] = tenant;
}
if (storeId != null && storeId != "") {
headers["store-id"] = storeId;
}
if (kReleaseMode) baseUrl = serviceBaseUrl;
if (url != null) baseUrl = url;
dio.options = BaseOptions(
connectTimeout: 60000,
receiveTimeout: 60000,
headers: headers,
responseType: ResponseType.json,
baseUrl: baseUrl,
);
dio.interceptors.add(
InterceptorsWrapper(onRequest: (RequestOptions options) {
debugPrint("\n======================= 请求数据 =======================");
debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}");
debugPrint("headers = ${options.headers}");
if (showLoading && !EasyLoading.isShow) {
//loading
EasyLoading.show(status: "正在加载...");
}
if (options.data is FormData) {
debugPrint("params data = FormData");
} else {
debugPrint("params data = ${jsonEncode(options.data)}");
}
debugPrint("params queryParameters = ${options.queryParameters}");
}, onResponse: (Response response) {
if (showLoading && EasyLoading.isShow) EasyLoading.dismiss();
debugPrint("\n======================= 响应数据开始 =======================");
debugPrint("code = ${response.statusCode}");
p(jsonEncode(response.data));
// debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length * 10);
Map map = response.data;
// if (map["code"] != 0) {
// EasyLoading.dismiss();
// }
// if (map["code"] == 40005 || map["code"] == 40001) {
// if (!LoginTipsDialog().isShow) {
// print("show: ${LoginTipsDialog().isShow}");
// LoginTipsDialog().show(context);
// }
// }
if (showErrorToast &&
map["code"] == 404 &&
(map["msg"] ?? map["message"]) != null) {
SmartDialog.showToast(map["msg"] ?? map["message"],
alignment: Alignment.center);
}
debugPrint("======================= 响应数据结束 =======================\n");
}, onError: (DioError e) {
if (EasyLoading.isShow) EasyLoading.dismiss();
// SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center);
// SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type),
// alignment: Alignment.center);
debugPrint("\n======================= 错误响应数据 =======================");
debugPrint("type = ${e.type}");
debugPrint("message = ${e.message}");
debugPrint("\n");
}),
);
return _BusinessApiService(dio, baseUrl: baseUrl);
}
void dispose();
static void p(String msg) {
//String的length是字符数量不是字节数量所以为了防止中文字符过多
// 4*1024MAX字节打印长度改为1000字符数
int maxStrLength = 900;
//1000
while (msg.length > maxStrLength) {
debugPrint(msg.substring(0, maxStrLength), wrapWidth: maxStrLength);
msg = msg.substring(maxStrLength);
}
//
debugPrint(msg, wrapWidth: maxStrLength);
}
/// token/
@POST("anno/token")
Future<BaseData> annoToken(@Body() Map<String, dynamic> param);
///
@POST("comprehensiveReport/getDayCounts")
Future<BaseData<DayCount>> getDayCounts(@Body() Map<String, dynamic> param);
////
@GET("dashBoard/store/?offsetDay={offsetDay}")
Future<BaseData<PopularSalesList>> popularList(
@Path("offsetDay") String offsetDay);
////
@GET("trend/orderTrend")
Future<BaseData<List<OrderTrend>>> orderTrend();
////
@GET("largeScreenReport/getDayCounts?date={date}")
Future<BaseData<VipCountsInfo>> vipCounts(
@Path("date") String date);
}

137
lib/retrofit/business_api.g.dart

@ -0,0 +1,137 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'business_api.dart';
// **************************************************************************
// RetrofitGenerator
// **************************************************************************
class _BusinessApiService implements BusinessApiService {
_BusinessApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= kReleaseMode ? serviceBaseUrl : localBaseUrl;
}
final Dio _dio;
String baseUrl;
@override
void dispose() {
_dio.close(force: true);
}
@override
Future<BaseData> annoToken(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'anno/token',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
);
return value;
}
@override
Future<BaseData<DayCount>> getDayCounts(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'comprehensiveReport/getDayCounts',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<DayCount>.fromJson(
_result.data,
(json) => json == "" ? null :DayCount.fromJson(json),
);
return value;
}
@override
Future<BaseData<PopularSalesList>> popularList(offsetDay) async {
ArgumentError.checkNotNull(offsetDay, 'offsetDay');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'dashBoard/store/?offsetDay=$offsetDay',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<PopularSalesList>.fromJson(
_result.data,
(json) => PopularSalesList.fromJson(json),
);
return value;
}
@override
Future<BaseData<List<OrderTrend>>> orderTrend() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'trend/orderTrend',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<OrderTrend>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<OrderTrend>(
(i) => OrderTrend.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<VipCountsInfo>> vipCounts(date) async {
ArgumentError.checkNotNull(date, 'date');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'largeScreenReport/getDayCounts?date=$date',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<VipCountsInfo>.fromJson(
_result.data,
(json) => VipCountsInfo.fromJson(json),
);
return value;
}
}

281
lib/retrofit/data/business_login_info.dart

File diff suppressed because one or more lines are too long

177
lib/retrofit/data/day_count.dart

@ -0,0 +1,177 @@
/// summaryDate : "2023-09-14"
/// dayMoney : "0"
/// discountSum : "0.00"
/// paySum : "0"
/// rechargeMoney : "0"
/// refundMoney : "0"
/// orderNum : 0
/// rechargeOrderNum : 0
/// refundOrderNum : 0
/// payOrderNum : 0
/// discountOrderNum : 0
/// startDate : null
/// endDate : null
/// tablePerConsumption : null
/// numberOfPeople : 0
/// peoplePerConsumption : "0"
/// realDiscountPer : null
/// tableRate : null
class DayCount {
DayCount({
String summaryDate,
String dayMoney,
String discountSum,
String paySum,
String rechargeMoney,
String refundMoney,
num orderNum,
num rechargeOrderNum,
num refundOrderNum,
num payOrderNum,
num discountOrderNum,
dynamic startDate,
dynamic endDate,
dynamic tablePerConsumption,
num numberOfPeople,
String peoplePerConsumption,
dynamic realDiscountPer,
dynamic tableRate,}){
_summaryDate = summaryDate;
_dayMoney = dayMoney;
_discountSum = discountSum;
_paySum = paySum;
_rechargeMoney = rechargeMoney;
_refundMoney = refundMoney;
_orderNum = orderNum;
_rechargeOrderNum = rechargeOrderNum;
_refundOrderNum = refundOrderNum;
_payOrderNum = payOrderNum;
_discountOrderNum = discountOrderNum;
_startDate = startDate;
_endDate = endDate;
_tablePerConsumption = tablePerConsumption;
_numberOfPeople = numberOfPeople;
_peoplePerConsumption = peoplePerConsumption;
_realDiscountPer = realDiscountPer;
_tableRate = tableRate;
}
DayCount.fromJson(dynamic json) {
_summaryDate = json['summaryDate'];
_dayMoney = json['dayMoney'];
_discountSum = json['discountSum'];
_paySum = json['paySum'];
_rechargeMoney = json['rechargeMoney'];
_refundMoney = json['refundMoney'];
_orderNum = json['orderNum'];
_rechargeOrderNum = json['rechargeOrderNum'];
_refundOrderNum = json['refundOrderNum'];
_payOrderNum = json['payOrderNum'];
_discountOrderNum = json['discountOrderNum'];
_startDate = json['startDate'];
_endDate = json['endDate'];
_tablePerConsumption = json['tablePerConsumption'];
_numberOfPeople = json['numberOfPeople'];
_peoplePerConsumption = json['peoplePerConsumption'];
_realDiscountPer = json['realDiscountPer'];
_tableRate = json['tableRate'];
}
String _summaryDate;
String _dayMoney;
String _discountSum;
String _paySum;
String _rechargeMoney;
String _refundMoney;
num _orderNum;
num _rechargeOrderNum;
num _refundOrderNum;
num _payOrderNum;
num _discountOrderNum;
dynamic _startDate;
dynamic _endDate;
dynamic _tablePerConsumption;
num _numberOfPeople;
String _peoplePerConsumption;
dynamic _realDiscountPer;
dynamic _tableRate;
DayCount copyWith({ String summaryDate,
String dayMoney,
String discountSum,
String paySum,
String rechargeMoney,
String refundMoney,
num orderNum,
num rechargeOrderNum,
num refundOrderNum,
num payOrderNum,
num discountOrderNum,
dynamic startDate,
dynamic endDate,
dynamic tablePerConsumption,
num numberOfPeople,
String peoplePerConsumption,
dynamic realDiscountPer,
dynamic tableRate,
}) => DayCount( summaryDate: summaryDate ?? _summaryDate,
dayMoney: dayMoney ?? _dayMoney,
discountSum: discountSum ?? _discountSum,
paySum: paySum ?? _paySum,
rechargeMoney: rechargeMoney ?? _rechargeMoney,
refundMoney: refundMoney ?? _refundMoney,
orderNum: orderNum ?? _orderNum,
rechargeOrderNum: rechargeOrderNum ?? _rechargeOrderNum,
refundOrderNum: refundOrderNum ?? _refundOrderNum,
payOrderNum: payOrderNum ?? _payOrderNum,
discountOrderNum: discountOrderNum ?? _discountOrderNum,
startDate: startDate ?? _startDate,
endDate: endDate ?? _endDate,
tablePerConsumption: tablePerConsumption ?? _tablePerConsumption,
numberOfPeople: numberOfPeople ?? _numberOfPeople,
peoplePerConsumption: peoplePerConsumption ?? _peoplePerConsumption,
realDiscountPer: realDiscountPer ?? _realDiscountPer,
tableRate: tableRate ?? _tableRate,
);
String get summaryDate => _summaryDate;
String get dayMoney => _dayMoney;
String get discountSum => _discountSum;
String get paySum => _paySum;
String get rechargeMoney => _rechargeMoney;
String get refundMoney => _refundMoney;
num get orderNum => _orderNum;
num get rechargeOrderNum => _rechargeOrderNum;
num get refundOrderNum => _refundOrderNum;
num get payOrderNum => _payOrderNum;
num get discountOrderNum => _discountOrderNum;
dynamic get startDate => _startDate;
dynamic get endDate => _endDate;
dynamic get tablePerConsumption => _tablePerConsumption;
num get numberOfPeople => _numberOfPeople;
String get peoplePerConsumption => _peoplePerConsumption;
dynamic get realDiscountPer => _realDiscountPer;
dynamic get tableRate => _tableRate;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['summaryDate'] = _summaryDate;
map['dayMoney'] = _dayMoney;
map['discountSum'] = _discountSum;
map['paySum'] = _paySum;
map['rechargeMoney'] = _rechargeMoney;
map['refundMoney'] = _refundMoney;
map['orderNum'] = _orderNum;
map['rechargeOrderNum'] = _rechargeOrderNum;
map['refundOrderNum'] = _refundOrderNum;
map['payOrderNum'] = _payOrderNum;
map['discountOrderNum'] = _discountOrderNum;
map['startDate'] = _startDate;
map['endDate'] = _endDate;
map['tablePerConsumption'] = _tablePerConsumption;
map['numberOfPeople'] = _numberOfPeople;
map['peoplePerConsumption'] = _peoplePerConsumption;
map['realDiscountPer'] = _realDiscountPer;
map['tableRate'] = _tableRate;
return map;
}
}

33
lib/retrofit/data/order_trend.dart

@ -0,0 +1,33 @@
/// date : "2023-09-08"
/// number : 0
class OrderTrend {
OrderTrend({
String date,
num number,}){
_date = date;
_number = number;
}
OrderTrend.fromJson(dynamic json) {
_date = json['date'];
_number = json['number'];
}
String _date;
num _number;
OrderTrend copyWith({ String date,
num number,
}) => OrderTrend( date: date ?? _date,
number: number ?? _number,
);
String get date => _date;
num get number => _number;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['date'] = _date;
map['number'] = _number;
return map;
}
}

311
lib/retrofit/data/popular_sales_list.dart

@ -0,0 +1,311 @@
/// dashMemberList : [{"id":"1645357356843794432","name":"哈哈哈","phone":"15623342902","balance":"817.21"},{"id":"1688728183219683328","name":"","phone":"17612711844","balance":"470.00"},{"id":"1693535584301088768","name":"西瓜太郎","phone":"18716285488","balance":"104.00"},{"id":"1645691116772655104","name":"丙阳测试环境","phone":"15827991714","balance":"0.88"},{"id":"1645348000345620480","name":"","phone":"15871490290","balance":"0.02"},{"id":"1685233051375763456","name":"","phone":"18672789329","balance":"0.00"},{"id":"1696812803165257728","name":"","phone":"15723456545","balance":"0.00"},{"id":"1652214301991108608","name":"","phone":"18573164593","balance":"0.00"},{"id":"1646037740963233792","name":"","phone":"13517240850","balance":"0.00"},{"id":"1650818734501134336","name":"","phone":"15172398708","balance":"0.00"},{"id":"1652493162733633536","name":"","phone":"15013675571","balance":"0.00"},{"id":"1646067749123784704","name":"","phone":"13720233327","balance":"0.00"}]
/// saleProductList : [{"product_id":"1646055704735252480","saleNum":12,"product_name":"香蕉牛乳"},{"product_id":"1645714721178910720","saleNum":8,"product_name":"红薯牛乳"},{"product_id":"1645991124428390400","saleNum":3,"product_name":"南瓜牛乳"},{"product_id":"1645722834221137920","saleNum":3,"product_name":"原味豆腐"},{"product_id":"1645992331242897408","saleNum":3,"product_name":"炸鲜香菇"},{"product_id":"1646449156648075264","saleNum":2,"product_name":"桑葚牛乳"},{"product_id":"1645724097411284992","saleNum":2,"product_name":"泡菜"},{"product_id":"1646449942484484096","saleNum":1,"product_name":"芒果牛乳"},{"product_id":"1645667029320990720","saleNum":1,"product_name":"木瓜牛奶"},{"product_id":"1645732366896857088","saleNum":1,"product_name":"酱烤玉米"}]
/// avgPrice : "11.43"
/// orderNum : 21
/// storeDailyStatistics : []
/// orderSum : "259.04"
/// changeData : {"addCartChangeRate":0.0,"payCountChangeRate":0.0,"sumAddCartCount":"0","sumSettleCount":"0","sumPaySuccessCount":"0","sumPV":"0","totalChangeRate":0.0,"sumPayCount":"0","settleChangeRate":0.0,"paySuccessChangeRate":0.0}
/// paySum : "240.00"
class PopularSalesList {
PopularSalesList({
List<DashMemberList> dashMemberList,
List<SaleProductList> saleProductList,
String avgPrice,
num orderNum,
// List<dynamic> storeDailyStatistics,
String orderSum,
ChangeData changeData,
String paySum,}){
_dashMemberList = dashMemberList;
_saleProductList = saleProductList;
_avgPrice = avgPrice;
_orderNum = orderNum;
// _storeDailyStatistics = storeDailyStatistics;
_orderSum = orderSum;
_changeData = changeData;
_paySum = paySum;
}
PopularSalesList.fromJson(dynamic json) {
if (json['dashMemberList'] != null) {
_dashMemberList = [];
json['dashMemberList'].forEach((v) {
_dashMemberList.add(DashMemberList.fromJson(v));
});
}
if (json['saleProductList'] != null) {
_saleProductList = [];
json['saleProductList'].forEach((v) {
_saleProductList.add(SaleProductList.fromJson(v));
});
}
_avgPrice = json['avgPrice'];
_orderNum = json['orderNum'];
// if (json['storeDailyStatistics'] != null) {
// _storeDailyStatistics = [];
// json['storeDailyStatistics'].forEach((v) {
// _storeDailyStatistics.add(Dynamic.fromJson(v));
// });
// }
_orderSum = json['orderSum'];
_changeData = json['changeData'] != null ? ChangeData.fromJson(json['changeData']) : null;
_paySum = json['paySum'];
}
List<DashMemberList> _dashMemberList;
List<SaleProductList> _saleProductList;
String _avgPrice;
num _orderNum;
// List<dynamic> _storeDailyStatistics;
String _orderSum;
ChangeData _changeData;
String _paySum;
PopularSalesList copyWith({ List<DashMemberList> dashMemberList,
List<SaleProductList> saleProductList,
String avgPrice,
num orderNum,
// List<dynamic> storeDailyStatistics,
String orderSum,
ChangeData changeData,
String paySum,
}) => PopularSalesList( dashMemberList: dashMemberList ?? _dashMemberList,
saleProductList: saleProductList ?? _saleProductList,
avgPrice: avgPrice ?? _avgPrice,
orderNum: orderNum ?? _orderNum,
// storeDailyStatistics: storeDailyStatistics ?? _storeDailyStatistics,
orderSum: orderSum ?? _orderSum,
changeData: changeData ?? _changeData,
paySum: paySum ?? _paySum,
);
List<DashMemberList> get dashMemberList => _dashMemberList;
List<SaleProductList> get saleProductList => _saleProductList;
String get avgPrice => _avgPrice;
num get orderNum => _orderNum;
// List<dynamic> get storeDailyStatistics => _storeDailyStatistics;
String get orderSum => _orderSum;
ChangeData get changeData => _changeData;
String get paySum => _paySum;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (_dashMemberList != null) {
map['dashMemberList'] = _dashMemberList.map((v) => v.toJson()).toList();
}
if (_saleProductList != null) {
map['saleProductList'] = _saleProductList.map((v) => v.toJson()).toList();
}
map['avgPrice'] = _avgPrice;
map['orderNum'] = _orderNum;
// if (_storeDailyStatistics != null) {
// map['storeDailyStatistics'] = _storeDailyStatistics.map((v) => v.toJson()).toList();
// }
map['orderSum'] = _orderSum;
if (_changeData != null) {
map['changeData'] = _changeData.toJson();
}
map['paySum'] = _paySum;
return map;
}
}
/// addCartChangeRate : 0.0
/// payCountChangeRate : 0.0
/// sumAddCartCount : "0"
/// sumSettleCount : "0"
/// sumPaySuccessCount : "0"
/// sumPV : "0"
/// totalChangeRate : 0.0
/// sumPayCount : "0"
/// settleChangeRate : 0.0
/// paySuccessChangeRate : 0.0
class ChangeData {
ChangeData({
num addCartChangeRate,
num payCountChangeRate,
String sumAddCartCount,
String sumSettleCount,
String sumPaySuccessCount,
String sumPV,
num totalChangeRate,
String sumPayCount,
num settleChangeRate,
num paySuccessChangeRate,}){
_addCartChangeRate = addCartChangeRate;
_payCountChangeRate = payCountChangeRate;
_sumAddCartCount = sumAddCartCount;
_sumSettleCount = sumSettleCount;
_sumPaySuccessCount = sumPaySuccessCount;
_sumPV = sumPV;
_totalChangeRate = totalChangeRate;
_sumPayCount = sumPayCount;
_settleChangeRate = settleChangeRate;
_paySuccessChangeRate = paySuccessChangeRate;
}
ChangeData.fromJson(dynamic json) {
_addCartChangeRate = json['addCartChangeRate'];
_payCountChangeRate = json['payCountChangeRate'];
_sumAddCartCount = json['sumAddCartCount'];
_sumSettleCount = json['sumSettleCount'];
_sumPaySuccessCount = json['sumPaySuccessCount'];
_sumPV = json['sumPV'];
_totalChangeRate = json['totalChangeRate'];
_sumPayCount = json['sumPayCount'];
_settleChangeRate = json['settleChangeRate'];
_paySuccessChangeRate = json['paySuccessChangeRate'];
}
num _addCartChangeRate;
num _payCountChangeRate;
String _sumAddCartCount;
String _sumSettleCount;
String _sumPaySuccessCount;
String _sumPV;
num _totalChangeRate;
String _sumPayCount;
num _settleChangeRate;
num _paySuccessChangeRate;
ChangeData copyWith({ num addCartChangeRate,
num payCountChangeRate,
String sumAddCartCount,
String sumSettleCount,
String sumPaySuccessCount,
String sumPV,
num totalChangeRate,
String sumPayCount,
num settleChangeRate,
num paySuccessChangeRate,
}) => ChangeData( addCartChangeRate: addCartChangeRate ?? _addCartChangeRate,
payCountChangeRate: payCountChangeRate ?? _payCountChangeRate,
sumAddCartCount: sumAddCartCount ?? _sumAddCartCount,
sumSettleCount: sumSettleCount ?? _sumSettleCount,
sumPaySuccessCount: sumPaySuccessCount ?? _sumPaySuccessCount,
sumPV: sumPV ?? _sumPV,
totalChangeRate: totalChangeRate ?? _totalChangeRate,
sumPayCount: sumPayCount ?? _sumPayCount,
settleChangeRate: settleChangeRate ?? _settleChangeRate,
paySuccessChangeRate: paySuccessChangeRate ?? _paySuccessChangeRate,
);
num get addCartChangeRate => _addCartChangeRate;
num get payCountChangeRate => _payCountChangeRate;
String get sumAddCartCount => _sumAddCartCount;
String get sumSettleCount => _sumSettleCount;
String get sumPaySuccessCount => _sumPaySuccessCount;
String get sumPV => _sumPV;
num get totalChangeRate => _totalChangeRate;
String get sumPayCount => _sumPayCount;
num get settleChangeRate => _settleChangeRate;
num get paySuccessChangeRate => _paySuccessChangeRate;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['addCartChangeRate'] = _addCartChangeRate;
map['payCountChangeRate'] = _payCountChangeRate;
map['sumAddCartCount'] = _sumAddCartCount;
map['sumSettleCount'] = _sumSettleCount;
map['sumPaySuccessCount'] = _sumPaySuccessCount;
map['sumPV'] = _sumPV;
map['totalChangeRate'] = _totalChangeRate;
map['sumPayCount'] = _sumPayCount;
map['settleChangeRate'] = _settleChangeRate;
map['paySuccessChangeRate'] = _paySuccessChangeRate;
return map;
}
}
/// product_id : "1646055704735252480"
/// saleNum : 12
/// product_name : "香蕉牛乳"
class SaleProductList {
SaleProductList({
String productId,
num saleNum,
String productName,}){
_productId = productId;
_saleNum = saleNum;
_productName = productName;
}
SaleProductList.fromJson(dynamic json) {
_productId = json['product_id'];
_saleNum = json['saleNum'];
_productName = json['product_name'];
}
String _productId;
num _saleNum;
String _productName;
SaleProductList copyWith({ String productId,
num saleNum,
String productName,
}) => SaleProductList( productId: productId ?? _productId,
saleNum: saleNum ?? _saleNum,
productName: productName ?? _productName,
);
String get productId => _productId;
num get saleNum => _saleNum;
String get productName => _productName;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['product_id'] = _productId;
map['saleNum'] = _saleNum;
map['product_name'] = _productName;
return map;
}
}
/// id : "1645357356843794432"
/// name : "哈哈哈"
/// phone : "15623342902"
/// balance : "817.21"
class DashMemberList {
DashMemberList({
String id,
String name,
String phone,
String balance,}){
_id = id;
_name = name;
_phone = phone;
_balance = balance;
}
DashMemberList.fromJson(dynamic json) {
_id = json['id'];
_name = json['name'];
_phone = json['phone'];
_balance = json['balance'];
}
String _id;
String _name;
String _phone;
String _balance;
DashMemberList copyWith({ String id,
String name,
String phone,
String balance,
}) => DashMemberList( id: id ?? _id,
name: name ?? _name,
phone: phone ?? _phone,
balance: balance ?? _balance,
);
String get id => _id;
String get name => _name;
String get phone => _phone;
String get balance => _balance;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['name'] = _name;
map['phone'] = _phone;
map['balance'] = _balance;
return map;
}
}

141
lib/retrofit/data/vip_counts_info.dart

@ -0,0 +1,141 @@
/// dayMoney : "0"
/// yesterdayMoney : "0"
/// paySum : "0"
/// yesterdayPaySum : "0"
/// rechargeMoney : "0"
/// weekRechargeMoney : "0"
/// lastWeekRechargeMoney : "0"
/// orderNum : 0
/// yesterdayOrderNum : 0
/// memberNum : 21800
/// lastWeekMemberNum : 4
/// weekMemberNum : 1
/// newMemberNum : 0
/// yesterdayNewMemberNum : 0
class VipCountsInfo {
VipCountsInfo({
String dayMoney,
String yesterdayMoney,
String paySum,
String yesterdayPaySum,
String rechargeMoney,
String weekRechargeMoney,
String lastWeekRechargeMoney,
num orderNum,
num yesterdayOrderNum,
num memberNum,
num lastWeekMemberNum,
num weekMemberNum,
num newMemberNum,
num yesterdayNewMemberNum,}){
_dayMoney = dayMoney;
_yesterdayMoney = yesterdayMoney;
_paySum = paySum;
_yesterdayPaySum = yesterdayPaySum;
_rechargeMoney = rechargeMoney;
_weekRechargeMoney = weekRechargeMoney;
_lastWeekRechargeMoney = lastWeekRechargeMoney;
_orderNum = orderNum;
_yesterdayOrderNum = yesterdayOrderNum;
_memberNum = memberNum;
_lastWeekMemberNum = lastWeekMemberNum;
_weekMemberNum = weekMemberNum;
_newMemberNum = newMemberNum;
_yesterdayNewMemberNum = yesterdayNewMemberNum;
}
VipCountsInfo.fromJson(dynamic json) {
_dayMoney = json['dayMoney'];
_yesterdayMoney = json['yesterdayMoney'];
_paySum = json['paySum'];
_yesterdayPaySum = json['yesterdayPaySum'];
_rechargeMoney = json['rechargeMoney'];
_weekRechargeMoney = json['weekRechargeMoney'];
_lastWeekRechargeMoney = json['lastWeekRechargeMoney'];
_orderNum = json['orderNum'];
_yesterdayOrderNum = json['yesterdayOrderNum'];
_memberNum = json['memberNum'];
_lastWeekMemberNum = json['lastWeekMemberNum'];
_weekMemberNum = json['weekMemberNum'];
_newMemberNum = json['newMemberNum'];
_yesterdayNewMemberNum = json['yesterdayNewMemberNum'];
}
String _dayMoney;
String _yesterdayMoney;
String _paySum;
String _yesterdayPaySum;
String _rechargeMoney;
String _weekRechargeMoney;
String _lastWeekRechargeMoney;
num _orderNum;
num _yesterdayOrderNum;
num _memberNum;
num _lastWeekMemberNum;
num _weekMemberNum;
num _newMemberNum;
num _yesterdayNewMemberNum;
VipCountsInfo copyWith({ String dayMoney,
String yesterdayMoney,
String paySum,
String yesterdayPaySum,
String rechargeMoney,
String weekRechargeMoney,
String lastWeekRechargeMoney,
num orderNum,
num yesterdayOrderNum,
num memberNum,
num lastWeekMemberNum,
num weekMemberNum,
num newMemberNum,
num yesterdayNewMemberNum,
}) => VipCountsInfo( dayMoney: dayMoney ?? _dayMoney,
yesterdayMoney: yesterdayMoney ?? _yesterdayMoney,
paySum: paySum ?? _paySum,
yesterdayPaySum: yesterdayPaySum ?? _yesterdayPaySum,
rechargeMoney: rechargeMoney ?? _rechargeMoney,
weekRechargeMoney: weekRechargeMoney ?? _weekRechargeMoney,
lastWeekRechargeMoney: lastWeekRechargeMoney ?? _lastWeekRechargeMoney,
orderNum: orderNum ?? _orderNum,
yesterdayOrderNum: yesterdayOrderNum ?? _yesterdayOrderNum,
memberNum: memberNum ?? _memberNum,
lastWeekMemberNum: lastWeekMemberNum ?? _lastWeekMemberNum,
weekMemberNum: weekMemberNum ?? _weekMemberNum,
newMemberNum: newMemberNum ?? _newMemberNum,
yesterdayNewMemberNum: yesterdayNewMemberNum ?? _yesterdayNewMemberNum,
);
String get dayMoney => _dayMoney;
String get yesterdayMoney => _yesterdayMoney;
String get paySum => _paySum;
String get yesterdayPaySum => _yesterdayPaySum;
String get rechargeMoney => _rechargeMoney;
String get weekRechargeMoney => _weekRechargeMoney;
String get lastWeekRechargeMoney => _lastWeekRechargeMoney;
num get orderNum => _orderNum;
num get yesterdayOrderNum => _yesterdayOrderNum;
num get memberNum => _memberNum;
num get lastWeekMemberNum => _lastWeekMemberNum;
num get weekMemberNum => _weekMemberNum;
num get newMemberNum => _newMemberNum;
num get yesterdayNewMemberNum => _yesterdayNewMemberNum;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['dayMoney'] = _dayMoney;
map['yesterdayMoney'] = _yesterdayMoney;
map['paySum'] = _paySum;
map['yesterdayPaySum'] = _yesterdayPaySum;
map['rechargeMoney'] = _rechargeMoney;
map['weekRechargeMoney'] = _weekRechargeMoney;
map['lastWeekRechargeMoney'] = _lastWeekRechargeMoney;
map['orderNum'] = _orderNum;
map['yesterdayOrderNum'] = _yesterdayOrderNum;
map['memberNum'] = _memberNum;
map['lastWeekMemberNum'] = _lastWeekMemberNum;
map['weekMemberNum'] = _weekMemberNum;
map['newMemberNum'] = _newMemberNum;
map['yesterdayNewMemberNum'] = _yesterdayNewMemberNum;
return map;
}
}

34
lib/utils/business_instance.dart

@ -0,0 +1,34 @@
class BusinessInstance {
factory BusinessInstance() => _getInstance();
static BusinessInstance get instance => _getInstance();
static BusinessInstance _instance;
String _businessToken;
String _businessTenant;
String get businessToken => _businessToken;
set businessToken(String value) {
_businessToken = value;
}
BusinessInstance._internal() {
//
}
static BusinessInstance _getInstance() {
if (_instance == null) {
_instance = BusinessInstance._internal();
}
return _instance;
}
String get businessTenant => _businessTenant;
set businessTenant(String value) {
_businessTenant = value;
}
}

46
pubspec.lock

@ -155,6 +155,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.1"
equatable:
dependency: transitive
description:
name: equatable
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
event_bus:
dependency: "direct main"
description:
@ -183,6 +190,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.1.4"
fl_chart:
dependency: "direct main"
description:
name: fl_chart
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.62.0"
flare_flutter:
dependency: "direct main"
description:
@ -291,6 +305,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.0+1"
flutter_skeleton:
dependency: "direct main"
description:
name: flutter_skeleton
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0+1"
flutter_slidable:
dependency: "direct main"
description:
@ -398,7 +419,7 @@ packages:
name: image_pickers
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
version: "2.0.4+1"
intl:
dependency: "direct main"
description:
@ -441,6 +462,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
matcher:
dependency: transitive
description:
@ -789,6 +817,20 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
syncfusion_flutter_core:
dependency: transitive
description:
name: syncfusion_flutter_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "19.4.56"
syncfusion_flutter_datepicker:
dependency: "direct main"
description:
name: syncfusion_flutter_datepicker
url: "https://pub.flutter-io.cn"
source: hosted
version: "19.4.56"
table_calendar:
dependency: "direct main"
description:
@ -823,7 +865,7 @@ packages:
name: tobias
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.1"
version: "2.4.2"
tpns_flutter_plugin:
dependency: "direct main"
description:

Loading…
Cancel
Save