Browse Source

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

所有骨架屏更改网络异常时显示异常页面;
我的页面,网络异常-禁止门店列表跳转更改;
wr_2023_business
wurong 1 year ago
parent
commit
7463ca70a4
  1. 105
      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. 81
      lib/business_system/order/order_list.dart
  12. 8
      lib/retrofit/data/business_order_list.dart

105
lib/business_system/goods/goods_search_page.dart

@ -46,7 +46,8 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
int _pageIndex = 1;
BusinessApiService businessService;
List<AdminProductVoList> adminProductVoList = [];
bool _shimmer =true;
String networkError = "";
int networkStatus = 0;
@override
void didChangeMetrics() {
@ -91,7 +92,6 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryGoodsList();
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (refreshController.isRefresh) refreshController.refreshCompleted();
@ -116,8 +116,9 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
"pageSize": 10,
"status": widget.arguments["onSaleStatus"],
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
@ -129,6 +130,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
refreshController.loadNoData();
else
refreshController.loadComplete();
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -147,20 +149,21 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"]);
}
BaseData baseData =
await businessService.goodsUpdate({
BaseData baseData = await businessService.goodsUpdate({
"productId": productId,
"sell": widget.arguments["onSaleStatus"] == "1" ? false : true,
}).catchError((error) {
});
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
_pageIndex = 1;
adminProductVoList.clear();
await _onRefresh(isShowLoad: false);
SmartDialog.showToast(widget.arguments["onSaleStatus"] == "1"?"商品下架成功":"商品上架成功", alignment: Alignment.center);
SmartDialog.showToast(
widget.arguments["onSaleStatus"] == "1" ? "商品下架成功" : "商品上架成功",
alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}}finally{
}
} finally {
EasyLoading.dismiss();
}
}
@ -184,8 +187,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom: 16.h),
child:
Container(
child: Container(
height: 40.h,
margin: EdgeInsets.fromLTRB(18.w, 17.h, 18.w, 10.h),
alignment: Alignment.center,
@ -210,8 +212,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
hintStyle: TextStyle(
fontSize: 15.sp,
color: Color(0xFF808080),
fontWeight: MyFontWeight.regular
),
fontWeight: MyFontWeight.regular),
isCollapsed: true,
prefixIcon: Padding(
padding: EdgeInsets.only(left: 5.w, right: 5.w),
@ -228,7 +229,9 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
),
),
Expanded(
child: Container(
child: networkStatus == -1
? noNetwork()
: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
@ -251,7 +254,8 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
_pageIndex++;
_onRefresh(isShowLoad: false);
},
child: (_shimmer)?ListView.builder(
child: networkStatus == 0
? ListView.builder(
padding: EdgeInsets.zero,
itemCount: 10,
scrollDirection: Axis.vertical,
@ -260,8 +264,8 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
itemBuilder: (context, position) {
return searchGoodsItemSm();
},
):
((adminProductVoList == null ||
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
@ -274,12 +278,14 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
margin: EdgeInsets.only(bottom: 20.h),
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: adminProductVoList?.length ?? 0,
itemCount:
adminProductVoList?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return searchGoodsItem(adminProductVoList[position]);
return searchGoodsItem(
adminProductVoList[position]);
},
),
)),
@ -403,8 +409,8 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
width: 1,
),
),
padding:
EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w),
padding: EdgeInsets.symmetric(
vertical: 2.h, horizontal: 12.w),
child: Text(
widget.arguments["onSaleStatus"] == "1" ? "下架" : "上架",
style: TextStyle(
@ -413,8 +419,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
color: Color(0xFF30415B),
),
),
)
)
))
],
)
],
@ -508,7 +513,9 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
),
],
),
SizedBox(height: 7.h,),
SizedBox(
height: 7.h,
),
Row(
children: [
Shimmer.fromColors(
@ -544,4 +551,52 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
),
);
}
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;
BusinessApiService businessService;
List<AdminProductVoList> adminProductVoList = [];
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void dispose() {
@ -59,7 +60,6 @@ class _OffShelfPage extends State<OffShelfPage> {
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryGoodsList();
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -84,8 +84,9 @@ class _OffShelfPage extends State<OffShelfPage> {
"pageSize": 10,
"status": "0"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
@ -98,6 +99,7 @@ class _OffShelfPage extends State<OffShelfPage> {
_refreshController.loadNoData();
else
_refreshController.loadComplete();
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -198,7 +200,7 @@ class _OffShelfPage extends State<OffShelfPage> {
),
),
Expanded(
child: Container(
child: networkStatus == -1?noNetwork():Container(
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
@ -223,7 +225,7 @@ class _OffShelfPage extends State<OffShelfPage> {
},
child: Container(
color: Colors.white,
child: (_shimmer)?ListView.builder(
child: networkStatus == 0 ?ListView.builder(
itemCount:10,
physics: BouncingScrollPhysics(),
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 _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void initState() {
@ -75,7 +76,6 @@ class _BatchShelf extends State<BatchShelf> {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -94,10 +94,6 @@ class _BatchShelf extends State<BatchShelf> {
"size": 100,
"sort": "sort"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
@ -126,8 +122,8 @@ class _BatchShelf extends State<BatchShelf> {
"pageSize": 10,
"status": "1"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
@ -140,6 +136,7 @@ class _BatchShelf extends State<BatchShelf> {
} else {
_refreshController.loadComplete();
}
networkStatus = 1;
} else {
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -235,7 +232,7 @@ class _BatchShelf extends State<BatchShelf> {
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
child:networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
@ -293,7 +290,7 @@ class _BatchShelf extends State<BatchShelf> {
},
child: Container(
color: Colors.white,
child: (_shimmer)
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
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();
BusinessApiService businessService;
ProductGroupList productGroupList;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void initState() {
@ -50,7 +51,6 @@ class _GoodsAssort extends State<GoodsAssort> {
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryProductGroupList();
_shimmer = false;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted)
@ -74,13 +74,15 @@ class _GoodsAssort extends State<GoodsAssort> {
"size": 100,
"sort": "sort"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) {
productGroupList = baseData.data;
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -117,7 +119,7 @@ class _GoodsAssort extends State<GoodsAssort> {
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: Container(
body: networkStatus == -1?noNetwork():Container(
margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w),
child: Column(
children: [
@ -141,7 +143,7 @@ class _GoodsAssort extends State<GoodsAssort> {
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
child: (_shimmer)?ListView.builder(
child: networkStatus == 0 ?ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
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 _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void initState() {
@ -80,7 +81,6 @@ class _GoodsSort extends State<GoodsSort> {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -99,10 +99,6 @@ class _GoodsSort extends State<GoodsSort> {
"size": 100,
"sort": "sort"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
@ -131,8 +127,8 @@ class _GoodsSort extends State<GoodsSort> {
"pageSize": 10,
"status": "1"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkStatus = -1;
networkError = AppUtils.dioErrorTypeToString(error.type);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
@ -145,6 +141,7 @@ class _GoodsSort extends State<GoodsSort> {
} else {
_refreshController.loadComplete();
}
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -200,7 +197,7 @@ class _GoodsSort extends State<GoodsSort> {
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: Row(
body: networkStatus == -1 ? noNetwork() : Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -209,7 +206,7 @@ class _GoodsSort extends State<GoodsSort> {
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
@ -267,7 +264,7 @@ class _GoodsSort extends State<GoodsSort> {
},
child: Container(
color: Colors.white,
child: (_shimmer)
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
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 _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void dispose() {
@ -78,7 +79,6 @@ class _OnSalePage extends State<OnSalePage> {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -97,10 +97,6 @@ class _OnSalePage extends State<OnSalePage> {
"size": 100,
"sort": "sort"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
@ -129,8 +125,8 @@ class _OnSalePage extends State<OnSalePage> {
"pageSize": 10,
"status": "1"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
@ -144,6 +140,7 @@ class _OnSalePage extends State<OnSalePage> {
} else {
_refreshController.loadComplete();
}
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -207,7 +204,8 @@ class _OnSalePage extends State<OnSalePage> {
width: double.infinity,
),
Expanded(
child: Container(
child: networkStatus == -1 ? noNetwork()
:Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -217,7 +215,7 @@ class _OnSalePage extends State<OnSalePage> {
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
@ -276,7 +274,7 @@ class _OnSalePage extends State<OnSalePage> {
},
child: Container(
color: Colors.white,
child: (_shimmer)
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
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 = [];
int _loadCount = 0;
String _datetime;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void initState() {
@ -70,7 +71,6 @@ class _FlowPage extends State<FlowPage> {
_loadCount += 1;
if (_loadCount == 1) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
@ -86,8 +86,8 @@ class _FlowPage extends State<FlowPage> {
try {
BaseData<List<DayFlowList>> baseData =
await businessService.dayFlow(yearMonth, isMonth).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkStatus = -1;
networkError = AppUtils.dioErrorTypeToString(error.type);
});
if (baseData != null && baseData.isSuccess) {
if (isMonth == "0") {
@ -97,6 +97,7 @@ class _FlowPage extends State<FlowPage> {
.firstWhere((element) => element.localDate == yearMonth)
.detailList = baseData.data;
}
networkStatus = 1;
}
} finally {
if (isSing) {
@ -119,7 +120,7 @@ class _FlowPage extends State<FlowPage> {
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: SmartRefresher(
body: networkStatus == -1 ? noNetwork():SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
@ -168,7 +169,7 @@ class _FlowPage extends State<FlowPage> {
SizedBox(
height: 16.h,
),
if(!_shimmer)
if(networkStatus == 1)
(dayFlowList == null || dayFlowList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
@ -190,7 +191,7 @@ class _FlowPage extends State<FlowPage> {
);
},
),
if(_shimmer)
if(networkStatus == 0)
ListView.builder(
padding: EdgeInsets.zero,
itemCount: 10,
@ -436,4 +437,52 @@ class _FlowPage extends State<FlowPage> {
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;
List<SingleSalesList> singleSalesList = [];
List<GoodsTypeSalesList> goodsTypeSalesList = [];
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void dispose() {
@ -176,7 +177,6 @@ class _TradeGoods extends State<TradeGoods> {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
if (mounted) setState(() {});
@ -199,11 +199,12 @@ class _TradeGoods extends State<TradeGoods> {
"searchType": 2,
"type": 1
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
});
if (baseData != null && baseData.isSuccess) {
goodsTypeSalesList = baseData.data;
networkStatus = 1;
}
} finally {
if (isSing) {
@ -273,7 +274,7 @@ class _TradeGoods extends State<TradeGoods> {
onRefresh:(){
_onRefresh(isLoading: false);
},
child: SingleChildScrollView(
child: networkStatus == -1 ? noNetwork() : SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -768,7 +769,7 @@ class _TradeGoods extends State<TradeGoods> {
],
),
),
if(!_shimmer)
if(networkStatus == 1)
(goodsTypeSalesList == null || goodsTypeSalesList.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
@ -794,7 +795,7 @@ class _TradeGoods extends State<TradeGoods> {
},
),
),
if(_shimmer)
if(networkStatus == 0)
ListView.builder(
padding: EdgeInsets.zero,
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;
List<Records> records = [];
double visiblePercentage;
int networkStatus = 0;
@override
void initState() {
@ -63,6 +64,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
.catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkStatus = -1;
refreshController.refreshFailed();
refreshController.loadFailed();
});
@ -70,6 +72,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
if (baseData != null && baseData.isSuccess) {
records = baseData.data.records ?? [];
refreshController.refreshCompleted();
networkStatus = 1;
// EasyLoading.dismiss();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -262,7 +265,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
GestureDetector(
behavior: HitTestBehavior.opaque,
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',
arguments: {"routeSource": "门店设置", "records": records});
} else {

65
lib/business_system/order/business_order_detail.dart

@ -33,7 +33,8 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
final RefreshController refreshController = RefreshController();
BusinessApiService businessService;
BusinessOrderDetailInfo orderDetailInfo;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void initState() {
@ -62,16 +63,14 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
BaseData<BusinessOrderDetailInfo> baseData = await businessService.getAdminOrderDetail({
"id": widget.arguments["id"],
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
});
if (baseData != null && baseData.isSuccess) {
orderDetailInfo = baseData.data;
} else {
SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
networkStatus = 1;
}
} finally {
_shimmer = false;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
setState(() {});
@ -89,7 +88,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: SmartRefresher(
body: networkStatus == -1 ? noNetwork():SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
@ -109,7 +108,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
child: Container(
margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
child: Column(
children: [goodsInfo(), (_shimmer)?orderInfoSm():orderInfo()],
children: [goodsInfo(), (networkStatus == 0)?orderInfoSm():orderInfo()],
),
),
),
@ -165,7 +164,7 @@ class _BusinessOrderDetail extends State<BusinessOrderDetail> {
SizedBox(
height: 12.h,
),
(_shimmer)?ListView.builder(
networkStatus == 0?ListView.builder(
padding: EdgeInsets.zero,
itemCount: 3,
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),
)),
)
],
),
);
}
}

81
lib/business_system/order/order_list.dart

@ -42,7 +42,8 @@ class _OrderList extends State<OrderList> {
BusinessApiService businessService;
List<AdminOrderDtoList> adminOrderDTOList = [];
int _pageIndex = 1;
bool _shimmer = true;
String networkError = "";
int networkStatus = 0;
@override
void dispose() {
@ -62,7 +63,6 @@ class _OrderList extends State<OrderList> {
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryOrderList(isRefreshData: false);
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
@ -103,8 +103,9 @@ class _OrderList extends State<OrderList> {
"showCancelOrder": 1,
"orderType": ""
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
@ -124,6 +125,7 @@ class _OrderList extends State<OrderList> {
break;
}
}
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -154,7 +156,9 @@ class _OrderList extends State<OrderList> {
_pageIndex++;
_onRefresh(isShowLoad: false);
},
child: (_shimmer)
child: networkStatus == -1
? noNetwork()
: ((networkStatus==0)
? ListView.builder(
padding: EdgeInsets.zero,
itemCount: 10,
@ -185,7 +189,8 @@ class _OrderList extends State<OrderList> {
behavior: HitTestBehavior.opaque,
onTap: () {
if (widget.isKeyBoardShow) {
FocusScope.of(context).requestFocus(FocusNode());
FocusScope.of(context)
.requestFocus(FocusNode());
return;
} else {
Navigator.of(context).pushNamed(
@ -200,7 +205,7 @@ class _OrderList extends State<OrderList> {
);
},
),
)),
))),
);
}
@ -347,7 +352,8 @@ class _OrderList extends State<OrderList> {
"userName": adminOrderDtoList?.name ?? "",
"ticketStatus": adminOrderDtoList?.ticketStatus,
}).then((value) async {
queryOrderList(queryId: adminOrderDtoList.orderCode);
queryOrderList(
queryId: adminOrderDtoList.orderCode);
});
},
child: Container(
@ -372,7 +378,7 @@ class _OrderList extends State<OrderList> {
),
),
if (adminOrderDtoList.payStatus == 1 &&
adminOrderDtoList.refundStatus == 0)
adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == false)
GestureDetector(
behavior: HitTestBehavior.opaque,
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),
)),
)
],
),
);
}
}

8
lib/retrofit/data/business_order_list.dart

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

Loading…
Cancel
Save