|
|
|
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/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 '../../utils/flutter_utils.dart';
|
|
|
|
import '../../utils/font_weight.dart';
|
|
|
|
|
|
|
|
class BusinessHomePage extends StatefulWidget {
|
|
|
|
final BusinessLoginInfo businessLoginInfo;
|
|
|
|
final int selectStoreIndex;
|
|
|
|
final Function changeIndex;
|
|
|
|
final Function changeTab;
|
|
|
|
|
|
|
|
BusinessHomePage(Key key,this.businessLoginInfo, this.selectStoreIndex,
|
|
|
|
this.changeIndex, this.changeTab): super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _BusinessHomePage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _BusinessHomePage extends State<BusinessHomePage> {
|
|
|
|
final RefreshController refreshController = RefreshController();
|
|
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
BusinessApiService businessService;
|
|
|
|
DayCount dayCount;
|
|
|
|
int _loadCount = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_onRefresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
refreshController.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
_onRefresh({int index, isLoading = true}) async {
|
|
|
|
if (isLoading)
|
|
|
|
EasyLoading.show(
|
|
|
|
status: S.current.zhengzaijiazai,
|
|
|
|
maskType: EasyLoadingMaskType.black);
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
if (!mounted) return;
|
|
|
|
businessService = BusinessApiService(Dio(),
|
|
|
|
context: context,
|
|
|
|
token: BusinessInstance.instance.businessToken,
|
|
|
|
tenant: BusinessInstance.instance.businessTenant,
|
|
|
|
storeId: widget.businessLoginInfo
|
|
|
|
.storeList[index ?? widget.selectStoreIndex].name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo
|
|
|
|
.storeList[index ?? widget.selectStoreIndex].id);
|
|
|
|
queryDayAmount();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
addLoadCount() {
|
|
|
|
_loadCount += 1;
|
|
|
|
if (_loadCount == 1) {
|
|
|
|
_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) {
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
|
|
|
|
alignment: Alignment.center);
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
refreshController.loadFailed();
|
|
|
|
});
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
dayCount = baseData.data;
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
addLoadCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: false,
|
|
|
|
header: MyHeader(
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
scrollController: scrollController,
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh: () {
|
|
|
|
_onRefresh(isLoading: false);
|
|
|
|
},
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
homeTop(),
|
|
|
|
commonFunctions(),
|
|
|
|
homeStatistics(),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/service_subscription_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo
|
|
|
|
.storeList[widget.selectStoreIndex].name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget
|
|
|
|
.businessLoginInfo.storeList[widget.selectStoreIndex].id
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 20.h, bottom: 28.h, left: 20.w, right: 23.w),
|
|
|
|
color: Color(0xFFDCE8FC),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "试用期到期时间:",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF252626),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "2024-01-02",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFFF8F1F),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(right: 2.w),
|
|
|
|
child: Text(
|
|
|
|
"去购买服务",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
)),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/icon_right_z.webp",
|
|
|
|
width: 14.h,
|
|
|
|
height: 14.h,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 76.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///首页头部
|
|
|
|
Widget homeTop() {
|
|
|
|
return Container(
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: MediaQuery.of(context).padding.top + 23.h,
|
|
|
|
bottom: 16.h,
|
|
|
|
left: 16.w,
|
|
|
|
right: 16.w),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
widget.changeIndex();
|
|
|
|
//改变导航栏状态栏颜色
|
|
|
|
// 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: () {
|
|
|
|
showIdentitySwitchDialog();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/bs_user_switch.webp",
|
|
|
|
width: 25.h,
|
|
|
|
height: 25.h,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/scan_code_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo
|
|
|
|
.storeList[widget.selectStoreIndex].name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo
|
|
|
|
.storeList[widget.selectStoreIndex].id
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/icon_scan_qr_code.webp",
|
|
|
|
width: 28.h,
|
|
|
|
height: 28.h,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 14.h),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 12.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
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, left: 23.w, right: 23.w),
|
|
|
|
child: Text(
|
|
|
|
dayCount?.paySum ?? "0",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_trade_num.webp",
|
|
|
|
width: 16,
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 3.w),
|
|
|
|
child: Text(
|
|
|
|
"交易笔数",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 5.h, left: 20.w, right: 20.w),
|
|
|
|
child: Text(
|
|
|
|
(dayCount?.orderNum ?? 0).toString(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_refund.webp",
|
|
|
|
width: 14,
|
|
|
|
height: 14,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 3.w),
|
|
|
|
child: Text(
|
|
|
|
"退款金额(元)",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 5.h, left: 20.w, right: 20.w),
|
|
|
|
child: Text(
|
|
|
|
(dayCount?.refundMoney ?? "0.00") == "0"
|
|
|
|
? "0.00"
|
|
|
|
: (dayCount?.refundMoney ?? "0.00"),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_refund_num.webp",
|
|
|
|
width: 14,
|
|
|
|
height: 14,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 3.w),
|
|
|
|
child: Text(
|
|
|
|
"退款笔数",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 5.h, left: 20.w, right: 20.w),
|
|
|
|
child: Text(
|
|
|
|
(dayCount?.refundOrderNum ?? 0).toString(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///用户身份切换
|
|
|
|
showIdentitySwitchDialog() async {
|
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return AlertDialog(
|
|
|
|
content: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
sharedPreferences.setString('identitySwitch', "2");
|
|
|
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
|
|
|
'/router/main_page',
|
|
|
|
(route) => false,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_user_switch_bg.webp",
|
|
|
|
width: 144.h,
|
|
|
|
height: 97.h,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 10.h, bottom: 10.h),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/bs_switch.webp",
|
|
|
|
width: 12.h,
|
|
|
|
height: 12.h,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"切换成用户端",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF30415B),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///常用功能
|
|
|
|
Widget commonFunctions() {
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
margin: EdgeInsets.only(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,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"常用功能",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
GridView.builder(
|
|
|
|
itemCount: commonFunctionsList.length ?? 0,
|
|
|
|
padding: EdgeInsets.only(top: 24.h),
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
crossAxisSpacing: 15.w,
|
|
|
|
mainAxisSpacing: 12.w,
|
|
|
|
),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
commonFunctionsIndex(index);
|
|
|
|
},
|
|
|
|
child: commonFunctionsItem(index));
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///常用功能跳转
|
|
|
|
commonFunctionsIndex(index) async {
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
if ((widget.businessLoginInfo.storeList[widget.selectStoreIndex].name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget
|
|
|
|
.businessLoginInfo.storeList[widget.selectStoreIndex].id) ==
|
|
|
|
"0") {
|
|
|
|
widget.changeIndex();
|
|
|
|
} else {
|
|
|
|
Navigator.of(context).pushNamed('/router/cashier_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo
|
|
|
|
.storeList[widget.selectStoreIndex].name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget
|
|
|
|
.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/vip_recharge_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
Navigator.of(context).pushNamed('/router/add_vip', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/trade_overview_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/business_vip_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
Navigator.of(context).pushNamed('/router/hot_selling_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
Navigator.of(context).pushNamed('/router/flow_page', arguments: {
|
|
|
|
"storeName": widget?.businessLoginInfo
|
|
|
|
?.storeList[widget.selectStoreIndex].name ??
|
|
|
|
"",
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
widget.changeTab(3);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///常用功能板块
|
|
|
|
List<Map<String, String>> commonFunctionsList = [
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_syt.webp",
|
|
|
|
"commonName": "收银台",
|
|
|
|
"imageWidth": "26",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_cz.webp",
|
|
|
|
"commonName": "充值",
|
|
|
|
"imageWidth": "22",
|
|
|
|
"imageHeight": "19"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_bhy.webp",
|
|
|
|
"commonName": "办会员",
|
|
|
|
"imageWidth": "24",
|
|
|
|
"imageHeight": "21"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_syzl.webp",
|
|
|
|
"commonName": "生意总览",
|
|
|
|
"imageWidth": "22",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_hygl.webp",
|
|
|
|
"commonName": "会员管理",
|
|
|
|
"imageWidth": "23",
|
|
|
|
"imageHeight": "25"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_rxbd.webp",
|
|
|
|
"commonName": "热销榜单",
|
|
|
|
"imageWidth": "20",
|
|
|
|
"imageHeight": "26"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_jrls.webp",
|
|
|
|
"commonName": "今日流水",
|
|
|
|
"imageWidth": "22",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_goods.webp",
|
|
|
|
"commonName": "商品",
|
|
|
|
"imageWidth": "21",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
///常用功能Item
|
|
|
|
Widget commonFunctionsItem(index) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
commonFunctionsList[index]["image"],
|
|
|
|
width: double.tryParse(commonFunctionsList[index]["imageWidth"]).w,
|
|
|
|
height: double.tryParse(commonFunctionsList[index]["imageHeight"]).h,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 12.h),
|
|
|
|
child: Text(
|
|
|
|
commonFunctionsList[index]["commonName"],
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF252626),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///统计
|
|
|
|
Widget homeStatistics() {
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
margin: EdgeInsets.only(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,
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"统计",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
GridView.builder(
|
|
|
|
itemCount: homeStatisticsList.length ?? 0,
|
|
|
|
padding: EdgeInsets.only(top: 24.h),
|
|
|
|
shrinkWrap: true,
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
crossAxisSpacing: 15.w,
|
|
|
|
mainAxisSpacing: 12.w,
|
|
|
|
),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
homeStatisticsIndex(index);
|
|
|
|
},
|
|
|
|
child: homeStatisticsItem(index));
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///统计跳转
|
|
|
|
homeStatisticsIndex(index) async {
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/trade_overview_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/business_vip_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
"index": 2
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/business_vip_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
"index": 1
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/consumer_ranking_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
"titleName": "会员余额统计"
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/consumer_ranking_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
"titleName": "消费排名"
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/trade_overview_page', arguments: {
|
|
|
|
"storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
|
|
|
|
.name ==
|
|
|
|
"所有门店"
|
|
|
|
? "0"
|
|
|
|
: widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
|
|
|
|
"index": 2
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///统计板块
|
|
|
|
List<Map<String, String>> homeStatisticsList = [
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_yytj.webp",
|
|
|
|
"commonName": "营业统计",
|
|
|
|
"imageWidth": "21",
|
|
|
|
"imageHeight": "20"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_xfjl.webp",
|
|
|
|
"commonName": "消费记录",
|
|
|
|
"imageWidth": "22",
|
|
|
|
"imageHeight": "21"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_czjl.webp",
|
|
|
|
"commonName": "充值记录",
|
|
|
|
"imageWidth": "19",
|
|
|
|
"imageHeight": "22"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_hyyetj.webp",
|
|
|
|
"commonName": "会员余额统计",
|
|
|
|
"imageWidth": "23",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_xfpm.webp",
|
|
|
|
"commonName": "消费排名",
|
|
|
|
"imageWidth": "26",
|
|
|
|
"imageHeight": "22"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"image": "assets/image/bus_home_goods_ssfx.webp",
|
|
|
|
"commonName": "商品销售分析",
|
|
|
|
"imageWidth": "26",
|
|
|
|
"imageHeight": "23"
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
///统计Item
|
|
|
|
Widget homeStatisticsItem(index) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
homeStatisticsList[index]["image"],
|
|
|
|
width: double.tryParse(homeStatisticsList[index]["imageWidth"]).w,
|
|
|
|
height: double.tryParse(homeStatisticsList[index]["imageHeight"]).h,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 12.h),
|
|
|
|
child: Text(
|
|
|
|
homeStatisticsList[index]["commonName"],
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF252626),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|