From a3e9cd2a8a1f5e7981aa99d311f13fa12d0ddafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Fri, 27 Aug 2021 09:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/goods_detail_model.dart | 55 ++++++------ lib/models/goods_detail_model.g.dart | 4 +- .../goods/goods_report/goods_report_page.dart | 88 ++++++++++--------- .../goods_report_widget_page.dart | 4 +- .../goods_report/widget/bar_table_widget.dart | 14 +-- .../goods/report_form/report_form_widget.dart | 55 +----------- .../home/classify/commodity_detail_page.dart | 6 +- lib/pages/home/classify/goods_page.dart | 19 ++-- .../home/widget/goods_image_page_view.dart | 62 +++++++++---- lib/widgets/goods_item.dart | 5 +- .../live_animate_widget.dart | 9 +- 11 files changed, 149 insertions(+), 172 deletions(-) diff --git a/lib/models/goods_detail_model.dart b/lib/models/goods_detail_model.dart index 87764b8..a6daf53 100644 --- a/lib/models/goods_detail_model.dart +++ b/lib/models/goods_detail_model.dart @@ -6,6 +6,8 @@ import 'package:recook/constants/header.dart'; import 'package:recook/models/base_model.dart'; import 'package:recook/models/price_model.dart'; +import 'goods_simple_list_model.dart'; + part 'goods_detail_model.g.dart'; /* @@ -173,34 +175,35 @@ class Data extends Object { num isFerme; num storehouse; String countryIcon; + Living living; Data( - this.id, - this.brandId, - this.goodsName, - this.description, - this.firstCategoryId, - this.secondCategoryId, - this.inventory, - this.salesVolume, - this.price, - this.video, - this.mainPhotos, - this.attributes, - this.sku, - this.promotion, - this.brand, - this.evaluations, - this.coupons, - this.isFavorite, - this.shoppingTrolleyCount, - this.recommends, - this.isImport, - this.isFerme, - this.storehouse, - this.notice, - this.countryIcon - ); + this.id, + this.brandId, + this.goodsName, + this.description, + this.firstCategoryId, + this.secondCategoryId, + this.inventory, + this.salesVolume, + this.price, + this.video, + this.mainPhotos, + this.attributes, + this.sku, + this.promotion, + this.brand, + this.evaluations, + this.coupons, + this.isFavorite, + this.shoppingTrolleyCount, + this.recommends, + this.isImport, + this.isFerme, + this.storehouse, + this.notice, + this.countryIcon, + this.living); factory Data.fromJson(Map srcJson) => _$DataFromJson(srcJson); diff --git a/lib/models/goods_detail_model.g.dart b/lib/models/goods_detail_model.g.dart index 5894eb2..06c748a 100644 --- a/lib/models/goods_detail_model.g.dart +++ b/lib/models/goods_detail_model.g.dart @@ -75,6 +75,7 @@ Data _$DataFromJson(Map json) { ? null : Notice.fromJson(json['notice'] as Map), json['country_icon'], + json['living'] == null ? null : new Living.fromJson(json['living']), ); } @@ -98,7 +99,8 @@ Map _$DataToJson(Data instance) => { 'coupons': instance.coupons, 'isFavorite': instance.isFavorite, 'shoppingTrolleyCount': instance.shoppingTrolleyCount, - 'country_icon':instance.countryIcon, + 'country_icon': instance.countryIcon, + 'living': instance.living, }; MainPhotos _$MainPhotosFromJson(Map json) { diff --git a/lib/pages/goods/goods_report/goods_report_page.dart b/lib/pages/goods/goods_report/goods_report_page.dart index 7dc4903..3b0a01d 100644 --- a/lib/pages/goods/goods_report/goods_report_page.dart +++ b/lib/pages/goods/goods_report/goods_report_page.dart @@ -73,53 +73,59 @@ class _GoodsReportPageState extends State width: double.infinity, margin: EdgeInsets.only(top: 10.rw), padding: EdgeInsets.only(top: 10.rw), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(6.rw))), child: (Column( children: [ - Row( - children: [ - Container( - width: 3.rw, - height: 15.rw, - color: Color(0xFF5484D8), - ), - 20.wb, - Text('产品报表', - style: TextStyle( - color: Color(0xFF333333), - fontSize: 16.rsp, - fontWeight: FontWeight.bold)), - ], - ), - 30.hb, Container( - height: 30.rw, - width: double.infinity, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.rw)), - color: Color(0xFFD5D5D5)), - alignment: Alignment.center, + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(6.rw))), + child: Column( + children: [ + Row( + children: [ + Container( + width: 3.rw, + height: 15.rw, + color: Color(0xFF5484D8), + ), + 20.wb, + Text('产品报表', + style: TextStyle( + color: Color(0xFF333333), + fontSize: 16.rsp, + fontWeight: FontWeight.bold)), + ], + ), + 30.hb, + Container( + height: 30.rw, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.rw)), + color: Color(0xFFD5D5D5)), + alignment: Alignment.center, - // width: DeviceInfo.screenWidth, - child: TabBar( - onTap: (index) { - _tabController.index = index; - setState(() {}); - }, - //isScrollable: , + // width: DeviceInfo.screenWidth, + child: TabBar( + onTap: (index) { + _tabController.index = index; + setState(() {}); + }, + //isScrollable: , - labelPadding: EdgeInsets.all(0), - controller: _tabController, - indicator: const BoxDecoration(), - indicatorWeight: 0, - unselectedLabelColor: Colors.black54, - labelStyle: TextStyle(color: Colors.black54), - tabs: _tabList.map((item) { - int index = _tabList.indexOf(item); - return _tabItem(item, index); - }).toList()), + labelPadding: EdgeInsets.all(0), + controller: _tabController, + indicator: const BoxDecoration(), + indicatorWeight: 0, + unselectedLabelColor: Colors.black54, + labelStyle: TextStyle(color: Colors.black54), + tabs: _tabList.map((item) { + int index = _tabList.indexOf(item); + return _tabItem(item, index); + }).toList()), + ), + ], + ), ), Expanded( child: TabBarView( diff --git a/lib/pages/goods/goods_report/goods_report_widget_page.dart b/lib/pages/goods/goods_report/goods_report_widget_page.dart index cad7138..12e9407 100644 --- a/lib/pages/goods/goods_report/goods_report_widget_page.dart +++ b/lib/pages/goods/goods_report/goods_report_widget_page.dart @@ -243,7 +243,7 @@ class _GoodsReportWidgetPageState extends State color: Color(0xFF2C5EB3), aspectRato: 0.3, aboveStrokeWidth: 5.rw), - 30.hb, + 40.hb, Text( '男', style: TextStyle( @@ -260,7 +260,7 @@ class _GoodsReportWidgetPageState extends State color: Color(0xFFC31B20), aspectRato: 0.7, aboveStrokeWidth: 5.rw), - 30.hb, + 40.hb, Text( '女', style: TextStyle( diff --git a/lib/pages/goods/goods_report/widget/bar_table_widget.dart b/lib/pages/goods/goods_report/widget/bar_table_widget.dart index d971e92..dac0320 100644 --- a/lib/pages/goods/goods_report/widget/bar_table_widget.dart +++ b/lib/pages/goods/goods_report/widget/bar_table_widget.dart @@ -18,14 +18,6 @@ class BarTableWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text( - '本周', - style: TextStyle( - color: Color(0xFF333333), - fontSize: 16, - ), - textAlign: TextAlign.center, - ), SizedBox( height: 4, ), @@ -98,7 +90,7 @@ class BarTableWidgetState extends State { ), leftTitles: SideTitles( showTitles: true, - interval: 200,//换成计算值 + interval: 200, //换成计算值 getTextStyles: (context, value) => const TextStyle( color: Color( 0xff939393, @@ -109,7 +101,7 @@ class BarTableWidgetState extends State { ), gridData: FlGridData( show: true, - checkToShowHorizontalLine: (value) => value % 200 == 0,//换成计算值 + checkToShowHorizontalLine: (value) => value % 200 == 0, //换成计算值 getDrawingHorizontalLine: (value) => FlLine( color: const Color(0xffe7e8ec), strokeWidth: 1, @@ -151,6 +143,4 @@ class BarTableWidgetState extends State { ], ); } - - } diff --git a/lib/pages/goods/report_form/report_form_widget.dart b/lib/pages/goods/report_form/report_form_widget.dart index 9cba05a..43b2cbd 100644 --- a/lib/pages/goods/report_form/report_form_widget.dart +++ b/lib/pages/goods/report_form/report_form_widget.dart @@ -51,49 +51,6 @@ class _ReportFormWidgetPagePageState extends State _buildListView() { return ListView( children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10.rw), - padding: EdgeInsets.only(top: 10.rw), - height: 470.rw, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(6.rw))), - child: (Column( - children: [ - Row( - children: [ - Container( - width: 3.rw, - height: 15.rw, - color: Color(0xFF5484D8), - ), - 20.wb, - Text('产品参数', - style: TextStyle( - color: Color(0xFF333333), - fontSize: 16.rsp, - fontWeight: FontWeight.bold)), - ], - ), - 40.hb, - _buildParameterText('品牌', '作家有出', '名称', '30cm多功能低压炒锅'), - _buildParameterText('净重', '约2.54kg', '材质', '铝合金基材,玻璃,硅胶,傲视不锈钢'), - _buildParameterText('尺寸', '约30cm*9.5cm', '适合炉灶', '通用'), - 50.hb, - Container( - width: double.infinity, - height: 200.rw, - alignment: Alignment.center, - child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG, - image: Api.getImgUrl('/photo/15961790346127.png'), - height: 200.rw, - width: 200.rw, - ), - ) - ], - ))), Container( width: double.infinity, height: 320.rw, @@ -112,7 +69,7 @@ class _ReportFormWidgetPagePageState extends State color: Color(0xFF5484D8), ), 20.wb, - Text('累计销量', + Text('类目', style: TextStyle( color: Color(0xFF333333), fontSize: 16.rsp, @@ -161,16 +118,6 @@ class _ReportFormWidgetPagePageState extends State child: BarTableWidget(), ), 40.hb, - Text('地图分布', - style: TextStyle( - color: Color(0xFF333333), - fontSize: 16.rsp, - fontWeight: FontWeight.bold)), - Container( - width: double.infinity, - padding: EdgeInsets.only(left: 15.rw), - height: 300.rw, - child: MapWidget()), ], ))), Container( diff --git a/lib/pages/home/classify/commodity_detail_page.dart b/lib/pages/home/classify/commodity_detail_page.dart index e4dd205..fdba0e8 100644 --- a/lib/pages/home/classify/commodity_detail_page.dart +++ b/lib/pages/home/classify/commodity_detail_page.dart @@ -149,10 +149,8 @@ class _CommodityDetailPageState extends BaseStoreState controller: _tabController, children: [ GoodsPage( - liveStatus:_liveStatus, - roomId:_roomId, - isLive: widget.isLive, - liveId: widget.liveId, + liveStatus: _liveStatus, + roomId: _roomId, openbrandList: () { // _goodsDetail.data.brandId; AppRouter.push( diff --git a/lib/pages/home/classify/goods_page.dart b/lib/pages/home/classify/goods_page.dart index 899501e..60dda46 100644 --- a/lib/pages/home/classify/goods_page.dart +++ b/lib/pages/home/classify/goods_page.dart @@ -70,8 +70,8 @@ class GoodsPage extends StatefulWidget { final ValueNotifier openSkuChoosePage; final void Function() openbrandList; //打开商家页面 - final bool isLive; - final int liveId; + // final bool isLive; + // final int liveId; final int liveStatus; final int roomId; @@ -82,8 +82,9 @@ class GoodsPage extends StatefulWidget { this.openSkuChoosePage, this.goodsDetail, this.openbrandList, - this.isLive = false, - this.liveId = 0, this.liveStatus, this.roomId, + // this.isLive = false, + // this.liveId = 0, + this.liveStatus, this.roomId, }) : super(key: key); @override @@ -425,7 +426,7 @@ class _GoodsPageState extends BaseStoreState { // images.add(widget.goodsDetail.data.video); // } images.addAll(widget.goodsDetail.data.mainPhotos); - return ImagePageView(images: images,liveStatus:widget.liveStatus,roomId:widget.roomId,onScrolled: (index) {}); + return ImagePageView(images: images,living:widget.goodsDetail.data.living,onScrolled: (index) {}); } /// 优惠券 规格等 @@ -1363,16 +1364,14 @@ class _GoodsPageState extends BaseStoreState { } if (skuModel.selectedIndex == 1) { ReToast.loading(text: ''); - if (widget.liveId != 0) + if (widget.goodsDetail.data.living.status != 0||widget.goodsDetail.data.living.roomId!=0) HttpManager.post(LiveAPI.buyGoodsInform, { - "liveItemId": widget.liveId, + "liveItemId":widget.goodsDetail.data.living.roomId, "goodsId": widget.goodsId, }); _createOrder( skuModel, context, - isLive: widget.isLive, - liveId: widget.liveId, ); return; } else { @@ -1430,7 +1429,7 @@ class _GoodsPageState extends BaseStoreState { skuModel.sku.id, skuModel.des, skuModel.num, - liveId: isLive ? liveId : null, + // liveId: isLive ? liveId : null, ); if (order.code != HttpStatus.SUCCESS) { // Toast.showError(order.msg); diff --git a/lib/pages/home/widget/goods_image_page_view.dart b/lib/pages/home/widget/goods_image_page_view.dart index 1c4c12f..51a2b76 100644 --- a/lib/pages/home/widget/goods_image_page_view.dart +++ b/lib/pages/home/widget/goods_image_page_view.dart @@ -12,10 +12,12 @@ import 'package:get/get.dart'; import 'package:recook/constants/api.dart'; import 'package:recook/constants/header.dart'; import 'package:recook/models/goods_detail_model.dart'; +import 'package:recook/models/goods_simple_list_model.dart'; import 'package:recook/pages/live/live_stream/live_stream_view_page.dart'; import 'package:recook/widgets/custom_cache_image.dart'; import 'package:recook/widgets/pic_swiper.dart'; import 'package:recook/widgets/seckill_activity_widget/live_animate_widget.dart'; +import 'package:recook/widgets/toast.dart'; import 'package:recook/widgets/video_view.dart'; typedef OnScrolledListener = Function(int index); @@ -24,16 +26,15 @@ class ImagePageView extends StatefulWidget { final OnScrolledListener onScrolled; final List images; - final int liveStatus; - final int roomId; + final Living living; + // final Video video; ImagePageView({ Key key, this.onScrolled, this.images, - this.liveStatus, - this.roomId, + this.living, }) : assert(images != null && images.length > 0, "images 不能为空"); @override @@ -122,14 +123,20 @@ class _ImagePageViewState extends State { BorderRadius.horizontal(left: Radius.circular(20))), child: _imageCount(), )), - widget.liveStatus == 1 + widget.living.status == 1 ? Positioned( - top: 32.rw, + top: 60.rw, right: 35.rw, - child: GestureDetector( - onTap: () { - Get.to(LiveStreamViewPage(id: widget.roomId)); - }, + child: InkWell( + onTap: widget.living.roomId != 0 + ? () { + Get.to( + LiveStreamViewPage(id: widget.living.roomId)); + } + : () { + Toast.showError('找不到该直播间!'); + print('1'); + }, child: Container( width: 50.rw, height: 69.rw, @@ -138,19 +145,20 @@ class _ImagePageViewState extends State { color: Colors.white), child: Column( children: [ - 5.hb, + 10.hb, Container( - width: 40.rw, - height: 40.rw, + width: 35.rw, + height: 35.rw, + alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFFFF0000), borderRadius: BorderRadius.all(Radius.circular(40.rw))), child: LiveAnimateWidget( - size: 80.w, + size: 50.w, ), ), - 5.hb, + 10.hb, Text( '直播中', style: TextStyle( @@ -162,6 +170,30 @@ class _ImagePageViewState extends State { ), ) : SizedBox(), + widget.living.status == 1 + ? Positioned( + top: 50.rw, + right: 35.rw, + child: InkWell( + onTap: widget.living.roomId != 0 + ? () { + Get.to( + LiveStreamViewPage(id: widget.living.roomId)); + } + : () { + Toast.showError('找不到该直播间!'); + print('2'); + }, + child: Container( + width: 60.rw, + height: 70.rw, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(7.rw)), + color: Colors.transparent), + ), + ), + ) + : SizedBox(), ]), ), ); diff --git a/lib/widgets/goods_item.dart b/lib/widgets/goods_item.dart index debc7a2..17d8a7e 100644 --- a/lib/widgets/goods_item.dart +++ b/lib/widgets/goods_item.dart @@ -924,8 +924,9 @@ class GoodsItemWidget extends StatelessWidget { } else { AppRouter.push(buildCtx, RouteName.COMMODITY_PAGE, arguments: CommodityDetailPage.setArguments(this.id, - liveStatus: living == null ? null : living.status, - roomId: living == null ? null : living.roomId)); + // liveStatus: living == null ? null : living.status, + // roomId: living == null ? null : living.roomId + )); } } diff --git a/lib/widgets/seckill_activity_widget/live_animate_widget.dart b/lib/widgets/seckill_activity_widget/live_animate_widget.dart index 7c3f9f1..3b5d196 100644 --- a/lib/widgets/seckill_activity_widget/live_animate_widget.dart +++ b/lib/widgets/seckill_activity_widget/live_animate_widget.dart @@ -20,11 +20,10 @@ class _LiveAnimateWidgetState extends State { return Container( width: widget.size ?? 50.w, height: widget.size ?? 50.w, - color: Colors.transparent, - // decoration: BoxDecoration( - // color: Colors.red, - // borderRadius: BorderRadius.circular((widget.size ?? 50.w) / 2), - // ), + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular((widget.size ?? 50.w) / 2), + ), child: Row( children: [ LiveAnimate(