Browse Source

商品板块新增:新建商品;

底部导航栏整体布局结构优化重构;
我的页面bug处理;
核销页面bug处理;
门店选择页面新增接口,数据优化调整;
会员充值页面ui调整;
wr_2023_new_business
wurong 1 year ago
parent
commit
475958179a
  1. BIN
      assets/image/2x/bus_goods_add.webp
  2. BIN
      assets/image/3x/bus_goods_add.webp
  3. BIN
      assets/image/bus_goods_add.webp
  4. 377
      lib/business_system/business_page.dart
  5. 147
      lib/business_system/goods/business_goods_page.dart
  6. 405
      lib/business_system/home/business_home_page.dart
  7. 43
      lib/business_system/home/select_shop.dart
  8. 1
      lib/business_system/home/vip/vip_recharge_page.dart
  9. 310
      lib/business_system/mine/business_mine_page.dart
  10. 8
      lib/business_system/order/business_order_page.dart
  11. 212
      lib/business_system/order/order_write_off.dart

BIN
assets/image/2x/bus_goods_add.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

BIN
assets/image/3x/bus_goods_add.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

BIN
assets/image/bus_goods_add.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

377
lib/business_system/business_page.dart

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/business_system/goods/business_goods_page.dart'; import 'package:huixiang/business_system/goods/business_goods_page.dart';
@ -8,6 +10,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/business_login_info.dart'; import '../retrofit/data/business_login_info.dart';
import 'home/business_home_page.dart'; import 'home/business_home_page.dart';
import 'home/home_view/home_sideslip_dialog.dart';
class BusinessPage extends StatefulWidget { class BusinessPage extends StatefulWidget {
final arguments; final arguments;
@ -25,6 +28,13 @@ class _BusinessPage extends State<BusinessPage>
int choiceIndex = 0; int choiceIndex = 0;
BusinessLoginInfo businessLoginInfo; BusinessLoginInfo businessLoginInfo;
int selectStoreIndex = 0; int selectStoreIndex = 0;
int switchStore = 0;
GlobalKey homePageKey = GlobalKey();
GlobalKey orderPageKey = GlobalKey();
GlobalKey goodsPageKey = GlobalKey();
GlobalKey minePageKey = GlobalKey();
var clickIndex = 0;
final PageController pageController = PageController();
@override @override
void initState() { void initState() {
@ -36,204 +46,205 @@ class _BusinessPage extends State<BusinessPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Stack( return Scaffold(
children: [ resizeToAvoidBottomInset: false,
Container( body: Stack(
color: Color(0xFFF7F7F7), alignment: Alignment.bottomRight,
), children: [
Stack( Container(
children: [ child: PageView(
if (choiceIndex == 0) controller: pageController,
BusinessHomePage(businessLoginInfo, selectStoreIndex, (index) { children: [
BusinessHomePage(
homePageKey, businessLoginInfo, selectStoreIndex, showAlertDialog,
(index) {
setState(() {
pageController.jumpToPage(2);
});
}),
BusinessOrderPage(orderPageKey,
businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
BusinessGoodsPage(goodsPageKey,
businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
BusinessMinePage(minePageKey, businessLoginInfo,
businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
],
physics: NeverScrollableScrollPhysics(),
onPageChanged: (index) {
clickIndex = index;
setState(() {});
},
),
),
if (switchStore == 0)
GestureDetector(
onTap: () {
setState(() { setState(() {
selectStoreIndex = index; switchStore = 1;
showAlertDialog();
}); });
},(index){ },
setState((){
choiceIndex = 3;
});
}),
if (choiceIndex == 1) BusinessOrderPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
// if (choiceIndex == 2) BusinessScanCode(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
if (choiceIndex == 3) BusinessGoodsPage(businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
if (choiceIndex == 4) BusinessMinePage(businessLoginInfo,businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"),
Align(
alignment: Alignment.bottomCenter,
child: Container( child: Container(
height: 85.h, width: 97.w,
width: double.infinity, decoration: BoxDecoration(
color: Colors.white, color: Color(0xFFEBEFF6),
padding: EdgeInsets.only(top: 20.h), borderRadius: BorderRadius.only(
topLeft: Radius.circular(111),
bottomLeft: Radius.circular(111),
),
),
padding: EdgeInsets.only(left: 12.w, top: 10.h, bottom: 10.h),
margin: EdgeInsets.only(bottom: 170.h),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Padding(
child: GestureDetector( padding: EdgeInsets.only(right: 4.w),
behavior: HitTestBehavior.opaque, child: Image.asset(
onTap: () { "assets/image/bs_switch.webp",
setState(() { width: 12.w,
choiceIndex = 0; height: 15.h,
}); )),
}, Text(
child: Column( "切换门店",
children: [ textAlign: TextAlign.center,
Image.asset( style: TextStyle(
choiceIndex == 0 color: Color(0xFF30415B),
? "assets/image/business_home.webp" fontSize: 12.sp,
: "assets/image/business_ home_h.webp", fontWeight: MyFontWeight.semi_bold,
width: 30,
height: 30,
),
SizedBox(
height: 5.h,
),
Text(
"首页",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: choiceIndex == 0
? Color(0xFF4C4C4C)
: Color(0xFFACACAC),
),
),
],
)),
),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 1;
});
},
child: Column(
children: [
Image.asset(
(choiceIndex == 0 ||
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 == 3 ||
choiceIndex == 4)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/scan_code_page', arguments:{"storeId":businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"});
},
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 == 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 == 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 == 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 == 3)
? Color(0xFFACACAC)
: Color(0xFF4C4C4C),
),
),
],
),
)),
], ],
), ),
), ),
), ),
],
),
extendBody: true,
bottomNavigationBar: Container(
alignment: Platform.isAndroid ? Alignment.center : Alignment.topCenter,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
], ],
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
), ),
], height: 82.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
bottomNavigationItem("首页", 0, "assets/image/business_home.webp",
"assets/image/business_ home_h.webp"),
bottomNavigationItem("订单", 1, "assets/image/business_order.webp",
"assets/image/business_order_h.webp"),
// bottomNavigationItem("", 2,"assets/image/business_scan_code.webp","assets/image/business_scan_code.webp"),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/scan_code_page', arguments: {
"storeId":
businessLoginInfo?.storeList[selectStoreIndex]?.id ?? "0"
});
},
child: Container(
padding: EdgeInsets.only(top: 10.h),
child: Image.asset(
"assets/image/business_scan_code.webp",
width: 52.h,
height: 52.h,
),
),
),
bottomNavigationItem("商品", 2, "assets/image/business_goods.webp",
"assets/image/business_goods_h.webp"),
bottomNavigationItem("我的", 3, "assets/image/business_mine.webp",
"assets/image/business_mine_h.webp"),
],
),
),
);
}
Widget bottomNavigationItem(text, index, image, unImage) {
var isSelected = index == clickIndex;
return Expanded(
child: InkWell(
onTap: () {
setState(() {
clickIndex = index;
pageController.jumpToPage(clickIndex);
});
},
child: Container(
width: 45.w,
child: Column(
mainAxisAlignment: Platform.isAndroid
? MainAxisAlignment.center
: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (Platform.isIOS)
SizedBox(
height: 4.h,
),
Image.asset(
isSelected ? image : unImage,
width: 30.h,
height: 30.h,
),
Text(
text,
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: isSelected ? Color(0xFF4C4C4C) : Color(0xFFACACAC),
),
),
],
),
),
),
flex: 1,
); );
} }
///
showAlertDialog() async {
try {
int index = await showCupertinoModalPopup(
builder: (context) {
return HomeSideslipDialog(selectStoreIndex, businessLoginInfo);
},
context: context);
if (index != null) {
if (index == -1) {
Navigator.of(context).pop();
return;
}
setState(() {
selectStoreIndex = index;
homePageKey = GlobalKey();
orderPageKey = GlobalKey();
goodsPageKey = GlobalKey();
minePageKey = GlobalKey();
});
}
} finally {
setState(() {
switchStore = 0;
});
}
}
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

147
lib/business_system/goods/business_goods_page.dart

@ -1,17 +1,19 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/business_system/goods/off_shelf/off_shelf_page.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_tab.dart'; import '../../view_widget/my_tab.dart';
import '../order/ticket/ticket_tab.dart';
import 'off_shelf/off_shelf_page.dart';
import 'on_sale/on_sale_page.dart'; import 'on_sale/on_sale_page.dart';
class BusinessGoodsPage extends StatefulWidget { class BusinessGoodsPage extends StatefulWidget {
final String storeId; final String storeId;
BusinessGoodsPage(this.storeId); BusinessGoodsPage(Key key,this.storeId): super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -19,12 +21,11 @@ class BusinessGoodsPage extends StatefulWidget {
} }
} }
class _BusinessGoodsPage extends State<BusinessGoodsPage> class _BusinessGoodsPage extends State<BusinessGoodsPage> {
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
String offShelfTotal; String offShelfTotal;
String onSaleTotal; String onSaleTotal;
int goodsIndex = 0;
@override @override
void initState() { void initState() {
@ -33,59 +34,93 @@ class _BusinessGoodsPage extends State<BusinessGoodsPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context);
return Column( return Column(
children: [ children: [
Expanded(child: Expanded(
DefaultTabController( child:
length: 2, DefaultTabController(
child: Scaffold( length: 3,
appBar: MyAppBar( child: Scaffold(
title:"", appBar: MyAppBar(
leading: false, title:"",
background: Colors.white, leading: false,
toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, background: Colors.white,
bottom: TabBar( toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight,
// isScrollable: true, // bottom: TabBar(
// // isScrollable: true, //
overlayColor: MaterialStateProperty.all(Colors.white), //
indicatorColor: Color(0xFF30415B), overlayColor: MaterialStateProperty.all(Colors.white),
labelColor: Colors.black, indicatorColor: Color(0xFF30415B),
labelStyle: TextStyle( labelColor: Colors.black,
fontSize: 15.sp, labelStyle: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15.sp,
fontWeight: FontWeight.bold,
),
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.normal,
color: Color(0xFF666666)
),
indicator: const TicketTab(
width: 33,
borderSide: BorderSide(
width: 2.0, color: Color(0xFF30415B))),
// controller: tabController,
//
unselectedLabelColor: Color(0xffA29E9E),
indicatorSize: TabBarIndicatorSize.label,
//
tabs: <Widget>[
MyTab(text:"在售中(${onSaleTotal ?? "0"})"),
MyTab(text: "已下架(${offShelfTotal ?? "0"})"),
GestureDetector(
onTap: (){
Navigator.of(context).pushNamed(
'/router/add_goods_page',
arguments: {
"storeId":widget.storeId ?? "",
});
},
child:Row(children: [Padding(
padding: EdgeInsets.only(right: 5.w),
child: Text(
"新增商品",
textAlign: TextAlign.center,
style: TextStyle(
height: 1.5,
color: Color(0xFF2E3552),
fontSize: 16.sp,
fontWeight: MyFontWeight.bold,
),
)), Image.asset(
"assets/image/bus_goods_add.webp",
width: 14.w,
height: 15.h,
),
]),
),
],
),
),
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
OnSalePage(widget.storeId,(value){
setState((){
onSaleTotal = value;
});
}),
OffShelfPage(widget.storeId,(value){
setState((){
offShelfTotal = value;
});
}),
Container()
],
),
),
), ),
unselectedLabelStyle: TextStyle( ),
fontSize: 15.sp,
fontWeight: FontWeight.normal,
color: Color(0xFF666666)
),
// controller: tabController,
//
unselectedLabelColor: Color(0xffA29E9E),
indicatorSize: TabBarIndicatorSize.label,
//
tabs: <Widget>[
MyTab(text:"在售中(${onSaleTotal ?? "0"})"),
MyTab(text: "已下架(${offShelfTotal ?? "0"})"),
],
),
),
body: TabBarView(
children: [
OnSalePage(widget.storeId,(value){
setState((){
onSaleTotal = value;
});
}),
OffShelfPage(widget.storeId,(value){
setState((){
offShelfTotal = value;
});
})],
),
),
),),
SizedBox( SizedBox(
height: 76.h, height: 76.h,
), ),
@ -93,6 +128,4 @@ class _BusinessGoodsPage extends State<BusinessGoodsPage>
); );
} }
@override
bool get wantKeepAlive => true;
} }

405
lib/business_system/home/business_home_page.dart

@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/business_system/home/home_view/home_sideslip_dialog.dart';
import 'package:huixiang/utils/business_instance.dart'; import 'package:huixiang/utils/business_instance.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
@ -19,7 +18,6 @@ import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/day_count.dart'; import '../../retrofit/data/day_count.dart';
import '../../utils/flutter_utils.dart'; import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart'; import '../../utils/font_weight.dart';
import '../../view_widget/settlement_tips_dialog.dart';
class BusinessHomePage extends StatefulWidget { class BusinessHomePage extends StatefulWidget {
final BusinessLoginInfo businessLoginInfo; final BusinessLoginInfo businessLoginInfo;
@ -27,8 +25,8 @@ class BusinessHomePage extends StatefulWidget {
final Function changeIndex; final Function changeIndex;
final Function changeTab; final Function changeTab;
BusinessHomePage( BusinessHomePage(Key key,this.businessLoginInfo, this.selectStoreIndex,
this.businessLoginInfo, this.selectStoreIndex, this.changeIndex,this.changeTab); this.changeIndex, this.changeTab): super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -36,8 +34,7 @@ class BusinessHomePage extends StatefulWidget {
} }
} }
class _BusinessHomePage extends State<BusinessHomePage> class _BusinessHomePage extends State<BusinessHomePage> {
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
BusinessApiService businessService; BusinessApiService businessService;
@ -48,30 +45,32 @@ class _BusinessHomePage extends State<BusinessHomePage>
void initState() { void initState() {
super.initState(); super.initState();
_onRefresh(); _onRefresh();
} }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
refreshController.dispose();
} }
_onRefresh({int index, isLoading = true}) async { _onRefresh({int index, isLoading = true}) async {
if (isLoading) if (isLoading)
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
if (!mounted) return;
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),
context: context, context: context,
token: BusinessInstance.instance.businessToken, token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant, tenant: BusinessInstance.instance.businessTenant,
storeId: widget.businessLoginInfo storeId: widget.businessLoginInfo
.storeList[index ?? widget.selectStoreIndex].name == .storeList[index ?? widget.selectStoreIndex].name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo
.storeList[index ?? widget.selectStoreIndex].id); .storeList[index ?? widget.selectStoreIndex].id);
queryDayAmount(); queryDayAmount();
}); });
} }
@ -106,7 +105,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context);
return Column( return Column(
children: [ children: [
Expanded( Expanded(
@ -140,6 +138,68 @@ class _BusinessHomePage extends State<BusinessHomePage>
), ),
), ),
), ),
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( SizedBox(
height: 76.h, height: 76.h,
), ),
@ -165,10 +225,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
showAlertDialog( widget.changeIndex();
widget.selectStoreIndex,
widget.businessLoginInfo,
);
// //
// SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), ); // SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.white), );
// Navigator.of(context).pushNamed('/router/select_shop'); // Navigator.of(context).pushNamed('/router/select_shop');
@ -407,26 +464,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
); );
} }
///
showAlertDialog(
selectStoreIndex,
businessLoginInfo,
) async {
int index = await showCupertinoModalPopup(
builder: (context) {
return HomeSideslipDialog(selectStoreIndex, businessLoginInfo);
},
context: context);
if (index != null) {
if (index == -1) {
Navigator.of(context).pop();
return;
}
widget.changeIndex(index);
_onRefresh(index: index);
}
}
/// ///
showIdentitySwitchDialog() async { showIdentitySwitchDialog() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
@ -488,8 +525,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
Widget commonFunctions() { Widget commonFunctions() {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom:16.h), margin: EdgeInsets.only(bottom: 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( child: Column(
children: [ children: [
Row( Row(
@ -511,13 +549,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
), ),
GridView.builder( GridView.builder(
itemCount:commonFunctionsList.length ?? 0, itemCount: commonFunctionsList.length ?? 0,
padding: EdgeInsets.only(top:24.h), padding: EdgeInsets.only(top: 24.h),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, crossAxisCount: 4,
crossAxisSpacing:15.w, crossAxisSpacing: 15.w,
mainAxisSpacing: 12.w, mainAxisSpacing: 12.w,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -538,119 +576,144 @@ class _BusinessHomePage extends State<BusinessHomePage>
commonFunctionsIndex(index) async { commonFunctionsIndex(index) async {
switch (index) { switch (index) {
case 0: case 0:
if ((widget.businessLoginInfo if ((widget.businessLoginInfo.storeList[widget.selectStoreIndex].name ==
.storeList[widget.selectStoreIndex].name == "所有门店"
"所有门店" ? "0"
? "0" : widget
: widget.businessLoginInfo .businessLoginInfo.storeList[widget.selectStoreIndex].id) ==
.storeList[widget.selectStoreIndex].id) == "0") { "0") {
SmartDialog.show( widget.changeIndex();
widget: SettlementTips( } else {
() {},
text: "请选择门店进行收银操作",
color: Color(0xFF30415B),
));
}else{
Navigator.of(context).pushNamed('/router/cashier_page', arguments: { Navigator.of(context).pushNamed('/router/cashier_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo
.storeList[widget.selectStoreIndex].name == .storeList[widget.selectStoreIndex].name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget
.storeList[widget.selectStoreIndex].id, .businessLoginInfo.storeList[widget.selectStoreIndex].id,
}); });
} }
break; break;
case 1: case 1:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/vip_recharge_page', arguments: { .pushNamed('/router/vip_recharge_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 2: case 2:
Navigator.of(context) Navigator.of(context).pushNamed('/router/add_vip', arguments: {
.pushNamed('/router/add_vip', arguments: { "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
"storeId": widget.businessLoginInfo .name ==
.storeList[widget.selectStoreIndex].name == "所有门店"
"所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 3: case 3:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/trade_overview_page', arguments: { .pushNamed('/router/trade_overview_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 4: case 4:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/business_vip_page', arguments: { .pushNamed('/router/business_vip_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 5: case 5:
Navigator.of(context) Navigator.of(context).pushNamed('/router/hot_selling_page', arguments: {
.pushNamed('/router/hot_selling_page', arguments: { "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
"storeId": widget.businessLoginInfo .name ==
.storeList[widget.selectStoreIndex].name == "所有门店"
"所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 6: case 6:
Navigator.of(context) Navigator.of(context).pushNamed('/router/flow_page', arguments: {
.pushNamed('/router/flow_page', arguments: {
"storeName": widget?.businessLoginInfo "storeName": widget?.businessLoginInfo
?.storeList[widget.selectStoreIndex].name ?? ?.storeList[widget.selectStoreIndex].name ??
"", "",
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 7: case 7:
widget.changeTab(3); widget.changeTab(3);
break; break;
} }
} }
/// ///
List<Map<String,String>> commonFunctionsList = [ 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_syt.webp",
{"image":"assets/image/bus_home_bhy.webp","commonName":"办会员","imageWidth":"24","imageHeight":"21"}, "commonName": "收银台",
{"image":"assets/image/bus_home_syzl.webp","commonName":"生意总览","imageWidth":"22","imageHeight":"23"}, "imageWidth": "26",
{"image":"assets/image/bus_home_hygl.webp","commonName":"会员管理","imageWidth":"23","imageHeight":"25"}, "imageHeight": "23"
{"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"}, "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 ///Item
Widget commonFunctionsItem(index){ Widget commonFunctionsItem(index) {
return Column( return Column(
children: [ children: [
Image.asset( Image.asset(
@ -659,7 +722,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
height: double.tryParse(commonFunctionsList[index]["imageHeight"]).h, height: double.tryParse(commonFunctionsList[index]["imageHeight"]).h,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
Padding(padding: EdgeInsets.only(top: 12.h), Padding(
padding: EdgeInsets.only(top: 12.h),
child: Text( child: Text(
commonFunctionsList[index]["commonName"], commonFunctionsList[index]["commonName"],
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -677,8 +741,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
Widget homeStatistics() { Widget homeStatistics() {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom:16.h), margin: EdgeInsets.only(bottom: 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( child: Column(
children: [ children: [
Row( Row(
@ -700,13 +765,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
), ),
GridView.builder( GridView.builder(
itemCount:homeStatisticsList.length ?? 0, itemCount: homeStatisticsList.length ?? 0,
padding: EdgeInsets.only(top:24.h), padding: EdgeInsets.only(top: 24.h),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, crossAxisCount: 4,
crossAxisSpacing:15.w, crossAxisSpacing: 15.w,
mainAxisSpacing: 12.w, mainAxisSpacing: 12.w,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -729,89 +794,113 @@ class _BusinessHomePage extends State<BusinessHomePage>
case 0: case 0:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/trade_overview_page', arguments: { .pushNamed('/router/trade_overview_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id,
}); });
break; break;
case 1: case 1:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/business_vip_page', arguments: { .pushNamed('/router/business_vip_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id, "index": 2
"index":2
}); });
break; break;
case 2: case 2:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/business_vip_page', arguments: { .pushNamed('/router/business_vip_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id, "index": 1
"index":1
}); });
break; break;
case 3: case 3:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/consumer_ranking_page', arguments: { .pushNamed('/router/consumer_ranking_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id, "titleName": "会员余额统计"
"titleName":"会员余额统计"
}); });
break; break;
case 4: case 4:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/consumer_ranking_page', arguments: { .pushNamed('/router/consumer_ranking_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id, "titleName": "消费排名"
"titleName":"消费排名"
}); });
break; break;
case 5: case 5:
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/trade_overview_page', arguments: { .pushNamed('/router/trade_overview_page', arguments: {
"storeId": widget.businessLoginInfo "storeId": widget.businessLoginInfo.storeList[widget.selectStoreIndex]
.storeList[widget.selectStoreIndex].name == .name ==
"所有门店" "所有门店"
? "0" ? "0"
: widget.businessLoginInfo : widget.businessLoginInfo.storeList[widget.selectStoreIndex].id,
.storeList[widget.selectStoreIndex].id, "index": 2
"index":2
}); });
break; break;
} }
} }
/// ///
List<Map<String,String>> homeStatisticsList = [ 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_yytj.webp",
{"image":"assets/image/bus_home_czjl.webp","commonName":"充值记录","imageWidth":"19","imageHeight":"22"}, "commonName": "营业统计",
{"image":"assets/image/bus_home_hyyetj.webp","commonName":"会员余额统计","imageWidth":"23","imageHeight":"23"}, "imageWidth": "21",
{"image":"assets/image/bus_home_xfpm.webp","commonName":"消费排名","imageWidth":"26","imageHeight":"22"}, "imageHeight": "20"
{"image":"assets/image/bus_home_goods_ssfx.webp","commonName":"商品销售分析","imageWidth":"26","imageHeight":"23"}, },
{
"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 ///Item
Widget homeStatisticsItem(index){ Widget homeStatisticsItem(index) {
return Column( return Column(
children: [ children: [
Image.asset( Image.asset(
@ -820,7 +909,8 @@ class _BusinessHomePage extends State<BusinessHomePage>
height: double.tryParse(homeStatisticsList[index]["imageHeight"]).h, height: double.tryParse(homeStatisticsList[index]["imageHeight"]).h,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
Padding(padding: EdgeInsets.only(top: 12.h), Padding(
padding: EdgeInsets.only(top: 12.h),
child: Text( child: Text(
homeStatisticsList[index]["commonName"], homeStatisticsList[index]["commonName"],
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -833,7 +923,4 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
); );
} }
@override
bool get wantKeepAlive => true;
} }

43
lib/business_system/home/select_shop.dart

@ -1,12 +1,18 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.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/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.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/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart'; import '../../retrofit/data/business_store_list.dart';
import '../../utils/business_instance.dart';
import '../../view_widget/classic_header.dart'; import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart'; import '../../view_widget/my_footer.dart';
@ -24,6 +30,7 @@ class SelectShop extends StatefulWidget {
class _SelectShop extends State<SelectShop> { class _SelectShop extends State<SelectShop> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessLoginInfo businessLoginInfo; BusinessLoginInfo businessLoginInfo;
BusinessApiService businessService;
List<Records> records = []; List<Records> records = [];
int selectIndex = 0; int selectIndex = 0;
@ -31,7 +38,43 @@ class _SelectShop extends State<SelectShop> {
void initState() { void initState() {
super.initState(); super.initState();
businessLoginInfo = widget.arguments["businessLoginInfo"]; businessLoginInfo = widget.arguments["businessLoginInfo"];
if(widget.arguments["routeSource"] == "单门店")
records = widget.arguments["records"]; records = widget.arguments["records"];
if(widget.arguments["routeSource"] == "门店设置")
queryStoreList();
}
///
queryStoreList() async {
try{
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: "0");
}
BaseData<BusinessStoreList> baseData = await businessService
.getStoreList(BusinessInstance.instance.businessTenant, "1", "100")
.catchError((error) {
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
records.clear();
records.addAll((baseData?.data?.records ?? []).reversed);
refreshController.refreshCompleted();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}finally{
EasyLoading.dismiss();
setState((){});
}
} }
@override @override

1
lib/business_system/home/vip/vip_recharge_page.dart

@ -684,7 +684,6 @@ class _VipRechargePage extends State<VipRechargePage> {
bottom: 34.h), bottom: 34.h),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF30415B), color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),

310
lib/business_system/mine/business_mine_page.dart

@ -7,20 +7,19 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:visibility_detector/visibility_detector.dart';
import '../../retrofit/business_api.dart'; import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart'; import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart'; import '../../retrofit/data/business_store_list.dart';
import '../../utils/business_instance.dart'; import '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart'; import '../../utils/font_weight.dart';
class BusinessMinePage extends StatefulWidget { class BusinessMinePage extends StatefulWidget {
final BusinessLoginInfo businessLoginInfo; final BusinessLoginInfo businessLoginInfo;
final String storeId; final String storeId;
BusinessMinePage(this.businessLoginInfo, this.storeId); BusinessMinePage(Key key, this.businessLoginInfo, this.storeId)
: super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -28,17 +27,18 @@ class BusinessMinePage extends StatefulWidget {
} }
} }
class _BusinessMinePage extends State<BusinessMinePage> class _BusinessMinePage extends State<BusinessMinePage> {
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessApiService businessService; BusinessApiService businessService;
List<Records> records = []; List<Records> records = [];
double visiblePercentage;
int networkStatus = 0; int networkStatus = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.businessLoginInfo.storeList.length == 1) {
queryStoreList();
}
} }
@override @override
@ -49,9 +49,6 @@ class _BusinessMinePage extends State<BusinessMinePage>
/// ///
queryStoreList() async { queryStoreList() async {
// EasyLoading.show(
// status: S.current.zhengzaijiazai,
// maskType: EasyLoadingMaskType.black);
if (businessService == null) { if (businessService == null) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),
context: context, context: context,
@ -62,18 +59,14 @@ class _BusinessMinePage extends State<BusinessMinePage>
BaseData<BusinessStoreList> baseData = await businessService BaseData<BusinessStoreList> baseData = await businessService
.getStoreList(BusinessInstance.instance.businessTenant, "1", "100") .getStoreList(BusinessInstance.instance.businessTenant, "1", "100")
.catchError((error) { .catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkStatus = -1;
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
records = baseData.data.records ?? []; records.clear();
records.addAll((baseData.data.records ?? []).reversed);
refreshController.refreshCompleted(); refreshController.refreshCompleted();
networkStatus = 1;
// EasyLoading.dismiss();
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -81,140 +74,178 @@ class _BusinessMinePage extends State<BusinessMinePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); return Column(
return VisibilityDetector( children: [
key: Key('my-widget-key'), Expanded(
onVisibilityChanged: (visibilityInfo) { child: Container(
visiblePercentage = visibilityInfo.visibleFraction; child: SmartRefresher(
if (visiblePercentage == 1) queryStoreList(); controller: refreshController,
}, enablePullDown: true,
child: Column( enablePullUp: false,
children: [ header: MyHeader(color: Color(0xFF30415B)),
Expanded( physics: BouncingScrollPhysics(),
child: Container( footer: CustomFooter(
child: SmartRefresher( builder: (context, mode) {
controller: refreshController, return MyFooter(mode);
enablePullDown: true, },
enablePullUp: false, ),
header: MyHeader(color: Color(0xFF30415B)), onRefresh: () {
physics: BouncingScrollPhysics(), if (widget.businessLoginInfo != null) {
footer: CustomFooter( queryStoreList();
builder: (context, mode) { } else
return MyFooter(mode); refreshController.refreshFailed();
}, },
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container(
child: Column(
children: [
mineInfo(),
commonFunctions(),
otherFunctions(),
SizedBox(
height: 54.h,
),
Text(
"@回乡信息公司",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium),
),
],
),
)),
),
),
),
SizedBox(
height: 76.h,
),
],
);
}
Widget mineInfo() {
return Container(
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Stack(
children: [
Container(
width: double.infinity,
height: 238.h,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/image/bs_mine_bg.webp",
),
fit: BoxFit.cover,
), ),
onRefresh: () { ),
if (widget.businessLoginInfo != null) { ),
queryStoreList(); GestureDetector(
} else behavior: HitTestBehavior.opaque,
refreshController.refreshFailed(); onTap: () {
}, Navigator.of(context)
child: SingleChildScrollView( .pushNamed('/router/account_information', arguments: {
physics: NeverScrollableScrollPhysics(), "businessLoginInfo": widget.businessLoginInfo,
child: Container( });
},
child: Container(
padding: EdgeInsets.only(
top: MediaQuery.of(context).padding.top + 50, left: 16.w),
child: Row(
children: [
(widget?.businessLoginInfo?.avatar != "")
? MImage(
widget?.businessLoginInfo?.avatar ?? "",
fit: BoxFit.cover,
width: 69.h,
height: 69.h,
radius: BorderRadius.circular(100),
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
)
: Image.asset(
"assets/image/bs_mine_heading.webp",
width: 69,
height: 69,
fit: BoxFit.fill,
),
SizedBox(
width: 10.w,
),
Container(
height: 69.h,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
mineInfo(), Text(
commonFunctions(), widget?.businessLoginInfo?.name ?? "",
otherFunctions(), style: TextStyle(
SizedBox( fontSize: 18.sp,
height: 54.h, color: Color(0xFF374C6C),
fontWeight: MyFontWeight.semi_bold),
), ),
Text( Text(
"@回乡信息公司", 'ID:${widget?.businessLoginInfo?.account ?? ""}',
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 16.sp,
color: Color(0xFF30415B), color: Color(0xFF374C6C),
fontWeight: MyFontWeight.medium), fontWeight: MyFontWeight.regular),
), ),
], ],
), ),
)), )
), ],
), ),
),
SizedBox(
height: 76.h,
),
],
));
}
Widget mineInfo() {
return Container(
child: Stack(
children: [
Container(
width: double.infinity,
height: 238.h,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/image/bs_mine_bg.webp",
), ),
fit: BoxFit.cover,
), ),
), ],
), ),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/account_information', arguments: { .pushNamed('/router/service_subscription_page', arguments: {
"businessLoginInfo": widget.businessLoginInfo, "storeId": widget.storeId ?? "",
}); });
}, },
child: Container( child: Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(bottom: 12.h, left: 16.w),
top: MediaQuery.of(context).padding.top + 50, left: 16.w),
child: Row( child: Row(
children: [ children: [
(widget?.businessLoginInfo?.avatar != "") Padding(
? MImage( padding: EdgeInsets.only(right: 14.w),
widget?.businessLoginInfo?.avatar ?? "", child: Text(
fit: BoxFit.cover, "服务有效期:2029-12-23",
width: 69.h, style: TextStyle(
height: 69.h, fontSize: 14.sp,
radius: BorderRadius.circular(100), color: Color(0xFF353535),
errorSrc: "assets/image/default_2_1.webp", fontWeight: MyFontWeight.regular),
fadeSrc: "assets/image/default_2_1.webp", )),
) Padding(
: Image.asset( padding: EdgeInsets.only(right: 4.w),
"assets/image/bs_mine_heading.webp", child: Text(
width: 69, "去续费",
height: 69, style: TextStyle(
fit: BoxFit.fill, fontSize: 14.sp,
), color: Color(0xFF353535),
SizedBox( fontWeight: MyFontWeight.regular),
width: 10.w, )),
Image.asset(
"assets/image/icon_right_z.webp",
width: 16.h,
height: 16.h,
color: Color(0xFF353535),
), ),
Container(
height: 69.h,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
widget?.businessLoginInfo?.name ?? "",
style: TextStyle(
fontSize: 18.sp,
color: Color(0xFF374C6C),
fontWeight: MyFontWeight.semi_bold),
),
Text(
'ID:${widget?.businessLoginInfo?.account ?? ""}',
style: TextStyle(
fontSize: 16.sp,
color: Color(0xFF374C6C),
fontWeight: MyFontWeight.regular),
),
],
),
)
], ],
), ),
), ),
), )
], ],
), ),
); );
@ -249,24 +280,26 @@ class _BusinessMinePage extends State<BusinessMinePage>
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if(networkStatus == -1){ if (networkStatus == -1) {
queryStoreList(); queryStoreList();
return; return;
} } else if (widget.businessLoginInfo.storeList.length > 1) {
else if (widget.businessLoginInfo.storeList.length > 1) { Navigator.of(context)
Navigator.of(context).pushNamed('/router/select_shop', .pushNamed('/router/select_shop', arguments: {
arguments: {"routeSource": "门店设置", "records": records}); "routeSource": "门店设置",
});
} else { } else {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/merchant_info', arguments: { .pushNamed('/router/merchant_info', arguments: {
"storeId": widget.storeId, "storeId": widget.storeId,
"storeName": records[0].storeName, "storeName": records[0].storeName,
"records": records[0], "records": records[0],
"routeSource": "单门店"
}); });
} }
}, },
child: commonFunctionsItem( child: commonFunctionsItem(
"assets/image/bs_shop_logo.webp", "门店设置", "",20,20), "assets/image/bs_shop_logo.webp", "门店设置", "", 20, 20),
), ),
Container( Container(
width: double.infinity, width: double.infinity,
@ -282,7 +315,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
SmartDialog.showToast("该功能暂未开放!", alignment: Alignment.center); SmartDialog.showToast("该功能暂未开放!", alignment: Alignment.center);
}, },
child: commonFunctionsItem( child: commonFunctionsItem(
"assets/image/bs_mine_code.webp", "门店预约二维码", "",18,18), "assets/image/bs_mine_code.webp", "门店预约二维码", "", 18, 18),
), ),
Container( Container(
width: double.infinity, width: double.infinity,
@ -300,7 +333,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
}); });
}, },
child: commonFunctionsItem( child: commonFunctionsItem(
"assets/image/bs_secure.webp", "安全设置", "登录手机号/密码",18,22)), "assets/image/bs_secure.webp", "安全设置", "登录手机号/密码", 18, 22)),
Container( Container(
width: double.infinity, width: double.infinity,
height: 1.h, height: 1.h,
@ -316,14 +349,15 @@ class _BusinessMinePage extends State<BusinessMinePage>
}); });
}, },
child: commonFunctionsItem( child: commonFunctionsItem(
"assets/image/bs_mine_clerk.webp", "店员管理", "",18,20), "assets/image/bs_mine_clerk.webp", "店员管理", "", 18, 20),
), ),
], ],
), ),
); );
} }
Widget commonFunctionsItem(icon, leftText, rightText,double width,double height) { Widget commonFunctionsItem(
icon, leftText, rightText, double width, double height) {
return Container( return Container(
margin: EdgeInsets.only(bottom: 14.h), margin: EdgeInsets.only(bottom: 14.h),
child: Row( child: Row(
@ -336,7 +370,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
SizedBox( SizedBox(
width:11.w, width: 11.w,
), ),
Expanded( Expanded(
child: Text( child: Text(
@ -397,13 +431,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/user_service_page'); Navigator.of(context).pushNamed('/router/user_service_page');
}, },
child: child: commonFunctionsItem(
commonFunctionsItem("assets/image/bs_user.webp", "关于我们", "",24,24)) "assets/image/bs_user.webp", "关于我们", "", 24, 24))
], ],
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

8
lib/business_system/order/business_order_page.dart

@ -10,7 +10,7 @@ import 'order_list_page.dart';
class BusinessOrderPage extends StatefulWidget { class BusinessOrderPage extends StatefulWidget {
final String storeId; final String storeId;
BusinessOrderPage(this.storeId); BusinessOrderPage(Key key,this.storeId): super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -19,7 +19,7 @@ class BusinessOrderPage extends StatefulWidget {
} }
class _BusinessOrderPage extends State<BusinessOrderPage> class _BusinessOrderPage extends State<BusinessOrderPage>
with AutomaticKeepAliveClientMixin,SingleTickerProviderStateMixin{ with SingleTickerProviderStateMixin{
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
TabController tabController; TabController tabController;
@ -37,7 +37,6 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context);
return Column( return Column(
children: [ children: [
Expanded(child: Expanded(child:
@ -86,7 +85,4 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
], ],
); );
} }
@override
bool get wantKeepAlive => true;
} }

212
lib/business_system/order/order_write_off.dart

@ -100,114 +100,120 @@ class _OrderWriteOff extends State<OrderWriteOff> {
}, },
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
scrollController: ScrollController(), scrollController: ScrollController(),
child: SingleChildScrollView( child: Stack(
physics: NeverScrollableScrollPhysics(), children: [
child: Container( SingleChildScrollView(
margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), physics: BouncingScrollPhysics(),
child: Column( child: Container(
children: [ margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w,bottom:100.h),
basicInfo(), child: Column(
writeOffInfo(), children: [
GestureDetector( basicInfo(),
onTap: () { writeOffInfo(),
if (tickets != null ],
? (widget.arguments["ticketStatus"] == false) ),
: (ticketDetails.state == 9)) { ),
return; ),
} else { Align(
List<dynamic> ticketWipedBatch = []; alignment: Alignment.bottomCenter,
if (widget.arguments["tickets"] != null) { child: GestureDetector(
tickets.forEach((element) { onTap: () {
List<dynamic> skuTickets = []; if (tickets != null
element.ticketItemList.forEach((ele) { ? (widget.arguments["ticketStatus"] == false)
if (ele.isSelect) { : (ticketDetails.state == 9)) {
skuTickets.add({ return;
"number": 1, } else {
"skuTicket": ele.name, List<dynamic> ticketWipedBatch = [];
"state": ele.state, if (widget.arguments["tickets"] != null) {
}); tickets.forEach((element) {
} List<dynamic> skuTickets = [];
}); element.ticketItemList.forEach((ele) {
if (skuTickets.isNotEmpty) { if (ele.isSelect) {
ticketWipedBatch.add({ skuTickets.add({
"itemMap": [ "number": 1,
{ "skuTicket": ele.name,
"productSkuld": element.productSkuId, "state": ele.state,
"ticketExchangeName": element.name,
"ticketId": element.id,
"skuTickets": skuTickets
}
],
"ticketCode": element.code,
});
}
});
} else {
List<dynamic> skuTickets = [];
ticketDetails.ticketItemList.forEach((element) {
if (element.isSelect) {
skuTickets.add({
"number": 1,
"skuTicket": element.name,
"state": element.state,
});
}
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": ticketDetails.productSkuId,
"ticketExchangeName": ticketDetails.name,
"ticketId": ticketDetails.id,
"skuTickets": skuTickets
}
],
"ticketCode": ticketDetails.code,
}); });
} }
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": element.productSkuId,
"ticketExchangeName": element.name,
"ticketId": element.id,
"skuTickets": skuTickets
}
],
"ticketCode": element.code,
});
} }
if (ticketWipedBatch.length == 0) { });
SmartDialog.showToast("请选择要核销的商品", } else {
alignment: Alignment.center); List<dynamic> skuTickets = [];
return; ticketDetails.ticketItemList.forEach((element) {
} else { if (element.isSelect) {
severalWiped(ticketWipedBatch); skuTickets.add({
"number": 1,
"skuTicket": element.name,
"state": element.state,
});
} }
});
if (skuTickets.isNotEmpty) {
ticketWipedBatch.add({
"itemMap": [
{
"productSkuld": ticketDetails.productSkuId,
"ticketExchangeName": ticketDetails.name,
"ticketId": ticketDetails.id,
"skuTickets": skuTickets
}
],
"ticketCode": ticketDetails.code,
});
} }
}, }
if (ticketWipedBatch.length == 0) {
SmartDialog.showToast("请选择要核销的商品",
alignment: Alignment.center);
return;
} else {
severalWiped(ticketWipedBatch);
}
}
},
child: Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.only(
top: 10.h,
left: 16.w,
right: 16.w,
bottom: 34.h),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only( height: 54.h,
bottom: 55.h, decoration: BoxDecoration(
top: (tickets != null borderRadius: BorderRadius.circular(27),
? tickets.length color: (tickets != null
: ticketDetails.ticketItemList.length) <= ? (widget.arguments["ticketStatus"] == true)
1 : (ticketDetails.state != 9))
? 125.h ? Color(0xFF30415B)
: 10.h), : Color(0xFFABACAB)),
padding: EdgeInsets.symmetric(vertical: 16.h), child: Text(
decoration: BoxDecoration( "确认核销",
borderRadius: BorderRadius.circular(27), style: TextStyle(
color: (tickets != null fontWeight: MyFontWeight.semi_bold,
? (widget.arguments["ticketStatus"] == true) fontSize: 16.sp,
: (ticketDetails.state != 9)) color: Colors.white,
? Color(0xFF30415B)
: Color(0xFFABACAB)),
child: Text(
"确认核销",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Colors.white,
),
),
), ),
) ),
], )),
), ))
), ],
), ),
), ),
); );
@ -253,10 +259,10 @@ class _OrderWriteOff extends State<OrderWriteOff> {
SizedBox( SizedBox(
height: 12.h, height: 12.h,
), ),
basicInfoItem("用户名称:", basicInfoItem("用户名称:",
widget?.arguments["userName"] ?? ticketDetails?.userName ?? ""), widget?.arguments["userName"] ?? ticketDetails?.userName ?? ""),
basicInfoItem( basicInfoItem(
"订单编号:", "订单编号:",
widget?.arguments["orderCode"] ?? widget?.arguments["orderCode"] ??
(ticketDetails.code.replaceAll("T", "")) ?? (ticketDetails.code.replaceAll("T", "")) ??
""), ""),

Loading…
Cancel
Save