diff --git a/lib/retrofit/data/activity_actRecord_details.dart b/lib/retrofit/data/activity_actRecord_details.dart index 4b2479a2..1970a87d 100644 --- a/lib/retrofit/data/activity_actRecord_details.dart +++ b/lib/retrofit/data/activity_actRecord_details.dart @@ -10,12 +10,15 @@ class ActivityActRecordDetails { List actRecordJoinList, ActProduct actProduct, dynamic skuName, - bool isBargain,}){ + bool isBargain, + int successNumber}){ _actRecord = actRecord; _actRecordJoinList = actRecordJoinList; _actProduct = actProduct; _skuName = skuName; _isBargain = isBargain; + _successNumber = successNumber; + } ActivityActRecordDetails.fromJson(dynamic json) { @@ -29,18 +32,21 @@ class ActivityActRecordDetails { _actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null; _skuName = json['skuName']; _isBargain = json['isBargain']; + _successNumber = json['successNumber']; } ActRecord _actRecord; List _actRecordJoinList; ActProduct _actProduct; dynamic _skuName; bool _isBargain; + int _successNumber; ActRecord get actRecord => _actRecord; List get actRecordJoinList => _actRecordJoinList; ActProduct get actProduct => _actProduct; dynamic get skuName => _skuName; bool get isBargain => _isBargain; + int get successNumber => _successNumber; Map toJson() { final map = {}; @@ -55,6 +61,7 @@ class ActivityActRecordDetails { } map['skuName'] = _skuName; map['isBargain'] = _isBargain; + map['successNumber'] = _successNumber; return map; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 9104799f..69fd5862 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.88:8775/app/";///詹云久 -const baseUrl = "http://192.168.10.88:8775/app/";///詹云久 +const base_url = "http://192.168.10.154:8775/app/";///詹云久 +const baseUrl = "http://192.168.10.154: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 160d2d14..8da31373 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.88:8775/app/'; + baseUrl ??= 'http://192.168.10.154:8775/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 3d680631..933e0089 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.88:8776/app/";///詹云久 -const baseUrl = "http://192.168.10.88:8776/app/";///詹云久 +const base_url = "http://192.168.10.154:8776/app/";///詹云久 +const baseUrl = "http://192.168.10.154: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 7ae275bf..b9e3727a 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.88:8776/app/'; + baseUrl ??= 'http://192.168.10.154:8776/app/'; } final Dio _dio; diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index aa35110a..bd3f8530 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -103,6 +103,7 @@ class _ShoppingGoodsDetails extends State { SharedPreferences.getInstance().then((value) { minLogin(value); + queryStoreInfo(); }); } @@ -120,6 +121,7 @@ class _ShoppingGoodsDetails extends State { }).then((baseData) { if (baseData != null && baseData.isSuccess) { minToken = baseData.data["token"]; + queryStoreInfo(); SharedPreferences.getInstance().then( (value) => { value.setString('minToken', minToken), @@ -135,8 +137,7 @@ class _ShoppingGoodsDetails extends State { storeId: storeId, showLoading: false, ); - - queryStoreInfo(); + queryMemberInfo(); if (pageType == null) { queryMiNiDetail(id); } else { @@ -147,6 +148,19 @@ class _ShoppingGoodsDetails extends State { }); } + ///会员信息 + queryMemberInfo() async { + BaseData baseData = await minService.memberInfo() + .catchError((error){debugPrint(error);}); + if (baseData != null && baseData.isSuccess) { + SharedPreferences.getInstance().then( + (value) => { + value.setString('minMember', jsonEncode(baseData.data)), + }, + ); + } + } + /// 查询店铺信息 queryStoreInfo() async { BaseData baseData = @@ -272,17 +286,17 @@ class _ShoppingGoodsDetails extends State { ///参与活动 queryJoinAct() async { BaseData baseData = await minService.joinAct({ - "actProductId": "", - "actRecordId": "", - "actTemplateId": "", - "actTimeId": "", + "actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id, + "actRecordId": launchJoinAct.actRecordId, + "actTemplateId": activityDetails.actProduct.templateId, + "actTimeId": activityDetails.actProduct.timeId, "addressId":"", - "isDirectBuy":true, + "isDirectBuy":pageType == "3" ? false : true, "getType": 1, - "productId": "", - "skuId": "", - "skuPrice": "", - "templateType": 1 + "productId": pageType == null ? productId :activityDetails.actProduct.productId, + "skuId": skuId1, + "skuPrice":skuPrice1, + "templateType": pageType, }).catchError((error) { refreshController.refreshFailed(); }); @@ -1546,32 +1560,32 @@ class _ShoppingGoodsDetails extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - "可参加的团", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF353535), + GestureDetector( + onTap: () { + setState(() { + Navigator.of(context).pushNamed( + '/router/group_page_details', + arguments: { + "actRecordAndJoinlDTOList": json + .encode(activityDetails.actRecordAndJoinlDTOList), + }); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + "可参加的团", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), ), ), - ), - GestureDetector( - onTap: () { - setState(() { - Navigator.of(context).popAndPushNamed( - '/router/group_page_details', - arguments: { - "actRecordAndJoinlDTOList": json - .encode(activityDetails.actRecordAndJoinlDTOList), - }); - }); - }, - child: Text( + Text( "更多", style: TextStyle( fontSize: 11.sp, @@ -1579,13 +1593,13 @@ class _ShoppingGoodsDetails extends State { color: Color(0xFF585858), ), ), - ), - Icon( - Icons.arrow_forward_ios, - size: 16, - color: Colors.black, - ), - ], + Icon( + Icons.arrow_forward_ios, + size: 16, + color: Colors.black, + ), + ], + ), ), SizedBox(height: 12.h), ListView.builder( @@ -1685,7 +1699,11 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - toDownOrder(); + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + queryJoinAct(); }, child: Container( alignment: Alignment.center, diff --git a/lib/store/shopping/shopping_home/group_details.dart b/lib/store/shopping/shopping_home/group_details.dart index 51db3931..8908af96 100644 --- a/lib/store/shopping/shopping_home/group_details.dart +++ b/lib/store/shopping/shopping_home/group_details.dart @@ -41,7 +41,6 @@ class _GroupDetails extends State { int tempHour = 0; int tempM = 0; int tempS = 0; - int limitNumber = 0; @override void dispose() { @@ -58,7 +57,6 @@ class _GroupDetails extends State { void initState() { super.initState(); actRecordId = widget.arguments["actRecordId"]; - limitNumber = widget.arguments["limitNumber"]; startCountdownTimer(); SharedPreferences.getInstance().then((value) { String minToken = value.getString("minToken"); @@ -287,7 +285,7 @@ class _GroupDetails extends State { alignment: Alignment.center, decoration: BoxDecoration( // color: Color(0xFFD2D2D2), - color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) || tempDay == 0) ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) || tempDay == 0) ? Color(0xFFD2D2D2):Color(0xFFF8961E), borderRadius: BorderRadius.circular(4)), child: Text( tempDay.toString(), @@ -307,7 +305,7 @@ class _GroupDetails extends State { fontSize: 16.sp, fontWeight: MyFontWeight.medium, // color: Color(0xFFD2D2D2), - color: (activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color: (activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0 ? Color(0xFFD2D2D2):Color(0xFFF8961E), ), )), ], @@ -320,7 +318,7 @@ class _GroupDetails extends State { alignment: Alignment.center, decoration: BoxDecoration( // color: Color(0xFFD2D2D2), - color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) + color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), borderRadius: BorderRadius.circular(4)), child: Text( @@ -341,7 +339,7 @@ class _GroupDetails extends State { fontSize: 16.sp, fontWeight: MyFontWeight.medium, // color: Color(0xFFD2D2D2), - color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), ), )), InkWell( @@ -352,7 +350,7 @@ class _GroupDetails extends State { alignment: Alignment.center, decoration: BoxDecoration( // color: Color(0xFFD2D2D2), - color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), borderRadius: BorderRadius.circular(4)), child: Text( tempM.toString(), @@ -372,7 +370,7 @@ class _GroupDetails extends State { fontSize: 16.sp, fontWeight: MyFontWeight.medium, // color: Color(0xFFD2D2D2), - color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), ), )), InkWell( @@ -383,7 +381,7 @@ class _GroupDetails extends State { alignment: Alignment.center, decoration: BoxDecoration( // color: Color(0xFFD2D2D2), - color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), + color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E), borderRadius: BorderRadius.circular(4)), child: Text( tempS.toString(), @@ -400,7 +398,7 @@ class _GroupDetails extends State { SizedBox( height: 24, ), - if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) + if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) Text( "恭喜您拼团成功", style: TextStyle( @@ -409,7 +407,7 @@ class _GroupDetails extends State { color: Colors.black, ), ), - if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < limitNumber && tempDay != 0 && tempHour!=0 && tempM !=0 && tempS !=0) + if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0) && tempDay != 0 && tempHour!=0 && tempM !=0 && tempS !=0) Text.rich( TextSpan( children: [ @@ -422,7 +420,7 @@ class _GroupDetails extends State { ), ), TextSpan( - text:(limitNumber - (activityActRecordDetails?.actRecord?.joinNum ?? 0)).toString(), + text:((activityActRecordDetails?.successNumber ?? 0) - (activityActRecordDetails?.actRecord?.joinNum ?? 0)).toString(), style: TextStyle( fontSize: 18.sp, fontWeight: MyFontWeight.semi_bold, @@ -461,7 +459,7 @@ class _GroupDetails extends State { padding: EdgeInsets.zero, scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), - itemCount:limitNumber, + itemCount:(activityActRecordDetails?.successNumber ?? 0), itemBuilder: (context, position) { return GestureDetector( onTap: () {}, @@ -473,7 +471,7 @@ class _GroupDetails extends State { SizedBox( height:54.h, ), - if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) + if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) InkWell( onTap: () { setState(() { @@ -497,7 +495,7 @@ class _GroupDetails extends State { ), )), ), - if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < limitNumber || tempDay != 0 && tempHour!=0 && tempM != 0 && tempS != 0) + if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0) || tempDay != 0 && tempHour!=0 && tempM != 0 && tempS != 0) InkWell( onTap: () { setState(() { @@ -535,7 +533,7 @@ class _GroupDetails extends State { ], )), ), - if(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) + if((tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0) && ((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0))) InkWell( onTap: () { setState(() { diff --git a/lib/store/shopping/shopping_home/group_page_details.dart b/lib/store/shopping/shopping_home/group_page_details.dart index 2404a5f9..d4b55bb8 100644 --- a/lib/store/shopping/shopping_home/group_page_details.dart +++ b/lib/store/shopping/shopping_home/group_page_details.dart @@ -148,14 +148,14 @@ class _GroupPageDetails extends State { onTap: () { setState(() {}); }, - child: groupItem(actRecordAndJoinlDTOList[position], position), + child: groupItem(actRecordAndJoinlDTOList[position]), ); }, ), ); } - Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList, index) { + Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) { return Container( height: 44.h, margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -164,7 +164,7 @@ class _GroupPageDetails extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ MImage( - actRecordAndJoinlDTOList?.actRecordJoinList[index]?.memberAvatar ?? + actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberAvatar ?? "", width: 44, height: 44, @@ -177,7 +177,7 @@ class _GroupPageDetails extends State { Expanded( child: Text( actRecordAndJoinlDTOList - ?.actRecordJoinList[index]?.memberNickname ?? + ?.actRecordJoinList[0]?.memberNickname ?? "", style: TextStyle( fontSize: 12.sp, @@ -232,10 +232,10 @@ class _GroupPageDetails extends State { ), GestureDetector( onTap: () { - Navigator.of(context).popAndPushNamed('/router/group_details', + Navigator.of(context).pushNamed('/router/group_details', arguments: { "actRecordId": actRecordAndJoinlDTOList - .actRecordJoinList[index].actRecordId + .actRecordJoinList[0].actRecordId, }); }, child: Container(