Browse Source

商品列表在售中更改;

wr_2023_business
wurong 1 year ago
parent
commit
f97a720d56
  1. 1
      lib/business_system/goods/goods_search_page.dart
  2. 61
      lib/business_system/goods/on_sale/batch_shelf.dart
  3. 3
      lib/business_system/goods/on_sale/goods_sort.dart
  4. 377
      lib/business_system/goods/on_sale/on_sale_page.dart
  5. 4
      lib/main.dart

1
lib/business_system/goods/goods_search_page.dart

@ -132,6 +132,7 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
} }
} }
///
queryGoodsUpdate() async { queryGoodsUpdate() async {
if (businessService == null) { if (businessService == null) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),

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

@ -9,6 +9,9 @@ import '../../../view_widget/classic_header.dart';
import '../../../view_widget/my_footer.dart'; import '../../../view_widget/my_footer.dart';
class BatchShelf extends StatefulWidget { class BatchShelf extends StatefulWidget {
final Map<String, dynamic> arguments;
BatchShelf({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _BatchShelf(); return _BatchShelf();
@ -96,7 +99,7 @@ class _BatchShelf extends State<BatchShelf> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return shelfRightItem(); return shelfGoodsItem();
}, },
), ),
)), )),
@ -107,8 +110,6 @@ class _BatchShelf extends State<BatchShelf> {
); );
} }
///list ///list
Widget shelfLeftItem(){ Widget shelfLeftItem(){
return Container( return Container(
@ -147,33 +148,33 @@ class _BatchShelf extends State<BatchShelf> {
); );
} }
///List // ///List
Widget shelfRightItem(){ // Widget shelfRightItem(){
return Container( // return Container(
margin: EdgeInsets.only(left:16.w,right:14.w), // margin: EdgeInsets.only(left:16.w,right:14.w),
width: double.infinity, // width: double.infinity,
child:Column( // child:Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Padding(padding:EdgeInsets.symmetric(vertical: 16.h), // Padding(padding:EdgeInsets.symmetric(vertical: 16.h),
child: Text("人气必点榜",style: TextStyle( // child: Text("人气必点榜",style: TextStyle(
color: Color(0xFF30415B), // color: Color(0xFF30415B),
fontSize: 12.sp, // fontSize: 12.sp,
fontWeight:MyFontWeight.regular, // fontWeight:MyFontWeight.regular,
),)), // ),)),
ListView.builder( // ListView.builder(
itemCount: 3, // itemCount: 3,
controller: controller, // controller: controller,
physics: scrollPhysics, // physics: scrollPhysics,
shrinkWrap: true, // shrinkWrap: true,
itemBuilder: (context, position) { // itemBuilder: (context, position) {
return shelfGoodsItem(); // return shelfGoodsItem();
}, // },
) // )
], // ],
), // ),
); // );
} // }
Widget shelfGoodsItem(){ Widget shelfGoodsItem(){
return Container( return Container(

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

@ -8,6 +8,9 @@ import '../../../view_widget/classic_header.dart';
import '../../../view_widget/my_footer.dart'; import '../../../view_widget/my_footer.dart';
class GoodsSort extends StatefulWidget { class GoodsSort extends StatefulWidget {
final Map<String, dynamic> arguments;
GoodsSort({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _GoodsSort(); return _GoodsSort();

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

@ -17,6 +17,8 @@ import '../../../retrofit/data/product_group_list.dart';
import '../../../utils/business_instance.dart'; import '../../../utils/business_instance.dart';
import '../../../utils/flutter_utils.dart'; import '../../../utils/flutter_utils.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/no_data_view.dart';
class OnSalePage extends StatefulWidget { class OnSalePage extends StatefulWidget {
final String storeId; final String storeId;
@ -39,6 +41,7 @@ class _OnSalePage extends State<OnSalePage> {
List<AdminProductVoList> adminProductVoList = []; List<AdminProductVoList> adminProductVoList = [];
int _loadCount = 0; int _loadCount = 0;
int _pageIndex = 1; int _pageIndex = 1;
int groupIndex = -1;
@override @override
void dispose() { void dispose() {
@ -64,7 +67,7 @@ class _OnSalePage extends State<OnSalePage> {
tenant: BusinessInstance.instance.businessTenant, tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId); storeId: widget.storeId);
queryProductGroupList(); queryProductGroupList();
queryGoodsList(isSing: false); queryGoodsList("", isSing: false);
}); });
} }
@ -85,7 +88,7 @@ class _OnSalePage extends State<OnSalePage> {
"current": 1, "current": 1,
"map": {}, "map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": ""}, "model": {"groupImg": "", "groupName": "", "isDelete": ""},
"size": 50, "size": 100,
"sort": "sort" "sort": "sort"
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
@ -105,11 +108,15 @@ class _OnSalePage extends State<OnSalePage> {
} }
/// ///
queryGoodsList({isSing = true}) async { queryGoodsList(groupId, {isSing = true}) async {
if(isSing)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
try { try {
BaseData<BusinessGoods> baseData = BaseData<BusinessGoods> baseData =
await businessService.findAdminProductLis({ await businessService.findAdminProductLis({
"groupId": "", "groupId": groupId,
"hasStock": "", "hasStock": "",
"keyword": "", "keyword": "",
"pageIndex": _pageIndex, "pageIndex": _pageIndex,
@ -143,6 +150,27 @@ class _OnSalePage extends State<OnSalePage> {
} }
} }
///
queryGoodsUpdate() async {
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
token: BusinessInstance.instance.businessToken,
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
}
BaseData baseData = await businessService.goodsUpdate({
"productId": adminProductVoList[0]?.id ?? "",
"sell": false,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
await queryGoodsList(groupIndex == -1?"":productGroupList?.records[groupIndex]?.id ?? "");
SmartDialog.showToast("商品下架成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -165,78 +193,142 @@ 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: true, children: [
header: MyHeader( Container(
color: Color(0xFF30415B), width: 100.w,
), child: ListView.builder(
physics: BouncingScrollPhysics(), itemCount: productGroupList?.records?.length ?? 0,
footer: CustomFooter( physics: BouncingScrollPhysics(),
builder: (context, mode) { shrinkWrap: true,
return MyFooter(mode); itemBuilder: (context, position) {
}, return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
groupIndex = position;
_pageIndex = 1;
adminProductVoList.clear();
queryGoodsList(
productGroupList?.records[position].id,
isSing: false);
});
},
child: leftItem(
productGroupList.records[position], position),
);
},
),
), ),
onRefresh: () { Container(
_pageIndex = 1; width: MediaQuery.of(context).size.width - 100.w,
adminProductVoList.clear(); child: SmartRefresher(
_onRefresh(isShowLoad: false); controller: _refreshController,
}, enablePullDown: false,
onLoading: () { enablePullUp: adminProductVoList.length != 0 ?true:false,
_pageIndex++; header: MyHeader(
queryGoodsList(); color: Color(0xFF30415B),
}, ),
child: SingleChildScrollView( physics: BouncingScrollPhysics(),
physics: NeverScrollableScrollPhysics(), footer: CustomFooter(
child: Container( builder: (context, mode) {
color: Colors.white, return MyFooter(mode);
child: Column( },
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.w,
child: ListView.builder(
itemCount: 5,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: leftItem(),
);
},
),
),
Container(
width:
MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount: 6,
controller: controller,
physics: scrollPhysics,
shrinkWrap: true,
itemBuilder: (context, position) {
return rightItem();
},
),
),
],
),
SizedBox(
height: 70.h,
)
],
), ),
onLoading: () {
_pageIndex++;
queryGoodsList(groupIndex == -1 ? "":productGroupList?.records[groupIndex].id);
},
child: Container(
color: Colors.white,
child: (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();
// },
// 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]),
// );
// },
// ),
// ),
// 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(
@ -245,7 +337,8 @@ class _OnSalePage extends State<OnSalePage> {
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/goods_assort',arguments: {"storeId":widget.storeId}); Navigator.of(context).pushNamed('/router/goods_assort',
arguments: {"storeId": widget.storeId});
}, },
child: Container( child: Container(
color: Color(0xFFEDEDED), color: Color(0xFFEDEDED),
@ -404,84 +497,41 @@ class _OnSalePage extends State<OnSalePage> {
} }
///list ///list
Widget leftItem() { Widget leftItem(Records records, index) {
return Container( return Container(
width: 100.w, color: groupIndex == index ? Colors.transparent : 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,
});
},
child: Container(
color: Color(0xFFFAFAFA),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w),
// margin: EdgeInsets.only(bottom: (index==appletProducts.length - 1)?35.h:0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
"人气必点榜",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
),
)),
],
),
),
),
);
}
///List
Widget rightItem() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Expanded(
padding: EdgeInsets.symmetric(vertical: 16.h),
child: Text( child: Text(
"人气必点榜", records?.groupName ?? "",
style: TextStyle( textAlign: TextAlign.center,
color: Color(0xFF30415B), style: TextStyle(
fontSize: 12.sp, color: groupIndex == index ? Color(0xFF30415B):Color(0xFF626264),
fontWeight: MyFontWeight.regular, fontSize: 12.sp,
), fontWeight: groupIndex == index ? MyFontWeight.semi_bold : MyFontWeight.regular,
)), ),
ListView.builder( )),
itemCount: 8,
controller: controller,
physics: scrollPhysics,
shrinkWrap: true,
itemBuilder: (context, position) {
return rightGoodsItem();
},
)
], ],
), ),
); );
} }
Widget rightGoodsItem() { Widget rightGoodsItem(AdminProductVoList adminProductVoList) {
return Container( return Container(
margin: EdgeInsets.only(bottom: 21.h), margin: EdgeInsets.only(bottom: 21.h, left: 16.w, right: 16.w, top: 10.h),
child: Row( child: Row(
children: [ children: [
Image.asset( MImage(
"assets/image/hot_list.webp", adminProductVoList?.productImg ?? "",
width: 70, width: 70.h,
height: 70, height: 70.h,
fit: BoxFit.fill, fit: BoxFit.cover,
radius: BorderRadius.circular(4),
), ),
SizedBox( SizedBox(
width: 12.w, width: 12.w,
@ -493,7 +543,7 @@ class _OnSalePage extends State<OnSalePage> {
Padding( Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h), padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Text( child: Text(
"台湾甄选手抓饺子三生", adminProductVoList?.productName ?? "",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -506,7 +556,7 @@ class _OnSalePage extends State<OnSalePage> {
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,
@ -517,7 +567,7 @@ class _OnSalePage extends State<OnSalePage> {
width: 8.w, 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,
@ -544,7 +594,7 @@ class _OnSalePage extends State<OnSalePage> {
), ),
), ),
TextSpan( TextSpan(
text: "19", text: adminProductVoList?.price ?? "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
@ -554,23 +604,28 @@ class _OnSalePage extends State<OnSalePage> {
], ],
), ),
)), )),
Container( GestureDetector(
decoration: BoxDecoration( onTap: (){
color: Colors.white, queryGoodsUpdate();
borderRadius: BorderRadius.circular(33), },
border: Border.all( child: Container(
color: Color(0xFF30415B), decoration: BoxDecoration(
width: 1, color: Colors.white,
borderRadius: BorderRadius.circular(33),
border: Border.all(
color: Color(0xFF30415B),
width: 1,
),
), ),
), padding:
padding: EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w),
EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), child: Text(
child: Text( "下架",
"下架", style: TextStyle(
style: TextStyle( fontSize: 12.sp,
fontSize: 12.sp, fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular, color: Color(0xFF30415B),
color: Color(0xFF30415B), ),
), ),
), ),
) )

4
lib/main.dart

@ -483,9 +483,9 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/add_assort': (context, {arguments}) => '/router/add_assort': (context, {arguments}) =>
AddAssort(arguments: arguments), AddAssort(arguments: arguments),
'/router/goods_sort': (context, {arguments}) => '/router/goods_sort': (context, {arguments}) =>
GoodsSort(), GoodsSort(arguments: arguments),
'/router/batch_shelf': (context, {arguments}) => '/router/batch_shelf': (context, {arguments}) =>
BatchShelf(), BatchShelf(arguments: arguments),
'/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}) =>

Loading…
Cancel
Save