Browse Source

网络请求异常时新增异常页面显示;

所有骨架屏更改网络异常时显示异常页面;
我的页面,网络异常-禁止门店列表跳转更改;
wr_2023_business
wurong 1 year ago
parent
commit
7463ca70a4
  1. 421
      lib/business_system/goods/goods_search_page.dart
  2. 61
      lib/business_system/goods/off_shelf/off_shelf_page.dart
  3. 67
      lib/business_system/goods/on_sale/batch_shelf.dart
  4. 62
      lib/business_system/goods/on_sale/goods_assort.dart
  5. 67
      lib/business_system/goods/on_sale/goods_sort.dart
  6. 68
      lib/business_system/goods/on_sale/on_sale_page.dart
  7. 63
      lib/business_system/home/flow_page.dart
  8. 62
      lib/business_system/home/overview/trade_goods.dart
  9. 9
      lib/business_system/mine/business_mine_page.dart
  10. 65
      lib/business_system/order/business_order_detail.dart
  11. 165
      lib/business_system/order/order_list.dart
  12. 10
      lib/retrofit/data/business_order_list.dart

421
lib/business_system/goods/goods_search_page.dart

@ -46,7 +46,8 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
int _pageIndex = 1; int _pageIndex = 1;
BusinessApiService businessService; BusinessApiService businessService;
List<AdminProductVoList> adminProductVoList = []; List<AdminProductVoList> adminProductVoList = [];
bool _shimmer =true; String networkError = "";
int networkStatus = 0;
@override @override
void didChangeMetrics() { void didChangeMetrics() {
@ -91,7 +92,6 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
await queryGoodsList(); await queryGoodsList();
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (refreshController.isRefresh) refreshController.refreshCompleted();
@ -116,8 +116,9 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
"pageSize": 10, "pageSize": 10,
"status": widget.arguments["onSaleStatus"], "status": widget.arguments["onSaleStatus"],
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
setState(() {});
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
@ -129,6 +130,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
refreshController.loadNoData(); refreshController.loadNoData();
else else
refreshController.loadComplete(); refreshController.loadComplete();
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -136,31 +138,32 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
/// ///
queryGoodsUpdate(productId) async { queryGoodsUpdate(productId) async {
try{ try {
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
if (businessService == null) { if (businessService == null) {
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.arguments["storeId"]); storeId: widget.arguments["storeId"]);
} }
BaseData baseData = BaseData baseData = await businessService.goodsUpdate({
await businessService.goodsUpdate({ "productId": productId,
"productId": productId, "sell": widget.arguments["onSaleStatus"] == "1" ? false : true,
"sell": widget.arguments["onSaleStatus"] == "1"?false:true, }).catchError((error) {});
}).catchError((error) { if (baseData != null && baseData.isSuccess) {
}); _pageIndex = 1;
if (baseData != null && baseData.isSuccess) { adminProductVoList.clear();
_pageIndex = 1; await _onRefresh(isShowLoad: false);
adminProductVoList.clear(); SmartDialog.showToast(
await _onRefresh(isShowLoad: false); widget.arguments["onSaleStatus"] == "1" ? "商品下架成功" : "商品上架成功",
SmartDialog.showToast(widget.arguments["onSaleStatus"] == "1"?"商品下架成功":"商品上架成功", alignment: Alignment.center); alignment: Alignment.center);
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}}finally{ }
} finally {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
} }
@ -184,8 +187,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
Container( Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom: 16.h), margin: EdgeInsets.only(bottom: 16.h),
child: child: Container(
Container(
height: 40.h, height: 40.h,
margin: EdgeInsets.fromLTRB(18.w, 17.h, 18.w, 10.h), margin: EdgeInsets.fromLTRB(18.w, 17.h, 18.w, 10.h),
alignment: Alignment.center, alignment: Alignment.center,
@ -208,10 +210,9 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
decoration: InputDecoration( decoration: InputDecoration(
hintText: "请输入搜索内容", hintText: "请输入搜索内容",
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 15.sp, fontSize: 15.sp,
color: Color(0xFF808080), color: Color(0xFF808080),
fontWeight: MyFontWeight.regular fontWeight: MyFontWeight.regular),
),
isCollapsed: true, isCollapsed: true,
prefixIcon: Padding( prefixIcon: Padding(
padding: EdgeInsets.only(left: 5.w, right: 5.w), padding: EdgeInsets.only(left: 5.w, right: 5.w),
@ -228,63 +229,68 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
), ),
), ),
Expanded( Expanded(
child: Container( child: networkStatus == -1
child: SmartRefresher( ? noNetwork()
controller: refreshController, : Container(
enablePullDown: true, child: SmartRefresher(
enablePullUp: true, controller: refreshController,
physics: BouncingScrollPhysics(), enablePullDown: true,
header: MyHeader( enablePullUp: true,
color: Color(0xFF30415B), physics: BouncingScrollPhysics(),
), header: MyHeader(
footer: CustomFooter( color: Color(0xFF30415B),
builder: (context, mode) { ),
return MyFooter(mode); footer: CustomFooter(
}, builder: (context, mode) {
), return MyFooter(mode);
onRefresh: () { },
_pageIndex = 1; ),
adminProductVoList.clear(); onRefresh: () {
_onRefresh(isShowLoad: false); _pageIndex = 1;
}, adminProductVoList.clear();
onLoading: () { _onRefresh(isShowLoad: false);
_pageIndex++; },
_onRefresh(isShowLoad: false); onLoading: () {
}, _pageIndex++;
child: (_shimmer)?ListView.builder( _onRefresh(isShowLoad: false);
padding: EdgeInsets.zero, },
itemCount: 10, child: networkStatus == 0
scrollDirection: Axis.vertical, ? ListView.builder(
shrinkWrap: true, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), itemCount: 10,
itemBuilder: (context, position) { scrollDirection: Axis.vertical,
return searchGoodsItemSm(); shrinkWrap: true,
}, physics: NeverScrollableScrollPhysics(),
): itemBuilder: (context, position) {
((adminProductVoList == null || return searchGoodsItemSm();
adminProductVoList.length == 0) },
? NoDataView( )
src: "assets/image/bs_no data_logo.webp", : ((adminProductVoList == null ||
isShowBtn: false, adminProductVoList.length == 0)
text: "未搜索到相关数据", ? NoDataView(
fontSize: 16.sp, src: "assets/image/bs_no data_logo.webp",
margin: EdgeInsets.all(20.h), isShowBtn: false,
) text: "未搜索到相关数据",
: Container( fontSize: 16.sp,
margin: EdgeInsets.only(bottom:20.h), margin: EdgeInsets.all(20.h),
child: ListView.builder( )
padding: EdgeInsets.zero, : Container(
itemCount: adminProductVoList?.length ?? 0, margin: EdgeInsets.only(bottom: 20.h),
scrollDirection: Axis.vertical, child: ListView.builder(
shrinkWrap: true, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), itemCount:
itemBuilder: (context, position) { adminProductVoList?.length ?? 0,
return searchGoodsItem(adminProductVoList[position]); scrollDirection: Axis.vertical,
}, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return searchGoodsItem(
adminProductVoList[position]);
},
),
)),
),
), ),
)),
),
),
) )
], ],
), ),
@ -390,31 +396,30 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
), ),
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
queryGoodsUpdate(adminProductVoList.id ?? ""); queryGoodsUpdate(adminProductVoList.id ?? "");
}, },
child:Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(33), borderRadius: BorderRadius.circular(33),
border: Border.all( border: Border.all(
color: Color(0xFF30415B), color: Color(0xFF30415B),
width: 1, width: 1,
),
), ),
), padding: EdgeInsets.symmetric(
padding: vertical: 2.h, horizontal: 12.w),
EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), child: Text(
child: Text( widget.arguments["onSaleStatus"] == "1" ? "下架" : "上架",
widget.arguments["onSaleStatus"] == "1"?"下架":"上架", style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular, color: Color(0xFF30415B),
color: Color(0xFF30415B), ),
), ),
), ))
)
)
], ],
) )
], ],
@ -440,7 +445,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
), ),
margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w), margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w),
padding: padding:
EdgeInsets.only(left: 12.w, top: 12.h, bottom: 12.h, right: 24.w), EdgeInsets.only(left: 12.w, top: 12.h, bottom: 12.h, right: 24.w),
child: Row( child: Row(
children: [ children: [
Shimmer.fromColors( Shimmer.fromColors(
@ -460,86 +465,136 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 124.w,
height: 20.h,
),
),
),
Row(
children: [ children: [
Padding( Shimmer.fromColors(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h), baseColor: Color(0XFFD8D8D8),
child: Shimmer.fromColors( highlightColor: Color(0XFFD8D8D8),
baseColor: Color(0XFFD8D8D8), child: Container(
highlightColor: Color(0XFFD8D8D8), decoration: BoxDecoration(
child: Container( color: Color(0XFFD8D8D8),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(2),
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 124.w,
height: 20.h,
), ),
width: 43.w,
height: 18.h,
), ),
), ),
Row( SizedBox(
children: [ width: 8.w,
Shimmer.fromColors( ),
baseColor: Color(0XFFD8D8D8), Shimmer.fromColors(
highlightColor: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
child: Container( highlightColor: Color(0XFFD8D8D8),
decoration: BoxDecoration( child: Container(
color: Color(0XFFD8D8D8), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), color: Color(0XFFD8D8D8),
), borderRadius: BorderRadius.circular(2),
width: 43.w,
height: 18.h,
),
),
SizedBox(
width: 8.w,
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 43.w,
height: 18.h,
),
), ),
], width: 43.w,
height: 18.h,
),
), ),
SizedBox(height: 7.h,), ],
Row( ),
children: [ SizedBox(
Shimmer.fromColors( height: 7.h,
baseColor: Color(0XFFD8D8D8), ),
highlightColor: Color(0XFFD8D8D8), Row(
child: Container( children: [
decoration: BoxDecoration( Shimmer.fromColors(
color: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), highlightColor: Color(0XFFD8D8D8),
), child: Container(
width: 28.w, decoration: BoxDecoration(
height: 20.h, color: Color(0XFFD8D8D8),
), borderRadius: BorderRadius.circular(2),
), ),
Spacer(), width: 28.w,
Shimmer.fromColors( height: 20.h,
baseColor: Color(0XFFD8D8D8), ),
highlightColor: Color(0XFFD8D8D8), ),
child: Container( Spacer(),
decoration: BoxDecoration( Shimmer.fromColors(
color: Color(0XFFD8D8D8), baseColor: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2), highlightColor: Color(0XFFD8D8D8),
), child: Container(
width: 24.w, decoration: BoxDecoration(
height: 18.h, color: Color(0XFFD8D8D8),
), borderRadius: BorderRadius.circular(2),
), ),
], width: 24.w,
) height: 18.h,
),
),
], ],
)), )
],
)),
],
),
);
}
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0, 4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
], ],
), ),
); );

61
lib/business_system/goods/off_shelf/off_shelf_page.dart

@ -39,7 +39,8 @@ class _OffShelfPage extends State<OffShelfPage> {
int _pageIndex = 1; int _pageIndex = 1;
BusinessApiService businessService; BusinessApiService businessService;
List<AdminProductVoList> adminProductVoList = []; List<AdminProductVoList> adminProductVoList = [];
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void dispose() { void dispose() {
@ -59,7 +60,6 @@ class _OffShelfPage extends State<OffShelfPage> {
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
await queryGoodsList(); await queryGoodsList();
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -84,8 +84,9 @@ class _OffShelfPage extends State<OffShelfPage> {
"pageSize": 10, "pageSize": 10,
"status": "0" "status": "0"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
setState(() {});
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
@ -98,6 +99,7 @@ class _OffShelfPage extends State<OffShelfPage> {
_refreshController.loadNoData(); _refreshController.loadNoData();
else else
_refreshController.loadComplete(); _refreshController.loadComplete();
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -198,7 +200,7 @@ class _OffShelfPage extends State<OffShelfPage> {
), ),
), ),
Expanded( Expanded(
child: Container( child: networkStatus == -1?noNetwork():Container(
child: SmartRefresher( child: SmartRefresher(
controller: _refreshController, controller: _refreshController,
enablePullDown: true, enablePullDown: true,
@ -223,7 +225,7 @@ class _OffShelfPage extends State<OffShelfPage> {
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: (_shimmer)?ListView.builder( child: networkStatus == 0 ?ListView.builder(
itemCount:10, itemCount:10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
@ -675,4 +677,51 @@ class _OffShelfPage extends State<OffShelfPage> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

67
lib/business_system/goods/on_sale/batch_shelf.dart

@ -41,7 +41,8 @@ class _BatchShelf extends State<BatchShelf> {
int _loadCount = 0; int _loadCount = 0;
int _pageIndex = 1; int _pageIndex = 1;
int groupIndex = -1; int groupIndex = -1;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -75,7 +76,6 @@ class _BatchShelf extends State<BatchShelf> {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 2) { if (_loadCount == 2) {
_loadCount = 0; _loadCount = 0;
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -94,10 +94,6 @@ class _BatchShelf extends State<BatchShelf> {
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -126,8 +122,8 @@ class _BatchShelf extends State<BatchShelf> {
"pageSize": 10, "pageSize": 10,
"status": "1" "status": "1"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
@ -140,6 +136,7 @@ class _BatchShelf extends State<BatchShelf> {
} else { } else {
_refreshController.loadComplete(); _refreshController.loadComplete();
} }
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -226,7 +223,7 @@ class _BatchShelf extends State<BatchShelf> {
), ),
), ),
), ),
body: Row( body: networkStatus == -1 ? noNetwork() : Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -235,7 +232,7 @@ class _BatchShelf extends State<BatchShelf> {
height: double.infinity, height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h), padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
child: (_shimmer) child:networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -293,7 +290,7 @@ class _BatchShelf extends State<BatchShelf> {
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: (_shimmer) child: networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -570,4 +567,52 @@ class _BatchShelf extends State<BatchShelf> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

62
lib/business_system/goods/on_sale/goods_assort.dart

@ -36,7 +36,8 @@ class _GoodsAssort extends State<GoodsAssort> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessApiService businessService; BusinessApiService businessService;
ProductGroupList productGroupList; ProductGroupList productGroupList;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -50,7 +51,6 @@ class _GoodsAssort extends State<GoodsAssort> {
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
await queryProductGroupList(); await queryProductGroupList();
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) if (mounted)
@ -74,13 +74,15 @@ class _GoodsAssort extends State<GoodsAssort> {
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
setState(() {});
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
productGroupList = baseData.data; productGroupList = baseData.data;
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -117,7 +119,7 @@ class _GoodsAssort extends State<GoodsAssort> {
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: Container( body: networkStatus == -1?noNetwork():Container(
margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w), margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w),
child: Column( child: Column(
children: [ children: [
@ -141,7 +143,7 @@ class _GoodsAssort extends State<GoodsAssort> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
scrollController: ScrollController(), scrollController: ScrollController(),
child: Container( child: Container(
child: (_shimmer)?ListView.builder( child: networkStatus == 0 ?ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
@ -435,4 +437,52 @@ class _GoodsAssort extends State<GoodsAssort> {
}, },
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

67
lib/business_system/goods/on_sale/goods_sort.dart

@ -42,7 +42,8 @@ class _GoodsSort extends State<GoodsSort> {
int _loadCount = 0; int _loadCount = 0;
int _pageIndex = 1; int _pageIndex = 1;
int groupIndex = -1; int groupIndex = -1;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -80,7 +81,6 @@ class _GoodsSort extends State<GoodsSort> {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 2) { if (_loadCount == 2) {
_loadCount = 0; _loadCount = 0;
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -99,10 +99,6 @@ class _GoodsSort extends State<GoodsSort> {
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -131,8 +127,8 @@ class _GoodsSort extends State<GoodsSort> {
"pageSize": 10, "pageSize": 10,
"status": "1" "status": "1"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkStatus = -1;
alignment: Alignment.center); networkError = AppUtils.dioErrorTypeToString(error.type);
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
@ -145,6 +141,7 @@ class _GoodsSort extends State<GoodsSort> {
} else { } else {
_refreshController.loadComplete(); _refreshController.loadComplete();
} }
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -200,7 +197,7 @@ class _GoodsSort extends State<GoodsSort> {
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: Row( body: networkStatus == -1 ? noNetwork() : Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -209,7 +206,7 @@ class _GoodsSort extends State<GoodsSort> {
height: double.infinity, height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h), padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
child: (_shimmer) child: networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -267,7 +264,7 @@ class _GoodsSort extends State<GoodsSort> {
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: (_shimmer) child: networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -582,4 +579,52 @@ class _GoodsSort extends State<GoodsSort> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

68
lib/business_system/goods/on_sale/on_sale_page.dart

@ -42,7 +42,8 @@ class _OnSalePage extends State<OnSalePage> {
int _loadCount = 0; int _loadCount = 0;
int _pageIndex = 1; int _pageIndex = 1;
int groupIndex = -1; int groupIndex = -1;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void dispose() { void dispose() {
@ -78,7 +79,6 @@ class _OnSalePage extends State<OnSalePage> {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 2) { if (_loadCount == 2) {
_loadCount = 0; _loadCount = 0;
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -97,10 +97,6 @@ class _OnSalePage extends State<OnSalePage> {
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -129,8 +125,8 @@ class _OnSalePage extends State<OnSalePage> {
"pageSize": 10, "pageSize": 10,
"status": "1" "status": "1"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
@ -144,6 +140,7 @@ class _OnSalePage extends State<OnSalePage> {
} else { } else {
_refreshController.loadComplete(); _refreshController.loadComplete();
} }
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -207,7 +204,8 @@ class _OnSalePage extends State<OnSalePage> {
width: double.infinity, width: double.infinity,
), ),
Expanded( Expanded(
child: Container( child: networkStatus == -1 ? noNetwork()
:Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -217,7 +215,7 @@ class _OnSalePage extends State<OnSalePage> {
height: double.infinity, height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h), padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
child: (_shimmer) child: networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -276,7 +274,7 @@ class _OnSalePage extends State<OnSalePage> {
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: (_shimmer) child: networkStatus == 0
? ListView.builder( ? ListView.builder(
itemCount: 10, itemCount: 10,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -761,4 +759,52 @@ class _OnSalePage extends State<OnSalePage> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

63
lib/business_system/home/flow_page.dart

@ -39,7 +39,8 @@ class _FlowPage extends State<FlowPage> {
List<DayFlowList> dayFlowList = []; List<DayFlowList> dayFlowList = [];
int _loadCount = 0; int _loadCount = 0;
String _datetime; String _datetime;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -70,7 +71,6 @@ class _FlowPage extends State<FlowPage> {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 1) { if (_loadCount == 1) {
_loadCount = 0; _loadCount = 0;
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {}); if (mounted) setState(() {});
@ -86,8 +86,8 @@ class _FlowPage extends State<FlowPage> {
try { try {
BaseData<List<DayFlowList>> baseData = BaseData<List<DayFlowList>> baseData =
await businessService.dayFlow(yearMonth, isMonth).catchError((error) { await businessService.dayFlow(yearMonth, isMonth).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkStatus = -1;
alignment: Alignment.center); networkError = AppUtils.dioErrorTypeToString(error.type);
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if (isMonth == "0") { if (isMonth == "0") {
@ -97,6 +97,7 @@ class _FlowPage extends State<FlowPage> {
.firstWhere((element) => element.localDate == yearMonth) .firstWhere((element) => element.localDate == yearMonth)
.detailList = baseData.data; .detailList = baseData.data;
} }
networkStatus = 1;
} }
} finally { } finally {
if (isSing) { if (isSing) {
@ -119,7 +120,7 @@ class _FlowPage extends State<FlowPage> {
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: SmartRefresher( body: networkStatus == -1 ? noNetwork():SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
@ -168,7 +169,7 @@ class _FlowPage extends State<FlowPage> {
SizedBox( SizedBox(
height: 16.h, height: 16.h,
), ),
if(!_shimmer) if(networkStatus == 1)
(dayFlowList == null || dayFlowList.length == 0) (dayFlowList == null || dayFlowList.length == 0)
? NoDataView( ? NoDataView(
src: "assets/image/bs_no data_logo.webp", src: "assets/image/bs_no data_logo.webp",
@ -190,7 +191,7 @@ class _FlowPage extends State<FlowPage> {
); );
}, },
), ),
if(_shimmer) if(networkStatus == 0)
ListView.builder( ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: 10, itemCount: 10,
@ -436,4 +437,52 @@ class _FlowPage extends State<FlowPage> {
queryDayFlow(_datetime + "-01", "0"); queryDayFlow(_datetime + "-01", "0");
} }
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

62
lib/business_system/home/overview/trade_goods.dart

@ -50,7 +50,8 @@ class _TradeGoods extends State<TradeGoods> {
BusinessApiService businessService; BusinessApiService businessService;
List<SingleSalesList> singleSalesList = []; List<SingleSalesList> singleSalesList = [];
List<GoodsTypeSalesList> goodsTypeSalesList = []; List<GoodsTypeSalesList> goodsTypeSalesList = [];
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void dispose() { void dispose() {
@ -176,7 +177,6 @@ class _TradeGoods extends State<TradeGoods> {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 2) { if (_loadCount == 2) {
_loadCount = 0; _loadCount = 0;
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
if (mounted) setState(() {}); if (mounted) setState(() {});
@ -199,11 +199,12 @@ class _TradeGoods extends State<TradeGoods> {
"searchType": 2, "searchType": 2,
"type": 1 "type": 1
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
goodsTypeSalesList = baseData.data; goodsTypeSalesList = baseData.data;
networkStatus = 1;
} }
} finally { } finally {
if (isSing) { if (isSing) {
@ -273,7 +274,7 @@ class _TradeGoods extends State<TradeGoods> {
onRefresh:(){ onRefresh:(){
_onRefresh(isLoading: false); _onRefresh(isLoading: false);
}, },
child: SingleChildScrollView( child: networkStatus == -1 ? noNetwork() : SingleChildScrollView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -768,7 +769,7 @@ class _TradeGoods extends State<TradeGoods> {
], ],
), ),
), ),
if(!_shimmer) if(networkStatus == 1)
(goodsTypeSalesList == null || goodsTypeSalesList.length == 0) (goodsTypeSalesList == null || goodsTypeSalesList.length == 0)
? NoDataView( ? NoDataView(
src: "assets/image/bs_no data_logo.webp", src: "assets/image/bs_no data_logo.webp",
@ -794,7 +795,7 @@ class _TradeGoods extends State<TradeGoods> {
}, },
), ),
), ),
if(_shimmer) if(networkStatus == 0)
ListView.builder( ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: 9, itemCount: 9,
@ -1098,4 +1099,51 @@ class _TradeGoods extends State<TradeGoods> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

9
lib/business_system/mine/business_mine_page.dart

@ -34,6 +34,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
BusinessApiService businessService; BusinessApiService businessService;
List<Records> records = []; List<Records> records = [];
double visiblePercentage; double visiblePercentage;
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -63,6 +64,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
.catchError((error) { .catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center); alignment: Alignment.center);
networkStatus = -1;
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
@ -70,6 +72,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
records = baseData.data.records ?? []; records = baseData.data.records ?? [];
refreshController.refreshCompleted(); refreshController.refreshCompleted();
networkStatus = 1;
// EasyLoading.dismiss(); // EasyLoading.dismiss();
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -262,7 +265,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (widget.businessLoginInfo.storeList.length > 1) { if(networkStatus == -1){
queryStoreList();
return;
}
else if (widget.businessLoginInfo.storeList.length > 1) {
Navigator.of(context).pushNamed('/router/select_shop', Navigator.of(context).pushNamed('/router/select_shop',
arguments: {"routeSource": "门店设置", "records": records}); arguments: {"routeSource": "门店设置", "records": records});
} else { } else {

65
lib/business_system/order/business_order_detail.dart

@ -33,7 +33,8 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessApiService businessService; BusinessApiService businessService;
BusinessOrderDetailInfo orderDetailInfo; BusinessOrderDetailInfo orderDetailInfo;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void initState() { void initState() {
@ -62,16 +63,14 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
BaseData<BusinessOrderDetailInfo> baseData = await businessService.getAdminOrderDetail({ BaseData<BusinessOrderDetailInfo> baseData = await businessService.getAdminOrderDetail({
"id": widget.arguments["id"], "id": widget.arguments["id"],
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
orderDetailInfo = baseData.data; orderDetailInfo = baseData.data;
} else { networkStatus = 1;
SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
} }
} finally { } finally {
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (refreshController.isRefresh) refreshController.refreshCompleted();
setState(() {}); setState(() {});
@ -89,7 +88,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: SmartRefresher( body: networkStatus == -1 ? noNetwork():SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
@ -109,7 +108,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
child: Container( child: Container(
margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
child: Column( child: Column(
children: [goodsInfo(), (_shimmer)?orderInfoSm():orderInfo()], children: [goodsInfo(), (networkStatus == 0)?orderInfoSm():orderInfo()],
), ),
), ),
), ),
@ -165,7 +164,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
SizedBox( SizedBox(
height: 12.h, height: 12.h,
), ),
(_shimmer)?ListView.builder( networkStatus == 0?ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: 3, itemCount: 3,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -795,4 +794,52 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
} }
} }
} }
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
queryOrderDetail();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

165
lib/business_system/order/order_list.dart

@ -42,7 +42,8 @@ class _OrderList extends State<OrderList> {
BusinessApiService businessService; BusinessApiService businessService;
List<AdminOrderDtoList> adminOrderDTOList = []; List<AdminOrderDtoList> adminOrderDTOList = [];
int _pageIndex = 1; int _pageIndex = 1;
bool _shimmer = true; String networkError = "";
int networkStatus = 0;
@override @override
void dispose() { void dispose() {
@ -62,7 +63,6 @@ class _OrderList extends State<OrderList> {
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
await queryOrderList(isRefreshData: false); await queryOrderList(isRefreshData: false);
_shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (!mounted) return; if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -103,8 +103,9 @@ class _OrderList extends State<OrderList> {
"showCancelOrder": 1, "showCancelOrder": 1,
"orderType": "" "orderType": ""
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), networkError = AppUtils.dioErrorTypeToString(error.type);
alignment: Alignment.center); networkStatus = -1;
setState(() {});
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}); });
@ -124,6 +125,7 @@ class _OrderList extends State<OrderList> {
break; break;
} }
} }
networkStatus = 1;
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -154,53 +156,56 @@ class _OrderList extends State<OrderList> {
_pageIndex++; _pageIndex++;
_onRefresh(isShowLoad: false); _onRefresh(isShowLoad: false);
}, },
child: (_shimmer) child: networkStatus == -1
? ListView.builder( ? noNetwork()
padding: EdgeInsets.zero, : ((networkStatus==0)
itemCount: 10, ? ListView.builder(
scrollDirection: Axis.vertical, padding: EdgeInsets.zero,
shrinkWrap: true, itemCount: 10,
physics: BouncingScrollPhysics(), scrollDirection: Axis.vertical,
itemBuilder: (context, position) { shrinkWrap: true,
return orderItemSm(); physics: BouncingScrollPhysics(),
}, itemBuilder: (context, position) {
) return orderItemSm();
: ((adminOrderDTOList == null || adminOrderDTOList.length == 0) },
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无数据",
fontSize: 16.sp,
iconHeight: 120.h,
margin: EdgeInsets.all(50.h),
) )
: Padding( : ((adminOrderDTOList == null || adminOrderDTOList.length == 0)
padding: EdgeInsets.only(top: 16.h), ? NoDataView(
child: ListView.builder( src: "assets/image/bs_no data_logo.webp",
itemCount: adminOrderDTOList?.length ?? 0, isShowBtn: false,
physics: BouncingScrollPhysics(), text: "暂无数据",
shrinkWrap: true, fontSize: 16.sp,
itemBuilder: (context, position) { iconHeight: 120.h,
return GestureDetector( margin: EdgeInsets.all(50.h),
behavior: HitTestBehavior.opaque, )
onTap: () { : Padding(
if (widget.isKeyBoardShow) { padding: EdgeInsets.only(top: 16.h),
FocusScope.of(context).requestFocus(FocusNode()); child: ListView.builder(
return; itemCount: adminOrderDTOList?.length ?? 0,
} else { physics: BouncingScrollPhysics(),
Navigator.of(context).pushNamed( shrinkWrap: true,
'/router/business_order_detail', itemBuilder: (context, position) {
arguments: { return GestureDetector(
"id": adminOrderDTOList[position].id, behavior: HitTestBehavior.opaque,
"storeId": widget.storeId onTap: () {
}); if (widget.isKeyBoardShow) {
} FocusScope.of(context)
.requestFocus(FocusNode());
return;
} else {
Navigator.of(context).pushNamed(
'/router/business_order_detail',
arguments: {
"id": adminOrderDTOList[position].id,
"storeId": widget.storeId
});
}
},
child: orderItem(adminOrderDTOList[position]),
);
}, },
child: orderItem(adminOrderDTOList[position]), ),
); ))),
},
),
)),
); );
} }
@ -347,7 +352,8 @@ class _OrderList extends State<OrderList> {
"userName": adminOrderDtoList?.name ?? "", "userName": adminOrderDtoList?.name ?? "",
"ticketStatus": adminOrderDtoList?.ticketStatus, "ticketStatus": adminOrderDtoList?.ticketStatus,
}).then((value) async { }).then((value) async {
queryOrderList(queryId: adminOrderDtoList.orderCode); queryOrderList(
queryId: adminOrderDtoList.orderCode);
}); });
}, },
child: Container( child: Container(
@ -372,7 +378,7 @@ class _OrderList extends State<OrderList> {
), ),
), ),
if (adminOrderDtoList.payStatus == 1 && if (adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0) adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == false)
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
@ -410,6 +416,15 @@ class _OrderList extends State<OrderList> {
), ),
), ),
], ],
),
if(adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == true)
Text(
"备注:暂无退款权限,请前往企业微信联系退款审核人员进行审批",
style: TextStyle(
fontSize: 12.sp,
color: Colors.red,
fontWeight: MyFontWeight.regular),
) )
], ],
), ),
@ -694,4 +709,52 @@ class _OrderList extends State<OrderList> {
), ),
); );
} }
Widget noNetwork() {
return Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
// "无法连接到网络",
networkError.substring(0,4),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
} }

10
lib/retrofit/data/business_order_list.dart

@ -88,7 +88,8 @@ class AdminOrderDtoList {
AdminOrderDtoList({ AdminOrderDtoList({
String id, String id,
String orderCode, String orderCode,
String storeName, String storeName,
bool enableRefundApprover,
num productCount, num productCount,
num orderStatus, num orderStatus,
String orderSum, String orderSum,
@ -133,6 +134,7 @@ class AdminOrderDtoList {
_id = id; _id = id;
_orderCode = orderCode; _orderCode = orderCode;
_storeName = storeName; _storeName = storeName;
_enableRefundApprover = enableRefundApprover;
_productCount = productCount; _productCount = productCount;
_orderStatus = orderStatus; _orderStatus = orderStatus;
_orderSum = orderSum; _orderSum = orderSum;
@ -180,6 +182,7 @@ class AdminOrderDtoList {
_id = json['id']; _id = json['id'];
_orderCode = json['orderCode']; _orderCode = json['orderCode'];
_storeName = json['storeName']; _storeName = json['storeName'];
_enableRefundApprover = json['enableRefundApprover'];
_productCount = json['productCount']; _productCount = json['productCount'];
_orderStatus = json['orderStatus']; _orderStatus = json['orderStatus'];
_orderSum = json['orderSum']; _orderSum = json['orderSum'];
@ -235,6 +238,7 @@ class AdminOrderDtoList {
String _id; String _id;
String _orderCode; String _orderCode;
String _storeName; String _storeName;
bool _enableRefundApprover;
num _productCount; num _productCount;
num _orderStatus; num _orderStatus;
String _orderSum; String _orderSum;
@ -279,6 +283,7 @@ class AdminOrderDtoList {
AdminOrderDtoList copyWith({ String id, AdminOrderDtoList copyWith({ String id,
String orderCode, String orderCode,
String storeName, String storeName,
bool enableRefundApprover,
num productCount, num productCount,
num orderStatus, num orderStatus,
String orderSum, String orderSum,
@ -323,6 +328,7 @@ AdminOrderDtoList copyWith({ String id,
}) => AdminOrderDtoList( id: id ?? _id, }) => AdminOrderDtoList( id: id ?? _id,
orderCode: orderCode ?? _orderCode, orderCode: orderCode ?? _orderCode,
storeName: storeName ?? _storeName, storeName: storeName ?? _storeName,
enableRefundApprover: enableRefundApprover ?? _enableRefundApprover,
productCount: productCount ?? _productCount, productCount: productCount ?? _productCount,
orderStatus: orderStatus ?? _orderStatus, orderStatus: orderStatus ?? _orderStatus,
orderSum: orderSum ?? _orderSum, orderSum: orderSum ?? _orderSum,
@ -368,6 +374,7 @@ AdminOrderDtoList copyWith({ String id,
String get id => _id; String get id => _id;
String get orderCode => _orderCode; String get orderCode => _orderCode;
String get storeName => _storeName; String get storeName => _storeName;
bool get enableRefundApprover => _enableRefundApprover;
num get productCount => _productCount; num get productCount => _productCount;
num get orderStatus => _orderStatus; num get orderStatus => _orderStatus;
String get orderSum => _orderSum; String get orderSum => _orderSum;
@ -415,6 +422,7 @@ AdminOrderDtoList copyWith({ String id,
map['id'] = _id; map['id'] = _id;
map['orderCode'] = _orderCode; map['orderCode'] = _orderCode;
map['storeName'] = _storeName; map['storeName'] = _storeName;
map['enableRefundApprover'] = _enableRefundApprover;
map['productCount'] = _productCount; map['productCount'] = _productCount;
map['orderStatus'] = _orderStatus; map['orderStatus'] = _orderStatus;
map['orderSum'] = _orderSum; map['orderSum'] = _orderSum;

Loading…
Cancel
Save