diff --git a/lib/retrofit/data/activity_details.dart b/lib/retrofit/data/activity_details.dart index d3a32e7a..b8b1c3ec 100644 --- a/lib/retrofit/data/activity_details.dart +++ b/lib/retrofit/data/activity_details.dart @@ -458,6 +458,9 @@ class ActProduct { int sellCount, List skuJson, int isDelete, + String shortName, + String supplierName, + String detail, }) { _id = id; _createTime = createTime; @@ -476,6 +479,9 @@ class ActProduct { _sellCount = sellCount; _skuJson = skuJson; _isDelete = isDelete; + _shortName = shortName; + _supplierName =supplierName; + _detail = detail; } ActProduct.fromJson(dynamic json) { @@ -501,6 +507,9 @@ class ActProduct { }); } _isDelete = json['isDelete']; + _shortName = json['shortName']; + _supplierName = json['supplierName']; + _detail = json['detail']; } String _id; @@ -520,6 +529,9 @@ class ActProduct { int _sellCount; List _skuJson; int _isDelete; + String _shortName; + String _supplierName; + String _detail; String get id => _id; @@ -555,6 +567,12 @@ class ActProduct { int get isDelete => _isDelete; + String get shortName => _shortName; + + String get supplierName => _supplierName; + + String get detail => _detail; + Map toJson() { final map = {}; map['id'] = _id; @@ -576,6 +594,9 @@ class ActProduct { map['skuJson'] = _skuJson.map((v) => v.toJson()).toList(); } map['isDelete'] = _isDelete; + map['shortName'] = _shortName; + map['supplierName'] = _supplierName; + map['detail'] = _detail; return map; } } @@ -587,7 +608,7 @@ class ActProduct { class SkuJson { SkuJson({ String skuId, - int skuPrice, + String skuPrice, int skuStock, }) { _skuId = skuId; @@ -602,12 +623,12 @@ class SkuJson { } String _skuId; - int _skuPrice; + String _skuPrice; int _skuStock; String get skuId => _skuId; - int get skuPrice => _skuPrice; + String get skuPrice => _skuPrice; int get skuStock => _skuStock; diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 6746a55c..1b7d24cd 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -39,8 +39,8 @@ part 'min_api.g.dart'; // const baseUrl = "http://192.168.10.236:8765/app/";///费韬 -const base_url = "http://192.168.10.114:8775/app/";///詹云久 -const baseUrl = "http://192.168.10.114:8775/app/";///詹云久 +const base_url = "http://192.168.10.66:8775/app/";///詹云久 +const baseUrl = "http://192.168.10.66:8775/app/";///詹云久 // const base_url = "http://192.168.10.37:8766/app/"; diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 337f1db1..1c268f85 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.114:8775/app/'; + baseUrl ??= 'http://192.168.10.66:8775/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 73666c98..ac8c2789 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -71,8 +71,8 @@ part 'retrofit_api.g.dart'; // const baseUrl = "http://192.168.10.37:8766/app/"; -const base_url = "http://192.168.10.114:8776/app/";///詹云久 -const baseUrl = "http://192.168.10.114:8776/app/";///詹云久 +const base_url = "http://192.168.10.66:8776/app/";///詹云久 +const baseUrl = "http://192.168.10.66:8776/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index c5b10332..55bd06ea 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.114:8776/app/'; + baseUrl ??= 'http://192.168.10.66:8776/app/'; } final Dio _dio; diff --git a/lib/store/shopping/activity_prefecture_details.dart b/lib/store/shopping/activity_prefecture_details.dart index 69ac1b9f..6df5c1fe 100644 --- a/lib/store/shopping/activity_prefecture_details.dart +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -873,7 +873,7 @@ class _ActivityPrefectureDetails extends State { color: Color(0xFFFFCD00), ), child: Text( - "最高可砍50元", + "最高可砍${double.parse(productList?.productPrice ?? "0") - double.parse(productList?.promotionPrice ?? "0")}元", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index 05a055be..2d858bca 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -5,6 +5,7 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.dart'; @@ -75,6 +76,8 @@ class _ShoppingGoodsDetails extends State { Timer _timer; String testTime = "2021-12-30 10:00:00"; LaunchJoinAct launchJoinAct; + int bargainType = 0; + String indexP; @override void dispose() { @@ -150,11 +153,12 @@ class _ShoppingGoodsDetails extends State { ///会员信息 queryMemberInfo() async { - BaseData baseData = await minService.memberInfo() - .catchError((error){debugPrint(error);}); + BaseData baseData = await minService.memberInfo().catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minMember', jsonEncode(baseData.data)), }, ); @@ -197,8 +201,7 @@ class _ShoppingGoodsDetails extends State { if (baseData != null && baseData.isSuccess) { setState(() { miNiDetail = baseData.data; - if (pageType != null) - queryViewProduct(actProductId, pageType); + if (pageType != null) queryViewProduct(actProductId, pageType); }); refreshController.refreshCompleted(); } else { @@ -254,16 +257,19 @@ class _ShoppingGoodsDetails extends State { showLoading: false, ); BaseData baseData = await minService.launchAct({ - "actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id, + "actProductId": pageType == null + ? miNiDetail.productSkuVOList[0].id + : activityDetails.actProduct.id, "actRecordId": 0, "actTemplateId": activityDetails.actProduct.templateId, "actTimeId": activityDetails.actProduct.timeId, - "addressId":"", - "isDirectBuy":pageType == "3" ? false : true, + "addressId": "", + "isDirectBuy": (bargainType == 1 || bargainType == 2) ? false : true, "getType": 1, - "productId": pageType == null ? productId :activityDetails.actProduct.productId, + "productId": + pageType == null ? productId : activityDetails.actProduct.productId, "skuId": skuId1, - "skuPrice":skuPrice1, + "skuPrice": skuPrice1, "templateType": pageType }).catchError((error) { refreshController.refreshFailed(); @@ -271,14 +277,16 @@ class _ShoppingGoodsDetails extends State { if (baseData != null && baseData.isSuccess) { setState(() { launchJoinAct = baseData.data; - if(pageType == "3"){ + if (bargainType == 1) { toBargain(); - }else{ + } else { toOrder(); } refreshController.refreshCompleted(); }); } else { + if((activityDetails?.actProduct?.productStock ?? 0) == 0) + SmartDialog.showToast("活动商品售罄",alignment: Alignment.center); refreshController.refreshFailed(); } } @@ -286,16 +294,19 @@ class _ShoppingGoodsDetails extends State { ///参与活动 queryJoinAct() async { BaseData baseData = await minService.joinAct({ - "actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id, - "actRecordId": launchJoinAct.actRecordId, + "actProductId": pageType == null + ? miNiDetail.productSkuVOList[0].id + : activityDetails.actProduct.id, + "actRecordId": indexP, "actTemplateId": activityDetails.actProduct.templateId, "actTimeId": activityDetails.actProduct.timeId, - "addressId":"", - "isDirectBuy":pageType == "3" ? false : true, + "addressId": "", + "isDirectBuy": pageType == "3" ? false : true, "getType": 1, - "productId": pageType == null ? productId :activityDetails.actProduct.productId, + "productId": + pageType == null ? productId : activityDetails.actProduct.productId, "skuId": skuId1, - "skuPrice":skuPrice1, + "skuPrice": skuPrice1, "templateType": pageType, }).catchError((error) { refreshController.refreshFailed(); @@ -305,6 +316,7 @@ class _ShoppingGoodsDetails extends State { toOrder(); refreshController.refreshCompleted(); } else { + SmartDialog.showToast(baseData.msg,alignment: Alignment.center); refreshController.refreshFailed(); } } @@ -367,7 +379,7 @@ class _ShoppingGoodsDetails extends State { setState(() { skuId1 = skuId; skuValue1 = skuValue; - skuPrice1 =skuPrice; + skuPrice1 = skuPrice; count1 = count; }); } @@ -488,14 +500,16 @@ class _ShoppingGoodsDetails extends State { arguments: { "storeInfo": storeInfo, "pageType": pageType, - "isDirectBuy":true, - "productId": (pageType!=null) ? activityDetails.actProduct.productId : miNiDetail.id, - "skuId":skuId1, + "isDirectBuy": true, + "productId": (pageType != null) + ? activityDetails.actProduct.productId + : miNiDetail.id, + "skuId": skuId1, "buyNum": count1, - "skuValue1":skuValue1, - "orderId":launchJoinAct.orderId, - "actProductId":actProductId, - "actProductSkuId":skuId1, + "skuValue1": skuValue1, + "orderId": launchJoinAct.orderId, + "actProductId": actProductId, + "actProductSkuId": skuId1, }, ).then((value) { _onRefresh(); @@ -506,14 +520,13 @@ class _ShoppingGoodsDetails extends State { ///去砍价详情页面 toBargain() async { await Navigator.of(context) - .pushNamed('/router/bargain_details',arguments: { + .pushNamed('/router/bargain_details', arguments: { "actRecordId": launchJoinAct.actRecordId, - "limitNumber":limitNumber, - "storeInfo":storeInfo, + "limitNumber": limitNumber, + "storeInfo": storeInfo, }); } - @override Widget build(BuildContext context) { return Stack( @@ -582,20 +595,20 @@ class _ShoppingGoodsDetails extends State { ], ), ), - // Container( - // color: Colors.white, - // margin: EdgeInsets.only(bottom: 72.h), - // child: Html( - // data: miNiDetail?.detail ?? "", - // customImageRenders: { - // networkSourceMatcher(): networkImageRender( - // loadingWidget: () { - // return Container(); - // }, - // ), - // }, - // ), - // ), + Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 72.h), + child: Html( + data: pageType != null ? (activityDetails?.actProduct?.detail ?? "") : (miNiDetail?.detail ?? ""), + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), ], ), ), @@ -904,7 +917,12 @@ class _ShoppingGoodsDetails extends State { children: [ GestureDetector( onTap: () { - toDownOrder(); + bargainType = 0; + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + queryLaunchAct(); }, child: Container( alignment: Alignment.center, @@ -960,6 +978,7 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { + bargainType = 1; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -997,7 +1016,8 @@ class _ShoppingGoodsDetails extends State { ), ), TextSpan( - text: activityDetails?.actProduct?.promotionPrice ?? + text: activityDetails + ?.actProduct?.promotionPrice ?? "", style: TextStyle( fontSize: 10.sp, @@ -1090,6 +1110,7 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { + bargainType = 2; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -1183,13 +1204,21 @@ class _ShoppingGoodsDetails extends State { alignment: Alignment.center, height: 50.h, padding: EdgeInsets.only(left: 16.w), + // decoration: BoxDecoration( + // // image: DecorationImage( + // // fit: BoxFit.fill, + // // image: NetworkImage(bannerImg), + // // ), + // color: Colors.green, + // ), decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: NetworkImage(bannerImg), - // ), - color: Colors.green, - ), + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFF32A057), + Color(0xFF61CE6B) + ])), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -1245,36 +1274,78 @@ class _ShoppingGoodsDetails extends State { color: Colors.white, ), ) - : Row( - children: [ - Container( - margin: EdgeInsets.only(right: 2), - padding: EdgeInsets.only(left: 2, right: 2), - height: 15.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0xFFFFFFFF), - ), - child: Text( - "${limitNumber ?? 0}人团", - style: TextStyle( - fontSize: 9.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF45B35F), + : (pageType == "1" + ? Row( + children: [ + Container( + margin: EdgeInsets.only(right: 2), + padding: EdgeInsets.only(left: 2, right: 2), + height: 15.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFFFFFFFF), + ), + child: Text( + "${limitNumber ?? 0}人团", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), + ), ), - ), - ), - Text( - "已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 11.sp, - color: Colors.white, - ), - ), - ], - ) + Text( + "已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, + ), + ), + ], + ) + : (pageType == "3" + ? Row( + children: [ + Container( + margin: EdgeInsets.only(right: 2), + padding: + EdgeInsets.only(left: 2, right: 2), + height: 15.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFFFFFFFF), + ), + child: Text( + "最高可砍${double.parse(activityDetails?.actProduct?.productPrice ?? "0") - double.parse(activityDetails?.actProduct?.promotionPrice ?? "0")}元", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), + ), + ), + Text( + "已砍${(activityDetails?.actProduct?.sellCount ?? 0)}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, + ), + ), + ], + ) + : Text( + "已秒${activityDetails?.actProduct?.sellCount ?? 0}件", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Colors.white, + ), + ))) ], ) ], @@ -1303,8 +1374,8 @@ class _ShoppingGoodsDetails extends State { ), ), Container( - margin: EdgeInsets.only(top: 8, right: 8), - padding: EdgeInsets.only(left: 2, right: 2), + margin: EdgeInsets.only(right: 8), + padding: EdgeInsets.only(left:3, right:3), height: 17.h, alignment: Alignment.center, decoration: BoxDecoration( @@ -1314,7 +1385,7 @@ class _ShoppingGoodsDetails extends State { child: Text( pageType == null ? (miNiDetail?.supplierName ?? "") - : ("没字段"), + : (activityDetails?.actProduct?.supplierName ?? ""), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -1328,7 +1399,7 @@ class _ShoppingGoodsDetails extends State { height: 8.h, ), Text( - pageType == null ? (miNiDetail?.shortName ?? "") : ("没字段"), + pageType == null ? (miNiDetail?.shortName ?? "") : (activityDetails?.actProduct?.shortName ?? ""), maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -1573,12 +1644,11 @@ class _ShoppingGoodsDetails extends State { GestureDetector( onTap: () { setState(() { - Navigator.of(context).pushNamed( - '/router/group_page_details', - arguments: { - "actRecordAndJoinlDTOList": json - .encode(activityDetails.actRecordAndJoinlDTOList), - }); + Navigator.of(context) + .pushNamed('/router/group_page_details', arguments: { + "actRecordAndJoinlDTOList": + json.encode(activityDetails.actRecordAndJoinlDTOList), + }); }); }, child: Row( @@ -1709,10 +1779,11 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { + indexP = actRecordAndJoinlDTOList.actRecord.id; if (count1 == 0) { - SmartDialog.showToast("请先选择您要购买的商品!~"); - return; - } + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } queryJoinAct(); }, child: Container( diff --git a/lib/store/shopping/shopping_home/group_details.dart b/lib/store/shopping/shopping_home/group_details.dart index 70528788..66397b13 100644 --- a/lib/store/shopping/shopping_home/group_details.dart +++ b/lib/store/shopping/shopping_home/group_details.dart @@ -568,8 +568,7 @@ class _GroupDetails extends State { ), )), ), - if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) < - (activityActRecordDetails?.successNumber ?? 0)) + if ((activityActRecordDetails?.actRecord?.state ?? 0) == 2) InkWell( onTap: () { setState(() {}); @@ -606,9 +605,7 @@ class _GroupDetails extends State { ], )), ), - if ((tempDay == 0 && tempHour == 0 && tempM == 0 && tempS == 0) && - ((activityActRecordDetails?.actRecord?.joinNum ?? 0) < - (activityActRecordDetails?.successNumber ?? 0))) + if ((activityActRecordDetails?.actRecord?.state ?? 0) == 4) InkWell( onTap: () { setState(() {});