对接购物车删除接口

hmxc
张萌 3 years ago
parent 9415b8e39a
commit 559fb691e7

@ -1,6 +1,7 @@
// import 'package:aku_community/base/base_style.dart'; // import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/models/market/goods_classification.dart'; import 'package:aku_community/models/market/goods_classification.dart';
@ -9,37 +10,22 @@ import 'package:aku_community/models/market/order/goods_home_model.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/community_func.dart'; import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_community/ui/market/widget/animated_home_background.dart'; import 'package:aku_community/ui/market/widget/animated_home_background.dart';
import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/home/home_sliver_app_bar.dart'; import 'package:aku_community/widget/home/home_sliver_app_bar.dart';
import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart'; import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/display_category_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/ui/market/category/category_card.dart';
import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/ui/market/order/my_order_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'market_home_goods_card.dart'; import 'market_home_goods_card.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart'; // import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
@ -88,11 +74,14 @@ class _MarketPageState extends State<MarketPage>
int? orderByPrice; int? orderByPrice;
Future updateMarketInfo() async { Future updateMarketInfo() async {
BaseListModel baseListModel = await NetUtil().getList(
BaseListModel baseListModel = API.market.findRecommendGoodsList,
await NetUtil().getList( API.market.findRecommendGoodsList, params: {
params: {'pageNum': _pageNum, 'size': _size, 'pageNum': _pageNum,
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -103,10 +92,14 @@ class _MarketPageState extends State<MarketPage>
} }
Future loadMarketInfo() async { Future loadMarketInfo() async {
BaseListModel baseListModel = BaseListModel baseListModel = await NetUtil().getList(
await NetUtil().getList( API.market.findRecommendGoodsList, API.market.findRecommendGoodsList,
params: {'pageNum': _pageNum, 'size': _size, params: {
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'pageNum': _pageNum,
'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -120,17 +113,18 @@ class _MarketPageState extends State<MarketPage>
void initState() { void initState() {
super.initState(); super.initState();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
_goodsClassificationList.add(GoodsClassification(id: 0,name: '',imgUrls: null)); _goodsClassificationList
.add(GoodsClassification(id: 0, name: '', imgUrls: null));
} }
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
_goodsPopularModelList.add(GoodsPopularModel(id: 0,skuName: '',mainPhoto: '',viewsNum: 0)); _goodsPopularModelList.add(
GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0));
} }
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
_sliverListController = ScrollController(); _sliverListController = ScrollController();
_tabController = TabController( _tabController = TabController(initialIndex: 0, length: 3, vsync: this);
initialIndex: 0, length: 3, vsync: this);
///appbar refresh ///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
await updateMarketInfo(); await updateMarketInfo();
@ -149,7 +143,7 @@ class _MarketPageState extends State<MarketPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// super.build(context); super.build(context);
final mediaWidth = MediaQuery.of(context).size.width; final mediaWidth = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
@ -171,16 +165,10 @@ class _MarketPageState extends State<MarketPage>
setState(() {}); setState(() {});
}, },
child: _buildBody(context), child: _buildBody(context),
), ),
); );
} }
_refresh() async { _refresh() async {
_pageNum = 1; _pageNum = 1;
await updateMarketInfo(); await updateMarketInfo();
@ -188,13 +176,13 @@ class _MarketPageState extends State<MarketPage>
_newTotal = await CommunityFunc.getNewProductsTodayNum(); _newTotal = await CommunityFunc.getNewProductsTodayNum();
_total = await CommunityFunc.getSkuTotal(); _total = await CommunityFunc.getSkuTotal();
_brandTotal = await CommunityFunc.getSettledBrandsNum(); _brandTotal = await CommunityFunc.getSettledBrandsNum();
_goodsClassificationList = await CommunityFunc.getGoodsClassificationList(0);//0 _goodsClassificationList =
await CommunityFunc.getGoodsClassificationList(0); //0
//_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); //_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6);
setState(() {}); setState(() {});
} }
Widget _buildBody(BuildContext context) { Widget _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () async { onPressed: () async {
@ -208,8 +196,7 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'综合', '综合',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp, fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL fontWeight: _orderType == OrderType.NORMAL
? FontWeight.bold ? FontWeight.bold
@ -231,8 +218,7 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'销量', '销量',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp, fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES fontWeight: _orderType == OrderType.SALES
? FontWeight.bold ? FontWeight.bold
@ -312,13 +298,19 @@ class _MarketPageState extends State<MarketPage>
expandedHeight: MessageHeight + expandedHeight: MessageHeight +
bannerHeight + bannerHeight +
buttonsHeight + buttonsHeight +
searchHeight +tabBarHeight+ScreenUtil().statusBarHeight +kToolbarHeight+280.w, searchHeight +
tabBarHeight +
ScreenUtil().statusBarHeight +
kToolbarHeight +
280.w,
flexibleSpace: _flexibleSpaceBar(context), flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight), preferredSize: Size.fromHeight(tabBarHeight),
child: _goodsTitle( normalTypeButton, salesTypeButton, priceButton,) child: _goodsTitle(
)), normalTypeButton,
salesTypeButton,
priceButton,
))),
SliverPadding( SliverPadding(
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
), ),
@ -326,14 +318,12 @@ class _MarketPageState extends State<MarketPage>
padding: EdgeInsets.only(left: 20.w, right: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(), sliver: buildSliverGrid(),
), ),
], ],
); );
} }
SliverGrid buildSliverGrid() { SliverGrid buildSliverGrid() {
return SliverGrid( return SliverGrid(
// child: WaterfallFlow.builder( // child: WaterfallFlow.builder(
// gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2, // crossAxisCount: 2,
@ -357,7 +347,6 @@ class _MarketPageState extends State<MarketPage>
///Item ///Item
delegate: new SliverChildBuilderDelegate( delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
///Item ///Item
return MarketHomeGoodsCard(item: _goodsHomeModelList[index]); return MarketHomeGoodsCard(item: _goodsHomeModelList[index]);
// return Container( // return Container(
@ -366,6 +355,7 @@ class _MarketPageState extends State<MarketPage>
// color: Colors.blue, // color: Colors.blue,
// ); // );
}, },
///Item ///Item
childCount: _goodsHomeModelList.length, childCount: _goodsHomeModelList.length,
), ),
@ -376,10 +366,10 @@ class _MarketPageState extends State<MarketPage>
return <Widget>[ return <Widget>[
GestureDetector( GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); Get.to(() => ShopCarPage()); //
}, },
child: Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, child:
height: 40.w, width: 40.w), Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, height: 40.w, width: 40.w),
), ),
Padding( Padding(
padding: EdgeInsets.only(left: 32.w, right: 32.w), padding: EdgeInsets.only(left: 32.w, right: 32.w),
@ -409,9 +399,7 @@ class _MarketPageState extends State<MarketPage>
child: Flex( child: Flex(
direction: Axis.horizontal, direction: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Row( Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (appProvider.location != null) if (appProvider.location != null)
Padding( Padding(
padding: EdgeInsets.only(right: 5.w, top: 5.w), padding: EdgeInsets.only(right: 5.w, top: 5.w),
@ -424,7 +412,9 @@ class _MarketPageState extends State<MarketPage>
), ),
), ),
Text( Text(
appProvider.location?['city']==null?'':appProvider.location?['city'] as String? ?? '', appProvider.location?['city'] == null
? ''
: appProvider.location?['city'] as String? ?? '',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 28.sp, fontSize: 28.sp,
@ -449,7 +439,6 @@ class _MarketPageState extends State<MarketPage>
} }
FlexibleSpaceBar _flexibleSpaceBar(context) { FlexibleSpaceBar _flexibleSpaceBar(context) {
return FlexibleSpaceBar( return FlexibleSpaceBar(
collapseMode: CollapseMode.pin, collapseMode: CollapseMode.pin,
background: Container( background: Container(
@ -478,7 +467,6 @@ class _MarketPageState extends State<MarketPage>
_buttonTitle(), _buttonTitle(),
20.hb, 20.hb,
_recommend(), _recommend(),
], ],
), ),
], ],
@ -486,7 +474,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
geSearch() { geSearch() {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 24.w), margin: EdgeInsets.symmetric(horizontal: 24.w),
@ -522,9 +509,11 @@ class _MarketPageState extends State<MarketPage>
height: 76.w, height: 76.w,
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12), ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12),
left: Radius.circular(12),
),
gradient: LinearGradient( gradient: LinearGradient(
begin: FractionalOffset.centerRight, begin: FractionalOffset.centerRight,
end: FractionalOffset.centerLeft, end: FractionalOffset.centerLeft,
@ -544,31 +533,39 @@ class _MarketPageState extends State<MarketPage>
width: 694.w, width: 694.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFDEEBF), color: Color(0xFFFDEEBF),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12) ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12), left: Radius.circular(12)),
), ),
child: Container( child: Container(
height: 50.w, height: 50.w,
width: 682.w, width: 682.w,
decoration: BoxDecoration( decoration: BoxDecoration(
//color: Color(0x99F5AF16), //color: Color(0x99F5AF16),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12)), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12), left: Radius.circular(12)),
border: Border.all(width: 2.w, color: Color(0x99F5AF16)), border: Border.all(width: 2.w, color: Color(0x99F5AF16)),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
80.wb, 80.wb,
Image.asset(R.ASSETS_ICONS_SHOP_LABA_PNG,width: 36.w,height: 34.w,), Image.asset(
R.ASSETS_ICONS_SHOP_LABA_PNG,
width: 36.w,
height: 34.w,
),
20.wb, 20.wb,
Text('今日上新${_total}',style: TextStyle(color: Color(0xFFD0564B),fontSize: 24.sp,height: 1.05),), Text(
], '今日上新${_total}',
style: TextStyle(
color: Color(0xFFD0564B),
fontSize: 24.sp,
height: 1.05),
), ),
],
), ),
)
), ),
)),
Positioned( Positioned(
left: 0, left: 0,
top: 0, top: 0,
@ -582,20 +579,23 @@ class _MarketPageState extends State<MarketPage>
end: FractionalOffset.centerRight, end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)], colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)],
), ),
borderRadius: BorderRadius.horizontal(right: Radius.circular(50),left: Radius.circular(24)) borderRadius: BorderRadius.horizontal(
), right: Radius.circular(50), left: Radius.circular(24))),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('SKU总数${_newTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),), Text(
Text('入驻品牌数:${_brandTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),) 'SKU总数${_newTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
Text(
'入驻品牌数:${_brandTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
)
], ],
), ),
)), )),
], ],
), ),
); );
@ -652,12 +652,10 @@ class _MarketPageState extends State<MarketPage>
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12.w)), borderRadius: BorderRadius.all(Radius.circular(12.w)),
), ),
child: child: FadeInImage.assetNetwork(
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(swiperModel.voResourcesImgList)), image: API.image(ImgModel.first(swiperModel.voResourcesImgList)),
fit: BoxFit.fill, fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset( return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP, R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -668,7 +666,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buttonTitle() { _buttonTitle() {
Container titles = Container( Container titles = Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -676,8 +673,7 @@ class _MarketPageState extends State<MarketPage>
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: GridView.builder(
GridView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
@ -692,7 +688,6 @@ class _MarketPageState extends State<MarketPage>
itemCount: 10, itemCount: 10,
shrinkWrap: true, shrinkWrap: true,
), ),
); );
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -703,10 +698,8 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buildTile(GoodsClassification item) { _buildTile(GoodsClassification item) {
return GestureDetector( return GestureDetector(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -716,15 +709,18 @@ class _MarketPageState extends State<MarketPage>
height: 88.w, height: 88.w,
image: API.image(ImgModel.first(item.imgUrls)), image: API.image(ImgModel.first(item.imgUrls)),
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 88.w, return Image.asset(
width: 88.w,); R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 88.w,
width: 88.w,
);
}, },
), ),
8.hb, 8.hb,
Text( (item.name??'').replaceAll('', ''),style: TextStyle( Text(
fontSize: 28.sp, (item.name ?? '').replaceAll('', ''),
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -735,13 +731,16 @@ class _MarketPageState extends State<MarketPage>
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(R.ASSETS_ICONS_TEST_KINGCION_PNG,height: 88.w, Image.asset(
width: 88.w,), R.ASSETS_ICONS_TEST_KINGCION_PNG,
height: 88.w,
width: 88.w,
),
8.hb, 8.hb,
Text( '全部分类',style: TextStyle( Text(
fontSize: 28.sp, '全部分类',
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -757,7 +756,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buttonTitleRow({onPressed}) { _buttonTitleRow({onPressed}) {
return Expanded( return Expanded(
child: CupertinoButton( child: CupertinoButton(
@ -767,7 +765,11 @@ class _MarketPageState extends State<MarketPage>
Container( Container(
width: 88.w, width: 88.w,
height: 88.w, height: 88.w,
child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 88.w,height: 88.w,), child: Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 88.w,
height: 88.w,
),
// FadeInImage.assetNetwork( // FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: Api.getImgUrl(kingCoin.url),) // image: Api.getImgUrl(kingCoin.url),)
@ -776,10 +778,7 @@ class _MarketPageState extends State<MarketPage>
margin: EdgeInsets.only(top: 6.w), margin: EdgeInsets.only(top: 6.w),
child: Text( child: Text(
'数码产品', '数码产品',
style: TextStyle( style: TextStyle(fontSize: 28.sp, color: Color(0xFF333333)),
fontSize: 28.sp,
color: Color(0xFF333333)),
), ),
) )
], ],
@ -793,7 +792,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_recommend() { _recommend() {
return Container( return Container(
height: 184.w, height: 184.w,
@ -804,8 +802,7 @@ class _MarketPageState extends State<MarketPage>
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: Column(
Column(
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -835,12 +832,14 @@ class _MarketPageState extends State<MarketPage>
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: _goodsPopularModelList[index].mainPhoto ?? '', image: _goodsPopularModelList[index].mainPhoto ?? '',
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w, return Image.asset(
width: 96.w,); R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 96.w,
width: 96.w,
);
}, },
), ),
), ),
], ],
); );
}, },
@ -870,24 +869,20 @@ class _MarketPageState extends State<MarketPage>
// ], // ],
// ).expand(), // ).expand(),
], ],
) ));
);
} }
_goodsTitle(
Widget normalTypeButton,
Widget salesTypeButton,
Widget priceButton,
) {
_goodsTitle(Widget normalTypeButton,Widget salesTypeButton,Widget priceButton,){
return Container( return Container(
height: 90.w, height: 90.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
color: Color(0xFFF9F9F9), color: Color(0xFFF9F9F9),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: child: Container(
Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
child: Row( child: Row(
@ -897,18 +892,10 @@ class _MarketPageState extends State<MarketPage>
priceButton, priceButton,
], ],
), ),
), ),
); );
} }
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -41,6 +41,14 @@ class _ShopCarPageState extends State<ShopCarPage> {
return num; return num;
} }
@override
void dispose() {
_controllers.forEach((element) {
element.dispose();
});
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -102,26 +110,17 @@ class _ShopCarPageState extends State<ShopCarPage> {
_models = (base.data as List) _models = (base.data as List)
.map((e) => ShopCarListModel.fromJson(e)) .map((e) => ShopCarListModel.fromJson(e))
.toList(); .toList();
} _controllers.forEach((element) {
_models.add(ShopCarListModel( element.dispose();
id: 0, });
skuName: '123', _controllers.clear();
mainPhoto: '',
status: 1,
shopStatus: 1,
sellPrice: 20.00,
discountPrice: 10,
unit: '',
kind: 1,
weight: 3,
num: 2));
_models.forEach((element) { _models.forEach((element) {
_controllers.add( _controllers.add(
TextEditingController(text: element.num.toString())); TextEditingController(text: element.num.toString()));
}); });
}
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
;
} }
}, },
child: _models.isEmpty child: _models.isEmpty
@ -209,7 +208,15 @@ class _ShopCarPageState extends State<ShopCarPage> {
Future _settleEnd() async {} Future _settleEnd() async {}
Future _delete() async {} Future _delete() async {
await NetUtil().post(
API.market.shopCarDelete,
params: {
'jcookGoodsIds': _selectIndex.map((e) => _models[e].id).toList()
},
showMessage: true,
);
}
Widget _goodCard(ShopCarListModel model, int index) { Widget _goodCard(ShopCarListModel model, int index) {
var top = RichText( var top = RichText(

Loading…
Cancel
Save