|
|
|
@ -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,78 +193,142 @@ 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); |
|
|
|
|
}, |
|
|
|
|
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: () { |
|
|
|
|
setState(() { |
|
|
|
|
groupIndex = position; |
|
|
|
|
_pageIndex = 1; |
|
|
|
|
adminProductVoList.clear(); |
|
|
|
|
queryGoodsList( |
|
|
|
|
productGroupList?.records[position].id, |
|
|
|
|
isSing: false); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: leftItem( |
|
|
|
|
productGroupList.records[position], position), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
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( |
|
|
|
|
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, |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
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: (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( |
|
|
|
@ -245,7 +337,8 @@ class _OnSalePage extends State<OnSalePage> {
|
|
|
|
|
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), |
|
|
|
|
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, |
|
|
|
|
color: groupIndex == index ? Colors.transparent : Color(0xFFFAFAFA), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 14.w), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
|
|
|
Expanded( |
|
|
|
|
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(); |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
records?.groupName ?? "", |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: groupIndex == index ? Color(0xFF30415B):Color(0xFF626264), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: groupIndex == index ? MyFontWeight.semi_bold : MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget rightGoodsItem() { |
|
|
|
|
Widget rightGoodsItem(AdminProductVoList adminProductVoList) { |
|
|
|
|
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,23 +604,28 @@ class _OnSalePage extends State<OnSalePage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
Container( |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
|
borderRadius: BorderRadius.circular(33), |
|
|
|
|
border: Border.all( |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
width: 1, |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
queryGoodsUpdate(); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
|
borderRadius: BorderRadius.circular(33), |
|
|
|
|
border: Border.all( |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
width: 1, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
padding: |
|
|
|
|
EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), |
|
|
|
|
child: Text( |
|
|
|
|
"下架", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
padding: |
|
|
|
|
EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), |
|
|
|
|
child: Text( |
|
|
|
|
"下架", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|