Browse Source

商家管理系统登录;

选择门店,首页部分接口更改;
wr_2023_business
huixiang_app 1 year ago
parent
commit
9e35d60145
  1. 257
      lib/business_system/business_page.dart
  2. 611
      lib/business_system/home/business_home_page.dart
  3. 308
      lib/business_system/home/home_view/home_sideslip_dialog.dart
  4. 195
      lib/business_system/home/select_shop.dart
  5. 642
      lib/business_system/login/business_login_page.dart
  6. 2
      lib/main.dart
  7. 322
      lib/mine/mine_view/mine_item.dart
  8. 48
      lib/retrofit/business_api.dart
  9. 92
      lib/retrofit/business_api.g.dart
  10. 281
      lib/retrofit/data/business_login_info.dart
  11. 177
      lib/retrofit/data/day_count.dart
  12. 33
      lib/retrofit/data/order_trend.dart
  13. 311
      lib/retrofit/data/popular_sales_list.dart
  14. 34
      lib/utils/business_instance.dart
  15. 4
      pubspec.lock

257
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,35 +43,30 @@ 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,
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 0;
@ -80,7 +81,9 @@ class _BusinessPage extends State<BusinessPage>
width: 30,
height: 30,
),
SizedBox(height: 5.h,),
SizedBox(
height: 5.h,
),
Text(
"首页",
style: TextStyle(
@ -96,111 +99,135 @@ class _BusinessPage extends State<BusinessPage>
),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 1;
});
},
child: Column(
children: [
Image.asset(
(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,),
Text(
"订单",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 1;
});
},
child: Column(
children: [
Image.asset(
(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,
),
Text(
"订单",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 2 ||
choiceIndex == 3 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
)),
],
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 2;
});
},
child: Image.asset(
"assets/image/business_scan_code.webp",
width: 52,
height: 52,
),
)),
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 2;
});
},
child: Image.asset(
"assets/image/business_scan_code.webp",
width: 52,
height: 52,
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 3;
});
},
child: Column(
children: [
Image.asset(
(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,),
Text(
"商品",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 3;
});
},
child: Column(
children: [
Image.asset(
(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,
),
Text(
"商品",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 4;
});
},
child: Column(
children: [
Image.asset(
(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,),
Text(
"我的",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 4;
});
},
child: Column(
children: [
Image.asset(
(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,
),
Text(
"我的",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: (choiceIndex == 0 ||
choiceIndex == 1 ||
choiceIndex == 2 ||
choiceIndex == 3)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
)),
],
),
)),
],
),
),

611
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, 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")
];
@override
void initState() {
super.initState();
_onRefresh();
}
@override
@ -39,6 +65,75 @@ 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();
queryPopularList();
});
}
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) {
orderTrend = baseData.data;
}
} finally {
addLoadCount();
}
}
@override
Widget build(BuildContext context) {
super.build(context);
@ -58,9 +153,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {});
},
onRefresh: _onRefresh,
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
@ -94,40 +187,59 @@ class _BusinessHomePage extends State<BusinessHomePage>
right: 16.w),
child: Column(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
showAlertDialog();
//
// SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), );
// Navigator.of(context).pushNamed('/router/select_shop');
},
child: Row(
children: [
Image.asset(
"assets/image/bs_more.webp",
width: 16.w,
height: 13.h,
),
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
"海峽姐妹茶 郑州新田360店",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
Row(
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
showAlertDialog(
widget.selectStoreIndex,
widget.businessLoginInfo,
);
//
// SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), );
// Navigator.of(context).pushNamed('/router/select_shop');
},
child: Row(
children: [
Image.asset(
"assets/image/bs_more.webp",
width: 16.w,
height: 13.h,
),
),
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
widget?.businessLoginInfo
?.storeList[widget.selectStoreIndex].name ??
"",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
),
],
),
],
),
)),
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,30 +248,33 @@ class _BusinessHomePage extends State<BusinessHomePage>
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Image.asset(
"assets/image/bs_home_bill.webp",
width: 14,
height: 14,
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"营业额(元)",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF30415B),
Padding(
padding: EdgeInsets.symmetric(horizontal: 23.w),
child: Row(
children: [
Image.asset(
"assets/image/bs_home_bill.webp",
width: 14,
height: 14,
),
),
),
],
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"营业额(元)",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF30415B),
),
),
),
],
)),
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 +286,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 +310,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 +349,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 +369,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 +390,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 +414,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 +465,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 +479,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 +495,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
SizedBox(
height: 18.h,
),
LineChartSample2(lineChartSample2Data,"销售量"),
LineChartSample2(lineChartSample2Data, "销售量"),
],
),
);
@ -371,7 +506,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 +535,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,15 +549,17 @@ class _BusinessHomePage extends State<BusinessHomePage>
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日会员充值",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日会员充值",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
),),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
@ -443,100 +581,108 @@ 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),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日新增会员",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日新增会员",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
],
),
SizedBox(
height: 7.h,
),
Text(
"666",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
),
],
),
)),
SizedBox(width:9.w,),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
SizedBox(
height: 7.h,
),
Text(
"666",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
],
),
)),
SizedBox(
width: 9.w,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"总会员数",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"总会员数",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
],
),
SizedBox(
height: 7.h,
),
Text(
"23455",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
),
],
),
)),
SizedBox(
height: 7.h,
),
Text(
"23455",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
)),
],
)
],
@ -545,18 +691,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 +717,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 +737,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 +754,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 +781,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 +799,19 @@ class _BusinessHomePage extends State<BusinessHomePage>
// color: Color(0xFF0D0D0D),
// ),
// ),
SizedBox(width:8.w,),
Expanded(child:Text(
"满杯花青素",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
"满杯花青素",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),
),),
),
Text(
"已售",
style: TextStyle(
@ -665,40 +820,48 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xFF0D0D0D),
),
),
Padding(padding:EdgeInsets.only(left: 7.w),
child: Text(
"1888件",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
"1888件",
style: TextStyle(
fontSize: 12.sp,
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(
"今日流水",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
)),
"今日流水",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
@ -714,7 +877,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 +890,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 +912,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 +934,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Color(0xD9000000),
),
),
SizedBox(height:7.h,),
SizedBox(
height: 7.h,
),
Text(
"海峽姐妹茶 郑州新田360店",
style: TextStyle(
@ -782,7 +951,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
TextSpan(
children: [
TextSpan(
text:"+",
text: "+",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,

308
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,143 +62,189 @@ class _HomeSideslipDialog extends State<HomeSideslipDialog> with SingleTickerPro
@override
Widget build(BuildContext context) {
return SlideTransition(position: _animation,
child: WillPopScope(
///
onWillPop: () async {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
return true;
},
child: Container(
width: double.infinity,
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(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:EdgeInsets.only(left:14.w,bottom: 33.h),
child: Row(
children: [
Image.asset(
"assets/image/default_user.webp",
width:57,
height:57,
),
SizedBox(width: 10.w,),
Expanded(child:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:[
Text("前进麦味烘焙*海峡姐妹茶",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A)
),),
SizedBox(height: 5.h,),
Text("123****1234",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D)
),),
],
))
],
return SlideTransition(
position: _animation,
child: WillPopScope(
///
onWillPop: () async {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
return true;
},
child: Container(
width: double.infinity,
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(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 14.w, bottom: 33.h),
child: Row(
children: [
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,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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(
AppUtils.phoneEncode(
widget?.businessLoginInfo?.account ?? ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D)),
),
],
))
],
),
),
),
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,
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,
),
SizedBox(
width: 4.w,
),
Text(
"门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)),
),
],
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
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(
widget.businessLoginInfo.storeList[position],
position),
);
},
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
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: (widget.businessLoginInfo.storeList.length > 20)
? 20.h
: 103.h,
top: 20.h),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4.w),
),
SizedBox(width: 4.w,),
Text("门店切换",
child: Text(
"退出登录",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)
),),
],
),),
Expanded(child:ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: shopItem(),
);
},
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
},
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),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4.w),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white),
),
),
child:Text("退出登录",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
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)
),)),
Icon(
Icons.check,
size: 20,
color: Color(0xFF4D4D4D),)
color: selectIndex == index
? Color(0xFF30415B)
: Color(0xFF4D4D4D)),
)),
if (selectIndex == index)
Icon(
Icons.check,
size: 20,
color: Color(0xFF4D4D4D),
)
],
),
);

195
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,86 +22,107 @@ 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(
backgroundColor: Colors.white,
appBar: MyAppBar(
title: "选择门店",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
brightness: Brightness.dark,
return Scaffold(
backgroundColor: Colors.white,
appBar: MyAppBar(
title: "选择门店",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
height: double.infinity,
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,
),
SizedBox(width: 4.w,),
Text("门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)
),),
],
),
SizedBox(height:20.h,),
Expanded(child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:20,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: shopsItem(),
);
},
)),
Container(
),
onRefresh: () {},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
height: double.infinity,
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,
),
SizedBox(
width: 4.w,
),
Text(
"门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)),
),
],
),
SizedBox(
height: 20.h,
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: businessLoginInfo?.storeList?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
selectIndex = position;
});
},
child: shopsItem(
businessLoginInfo?.storeList[position], position),
);
},
)),
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,14 +131,15 @@ class _SelectShop extends State<SelectShop> {
),
),
),
],
),
),
],
),
),
);
),
);
}
Widget shopsItem(){
Widget shopsItem(StoreList storeList, index) {
return Container(
height: 52.h,
margin: EdgeInsets.only(bottom: 12),
@ -123,30 +150,34 @@ 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)
),),
),
Image.asset(
"assets/image/bs_shop.webp",
width: 20,
height: 20,
fit: BoxFit.fill,
color: selectIndex == index
? Color(0xFF30415B)
: Color(0xFF0D0D0D)),
),
),
if (selectIndex == index)
Image.asset(
"assets/image/bs_shop.webp",
width: 20,
height: 20,
fit: BoxFit.fill,
),
],
),
);
}
}

642
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,240 +55,467 @@ 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(
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),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: 5.w),
child: Text("您好!",
style: TextStyle(
fontSize: 26.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.bold)),
),
Padding(
padding: EdgeInsets.only(left: 5.w, top: 15.h),
child: Text("欢迎使用回乡收银商家APP",
style: TextStyle(
fontSize: 16.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium)),
),
SizedBox(height: 160.h),
Row(
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),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/business_phone.webp",
width:10.w,
height:15.h,
Padding(
padding: EdgeInsets.only(left: 5.w),
child: Text("您好!",
style: TextStyle(
fontSize: 26.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.bold)),
),
SizedBox(width:4.w),
Text("手机号码",
Padding(
padding: EdgeInsets.only(left: 5.w, top: 15.h),
child: Text("欢迎使用回乡收银商家APP",
style: TextStyle(
fontSize: 16.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium)),
),
SizedBox(height: 160.h),
Row(
children: [
Image.asset(
"assets/image/business_phone.webp",
width: 10.w,
height: 15.h,
),
SizedBox(width: 4.w),
Text("手机号码",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xD9000000),
fontWeight: MyFontWeight.bold))
],
),
Container(
margin: EdgeInsets.only(top: 13.h, bottom: 24.h),
child: TextField(
controller: _userPhoneController,
keyboardType: TextInputType.phone,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xD9000000),
fontWeight: MyFontWeight.bold))
],
),
Container(
margin: EdgeInsets.only(top: 13.h, bottom: 24.h),
child: TextField(
controller: _userPhoneController,
keyboardType: TextInputType.phone,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular),
decoration: InputDecoration(
hintText: "请输入手机号码",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFF262626),
fontWeight: MyFontWeight.regular),
contentPadding: EdgeInsets.only(
left: 12.w, top: 16.h, bottom: 15.h),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(4),
borderSide: BorderSide.none),
filled: true,
fillColor: Color(0xFFF8F9FA),
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular),
decoration: InputDecoration(
hintText: "请输入手机号码",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFF262626),
fontWeight: MyFontWeight.regular),
contentPadding: EdgeInsets.only(
left: 12.w, top: 16.h, bottom: 15.h),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(4),
borderSide: BorderSide.none),
filled: true,
fillColor: Color(0xFFF8F9FA),
),
onChanged: (value) {
if (value.isEmpty) {
phoneInputTips = "请输入手机号码";
} else {
phoneInputTips = null;
}
refresh();
},
inputFormatters: [
LengthLimitingTextInputFormatter(11)
],
),
),
onChanged: (value) {
if (value.isEmpty) {
_phoneInputTips = "请输入手机号码";
} else {
_phoneInputTips = null;
}
refresh();
},
),
),
Row(
children: [
Image.asset(
"assets/image/business_code.webp",
width:12.w,
height:15.h,
Row(
children: [
Image.asset(
"assets/image/business_code.webp",
width: 12.w,
height: 15.h,
),
SizedBox(width: 4.w),
Text("密码",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xD9000000),
fontWeight: MyFontWeight.bold))
],
),
SizedBox(width:4.w),
Text("密码",
Container(
margin: EdgeInsets.only(top: 12.h, bottom: 75.h),
child: TextField(
controller: _passwordController,
keyboardType: TextInputType.phone,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xD9000000),
fontWeight: MyFontWeight.bold))
],
),
Container(
margin: EdgeInsets.only(top: 12.h, bottom: 75.h),
child: TextField(
controller: _passwordController,
keyboardType: TextInputType.phone,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular),
decoration: InputDecoration(
hintText: "请输入密码",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFF262626),
fontWeight: MyFontWeight.regular),
contentPadding: EdgeInsets.only(
left: 12.w, top: 16.h, bottom: 15.h),
border: OutlineInputBorder(
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular),
decoration: InputDecoration(
hintText: "请输入密码",
hintStyle: TextStyle(
fontSize: 14.sp,
color: Color(0xFF262626),
fontWeight: MyFontWeight.regular),
contentPadding: EdgeInsets.only(
left: 12.w, top: 16.h, bottom: 15.h),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(4),
borderSide: BorderSide.none),
filled: true,
fillColor: Color(0xFFF8F9FA),
),
onChanged: (value) {
if (value.isEmpty) {
pwdInputTips = "请输入密码";
} else {
pwdInputTips = null;
}
refresh();
},
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
login();
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 15.h),
margin: EdgeInsets.only(bottom: 22.h),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4),
borderSide: BorderSide.none),
filled: true,
fillColor: Color(0xFFF8F9FA),
),
child: Text(S.of(context).login,
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: MyFontWeight.bold)),
),
),
onChanged: (value) {
if (value.isEmpty) {
_pwdInputTips = "请输入密码";
} else {
_pwdInputTips = null;
}
refresh();
},
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushReplacementNamed('/router/business_page');
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 15.h),
margin: EdgeInsets.only(bottom: 22.h),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Checkbox(
value: checkStatus,
onChanged: (a) {
setState(() {
checkStatus = !checkStatus;
});
},
checkColor: Color(0xFFFFFFFF),
fillColor:
MaterialStateProperty.all(Color(0xFF30415B)),
),
Expanded(
child: Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).privacy_policy1,
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
),
),
TextSpan(
// text: S.of(context).privacy_policy2,
text: "《一心回乡用户协议》",
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context).pushNamed(
'/router/user_service_page');
},
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
),
),
TextSpan(
text: "",
style: TextStyle(
fontSize: 11.sp,
color: Colors.black,
),
),
TextSpan(
text: S.of(context).privacy_policy3,
recognizer: tapGestureRecognizer,
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
),
),
TextSpan(
text: S.of(context).privacy_policy4,
style: TextStyle(
fontSize: 11.sp,
height: 1.2,
color: Color(0xFF010101),
),
),
]),
)),
SizedBox(
width: 30,
)
],
),
child: Text(S.of(context).login,
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: MyFontWeight.bold)),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 98.h),
child: Image.asset(
"assets/image/business_login.webp",
fit: BoxFit.cover,
width: double.infinity,
height: 199.h,
),
)
],
),
),
)),
);
}
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),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
child: Column(
children: [
Checkbox(
value: checkStatus,
onChanged: (a) {
setState(() {
checkStatus = !checkStatus;
});
},
checkColor: Color(0xFFFFFFFF),
fillColor:
MaterialStateProperty.all(Color(0xFF30415B)),
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,
),
),
),
Expanded(
child: Text.rich(
Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).privacy_policy1,
text: S.of(context).yinsizhengce1,
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
height: 1.3.h,
color: Color(0xff727272),
),
),
TextSpan(
// text: S.of(context).privacy_policy2,
text: "《一心回乡用户协议》",
text: S.of(context).yinsixieyi,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xff32A060)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.pushNamed('/router/user_service_page');
.popAndPushNamed('/router/treaty_page');
},
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
),
),
TextSpan(
text: "",
style: TextStyle(
fontSize: 11.sp,
color: Colors.black,
),
),
TextSpan(
text: S.of(context).privacy_policy3,
recognizer: tapGestureRecognizer,
style: TextStyle(
fontSize: 11.sp,
color: Color(0xFF010101),
),
),
TextSpan(
text: S.of(context).privacy_policy4,
style: TextStyle(
fontSize: 11.sp,
height: 1.2,
color: Color(0xFF010101),
),
),
]),
)),
),
SizedBox(
width: 30,
)
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,
),
],
),
],
),
),
Container(
margin: EdgeInsets.only(top: 98.h),
child: Image.asset(
"assets/image/business_login.webp",
fit: BoxFit.cover,
width: double.infinity,
height: 199.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,
),
],
),
],
)
],
),
),
),
);
},
);
}
}

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}) =>

322
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)
.pushReplacementNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
});
} else {
Navigator.of(context)
.pushReplacementNamed('/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,76 +181,85 @@ class _MineItem extends State<MineItem> {
// ),
// ),),
///
Expanded(child:
InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/coupon_page');
});
},
child: mineItem(
S.of(context).youhuiquan,
"assets/image/coupon.webp",
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/coupon_page');
});
},
child: mineItem(
S.of(context).youhuiquan,
"assets/image/coupon.webp",
),
),
),
),
///
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_wallet');
});
},
child: mineItem(
S.of(context).huixiangqianbao,
"assets/image/platform_yue.webp",
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_wallet');
});
},
child: mineItem(
S.of(context).huixiangqianbao,
"assets/image/platform_yue.webp",
),
),
),),
),
///
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_shop_page');
});
},
child: mineItem(
"店铺充值",
"assets/image/shop_yue.webp",
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_shop_page');
});
},
child: mineItem(
"店铺充值",
"assets/image/shop_yue.webp",
),
),
),),
),
///
Expanded(child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/exchange_history_page');
});
},
child: mineItem(
S.of(context).duihuanlishi,
"assets/image/icon_mine_records_of_consumption.webp",
Expanded(
child: InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/exchange_history_page');
});
},
child: 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,36 +321,56 @@ class _MineItem extends State<MineItem> {
// ),
// ),),
///
Expanded(child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/help_feedback_page');
},
child: mineItem(
S.of(context).bangzhuyufankui,
"assets/image/fan_kui.webp",
Expanded(
child: InkWell(
onTap: () {
Navigator.of(context)
.pushNamed('/router/help_feedback_page');
},
child: mineItem(
S.of(context).bangzhuyufankui,
"assets/image/fan_kui.webp",
),
),
),),
),
///
Expanded(child: InkWell(
onTap: () {
showCallMobile();
},
child: mineItem(
S.of(context).lianxikefu,
"assets/image/icon_mine_online_service.webp",
Expanded(
child: InkWell(
onTap: () {
showCallMobile();
},
child: mineItem(
S.of(context).lianxikefu,
"assets/image/icon_mine_online_service.webp",
),
),
),),
),
///
Expanded(child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/business_login_page');
},
child: mineItem(
"商家管理",
"assets/image/business.webp",
Expanded(
child: InkWell(
onTap: () {
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: () {
@ -311,19 +390,21 @@ class _MineItem extends State<MineItem> {
// "assets/image/pin_tuan.webp",
// ),
// ),),
// Expanded(child:InkWell(
// onTap: () {
// Navigator.of(context).pushNamed('/router/invitation_record', arguments: {});
// },
// child: mineItem(
// "邀请记录",
// "assets/image/yao_q.webp",
// ),
// ),),
// Expanded(child:InkWell(
// onTap: () {
// Navigator.of(context).pushNamed('/router/invitation_record', arguments: {});
// },
// child: mineItem(
// "邀请记录",
// "assets/image/yao_q.webp",
// ),
// ),),
],
),
),
// 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,
@ -386,8 +474,8 @@ class _MineItem extends State<MineItem> {
// ],
// ),),
// )
],
),
],
),
);
}
@ -396,7 +484,7 @@ class _MineItem extends State<MineItem> {
return Container(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 6.h),
child: Column(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -428,15 +516,15 @@ class _MineItem extends State<MineItem> {
return CupertinoActionSheet(
title: Text(S.of(context).bodadianhua),
actions: [
CupertinoActionSheetAction(
child: Text("19947603193"),
onPressed: () {
callMobile("19947603193");
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
CupertinoActionSheetAction(
child: Text("19947603193"),
onPressed: () {
callMobile("19947603193");
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {

48
lib/retrofit/business_api.dart

@ -6,16 +6,24 @@ 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: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://admin-api.test.yixinhuixiang.com/";
///
// const localBaseUrl = "http://test-merchant.lotus-wallet.com/";
const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/";
///线
const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/";
const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/";
@RestApi(baseUrl: localBaseUrl)
abstract class BusinessApiService {
@ -26,11 +34,19 @@ abstract class BusinessApiService {
String token,
bool showLoading = false,
String url,
String tenant,
String storeId,
bool showErrorToast = true,
}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
baseUrl = serviceBaseUrl;
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,
@ -40,8 +56,7 @@ abstract class BusinessApiService {
baseUrl: baseUrl,
);
dio.interceptors.add(
InterceptorsWrapper(onRequest:
(RequestOptions options) {
InterceptorsWrapper(onRequest: (RequestOptions options) {
debugPrint("\n======================= 请求数据 =======================");
debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}");
@ -83,7 +98,9 @@ abstract class BusinessApiService {
debugPrint("======================= 响应数据结束 =======================\n");
}, onError: (DioError e) {
if (EasyLoading.isShow) EasyLoading.dismiss();
SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center);
// SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center);
SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type),
alignment: Alignment.center);
debugPrint("\n======================= 错误响应数据 =======================");
debugPrint("type = ${e.type}");
debugPrint("message = ${e.message}");
@ -107,4 +124,21 @@ abstract class BusinessApiService {
//
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}")
Future<BaseData<PopularSalesList>> popularList(
@Path("offsetDay") String offsetDay);
////
@GET("trend/orderTrend")
Future<BaseData<List<OrderTrend>>> orderTrend();
}

92
lib/retrofit/business_api.g.dart

@ -9,6 +9,7 @@ part of 'business_api.dart';
class _BusinessApiService implements BusinessApiService {
_BusinessApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= kReleaseMode ? serviceBaseUrl : localBaseUrl;
}
final Dio _dio;
@ -20,4 +21,95 @@ class _BusinessApiService implements BusinessApiService {
_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',
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;
}
}

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

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

4
pubspec.lock

@ -433,7 +433,7 @@ packages:
name: image_pickers
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.4+1"
version: "2.0.0"
intl:
dependency: "direct main"
description:
@ -879,7 +879,7 @@ packages:
name: tobias
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.2"
version: "2.4.1"
tpns_flutter_plugin:
dependency: "direct main"
description:

Loading…
Cancel
Save