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

279
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/flutter_utils.dart';
import '../../../utils/font_weight.dart';
import '../../../view_widget/custom_image.dart';
import '../../../view_widget/no_data_view.dart';
class OnSalePage extends StatefulWidget {
final String storeId;
@ -39,6 +41,7 @@ class _OnSalePage extends State<OnSalePage> {
List<AdminProductVoList> adminProductVoList = [];
int _loadCount = 0;
int _pageIndex = 1;
int groupIndex = -1;
@override
void dispose() {
@ -64,7 +67,7 @@ class _OnSalePage extends State<OnSalePage> {
tenant: BusinessInstance.instance.businessTenant,
storeId: widget.storeId);
queryProductGroupList();
queryGoodsList(isSing: false);
queryGoodsList("", isSing: false);
});
}
@ -85,7 +88,7 @@ class _OnSalePage extends State<OnSalePage> {
"current": 1,
"map": {},
"model": {"groupImg": "", "groupName": "", "isDelete": ""},
"size": 50,
"size": 100,
"sort": "sort"
}).catchError((error) {
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 {
BaseData<BusinessGoods> baseData =
await businessService.findAdminProductLis({
"groupId": "",
"groupId": groupId,
"hasStock": "",
"keyword": "",
"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
Widget build(BuildContext context) {
return Scaffold(
@ -165,87 +193,152 @@ class _OnSalePage extends State<OnSalePage> {
),
Expanded(
child: Container(
child: 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: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container(
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.w,
child: ListView.builder(
itemCount: 5,
itemCount: productGroupList?.records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: leftItem(),
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: ListView.builder(
itemCount: 6,
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: (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: scrollPhysics,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return rightItem();
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(
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
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(
color: Color(0xFFEDEDED),
@ -404,84 +497,41 @@ class _OnSalePage extends State<OnSalePage> {
}
///list
Widget leftItem() {
Widget leftItem(Records records, index) {
return Container(
width: 100.w,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
// controller.jumpTo(appletProducts[index].goodsIndex);
});
},
child: Container(
color: Color(0xFFFAFAFA),
color: groupIndex == index ? Colors.transparent : 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(
"人气必点榜",
records?.groupName ?? "",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF000000),
color: groupIndex == index ? Color(0xFF30415B):Color(0xFF626264),
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
fontWeight: groupIndex == index ? MyFontWeight.semi_bold : MyFontWeight.regular,
),
)),
],
),
),
),
);
}
///List
Widget rightItem() {
Widget rightGoodsItem(AdminProductVoList adminProductVoList) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.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: 8,
controller: controller,
physics: scrollPhysics,
shrinkWrap: true,
itemBuilder: (context, position) {
return rightGoodsItem();
},
)
],
),
);
}
Widget rightGoodsItem() {
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(
children: [
Image.asset(
"assets/image/hot_list.webp",
width: 70,
height: 70,
fit: BoxFit.fill,
MImage(
adminProductVoList?.productImg ?? "",
width: 70.h,
height: 70.h,
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
),
SizedBox(
width: 12.w,
@ -493,7 +543,7 @@ class _OnSalePage extends State<OnSalePage> {
Padding(
padding: EdgeInsets.only(bottom: 11.h, top: 2.h),
child: Text(
"台湾甄选手抓饺子三生",
adminProductVoList?.productName ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -506,7 +556,7 @@ class _OnSalePage extends State<OnSalePage> {
Row(
children: [
Text(
"库存4321",
"库存${adminProductVoList?.stock ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -517,7 +567,7 @@ class _OnSalePage extends State<OnSalePage> {
width: 8.w,
),
Text(
"销量4321",
"销量${adminProductVoList?.sellCount ?? 0}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -544,7 +594,7 @@ class _OnSalePage extends State<OnSalePage> {
),
),
TextSpan(
text: "19",
text: adminProductVoList?.price ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
@ -554,7 +604,11 @@ class _OnSalePage extends State<OnSalePage> {
],
),
)),
Container(
GestureDetector(
onTap: (){
queryGoodsUpdate();
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(33),
@ -573,6 +627,7 @@ class _OnSalePage extends State<OnSalePage> {
color: Color(0xFF30415B),
),
),
),
)
],
)

4
lib/main.dart

@ -483,9 +483,9 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/add_assort': (context, {arguments}) =>
AddAssort(arguments: arguments),
'/router/goods_sort': (context, {arguments}) =>
GoodsSort(),
GoodsSort(arguments: arguments),
'/router/batch_shelf': (context, {arguments}) =>
BatchShelf(),
BatchShelf(arguments: arguments),
'/router/business_order_detail': (context, {arguments}) =>
BusinessOrderDetail(arguments: arguments),
'/router/order_write_off': (context, {arguments}) =>

Loading…
Cancel
Save