diff --git a/assets/image/2x/ji_fen.png b/assets/image/2x/ji_fen.png new file mode 100644 index 00000000..c7e2ca1c Binary files /dev/null and b/assets/image/2x/ji_fen.png differ diff --git a/assets/image/2x/shopping_k.png b/assets/image/2x/shopping_k.png new file mode 100644 index 00000000..09a1f810 Binary files /dev/null and b/assets/image/2x/shopping_k.png differ diff --git a/assets/image/3x/ji_fen.png b/assets/image/3x/ji_fen.png new file mode 100644 index 00000000..d11a5a46 Binary files /dev/null and b/assets/image/3x/ji_fen.png differ diff --git a/assets/image/3x/shopping_k.png b/assets/image/3x/shopping_k.png new file mode 100644 index 00000000..b15bb5a5 Binary files /dev/null and b/assets/image/3x/shopping_k.png differ diff --git a/assets/image/ji_fen.png b/assets/image/ji_fen.png new file mode 100644 index 00000000..b7aa7d1b Binary files /dev/null and b/assets/image/ji_fen.png differ diff --git a/assets/image/shopping_k.png b/assets/image/shopping_k.png new file mode 100644 index 00000000..e03be6e7 Binary files /dev/null and b/assets/image/shopping_k.png differ diff --git a/lib/main.dart b/lib/main.dart index 2c5120f0..8f00f264 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -51,6 +51,13 @@ import 'package:huixiang/setting/help_feedback_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; +import 'package:huixiang/store/shopping/activity_prefecture_details.dart'; +import 'package:huixiang/store/shopping/shopping_goods_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/bargain_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/group_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/group_page_details.dart'; +import 'package:huixiang/store/shopping/shopping_home/search_page.dart'; +import 'package:huixiang/store/shopping/shopping_mall_home.dart'; import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/test_page.dart'; @@ -338,11 +345,11 @@ Map routers = { '/router/headlines_column_details': (context, {arguments}) => HeadlinesColumnDetails(arguments: arguments), '/router/group_details': (context, {arguments}) => - GroupDetails(), + GroupDetails(arguments:arguments), '/router/bargain_details': (context, {arguments}) => BargainDetails(), '/router/group_page_details': (context, {arguments}) => - GroupPageDetails(), + GroupPageDetails(arguments:arguments), '/router/photo_view_gallery_screen': (context, {arguments}) => PhotoViewGalleryScreen(), }; diff --git a/lib/retrofit/data/activity_actRecord_details.dart b/lib/retrofit/data/activity_actRecord_details.dart new file mode 100644 index 00000000..36da4af6 --- /dev/null +++ b/lib/retrofit/data/activity_actRecord_details.dart @@ -0,0 +1,315 @@ +/// actRecord : {"id":"1480458252863930368","createTime":"2022-01-10 16:35:28","createUser":"1478548720785031168","updateTime":"2022-01-10 16:35:28","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actProductId":"1479377402160218112","mid":"1478548720785031168","joinNum":1,"startTime":"2022-01-10 16:35:28","endTime":"2022-01-11 14:35:28","state":1,"isDelete":0} +/// actRecordJoinList : [{"id":"1480458253568573440","createTime":"2022-01-10 16:35:28","createUser":"1478548720785031168","updateTime":"2022-01-10 16:35:28","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1480458252863930368","mid":"1478548720785031168","orderId":"1480458254545846272","isLeader":true,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402160218112","actPrice":"78.00","state":false,"isDelete":0},{"id":"1480465728682328064","createTime":"2022-01-10 17:05:10","createUser":"1478548720785031168","updateTime":"2022-01-10 17:05:10","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1480458252863930368","mid":"1478548720785031168","orderId":"1480465729634435072","isLeader":false,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402160218112","actPrice":"78.00","state":true,"isDelete":0},{"id":"1480466261283438592","createTime":"2022-01-10 17:07:17","createUser":"1478548720785031168","updateTime":"2022-01-10 17:07:17","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":1,"actTemplateId":"1479377328797646848","actTimeId":"1479377329099636736","actRecordId":"1480458252863930368","mid":"1478548720785031168","orderId":"1480466261941944320","isLeader":false,"memberAvatar":"","memberNickname":"斯基","productId":"1479377402160218112","actPrice":"78.00","state":false,"isDelete":0}] + +class ActivityActRecordDetails { + ActivityActRecordDetails({ + ActRecord actRecord, + List actRecordJoinList,}){ + _actRecord = actRecord; + _actRecordJoinList = actRecordJoinList; +} + + ActivityActRecordDetails.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 : "1480458253568573440" +/// createTime : "2022-01-10 16:35:28" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-10 16:35:28" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// type : 1 +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actRecordId : "1480458252863930368" +/// mid : "1478548720785031168" +/// orderId : "1480458254545846272" +/// isLeader : true +/// memberAvatar : "" +/// memberNickname : "斯基" +/// productId : "1479377402160218112" +/// actPrice : "78.00" +/// state : false +/// isDelete : 0 + +class ActRecordJoinList { + ActRecordJoinList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String storeId, + int type, + 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; + _type = type; + _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']; + _type = json['type']; + _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; + int _type; + 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; + int get type => _type; + 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['type'] = _type; + 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 : "1480458252863930368" +/// createTime : "2022-01-10 16:35:28" +/// createUser : "1478548720785031168" +/// updateTime : "2022-01-10 16:35:28" +/// updateUser : "1478548720785031168" +/// storeId : "1460885296764682240" +/// type : 1 +/// actTemplateId : "1479377328797646848" +/// actTimeId : "1479377329099636736" +/// actProductId : "1479377402160218112" +/// mid : "1478548720785031168" +/// joinNum : 1 +/// startTime : "2022-01-10 16:35:28" +/// endTime : "2022-01-11 14:35:28" +/// state : 1 +/// 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; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/activity_details.dart b/lib/retrofit/data/activity_details.dart index 458727ed..d3a32e7a 100644 --- a/lib/retrofit/data/activity_details.dart +++ b/lib/retrofit/data/activity_details.dart @@ -3,14 +3,17 @@ class ActivityDetails { ActivityDetails({ - ActProduct actProduct, - List actRecordAndJoinlDTOList,}){ + ActProduct actProduct, + List actRecordAndJoinlDTOList, + }) { _actProduct = actProduct; _actRecordAndJoinlDTOList = actRecordAndJoinlDTOList; -} + } ActivityDetails.fromJson(dynamic json) { - _actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null; + _actProduct = json['actProduct'] != null + ? ActProduct.fromJson(json['actProduct']) + : null; if (json['actRecordAndJoinlDTOList'] != null) { _actRecordAndJoinlDTOList = []; json['actRecordAndJoinlDTOList'].forEach((v) { @@ -18,11 +21,14 @@ class ActivityDetails { }); } } + ActProduct _actProduct; List _actRecordAndJoinlDTOList; ActProduct get actProduct => _actProduct; - List get actRecordAndJoinlDTOList => _actRecordAndJoinlDTOList; + + List get actRecordAndJoinlDTOList => + _actRecordAndJoinlDTOList; Map toJson() { final map = {}; @@ -30,11 +36,11 @@ class ActivityDetails { map['actProduct'] = _actProduct.toJson(); } if (_actRecordAndJoinlDTOList != null) { - map['actRecordAndJoinlDTOList'] = _actRecordAndJoinlDTOList.map((v) => v.toJson()).toList(); + 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} @@ -42,14 +48,17 @@ class ActivityDetails { class ActRecordAndJoinlDTOList { ActRecordAndJoinlDTOList({ - ActRecord actRecord, - List actRecordJoinList,}){ + ActRecord actRecord, + List actRecordJoinList, + }) { _actRecord = actRecord; _actRecordJoinList = actRecordJoinList; -} + } ActRecordAndJoinlDTOList.fromJson(dynamic json) { - _actRecord = json['actRecord'] != null ? ActRecord.fromJson(json['actRecord']) : null; + _actRecord = json['actRecord'] != null + ? ActRecord.fromJson(json['actRecord']) + : null; if (json['actRecordJoinList'] != null) { _actRecordJoinList = []; json['actRecordJoinList'].forEach((v) { @@ -57,10 +66,12 @@ class ActRecordAndJoinlDTOList { }); } } + ActRecord _actRecord; List _actRecordJoinList; ActRecord get actRecord => _actRecord; + List get actRecordJoinList => _actRecordJoinList; Map toJson() { @@ -69,11 +80,11 @@ class ActRecordAndJoinlDTOList { map['actRecord'] = _actRecord.toJson(); } if (_actRecordJoinList != null) { - map['actRecordJoinList'] = _actRecordJoinList.map((v) => v.toJson()).toList(); + map['actRecordJoinList'] = + _actRecordJoinList.map((v) => v.toJson()).toList(); } return map; } - } /// id : "1479399514073726976" @@ -97,24 +108,25 @@ class ActRecordAndJoinlDTOList { 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,}){ + 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; @@ -133,7 +145,7 @@ class ActRecordJoinList { _actPrice = actPrice; _state = state; _isDelete = isDelete; -} + } ActRecordJoinList.fromJson(dynamic json) { _id = json['id']; @@ -155,6 +167,7 @@ class ActRecordJoinList { _state = json['state']; _isDelete = json['isDelete']; } + String _id; String _createTime; String _createUser; @@ -175,22 +188,39 @@ class ActRecordJoinList { 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() { @@ -215,7 +245,6 @@ class ActRecordJoinList { map['isDelete'] = _isDelete; return map; } - } /// id : "1479399513473941504" @@ -237,22 +266,23 @@ class ActRecordJoinList { 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,}){ + 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; @@ -269,7 +299,7 @@ class ActRecord { _endTime = endTime; _state = state; _isDelete = isDelete; -} + } ActRecord.fromJson(dynamic json) { _id = json['id']; @@ -289,6 +319,7 @@ class ActRecord { _state = json['state']; _isDelete = json['isDelete']; } + String _id; String _createTime; String _createUser; @@ -305,22 +336,48 @@ class ActRecord { String _endTime; int _state; int _isDelete; + int _tempDay; + int _tempHour; + int _tempM; + int _tempS; + + + int get tempDay => _tempDay; + + set tempDay(int value) { + _tempDay = value; + } 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() { @@ -344,6 +401,24 @@ class ActRecord { return map; } + int get tempHour => _tempHour; + + set tempHour(int value) { + _tempHour = value; + } + + int get tempM => _tempM; + + set tempM(int value) { + _tempM = value; + } + + int get tempS => _tempS; + + set tempS(int value) { + _tempS = value; + } + } /// id : "1479377402042777600" @@ -366,23 +441,24 @@ class ActRecord { 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,}){ + 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; @@ -400,7 +476,7 @@ class ActProduct { _sellCount = sellCount; _skuJson = skuJson; _isDelete = isDelete; -} + } ActProduct.fromJson(dynamic json) { _id = json['id']; @@ -426,6 +502,7 @@ class ActProduct { } _isDelete = json['isDelete']; } + String _id; String _createTime; String _createUser; @@ -445,21 +522,37 @@ class ActProduct { 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() { @@ -485,7 +578,6 @@ class ActProduct { map['isDelete'] = _isDelete; return map; } - } /// skuId : "1460886581089927168" @@ -494,25 +586,29 @@ class ActProduct { class SkuJson { SkuJson({ - String skuId, - int skuPrice, - int skuStock,}){ + 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() { @@ -522,5 +618,4 @@ class SkuJson { map['skuStock'] = _skuStock; return map; } - -} \ No newline at end of file +} diff --git a/lib/retrofit/data/activity_order_list.dart b/lib/retrofit/data/activity_order_list.dart new file mode 100644 index 00000000..b53690d9 --- /dev/null +++ b/lib/retrofit/data/activity_order_list.dart @@ -0,0 +1,85 @@ +/// storeName : "一心回乡商城" +/// joinTime : "2022-01-07 18:28:25" +/// productImg : "https://pos.upload.gznl.top/1179/2021/11/e50b00a1-09a2-4bab-b71f-e26e80006459.png" +/// productName : "无花果礼盒" +/// productSkuName : "" +/// actRecordstate : 4 +/// actRecordJoinState : null +/// howManyMore : null +/// bargainMoney : null +/// howManyMoney : null + +class ActivityOrderList { + ActivityOrderList({ + String storeName, + String joinTime, + String productImg, + String productName, + String productSkuName, + int actRecordstate, + dynamic actRecordJoinState, + dynamic howManyMore, + dynamic bargainMoney, + dynamic howManyMoney,}){ + _storeName = storeName; + _joinTime = joinTime; + _productImg = productImg; + _productName = productName; + _productSkuName = productSkuName; + _actRecordstate = actRecordstate; + _actRecordJoinState = actRecordJoinState; + _howManyMore = howManyMore; + _bargainMoney = bargainMoney; + _howManyMoney = howManyMoney; +} + + ActivityOrderList.fromJson(dynamic json) { + _storeName = json['storeName']; + _joinTime = json['joinTime']; + _productImg = json['productImg']; + _productName = json['productName']; + _productSkuName = json['productSkuName']; + _actRecordstate = json['actRecordstate']; + _actRecordJoinState = json['actRecordJoinState']; + _howManyMore = json['howManyMore']; + _bargainMoney = json['bargainMoney']; + _howManyMoney = json['howManyMoney']; + } + String _storeName; + String _joinTime; + String _productImg; + String _productName; + String _productSkuName; + int _actRecordstate; + dynamic _actRecordJoinState; + dynamic _howManyMore; + dynamic _bargainMoney; + dynamic _howManyMoney; + + String get storeName => _storeName; + String get joinTime => _joinTime; + String get productImg => _productImg; + String get productName => _productName; + String get productSkuName => _productSkuName; + int get actRecordstate => _actRecordstate; + dynamic get actRecordJoinState => _actRecordJoinState; + dynamic get howManyMore => _howManyMore; + dynamic get bargainMoney => _bargainMoney; + dynamic get howManyMoney => _howManyMoney; + + Map toJson() { + final map = {}; + map['storeName'] = _storeName; + map['joinTime'] = _joinTime; + map['productImg'] = _productImg; + map['productName'] = _productName; + map['productSkuName'] = _productSkuName; + map['actRecordstate'] = _actRecordstate; + map['actRecordJoinState'] = _actRecordJoinState; + map['howManyMore'] = _howManyMore; + map['bargainMoney'] = _bargainMoney; + map['howManyMoney'] = _howManyMoney; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index f0f7cda7..248d1ea5 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -14,9 +14,11 @@ import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; +import 'data/activity_actRecord_details.dart'; import 'data/activity_area_list.dart'; import 'data/activity_details.dart'; import 'data/findMiNiGroupList.dart'; +import 'data/activity_order_list.dart'; import 'data/home_recommend_list.dart'; import 'data/miNiDetail.dart'; import 'data/settleOrderInfo.dart'; @@ -25,8 +27,8 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -38,8 +40,8 @@ const baseUrl = "https://pos.api.lotus-wallet.com/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) @@ -225,16 +227,24 @@ abstract class MinApiService { Future> viewProduct(@Path("actProductId") String actProductId, @Path("type") String type); - // /// 活动付款 - // @POST("actTemplate/actPay") - // Future actPay(@Body() Map param); - // - // /// 参与活动 - // @POST("actTemplate/joinAct") - // Future joinAct(@Body() Map param); - // - // /// 发起活动 - // @POST("actTemplate/launchAct") - // Future launchAct(@Body() Map param); + /// 发起活动 + @POST("actTemplate/launchAct") + Future launchAct(@Body() Map param); + + /// 参与活动 + @POST("actTemplate/joinAct") + Future joinAct(@Body() Map param); + + /// 活动付款 + @POST("actTemplate/actPay") + Future actPay(@Body() Map param); + + /// 查看我的拼团、砍价、列表 + @POST("actTemplate/showMyActList") + Future>> showMyActList(@Body() Map param); + + /// 查看某一个发起的拼团、砍价详情 + @GET("actTemplate/showOneAct?actRecordId={actRecordId}") + Future> showOneAct(@Path("actRecordId") String actRecordId); } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 4060db33..06470f2b 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 ??= 'https://pos.api.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.142:8765/app/'; } final Dio _dio; @@ -488,4 +488,116 @@ class _MinApiService implements MinApiService { return value; } + @override + Future> launchAct(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('actTemplate/launchAct', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> joinAct(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('actTemplate/joinAct', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> actPay(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('actTemplate/actPay', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future>> showMyActList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('actTemplate/launchAct', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map( + (i) => ActivityOrderList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> showOneAct(actRecordId) async { + ArgumentError.checkNotNull(actRecordId, 'actRecordId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + 'actTemplate/showOneAct?actRecordId=$actRecordId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityActRecordDetails.fromJson(json), + ); + return value; + } + } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 29b4aa1c..9a42e5ed 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -54,8 +54,8 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -67,8 +67,8 @@ const baseUrl = "https://pos.platform.lotus-wallet.com/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 d221d3b7..50bf5722 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 ??= 'https://pos.platform.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.142:8766/app/'; } final Dio _dio; diff --git a/lib/store/shopping/shopping_cart/shopping_cart_page.dart b/lib/store/shopping/shopping_cart/shopping_cart_page.dart index 3a7b98bc..6799250f 100644 --- a/lib/store/shopping/shopping_cart/shopping_cart_page.dart +++ b/lib/store/shopping/shopping_cart/shopping_cart_page.dart @@ -388,7 +388,27 @@ class _ShoppingCartPage extends State } Widget cartGoodsList(){ - return Container( + return + // ((shopCarGoods?.length ?? 0) > 0) ?Container( + // // width: double.infinity, + // alignment: Alignment.center, + // margin: EdgeInsets.only(bottom: 47.h,left: 66.w,right: 59.w), + // child:Column(children: [ + // Image.asset( + // "assets/image/shopping_k.png", + // width:double.infinity, + // height: 250.h, + // ), + // Text( + // "目前暂无商品,要快去买点好吃的哦~", + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFF353535), + // ), + // ), + // ],)): + Container( margin: EdgeInsets.only(bottom: 50.h), child: ListView.builder( itemCount:((shopCarGoods?.length ?? 0) > 0) ? (shopCarGoods[0]?.shoppingCartSkuItemList?.length ?? 0) : 0, @@ -401,7 +421,6 @@ class _ShoppingCartPage extends State itemBuilder: (context, position) { return InkWell( onTap: () { - }, child: cartGoodsItem(position), ); diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index fcb7de5f..5b251fc0 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:convert'; import 'package:dio/dio.dart'; @@ -14,6 +15,7 @@ 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'; +import 'package:huixiang/retrofit/data/activity_order_list.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; @@ -70,8 +72,24 @@ class _ShoppingGoodsDetails extends State { int limitNumber = 0; int limitTime = 0; String bannerImg; + // String pName; + // String pid; + // String cName; + // String cid; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + @override + void dispose() { + super.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } + @override void initState() { super.initState(); @@ -84,6 +102,7 @@ class _ShoppingGoodsDetails extends State { limitTime = widget.arguments["limitTime"]; bannerImg = widget.arguments["bannerImg"]; + startCountdownTimer(); debugPrint("store_param tenant:$tenant storeId:$storeId"); SharedPreferences.getInstance().then((value) { @@ -128,6 +147,7 @@ class _ShoppingGoodsDetails extends State { queryViewProduct(actProductId, pageType); } + EasyLoading.dismiss(); } }); @@ -202,6 +222,40 @@ class _ShoppingGoodsDetails extends State { } } + ///发起活动 + // queryLaunchAct() async { + // if (minService == null) + // minService = MinApiService( + // Dio(), + // context: context, + // token: minToken, + // tenant: tenant, + // storeId: storeId, + // showLoading: false, + // ); + // BaseData baseData = await minService.launchAct({ + // "actProductId":activityDetails.actProduct.id, + // "actRecordId":0, + // "actTemplateId":activityDetails.actProduct.templateId, + // "actTimeId":activityDetails.actProduct.timeId, + // "getType":1, + // "productId":activityDetails.actProduct.productId, + // "skuId":activityDetails.actProduct.skuJson[0].skuId, + // "skuPrice":activityDetails.actProduct.skuJson[0].skuPrice, + // "templateType":pageType + // }).catchError((error) { + // refreshController.refreshFailed(); + // }); + // if (baseData != null && baseData.isSuccess) { + // setState(() { + // + // refreshController.refreshCompleted(); + // }); + // } else { + // refreshController.refreshFailed(); + // } + // } + ///选规格弹窗 showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { if (miNiDetail.attrList != null && @@ -294,6 +348,42 @@ class _ShoppingGoodsDetails extends State { } } + _onRefresh(){ + if (pageType == null) { + queryMiNiDetail(id); + } else { + queryViewProduct(actProductId, pageType); + } + } + + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + activityDetails.actRecordAndJoinlDTOList.forEach((element) { + var tempDateTime = + DateTime.parse(element.actRecord.endTime).difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + element.actRecord.tempDay = 0; + element.actRecord.tempHour = 0; + element.actRecord.tempM = 0; + element.actRecord.tempS = 0; + return; + } + element.actRecord.tempDay = tempDateTime.inDays; + element.actRecord.tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + element.actRecord.tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + element.actRecord.tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + @override Widget build(BuildContext context) { return Stack( @@ -318,7 +408,7 @@ class _ShoppingGoodsDetails extends State { ), onRefresh: () { setState(() { - queryMiNiDetail(id); + _onRefresh(); }); }, child: SingleChildScrollView( @@ -840,7 +930,6 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: (){ - Navigator.of(context).popAndPushNamed('/router/bargain_details'); }, child: Container( alignment: Alignment.center, @@ -929,7 +1018,7 @@ class _ShoppingGoodsDetails extends State { decoration: BoxDecoration( // image: DecorationImage( // fit: BoxFit.fill, - // image: AssetImage(bannerImg), + // image: NetworkImage(bannerImg), // ), color: Colors.green, ), @@ -1328,7 +1417,8 @@ class _ShoppingGoodsDetails extends State { onTap: () { setState(() { Navigator.of(context) - .popAndPushNamed('/router/group_page_details'); + .popAndPushNamed('/router/group_page_details', + arguments: {"actRecordAndJoinlDTOList":json.encode(activityDetails.actRecordAndJoinlDTOList),}); }); }, child: Text( @@ -1359,7 +1449,7 @@ class _ShoppingGoodsDetails extends State { onTap: () { setState(() {}); }, - child: groupItem(activityDetails.actRecordAndJoinlDTOList[position]), + child: groupItem(activityDetails.actRecordAndJoinlDTOList[position],position), ); }, ), @@ -1368,7 +1458,7 @@ class _ShoppingGoodsDetails extends State { ); } - Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) { + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList,index) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), child: Row( @@ -1429,7 +1519,7 @@ class _ShoppingGoodsDetails extends State { ), ), Text( - "剩余23:12:12", + "剩余${(actRecordAndJoinlDTOList.actRecord.tempDay != 0)?actRecordAndJoinlDTOList.actRecord.tempDay : ""}:${actRecordAndJoinlDTOList.actRecord.tempHour}:${actRecordAndJoinlDTOList.actRecord.tempM}:${actRecordAndJoinlDTOList.actRecord.tempS}", style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -1438,38 +1528,45 @@ class _ShoppingGoodsDetails extends State { ), ], ), - Container( - alignment: Alignment.center, - width: 53.w, - height: 22.h, - margin: EdgeInsets.only(left: 4.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(13), - gradient: new LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - Color(0xFF61CE6B), - Color(0xFF32A057), - ]), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + GestureDetector( + onTap: (){ + Navigator.of(context).popAndPushNamed('/router/group_details', + arguments: {"actRecordId":activityDetails.actRecordAndJoinlDTOList[0].actRecordJoinList[index].actRecordId}); + }, + child: Container( + alignment: Alignment.center, + width: 53.w, + height: 22.h, + margin: EdgeInsets.only(left: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(13), + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFF61CE6B), + Color(0xFF32A057), + ]), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "去参团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, ), - ], - ), - child: Text( - "去参团", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, ), - ), - ) + ) , + ), + ], ), ); diff --git a/lib/store/shopping/shopping_home/group_details.dart b/lib/store/shopping/shopping_home/group_details.dart index 350a698b..577d7cb4 100644 --- a/lib/store/shopping/shopping_home/group_details.dart +++ b/lib/store/shopping/shopping_home/group_details.dart @@ -1,15 +1,26 @@ +import 'dart:async'; +import 'dart:core'; + +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/min_api.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:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class GroupDetails extends StatefulWidget { + final Map arguments; + + GroupDetails({this.arguments}); + @override State createState() { return _GroupDetails(); @@ -17,15 +28,82 @@ class GroupDetails extends StatefulWidget { } class _GroupDetails extends State { - ApiService apiService; + MinApiService minService; + String actRecordId; + ActivityActRecordDetails activityActRecordDetails; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + int tempDay = 0; + int tempHour = 0; + int tempM = 0; + int tempS = 0; @override void initState() { super.initState(); + actRecordId = widget.arguments["actRecordId"]; + + startCountdownTimer(); + SharedPreferences.getInstance().then((value) { + String minToken = value.getString("minToken"); + String tenant = value.getString("tenant"); + String storeId = value.getString("storeId"); + minService = MinApiService( + Dio(), + context: context, + token: minToken, + tenant: tenant, + storeId: storeId, + ); + queryShowOneAct(actRecordId); + }); } final SwiperController controller = SwiperController(); + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + var tempDateTime = + DateTime.parse(activityActRecordDetails.actRecord.endTime).difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + tempDay = 0; + tempHour = 0; + tempM = 0; + tempS = 0; + return; + } + tempDay = tempDateTime.inDays; + tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + ///查看某一个发起的拼团、砍价详情 + queryShowOneAct(actRecordId) async { + BaseData baseData = await minService + .showOneAct(actRecordId) + .catchError((error) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + setState(() { + activityActRecordDetails = baseData.data; + }); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + } + } + @override void dispose() { super.dispose(); @@ -285,6 +363,40 @@ class _GroupDetails extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ + if(tempDay != 0) + Row( + children: [ + InkWell( + onTap: () {}, + child: Container( + width: 27, + height: 28, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFD2D2D2), + borderRadius: BorderRadius.circular(4)), + child: Text( + tempDay.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 10, right: 10), + child: Text( + ":", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFD2D2D2), + ), + )), + ], + ), InkWell( onTap: () {}, child: Container( @@ -295,7 +407,7 @@ class _GroupDetails extends State { color: Color(0xFFD2D2D2), borderRadius: BorderRadius.circular(4)), child: Text( - "22", + tempHour.toString(), style: TextStyle( color: Colors.white, fontSize: 14.sp, @@ -324,7 +436,7 @@ class _GroupDetails extends State { color: Color(0xFFD2D2D2), borderRadius: BorderRadius.circular(4)), child: Text( - "59", + tempM.toString(), style: TextStyle( color: Colors.white, fontSize: 14.sp, @@ -353,7 +465,7 @@ class _GroupDetails extends State { color: Color(0xFFD2D2D2), borderRadius: BorderRadius.circular(4)), child: Text( - "59", + tempS.toString(), style: TextStyle( color: Colors.white, fontSize: 14.sp, @@ -387,7 +499,7 @@ class _GroupDetails extends State { ), ), TextSpan( - text: "2", + text:(activityActRecordDetails?.actRecord?.joinNum ?? 0).toString(), style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.semi_bold, @@ -419,17 +531,17 @@ class _GroupDetails extends State { Container( alignment: Alignment.center, width: double.infinity, - height: 75.h, + height:80.h, child: ListView.builder( shrinkWrap: true, padding: EdgeInsets.zero, scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), - itemCount: 3, + itemCount:activityActRecordDetails?.actRecord?.joinNum ?? 0, itemBuilder: (context, position) { return GestureDetector( onTap: () {}, - child: groupItem(), + child: groupItem(activityActRecordDetails.actRecordJoinList[position]), ); }, ), @@ -523,10 +635,12 @@ class _GroupDetails extends State { ); } - Widget groupItem() { + Widget groupItem(ActRecordJoinList actRecordJoinList) { return Container( margin: EdgeInsets.only(right:25), child:Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Stack( children: [ @@ -541,15 +655,16 @@ class _GroupDetails extends State { ), ), child:MImage( - "", - width:60.w, - height:60.h, + actRecordJoinList?.memberAvatar ?? "", + width:60, + height:60, fit: BoxFit.cover, isCircle: true, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", ), ), + actRecordJoinList.isLeader ? Align( alignment: Alignment.bottomCenter, child:Container( @@ -572,19 +687,22 @@ class _GroupDetails extends State { )), ), - ) + ):Container(), ], ), - // Container( - // width: 60.w, - // height: 67.h, - // child:Image.asset( - // "assets/image/pin_t.png", - // width: 60.w, - // height: 60.h, - // fit: BoxFit.cover, - // ), - // ), + if( + activityActRecordDetails.actRecord.joinNum != 0) + Container( + width: 60, + height: 67, + margin: EdgeInsets.only(left:20), + child:Image.asset( + "assets/image/pin_t.png", + width: 60.w, + height: 60.h, + fit: BoxFit.cover, + ), + ), ], ) ); diff --git a/lib/store/shopping/shopping_home/group_page_details.dart b/lib/store/shopping/shopping_home/group_page_details.dart index 0e761da7..2404a5f9 100644 --- a/lib/store/shopping/shopping_home/group_page_details.dart +++ b/lib/store/shopping/shopping_home/group_page_details.dart @@ -1,13 +1,20 @@ +import 'dart:async'; +import 'dart:convert'; + import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/retrofit_api.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'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class GroupPageDetails extends StatefulWidget { + final Map arguments; + + GroupPageDetails({this.arguments}); @override State createState() { @@ -17,28 +24,74 @@ class GroupPageDetails extends StatefulWidget { class _GroupPageDetails extends State { RefreshController refreshController = RefreshController(); - ApiService apiService; - int pageNum = 0; + List actRecordAndJoinlDTOList = []; + bool isDispose = false; + Timer _timer; + String testTime = "2021-12-30 10:00:00"; + + @override + void dispose() { + super.dispose(); + isDispose = true; + if (_timer != null) { + _timer.cancel(); + } + } @override void initState() { super.initState(); - _onRefresh(); + // _onRefresh(); + actRecordAndJoinlDTOList.addAll((json.decode( + widget.arguments["actRecordAndJoinlDTOList"]) as List) + .map( + (i) => ActRecordAndJoinlDTOList.fromJson(i as Map)) + .toList()); + startCountdownTimer(); } - _onRefresh() async { - pageNum = 0; - setState(() {}); + ///团购/秒杀时间 + startCountdownTimer() { + if (_timer != null) return; + const oneSec = const Duration(seconds: 1); + var callback = ((timer) { + if (isDispose) return; + setState(() { + actRecordAndJoinlDTOList.forEach((element) { + var tempDateTime = DateTime.parse(element.actRecord.endTime) + .difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { + element.actRecord.tempDay = 0; + element.actRecord.tempHour = 0; + element.actRecord.tempM = 0; + element.actRecord.tempS = 0; + return; + } + element.actRecord.tempDay = tempDateTime.inDays; + element.actRecord.tempHour = + tempDateTime.inHours - (tempDateTime.inDays * 24); + element.actRecord.tempM = + tempDateTime.inMinutes - (tempDateTime.inHours * 60); + element.actRecord.tempS = + tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); + }); + }); + }); + _timer = Timer.periodic(oneSec, callback); + } + + _onRefresh() { + refreshController.refreshCompleted(); } @override Widget build(BuildContext context) { return Container( color: Colors.white, - child: Column( + child: Column( children: [ MyAppBar( - title:"可参加的团", + title: "可参加的团", titleColor: Colors.black, leadingColor: Colors.black, background: Colors.transparent, @@ -52,7 +105,9 @@ class _GroupPageDetails extends State { header: MyHeader(), physics: BouncingScrollPhysics(), onRefresh: () { - setState(() {}); + setState(() { + _onRefresh(); + }); }, child: SingleChildScrollView( physics: NeverScrollableScrollPhysics(), @@ -78,11 +133,13 @@ class _GroupPageDetails extends State { ///参团列表 Widget groupList() { return Container( - height: MediaQuery.of(context).size.height-62.h-MediaQuery.of(context).padding.top, + height: MediaQuery.of(context).size.height - + 62.h - + MediaQuery.of(context).padding.top, padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), child: ListView.builder( padding: EdgeInsets.zero, - itemCount:10, + itemCount: actRecordAndJoinlDTOList?.length ?? 0, scrollDirection: Axis.vertical, shrinkWrap: true, physics: BouncingScrollPhysics(), @@ -91,14 +148,14 @@ class _GroupPageDetails extends State { onTap: () { setState(() {}); }, - child: groupItem(), + child: groupItem(actRecordAndJoinlDTOList[position], position), ); }, ), ); } - Widget groupItem() { + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList, index) { return Container( height: 44.h, margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -106,31 +163,28 @@ class _GroupPageDetails extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - // MImage( - // "", - // width:44, - // height:44, - // 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", + MImage( + actRecordAndJoinlDTOList?.actRecordJoinList[index]?.memberAvatar ?? + "", width: 44, height: 44, fit: BoxFit.cover, + isCircle: true, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), SizedBox(width: 4.w), Expanded( child: Text( - "团长名称", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D), - ), - )), + actRecordAndJoinlDTOList + ?.actRecordJoinList[index]?.memberNickname ?? + "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D), + ), + )), Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, @@ -147,7 +201,8 @@ class _GroupPageDetails extends State { ), ), TextSpan( - text: "1", + text: + actRecordAndJoinlDTOList.actRecord.joinNum.toString(), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -166,7 +221,7 @@ class _GroupPageDetails extends State { ), ), Text( - "剩余23:12:12", + "剩余${(actRecordAndJoinlDTOList.actRecord.tempDay != 0) ? actRecordAndJoinlDTOList.actRecord.tempDay : ""}:${actRecordAndJoinlDTOList?.actRecord?.tempHour ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempM ?? 0}:${actRecordAndJoinlDTOList?.actRecord?.tempS ?? 0}", style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -175,38 +230,47 @@ class _GroupPageDetails extends State { ), ], ), - Container( - alignment: Alignment.center, - width: 53.w, - height: 22.h, - margin: EdgeInsets.only(left: 4.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(13), - gradient: new LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - Color(0xFF61CE6B), - Color(0xFF32A057), - ]), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + GestureDetector( + onTap: () { + Navigator.of(context).popAndPushNamed('/router/group_details', + arguments: { + "actRecordId": actRecordAndJoinlDTOList + .actRecordJoinList[index].actRecordId + }); + }, + child: Container( + alignment: Alignment.center, + width: 53.w, + height: 22.h, + margin: EdgeInsets.only(left: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(13), + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + Color(0xFF61CE6B), + Color(0xFF32A057), + ]), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "去参团", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, ), - ], - ), - child: Text( - "去参团", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, ), ), - ) + ), ], ), ); diff --git a/lib/store/shopping/shopping_mall_home.dart b/lib/store/shopping/shopping_mall_home.dart index 1b20da39..0929cff7 100644 --- a/lib/store/shopping/shopping_mall_home.dart +++ b/lib/store/shopping/shopping_mall_home.dart @@ -71,7 +71,7 @@ class _ShoppingMallHome extends State }); queryStoreInfo(); SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minToken', minToken), value.setString('tenant', tenant), value.setString('storeId', storeId), @@ -94,7 +94,7 @@ class _ShoppingMallHome extends State /// 查询店铺信息 queryStoreInfo() async { BaseData baseData = - await apiService.queryStoreInfo(storeId).catchError((error) { + await apiService.queryStoreInfo(storeId).catchError((error) { debugPrint(error.toString()); }); if (baseData != null && baseData.isSuccess) { @@ -143,7 +143,7 @@ class _ShoppingMallHome extends State minToken, storeId, tenant, - storeInfo, + storeInfo, ), Align( alignment: Alignment.bottomCenter, @@ -187,33 +187,33 @@ class _ShoppingMallHome extends State ), Expanded( child: GestureDetector( - onTap: () { - setState(() { - choiceIndex = 1; - }); - }, - child: Column( - children: [ - Image.asset( - choiceIndex == 0 - ? "assets/image/shopping_cart_h.png" - : "assets/image/shopping_cart.png", - width: 30, - height: 30, - ), - Text( - "购物车", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.semi_bold, - color: choiceIndex == 0 - ? Color(0xFFC6C6C6) - : Color(0xFF4C4C4C), - ), + onTap: () { + setState(() { + choiceIndex = 1; + }); + }, + child: Column( + children: [ + Image.asset( + choiceIndex == 0 + ? "assets/image/shopping_cart_h.png" + : "assets/image/shopping_cart.png", + width: 30, + height: 30, + ), + Text( + "购物车", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.semi_bold, + color: choiceIndex == 0 + ? Color(0xFFC6C6C6) + : Color(0xFF4C4C4C), + ), + ), + ], ), - ], - ), - )) + )) ], ), ),