From 16e7c313a56795d9f256e91a6db57a2538b0db7e Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Thu, 6 Jan 2022 17:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6,=E7=A7=92=E6=9D=80b?= =?UTF-8?q?ug=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/data/activity_area_list.dart | 172 ++-- lib/retrofit/min_api.dart | 28 +- lib/retrofit/min_api.g.dart | 41 +- lib/retrofit/retrofit_api.dart | 8 +- lib/retrofit/retrofit_api.g.dart | 2 +- .../shopping/activity_prefecture_details.dart | 974 +++++++++--------- .../shopping_cart/shopping_cart_page.dart | 13 +- .../recommend_goods_list_view.dart | 5 +- lib/utils/flutter_utils.dart | 7 + 9 files changed, 673 insertions(+), 577 deletions(-) diff --git a/lib/retrofit/data/activity_area_list.dart b/lib/retrofit/data/activity_area_list.dart index 4cde4d2b..322f0bd6 100644 --- a/lib/retrofit/data/activity_area_list.dart +++ b/lib/retrofit/data/activity_area_list.dart @@ -1,7 +1,5 @@ -import 'package:huixiang/retrofit/data/product.dart'; - -/// actTemplate : {"id":"1473198577613275136","createTime":"2021-12-21 15:48:06","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:06","updateUser":"1333246101196636160","storeId":"1333246101343436800","type":2,"limitTime":null,"limitNumber":0,"coverImg":"https://pos.upload.gznl.top/1175/2021/12/5bf7a846-768b-4a17-872f-e927988c24c9.jpg","shareImg":"https://pos.upload.gznl.top/1175/2021/12/65f6a0f7-14d1-4393-902e-42e5dc464800.jpg","bannerImg":"https://pos.upload.gznl.top/1175/2021/12/9ee395eb-718c-40c0-bfe0-673dbbade4cf.jpg","state":1,"allDay":false,"startTime":"2021-12-20 00:00:00","endTime":"2021-12-30 00:00:00","isDelete":0} -/// timeProductList : [{"actTime":{"id":"1473198590141661184","createTime":"2021-12-21 15:48:09","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:09","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","allDay":false,"startHour":"09:00:00","endHour":"10:00:00","isDelete":0},"productList":[{"id":"1473543964270264320","createTime":"2021-12-22 14:40:33","createUser":"1333246101196636160","updateTime":"2021-12-22 14:40:33","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","timeId":"1473198590141661184","productId":"1425724410261667840","productName":"西瓜椰椰甘露","productImg":"https://pos.upload.gznl.top/1177/2021/08/3471058e-ac5e-47dd-8ed5-148e8cb28316.jpg","productPrice":"15.00","promotionPrice":"15.00","productStock":2847,"sellCount":0,"skuJson":[{"skuId":"1425724410358136832","skuPrice":15,"skuStock":996},{"skuId":"1425724410387496960","skuPrice":15,"skuStock":851},{"skuId":"1425724410454605824","skuPrice":15,"skuStock":1000}],"isDelete":0}]}] +/// actTemplate : {"id":"1478267568996220928","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","actName":"砍价","actDesc":"","type":3,"limitTime":2,"limitNumber":5,"coverImg":"https://pos.upload.gznl.top/1179/2022/01/792bda39-3c2e-434f-8e57-02c62163add4.png","shareImg":"https://pos.upload.gznl.top/1179/2022/01/68f9b6d4-16a8-4bcf-aab6-09f95d1d2a9a.png","bannerImg":"https://pos.upload.gznl.top/1179/2022/01/5efd74a8-be45-4723-a878-0513d6bfd9f8.png","state":1,"allDay":true,"startTime":"2022-01-01 00:00:00","endTime":"2022-01-31 00:00:00","isDelete":0} +/// timeProductList : [{"actTime":{"id":"1478267569205936128","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","allDay":true,"startHour":null,"endHour":null,"isDelete":0},"productList":[{"id":"1478267723770232832","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","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},{"id":"1478267723787010048","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460896670593056768","productName":"甄果酥","productImg":"https://pos.upload.gznl.top/1179/2021/11/c4e6ea91-9cc1-4f5f-86e3-91e323ab2d53.jpg","productPrice":"78.00","promotionPrice":"78.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460896670697914368","skuPrice":78,"skuStock":100}],"isDelete":0},{"id":"1478267723791204352","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460899864027070464","productName":"肺宝酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/ccf4293f-004c-4450-bcc7-c45e47444fe3.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460899864102567936","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398656","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460901466356056064","productName":"纤盈酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/49931aa8-7eda-4df2-876f-a6fa19ac0682.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460901466435747840","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398657","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461168275898499072","productName":"生态桂圆","productImg":"https://pos.upload.gznl.top/1179/2021/11/eeef5404-5533-46fc-b650-0901e0cf4580.jpg","productPrice":"60.00","promotionPrice":"60.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461168275957219328","skuPrice":60,"skuStock":100},{"skuId":"1461168275982385152","skuPrice":170,"skuStock":100}],"isDelete":0},{"id":"1478267723799592960","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461261296568631296","productName":"麦芽糖","productImg":"https://pos.upload.gznl.top/1179/2021/11/2dd21e14-f221-46b5-8d88-2812fbe9ab45.jpg","productPrice":"29.80","promotionPrice":"29.80","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1461261296623157248","skuPrice":29.8,"skuStock":100}],"isDelete":0},{"id":"1478267723803787264","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461263843052224512","productName":"心耕年糕400g/袋*6","productImg":"https://pos.upload.gznl.top/1179/2021/11/3f3fcf7a-c477-4a6b-a689-89b1ff4c3528.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461263843098361856","skuPrice":88,"skuStock":50}],"isDelete":0},{"id":"1478267723807981568","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461626570010525696","productName":"枣糕方芝麻丸 150g/罐","productImg":"https://pos.upload.gznl.top/1179/2021/11/dad36dd4-e859-4d19-8c75-7d3702d8a2b4.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461626570077634560","skuPrice":88,"skuStock":50}],"isDelete":0}]}] class ActivityAreaList { ActivityAreaList({ @@ -39,8 +37,8 @@ class ActivityAreaList { } -/// actTime : {"id":"1473198590141661184","createTime":"2021-12-21 15:48:09","createUser":"1333246101196636160","updateTime":"2021-12-21 15:48:09","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","allDay":false,"startHour":"09:00:00","endHour":"10:00:00","isDelete":0} -/// productList : [{"id":"1473543964270264320","createTime":"2021-12-22 14:40:33","createUser":"1333246101196636160","updateTime":"2021-12-22 14:40:33","updateUser":"1333246101196636160","storeId":"1333246101343436800","templateId":"1473198577613275136","timeId":"1473198590141661184","productId":"1425724410261667840","productName":"西瓜椰椰甘露","productImg":"https://pos.upload.gznl.top/1177/2021/08/3471058e-ac5e-47dd-8ed5-148e8cb28316.jpg","productPrice":"15.00","promotionPrice":"15.00","productStock":2847,"sellCount":0,"skuJson":[{"skuId":"1425724410358136832","skuPrice":15,"skuStock":996},{"skuId":"1425724410387496960","skuPrice":15,"skuStock":851},{"skuId":"1425724410454605824","skuPrice":15,"skuStock":1000}],"isDelete":0}] +/// actTime : {"id":"1478267569205936128","createTime":"2022-01-04 15:30:28","createUser":"1364043181062094848","updateTime":"2022-01-04 15:30:28","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","allDay":true,"startHour":null,"endHour":null,"isDelete":0} +/// productList : [{"id":"1478267723770232832","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","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},{"id":"1478267723787010048","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460896670593056768","productName":"甄果酥","productImg":"https://pos.upload.gznl.top/1179/2021/11/c4e6ea91-9cc1-4f5f-86e3-91e323ab2d53.jpg","productPrice":"78.00","promotionPrice":"78.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460896670697914368","skuPrice":78,"skuStock":100}],"isDelete":0},{"id":"1478267723791204352","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460899864027070464","productName":"肺宝酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/ccf4293f-004c-4450-bcc7-c45e47444fe3.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460899864102567936","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398656","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1460901466356056064","productName":"纤盈酵素","productImg":"https://pos.upload.gznl.top/1179/2021/11/49931aa8-7eda-4df2-876f-a6fa19ac0682.jpg","productPrice":"328.00","promotionPrice":"328.00","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1460901466435747840","skuPrice":328,"skuStock":100}],"isDelete":0},{"id":"1478267723795398657","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461168275898499072","productName":"生态桂圆","productImg":"https://pos.upload.gznl.top/1179/2021/11/eeef5404-5533-46fc-b650-0901e0cf4580.jpg","productPrice":"60.00","promotionPrice":"60.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461168275957219328","skuPrice":60,"skuStock":100},{"skuId":"1461168275982385152","skuPrice":170,"skuStock":100}],"isDelete":0},{"id":"1478267723799592960","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461261296568631296","productName":"麦芽糖","productImg":"https://pos.upload.gznl.top/1179/2021/11/2dd21e14-f221-46b5-8d88-2812fbe9ab45.jpg","productPrice":"29.80","promotionPrice":"29.80","productStock":100,"sellCount":0,"skuJson":[{"skuId":"1461261296623157248","skuPrice":29.8,"skuStock":100}],"isDelete":0},{"id":"1478267723803787264","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461263843052224512","productName":"心耕年糕400g/袋*6","productImg":"https://pos.upload.gznl.top/1179/2021/11/3f3fcf7a-c477-4a6b-a689-89b1ff4c3528.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461263843098361856","skuPrice":88,"skuStock":50}],"isDelete":0},{"id":"1478267723807981568","createTime":"2022-01-04 15:31:05","createUser":"1364043181062094848","updateTime":"2022-01-04 15:31:05","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1478267568996220928","timeId":"1478267569205936128","productId":"1461626570010525696","productName":"枣糕方芝麻丸 150g/罐","productImg":"https://pos.upload.gznl.top/1179/2021/11/dad36dd4-e859-4d19-8c75-7d3702d8a2b4.jpg","productPrice":"88.00","promotionPrice":"88.00","productStock":50,"sellCount":0,"skuJson":[{"skuId":"1461626570077634560","skuPrice":88,"skuStock":50}],"isDelete":0}] class TimeProductList { TimeProductList({ @@ -78,22 +76,22 @@ class TimeProductList { } -/// id : "1473543964270264320" -/// createTime : "2021-12-22 14:40:33" -/// createUser : "1333246101196636160" -/// updateTime : "2021-12-22 14:40:33" -/// updateUser : "1333246101196636160" -/// storeId : "1333246101343436800" -/// templateId : "1473198577613275136" -/// timeId : "1473198590141661184" -/// productId : "1425724410261667840" -/// productName : "西瓜椰椰甘露" -/// productImg : "https://pos.upload.gznl.top/1177/2021/08/3471058e-ac5e-47dd-8ed5-148e8cb28316.jpg" -/// productPrice : "15.00" -/// promotionPrice : "15.00" -/// productStock : 2847 +/// id : "1478267723770232832" +/// createTime : "2022-01-04 15:31:05" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:31:05" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1478267568996220928" +/// timeId : "1478267569205936128" +/// 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":"1425724410358136832","skuPrice":15,"skuStock":996},{"skuId":"1425724410387496960","skuPrice":15,"skuStock":851},{"skuId":"1425724410454605824","skuPrice":15,"skuStock":1000}] +/// skuJson : [{"skuId":"1460886581089927168","skuPrice":88,"skuStock":0}] /// isDelete : 0 class ProductList { @@ -112,9 +110,9 @@ class ProductList { String productPrice, String promotionPrice, int productStock, - int sellCount, + dynamic sellCount, List skuJson, - int isDelete,}){ + dynamic isDelete,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -174,7 +172,7 @@ class ProductList { int _productStock; int _sellCount; List _skuJson; - int _isDelete; + dynamic _isDelete; String get id => _id; String get createTime => _createTime; @@ -192,7 +190,7 @@ class ProductList { int get productStock => _productStock; int get sellCount => _sellCount; List get skuJson => _skuJson; - int get isDelete => _isDelete; + dynamic get isDelete => _isDelete; Map toJson() { final map = {}; @@ -220,15 +218,15 @@ class ProductList { } -/// skuId : "1425724410358136832" -/// skuPrice : 15 -/// skuStock : 996 +/// skuId : "1460886581089927168" +/// skuPrice : 88 +/// skuStock : 0 class SkuJson { SkuJson({ String skuId, - int skuPrice, - int skuStock,}){ + dynamic skuPrice, + dynamic skuStock,}){ _skuId = skuId; _skuPrice = skuPrice; _skuStock = skuStock; @@ -240,12 +238,12 @@ class SkuJson { _skuStock = json['skuStock']; } String _skuId; - int _skuPrice; - int _skuStock; + dynamic _skuPrice; + dynamic _skuStock; String get skuId => _skuId; - int get skuPrice => _skuPrice; - int get skuStock => _skuStock; + dynamic get skuPrice => _skuPrice; + dynamic get skuStock => _skuStock; Map toJson() { final map = {}; @@ -257,16 +255,16 @@ class SkuJson { } -/// id : "1473198590141661184" -/// createTime : "2021-12-21 15:48:09" -/// createUser : "1333246101196636160" -/// updateTime : "2021-12-21 15:48:09" -/// updateUser : "1333246101196636160" -/// storeId : "1333246101343436800" -/// templateId : "1473198577613275136" -/// allDay : false -/// startHour : "09:00:00" -/// endHour : "10:00:00" +/// id : "1478267569205936128" +/// createTime : "2022-01-04 15:30:28" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:30:28" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// templateId : "1478267568996220928" +/// allDay : true +/// startHour : null +/// endHour : null /// isDelete : 0 class ActTime { @@ -279,9 +277,9 @@ class ActTime { String storeId, String templateId, bool allDay, - String startHour, - String endHour, - int isDelete,}){ + dynamic startHour, + dynamic endHour, + dynamic isDelete,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -316,9 +314,9 @@ class ActTime { String _storeId; String _templateId; bool _allDay; - String _startHour; - String _endHour; - int _isDelete; + dynamic _startHour; + dynamic _endHour; + dynamic _isDelete; String get id => _id; String get createTime => _createTime; @@ -328,9 +326,9 @@ class ActTime { String get storeId => _storeId; String get templateId => _templateId; bool get allDay => _allDay; - String get startHour => _startHour; - String get endHour => _endHour; - int get isDelete => _isDelete; + dynamic get startHour => _startHour; + dynamic get endHour => _endHour; + dynamic get isDelete => _isDelete; Map toJson() { final map = {}; @@ -350,22 +348,24 @@ class ActTime { } -/// id : "1473198577613275136" -/// createTime : "2021-12-21 15:48:06" -/// createUser : "1333246101196636160" -/// updateTime : "2021-12-21 15:48:06" -/// updateUser : "1333246101196636160" -/// storeId : "1333246101343436800" -/// type : 2 -/// limitTime : null -/// limitNumber : 0 -/// coverImg : "https://pos.upload.gznl.top/1175/2021/12/5bf7a846-768b-4a17-872f-e927988c24c9.jpg" -/// shareImg : "https://pos.upload.gznl.top/1175/2021/12/65f6a0f7-14d1-4393-902e-42e5dc464800.jpg" -/// bannerImg : "https://pos.upload.gznl.top/1175/2021/12/9ee395eb-718c-40c0-bfe0-673dbbade4cf.jpg" +/// id : "1478267568996220928" +/// createTime : "2022-01-04 15:30:28" +/// createUser : "1364043181062094848" +/// updateTime : "2022-01-04 15:30:28" +/// updateUser : "1364043181062094848" +/// storeId : "1460885296764682240" +/// actName : "砍价" +/// actDesc : "" +/// type : 3 +/// limitTime : 2 +/// limitNumber : 5 +/// coverImg : "https://pos.upload.gznl.top/1179/2022/01/792bda39-3c2e-434f-8e57-02c62163add4.png" +/// shareImg : "https://pos.upload.gznl.top/1179/2022/01/68f9b6d4-16a8-4bcf-aab6-09f95d1d2a9a.png" +/// bannerImg : "https://pos.upload.gznl.top/1179/2022/01/5efd74a8-be45-4723-a878-0513d6bfd9f8.png" /// state : 1 -/// allDay : false -/// startTime : "2021-12-20 00:00:00" -/// endTime : "2021-12-30 00:00:00" +/// allDay : true +/// startTime : "2022-01-01 00:00:00" +/// endTime : "2022-01-31 00:00:00" /// isDelete : 0 class ActTemplate { @@ -376,23 +376,27 @@ class ActTemplate { String updateTime, String updateUser, String storeId, - int type, + String actName, + String actDesc, + dynamic type, dynamic limitTime, - int limitNumber, + dynamic limitNumber, String coverImg, String shareImg, String bannerImg, - int state, + dynamic state, bool allDay, String startTime, String endTime, - int isDelete,}){ + dynamic isDelete,}){ _id = id; _createTime = createTime; _createUser = createUser; _updateTime = updateTime; _updateUser = updateUser; _storeId = storeId; + _actName = actName; + _actDesc = actDesc; _type = type; _limitTime = limitTime; _limitNumber = limitNumber; @@ -413,6 +417,8 @@ class ActTemplate { _updateTime = json['updateTime']; _updateUser = json['updateUser']; _storeId = json['storeId']; + _actName = json['actName']; + _actDesc = json['actDesc']; _type = json['type']; _limitTime = json['limitTime']; _limitNumber = json['limitNumber']; @@ -431,17 +437,19 @@ class ActTemplate { String _updateTime; String _updateUser; String _storeId; - int _type; + String _actName; + String _actDesc; + dynamic _type; dynamic _limitTime; - int _limitNumber; + dynamic _limitNumber; String _coverImg; String _shareImg; String _bannerImg; - int _state; + dynamic _state; bool _allDay; String _startTime; String _endTime; - int _isDelete; + dynamic _isDelete; String get id => _id; String get createTime => _createTime; @@ -449,17 +457,19 @@ class ActTemplate { String get updateTime => _updateTime; String get updateUser => _updateUser; String get storeId => _storeId; - int get type => _type; + String get actName => _actName; + String get actDesc => _actDesc; + dynamic get type => _type; dynamic get limitTime => _limitTime; - int get limitNumber => _limitNumber; + dynamic get limitNumber => _limitNumber; String get coverImg => _coverImg; String get shareImg => _shareImg; String get bannerImg => _bannerImg; - int get state => _state; + dynamic get state => _state; bool get allDay => _allDay; String get startTime => _startTime; String get endTime => _endTime; - int get isDelete => _isDelete; + dynamic get isDelete => _isDelete; Map toJson() { final map = {}; @@ -469,6 +479,8 @@ class ActTemplate { map['updateTime'] = _updateTime; map['updateUser'] = _updateUser; map['storeId'] = _storeId; + map['actName'] = _actName; + map['actDesc'] = _actDesc; map['type'] = _type; map['limitTime'] = _limitTime; map['limitNumber'] = _limitNumber; diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 3bbcaac4..1a7adc3e 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -31,14 +31,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) @@ -168,7 +168,7 @@ abstract class MinApiService { ///修改购物车商品数量 @PUT("shoppingcart/single") - Future>> shoppingCartSingle(@Body() Map param); + Future shoppingCartSingle(@Body() Map param); ///订单结算信息 @POST("order/getOrderInfo") @@ -215,8 +215,24 @@ abstract class MinApiService { Future> homeConfig(); ///活动专区,秒杀,砍价,拼团 - @GET("/actTemplate/findActListByType?allDay={allDay}&type={type}") + @GET("actTemplate/findActListByType?allDay={allDay}&type={type}") Future> findActListByType(@Path("allDay") bool allDay, @Path("type") String type); + // /// APP、小程序点击查看活动列表的某一个活动详情 + // @GET("actTemplate/viewProduct?actProductId={actProductId}&type={type}") + // Future>> viewProduct(); + // + // /// 活动付款 + // @POST("actTemplate/actPay") + // Future actPay(@Body() Map param); + // + // /// 参与活动 + // @POST("actTemplate/joinAct") + // Future joinAct(@Body() Map param); + // + // /// 发起活动 + // @POST("actTemplate/launchAct") + // Future launchAct(@Body() Map param); + } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index cdf05a72..4e7fb979 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; @@ -176,14 +176,13 @@ class _MinApiService implements MinApiService { } @override - Future>> shoppingCartSingle(param) async { + Future> shoppingCartSingle(param) async { ArgumentError.checkNotNull(param, 'param'); const _extra = {}; final queryParameters = {}; final _data = {}; _data.addAll(param ?? {}); - final _result = await _dio.request>( - 'shoppingcart/single', + final _result = await _dio.request>('shoppingcart/single', queryParameters: queryParameters, options: RequestOptions( method: 'PUT', @@ -191,15 +190,14 @@ class _MinApiService implements MinApiService { extra: _extra, baseUrl: baseUrl), data: _data); - final value = BaseData>.fromJson( - _result.data, - (json) => (json as List) - .map( - (i) => ShoppingCart.fromJson(i as Map)) - .toList()); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); return value; } + @override Future> getOrderInfo(param) async { ArgumentError.checkNotNull(param, 'param'); @@ -467,4 +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; + // } + } 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 4b3b5482..8c6f6934 100644 --- a/lib/store/shopping/activity_prefecture_details.dart +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.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:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -21,6 +22,7 @@ class ActivityPrefectureDetails extends StatefulWidget { final Map arguments; ActivityPrefectureDetails({this.arguments}); + @override State createState() { return _ActivityPrefectureDetails(); @@ -103,7 +105,7 @@ class _ActivityPrefectureDetails extends State { minToken = baseData.data["token"]; queryStoreInfo(); SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minToken', minToken), value.setString('tenant', tenant), value.setString('storeId', storeId), @@ -117,8 +119,7 @@ class _ActivityPrefectureDetails extends State { storeId: storeId, showLoading: false, ); - - queryStoreInfo(); + queryFindActListByType(pageType == "2" ? false : true); EasyLoading.dismiss(); } @@ -127,8 +128,9 @@ class _ActivityPrefectureDetails extends State { /// 查询店铺信息 queryStoreInfo() async { - BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { - debugPrint(error); + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error.toString()); }); if (baseData != null && baseData.isSuccess) { storeInfo = StoreInfo.fromJson(baseData.data); @@ -144,8 +146,9 @@ class _ActivityPrefectureDetails extends State { ///秒杀/砍价/拼团列表 queryFindActListByType(allDay) async { - BaseData baseData = - await minService.findActListByType(allDay,pageType).catchError((error) { + BaseData baseData = await minService + .findActListByType(allDay, pageType) + .catchError((error) { refreshController.refreshFailed(); }); setState(() { @@ -175,25 +178,24 @@ class _ActivityPrefectureDetails extends State { ///限天秒杀时间 startCountdownTimer() { - if(_timer != null) - return; + if (_timer != null) return; const oneSec = const Duration(seconds: 1); - var callback = ((timer){ - if(isDispose) - return; + var callback = ((timer) { + if (isDispose) return; setState(() { - var tempDateTime = DateTime.parse(actTemplate.endTime).difference(DateTime.now()); - if(tempDateTime.inSeconds <0){ + var tempDateTime = + DateTime.parse(actTemplate.endTime).difference(DateTime.now()); + if (tempDateTime.inSeconds < 0) { tempDay = 0; tempHour = 0; - tempM = 0; - tempS = 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); + tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60); + tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60); }); }); _timer = Timer.periodic(oneSec, callback); @@ -201,16 +203,30 @@ class _ActivityPrefectureDetails extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - physics: BouncingScrollPhysics(), - controller: _scrollController, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - seckillProduct(), - seckilList(), - ], + return Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() { + queryFindActListByType(pageType == "2" ? false : true); + }); + }, + child:SingleChildScrollView( + physics: BouncingScrollPhysics(), + controller: _scrollController, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + seckillProduct(), + seckilList(), + ], + ), + ), ), ); } @@ -233,182 +249,187 @@ class _ActivityPrefectureDetails extends State { child: Column( children: [ swiper(), - pageType == "2"?(seckillIndex == 0 - ? Container( - width: double.infinity, - alignment: Alignment.center, - height: 62.h, - padding: EdgeInsets.only(left: 16.w, right: 16.w), - decoration: BoxDecoration(color: Color(0xFFFFEED9)), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/ms.png", - width: 38, - height: 38, - fit: BoxFit.contain, - ), - SizedBox( - width: 14.w, - ), - Expanded( - child: ListView.builder( - scrollDirection: Axis.horizontal, - physics: BouncingScrollPhysics(), - itemCount: actTimeList?.length ?? 0, - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() { - actTimeListIndex = position; - productList.clear(); - productList.addAll(actTimeList[actTimeListIndex].productList); - }); + pageType == "2" + ? (seckillIndex == 0 + ? Container( + width: double.infinity, + alignment: Alignment.center, + height: 62.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: BoxDecoration(color: Color(0xFFFFEED9)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/ms.png", + width: 38, + height: 38, + fit: BoxFit.contain, + ), + SizedBox( + width: 14.w, + ), + Expanded( + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemCount: actTimeList?.length ?? 0, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + actTimeListIndex = position; + productList.clear(); + productList.addAll( + actTimeList[actTimeListIndex] + .productList); + }); + }, + child: + timeItem(actTimeList[position], position), + ); }, - child: timeItem(actTimeList[position], position), - ); - }, - )), - ], - ), - ) - : Container( - width: double.infinity, - alignment: Alignment.center, - height: 62.h, - padding: EdgeInsets.only(left: 16.w, right: 16.w), - decoration: BoxDecoration(color: Color(0xFFFFEED9)), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/ms_t.png", - width: 38, - height: 38, - fit: BoxFit.contain, - ), - Spacer(), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "距秒杀结束还有", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Colors.black, - ), - ), - TextSpan( - text: tempDay.toString(), - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFFFB312B), - ), - ), - TextSpan( - text: "天", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Colors.black, - ), - ), - ], - ), + )), + ], ), - SizedBox(width: 4.w), - Row( - mainAxisAlignment: MainAxisAlignment.center, + ) + : Container( + width: double.infinity, + alignment: Alignment.center, + height: 62.h, + padding: EdgeInsets.only(left: 16.w, right: 16.w), + decoration: BoxDecoration(color: Color(0xFFFFEED9)), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - InkWell( - onTap: () { - setState(() {}); - }, - child: Container( - width: 20, - height: 20, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFFFB312B), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempHour.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + Image.asset( + "assets/image/ms_t.png", + width: 38, + height: 38, + fit: BoxFit.contain, + ), + Spacer(), + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "距秒杀结束还有", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), ), - ), + TextSpan( + text: tempDay.toString(), + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFFB312B), + ), + ), + TextSpan( + text: "天", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, + ), + ), + ], ), ), - Padding( - padding: EdgeInsets.only(left: 2.w, right: 2.w), - child: Text( - ":", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xFFFB312B), + SizedBox(width: 4.w), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempHour.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), ), - ), - ), - Container( - width: 20, - height: 20, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFFFB312B), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempM.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + Padding( + padding: EdgeInsets.only(left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFFFB312B), + ), + ), ), - ), - ), - Padding( - padding: EdgeInsets.only(left: 2.w, right: 2.w), - child: Text( - ":", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xFFFB312B), + Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempM.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), ), - ), - ), - InkWell( - onTap: () {}, - child: Container( - width: 20, - height: 20, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFFFB312B), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempS.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + Padding( + padding: EdgeInsets.only(left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFFFB312B), + ), ), ), - ), - ), + InkWell( + onTap: () {}, + child: Container( + width: 20, + height: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(1)), + child: Text( + tempS.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + ], + ) ], - ) - ], - ), - )) :Container(), + ), + )) + : Container(), ], ), ); @@ -422,15 +443,18 @@ class _ActivityPrefectureDetails extends State { child: Stack( children: [ Positioned( - top: 0,left: 0,right: 0,bottom: 0, + top: 0, + left: 0, + right: 0, + bottom: 0, child: MImage( - actTemplate?.coverImg ?? "", - width: double.infinity, - height: 330.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - )), + actTemplate?.coverImg ?? "", + width: double.infinity, + height: 330.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + )), GestureDetector( onTap: () { Navigator.of(context).pop(); @@ -445,113 +469,114 @@ class _ActivityPrefectureDetails extends State { ), ), ), - pageType == "2" ? - Align( - alignment: Alignment.topCenter, - child: Container( - margin: EdgeInsets.only(top: 52), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Color.fromRGBO(0, 0, 0, 69000000), - ), - width: 160.w, - height:35.h, - child: Row( - children: [ - GestureDetector( - onTap: () { - setState(() { - seckillIndex = 0; - queryFindActListByType(false); - }); - }, - child: Container( - alignment: Alignment.center, - width: 72.w, - height: 25.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - seckillIndex == 0 - ? Color(0xFFF67E5F) - : Colors.transparent, - seckillIndex == 0 - ? Color(0xFFFC5237) - : Colors.transparent, - ]), - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Opacity( - opacity: seckillIndex == 0 ? 1 : 0.5, - child: Text( - "限时秒杀", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ))), - GestureDetector( - onTap: () { - setState(() { - seckillIndex = 1; - queryFindActListByType(true); - }); - }, - child: Container( - alignment: Alignment.center, - width: 72.w, - height: 25.h, - margin: EdgeInsets.only(left: 6.w), - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - seckillIndex == 1 - ? Color(0xFFF67E5F) - : Colors.transparent, - seckillIndex == 1 - ? Color(0xFFFC5237) - : Colors.transparent, - ]), - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Opacity( - opacity: seckillIndex == 1 ? 1 : 0.5, - child: Text( - "限天秒杀", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ))), - ], - ), - ), - ) : Container(), + pageType == "2" + ? Align( + alignment: Alignment.topCenter, + child: Container( + margin: EdgeInsets.only(top: 52), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Color.fromRGBO(0, 0, 0, 69000000), + ), + width: 160.w, + height: 35.h, + child: Row( + children: [ + GestureDetector( + onTap: () { + setState(() { + seckillIndex = 0; + queryFindActListByType(false); + }); + }, + child: Container( + alignment: Alignment.center, + width: 72.w, + height: 25.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + seckillIndex == 0 + ? Color(0xFFF67E5F) + : Colors.transparent, + seckillIndex == 0 + ? Color(0xFFFC5237) + : Colors.transparent, + ]), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Opacity( + opacity: seckillIndex == 0 ? 1 : 0.5, + child: Text( + "限时秒杀", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ))), + GestureDetector( + onTap: () { + setState(() { + seckillIndex = 1; + queryFindActListByType(true); + }); + }, + child: Container( + alignment: Alignment.center, + width: 72.w, + height: 25.h, + margin: EdgeInsets.only(left: 6.w), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerRight, + end: Alignment.centerLeft, + colors: [ + seckillIndex == 1 + ? Color(0xFFF67E5F) + : Colors.transparent, + seckillIndex == 1 + ? Color(0xFFFC5237) + : Colors.transparent, + ]), + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Opacity( + opacity: seckillIndex == 1 ? 1 : 0.5, + child: Text( + "限天秒杀", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ))), + ], + ), + ), + ) + : Container(), ], ), ), @@ -566,48 +591,48 @@ class _ActivityPrefectureDetails extends State { MediaQuery.of(context).padding.top, padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), color: Colors.white, - child: productList.length == 0 ? - Container( - 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, + child: productList.length == 0 + ? Container( + 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, + }, + ); + }); }, + child: seckilItem(productList[position]), ); - }); - }, - child: seckilItem(productList[position]), - ); - }, - ), + }, + ), ); } int timeFlag(String time) { - if(time == null) - return 0; + if (time == null) return 0; var now = DateTime.now().hour; var tHour = int.tryParse(time.substring(0, 2)); if (now < tHour) @@ -752,7 +777,7 @@ class _ActivityPrefectureDetails extends State { width: 12.w, ), Expanded( - child:Column( + child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -774,7 +799,7 @@ class _ActivityPrefectureDetails extends State { color: Color(0xFF4D4D4D), ), ), - if(pageType == "2") + if (pageType == "2") Row( children: [ ClipRRect( @@ -787,16 +812,22 @@ class _ActivityPrefectureDetails extends State { color: Color(0xFFF5F5F5), ), Container( - width:productList.sellCount == 0 ? 0 :(((productList?.sellCount ?? 0)/(productList?.productStock ?? 0)) * 180.w).toDouble(), + width: productList.sellCount == null + ? 0 + : (((productList?.sellCount ?? 0) / + (productList?.productStock ?? + 0)) * + 180.w) + .toDouble(), height: 8.h, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - Color(0xFFFDBA56), - Color(0xFFFB2B2B) - ])), + Color(0xFFFDBA56), + Color(0xFFFB2B2B) + ])), ) ], )), @@ -813,7 +844,7 @@ class _ActivityPrefectureDetails extends State { ), ], ), - if(pageType == "3") + if (pageType == "3") Row( children: [ Container( @@ -835,10 +866,10 @@ class _ActivityPrefectureDetails extends State { Spacer(), ], ), - if(pageType == "1") - Container( - height: 22.h, - ), + if (pageType == "1") + Container( + height: 22.h, + ), Row( children: [ Text.rich( @@ -849,7 +880,9 @@ class _ActivityPrefectureDetails extends State { style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.semi_bold, - color: pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C), + color: pageType == "3" + ? Color(0xFF9476F7) + : Color(0xFFFB2E2C), ), ), TextSpan( @@ -857,7 +890,9 @@ class _ActivityPrefectureDetails extends State { style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.semi_bold, - color:pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C), + color: pageType == "3" + ? Color(0xFF9476F7) + : Color(0xFFFB2E2C), ), ), ], @@ -867,7 +902,7 @@ class _ActivityPrefectureDetails extends State { child: Text( productList.productPrice, style: TextStyle( - fontSize:11.sp, + fontSize: 11.sp, decoration: TextDecoration.lineThrough, decorationColor: Color(0xFF353535), fontWeight: MyFontWeight.regular, @@ -875,66 +910,117 @@ class _ActivityPrefectureDetails extends State { ), ), ), - if(pageType == "2") - (seckillIndex == 0 ? - (tStatus == 0 - ? Container( - alignment: Alignment.center, - width: 60.w, - height: 24.h, - decoration: BoxDecoration( - color: Color(0xFFE2F6EA), - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Text( - "即将开始", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF52AF79), - ), - ), - ) - : (tStatus == 1 - ? Container( - alignment: Alignment.center, - width: 60.w, - height: 24.h, - decoration: BoxDecoration( - color: Color(0xFFFB312B), - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Text( - "马上抢", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ) + if (pageType == "2") + (seckillIndex == 0 + ? (tStatus == 0 + ? Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFE2F6EA), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "即将开始", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF52AF79), + ), + ), + ) + : (tStatus == 1 + ? Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "马上抢", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ) + : Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "已结束", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFFADADAD), + ), + ), + ))) : Container( + alignment: Alignment.center, + width: 60.w, + height: 24.h, + decoration: BoxDecoration( + color: Color(0xFFFB312B), + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ), + ], + ), + child: Text( + "马上抢", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + )), + if (pageType == "1") + Container( alignment: Alignment.center, width: 60.w, height: 24.h, decoration: BoxDecoration( - color: Colors.transparent, + color: Color(0xFFFB2E2C), borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -946,19 +1032,21 @@ class _ActivityPrefectureDetails extends State { ], ), child: Text( - "已结束", + "立即开团", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFFADADAD), + color: Colors.white, ), ), - ))) : Container( + ), + if (pageType == "3") + Container( alignment: Alignment.center, width: 60.w, height: 24.h, decoration: BoxDecoration( - color: Color(0xFFFB312B), + color: Color(0xFF9476F7), borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -970,66 +1058,14 @@ class _ActivityPrefectureDetails extends State { ], ), child: Text( - "马上抢", + "我要砍价", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, color: Colors.white, ), ), - )), - if(pageType == "1") - Container( - alignment: Alignment.center, - width: 60.w, - height: 24.h, - decoration: BoxDecoration( - color: Color(0xFFFB2E2C), - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Text( - "立即开团", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ), - if(pageType == "3") - Container( - alignment: Alignment.center, - width: 60.w, - height: 24.h, - decoration: BoxDecoration( - color: Color(0xFF9476F7), - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ), - ], - ), - child: Text( - "我要砍价", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, - ), - ), - ) + ) ], ), ], diff --git a/lib/store/shopping/shopping_cart/shopping_cart_page.dart b/lib/store/shopping/shopping_cart/shopping_cart_page.dart index 3e5b9864..3a7b98bc 100644 --- a/lib/store/shopping/shopping_cart/shopping_cart_page.dart +++ b/lib/store/shopping/shopping_cart/shopping_cart_page.dart @@ -53,10 +53,12 @@ class _ShoppingCartPage extends State ///清空购物车 clearShopCar() async { - BaseData baseData = await minService.clearShoppingCart(); - if (baseData.isSuccess) { - queryShopCar(); - } + shopCarGoods[0].shoppingCartSkuItemList.forEach((element) { + if(element.selected == 1){ + shopCartAdd(element,-element.buyNum,element.selected); + } + }); + queryShopCar(); } ///去下单结算页面 @@ -154,7 +156,7 @@ class _ShoppingCartPage extends State cartSkuItem.selected = selected; shopCarTemp["selected"] = selected; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; - BaseData> baseDate = + BaseData baseDate = await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { setState(() { @@ -267,6 +269,7 @@ class _ShoppingCartPage extends State isAllSelect = !isAllSelect; shopCarGoods[0].shoppingCartSkuItemList.forEach((element) { element.selected = isAllSelect?1:0; + shopCartAdd(element,0,element.selected); }); }); }, diff --git a/lib/store/shopping/shopping_home/recommend_goods_list_view.dart b/lib/store/shopping/shopping_home/recommend_goods_list_view.dart index 0aa43985..d6c64326 100644 --- a/lib/store/shopping/shopping_home/recommend_goods_list_view.dart +++ b/lib/store/shopping/shopping_home/recommend_goods_list_view.dart @@ -145,14 +145,14 @@ class _RecommendGoodsListView extends State { Container( margin: EdgeInsets.only(top: 8, right: 8), padding: EdgeInsets.only(left: 2, right: 2), - height: 17.h, + height: 18.h, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: Color(0xFF5A5A5A), ), child: Text( - homeRecommendList?.supplierName ?? "", + AppUtils.textSubStr(homeRecommendList?.supplierName ?? "",8), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -226,4 +226,5 @@ class _RecommendGoodsListView extends State { ), ); } + } diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index d9b016bc..3c070a05 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -164,4 +164,11 @@ class AppUtils { } } } + + static String textSubStr(String input, int length) { + length -= 1; + if(length < 0 || input.length < length) + return input; + return "${input.substring(0,length)}..."; + } }