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. 604
      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/business_api.dart';
import '../../../retrofit/data/base_data.dart'; import '../../../retrofit/data/base_data.dart';
import '../../../utils/business_instance.dart'; import '../../../utils/business_instance.dart';
import '../../../view_widget/border_text.dart';
import '../../../view_widget/round_button.dart';
class AddAssort extends StatefulWidget { class AddAssort extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -80,8 +82,11 @@ class _AddAssort extends State<AddAssort> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
EasyLoading.dismiss(); EasyLoading.dismiss();
Navigator.of(context).pop(); Navigator.of(context).pop();
SmartDialog.showToast(name == "添加分类" ? "分类添加成功" : "分类编辑成功", if (name == "添加分类")
alignment: Alignment.center); showProductTipDialog();
else
SmartDialog.showToast(name == "添加分类" ? "分类添加成功" : "分类编辑成功",
alignment: Alignment.center);
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); 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/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:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../../generated/l10n.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 '../../../utils/font_weight.dart';
import '../../../view_widget/classic_header.dart'; import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart'; import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart';
class BatchShelf extends StatefulWidget { class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -19,15 +32,150 @@ class BatchShelf extends StatefulWidget {
} }
class _BatchShelf extends State<BatchShelf> { class _BatchShelf extends State<BatchShelf> {
final RefreshController refreshController = RefreshController(); final RefreshController _refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController(); 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 @override
void initState() { void initState() {
super.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 @override
@ -40,152 +188,176 @@ class _BatchShelf extends State<BatchShelf> {
background: Colors.white, background: Colors.white,
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
action: Container( action: GestureDetector(
alignment: Alignment.center, behavior: HitTestBehavior.opaque,
child: Text( onTap: (){
S.of(context).queren, if (productIds.length != 0)
style: TextStyle( productIds.clear();
color: Color(0xFF30415B), adminProductVoList.forEach((element) {
fontSize: 14.sp, if (element.isSelect) productIds.add(element.id);
fontWeight: MyFontWeight.semi_bold, });
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( body: Row(
controller: refreshController, mainAxisAlignment: MainAxisAlignment.start,
enablePullDown: true, crossAxisAlignment: CrossAxisAlignment.start,
enablePullUp: false, children: [
header: MyHeader( Container(
color: Colors.white, width: 100.w,
), height: double.infinity,
footer: CustomFooter( padding: EdgeInsets.only(bottom: 70.h),
builder: (context, mode) { color: Color(0xFFFAFAFA),
return MyFooter(mode); child: (_shimmer)
}, ? ListView.builder(
), itemCount: 10,
onRefresh: () {}, physics: BouncingScrollPhysics(),
physics: BouncingScrollPhysics(), shrinkWrap: true,
scrollController: ScrollController(), itemBuilder: (context, position) {
child: Container( return shelfLeftItemSm();
margin: EdgeInsets.only(top: 24.h,), },
child: Row( )
mainAxisAlignment: MainAxisAlignment.start, : ListView.builder(
crossAxisAlignment: CrossAxisAlignment.start, itemCount: productGroupList?.records?.length ?? 0,
mainAxisSize: MainAxisSize.max, physics: BouncingScrollPhysics(),
children: [ shrinkWrap: true,
Container( itemBuilder: (context, position) {
width: 100.w, return GestureDetector(
color: Color(0xFFFAFAFA), behavior: HitTestBehavior.opaque,
height: double.infinity, onTap: () {
child: ListView.builder( groupIndex = position;
itemCount:5, _pageIndex = 1;
physics: BouncingScrollPhysics(), adminProductVoList.clear();
shrinkWrap: true, queryGoodsList(productGroupList?.records[position].id,);
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: shelfLeftItem(),
);
}, },
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),
), ),
), physics: BouncingScrollPhysics(),
Expanded(child: Container( footer: CustomFooter(
width: MediaQuery.of(context).size.width - 100.w, builder: (context, mode) {
child: ListView.builder( return MyFooter(mode);
itemCount: 6,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return shelfGoodsItem();
}, },
), ),
)), 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 ///list
Widget shelfLeftItem(){ Widget shelfLeftItem(Records records, index){
return Container( return Container(
width: 100.w, color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
child: GestureDetector( alignment: Alignment.center,
behavior: HitTestBehavior.opaque, padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
onTap: () { child: Row(
setState(() { mainAxisAlignment: MainAxisAlignment.center,
// controller.jumpTo(appletProducts[index].goodsIndex); crossAxisAlignment: CrossAxisAlignment.center,
}); children: [
}, Expanded(
child: child: Text(
Container( records?.groupName ?? "",
// color: Color(0xFFFAFAFA), textAlign: TextAlign.center,
alignment: Alignment.center, style: TextStyle(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal:14.w), color:
// margin: EdgeInsets.only(bottom: (index==appletProducts.length - 1)?35.h:0), groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264),
child: Row( fontSize: 12.sp,
mainAxisAlignment: MainAxisAlignment.center, fontWeight: groupIndex == index
crossAxisAlignment: CrossAxisAlignment.center, ? MyFontWeight.semi_bold
children: [ : MyFontWeight.regular,
Expanded( ),
child: Text( )),
"人气必点榜", ],
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight:MyFontWeight.semi_bold,
),
)),
],
),
),
), ),
); );
} }
// ///List Widget shelfGoodsItem(AdminProductVoList adminProductVoList){
// 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(){
return Container( return Container(
margin: EdgeInsets.only(bottom: 21.h), margin: EdgeInsets.only(bottom: 21.h),
child: Row( child: Row(
children: [ children: [
Image.asset( MImage(
"assets/image/hot_list.webp", adminProductVoList?.productImg ?? "",
width: 77, width: 77.h,
height: 77, height: 77.h,
fit: BoxFit.fill, fit: BoxFit.cover,
radius: BorderRadius.circular(4),
), ),
SizedBox(width:12.w,), SizedBox(width:12.w,),
Expanded(child:Column( Expanded(child:Column(
@ -193,7 +365,7 @@ class _BatchShelf extends State<BatchShelf> {
children: [ children: [
Padding(padding:EdgeInsets.only(top: 2.h), Padding(padding:EdgeInsets.only(top: 2.h),
child:Text( child:Text(
"台湾甄选手抓饺子三生", adminProductVoList?.productName ?? "",
maxLines:1, maxLines:1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -205,7 +377,7 @@ class _BatchShelf extends State<BatchShelf> {
Row( Row(
children: [ children: [
Text( Text(
"库存4321", "库存${adminProductVoList?.stock ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -214,7 +386,7 @@ class _BatchShelf extends State<BatchShelf> {
), ),
SizedBox(width: 8.w,), SizedBox(width: 8.w,),
Expanded(child: Text( Expanded(child: Text(
"销量4321", "销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -222,51 +394,169 @@ class _BatchShelf extends State<BatchShelf> {
), ),
)), )),
Checkbox( Checkbox(
visualDensity: VisualDensity.compact, value: adminProductVoList.isSelect,
value: checkStatus,
onChanged: (a) { onChanged: (a) {
setState(() { setState(() {
checkStatus = !checkStatus; adminProductVoList.isSelect = !adminProductVoList.isSelect;
}); });
}, },
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2.0), borderRadius: BorderRadius.circular(2.0),
), ),
checkColor: Color(0xFFFFFFFF), checkColor: Color(0xFFFFFFFF),
fillColor: fillColor: MaterialStateProperty.all(Color(0xFF30415B)),
MaterialStateProperty.all(Color(0xFF30415B)),
), ),
], ],
), ),
SizedBox(height:7.h,), SizedBox(height:7.h,),
Row( Text.rich(
children: [ TextSpan(
Expanded(child:Text.rich( children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
TextSpan( TextSpan(
children: [ text: adminProductVoList?.price ?? "",
TextSpan( style: TextStyle(
text: "¥", fontSize: 18.sp,
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 12.sp, color: Color(0xFFF4524D),
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", SizedBox(
style: TextStyle( width: 8.w,
fontSize: 14.sp, ),
fontWeight: MyFontWeight.medium, Shimmer.fromColors(
color: Color(0xFFF4524D), 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/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:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '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 '../../../utils/font_weight.dart';
import '../../../view_widget/classic_header.dart'; import '../../../view_widget/classic_header.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/my_footer.dart'; import '../../../view_widget/my_footer.dart';
import '../../../view_widget/no_data_view.dart';
class GoodsSort extends StatefulWidget { class GoodsSort extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -18,14 +32,125 @@ class GoodsSort extends StatefulWidget {
} }
class _GoodsSort extends State<GoodsSort> { class _GoodsSort extends State<GoodsSort> {
final RefreshController refreshController = RefreshController(); final RefreshController _refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
BusinessApiService businessService;
ProductGroupList productGroupList;
List<AdminProductVoList> adminProductVoList = [];
int _loadCount = 0;
int _pageIndex = 1;
int groupIndex = -1;
bool _shimmer = true;
@override @override
void initState() { void initState() {
super.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 @override
@ -39,140 +164,150 @@ class _GoodsSort extends State<GoodsSort> {
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: SmartRefresher( body:Row(
controller: refreshController, mainAxisAlignment: MainAxisAlignment.start,
enablePullDown: true, crossAxisAlignment: CrossAxisAlignment.start,
enablePullUp: false, children: [
header: MyHeader( Container(
color: Colors.white, width: 100.w,
), height: double.infinity,
footer: CustomFooter( padding: EdgeInsets.only(bottom: 70.h),
builder: (context, mode) { color: Color(0xFFFAFAFA),
return MyFooter(mode); child: (_shimmer)
}, ? ListView.builder(
), itemCount: 10,
onRefresh: () {}, physics: BouncingScrollPhysics(),
physics: BouncingScrollPhysics(), shrinkWrap: true,
scrollController: ScrollController(), itemBuilder: (context, position) {
child: Container( return sortLeftItemSm();
margin: EdgeInsets.only(top: 24.h,), },
child: Row( )
mainAxisAlignment: MainAxisAlignment.start, : ListView.builder(
crossAxisAlignment: CrossAxisAlignment.start, itemCount: productGroupList?.records?.length ?? 0,
mainAxisSize: MainAxisSize.max, physics: BouncingScrollPhysics(),
children: [ shrinkWrap: true,
Container( itemBuilder: (context, position) {
width: 100.w, return GestureDetector(
color: Color(0xFFFAFAFA), behavior: HitTestBehavior.opaque,
height: double.infinity, onTap: () {
child: ListView.builder( groupIndex = position;
itemCount:5, _pageIndex = 1;
physics: BouncingScrollPhysics(), adminProductVoList.clear();
shrinkWrap: true, queryGoodsList(productGroupList?.records[position].id,);
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: sortLeftItem(),
);
}, },
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),
), ),
), physics: BouncingScrollPhysics(),
Expanded(child: Container( footer: CustomFooter(
width: MediaQuery.of(context).size.width - 100.w, builder: (context, mode) {
child: ListView.builder( return MyFooter(mode);
itemCount: 6,
controller: controller,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return sortRightItem();
}, },
), ),
)), 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 ///list
Widget sortRightItem(){ Widget sortLeftItem(Records records, index){
return Container( return Container(
margin: EdgeInsets.only(left:16.w,right: 14.w), color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
width: double.infinity, alignment: Alignment.center,
child:Column( padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
crossAxisAlignment: CrossAxisAlignment.start, child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Padding(padding:EdgeInsets.symmetric(vertical: 16.h), Expanded(
child: Text("人气必点榜",style: TextStyle( child: Text(
color: Color(0xFF30415B), records?.groupName ?? "",
fontSize: 12.sp, textAlign: TextAlign.center,
fontWeight:MyFontWeight.regular, style: TextStyle(
),)), color:
ListView.builder( groupIndex == index ? Color(0xFF30415B) : Color(0xFF626264),
itemCount: 3, fontSize: 12.sp,
controller: controller, fontWeight: groupIndex == index
physics: scrollPhysics, ? MyFontWeight.semi_bold
shrinkWrap: true, : MyFontWeight.regular,
itemBuilder: (context, position) { ),
return sortGoodsItem(); )),
},
)
], ],
), ),
); );
} }
Widget sortGoodsItem(){ ///List
Widget sortGoodsItem(AdminProductVoList adminProductVoList){
return Container( return Container(
margin: EdgeInsets.only(bottom: 21.h), margin: EdgeInsets.only(bottom: 21.h),
padding: EdgeInsets.only(left: 16.w, right: 14.w),
child: Row( child: Row(
children: [ children: [
Image.asset( MImage(
"assets/image/hot_list.webp", adminProductVoList?.productImg ?? "",
width: 77, width: 77.h,
height: 77, height: 77.h,
fit: BoxFit.fill, fit: BoxFit.cover,
radius: BorderRadius.circular(4),
), ),
SizedBox(width:12.w,), SizedBox(width:12.w,),
Expanded(child:Column( Expanded(child:Column(
@ -182,7 +317,7 @@ class _GoodsSort extends State<GoodsSort> {
child: Row( child: Row(
children: [ children: [
Expanded(child: Text( Expanded(child: Text(
"台湾甄选手抓饺子三生", adminProductVoList?.productName ?? "",
maxLines:1, maxLines:1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -204,7 +339,7 @@ class _GoodsSort extends State<GoodsSort> {
Row( Row(
children: [ children: [
Text( Text(
"库存4321", "库存${adminProductVoList?.stock ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -213,7 +348,7 @@ class _GoodsSort extends State<GoodsSort> {
), ),
SizedBox(width: 8.w,), SizedBox(width: 8.w,),
Text( Text(
"销量4321", "销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -223,34 +358,163 @@ class _GoodsSort extends State<GoodsSort> {
], ],
), ),
SizedBox(height:7.h,), SizedBox(height:7.h,),
Row( Text.rich(
children: [ TextSpan(
Expanded(child:Text.rich( children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
),
TextSpan( TextSpan(
children: [ text: adminProductVoList?.price ?? "",
TextSpan( style: TextStyle(
text: "¥", fontSize: 18.sp,
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 12.sp, color: Color(0xFFF4524D),
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", SizedBox(
style: TextStyle( width:10.w,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D),
),
), ),
], 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> { class _OnSalePage extends State<OnSalePage> {
final RefreshController _refreshController = RefreshController(); final RefreshController _refreshController = RefreshController();
final RefreshController refreshController = RefreshController();
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics();
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
BusinessApiService businessService; BusinessApiService businessService;
ProductGroupList productGroupList; ProductGroupList productGroupList;
@ -50,7 +48,6 @@ class _OnSalePage extends State<OnSalePage> {
void dispose() { void dispose() {
super.dispose(); super.dispose();
_refreshController.dispose(); _refreshController.dispose();
refreshController.dispose();
} }
@override @override
@ -83,8 +80,9 @@ class _OnSalePage extends State<OnSalePage> {
_loadCount = 0; _loadCount = 0;
_shimmer = false; _shimmer = false;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (!mounted) return;
if (!mounted) setState(() {}); if (_refreshController.isRefresh) _refreshController.refreshCompleted();
setState(() {});
} }
} }
@ -94,14 +92,15 @@ class _OnSalePage extends State<OnSalePage> {
BaseData<ProductGroupList> baseData = await businessService.productGroup({ BaseData<ProductGroupList> baseData = await businessService.productGroup({
"current": 1, "current": 1,
"map": {}, "map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": ""}, "model": {"groupImg": "", "groupName": "", "isDelete": 0},
"order": "ascending",
"size": 100, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center); alignment: Alignment.center);
refreshController.refreshFailed(); _refreshController.refreshFailed();
refreshController.loadFailed(); _refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -132,10 +131,8 @@ class _OnSalePage extends State<OnSalePage> {
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center); alignment: Alignment.center);
// _refreshController.refreshFailed(); _refreshController.refreshFailed();
// _refreshController.loadFailed(); _refreshController.loadFailed();
refreshController.refreshFailed();
refreshController.loadFailed();
}); });
if (!mounted) return; if (!mounted) return;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -143,11 +140,9 @@ class _OnSalePage extends State<OnSalePage> {
widget.total(baseData.data.total.toString()); widget.total(baseData.data.total.toString());
if ((baseData?.data?.adminProductVOList ?? []).isEmpty || if ((baseData?.data?.adminProductVOList ?? []).isEmpty ||
adminProductVoList.length == baseData.data.total) { adminProductVoList.length == baseData.data.total) {
// _refreshController.loadNoData(); _refreshController.loadNoData();
refreshController.loadNoData();
} else { } else {
// _refreshController.loadComplete(); _refreshController.loadComplete();
refreshController.loadComplete();
} }
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); 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) { if (businessService == null) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),
context: context, context: context,
@ -204,200 +199,107 @@ class _OnSalePage extends State<OnSalePage> {
), ),
Expanded( Expanded(
child: Container( child: Container(
child: SmartRefresher( child: Row(
controller: refreshController, mainAxisAlignment: MainAxisAlignment.start,
enablePullDown: true, crossAxisAlignment: CrossAxisAlignment.start,
enablePullUp: false, children: [
header: MyHeader( Container(
color: Color(0xFF30415B), width: 100.w,
), height: double.infinity,
physics: BouncingScrollPhysics(), padding: EdgeInsets.only(bottom: 70.h),
footer: CustomFooter( color: Color(0xFFFAFAFA),
builder: (context, mode) { child: (_shimmer)
return MyFooter(mode); ? 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; Container(
adminProductVoList.clear(); width: MediaQuery.of(context).size.width - 100.w,
_onRefresh(isShowLoad: false); 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, onLoading: () {
crossAxisAlignment: CrossAxisAlignment.start, _pageIndex++;
children: [ queryGoodsList(groupIndex == -1
Container( ? ""
width: 100.w, : productGroupList?.records[groupIndex].id);
child: (_shimmer) },
? ListView.builder( onRefresh: () {
itemCount: 10, _pageIndex = 1;
physics: NeverScrollableScrollPhysics(), adminProductVoList.clear();
shrinkWrap: true, _onRefresh(isShowLoad: false);
itemBuilder: (context, position) { },
return leftItemSm(); 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( : ListView.builder(
itemCount: itemCount:
productGroupList?.records?.length ?? adminProductVoList?.length ?? 0,
0, controller: controller,
physics: NeverScrollableScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return rightGoodsItem(
behavior: HitTestBehavior.opaque, adminProductVoList[position]);
onTap: () {
setState(() {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(
productGroupList
?.records[position].id,
isSing: false);
});
},
child: leftItem(
productGroupList
.records[position],
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( Row(
@ -443,7 +345,8 @@ class _OnSalePage extends State<OnSalePage> {
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/goods_sort'); Navigator.of(context).pushNamed('/router/goods_sort',
arguments: {"storeId": widget.storeId});
}, },
child: Container( child: Container(
color: Color(0xFFEDEDED), color: Color(0xFFEDEDED),
@ -479,7 +382,8 @@ class _OnSalePage extends State<OnSalePage> {
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/batch_shelf'); Navigator.of(context).pushNamed('/router/batch_shelf',
arguments: {"storeId": widget.storeId});
}, },
child: Container( child: Container(
color: Color(0xFFEDEDED), color: Color(0xFFEDEDED),
@ -568,7 +472,7 @@ class _OnSalePage extends State<OnSalePage> {
///list ///list
Widget leftItem(Records records, index) { Widget leftItem(Records records, index) {
return Container( return Container(
color: groupIndex == index ? Colors.transparent : Color(0xFFFAFAFA), color: groupIndex == index ? Colors.white : Color(0xFFFAFAFA),
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w), padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
child: Row( child: Row(
@ -668,7 +572,7 @@ class _OnSalePage extends State<OnSalePage> {
TextSpan( TextSpan(
text: adminProductVoList?.price ?? "", text: adminProductVoList?.price ?? "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 18.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFFF4524D), color: Color(0xFFF4524D),
), ),

24
lib/business_system/home/business_home_page.dart

@ -588,10 +588,11 @@ class _BusinessHomePage extends State<BusinessHomePage>
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(top: 16.h), margin: EdgeInsets.only(top: 16.h),
padding: 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( child: Column(
children: [ children: [
Row( Padding(padding:EdgeInsets.only(left:7.w,),
child: Row(
children: [ children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)), Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding( Padding(
@ -608,11 +609,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
), ),
), ),
], ],
), )),
SizedBox( SizedBox(
height: 12.h, height: 12.h,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
@ -622,6 +625,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h), padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Color(0xFFFC5A58), Color(0xFFFF716F)], colors: [Color(0xFFFC5A58), Color(0xFFFF716F)],
@ -668,9 +672,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
), ),
), ),
)), )),
SizedBox( // SizedBox(
width: 9.w, // width: 9.w,
), // ),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
@ -680,6 +684,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h), horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)], colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
@ -725,9 +730,9 @@ class _BusinessHomePage extends State<BusinessHomePage>
], ],
), ),
))), ))),
SizedBox( // SizedBox(
width: 9.w, // width: 9.w,
), // ),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
@ -737,6 +742,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 8.w, vertical: 6.h), horizontal: 8.w, vertical: 6.h),
margin: EdgeInsets.symmetric(horizontal:4.w),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)], 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:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart'; import '../../generated/l10n.dart';
import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart';
import '../../view_widget/classic_header.dart'; import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart'; import '../../view_widget/my_footer.dart';
@ -23,22 +25,23 @@ class SelectShop extends StatefulWidget {
class _SelectShop extends State<SelectShop> { class _SelectShop extends State<SelectShop> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessLoginInfo businessLoginInfo; BusinessLoginInfo businessLoginInfo;
List<Records> records = [];
int selectIndex = 0; int selectIndex = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
businessLoginInfo = widget.arguments["businessLoginInfo"]; businessLoginInfo = widget.arguments["businessLoginInfo"];
records = widget.arguments["records"];
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Color(0xFFF8F8FA),
appBar: MyAppBar( appBar: MyAppBar(
title: "选择门店", title: "选择门店",
titleColor: Colors.black, titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black, leadingColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
@ -73,7 +76,7 @@ class _SelectShop extends State<SelectShop> {
width: 4.w, width: 4.w,
), ),
Text( Text(
"门店切换", (widget.arguments["routeSource"] == "门店设置")?"请选择门店":"请选择登录门店",
style: TextStyle( style: TextStyle(
fontSize: 15.sp, fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -87,7 +90,7 @@ class _SelectShop extends State<SelectShop> {
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: businessLoginInfo?.storeList?.length ?? 0, itemCount: (widget.arguments["routeSource"] == "门店设置") ? (records?.length ?? 0):(businessLoginInfo?.storeList?.length ?? 0),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -98,20 +101,29 @@ class _SelectShop extends State<SelectShop> {
selectIndex = position; selectIndex = position;
}); });
}, },
child: shopsItem( child: (widget.arguments["routeSource"] == "门店设置") ? merchantItem(records[position], position):
businessLoginInfo?.storeList[position], position), shopsItem(businessLoginInfo?.storeList[position], position),
); );
}, },
)), )),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushReplacementNamed( if(widget.arguments["routeSource"] == "门店设置"){
'/router/business_page', Navigator.of(context)
arguments: { .popAndPushNamed('/router/merchant_info',arguments: {
"selectStoreIndex": selectIndex, "storeId": records[selectIndex]?.id ?? "",
"businessLoginInfo": businessLoginInfo, "storeName": records[selectIndex]?.storeName ?? "",
}); "records": records[selectIndex],
});
}else{
Navigator.of(context).pushReplacementNamed(
'/router/business_page',
arguments: {
"selectStoreIndex": selectIndex,
"businessLoginInfo": businessLoginInfo,
});
}
}, },
child: Container( child: Container(
width: double.infinity, 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) { if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data); 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.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token; BusinessInstance.instance.businessToken = businessLoginInfo.token;
sharedPreferences.setString('account', _userPhoneController.text); sharedPreferences.setString('account', _userPhoneController.text);
@ -102,6 +104,7 @@ class _BusinessLoginPage extends State<BusinessLoginPage> {
Navigator.of(context) Navigator.of(context)
.pushReplacementNamed('/router/select_shop', arguments: { .pushReplacementNamed('/router/select_shop', arguments: {
"businessLoginInfo": businessLoginInfo, "businessLoginInfo": businessLoginInfo,
"routeSource":"登录",
}); });
} else { } else {
Navigator.of(context) 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../retrofit/business_api.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/business_login_info.dart'; import '../../retrofit/data/business_login_info.dart';
import '../../retrofit/data/business_store_list.dart';
import '../../utils/business_instance.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart'; import '../../utils/font_weight.dart';
class BusinessMinePage extends StatefulWidget { class BusinessMinePage extends StatefulWidget {
final BusinessLoginInfo businessLoginInfo; final BusinessLoginInfo businessLoginInfo;
final String storeId; final String storeId;
BusinessMinePage(this.businessLoginInfo,this.storeId); BusinessMinePage(this.businessLoginInfo, this.storeId);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _BusinessMinePage(); return _BusinessMinePage();
@ -23,15 +33,48 @@ class BusinessMinePage extends StatefulWidget {
class _BusinessMinePage extends State<BusinessMinePage> class _BusinessMinePage extends State<BusinessMinePage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessApiService businessService;
List<Records> records = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
queryStoreList();
} }
@override @override
void dispose() { void dispose() {
super.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 @override
@ -45,7 +88,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
header: MyHeader(color:Color(0xFF30415B)), header: MyHeader(color: Color(0xFF30415B)),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
@ -53,8 +96,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
}, },
), ),
onRefresh: () { onRefresh: () {
if(widget.businessLoginInfo != null) if (widget.businessLoginInfo != null){
refreshController.refreshCompleted(); // if(widget.businessLoginInfo.storeList.length <= 1)
queryStoreList();
// refreshController.refreshCompleted();
}
else else
refreshController.refreshFailed(); refreshController.refreshFailed();
}, },
@ -67,14 +113,15 @@ class _BusinessMinePage extends State<BusinessMinePage>
commonFunctions(), commonFunctions(),
otherFunctions(), otherFunctions(),
SizedBox( SizedBox(
height:54.h, height: 54.h,
), ),
Text( Text(
"@回乡信息公司", "@回乡信息公司",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF30415B), color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium),), fontWeight: MyFontWeight.medium),
),
], ],
), ),
)), )),
@ -106,9 +153,10 @@ class _BusinessMinePage extends State<BusinessMinePage>
), ),
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
Navigator.of(context).pushNamed('/router/account_information',arguments: { Navigator.of(context)
"businessLoginInfo":widget.businessLoginInfo, .pushNamed('/router/account_information', arguments: {
"businessLoginInfo": widget.businessLoginInfo,
}); });
}, },
child: Container( child: Container(
@ -116,15 +164,22 @@ class _BusinessMinePage extends State<BusinessMinePage>
top: MediaQuery.of(context).padding.top + 50, left: 16.w), top: MediaQuery.of(context).padding.top + 50, left: 16.w),
child: Row( child: Row(
children: [ children: [
MImage( (widget?.businessLoginInfo?.avatar != "")
widget?.businessLoginInfo?.avatar ?? "", ? MImage(
fit: BoxFit.cover, widget?.businessLoginInfo?.avatar ?? "",
width: 69.h, fit: BoxFit.cover,
height: 69.h, width: 69.h,
radius: BorderRadius.circular(100), height: 69.h,
errorSrc: "assets/image/bs_mine_heading.webp", radius: BorderRadius.circular(100),
fadeSrc: "assets/image/bs_mine_heading.webp", 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( SizedBox(
width: 10.w, width: 10.w,
), ),
@ -163,7 +218,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
/// ///
Widget commonFunctions() { Widget commonFunctions() {
return Container( 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( child: Column(
children: [ children: [
Row( Row(
@ -183,82 +238,113 @@ class _BusinessMinePage extends State<BusinessMinePage>
), ),
], ],
), ),
SizedBox(height:20.h,), SizedBox(
GestureDetector( height: 20.h,
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 ?? ""),
), ),
// 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( Container(
width: double.infinity, width: double.infinity,
height: 1.h, height: 1.h,
color: Color(0xFFEBECEF), 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( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
Navigator.of(context).pushNamed('/router/security_setting',arguments:{ if(widget.businessLoginInfo.storeList.length > 1){
"storeId":widget.storeId, Navigator.of(context)
"businessLoginInfo":widget.businessLoginInfo, .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( return Container(
margin: EdgeInsets.only(bottom:14.h), margin: EdgeInsets.only(bottom: 14.h),
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
icon, icon,
width: 24, width: 24,
height:24, height: 24,
fit: BoxFit.fill,), fit: BoxFit.fill,
SizedBox(width:8.w,), ),
Expanded(child: Text( SizedBox(
width: 8.w,
),
Expanded(
child: Text(
leftText, leftText,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF30415B), color: Color(0xFF30415B),
fontWeight: MyFontWeight.medium),)), fontWeight: MyFontWeight.medium),
)),
Text( Text(
rightText, rightText,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight: MyFontWeight.medium),), fontWeight: MyFontWeight.medium),
),
Image.asset( Image.asset(
"assets/image/icon_right_z.webp", "assets/image/icon_right_z.webp",
width: 16, width: 16,
height:16, height: 16,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
], ],
), ),
); );
} }
Widget otherFunctions(){ Widget otherFunctions() {
return Container( return Container(
margin: EdgeInsets.only(left: 16.w, right:17.w,), margin: EdgeInsets.only(
left: 16.w,
right: 17.w,
),
child: Column( child: Column(
children: [ children: [
Row( Row(
@ -278,7 +364,9 @@ class _BusinessMinePage extends State<BusinessMinePage>
), ),
], ],
), ),
SizedBox(height:20.h,), SizedBox(
height: 20.h,
),
commonFunctionsItem("assets/image/bs_user.webp", "关于我们", ""), 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:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
@ -42,6 +41,7 @@ class _OrderList extends State<OrderList> {
List<AdminOrderDtoList> adminOrderDTOList = []; List<AdminOrderDtoList> adminOrderDTOList = [];
int _pageIndex = 1; int _pageIndex = 1;
bool _shimmer = true; bool _shimmer = true;
int index = 0;
@override @override
void dispose() { void dispose() {
@ -251,7 +251,9 @@ class _OrderList extends State<OrderList> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {
index = position;
},
child: orderGoodsList( child: orderGoodsList(
adminOrderDtoList.orderProductList[position]), adminOrderDtoList.orderProductList[position]),
); );
@ -318,12 +320,17 @@ class _OrderList extends State<OrderList> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// Spacer(), if(adminOrderDtoList.ticketStatus != null)
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context) 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( child: Container(
decoration: BoxDecoration( 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:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/data/business_order_list.dart';
import '../../view_widget/classic_header.dart'; import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart'; import '../../view_widget/my_footer.dart';
class OrderWriteOff extends StatefulWidget { class OrderWriteOff extends StatefulWidget {
final Map<String, dynamic> arguments;
OrderWriteOff({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _OrderWriteOff(); return _OrderWriteOff();
@ -17,10 +22,14 @@ class OrderWriteOff extends StatefulWidget {
class _OrderWriteOff extends State<OrderWriteOff> { class _OrderWriteOff extends State<OrderWriteOff> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
var writeOffCheck = false; var writeOffCheck = false;
List<Tickets> tickets;
String productName;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
tickets = widget.arguments["tickets"];
productName = widget.arguments["productName"];
} }
@override @override
@ -123,10 +132,10 @@ class _OrderWriteOff extends State<OrderWriteOff> {
SizedBox( SizedBox(
height: 12.h, height: 12.h,
), ),
basicInfoItem("票券名称:","单人尊享票"), basicInfoItem("票券名称:",productName ?? ""),
basicInfoItem("用户名称::","李哈哈"), basicInfoItem("用户名称::",widget?.arguments["userName"] ?? ""),
basicInfoItem("票券编号::","177777622222223"), basicInfoItem("票券编号::","177777622222223"),
basicInfoItem("订单编号::","7666677777777772233") basicInfoItem("订单编号::",widget?.arguments["orderCode"] ?? ""),
], ],
), ),
); );
@ -204,14 +213,14 @@ class _OrderWriteOff extends State<OrderWriteOff> {
), ),
ListView.builder( ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: 3, itemCount: tickets?.length ?? 0,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {},
child: writeOffInfoItem(), child: writeOffInfoItem(tickets[position]),
); );
}, },
) )
@ -220,7 +229,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
); );
} }
Widget writeOffInfoItem(){ Widget writeOffInfoItem(Tickets tickets){
return Container( return Container(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
@ -230,11 +239,11 @@ class _OrderWriteOff extends State<OrderWriteOff> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded(child: Text( Expanded(child: Text(
"台湾天然手作牡丹茶*1(牡丹野餐区茶饮车兑换)", tickets?.name ?? "",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF0D0D0D), color: tickets.state == 1?Color(0xFF0D0D0D):Color(0xFFABACAB),
), ),
)), )),
Expanded(child: Column( Expanded(child: Column(
@ -242,14 +251,15 @@ class _OrderWriteOff extends State<OrderWriteOff> {
children: [ children: [
Padding(padding: EdgeInsets.only(right:10.w), Padding(padding: EdgeInsets.only(right:10.w),
child: Text( child: Text(
"已核销", (tickets.state == 1)?"待核销":"已核销",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFFACACAC), color: (tickets.state == 1)?Color(0xFF30415B):Color(0xFFACACAC),
), ),
),), ),),
SizedBox(height:25.h,), SizedBox(height:25.h,),
if(tickets.state == 1)
Checkbox( Checkbox(
value: writeOffCheck, value: writeOffCheck,
onChanged: (a) { onChanged: (a) {
@ -267,25 +277,26 @@ class _OrderWriteOff extends State<OrderWriteOff> {
)) ))
], ],
), ),
// Align( Align(
// alignment: Alignment.centerRight, alignment: Alignment.centerRight,
// child:Container( child:Container(
// decoration: BoxDecoration( margin: EdgeInsets.only(right:10.w),
// color: Colors.white, decoration: BoxDecoration(
// borderRadius: BorderRadius.circular( color: Colors.white,
// 2, borderRadius: BorderRadius.circular(
// ), 2,
// border: Border.all( ),
// color: Color(0xFFCFCFCF), border: Border.all(
// width: 1.w, color: Color(0xFFCFCFCF),
// ), width: 1.w,
// ), ),
// child: Icon( ),
// Icons.check, child: Icon(
// color: Color(0xFFCFCFCF), Icons.check,
// size: 14.w, color: Color(0xFFCFCFCF),
// ) size: 14.w,
// ),), )
),),
Container( Container(
margin: EdgeInsets.only(bottom:11.h,top: 13.h), margin: EdgeInsets.only(bottom:11.h,top: 13.h),
width: double.infinity, width: double.infinity,

6
lib/business_system/order/request_refund.dart

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

5
lib/home/points_mall_view/points_goods_view.dart

@ -46,11 +46,6 @@ class _PointGoods extends State<PointGoods> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( 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) child:(widget.goods == null || widget.goods.length == 0)
? NoDataView( ? NoDataView(
src: "assets/image/xiao_fei.webp", 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/account_information.dart';
import 'business_system/mine/merchant_info.dart'; import 'business_system/mine/merchant_info.dart';
import 'business_system/mine/security_setting.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/business_order_detail.dart';
import 'business_system/order/order_write_off.dart'; import 'business_system/order/order_write_off.dart';
import 'business_system/order/request_refund.dart'; import 'business_system/order/request_refund.dart';
@ -489,7 +490,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/business_order_detail': (context, {arguments}) => '/router/business_order_detail': (context, {arguments}) =>
BusinessOrderDetail(arguments: arguments), BusinessOrderDetail(arguments: arguments),
'/router/order_write_off': (context, {arguments}) => '/router/order_write_off': (context, {arguments}) =>
OrderWriteOff(), OrderWriteOff(arguments: arguments),
'/router/security_setting': (context, {arguments}) => '/router/security_setting': (context, {arguments}) =>
SecuritySetting(arguments: arguments), SecuritySetting(arguments: arguments),
'/router/merchant_info': (context, {arguments}) => '/router/merchant_info': (context, {arguments}) =>
@ -506,4 +507,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
MonthlyReportPage(), MonthlyReportPage(),
'/router/custom_page': (context, {arguments}) => '/router/custom_page': (context, {arguments}) =>
CustomPage(), 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, "account": account,
"password": password, "password": password,
}; };
EasyLoading.show( EasyLoading.show(
status: S.of(context).zhengzaijiazai, status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black);
@ -44,7 +43,9 @@ class _MineItem extends State<MineItem> {
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
var businessLoginInfo = BusinessLoginInfo.fromJson(baseData.data); 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.businessTenant = businessLoginInfo.tenantCode;
BusinessInstance.instance.businessToken = businessLoginInfo.token; BusinessInstance.instance.businessToken = businessLoginInfo.token;
if (businessLoginInfo.storeList.length > 1) { 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(), physics: BouncingScrollPhysics(),
child: Column( child: Column(
children: [ children: [
SizedBox(height: 24), SizedBox(height: 24.h),
MImage( MImage(
userInfo?.headimg ?? "", userInfo?.headimg ?? "",
isCircle: true, isCircle: true,
width: 58, width: 58.h,
height: 58, height: 58.h,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_user.webp", errorSrc: "assets/image/default_user.webp",
fadeSrc: "assets/image/default_user.webp", fadeSrc: "assets/image/default_user.webp",
), ),
SizedBox(height: 8), SizedBox(height: 8.h),
Text( Text(
userInfo?.nickname ?? S.of(context).denglu, userInfo?.nickname ?? S.of(context).denglu,
style: TextStyle( style: TextStyle(
@ -189,11 +189,11 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
), ),
SizedBox(height: 28), SizedBox(height: 28.h),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 16, right: 16, top: 26, bottom: 8), left: 16.w, right: 16.w, top: 26.h, bottom: 8.h),
padding: EdgeInsets.all(20), padding: EdgeInsets.symmetric(vertical: 20.h,),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -210,6 +210,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding(padding:EdgeInsets.symmetric(horizontal:20.w),
child:
Row( Row(
children: [ children: [
Text( Text(
@ -244,8 +246,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)), color: Color(0xFF353535)),
), ),
], ],
), )),
SizedBox(height: 12), SizedBox(height: 12.h),
attainmentBadge(), attainmentBadge(),
], ],
), ),
@ -269,14 +271,14 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量
crossAxisCount: 3, crossAxisCount: 3,
//Widget之间间距 // //Widget之间间距
crossAxisSpacing: 13, // crossAxisSpacing: 13,
//Widget之间间距 // //Widget之间间距
mainAxisSpacing: 12, // mainAxisSpacing: 12,
//Widget宽高比例 // //Widget宽高比例
childAspectRatio: AppUtils.textScale(context) > 1 // childAspectRatio: AppUtils.textScale(context) > 1
? (1 - ((AppUtils.textScale(context) - 1))) // ? (1 - ((AppUtils.textScale(context) - 1)))
: 0.85, // : 0.85,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
@ -285,7 +287,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
queryAchievementDetail(index); queryAchievementDetail(index);
}); });
}, },
child: badgeItem(vipBadgesList[index]), child: badgeItem(vipBadgesList[index])
); );
}, },
) )
@ -306,8 +308,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
children: [ children: [
MImage( MImage(
vipBadgesList?.icon ?? "", vipBadgesList?.icon ?? "",
width: 80, width: 80.h,
height: 80, height: 80.h,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp", errorSrc: "assets/image/default_1.webp",
fadeSrc: "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:convert';
import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -15,6 +16,7 @@ import 'data/base_data.dart';
import 'data/business_goods.dart'; import 'data/business_goods.dart';
import 'data/business_order_detail_info.dart'; import 'data/business_order_detail_info.dart';
import 'data/business_order_list.dart'; import 'data/business_order_list.dart';
import 'data/business_store_list.dart';
import 'data/day_flow_list.dart'; import 'data/day_flow_list.dart';
import 'data/goods_type_sales_list.dart'; import 'data/goods_type_sales_list.dart';
import 'data/popular_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/refund_reason_list.dart';
import 'data/single_sales_list.dart'; import 'data/single_sales_list.dart';
import 'data/trade_summary_list.dart'; import 'data/trade_summary_list.dart';
import 'data/upload_result.dart';
part 'business_api.g.dart'; part 'business_api.g.dart';
@ -58,8 +61,8 @@ abstract class BusinessApiService {
if (kReleaseMode) baseUrl = serviceBaseUrl; if (kReleaseMode) baseUrl = serviceBaseUrl;
if (url != null) baseUrl = url; if (url != null) baseUrl = url;
dio.options = BaseOptions( dio.options = BaseOptions(
connectTimeout: 60000, connectTimeout: 30000,
receiveTimeout: 60000, receiveTimeout: 30000,
headers: headers, headers: headers,
responseType: ResponseType.json, responseType: ResponseType.json,
baseUrl: baseUrl, baseUrl: baseUrl,
@ -229,4 +232,19 @@ abstract class BusinessApiService {
Future<BaseData> delProductCategory( Future<BaseData> delProductCategory(
@Body() Map<String, dynamic> param); @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; 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;
}
} }

604
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