From 1e10ea6a351ad89fe42d4d3d65c2bda3c4838ca9 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 8 Jan 2022 13:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E5=9B=A2=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/data/activity_details.dart | 526 ++++++++++ lib/retrofit/min_api.dart | 18 +- lib/retrofit/min_api.g.dart | 46 +- lib/retrofit/retrofit_api.dart | 8 +- lib/retrofit/retrofit_api.g.dart | 2 +- .../shopping/activity_prefecture_details.dart | 105 +- .../shopping/shopping_goods_details.dart | 960 +++++++++++------- 7 files changed, 1190 insertions(+), 475 deletions(-) create mode 100644 lib/retrofit/data/activity_details.dart diff --git a/lib/retrofit/data/activity_details.dart b/lib/retrofit/data/activity_details.dart new file mode 100644 index 00000000..458727ed --- /dev/null +++ b/lib/retrofit/data/activity_details.dart @@ -0,0 +1,526 @@ +/// actProduct : {"id":"1479377402042777600","createTime":"2022-01-07 17:00:33","createUser":"1364043181062094848","updateTime":"2022-01-07 17:00:33","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1479377328797646848","timeId":"1479377329099636736","productId":"1460886580993458176","productName":"无花果礼盒","productImg":"https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png","productPrice":"88.00","promotionPrice":"88.00","productStock":0,"sellCount":0,"skuJson":[{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}],"isDelete":0} +/// actRecordAndJoinlDTOList : [{"actRecord":{"id":"1479399513473941504","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1478548720785031168","joinNum":0,"startTime":"2022-01-07 18:28:25","endTime":"2022-01-08 16:28:25","state":2,"isDelete":0},"actRecordJoinList":[{"id":"1479399514073726976","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479399513473941504","mid":"1478548720785031168","orderId":"1479399514677706752","isLeader":true,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}]},{"actRecord":{"id":"1479401111025614848","createTime":"2022-01-07 18:34:45","createUser":"1468903135782109184","updateTime":"2022-01-07 18:34:45","updateUser":"1468903135782109184","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1468903135782109184","joinNum":0,"startTime":"2022-01-07 18:34:45","endTime":"2022-01-08 16:34:45","state":2,"isDelete":0},"actRecordJoinList":[{"id":"1479401111688314880","createTime":"2022-01-07 18:34:46","createUser":"1468903135782109184","updateTime":"2022-01-07 18:34:46","updateUser":"1468903135782109184","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479401111025614848","mid":"1468903135782109184","orderId":"1479401112292294656","isLeader":true,"memberAvatar":"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg","memberNickname":"哈哈哈","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}]}] + +class ActivityDetails { + ActivityDetails({ + ActProduct actProduct, + List actRecordAndJoinlDTOList,}){ + _actProduct = actProduct; + _actRecordAndJoinlDTOList = actRecordAndJoinlDTOList; +} + + ActivityDetails.fromJson(dynamic json) { + _actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null; + if (json['actRecordAndJoinlDTOList'] != null) { + _actRecordAndJoinlDTOList = []; + json['actRecordAndJoinlDTOList'].forEach((v) { + _actRecordAndJoinlDTOList.add(ActRecordAndJoinlDTOList.fromJson(v)); + }); + } + } + ActProduct _actProduct; + List _actRecordAndJoinlDTOList; + + ActProduct get actProduct => _actProduct; + List get actRecordAndJoinlDTOList => _actRecordAndJoinlDTOList; + + Map toJson() { + final map = {}; + if (_actProduct != null) { + map['actProduct'] = _actProduct.toJson(); + } + if (_actRecordAndJoinlDTOList != null) { + map['actRecordAndJoinlDTOList'] = _actRecordAndJoinlDTOList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// actRecord : {"id":"1479399513473941504","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402042777600","mid":"1478548720785031168","joinNum":0,"startTime":"2022-01-07 18:28:25","endTime":"2022-01-08 16:28:25","state":2,"isDelete":0} +/// actRecordJoinList : [{"id":"1479399514073726976","createTime":"2022-01-07 18:28:25","createUser":"1478548720785031168","updateTime":"2022-01-07 18:28:25","updateUser":"1478548720785031168","storeId":"1460885296764682240","actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1479399513473941504","mid":"1478548720785031168","orderId":"1479399514677706752","isLeader":true,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402042777600","actPrice":"88.00","state":false,"isDelete":0}] + +class ActRecordAndJoinlDTOList { + ActRecordAndJoinlDTOList({ + ActRecord actRecord, + List actRecordJoinList,}){ + _actRecord = actRecord; + _actRecordJoinList = actRecordJoinList; +} + + ActRecordAndJoinlDTOList.fromJson(dynamic json) { + _actRecord = json['actRecord'] != null ? ActRecord.fromJson(json['actRecord']) : null; + if (json['actRecordJoinList'] != null) { + _actRecordJoinList = []; + json['actRecordJoinList'].forEach((v) { + _actRecordJoinList.add(ActRecordJoinList.fromJson(v)); + }); + } + } + ActRecord _actRecord; + List _actRecordJoinList; + + ActRecord get actRecord => _actRecord; + List get actRecordJoinList => _actRecordJoinList; + + Map toJson() { + final map = {}; + if (_actRecord != null) { + map['actRecord'] = _actRecord.toJson(); + } + if (_actRecordJoinList != null) { + map['actRecordJoinList'] = _actRecordJoinList.map((v) => v.toJson()).toList(); + } + return map; + } + +} + +/// id : "1479399514073726976" +/// createTime : "2022-01-07 18:28:25" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-07 18:28:25" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actRecordId : "1479399513473941504" +/// mid : "1478548720785031168" +/// orderId : "1479399514677706752" +/// isLeader : true +/// memberAvatar : "" +/// memberNickname : "斯基" +/// productId : "1479377402042777600" +/// actPrice : "88.00" +/// state : false +/// isDelete : 0 + +class ActRecordJoinList { + ActRecordJoinList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String actTemplateId, + String actTimeId, + String actRecordId, + String mid, + String orderId, + bool isLeader, + String memberAvatar, + String memberNickname, + String productId, + String actPrice, + bool state, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actRecordId = actRecordId; + _mid = mid; + _orderId = orderId; + _isLeader = isLeader; + _memberAvatar = memberAvatar; + _memberNickname = memberNickname; + _productId = productId; + _actPrice = actPrice; + _state = state; + _isDelete = isDelete; +} + + ActRecordJoinList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actRecordId = json['actRecordId']; + _mid = json['mid']; + _orderId = json['orderId']; + _isLeader = json['isLeader']; + _memberAvatar = json['memberAvatar']; + _memberNickname = json['memberNickname']; + _productId = json['productId']; + _actPrice = json['actPrice']; + _state = json['state']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _actTemplateId; + String _actTimeId; + String _actRecordId; + String _mid; + String _orderId; + bool _isLeader; + String _memberAvatar; + String _memberNickname; + String _productId; + String _actPrice; + bool _state; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get actTemplateId => _actTemplateId; + String get actTimeId => _actTimeId; + String get actRecordId => _actRecordId; + String get mid => _mid; + String get orderId => _orderId; + bool get isLeader => _isLeader; + String get memberAvatar => _memberAvatar; + String get memberNickname => _memberNickname; + String get productId => _productId; + String get actPrice => _actPrice; + bool get state => _state; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actRecordId'] = _actRecordId; + map['mid'] = _mid; + map['orderId'] = _orderId; + map['isLeader'] = _isLeader; + map['memberAvatar'] = _memberAvatar; + map['memberNickname'] = _memberNickname; + map['productId'] = _productId; + map['actPrice'] = _actPrice; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + +} + +/// id : "1479399513473941504" +/// createTime : "2022-01-07 18:28:25" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-07 18:28:25" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// type : 1 +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actProductId : "1479377402042777600" +/// mid : "1478548720785031168" +/// joinNum : 0 +/// startTime : "2022-01-07 18:28:25" +/// endTime : "2022-01-08 16:28:25" +/// state : 2 +/// isDelete : 0 + +class ActRecord { + ActRecord({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + String actTemplateId, + String actTimeId, + String actProductId, + String mid, + int joinNum, + String startTime, + String endTime, + int state, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _type = type; + _actTemplateId = actTemplateId; + _actTimeId = actTimeId; + _actProductId = actProductId; + _mid = mid; + _joinNum = joinNum; + _startTime = startTime; + _endTime = endTime; + _state = state; + _isDelete = isDelete; +} + + ActRecord.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _type = json['type']; + _actTemplateId = json['actTemplateId']; + _actTimeId = json['actTimeId']; + _actProductId = json['actProductId']; + _mid = json['mid']; + _joinNum = json['joinNum']; + _startTime = json['startTime']; + _endTime = json['endTime']; + _state = json['state']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + int _type; + String _actTemplateId; + String _actTimeId; + String _actProductId; + String _mid; + int _joinNum; + String _startTime; + String _endTime; + int _state; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + int get type => _type; + String get actTemplateId => _actTemplateId; + String get actTimeId => _actTimeId; + String get actProductId => _actProductId; + String get mid => _mid; + int get joinNum => _joinNum; + String get startTime => _startTime; + String get endTime => _endTime; + int get state => _state; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['type'] = _type; + map['actTemplateId'] = _actTemplateId; + map['actTimeId'] = _actTimeId; + map['actProductId'] = _actProductId; + map['mid'] = _mid; + map['joinNum'] = _joinNum; + map['startTime'] = _startTime; + map['endTime'] = _endTime; + map['state'] = _state; + map['isDelete'] = _isDelete; + return map; + } + +} + +/// id : "1479377402042777600" +/// createTime : "2022-01-07 17:00:33" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-07 17:00:33" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1479377328797646848" +/// timeId : "1479377329099636736" +/// productId : "1460886580993458176" +/// productName : "无花果礼盒" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png" +/// productPrice : "88.00" +/// promotionPrice : "88.00" +/// productStock : 0 +/// sellCount : 0 +/// skuJson : [{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}] +/// isDelete : 0 + +class ActProduct { + ActProduct({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + String templateId, + String timeId, + String productId, + String productName, + String productImg, + String productPrice, + String promotionPrice, + int productStock, + int sellCount, + List skuJson, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _storeId = storeId; + _templateId = templateId; + _timeId = timeId; + _productId = productId; + _productName = productName; + _productImg = productImg; + _productPrice = productPrice; + _promotionPrice = promotionPrice; + _productStock = productStock; + _sellCount = sellCount; + _skuJson = skuJson; + _isDelete = isDelete; +} + + ActProduct.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _storeId = json['storeId']; + _templateId = json['templateId']; + _timeId = json['timeId']; + _productId = json['productId']; + _productName = json['productName']; + _productImg = json['productImg']; + _productPrice = json['productPrice']; + _promotionPrice = json['promotionPrice']; + _productStock = json['productStock']; + _sellCount = json['sellCount']; + if (json['skuJson'] != null) { + _skuJson = []; + json['skuJson'].forEach((v) { + _skuJson.add(SkuJson.fromJson(v)); + }); + } + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _storeId; + String _templateId; + String _timeId; + String _productId; + String _productName; + String _productImg; + String _productPrice; + String _promotionPrice; + int _productStock; + int _sellCount; + List _skuJson; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get storeId => _storeId; + String get templateId => _templateId; + String get timeId => _timeId; + String get productId => _productId; + String get productName => _productName; + String get productImg => _productImg; + String get productPrice => _productPrice; + String get promotionPrice => _promotionPrice; + int get productStock => _productStock; + int get sellCount => _sellCount; + List get skuJson => _skuJson; + int get isDelete => _isDelete; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['storeId'] = _storeId; + map['templateId'] = _templateId; + map['timeId'] = _timeId; + map['productId'] = _productId; + map['productName'] = _productName; + map['productImg'] = _productImg; + map['productPrice'] = _productPrice; + map['promotionPrice'] = _promotionPrice; + map['productStock'] = _productStock; + map['sellCount'] = _sellCount; + if (_skuJson != null) { + map['skuJson'] = _skuJson.map((v) => v.toJson()).toList(); + } + map['isDelete'] = _isDelete; + return map; + } + +} + +/// skuId : "1460886581089927168" +/// skuPrice : 88 +/// skuStock : 0 + +class SkuJson { + SkuJson({ + String skuId, + int skuPrice, + int skuStock,}){ + _skuId = skuId; + _skuPrice = skuPrice; + _skuStock = skuStock; +} + + SkuJson.fromJson(dynamic json) { + _skuId = json['skuId']; + _skuPrice = json['skuPrice']; + _skuStock = json['skuStock']; + } + String _skuId; + int _skuPrice; + int _skuStock; + + String get skuId => _skuId; + int get skuPrice => _skuPrice; + int get skuStock => _skuStock; + + Map toJson() { + final map = {}; + map['skuId'] = _skuId; + map['skuPrice'] = _skuPrice; + map['skuStock'] = _skuStock; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index c0529855..395dca09 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -15,6 +15,7 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; import 'data/activity_area_list.dart'; +import 'data/activity_details.dart'; import 'data/findMiNiGroupList.dart'; import 'data/home_recommend_list.dart'; import 'data/miNiDetail.dart'; @@ -31,14 +32,14 @@ part 'min_api.g.dart'; // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 -const base_url = "http://192.168.10.236:8765/app/";///费韬 -const baseUrl = "http://192.168.10.236:8765/app/";///费韬 +// const base_url = "http://192.168.10.236:8765/app/";///费韬 +// const baseUrl = "http://192.168.10.236:8765/app/";///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.142:8765/app/";///詹云久 -// const baseUrl = "http://192.168.10.142:8765/app/";///詹云久 +const base_url = "http://192.168.10.142:8765/app/";///詹云久 +const baseUrl = "http://192.168.10.142:8765/app/";///詹云久 ///调用小程序的接口 @RestApi(baseUrl: baseUrl) @@ -219,10 +220,11 @@ abstract class MinApiService { Future> findActListByType(@Path("allDay") bool allDay, @Path("type") String type); - // /// APP、小程序点击查看活动列表的某一个活动详情 - // @GET("actTemplate/viewProduct?actProductId={actProductId}&type={type}") - // Future>> viewProduct(); - // + /// APP、小程序点击查看活动列表的某一个活动详情 + @GET("actTemplate/viewProduct?actProductId={actProductId}&type={type}") + Future> viewProduct(@Path("actProductId") String actProductId, + @Path("type") String type); + // /// 活动付款 // @POST("actTemplate/actPay") // Future actPay(@Body() Map param); diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 9ebb97e8..ec4190d2 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -9,7 +9,7 @@ part of 'min_api.dart'; class _MinApiService implements MinApiService { _MinApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8765/app/'; + baseUrl ??= 'http://192.168.10.142:8765/app/'; } final Dio _dio; @@ -465,27 +465,27 @@ class _MinApiService implements MinApiService { return value; } - // @override - // Future> viewProduct (actProductId,type) async { - // ArgumentError.checkNotNull(actProductId, 'actProductId'); - // ArgumentError.checkNotNull(type, 'type'); - // const _extra = {}; - // final queryParameters = {}; - // final _data = {}; - // final _result = await _dio.request>( - // 'actTemplate/viewProduct?actProductId=$actProductId&type=$type', - // queryParameters: queryParameters, - // options: RequestOptions( - // method: 'GET', - // headers: {}, - // extra: _extra, - // baseUrl: baseUrl), - // data: _data); - // final value = BaseData.fromJson( - // _result.data, - // (json) => ActivityAreaList.fromJson(json), - // ); - // return value; - // } + @override + Future> viewProduct(actProductId,type) async { + ArgumentError.checkNotNull(actProductId, 'actProductId'); + ArgumentError.checkNotNull(type, 'type'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'actTemplate/viewProduct?actProductId=$actProductId&type=$type', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityDetails.fromJson(json), + ); + return value; + } } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 61080c22..9a42e5ed 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -60,15 +60,15 @@ part 'retrofit_api.g.dart'; // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.142:8766/app/";///詹云久 -// const baseUrl = "http://192.168.10.142:8766/app/";///詹云久 +const base_url = "http://192.168.10.142:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.142:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 1eb48e20..0adf7d45 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8766/app/'; + baseUrl ??= 'http://192.168.10.142:8766/app/'; } final Dio _dio; diff --git a/lib/store/shopping/activity_prefecture_details.dart b/lib/store/shopping/activity_prefecture_details.dart index 899c9b07..bb921b3c 100644 --- a/lib/store/shopping/activity_prefecture_details.dart +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -68,16 +68,20 @@ class _ActivityPrefectureDetails extends State { void initState() { super.initState(); _scrollController = ScrollController(); - _scrollController.addListener(() { - setState(() { - if (_scrollController.offset < - (325.h - MediaQuery.of(context).padding.top)) { - _scrollPhysics = NeverScrollableScrollPhysics(); - } else { - _scrollPhysics = BouncingScrollPhysics(); - } + if(pageType != "2"){ + _scrollPhysics = BouncingScrollPhysics(); + }else{ + _scrollController.addListener(() { + setState(() { + if (_scrollController.offset < + (325.h - MediaQuery.of(context).padding.top)) { + _scrollPhysics = NeverScrollableScrollPhysics(); + } else { + _scrollPhysics = BouncingScrollPhysics(); + } + }); }); - }); + } pageType = widget.arguments["type"]; storeId = widget.arguments["storeId"]; @@ -201,6 +205,7 @@ class _ActivityPrefectureDetails extends State { _timer = Timer.periodic(oneSec, callback); } + @override Widget build(BuildContext context) { return Container( @@ -585,50 +590,62 @@ class _ActivityPrefectureDetails extends State { ///秒杀列表 Widget seckilList() { - return Container( + return (pageType == "2")?Container( height: MediaQuery.of(context).size.height - 62.h - MediaQuery.of(context).padding.top, padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), color: Colors.white, - child: productList.length == 0 + child: seckilListChild(), + ):Container( + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + color: Colors.white, + child: seckilListChild(), + ); + } + + Widget seckilListChild() { + return productList.length == 0 ? Container( - width: double.infinity, - alignment: Alignment.topCenter, - child: Text( - "暂无商品参与活动", - style: TextStyle( - fontSize: 18.sp, - fontWeight: MyFontWeight.medium, - color: Colors.black, - ), - ), - ) + width: double.infinity, + alignment: Alignment.topCenter, + child: Text( + "暂无商品参与活动", + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + ) : ListView.builder( - padding: EdgeInsets.zero, - itemCount: productList?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: _scrollPhysics, - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - Navigator.of(context).pushNamed( - '/router/shopping_goods_details', - arguments: { - "id": productList[position].id, - "storeId": storeId, - "tenant": tenant, - }, - ); - }); + padding: EdgeInsets.zero, + itemCount: productList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: _scrollPhysics, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pushNamed( + '/router/shopping_goods_details', + arguments: { + "actProductId": productList[position].id, + "type":pageType, + "storeId": storeId, + "tenant": tenant, + "limitNumber":actTemplate.limitNumber, + "limitTime":actTemplate.limitTime, + "bannerImg":actTemplate.bannerImg }, - child: seckilItem(productList[position]), ); - }, - ), - ); + }); + }, + child: seckilItem(productList[position]), + ); + }, + ); } int timeFlag(String time) { diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index 77f86c7d..af15bcaa 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -10,6 +10,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; +import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/goods.dart'; @@ -23,6 +24,7 @@ import 'package:huixiang/store/store_view/product_sku.dart'; import 'package:huixiang/store/store_view/store_order_list.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -62,6 +64,13 @@ class _ShoppingGoodsDetails extends State { int numberOfPeople = 0; List activitys; ProductSkuVOListBean productSku; + String actProductId; + String pageType = "1"; + ActivityDetails activityDetails; + int limitNumber = 0; + int limitTime = 0; + String bannerImg; + @override void initState() { @@ -69,13 +78,16 @@ class _ShoppingGoodsDetails extends State { storeId = widget.arguments["storeId"]; tenant = widget.arguments["tenant"]; id = widget.arguments["id"]; + pageType = widget.arguments["type"]; + actProductId = widget.arguments["actProductId"]; + limitNumber = widget.arguments["limitNumber"]; + limitTime = widget.arguments["limitTime"]; + bannerImg = widget.arguments["bannerImg"]; debugPrint("store_param tenant:$tenant storeId:$storeId"); SharedPreferences.getInstance().then((value) { minLogin(value); - queryStoreInfo(); - queryMiNiDetail(id); }); } @@ -93,7 +105,6 @@ class _ShoppingGoodsDetails extends State { }).then((baseData) { if (baseData != null && baseData.isSuccess) { minToken = baseData.data["token"]; - queryStoreInfo(); SharedPreferences.getInstance().then( (value) => { value.setString('minToken', minToken), @@ -111,6 +122,11 @@ class _ShoppingGoodsDetails extends State { ); queryStoreInfo(); + if (pageType == null) { + queryMiNiDetail(id); + } else { + queryViewProduct(actProductId, pageType); + } EasyLoading.dismiss(); } @@ -151,7 +167,35 @@ class _ShoppingGoodsDetails extends State { refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { - miNiDetail = baseData.data; + setState(() { + miNiDetail = baseData.data; + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + + ///活动商品详情 + queryViewProduct(actProductId, pageType) async { + if (minService == null) + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + showLoading: false, + ); + BaseData baseData = await minService + .viewProduct(actProductId, pageType) + .catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + activityDetails = baseData.data; + }); refreshController.refreshCompleted(); } else { refreshController.refreshFailed(); @@ -286,9 +330,11 @@ class _ShoppingGoodsDetails extends State { buildColumn(), ///拼团 + if(pageType == "1") groupOption(), ///拼团规则 + if(pageType == "1") groupRule(), goodsOption(), Padding( @@ -431,350 +477,427 @@ class _ShoppingGoodsDetails extends State { ///购买按钮 Widget payButton() { return Container( - child: Row( + child:Row( children: [ - GestureDetector( - onTap: () { - if (productSku == null) - SmartDialog.showToast("请选择規格!", alignment: Alignment.center); - addShoppingCar(); - }, - child: Container( - alignment: Alignment.center, - width: 120.w, - height: 37.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all( - width: 1, - color: Color(0xFF32A060), - style: BorderStyle.solid, - ), - ), - child: Text( - "加入购物车", - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF32A060), + if(pageType == null) + Row( + children: [ + GestureDetector( + onTap: () { + if (productSku == null) + SmartDialog.showToast("请选择規格!", alignment: Alignment.center); + addShoppingCar(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 37.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Text( + "加入购物车", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF32A060), + ), + ), + ), ), - ), + GestureDetector( + onTap: () { + // toDownOrder(); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 37.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "立即购买", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + )), + ], ), - ), - GestureDetector( - onTap: () { - // toDownOrder(); - }, - child: Container( - alignment: Alignment.center, - width: 120.w, - height: 37.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + + ///秒杀按钮 + if(pageType == "2") + Row( + children: [ + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text:activityDetails?.actProduct?.productPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], ), - ], - ), - child: Text( - "立即购买", - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, ), ), - )), + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text: activityDetails?.actProduct?.promotionPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要秒杀", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )), + ], + ), - ///秒杀按钮 - // GestureDetector( - // onTap: (){ - // Navigator.of(context).popAndPushNamed('/router/group_details'); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 120.w, - // height:40.h, - // margin: EdgeInsets.only(left: 6.w), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(16), - // border: Border.all( - // width: 1, - // color: Color(0xFF32A060), - // style: BorderStyle.solid, - // ), - // ), - // child: Column( - // children: [ - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "¥", - // style: TextStyle( - // fontSize: 7.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // TextSpan( - // text: "284.00", - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // ], - // ), - // ), - // Expanded(child: - // Text( - // "原价购买", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // )), - // ], - // ), - // ), - // ), - // GestureDetector( - // onTap: (){ - // Navigator.of(context).popAndPushNamed('/router/bargain_details'); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 120.w, - // height: 40.h, - // margin: EdgeInsets.only(left: 6.w), - // decoration: BoxDecoration( - // color: Color(0xFF32A060), - // borderRadius: BorderRadius.circular(16), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ), - // ], - // ), - // child: Column( - // children: [ - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "¥", - // style: TextStyle( - // fontSize: 7.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // TextSpan( - // text: "284.00", - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // Expanded(child: - // Text( - // "我要秒杀", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ),), - // ], - // ), - // )), ///砍价 - // GestureDetector( - // onTap: (){ - // Navigator.of(context).popAndPushNamed('/router/bargain_details'); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 120.w, - // height: 40.h, - // margin: EdgeInsets.only(left: 6.w), - // decoration: BoxDecoration( - // color: Color(0xFF32A060), - // borderRadius: BorderRadius.circular(16), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ), - // ], - // ), - // child: Column( - // children: [ - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "¥", - // style: TextStyle( - // fontSize: 7.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // TextSpan( - // text: "284.00", - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // Expanded(child: - // Text( - // "我要砍价", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ),), - // ], - // ), - // )), + if(pageType == "3") + Row( + children: [ + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text:activityDetails?.actProduct?.productPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "原价购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ), + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text:activityDetails?.actProduct?.promotionPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要砍价", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )), + ], + ), + + ///拼团按钮 - // GestureDetector( - // onTap: (){ - // Navigator.of(context).popAndPushNamed('/router/group_details'); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 120.w, - // height:40.h, - // margin: EdgeInsets.only(left: 6.w), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(16), - // border: Border.all( - // width: 1, - // color: Color(0xFF32A060), - // style: BorderStyle.solid, - // ), - // ), - // child: Column( - // children: [ - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "¥", - // style: TextStyle( - // fontSize: 7.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // TextSpan( - // text: "284.00", - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // ), - // ], - // ), - // ), - // Expanded(child: - // Text( - // "单人购买", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Color(0xFF32A060), - // ), - // )), - // ], - // ), - // ), - // ), - // GestureDetector( - // onTap: (){ - // Navigator.of(context).popAndPushNamed('/router/bargain_details'); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 120.w, - // height: 40.h, - // margin: EdgeInsets.only(left: 6.w), - // decoration: BoxDecoration( - // color: Color(0xFF32A060), - // borderRadius: BorderRadius.circular(16), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ), - // ], - // ), - // child: Column( - // children: [ - // Text.rich( - // TextSpan( - // children: [ - // TextSpan( - // text: "¥", - // style: TextStyle( - // fontSize: 7.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // TextSpan( - // text: "284.00", - // style: TextStyle( - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // Expanded(child: - // Text( - // "我要开团", - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.medium, - // color: Colors.white, - // ), - // ),), - // ], - // ), - // )), + if(pageType == "1") + Row( + children: [ + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height:40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all( + width: 1, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + TextSpan( + text:activityDetails?.actProduct?.productPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + ), + ), + Expanded(child: + Text( + "单人购买", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + )), + ], + ), + ), + ), + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/bargain_details'); + }, + child: Container( + alignment: Alignment.center, + width: 120.w, + height: 40.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Column( + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 7.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + TextSpan( + text:activityDetails?.actProduct?.promotionPrice ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ], + ), + ), + Expanded(child: + Text( + "我要开团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ),), + ], + ), + )), + ], + ), ], ), ); @@ -805,11 +928,12 @@ class _ShoppingGoodsDetails extends State { height: 50.h, padding: EdgeInsets.only(left: 16.w), decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage("assets/image/attainment_bj.png"), - // ), - color: Colors.green), + // image: DecorationImage( + // fit: BoxFit.fill, + // image: AssetImage(bannerImg), + // ), + color: Colors.green, + ), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -826,7 +950,10 @@ class _ShoppingGoodsDetails extends State { ), ), TextSpan( - text: miNiDetail?.price ?? "", + text: pageType == null + ? (miNiDetail?.price ?? "") + : (activityDetails?.actProduct?.promotionPrice ?? + ""), style: TextStyle( fontSize: 28.sp, fontWeight: MyFontWeight.semi_bold, @@ -842,7 +969,9 @@ class _ShoppingGoodsDetails extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "原价¥283.00", + pageType == null + ? ("原价¥283.00") + : ("单买价 ${activityDetails?.actProduct?.productPrice ?? ""}"), style: TextStyle( fontWeight: MyFontWeight.regular, decoration: TextDecoration.lineThrough, @@ -851,14 +980,45 @@ class _ShoppingGoodsDetails extends State { color: Colors.white, ), ), - Text( - "已售${miNiDetail?.sellCount ?? 0}件", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 10.sp, - color: Colors.white, - ), - ), + pageType == null + ? Text( + "已售${miNiDetail?.sellCount ?? 0}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Colors.white, + ), + ) + : Row( + children: [ + Container( + margin: EdgeInsets.only(right: 2), + padding: EdgeInsets.only(left: 2, right: 2), + height: 15.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFFFFFFFF), + ), + child: Text( + "${limitNumber ?? 0}人团", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), + ), + ), + Text( + "已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, + ), + ), + ], + ) ], ) ], @@ -876,7 +1036,9 @@ class _ShoppingGoodsDetails extends State { children: [ Expanded( child: Text( - miNiDetail?.productName ?? "", + pageType == null + ? (miNiDetail?.productName ?? "") + : (activityDetails?.actProduct?.productName ?? ""), style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 15.sp, @@ -894,7 +1056,9 @@ class _ShoppingGoodsDetails extends State { color: Color(0xFF5A5A5A), ), child: Text( - miNiDetail?.supplierName ?? "", + pageType == null + ? (miNiDetail?.supplierName ?? "") + : ("没字段"), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -908,7 +1072,7 @@ class _ShoppingGoodsDetails extends State { height: 8.h, ), Text( - miNiDetail?.shortName ?? "", + pageType == null ? (miNiDetail?.shortName ?? "") : ("没字段"), maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -931,27 +1095,39 @@ class _ShoppingGoodsDetails extends State { aspectRatio: 1.3698, child: Stack( children: [ - Swiper( - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - builder: DotSwiperPaginationBuilder( - size: 8, - activeSize: 8, - space: 5, - activeColor: Colors.black, - color: Colors.black.withAlpha(76), - ), - ), - itemBuilder: (context, position) { - return miNiDetail == null - ? Container() - : Image.network( - miNiDetail.imgs.elementAt(position), + if ((miNiDetail?.imgs?.length ?? 0) > 0 || pageType != null) + pageType == null + ? Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + itemBuilder: (context, position) { + return miNiDetail == null + ? Container() + : Image.network( + miNiDetail.imgs.elementAt(position), + fit: BoxFit.cover, + ); + }, + itemCount: miNiDetail?.imgs?.length ?? 0, + ) + : Positioned( + child: MImage( + activityDetails?.actProduct?.productImg ?? "", + width: double.infinity, + height: double.infinity, fit: BoxFit.cover, - ); - }, - itemCount: miNiDetail?.imgs?.length ?? 0, - ), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), GestureDetector( onTap: () { Navigator.of(context).pop(); @@ -1175,7 +1351,7 @@ class _ShoppingGoodsDetails extends State { SizedBox(height: 12.h), ListView.builder( padding: EdgeInsets.zero, - itemCount: 2, + itemCount:activityDetails?.actRecordAndJoinlDTOList?.length ?? 0, scrollDirection: Axis.vertical, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -1184,7 +1360,7 @@ class _ShoppingGoodsDetails extends State { onTap: () { setState(() {}); }, - child: groupItem(), + child: groupItem(activityDetails.actRecordAndJoinlDTOList[position]), ); }, ), @@ -1193,32 +1369,26 @@ class _ShoppingGoodsDetails extends State { ); } - Widget groupItem() { + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - // MImage( - // "", - // width:30, - // height:30, - // fit: BoxFit.cover, - // isCircle: true, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), - Image.asset( - "assets/image/icon_story_td.png", - width: 30, - height: 30, + MImage( + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberAvatar ??"", + width:30, + height:30, fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), SizedBox(width: 4.w), Expanded( child: Text( - "团长名称", + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberNickname ??"", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -1241,7 +1411,7 @@ class _ShoppingGoodsDetails extends State { ), ), TextSpan( - text: "1", + text:activityDetails.actRecordAndJoinlDTOList[0].actRecord.joinNum.toString(), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular,