diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 7b19cdc..0aaf7bb 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,3 +1,3 @@ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" -#include "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig" + diff --git a/ios/Podfile b/ios/Podfile index 4b9cf4b..917822d 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '9.3' +# platform :ios, '9.3' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8f61a9d..8d9efd3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -473,6 +473,6 @@ SPEC CHECKSUMS: webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44 -PODFILE CHECKSUM: 80e178f7acd39d9ad7aacc7d6a4e9dea0cb945ea +PODFILE CHECKSUM: 8eecf180615377d7d7172e551af1ab922f54002e COCOAPODS: 1.11.0 diff --git a/lib/models/goods_detail_model.dart b/lib/models/goods_detail_model.dart index df69e8b..9ae1022 100644 --- a/lib/models/goods_detail_model.dart +++ b/lib/models/goods_detail_model.dart @@ -133,6 +133,7 @@ class Data extends Object { int brandId; + String goodsName; String description; @@ -178,6 +179,7 @@ class Data extends Object { Living living; Seckill seckill; + int vendorId; Data( @@ -207,7 +209,8 @@ class Data extends Object { this.notice, this.countryIcon, this.living, - this.seckill + this.seckill, + this.vendorId ); factory Data.fromJson(Map srcJson) => diff --git a/lib/models/goods_detail_model.g.dart b/lib/models/goods_detail_model.g.dart index 5fe3124..38209fb 100644 --- a/lib/models/goods_detail_model.g.dart +++ b/lib/models/goods_detail_model.g.dart @@ -77,6 +77,7 @@ Data _$DataFromJson(Map json) { json['country_icon'], json['living'] == null ? null : new Living.fromJson(json['living']), json['sec_kill'] == null ? null : new Seckill.fromJson(json['sec_kill']), + json['vendorId'] as int, ); } @@ -103,6 +104,7 @@ Map _$DataToJson(Data instance) => { 'country_icon': instance.countryIcon, 'living': instance.living, 'sec_kill':instance.seckill, + 'vendorId':instance.vendorId }; MainPhotos _$MainPhotosFromJson(Map json) { diff --git a/lib/models/goods_hot_sell_list_model.dart b/lib/models/goods_hot_sell_list_model.dart index 64c9fcb..443803b 100644 --- a/lib/models/goods_hot_sell_list_model.dart +++ b/lib/models/goods_hot_sell_list_model.dart @@ -47,6 +47,8 @@ class Data { int isFerme; int storehouse; String countryIcon; + int gysId; + SecKill secKill; Data({ this.id, this.goodsName, @@ -67,6 +69,8 @@ class Data { this.isImport, this.storehouse, this.countryIcon, + this.gysId, + this.secKill }); Data.fromJson(Map json) { @@ -88,6 +92,10 @@ class Data { isFerme = json['isFerme']; storehouse = json['storehouse']; countryIcon = json['country_icon']; + gysId = json['gys_id']; + secKill = json['sec_kill'] != null + ? new SecKill.fromJson(json['sec_kill']) + : null; } Map toJson() { @@ -107,6 +115,38 @@ class Data { data['isFerme'] = this.isFerme; data['storehouse'] = this.storehouse; data['country_icon'] = this.countryIcon; + data['gys_id'] = this.gysId; + if (this.secKill != null) { + data['sec_kill'] = this.secKill.toJson(); + } + return data; + } +} +class SecKill { + int secKill; + String secKillEndTime; + int secKillMinPrice; + int secKillCommission; + + SecKill( + {this.secKill, + this.secKillEndTime, + this.secKillMinPrice, + this.secKillCommission}); + + SecKill.fromJson(Map json) { + secKill = json['sec_kill']; + secKillEndTime = json['sec_kill_end_time']; + secKillMinPrice = json['sec_kill_min_price']; + secKillCommission = json['sec_kill_commission']; + } + + Map toJson() { + final Map data = new Map(); + data['sec_kill'] = this.secKill; + data['sec_kill_end_time'] = this.secKillEndTime; + data['sec_kill_min_price'] = this.secKillMinPrice; + data['sec_kill_commission'] = this.secKillCommission; return data; } } diff --git a/lib/models/goods_simple_list_model.dart b/lib/models/goods_simple_list_model.dart index a33803a..4ededef 100644 --- a/lib/models/goods_simple_list_model.dart +++ b/lib/models/goods_simple_list_model.dart @@ -1,5 +1,7 @@ import 'package:recook/pages/home/promotion_time_tool.dart'; +import 'goods_hot_sell_list_model.dart'; + class GoodsSimpleListModel { String code; String msg; @@ -56,6 +58,7 @@ class GoodsSimple { num gysId; List specialIcon; String countryIcon; + SecKill secKill; GoodsSimple( {this.id, this.goodsName, @@ -83,7 +86,8 @@ class GoodsSimple { this.living, this.gysId, this.specialIcon, - this.countryIcon}); + this.countryIcon, + this.secKill}); GoodsSimple.fromJson(Map json) { id = json['id']; @@ -117,6 +121,9 @@ class GoodsSimple { specialIcon = json['spec_icon'] != null ? json['spec_icon'].cast() : null; countryIcon = json['country_icon']; + secKill = json['sec_kill'] != null + ? new SecKill.fromJson(json['sec_kill']) + : null; } Map toJson() { @@ -150,6 +157,9 @@ class GoodsSimple { data['gys_id'] = this.gysId; data['spec_icon'] = this.specialIcon; data['country_icon'] = this.countryIcon; + if (this.secKill != null) { + data['sec_kill'] = this.secKill.toJson(); + } return data; } @@ -176,3 +186,4 @@ class Living { return data; } } + diff --git a/lib/models/promotion_goods_list_model.dart b/lib/models/promotion_goods_list_model.dart index ef196ed..d7fb449 100644 --- a/lib/models/promotion_goods_list_model.dart +++ b/lib/models/promotion_goods_list_model.dart @@ -1,6 +1,7 @@ import 'package:flustars/flustars.dart'; import 'package:recook/pages/home/promotion_time_tool.dart'; +import 'goods_hot_sell_list_model.dart'; import 'goods_simple_list_model.dart'; class PromotionGoodsListModel { @@ -126,6 +127,7 @@ class PromotionGoodsModel { num gysId; List specialIcon; String countryIcon; + SecKill secKill; PromotionGoodsModel( {this.goodsId, @@ -158,7 +160,8 @@ class PromotionGoodsModel { this.specialSale, this.gysId, this.specialIcon, - this.countryIcon}); + this.countryIcon, + this.secKill}); PromotionGoodsModel.fromJson(Map json) { goodsId = json['goodsId']; @@ -197,6 +200,9 @@ class PromotionGoodsModel { json['spec_icon'] != null ? json['spec_icon'].cast() : null; gysId = json['gys_id']; countryIcon = json['country_icon']; + secKill = json['sec_kill'] != null + ? new SecKill.fromJson(json['sec_kill']) + : null; } Map toJson() { @@ -236,6 +242,9 @@ class PromotionGoodsModel { data['gys_id'] = this.gysId; data['spec_icon'] = this.specialIcon; data['country_icon'] = this.countryIcon; + if (this.secKill != null) { + data['sec_kill'] = this.secKill.toJson(); + } return data; } diff --git a/lib/pages/home/classify/commodity_detail_page.dart b/lib/pages/home/classify/commodity_detail_page.dart index 48465ac..693a937 100644 --- a/lib/pages/home/classify/commodity_detail_page.dart +++ b/lib/pages/home/classify/commodity_detail_page.dart @@ -42,8 +42,8 @@ class CommodityDetailPage extends StatefulWidget { this.liveId = 0, }) : super(key: key); - static setArguments(int goodsID, {int liveStatus, int roomId,int gysId,bool seckillout}) { - return {"goodsID": goodsID, 'liveStatus': liveStatus, 'roomId': roomId,'gysId':gysId,'seckillout':seckillout}; + static setArguments(int goodsID, {int liveStatus, int roomId,bool seckillout}) { + return {"goodsID": goodsID, 'liveStatus': liveStatus, 'roomId': roomId,'seckillout':seckillout}; } @override @@ -62,7 +62,7 @@ class _CommodityDetailPageState extends BaseStoreState GoodsDetailModel _goodsDetail; int _liveStatus; int _roomId; - num _gysId; + bool _seckillout;//秒杀是否无货 @@ -72,8 +72,6 @@ class _CommodityDetailPageState extends BaseStoreState _goodsId = widget.arguments["goodsID"]; _liveStatus = widget.arguments["liveStatus"]; _roomId = widget.arguments["roomId"]; - _gysId = widget.arguments["gysId"]; - _seckillout = widget.arguments['seckillout']??false; _tabController = TabController(length: 3, vsync: this); @@ -158,6 +156,7 @@ class _CommodityDetailPageState extends BaseStoreState child: CacheTabBarView( controller: _tabController, children: [ + _goodsDetail!=null? GoodsPage( liveStatus: _liveStatus, roomId: _roomId, @@ -172,7 +171,6 @@ class _CommodityDetailPageState extends BaseStoreState goodsId: _goodsId, openSkuChoosePage: _openSkuChoosePage, goodsDetail: _goodsDetail, - gysId: _gysId, onScroll: (notification) { // double maxScroll = notification.metrics.maxScrollExtent; double offset = notification.metrics.pixels; @@ -185,7 +183,7 @@ class _CommodityDetailPageState extends BaseStoreState // _tabController.animateTo(1); // } }, - ), + ):SizedBox(), // DetailPage( // goodsID: _goodsId, // ), diff --git a/lib/pages/home/classify/goods_page.dart b/lib/pages/home/classify/goods_page.dart index 3d2f3df..83dceda 100644 --- a/lib/pages/home/classify/goods_page.dart +++ b/lib/pages/home/classify/goods_page.dart @@ -84,7 +84,6 @@ class GoodsPage extends StatefulWidget { final int liveStatus; final int roomId; - final num gysId; const GoodsPage({ Key key, @@ -97,7 +96,6 @@ class GoodsPage extends StatefulWidget { // this.liveId = 0, this.liveStatus, this.roomId, - this.gysId, }) : super(key: key); @override @@ -128,7 +126,7 @@ class _GoodsPageState extends BaseStoreState { AddressDefaultModel _addressModel; String _defaltAddress; int _jDHaveGoods = -1; - int _seckillStatus = 0;//秒杀状态 0为未开始 1为开始 + // int _seckillStatus = 0;//秒杀状态 0为未开始 1为开始 @override bool get wantKeepAlive => true; @@ -136,8 +134,8 @@ class _GoodsPageState extends BaseStoreState { @override void initState() { super.initState(); - //gysid为1800或者2000 - if (widget.gysId == 1800 || widget.gysId == 2000) { + //获取默认地址并且判断有无货源 + if (widget.goodsDetail.data.vendorId == 1800 || widget.goodsDetail.data.vendorId == 2000) { Future.delayed(Duration.zero, () async { _addressList = await _getDefaultAddress(); if (_addressList != null) { @@ -156,12 +154,14 @@ class _GoodsPageState extends BaseStoreState { }); } } - // - }); } }); + } + //goodsDetail.data.vendorId为1800或者2000 + + GoodsDetailModelImpl.getDetailImages(widget.goodsId) .then((GoodsDetailImagesModel model) { if (model.code != HttpStatus.SUCCESS) { @@ -177,7 +177,7 @@ class _GoodsPageState extends BaseStoreState { if (_context != null && widget.goodsDetail != null && widget.openSkuChoosePage.value) { - if (widget.gysId == 1800 || widget.gysId == 2000) { + if (widget.goodsDetail.data.vendorId == 1800 || widget.goodsDetail.data.vendorId == 2000) { if (_jDHaveGoods == 1) { _showSkuChoosePage(context); } else { @@ -190,6 +190,7 @@ class _GoodsPageState extends BaseStoreState { } }); + } @override @@ -201,6 +202,7 @@ class _GoodsPageState extends BaseStoreState { @override Widget buildContext(BuildContext context, {store}) { if (widget.goodsDetail != null) { + _skuCombinations(); _itemModels = _chooseValues(); } @@ -210,6 +212,8 @@ class _GoodsPageState extends BaseStoreState { } MediaQuery _buildBody(BuildContext context) { + + _context = context; return MediaQuery.removePadding( key: myGlobals.scaffoldKey, @@ -245,6 +249,7 @@ class _GoodsPageState extends BaseStoreState { } List _detailListWidget() { + List children = []; children.addAll(_goodHeadDetail()); children.addAll(_goodDetailImages()); @@ -409,7 +414,7 @@ class _GoodsPageState extends BaseStoreState { children: [ _headPageView(), GoodPriceView( - gysId: widget.gysId, + detailModel: widget.goodsDetail, shareCallback: () { String img = ''; @@ -441,7 +446,7 @@ class _GoodsPageState extends BaseStoreState { color: Colors.white, child: _discountContent(context), ), - widget.gysId == 1800 || widget.gysId == 2000 + widget.goodsDetail.data.vendorId == 1800 || widget.goodsDetail.data.vendorId == 2000 ? Container( margin: EdgeInsets.only(bottom: 13), padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), @@ -545,7 +550,7 @@ class _GoodsPageState extends BaseStoreState { margin: EdgeInsets.only(top: 10), child: GestureDetector( onTap: () { - if (widget.gysId == 1800 || widget.gysId == 2000) { + if (widget.goodsDetail.data.vendorId == 1800 || widget.goodsDetail.data.vendorId == 2000) { if (_jDHaveGoods == 1) { _showSkuChoosePage(context); } else { @@ -812,7 +817,7 @@ class _GoodsPageState extends BaseStoreState { Expanded( child: Row( children: [ - widget.gysId == 1800 + widget.goodsDetail.data.vendorId == 1800 ? Text( "京东仓发货 | ", style: AppTextStyle.generate(13 * 2.sp, diff --git a/lib/pages/home/items/item_brand_detail_grid.dart b/lib/pages/home/items/item_brand_detail_grid.dart index 07caacf..e34035b 100644 --- a/lib/pages/home/items/item_brand_detail_grid.dart +++ b/lib/pages/home/items/item_brand_detail_grid.dart @@ -34,9 +34,26 @@ class BrandDetailGridItem extends StatelessWidget { {Key key, this.goods, this.buyClick, this.onBrandClick}) : super(key: key); static final Color colorGrey = Color(0xff999999); + @override Widget build(BuildContext context) { - bool isSoldOut = goods.inventory <= 0 ? true : false; + + bool sellout = false; + bool isSeckill = false; + + if(this.goods.inventory>0){ + sellout = false; + }else{ + sellout = true; + } + if(this.goods.secKill!=null){ + if(this.goods.secKill.secKill==1){ + isSeckill = true; + sellout = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + } + } + double width = (MediaQuery.of(context).size.width - 10) / 2; return ClipRRect( borderRadius: BorderRadius.all(Radius.circular(8)), @@ -63,7 +80,7 @@ class BrandDetailGridItem extends StatelessWidget { Api.getResizeImgUrl(goods.mainPhotoUrl, 300)), )), Positioned( - child: isSoldOut + child: sellout ? ItemTagWidget.imageMaskWidget( padding: 40, width: width - 80, height: width - 80) : Container(), @@ -171,10 +188,20 @@ class BrandDetailGridItem extends StatelessWidget { // Spacer(), _saleNumberWidget(this.goods), SizedBox( - height: 4 * 2.w, + height: 4.w, ), Row( children: [ + isSeckill?Container( + alignment: Alignment.center, + child: Text( + "赚" + (this.goods.commission??0).toStringAsFixed(2), + style: TextStyle( + color: Color(0xFFC92219), + fontSize: 12 * 2.sp, + ), + ), + ): Text( '¥${this.goods.originalPrice.toStringAsFixed(2)}', style: TextStyle( @@ -270,7 +297,7 @@ class BrandDetailGridItem extends StatelessWidget { child: CustomImageButton( direction: Direction.horizontal, height: 21, - title: this.goods.inventory <= 0 ? "已售完" : "自购", + title: sellout ? "已售完" : "自购", style: TextStyle( color: Colors.white, fontSize: 13 * 2.sp, @@ -298,7 +325,7 @@ class BrandDetailGridItem extends StatelessWidget { // : 0), // topRight: Radius.circular(40), // bottomRight: Radius.circular(40)), - backgroundColor: this.goods.inventory <= 0 + backgroundColor: sellout ? AppColor.greyColor : Color(0xFFC92219), pureDisplay: true, @@ -317,11 +344,27 @@ class BrandDetailGridItem extends StatelessWidget { } _saleNumberWidget(GoodsSimple goods) { + bool sellout = false; + bool isSeckill = false; + + if(this.goods.inventory>0){ + sellout = false; + }else{ + sellout = true; + } + if(this.goods.secKill!=null){ + if(this.goods.secKill.secKill==1){ + isSeckill = true; + sellout = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + } + } return Container( child: Stack( children: [ Row( children: [ + isSeckill?SizedBox(): (goods.coupon != null && goods.coupon != 0) ? Container( margin: EdgeInsets.only(right: 5), @@ -331,11 +374,16 @@ class BrandDetailGridItem extends StatelessWidget { ), ) : SizedBox(), + isSeckill? Container( + padding: EdgeInsets.only(top:5.rw), + child: Image.asset(R.ASSETS_SECKILL_ICON_PNG,width: 69.rw,height: 20.rw,), + ): AppConfig.commissionByRoleLevel ? Container( child: Stack( alignment: Alignment.center, children: [ + Container( margin: EdgeInsets.symmetric(vertical: 2), alignment: Alignment.center, @@ -354,6 +402,7 @@ class BrandDetailGridItem extends StatelessWidget { ), ), ), + AppConfig.getShowCommission() ? Container( alignment: Alignment.center, @@ -383,7 +432,7 @@ class BrandDetailGridItem extends StatelessWidget { buyClick(); } else { AppRouter.push(context, RouteName.COMMODITY_PAGE, - arguments: CommodityDetailPage.setArguments(this.goods.id,gysId: this.goods.gysId)); + arguments: CommodityDetailPage.setArguments(this.goods.id)); } } diff --git a/lib/pages/home/items/item_brand_like_grid.dart b/lib/pages/home/items/item_brand_like_grid.dart index c1964de..300e627 100644 --- a/lib/pages/home/items/item_brand_like_grid.dart +++ b/lib/pages/home/items/item_brand_like_grid.dart @@ -188,7 +188,7 @@ class BrandLikeGridItem extends StatelessWidget { TextSpan( text: "券后 ¥ ", style: AppTextStyle.generate(12 * 2.sp, - color: Color(0xFFFA6400), + color: Color(0xffc70404), fontWeight: FontWeight.w500), ), TextSpan( diff --git a/lib/pages/home/widget/good_price_view.dart b/lib/pages/home/widget/good_price_view.dart index 5fac237..f626896 100644 --- a/lib/pages/home/widget/good_price_view.dart +++ b/lib/pages/home/widget/good_price_view.dart @@ -29,10 +29,9 @@ import 'package:recook/widgets/goods_item.dart'; class GoodPriceView extends StatefulWidget { final GoodsDetailModel detailModel; final VoidCallback shareCallback; - final gysId; const GoodPriceView( - {Key key, this.detailModel, this.shareCallback, this.gysId}) + {Key key, this.detailModel, this.shareCallback}) : super(key: key); @override @@ -54,10 +53,7 @@ class _GoodPriceViewState extends State { if(widget.detailModel.data.seckill!=null){ _status = widget.detailModel.data.seckill.seckill_status; _endTime = widget.detailModel.data.seckill.seckillEndTime; - print('--------------------'); - print(DateTime.parse(_endTime)); - print('--------------------'); - _endTime= DateUtil.formatDate(DateTime.parse(_endTime), format: 'HH-mm-ss'); + //_endTime= DateUtil.formatDate(DateTime.parse(_endTime), format: 'HH-mm-ss'); } detailModel = widget.detailModel; @@ -75,7 +71,7 @@ class _GoodPriceViewState extends State { _detail(), _label(), //京东商品隐藏 - widget.gysId == 1800 || widget.gysId == 2000 ?SizedBox(): _service() , + widget.detailModel.data.vendorId == 1800 || widget.detailModel.data.vendorId == 2000 ?SizedBox(): _service() , ], ); } @@ -156,11 +152,10 @@ class _GoodPriceViewState extends State { "${_getDoubleText(minCommission)}-${_getDoubleText(maxCommission)}"; } if(_status==1){ - if(detailModel.data.sku != null && detailModel.data.sku.length > 0){ - detailModel.data.sku.sort((left,right)=> left.discountPrice.compareTo(right.discountPrice)); - price = detailModel.data.sku[0].discountPrice.toStringAsFixed(2); - commission = detailModel.data.sku[0].commission.toStringAsFixed(2); - } + + price = detailModel.data.seckill.seckillMinPrice.toStringAsFixed(2)??''; + commission = detailModel.data.seckill.seckillCommission.toStringAsFixed(2)??''; + } return _normalPriceWidget( price, commission, originPrice, isTwoPrice, coupon); diff --git a/lib/pages/home/widget/modify_detail_bottom_bar.dart b/lib/pages/home/widget/modify_detail_bottom_bar.dart index faf6f60..f72ed0b 100644 --- a/lib/pages/home/widget/modify_detail_bottom_bar.dart +++ b/lib/pages/home/widget/modify_detail_bottom_bar.dart @@ -319,13 +319,16 @@ class _DetailBottomBarState extends State { _twoButtonRow() { String commission = ''; if(widget.goodsDetail != null){ - if( widget.goodsDetail.data.seckill.seckill_status==1){ - commission = widget.goodsDetail.data.seckill.seckillCommission.toStringAsFixed(2); - }else{ - commission = widget.goodsDetail == null - ? null - : widget.goodsDetail.data.price.min.commission.toStringAsFixed(2); + commission = widget.goodsDetail == null + ? null + : widget.goodsDetail.data.price.min.commission.toStringAsFixed(2); + if(widget.goodsDetail.data.seckill!=null){ + if( widget.goodsDetail.data.seckill.seckill_status==1){ + commission = widget.goodsDetail.data.seckill.seckillCommission.toStringAsFixed(2); + } + } + } diff --git a/lib/pages/seckill_activity/seckill_activity_page.dart b/lib/pages/seckill_activity/seckill_activity_page.dart index df21c2a..482a8d3 100644 --- a/lib/pages/seckill_activity/seckill_activity_page.dart +++ b/lib/pages/seckill_activity/seckill_activity_page.dart @@ -17,12 +17,12 @@ import 'package:recook/widgets/refresh_widget.dart'; import 'package:velocity_x/velocity_x.dart'; import 'cut_down_time_widget.dart'; +import 'functions/SeckillFunctions.dart'; import 'model/SeckillModel.dart'; class SeckillActivityPage extends StatefulWidget { - final SeckillModel seckillModel; SeckillActivityPage({ - Key key, @required this.seckillModel, + Key key }) : super(key: key); @override @@ -36,6 +36,8 @@ class _SeckillActivityPageState extends State { String _endTime = ''; String _startTime = ''; num _peopleNum = 800; + SeckillModel _seckillModel; + GSRefreshController _refreshController = GSRefreshController(initialRefresh: true); @@ -43,10 +45,7 @@ class _SeckillActivityPageState extends State { @override void initState() { super.initState(); - _status = widget.seckillModel.status; - _endTime = widget.seckillModel.endTime; - _startTime = widget.seckillModel.startTime; - _peopleNum = widget.seckillModel.shoppingPeople; + } @override @@ -91,41 +90,41 @@ class _SeckillActivityPageState extends State { bottom: _bottomWidgt(), ), - body: Container( - // decoration: BoxDecoration( - // gradient: LinearGradient( - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // colors: [ - // Color(0xFFD5101A), - // Color(0x03FE2E39), - // ], - // stops: [0.0, 0.5], - // )), - child: _listWidget(), - ), - ); + body: RefreshWidget( + controller: _refreshController, + noData: '抱歉,没有找到商品', + onRefresh: () async { + _seckillModel = await SeckillFunc.getSeckillList(); + if(_seckillModel!=null){ + _status =_seckillModel.status; + _endTime = _seckillModel.endTime; + _startTime = _seckillModel.startTime; + _peopleNum = _seckillModel.shoppingPeople; + setState(() {}); + } + _refreshController.refreshCompleted(); + + }, + body: _listWidget())); } _listWidget() { - return Container( - child: widget.seckillModel.seckillGoodsList!=null? + return _seckillModel!=null? ListView.builder( - itemBuilder: (_, index) { return GestureDetector( onTap: () { AppRouter.push(context, RouteName.COMMODITY_PAGE, arguments: CommodityDetailPage.setArguments( - widget.seckillModel.seckillGoodsList[index].goodsId)); + _seckillModel.seckillGoodsList[index].goodsId)); }, - child: _itemWidget(widget.seckillModel.seckillGoodsList[index]), + child: _itemWidget(_seckillModel.seckillGoodsList[index]), ); }, - itemCount: widget.seckillModel.seckillGoodsList.length, - ):noDataView('没有找到商品'), - ); + itemCount: _seckillModel.seckillGoodsList.length, + ):noDataView('没有找到商品'); + } noDataView(String text, {Widget icon}) { return Container( @@ -170,7 +169,7 @@ class _SeckillActivityPageState extends State { }, buildCtx: context, model: data, - seckillModel: widget.seckillModel, + seckillModel: _seckillModel, ), ], ), diff --git a/lib/pages/shopping_cart/item/item_shopping_cart.dart b/lib/pages/shopping_cart/item/item_shopping_cart.dart index d599f2e..6d31bd1 100644 --- a/lib/pages/shopping_cart/item/item_shopping_cart.dart +++ b/lib/pages/shopping_cart/item/item_shopping_cart.dart @@ -72,8 +72,8 @@ class _ShoppingCartItemState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - !widget.model.isAllWaitPromotionStart() || widget.isEdit - ? CustomImageButton( + // !widget.model.isAllWaitPromotionStart() || widget.isEdit? + CustomImageButton( icon: Icon( widget.model.selected ? AppIcons.icon_check_circle @@ -98,8 +98,8 @@ class _ShoppingCartItemState extends State { }); setState(() {}); }, - ) - : Container(), + ), + // : Container(), Container( width: rSize(6), ), diff --git a/lib/pages/shopping_cart/shopping_cart_page.dart b/lib/pages/shopping_cart/shopping_cart_page.dart index 7af21f1..f554108 100644 --- a/lib/pages/shopping_cart/shopping_cart_page.dart +++ b/lib/pages/shopping_cart/shopping_cart_page.dart @@ -76,6 +76,7 @@ class _ShoppingCartPageState extends BaseStoreState _controller = MvpListViewController(); _selectedGoods = []; + _presenter.getShoppingCartList(UserManager.instance.user.info.id); UserManager.instance.refreshShoppingCart.addListener(_refreshShoppingCart); @@ -308,12 +309,14 @@ class _ShoppingCartPageState extends BaseStoreState _checkAll = !_checkAll; _selectedGoods.clear(); // 如果是编辑状态 可以选中所以 - // 如果不是编辑状态 只能选中没有在活动中的商品 + // 如果不是编辑状态 只能选中未下架的商品 _controller.getData().forEach((brand) { brand.selected = _checkAll; brand.children.forEach((goods) { if (_checkAll) { - _selectedGoods.add(goods); + if(goods.publishStatus!=0){//判断是否下架 + _selectedGoods.add(goods); + } } goods.selected = _checkAll; }); diff --git a/lib/pages/user/items/item_order_list.dart b/lib/pages/user/items/item_order_list.dart index 71331a2..cd8c4d3 100644 --- a/lib/pages/user/items/item_order_list.dart +++ b/lib/pages/user/items/item_order_list.dart @@ -509,11 +509,12 @@ class _OrderListItemState extends State { borderRadius: BorderRadius.circular(2), color: Color(0xffeff1f6), ), + constraints: BoxConstraints(maxWidth: 150.rw),//增加最大宽度 padding: const EdgeInsets.symmetric( vertical: 3, horizontal: 6), child: Text( "${goods.skuName}", - maxLines: 3, + maxLines: 1, overflow: TextOverflow.ellipsis, style: AppTextStyle.generate(11 * 2.sp, color: Colors.grey[600], diff --git a/lib/pages/user/order/order_detail_state.dart b/lib/pages/user/order/order_detail_state.dart index 089fa4a..f4d3a57 100644 --- a/lib/pages/user/order/order_detail_state.dart +++ b/lib/pages/user/order/order_detail_state.dart @@ -577,6 +577,7 @@ abstract class OrderDetailState crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( + constraints: BoxConstraints(maxWidth: 150.rw), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: Color(0xffeff1f6), @@ -585,7 +586,7 @@ abstract class OrderDetailState vertical: 3, horizontal: 6), child: Text( goods.skuName, - maxLines: 3, + maxLines: 1, overflow: TextOverflow.ellipsis, style: AppTextStyle.generate(11 * 2.sp, color: Colors.grey[600], diff --git a/lib/pages/user/setting_page.dart b/lib/pages/user/setting_page.dart index 6ed92d7..7258e4e 100644 --- a/lib/pages/user/setting_page.dart +++ b/lib/pages/user/setting_page.dart @@ -138,11 +138,10 @@ class _SettingItemListViewState extends ResumableState { //秒杀临时入口 SCTile.normalTile("秒杀(临时)", listener: () async { - SeckillModel seckillModel = new SeckillModel(); - seckillModel = await SeckillFunc.getSeckillList(); - if(seckillModel!=null){ - Get.to(() => SeckillActivityPage(seckillModel:seckillModel)); - } + + + Get.to(() => SeckillActivityPage()); + //CRoute.push(context, PrivacyPageV2()); }), diff --git a/lib/pages/welcome/launch_widget.dart b/lib/pages/welcome/launch_widget.dart index 39ae5a6..9f60f3b 100644 --- a/lib/pages/welcome/launch_widget.dart +++ b/lib/pages/welcome/launch_widget.dart @@ -32,7 +32,7 @@ class _LaunchWidgetState extends BaseStoreState @override void initState() { super.initState(); - PowerLogger.start(context, debug: AppConfig.debug); + PowerLogger.start(context, debug: true);//京东测试 WidgetsBinding.instance.addPostFrameCallback((callback) async { await Future.delayed(Duration(milliseconds: 2450)); if (HiveStore.appBox.get('privacy_init') == null) { diff --git a/lib/widgets/goods_item.dart b/lib/widgets/goods_item.dart index 6b2f25b..b5149a0 100644 --- a/lib/widgets/goods_item.dart +++ b/lib/widgets/goods_item.dart @@ -8,6 +8,7 @@ import 'package:recook/constants/header.dart'; import 'package:recook/manager/user_manager.dart'; import 'package:recook/models/goods_detail_model.dart'; +import 'package:recook/models/goods_hot_sell_list_model.dart'; import 'package:recook/models/goods_simple_list_model.dart'; import 'package:recook/models/promotion_goods_list_model.dart'; @@ -16,8 +17,6 @@ import 'package:recook/pages/home/classify/commodity_detail_page.dart'; import 'package:recook/pages/home/classify/mvp/goods_detail_model_impl.dart'; import 'package:recook/pages/home/promotion_time_tool.dart'; import 'package:recook/pages/seckill_activity/model/SeckillModel.dart'; -import 'package:recook/pages/seckill_activity/model/SeckillModel.dart'; -import 'package:recook/pages/seckill_activity/model/SeckillModel.dart'; import 'package:recook/utils/share_tool.dart'; import 'package:recook/utils/user_level_tool.dart'; import 'package:recook/widgets/custom_cache_image.dart'; @@ -69,6 +68,7 @@ class GoodsItemWidget extends StatelessWidget { final GifController gifController; final num gysId; final SeckillModel seckillModel; + final SecKill secKill; const GoodsItemWidget({ @@ -98,7 +98,7 @@ class GoodsItemWidget extends StatelessWidget { this.specialIcon, this.type, this.countryIcon, - this.living, this.gifController, this.gysId, this.seckillModel, + this.living, this.gifController, this.gysId, this.seckillModel, this.secKill, //this.special_sale, }) : widgetType = GoodsItemType.NONE, super(key: key); @@ -137,6 +137,8 @@ class GoodsItemWidget extends StatelessWidget { countryIcon = model.countryIcon, living = model.living, gysId = model.gysId, + secKill = model.secKill, + //secKill = model. super(key: key); ///Hot List @@ -152,7 +154,7 @@ class GoodsItemWidget extends StatelessWidget { this.specialSale, this.specialIcon, this.type, - this.living, this.gifController, this.gysId, this.seckillModel, + this.living, this.gifController, this.seckillModel, }) : goodsName = data.goodsName, brandName = data.brandName, brandPictureUrl = data.brandImg, @@ -172,6 +174,8 @@ class GoodsItemWidget extends StatelessWidget { widgetType = GoodsItemType.HOT_LIST, isImport = data.isImport, countryIcon = data.countryIcon, + gysId = data.gysId, + secKill = data.secKill, super(key: key); /// 活动列表 @@ -184,7 +188,7 @@ class GoodsItemWidget extends StatelessWidget { @required this.buyClick, PromotionGoodsModel model, this.notShowAmount = false, - this.type, this.gifController, this.gysId, this.seckillModel, + this.type, this.gifController, this.seckillModel, }) : goodsName = model.goodsName, brandName = model.brandName, brandPictureUrl = model.brandImg, @@ -205,6 +209,8 @@ class GoodsItemWidget extends StatelessWidget { specialIcon = model.specialIcon, countryIcon = model.countryIcon, living = model.living, + gysId = model.gysId, + secKill = model.secKill, super(key: key); //秒杀活动 @@ -220,7 +226,7 @@ class GoodsItemWidget extends StatelessWidget { this.notShowAmount = false, this.specialSale, - this.type, this.gifController,this.originalPrice, this.percent, this.coupon,this.isImport, this.specialIcon, this.promotionStatus, this.living, this.gysId, + this.type, this.gifController,this.originalPrice, this.percent, this.coupon,this.isImport, this.specialIcon, this.promotionStatus, this.living, this.gysId, this.secKill, //this.special_sale, }) : goodsName = model.goodsName, brandName = model.brandName, @@ -492,6 +498,26 @@ class GoodsItemWidget extends StatelessWidget { // } _image() { + bool sellout = false; + if(this.widgetType == GoodsItemType.SECKILL){ + if(this.salesVolume>=this.inventory){ + sellout = true; + }else{ + sellout = false; + } + }else{ + if(this.inventory>0){ + sellout = false; + }else{ + sellout = true; + } + if(this.secKill!=null){ + if(secKill.secKill==1){ + sellout = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + } + } + } double cir = 5; return Container( width: _height - 8, @@ -523,7 +549,7 @@ class GoodsItemWidget extends StatelessWidget { left: 0, bottom: 0, child: Offstage( - offstage: this.inventory > 0&&(this.salesVolume=this.inventory&&this.widgetType == GoodsItemType.SECKILL; - bool sellout = this.inventory <= 0; + // bool seckillout = this.salesVolume>=this.inventory&&(this.widgetType == GoodsItemType.SECKILL); + // bool sellout = this.inventory <= 0; + bool sellout = false; + bool isSeckill = false; + if(this.widgetType == GoodsItemType.SECKILL){ + if(this.seckillModel!=null){ + if(seckillModel.status==2){ + isSeckill = true;//秒杀页面的商品 非秒杀状态(2)的情况下 正常显示 + } + else{ + isSeckill = false; + } + } + if(this.salesVolume>=this.inventory){ + sellout = true; + }else{ + sellout = false; + } + }else{ + if(this.inventory>0){ + sellout = false; + }else{ + sellout = true; + } + if(this.secKill!=null){ + if(secKill.secKill==1){ + isSeckill = true; + sellout = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + } + } + } Color priceColor = Color(0xffc70404); return Container( height: 20 * 2.h, @@ -678,7 +734,7 @@ class GoodsItemWidget extends StatelessWidget { children: [ ExtendedText.rich(TextSpan(children: [ TextSpan( - text: widgetType == GoodsItemType.SECKILL? "秒杀 ¥ ": "券后 ¥ ", + text: isSeckill&&this.widgetType == GoodsItemType.SECKILL? "秒杀 ¥ ": isSeckill&&this.widgetType != GoodsItemType.SECKILL?'¥':"券后 ¥ ", style: AppTextStyle.generate(12 * 2.sp, color: priceColor, fontWeight: FontWeight.w500), ), @@ -698,7 +754,7 @@ class GoodsItemWidget extends StatelessWidget { width: 5, )), TextSpan( - text: widgetType == GoodsItemType.SECKILL?'':"¥${this.originalPrice.toStringAsFixed(0)}", + text: isSeckill?'':"¥${this.originalPrice.toStringAsFixed(0)}", style: TextStyle( decoration: TextDecoration.lineThrough, decorationColor: Color(0xff898989), @@ -708,7 +764,7 @@ class GoodsItemWidget extends StatelessWidget { ) ])), - AppConfig.getShowCommission()&&this.widgetType==GoodsItemType.SECKILL + AppConfig.getShowCommission()&&(isSeckill) ? Container( alignment: Alignment.center, child: Text( @@ -807,7 +863,7 @@ class GoodsItemWidget extends StatelessWidget { direction: Direction.horizontal, height: 21, //暂时隐藏 - title: sellout||seckillout ? "已售完" : "自购", + title: sellout?"已售完" : "自购", style: TextStyle( color: Colors.white, @@ -838,7 +894,7 @@ class GoodsItemWidget extends StatelessWidget { // bottomRight: Radius.circular(40)), backgroundColor: //暂时隐藏 - sellout||seckillout ? AppColor.greyColor : _shareTextColor, + sellout? AppColor.greyColor : _shareTextColor, pureDisplay: true, ), @@ -906,11 +962,34 @@ class GoodsItemWidget extends StatelessWidget { // } _saleNumberWidget() { + + bool isSeckill = false; + if(this.widgetType == GoodsItemType.SECKILL){ + if(this.seckillModel!=null){ + if(seckillModel.status==2){ + isSeckill = true;//秒杀页面的商品 非秒杀状态(2)的情况下 正常显示 + } + else{ + isSeckill = false; + } + } + + }else{ + if(this.secKill!=null){ + if(secKill.secKill==1){ + isSeckill = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + }else{ + isSeckill = false; + } + } + } return Container( child: Stack( children: [ Row( children: [ + isSeckill?SizedBox(): (this.coupon != null && this.coupon != 0) ? Container( margin: EdgeInsets.only(right: 5), @@ -920,7 +999,7 @@ class GoodsItemWidget extends StatelessWidget { ), ) : SizedBox(), - this.widgetType==GoodsItemType.SECKILL? + isSeckill? Container( child: Image.asset(R.ASSETS_SECKILL_ICON_PNG,width: 69.rw,height: 20.rw,), ): @@ -1037,15 +1116,34 @@ class GoodsItemWidget extends StatelessWidget { } _buyEvent() { - bool seckillout = this.salesVolume>=this.inventory&&this.widgetType == GoodsItemType.SECKILL; + bool sellout = false; + if(this.widgetType == GoodsItemType.SECKILL){ + if(this.salesVolume>=this.inventory){ + sellout = true; + }else{ + sellout = false; + } + }else{ + if(this.inventory>0){ + sellout = false; + }else{ + sellout = true; + } + if(this.secKill!=null){ + if(secKill.secKill==1){ + sellout = true; + //秒杀中 通过seckill中的库存和销量来判断是否是否售完 + } + } + } if (buyClick != null) { buyClick(); } else { AppRouter.push(buildCtx, RouteName.COMMODITY_PAGE, arguments: CommodityDetailPage.setArguments( this.id, - gysId: gysId, - seckillout:seckillout + + seckillout:sellout // liveStatus: living == null ? null : living.status, // roomId: living == null ? null : living.roomId ));