Browse Source

添加分组页面新增提示;

批量下架页面更改;
首页ui边调整;
登录页面更改;
我的页面更改,新增门店设置,不要商家设置;
订单列表更改,核销显示完成,核销页面待调试核对;
商品排序更改;
商户信息页面改成门店设置,接口页面对接调试完成;
app成就徽章页面调整更改;
分组列表接口更改;
商品页面更改;
订单列表核销更改;
核销页面接口数据对接;
申请退款弹窗更改;
选择门店页面数据调整更改;
新增门店列表实体类;
新增门店设置图片上传页面;
wr_2023_business
wurong 1 year ago
parent
commit
5bf3f6585e
  1. 70
      lib/business_system/goods/on_sale/add_assort.dart
  2. 600
      lib/business_system/goods/on_sale/batch_shelf.dart
  3. 544
      lib/business_system/goods/on_sale/goods_sort.dart
  4. 316
      lib/business_system/goods/on_sale/on_sale_page.dart
  5. 24
      lib/business_system/home/business_home_page.dart
  6. 78
      lib/business_system/home/select_shop.dart
  7. 5
      lib/business_system/login/business_login_page.dart
  8. 200
      lib/business_system/mine/business_mine_page.dart
  9. 1223
      lib/business_system/mine/merchant_info.dart
  10. 356
      lib/business_system/mine/shop_image_info.dart
  11. 15
      lib/business_system/order/order_list.dart
  12. 69
      lib/business_system/order/order_write_off.dart
  13. 6
      lib/business_system/order/request_refund.dart
  14. 5
      lib/home/points_mall_view/points_goods_view.dart
  15. 5
      lib/main.dart
  16. 5
      lib/mine/mine_view/mine_item.dart
  17. 42
      lib/mine/mine_vip/mine_attainment_page.dart
  18. 22
      lib/retrofit/business_api.dart
  19. 76
      lib/retrofit/business_api.g.dart
  20. 462
      lib/retrofit/data/business_order_list.dart
  21. 943
      lib/retrofit/data/business_store_list.dart

70
lib/business_system/goods/on_sale/add_assort.dart

@ -10,6 +10,8 @@ import '../../../generated/l10n.dart';
import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/base_data.dart';
import '../../../utils/business_instance.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/round_button.dart';
class AddAssort extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -80,8 +82,11 @@ class _AddAssort extends State<AddAssort> {
if (baseData != null && baseData.isSuccess) {
EasyLoading.dismiss();
Navigator.of(context).pop();
SmartDialog.showToast(name == "添加分类" ? "分类添加成功" : "分类编辑成功",
alignment: Alignment.center);
if (name == "添加分类")
showProductTipDialog();
else
SmartDialog.showToast(name == "添加分类" ? "分类添加成功" : "分类编辑成功",
alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -240,4 +245,65 @@ class _AddAssort extends State<AddAssort> {
),
);
}
///
showProductTipDialog() {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84.w,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"提示",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 15.h,
),
Text(
"注意:新增分组完成后,请配置打印机,否则无法打印票单!",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFFF4524D),
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 35.h,
),
InkWell(
child: RoundButton(
text: S.of(context).queren,
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF30415B),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
Navigator.of(context).pop();
SmartDialog.showToast("分类添加成功",
alignment: Alignment.center);
},
),
],
),
),
);
},
);
}
}

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

@ -1,12 +1,25 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../../generated/l10n.dart';
import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/base_data.dart';
import '../../../retrofit/data/business_goods.dart';
import '../../../retrofit/data/product_group_list.dart';
import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart';
class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -19,15 +32,150 @@ class BatchShelf extends StatefulWidget {
}
class _BatchShelf extends State<BatchShelf> {
final RefreshController refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final RefreshController _refreshController = RefreshController();
final ScrollController controller = ScrollController();
var checkStatus = false;
BusinessApiService businessService;
ProductGroupList productGroupList;
List<AdminProductVoList> adminProductVoList = [];
List<dynamic> productIds = [];
int _loadCount = 0;
int _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
@override
void initState() {
super.initState();
_onRefresh();
}
@override
void dispose() {
super.dispose();
_refreshController.dispose();
}
_onRefresh({isShowLoad = true}) async {
if (isShowLoad)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"],);
queryProductGroupList();
queryGoodsList(groupIndex != -1 ? productGroupList.records[groupIndex].id : "", isSing: false);
});
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
setState(() {});
}
}
///
queryProductGroupList() async {
try {
BaseData<ProductGroupList> baseData = await businessService.productGroup({
"current": 1,
"map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": 0},
"order": "ascending",
"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) {
productGroupList = baseData.data;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
addLoadCount();
}
}
///
queryGoodsList(groupId, {isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<BusinessGoods> baseData =
await businessService.findAdminProductLis({
"groupId": groupId,
"hasStock": "",
"keyword": "",
"pageIndex": _pageIndex,
"pageSize": 10,
"status": "1"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
adminProductVoList.addAll(baseData?.data?.adminProductVOList ?? []);
if ((baseData?.data?.adminProductVOList ?? []).isEmpty ||
adminProductVoList.length == baseData.data.total) {
_refreshController.loadNoData();
} else {
_refreshController.loadComplete();
}
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
queryGoodsUpdate() async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"]);
}
BaseData baseData = await businessService.goodsUpdate({
"productId": 0,
"productIds": productIds ?? [],
"sell": false,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
_pageIndex = 1;
adminProductVoList.clear();
await queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex]?.id ?? "");
SmartDialog.showToast("商品下架成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
@ -40,152 +188,176 @@ class _BatchShelf extends State<BatchShelf> {
background: Colors.white,
leadingColor: Colors.black,
brightness: Brightness.dark,
action: Container(
alignment: Alignment.center,
child: Text(
S.of(context).queren,
style: TextStyle(
color: Color(0xFF30415B),
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
action: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
if (productIds.length != 0)
productIds.clear();
adminProductVoList.forEach((element) {
if (element.isSelect) productIds.add(element.id);
});
if (productIds.length == 0) {
SmartDialog.showToast("请选择要下架的商品",
alignment: Alignment.center);
return;
} else {
queryGoodsUpdate();
}
},
child: Container(
alignment: Alignment.center,
child: Text(
S.of(context).queren,
style: TextStyle(
color: Color(0xFF30415B),
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
),
),
),
),
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
margin: EdgeInsets.only(top: 24.h,),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.w,
color: Color(0xFFFAFAFA),
height: double.infinity,
child: ListView.builder(
itemCount:5,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: shelfLeftItem(),
);
body: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 100.w,
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfLeftItemSm();
},
)
: ListView.builder(
itemCount: productGroupList?.records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(productGroupList?.records[position].id,);
},
child: shelfLeftItem(
productGroupList.records[position],
position),
);
},
),
),
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp:
adminProductVoList.length != 0 ? true : false,
header: MyHeader(
color: Color(0xFF30415B),
),
),
Expanded(child: Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount: 6,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfGoodsItem();
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
)),
],
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex].id);
},
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
},
child: Container(
color: Colors.white,
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfGoodsItemSm();
},
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src:
"assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "该分组暂无添加商品",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount:
adminProductVoList?.length ?? 0,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfGoodsItem(adminProductVoList[position]);
},
)))),
),
),
],
),
);
}
///list
Widget shelfLeftItem(){
Widget shelfLeftItem(Records records, index){
return Container(
width: 100.w,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
// controller.jumpTo(appletProducts[index].goodsIndex);
});
},
child:
Container(
// color: Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal:14.w),
// margin: EdgeInsets.only(bottom: (index==appletProducts.length - 1)?35.h:0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
"人气必点榜",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight:MyFontWeight.semi_bold,
),
)),
],
),
),
color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
records?.groupName ?? "",
textAlign: TextAlign.center,
style: TextStyle(
color:
groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264),
fontSize: 12.sp,
fontWeight: groupIndex == index
? MyFontWeight.semi_bold
: MyFontWeight.regular,
),
)),
],
),
);
}
// ///List
// Widget shelfRightItem(){
// return Container(
// margin: EdgeInsets.only(left:16.w,right:14.w),
// width: double.infinity,
// child:Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(padding:EdgeInsets.symmetric(vertical: 16.h),
// child: Text("人气必点榜",style: TextStyle(
// color: Color(0xFF30415B),
// fontSize: 12.sp,
// fontWeight:MyFontWeight.regular,
// ),)),
// ListView.builder(
// itemCount: 3,
// controller: controller,
// physics: scrollPhysics,
// shrinkWrap: true,
// itemBuilder: (context, position) {
// return shelfGoodsItem();
// },
// )
// ],
// ),
// );
// }
Widget shelfGoodsItem(){
Widget shelfGoodsItem(AdminProductVoList adminProductVoList){
return Container(
margin: EdgeInsets.only(bottom: 21.h),
child: Row(
children: [
Image.asset(
"assets/image/hot_list.webp",
width: 77,
height: 77,
fit: BoxFit.fill,
MImage(
adminProductVoList?.productImg ?? "",
width: 77.h,
height: 77.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
),
SizedBox(width:12.w,),
Expanded(child:Column(
@ -193,7 +365,7 @@ class _BatchShelf extends State<BatchShelf> {
children: [
Padding(padding:EdgeInsets.only(top: 2.h),
child:Text(
"台湾甄选手抓饺子三生",
adminProductVoList?.productName ?? "",
maxLines:1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -205,7 +377,7 @@ class _BatchShelf extends State<BatchShelf> {
Row(
children: [
Text(
"库存4321",
"库存${adminProductVoList?.stock ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -214,7 +386,7 @@ class _BatchShelf extends State<BatchShelf> {
),
SizedBox(width: 8.w,),
Expanded(child: Text(
"销量4321",
"销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -222,51 +394,169 @@ class _BatchShelf extends State<BatchShelf> {
),
)),
Checkbox(
visualDensity: VisualDensity.compact,
value: checkStatus,
value: adminProductVoList.isSelect,
onChanged: (a) {
setState(() {
checkStatus = !checkStatus;
adminProductVoList.isSelect = !adminProductVoList.isSelect;
});
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2.0),
),
checkColor: Color(0xFFFFFFFF),
fillColor:
MaterialStateProperty.all(Color(0xFF30415B)),
fillColor: MaterialStateProperty.all(Color(0xFF30415B)),
),
],
),
SizedBox(height:7.h,),
Row(
children: [
Expanded(child:Text.rich(
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
text: adminProductVoList?.price ?? "",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
],
),
)
],
)),
],
),
);
}
Widget shelfLeftItemSm() {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 48.w,
height: 30.h,
),
),
);
}
Widget shelfGoodsItemSm() {
return Container(
margin: EdgeInsets.only(bottom: 21.h, left: 16.w, right: 16.w, top: 10.h),
child: Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(4),
),
width: 70.h,
height: 70.h,
),
),
SizedBox(
width: 12.w,
),
Expanded(
child: Column(
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: [
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,
),
TextSpan(
text: "19",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
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,
),
],
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16.h,
height: 16.h,
),
),
],
),
SizedBox(
height: 7.h,
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 28.w,
height: 20.h,
),
)),
),
],
)
],
)),
)),
],
),
);

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

@ -1,11 +1,25 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../../generated/l10n.dart';
import '../../../retrofit/business_api.dart';
import '../../../retrofit/data/base_data.dart';
import '../../../retrofit/data/business_goods.dart';
import '../../../retrofit/data/product_group_list.dart';
import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart';
class GoodsSort extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -18,14 +32,125 @@ class GoodsSort extends StatefulWidget {
}
class _GoodsSort extends State<GoodsSort> {
final RefreshController refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final RefreshController _refreshController = RefreshController();
final ScrollController controller = ScrollController();
BusinessApiService businessService;
ProductGroupList productGroupList;
List<AdminProductVoList> adminProductVoList = [];
int _loadCount = 0;
int _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
@override
void initState() {
super.initState();
_onRefresh();
}
@override
void dispose() {
super.dispose();
_refreshController.dispose();
}
_onRefresh({isShowLoad = true}) async {
if (isShowLoad)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
SharedPreferences.getInstance().then((value) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"],);
queryProductGroupList();
queryGoodsList(groupIndex != -1 ? productGroupList.records[groupIndex].id : "", isSing: false);
});
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
setState(() {});
}
}
///
queryProductGroupList() async {
try {
BaseData<ProductGroupList> baseData = await businessService.productGroup({
"current": 1,
"map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": 0},
"order": "ascending",
"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) {
productGroupList = baseData.data;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
addLoadCount();
}
}
///
queryGoodsList(groupId, {isSing = true}) async {
if (isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try {
BaseData<BusinessGoods> baseData =
await businessService.findAdminProductLis({
"groupId": groupId,
"hasStock": "",
"keyword": "",
"pageIndex": _pageIndex,
"pageSize": 10,
"status": "1"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
adminProductVoList.addAll(baseData?.data?.adminProductVOList ?? []);
if ((baseData?.data?.adminProductVOList ?? []).isEmpty ||
adminProductVoList.length == baseData.data.total) {
_refreshController.loadNoData();
} else {
_refreshController.loadComplete();
}
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
if (isSing) {
setState(() {});
EasyLoading.dismiss();
} else {
addLoadCount();
}
}
}
@override
@ -39,140 +164,150 @@ class _GoodsSort extends State<GoodsSort> {
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
margin: EdgeInsets.only(top: 24.h,),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.w,
color: Color(0xFFFAFAFA),
height: double.infinity,
child: ListView.builder(
itemCount:5,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: sortLeftItem(),
);
body:Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 100.w,
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return sortLeftItemSm();
},
)
: ListView.builder(
itemCount: productGroupList?.records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(productGroupList?.records[position].id,);
},
child: sortLeftItem(
productGroupList.records[position],
position),
);
},
),
),
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp:
adminProductVoList.length != 0 ? true : false,
header: MyHeader(
color: Color(0xFF30415B),
),
),
Expanded(child: Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount: 6,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return sortRightItem();
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
)),
],
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex].id);
},
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
},
child: Container(
color: Colors.white,
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return sortGoodsItemSm();
},
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src:
"assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "该分组暂无添加商品",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount:
adminProductVoList?.length ?? 0,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return sortGoodsItem(adminProductVoList[position]);
},
)))),
),
),
],
),
);
}
///list
Widget sortLeftItem(){
return Container(
width: 100.w,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
// controller.jumpTo(appletProducts[index].goodsIndex);
});
},
child:
Container(
// color: Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal:14.w),
// margin: EdgeInsets.only(bottom: (index==appletProducts.length - 1)?35.h:0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
"人气必点榜",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight:MyFontWeight.semi_bold,
),
)),
],
),
),
),
);
}
///List
Widget sortRightItem(){
///list
Widget sortLeftItem(Records records, index){
return Container(
margin: EdgeInsets.only(left:16.w,right: 14.w),
width: double.infinity,
child:Column(
crossAxisAlignment: CrossAxisAlignment.start,
color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding:EdgeInsets.symmetric(vertical: 16.h),
child: Text("人气必点榜",style: TextStyle(
color: Color(0xFF30415B),
fontSize: 12.sp,
fontWeight:MyFontWeight.regular,
),)),
ListView.builder(
itemCount: 3,
controller: controller,
physics: scrollPhysics,
shrinkWrap: true,
itemBuilder: (context, position) {
return sortGoodsItem();
},
)
Expanded(
child: Text(
records?.groupName ?? "",
textAlign: TextAlign.center,
style: TextStyle(
color:
groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264),
fontSize: 12.sp,
fontWeight: groupIndex == index
? MyFontWeight.semi_bold
: MyFontWeight.regular,
),
)),
],
),
);
}
Widget sortGoodsItem(){
///List
Widget sortGoodsItem(AdminProductVoList adminProductVoList){
return Container(
margin: EdgeInsets.only(bottom: 21.h),
padding: EdgeInsets.only(left: 16.w, right: 14.w),
child: Row(
children: [
Image.asset(
"assets/image/hot_list.webp",
width: 77,
height: 77,
fit: BoxFit.fill,
MImage(
adminProductVoList?.productImg ?? "",
width: 77.h,
height: 77.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
),
SizedBox(width:12.w,),
Expanded(child:Column(
@ -182,7 +317,7 @@ class _GoodsSort extends State<GoodsSort> {
child: Row(
children: [
Expanded(child: Text(
"台湾甄选手抓饺子三生",
adminProductVoList?.productName ?? "",
maxLines:1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -204,7 +339,7 @@ class _GoodsSort extends State<GoodsSort> {
Row(
children: [
Text(
"库存4321",
"库存${adminProductVoList?.stock ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -213,7 +348,7 @@ class _GoodsSort extends State<GoodsSort> {
),
SizedBox(width: 8.w,),
Text(
"销量4321",
"销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -223,34 +358,163 @@ class _GoodsSort extends State<GoodsSort> {
],
),
SizedBox(height:7.h,),
Row(
children: [
Expanded(child:Text.rich(
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
text: adminProductVoList?.price ?? "",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
],
),
)
],
)),
],
),
);
}
Widget sortLeftItemSm() {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 48.w,
height: 30.h,
),
),
);
}
Widget sortGoodsItemSm() {
return Container(
margin: EdgeInsets.only(bottom: 21.h, left: 16.w, right: 16.w, top: 10.h),
child: Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(4),
),
width: 70.h,
height: 70.h,
),
),
SizedBox(
width: 12.w,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Row(
children: [Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 120.w,
height: 20.h,
),
TextSpan(
text: "19",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
SizedBox(
width:10.w,
),
],
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 24.w,
height: 20.h,
),
),],
),
)),
),
Row(
children: [
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,
),
),
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,
),
),
],
),
SizedBox(
height: 7.h,
),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 28.w,
height: 20.h,
),
),
Spacer(),
],
)
],
)
],
)),
)),
],
),
);

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

@ -35,8 +35,6 @@ class OnSalePage extends StatefulWidget {
class _OnSalePage extends State<OnSalePage> {
final RefreshController _refreshController = RefreshController();
final RefreshController refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController();
BusinessApiService businessService;
ProductGroupList productGroupList;
@ -50,7 +48,6 @@ class _OnSalePage extends State<OnSalePage> {
void dispose() {
super.dispose();
_refreshController.dispose();
refreshController.dispose();
}
@override
@ -83,8 +80,9 @@ class _OnSalePage extends State<OnSalePage> {
_loadCount = 0;
_shimmer = false;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (!mounted) setState(() {});
if (!mounted) return;
if (_refreshController.isRefresh) _refreshController.refreshCompleted();
setState(() {});
}
}
@ -94,14 +92,15 @@ class _OnSalePage extends State<OnSalePage> {
BaseData<ProductGroupList> baseData = await businessService.productGroup({
"current": 1,
"map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": ""},
"model": {"groupImg": "", "groupName": "", "isDelete": 0},
"order": "ascending",
"size": 100,
"sort": "sort"
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
@ -132,10 +131,8 @@ class _OnSalePage extends State<OnSalePage> {
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
// _refreshController.refreshFailed();
// _refreshController.loadFailed();
refreshController.refreshFailed();
refreshController.loadFailed();
_refreshController.refreshFailed();
_refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
@ -143,11 +140,9 @@ class _OnSalePage extends State<OnSalePage> {
widget.total(baseData.data.total.toString());
if ((baseData?.data?.adminProductVOList ?? []).isEmpty ||
adminProductVoList.length == baseData.data.total) {
// _refreshController.loadNoData();
refreshController.loadNoData();
_refreshController.loadNoData();
} else {
// _refreshController.loadComplete();
refreshController.loadComplete();
_refreshController.loadComplete();
}
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -163,7 +158,7 @@ class _OnSalePage extends State<OnSalePage> {
}
///
queryGoodsUpdate({isSing = true}) async {
queryGoodsUpdate() async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
@ -204,200 +199,107 @@ class _OnSalePage extends State<OnSalePage> {
),
Expanded(
child: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 100.w,
height: double.infinity,
padding: EdgeInsets.only(bottom: 70.h),
color: Color(0xFFFAFAFA),
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return leftItemSm();
},
)
: ListView.builder(
itemCount: productGroupList?.records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(
productGroupList?.records[position].id);
},
child: leftItem(
productGroupList.records[position],
position),
);
},
),
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
),
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: SmartRefresher(
controller: _refreshController,
enablePullDown: true,
enablePullUp:
adminProductVoList.length != 0 ? true : false,
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 100.w,
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return leftItemSm();
},
),
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1
? ""
: productGroupList?.records[groupIndex].id);
},
onRefresh: () {
_pageIndex = 1;
adminProductVoList.clear();
_onRefresh(isShowLoad: false);
},
child: Container(
color: Colors.white,
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return rightGoodsSm();
},
)
: ((adminProductVoList == null ||
adminProductVoList.length == 0)
? NoDataView(
src:
"assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "该分组暂无添加商品",
fontSize: 16.sp,
margin: EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount:
productGroupList?.records?.length ??
0,
physics: NeverScrollableScrollPhysics(),
adminProductVoList?.length ?? 0,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(
productGroupList
?.records[position].id,
isSing: false);
});
},
child: leftItem(
productGroupList
.records[position],
position),
);
return rightGoodsItem(
adminProductVoList[position]);
},
),
),
Container(
width:
MediaQuery.of(context).size.width - 100.w,
child: SmartRefresher(
controller: _refreshController,
enablePullDown: false,
enablePullUp: adminProductVoList.length != 0
? true
: false,
header: MyHeader(
color: Color(0xFF30415B),
),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1
? ""
: productGroupList
?.records[groupIndex].id);
},
child: Container(
color: Colors.white,
child: (_shimmer)
? ListView.builder(
itemCount: 10,
physics:
BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder:
(context, position) {
return rightGoodsSm();
},
)
: ((adminProductVoList == null ||
adminProductVoList.length ==
0)
? NoDataView(
src:
"assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "该分组暂无添加商品",
fontSize: 16.sp,
margin:
EdgeInsets.all(20.h),
)
: ListView.builder(
itemCount:
adminProductVoList
?.length ??
0,
controller: controller,
physics:
BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder:
(context, position) {
return rightGoodsItem(
adminProductVoList[
position]);
},
)))),
),
],
))
// SmartRefresher(
// controller: _refreshController,
// enablePullDown: true,
// enablePullUp: true,
// header: MyHeader(
// color: Color(0xFF30415B),
// ),
// physics: BouncingScrollPhysics(),
// footer: CustomFooter(
// builder: (context, mode) {
// return MyFooter(mode);
// },
// ),
// onRefresh: () {
// _pageIndex = 1;
// adminProductVoList.clear();
// _onRefresh(isShowLoad: false);
// },
// onLoading: () {
// _pageIndex++;
// queryGoodsList(groupIndex == -1 ? "" : productGroupList.records[groupIndex].id);
// },
// child: Container(
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// width: 100.w,
// child: ListView.builder(
// itemCount: productGroupList?.records?.length ?? 0,
// physics: BouncingScrollPhysics(),
// shrinkWrap: true,
// itemBuilder: (context, position) {
// return GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {},
// child: leftItem(productGroupList.records[position],position),
// );
// },
// ),
// ),
// Container(
// width:
// MediaQuery.of(context).size.width - 100.w,
// child: ListView.builder(
// itemCount: adminProductVoList?.length ?? 0,
// controller: controller,
// physics: BouncingScrollPhysics(),
// shrinkWrap: true,
// itemBuilder: (context, position) {
// return rightGoodsItem(adminProductVoList[position]);
// },
// ),
// ),
// ],
// ),
// ),
// ),
)),
SizedBox(
height: 70.h,
)
)))),
),
],
))),
],
),
Row(
@ -443,7 +345,8 @@ class _OnSalePage extends State<OnSalePage> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/goods_sort');
Navigator.of(context).pushNamed('/router/goods_sort',
arguments: {"storeId": widget.storeId});
},
child: Container(
color: Color(0xFFEDEDED),
@ -479,7 +382,8 @@ class _OnSalePage extends State<OnSalePage> {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/batch_shelf');
Navigator.of(context).pushNamed('/router/batch_shelf',
arguments: {"storeId": widget.storeId});
},
child: Container(
color: Color(0xFFEDEDED),
@ -568,7 +472,7 @@ class _OnSalePage extends State<OnSalePage> {
///list
Widget leftItem(Records records, index) {
return Container(
color: groupIndex == index ? Colors.transparent : Color(0xFFFAFAFA),
color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Row(
@ -668,7 +572,7 @@ class _OnSalePage extends State<OnSalePage> {
TextSpan(
text: adminProductVoList?.price ?? "",
style: TextStyle(
fontSize: 14.sp,
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),

24
lib/business_system/home/business_home_page.dart

@ -588,10 +588,11 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding:
EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h),
EdgeInsets.only(left:9.w, right:9.w, top: 12.h, bottom: 12.h),
child: Column(
children: [
Row(
Padding(padding:EdgeInsets.only(left:7.w,),
child: Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
@ -608,11 +609,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
),
],
),
)),
SizedBox(
height: 12.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: GestureDetector(
@ -622,6 +625,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFC5A58), Color(0xFFFF716F)],
@ -668,9 +672,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
),
),
)),
SizedBox(
width: 9.w,
),
// SizedBox(
// width: 9.w,
// ),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
@ -680,6 +684,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
@ -725,9 +730,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
))),
SizedBox(
width: 9.w,
),
// SizedBox(
// width: 9.w,
// ),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
@ -737,6 +742,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],

78
lib/business_system/home/select_shop.dart

@ -3,9 +3,11 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
@ -23,22 +25,23 @@ class SelectShop extends StatefulWidget {
class _SelectShop extends State<SelectShop> {
final RefreshController refreshController = RefreshController();
BusinessLoginInfo businessLoginInfo;
List<Records> records = [];
int selectIndex = 0;
@override
void initState() {
super.initState();
businessLoginInfo = widget.arguments["businessLoginInfo"];
records = widget.arguments["records"];
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: Color(0xFFF8F8FA),
appBar: MyAppBar(
title: "选择门店",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
brightness: Brightness.dark,
),
@ -73,7 +76,7 @@ class _SelectShop extends State<SelectShop> {
width: 4.w,
),
Text(
"门店切换",
(widget.arguments["routeSource"] == "门店设置")?"请选择门店":"请选择登录门店",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
@ -87,7 +90,7 @@ class _SelectShop extends State<SelectShop> {
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: businessLoginInfo?.storeList?.length ?? 0,
itemCount: (widget.arguments["routeSource"] == "门店设置") ? (records?.length ?? 0):(businessLoginInfo?.storeList?.length ?? 0),
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
@ -98,20 +101,29 @@ class _SelectShop extends State<SelectShop> {
selectIndex = position;
});
},
child: shopsItem(
businessLoginInfo?.storeList[position], position),
child: (widget.arguments["routeSource"] == "门店设置") ? merchantItem(records[position], position):
shopsItem(businessLoginInfo?.storeList[position], position),
);
},
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushReplacementNamed(
'/router/business_page',
arguments: {
"selectStoreIndex": selectIndex,
"businessLoginInfo": businessLoginInfo,
});
if(widget.arguments["routeSource"] == "门店设置"){
Navigator.of(context)
.popAndPushNamed('/router/merchant_info',arguments: {
"storeId": records[selectIndex]?.id ?? "",
"storeName": records[selectIndex]?.storeName ?? "",
"records": records[selectIndex],
});
}else{
Navigator.of(context).pushReplacementNamed(
'/router/business_page',
arguments: {
"selectStoreIndex": selectIndex,
"businessLoginInfo": businessLoginInfo,
});
}
},
child: Container(
width: double.infinity,
@ -180,4 +192,46 @@ class _SelectShop extends State<SelectShop> {
),
);
}
Widget merchantItem(Records records, index) {
return Container(
height: 52.h,
margin: EdgeInsets.only(bottom: 12),
child: Stack(
alignment: Alignment.bottomRight,
children: [
Container(
height: 52.h,
width: double.infinity,
decoration: BoxDecoration(
color: selectIndex == index ? Color(0xFFEFF5FF) : Colors.white,
borderRadius: BorderRadius.circular(4.w),
border: Border.all(
color: selectIndex == index ? Color(0xFF30415B) : Colors.white,
width: selectIndex == index ? 1.w : 0,
),
),
padding: EdgeInsets.only(
top: 16.h, bottom: 16.h, left: 16.w, right: 17.w),
child: Text(
records?.storeName ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: selectIndex == index
? Color(0xFF30415B)
: Color(0xFF0D0D0D)),
),
),
if (selectIndex == index)
Image.asset(
"assets/image/bs_shop.webp",
width: 20,
height: 20,
fit: BoxFit.fill,
),
],
),
);
}
}

5
lib/business_system/login/business_login_page.dart

@ -93,7 +93,9 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
});
if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data);
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
if(businessLoginInfo.storeList.length > 1){
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
}
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('account', _userPhoneController.text);
@ -102,6 +104,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
Navigator.of(context)
.pushReplacementNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo,
"routeSource":"登录",
});
} else {
Navigator.of(context)

200
lib/business_system/mine/business_mine_page.dart

@ -1,19 +1,29 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart';
import '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
class BusinessMinePage extends StatefulWidget {
final BusinessLoginInfo businessLoginInfo;
final String storeId;
BusinessMinePage(this.businessLoginInfo,this.storeId);
BusinessMinePage(this.businessLoginInfo, this.storeId);
@override
State<StatefulWidget> createState() {
return _BusinessMinePage();
@ -23,15 +33,48 @@ class BusinessMinePage extends StatefulWidget {
class _BusinessMinePage extends State<BusinessMinePage>
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController();
BusinessApiService businessService;
List<Records> records = [];
@override
void initState() {
super.initState();
queryStoreList();
}
@override
void dispose() {
super.dispose();
refreshController.dispose();
}
///
queryStoreList() async {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData<BusinessStoreList> baseData =
await businessService.getStoreList(BusinessInstance.instance.businessTenant,"1","100").catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
records = baseData.data.records ?? [];
refreshController.refreshCompleted();
EasyLoading.dismiss();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
@ -45,7 +88,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(color:Color(0xFF30415B)),
header: MyHeader(color: Color(0xFF30415B)),
physics: BouncingScrollPhysics(),
footer: CustomFooter(
builder: (context, mode) {
@ -53,8 +96,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
},
),
onRefresh: () {
if(widget.businessLoginInfo != null)
refreshController.refreshCompleted();
if (widget.businessLoginInfo != null){
// if(widget.businessLoginInfo.storeList.length <= 1)
queryStoreList();
// refreshController.refreshCompleted();
}
else
refreshController.refreshFailed();
},
@ -67,14 +113,15 @@ class _BusinessMinePage extends State<BusinessMinePage>
commonFunctions(),
otherFunctions(),
SizedBox(
height:54.h,
height: 54.h,
),
Text(
"@回乡信息公司",
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium),),
fontWeight: MyFontWeight.medium),
),
],
),
)),
@ -106,9 +153,10 @@ class _BusinessMinePage extends State<BusinessMinePage>
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
Navigator.of(context).pushNamed('/router/account_information',arguments: {
"businessLoginInfo":widget.businessLoginInfo,
onTap: () {
Navigator.of(context)
.pushNamed('/router/account_information', arguments: {
"businessLoginInfo": widget.businessLoginInfo,
});
},
child: Container(
@ -116,15 +164,22 @@ class _BusinessMinePage extends State<BusinessMinePage>
top: MediaQuery.of(context).padding.top + 50, left: 16.w),
child: Row(
children: [
MImage(
widget?.businessLoginInfo?.avatar ?? "",
fit: BoxFit.cover,
width: 69.h,
height: 69.h,
radius: BorderRadius.circular(100),
errorSrc: "assets/image/bs_mine_heading.webp",
fadeSrc: "assets/image/bs_mine_heading.webp",
),
(widget?.businessLoginInfo?.avatar != "")
? MImage(
widget?.businessLoginInfo?.avatar ?? "",
fit: BoxFit.cover,
width: 69.h,
height: 69.h,
radius: BorderRadius.circular(100),
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
)
: Image.asset(
"assets/image/bs_mine_heading.webp",
width: 69,
height: 69,
fit: BoxFit.fill,
),
SizedBox(
width: 10.w,
),
@ -163,7 +218,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
///
Widget commonFunctions() {
return Container(
margin: EdgeInsets.only(top:26.h, left: 16.w, right:17.w,bottom:23.h),
margin: EdgeInsets.only(top: 26.h, left: 16.w, right: 17.w, bottom: 23.h),
child: Column(
children: [
Row(
@ -183,82 +238,113 @@ class _BusinessMinePage extends State<BusinessMinePage>
),
],
),
SizedBox(height:20.h,),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
Navigator.of(context).pushNamed('/router/merchant_info',arguments:{
"storeId":widget.storeId,
});
},
child:
commonFunctionsItem("assets/image/bs_store_info_logo.webp", "商户信息", widget?.businessLoginInfo?.name ?? ""),
SizedBox(
height: 20.h,
),
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: (){
// Navigator.of(context).pushNamed('/router/merchant_info',arguments:{
// "storeId":widget.storeId,
// });
// },
// child:
// commonFunctionsItem("assets/image/bs_store_info_logo.webp", "商户信息", widget?.businessLoginInfo?.name ?? ""),
// ),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
margin: EdgeInsets.only(left:32.w,bottom:12.h),
margin: EdgeInsets.only(left: 32.w, bottom: 12.h),
),
// commonFunctionsItem("assets/image/bs_shop_logo.webp", "门店设置", ""),
// Container(
// width: double.infinity,
// height: 1.h,
// color: Color(0xFFEBECEF),
// margin: EdgeInsets.only(left:32.w,bottom:12.h),
// ),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
Navigator.of(context).pushNamed('/router/security_setting',arguments:{
"storeId":widget.storeId,
"businessLoginInfo":widget.businessLoginInfo,
});
onTap: () {
if(widget.businessLoginInfo.storeList.length > 1){
Navigator.of(context)
.pushNamed('/router/select_shop', arguments: {
"routeSource":"门店设置",
"records":records
});
}else{
Navigator.of(context)
.pushNamed('/router/merchant_info',arguments: {
"storeId": widget.storeId,
"storeName": records[0].storeName,
"records": records[0],
});
}
},
child: commonFunctionsItem("assets/image/bs_secure.webp", "安全设置", "登录手机号/密码")
child: commonFunctionsItem("assets/image/bs_shop_logo.webp", "门店设置",""),
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
margin: EdgeInsets.only(left: 32.w, bottom: 12.h),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/security_setting', arguments: {
"storeId": widget.storeId,
"businessLoginInfo": widget.businessLoginInfo,
});
},
child: commonFunctionsItem(
"assets/image/bs_secure.webp", "安全设置", "登录手机号/密码")),
],
),
);
}
Widget commonFunctionsItem(icon,leftText,rightText){
Widget commonFunctionsItem(icon, leftText, rightText) {
return Container(
margin: EdgeInsets.only(bottom:14.h),
margin: EdgeInsets.only(bottom: 14.h),
child: Row(
children: [
Image.asset(
icon,
width: 24,
height:24,
fit: BoxFit.fill,),
SizedBox(width:8.w,),
Expanded(child: Text(
height: 24,
fit: BoxFit.fill,
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
leftText,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium),)),
fontWeight: MyFontWeight.medium),
)),
Text(
rightText,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF353535),
fontWeight: MyFontWeight.medium),),
fontWeight: MyFontWeight.medium),
),
Image.asset(
"assets/image/icon_right_z.webp",
width: 16,
height:16,
color: Color(0xFF353535),
height: 16,
color: Color(0xFF353535),
),
],
),
);
}
Widget otherFunctions(){
Widget otherFunctions() {
return Container(
margin: EdgeInsets.only(left: 16.w, right:17.w,),
margin: EdgeInsets.only(
left: 16.w,
right: 17.w,
),
child: Column(
children: [
Row(
@ -278,7 +364,9 @@ class _BusinessMinePage extends State<BusinessMinePage>
),
],
),
SizedBox(height:20.h,),
SizedBox(
height: 20.h,
),
commonFunctionsItem("assets/image/bs_user.webp", "关于我们", ""),
],
),

1223
lib/business_system/mine/merchant_info.dart

File diff suppressed because it is too large Load Diff

356
lib/business_system/mine/shop_image_info.dart

@ -0,0 +1,356 @@
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/svg.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/upload_result.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/cupertino_date_picker.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/business_api.dart';
import '../../utils/business_instance.dart';
class ShopImageInfo extends StatefulWidget {
final Map<String, dynamic> arguments;
ShopImageInfo({this.arguments});
@override
State<StatefulWidget> createState() {
return _ShopImageInfo();
}
}
class _ShopImageInfo extends State<ShopImageInfo> {
String filePath;
String logoPath;
BusinessApiService businessService;
Map<String, String> imageInfo = {
"logo": "",
"facade": "",
};
@override
void initState() {
super.initState();
// SharedPreferences.getInstance().then((value) => {
// imageInfo["logo"] = widget.arguments["logo"],
// imageInfo["facade"] = widget.arguments["facade"],
// });
}
refresh() async {
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFFF8F8FA),
appBar: MyAppBar(
title: "门店图片",
titleColor: Colors.black,
background: Color(0xFFFFFFFF),
leadingColor: Colors.black,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
padding: EdgeInsets.only(top: 16.h, left: 18.w, bottom: 16.h),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
"店铺logo",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
showImagePicker(1);
},
child: Container(
height: 77.h,
width: 77.h,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
borderRadius: BorderRadius.circular(4),
),
alignment: Alignment.center,
child: (widget.arguments["logo"] != "")
? (logoPath == null
? MImage(
widget.arguments["logo"],
fit: BoxFit.contain,
radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
)
: Image.file(
File(logoPath),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
fit: BoxFit.cover,
))
: SvgPicture.asset(
"assets/svg/zhaopianshipin.svg",
width: 24.h,
height: 24.h,
fit: BoxFit.contain,
),
),
)
],
),
),
Container(
margin: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
padding: EdgeInsets.only(top: 16.h, left: 18.w, bottom: 16.h),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
"门面图",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
showImagePicker(2);
},
child: Container(
height: 77.h,
width: 77.h,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
borderRadius: BorderRadius.circular(4),
),
alignment: Alignment.center,
child: (widget.arguments["facade"] != "")
? (filePath == null
? MImage(
widget.arguments["facade"],
fit: BoxFit.contain,
radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
)
: Image.file(
File(filePath),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
fit: BoxFit.cover,
))
: SvgPicture.asset(
"assets/svg/zhaopianshipin.svg",
width: 24.h,
height: 24.h,
fit: BoxFit.contain,
),
),
)
],
),
),
Spacer(),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
Navigator.of(context).pop([imageInfo["logo"] == "" ? widget.arguments["logo"]:imageInfo["logo"],
imageInfo["facade"] == "" ? widget.arguments["facade"]:imageInfo["facade"]]);
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 55.h, left: 16.w, right: 16.w),
padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27),
color: Color(0xFF30415B)),
child: Text(
S.of(context).baocun,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 16.sp,
color: Colors.white,
),
),
),
)
],
),
);
}
///
showImagePicker(index) {
showCupertinoModalPopup(
context: context,
builder: (contetx) {
return CupertinoActionSheet(
title: Text(S.of(context).genghuantouxiang),
actions: [
CupertinoActionSheetAction(
child: Text(S.of(context).paizhao),
onPressed: () {
openCamera(index);
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
CupertinoActionSheetAction(
child: Text(S.of(context).xiangce),
onPressed: () {
openStorage(index);
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).quxiao),
isDestructiveAction: true,
),
);
});
}
///
openCamera(index) async {
if (await Permission.camera.isGranted) {
Media medias = await ImagePickers.openCamera(
cameraMimeType: CameraMimeType.photo,
cropConfig: CropConfig(
enableCrop: true,
width: 200,
height: 200,
),
compressSize: 500,
);
if (medias == null) return;
if(index == 1){
logoPath = medias.path;
}else{
filePath = medias.path;
}
fileImgUpload(index);
} else {
await Permission.camera.request();
openCamera(index);
}
}
///
openStorage(index) async {
if (await Permission.storage.isGranted) {
List<Media> medias = await ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 1,
showGif: true,
showCamera: false,
compressSize: 500,
uiConfig: UIConfig(
uiThemeColor: Color(0xFFFFFFFF),
),
cropConfig: CropConfig(
enableCrop: true,
width: 200,
height: 200,
),
);
if (medias == null || medias.length == 0) return;
if (index == 1) {
logoPath = medias[0].path;
} else {
filePath = medias[0].path;
}
setState(() {});
fileImgUpload(index);
} else {
await Permission.storage.request();
openStorage(index);
}
}
///
fileImgUpload(index) async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.arguments["storeId"]);
}
if (logoPath != null && logoPath != "" && await File(logoPath).exists() || filePath != null && filePath != "" && await File(filePath).exists()) {
BaseData<UploadResult> baseData = await businessService
.upload(File(index == 1 ? logoPath:filePath), 1)
.catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
UploadResult uploadResult = baseData.data;
if (index == 1) {
imageInfo["logo"] = uploadResult.url;
} else {
imageInfo["facade"] = uploadResult.url;
}
}
EasyLoading.dismiss();
}
}
}

15
lib/business_system/order/order_list.dart

@ -7,7 +7,6 @@ import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../../utils/font_weight.dart';
@ -42,6 +41,7 @@ class _OrderList extends State<OrderList> {
List<AdminOrderDtoList> adminOrderDTOList = [];
int _pageIndex = 1;
bool _shimmer = true;
int index = 0;
@override
void dispose() {
@ -251,7 +251,9 @@ class _OrderList extends State<OrderList> {
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
onTap: () {
index = position;
},
child: orderGoodsList(
adminOrderDtoList.orderProductList[position]),
);
@ -318,12 +320,17 @@ class _OrderList extends State<OrderList> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Spacer(),
if(adminOrderDtoList.ticketStatus != null)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/order_write_off');
.pushNamed('/router/order_write_off', arguments:{
"tickets":adminOrderDtoList.tickets,
"productName": adminOrderDtoList.orderProductList[index].productName,
"orderCode": adminOrderDtoList?.orderCode ?? "",
"userName":adminOrderDtoList?.name ?? ""
});
},
child: Container(
decoration: BoxDecoration(

69
lib/business_system/order/order_write_off.dart

@ -4,10 +4,15 @@ import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/data/business_order_list.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class OrderWriteOff extends StatefulWidget {
final Map<String, dynamic> arguments;
OrderWriteOff({this.arguments});
@override
State<StatefulWidget> createState() {
return _OrderWriteOff();
@ -17,10 +22,14 @@ class OrderWriteOff extends StatefulWidget {
class _OrderWriteOff extends State<OrderWriteOff> {
final RefreshController refreshController = RefreshController();
var writeOffCheck = false;
List<Tickets> tickets;
String productName;
@override
void initState() {
super.initState();
tickets = widget.arguments["tickets"];
productName = widget.arguments["productName"];
}
@override
@ -123,10 +132,10 @@ class _OrderWriteOff extends State<OrderWriteOff> {
SizedBox(
height: 12.h,
),
basicInfoItem("票券名称:","单人尊享票"),
basicInfoItem("用户名称::","李哈哈"),
basicInfoItem("票券名称:",productName ?? ""),
basicInfoItem("用户名称::",widget?.arguments["userName"] ?? ""),
basicInfoItem("票券编号::","177777622222223"),
basicInfoItem("订单编号::","7666677777777772233")
basicInfoItem("订单编号::",widget?.arguments["orderCode"] ?? ""),
],
),
);
@ -204,14 +213,14 @@ class _OrderWriteOff extends State<OrderWriteOff> {
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: 3,
itemCount: tickets?.length ?? 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: writeOffInfoItem(),
child: writeOffInfoItem(tickets[position]),
);
},
)
@ -220,7 +229,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
);
}
Widget writeOffInfoItem(){
Widget writeOffInfoItem(Tickets tickets){
return Container(
width: double.infinity,
child: Column(
@ -230,11 +239,11 @@ class _OrderWriteOff extends State<OrderWriteOff> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Text(
"台湾天然手作牡丹茶*1(牡丹野餐区茶饮车兑换)",
tickets?.name ?? "",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
color: tickets.state == 1?Color(0xFF0D0D0D):Color(0xFFABACAB),
),
)),
Expanded(child: Column(
@ -242,14 +251,15 @@ class _OrderWriteOff extends State<OrderWriteOff> {
children: [
Padding(padding: EdgeInsets.only(right:10.w),
child: Text(
"已核销",
(tickets.state == 1)?"待核销":"已核销",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: Color(0xFFACACAC),
color: (tickets.state == 1)?Color(0xFF30415B):Color(0xFFACACAC),
),
),),
SizedBox(height:25.h,),
if(tickets.state == 1)
Checkbox(
value: writeOffCheck,
onChanged: (a) {
@ -267,25 +277,26 @@ class _OrderWriteOff extends State<OrderWriteOff> {
))
],
),
// Align(
// alignment: Alignment.centerRight,
// child:Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(
// 2,
// ),
// border: Border.all(
// color: Color(0xFFCFCFCF),
// width: 1.w,
// ),
// ),
// child: Icon(
// Icons.check,
// color: Color(0xFFCFCFCF),
// size: 14.w,
// )
// ),),
Align(
alignment: Alignment.centerRight,
child:Container(
margin: EdgeInsets.only(right:10.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
2,
),
border: Border.all(
color: Color(0xFFCFCFCF),
width: 1.w,
),
),
child: Icon(
Icons.check,
color: Color(0xFFCFCFCF),
size: 14.w,
)
),),
Container(
margin: EdgeInsets.only(bottom:11.h,top: 13.h),
width: double.infinity,

6
lib/business_system/order/request_refund.dart

@ -368,9 +368,9 @@ class _RequestRefund extends State<RequestRefund> {
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 139.h,
width: MediaQuery.of(context).size.width - 84.w,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -476,7 +476,7 @@ class _RequestRefund extends State<RequestRefund> {
Expanded(
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.symmetric(vertical: 12),
margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 41.w),
child: Text(
"退款原因",
style: TextStyle(

5
lib/home/points_mall_view/points_goods_view.dart

@ -46,11 +46,6 @@ class _PointGoods extends State<PointGoods> {
@override
Widget build(BuildContext context) {
return Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(4),
// color: Colors.white,
// ),
// margin: EdgeInsets.only(top: 16.h,right: 14.w,left: 14.w),
child:(widget.goods == null || widget.goods.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",

5
lib/main.dart

@ -102,6 +102,7 @@ import 'business_system/login/business_login_page.dart';
import 'business_system/mine/account_information.dart';
import 'business_system/mine/merchant_info.dart';
import 'business_system/mine/security_setting.dart';
import 'business_system/mine/shop_image_info.dart';
import 'business_system/order/business_order_detail.dart';
import 'business_system/order/order_write_off.dart';
import 'business_system/order/request_refund.dart';
@ -489,7 +490,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/business_order_detail': (context, {arguments}) =>
BusinessOrderDetail(arguments: arguments),
'/router/order_write_off': (context, {arguments}) =>
OrderWriteOff(),
OrderWriteOff(arguments: arguments),
'/router/security_setting': (context, {arguments}) =>
SecuritySetting(arguments: arguments),
'/router/merchant_info': (context, {arguments}) =>
@ -506,4 +507,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
MonthlyReportPage(),
'/router/custom_page': (context, {arguments}) =>
CustomPage(),
'/router/shop_image_info': (context, {arguments}) =>
ShopImageInfo(arguments:arguments),
};

5
lib/mine/mine_view/mine_item.dart

@ -31,7 +31,6 @@ class _MineItem extends State<MineItem> {
"account": account,
"password": password,
};
EasyLoading.show(
status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
@ -44,7 +43,9 @@ class _MineItem extends State<MineItem> {
});
if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data);
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
if(businessLoginInfo.storeList.length > 1) {
businessLoginInfo.storeList.insert(0, StoreList(name: "所有门店"));
}
BusinessInstance.instance.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token;
if (businessLoginInfo.storeList.length > 1) {

42
lib/mine/mine_vip/mine_attainment_page.dart

@ -170,17 +170,17 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
physics: BouncingScrollPhysics(),
child: Column(
children: [
SizedBox(height: 24),
SizedBox(height: 24.h),
MImage(
userInfo?.headimg ?? "",
isCircle: true,
width: 58,
height: 58,
width: 58.h,
height: 58.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_user.webp",
fadeSrc: "assets/image/default_user.webp",
),
SizedBox(height: 8),
SizedBox(height: 8.h),
Text(
userInfo?.nickname ?? S.of(context).denglu,
style: TextStyle(
@ -189,11 +189,11 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535),
),
),
SizedBox(height: 28),
SizedBox(height: 28.h),
Container(
margin: EdgeInsets.only(
left: 16, right: 16, top: 26, bottom: 8),
padding: EdgeInsets.all(20),
left: 16.w, right: 16.w, top: 26.h, bottom: 8.h),
padding: EdgeInsets.symmetric(vertical: 20.h,),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
@ -210,6 +210,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(padding:EdgeInsets.symmetric(horizontal:20.w),
child:
Row(
children: [
Text(
@ -244,8 +246,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)),
),
],
),
SizedBox(height: 12),
)),
SizedBox(height: 12.h),
attainmentBadge(),
],
),
@ -269,14 +271,14 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量
crossAxisCount: 3,
//Widget之间间距
crossAxisSpacing: 13,
//Widget之间间距
mainAxisSpacing: 12,
//Widget宽高比例
childAspectRatio: AppUtils.textScale(context) > 1
? (1 - ((AppUtils.textScale(context) - 1)))
: 0.85,
// //Widget之间间距
// crossAxisSpacing: 13,
// //Widget之间间距
// mainAxisSpacing: 12,
// //Widget宽高比例
// childAspectRatio: AppUtils.textScale(context) > 1
// ? (1 - ((AppUtils.textScale(context) - 1)))
// : 0.85,
),
itemBuilder: (context, index) {
return GestureDetector(
@ -285,7 +287,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
queryAchievementDetail(index);
});
},
child: badgeItem(vipBadgesList[index]),
child: badgeItem(vipBadgesList[index])
);
},
)
@ -306,8 +308,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
children: [
MImage(
vipBadgesList?.icon ?? "",
width: 80,
height: 80,
width: 80.h,
height: 80.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",

22
lib/retrofit/business_api.dart

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
@ -15,6 +16,7 @@ import 'data/base_data.dart';
import 'data/business_goods.dart';
import 'data/business_order_detail_info.dart';
import 'data/business_order_list.dart';
import 'data/business_store_list.dart';
import 'data/day_flow_list.dart';
import 'data/goods_type_sales_list.dart';
import 'data/popular_sales_list.dart';
@ -22,6 +24,7 @@ import 'data/product_group_list.dart';
import 'data/refund_reason_list.dart';
import 'data/single_sales_list.dart';
import 'data/trade_summary_list.dart';
import 'data/upload_result.dart';
part 'business_api.g.dart';
@ -58,8 +61,8 @@ abstract class BusinessApiService {
if (kReleaseMode) baseUrl = serviceBaseUrl;
if (url != null) baseUrl = url;
dio.options = BaseOptions(
connectTimeout: 60000,
receiveTimeout: 60000,
connectTimeout: 30000,
receiveTimeout: 30000,
headers: headers,
responseType: ResponseType.json,
baseUrl: baseUrl,
@ -229,4 +232,19 @@ abstract class BusinessApiService {
Future<BaseData> delProductCategory(
@Body() Map<String, dynamic> param);
///-
@GET("store/getStoreList?tenantCode={tenantCode}&pageIndex={pageIndex}&pageSize={pageSize}")
Future<BaseData<BusinessStoreList>> getStoreList(@Path("tenantCode") String tenantCode, @Path("pageIndex") String pageIndex, @Path("pageSize") String pageSize);
///
@PUT("store")
Future<BaseData> saveStoreInfo(
@Body() Map<String, dynamic> param);
///
@POST("file/upload")
@MultiPart()
Future<BaseData<UploadResult>> upload(@Part(name: "file") File data,
@Part(name: "folderId") int folderId);
}

76
lib/retrofit/business_api.g.dart

@ -476,4 +476,80 @@ class _BusinessApiService implements BusinessApiService {
);
return value;
}
@override
Future<BaseData<BusinessStoreList>> getStoreList(tenantCode,pageIndex,pageSize) async {
ArgumentError.checkNotNull(tenantCode, 'tenantCode');
ArgumentError.checkNotNull(pageIndex, 'pageIndex');
ArgumentError.checkNotNull(pageSize, 'pageSize');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'store/getStoreList?tenantCode=$tenantCode&pageIndex=$pageIndex&pageSize=$pageSize',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<BusinessStoreList>.fromJson(
_result.data,
(json) => BusinessStoreList.fromJson(json),
);
return value;
}
@override
Future<BaseData> saveStoreInfo(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('store',
queryParameters: queryParameters,
options: RequestOptions(
method: 'PUT',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => json == null ? null : json,
);
return value;
}
@override
Future<BaseData<UploadResult>> upload(data, folderId) async {
ArgumentError.checkNotNull(data, 'data');
ArgumentError.checkNotNull(folderId, 'folderId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = FormData();
String fileName = data.path.split(Platform.pathSeparator).last;
_data.files.add(MapEntry(
'file', MultipartFile.fromFileSync(data.path, filename: fileName)));
print("filename:$fileName");
if (folderId != null) {
_data.fields.add(MapEntry('folderId', folderId.toString()));
}
final _result = await _dio.request<Map<String, dynamic>>('/file/upload',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
connectTimeout: 60000,
baseUrl: baseUrl),
data: _data);
final value = BaseData<UploadResult>.fromJson(
_result.data,
(json) => UploadResult.fromJson(json),
);
return value;
}
}

462
lib/retrofit/data/business_order_list.dart

File diff suppressed because one or more lines are too long

943
lib/retrofit/data/business_store_list.dart

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save