Browse Source

拼团更改

zyh
w-R 3 years ago
parent
commit
a579be3074
  1. 9
      lib/retrofit/data/activity_actRecord_details.dart
  2. 4
      lib/retrofit/min_api.dart
  3. 2
      lib/retrofit/min_api.g.dart
  4. 4
      lib/retrofit/retrofit_api.dart
  5. 2
      lib/retrofit/retrofit_api.g.dart
  6. 70
      lib/store/shopping/shopping_goods_details.dart
  7. 30
      lib/store/shopping/shopping_home/group_details.dart
  8. 12
      lib/store/shopping/shopping_home/group_page_details.dart

9
lib/retrofit/data/activity_actRecord_details.dart

@ -10,12 +10,15 @@ class ActivityActRecordDetails {
List<ActRecordJoinList> actRecordJoinList, List<ActRecordJoinList> actRecordJoinList,
ActProduct actProduct, ActProduct actProduct,
dynamic skuName, dynamic skuName,
bool isBargain,}){ bool isBargain,
int successNumber}){
_actRecord = actRecord; _actRecord = actRecord;
_actRecordJoinList = actRecordJoinList; _actRecordJoinList = actRecordJoinList;
_actProduct = actProduct; _actProduct = actProduct;
_skuName = skuName; _skuName = skuName;
_isBargain = isBargain; _isBargain = isBargain;
_successNumber = successNumber;
} }
ActivityActRecordDetails.fromJson(dynamic json) { ActivityActRecordDetails.fromJson(dynamic json) {
@ -29,18 +32,21 @@ class ActivityActRecordDetails {
_actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null; _actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null;
_skuName = json['skuName']; _skuName = json['skuName'];
_isBargain = json['isBargain']; _isBargain = json['isBargain'];
_successNumber = json['successNumber'];
} }
ActRecord _actRecord; ActRecord _actRecord;
List<ActRecordJoinList> _actRecordJoinList; List<ActRecordJoinList> _actRecordJoinList;
ActProduct _actProduct; ActProduct _actProduct;
dynamic _skuName; dynamic _skuName;
bool _isBargain; bool _isBargain;
int _successNumber;
ActRecord get actRecord => _actRecord; ActRecord get actRecord => _actRecord;
List<ActRecordJoinList> get actRecordJoinList => _actRecordJoinList; List<ActRecordJoinList> get actRecordJoinList => _actRecordJoinList;
ActProduct get actProduct => _actProduct; ActProduct get actProduct => _actProduct;
dynamic get skuName => _skuName; dynamic get skuName => _skuName;
bool get isBargain => _isBargain; bool get isBargain => _isBargain;
int get successNumber => _successNumber;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
@ -55,6 +61,7 @@ class ActivityActRecordDetails {
} }
map['skuName'] = _skuName; map['skuName'] = _skuName;
map['isBargain'] = _isBargain; map['isBargain'] = _isBargain;
map['successNumber'] = _successNumber;
return map; return map;
} }

4
lib/retrofit/min_api.dart

@ -39,8 +39,8 @@ part 'min_api.g.dart';
// const baseUrl = "http://192.168.10.236:8765/app/";/// // const baseUrl = "http://192.168.10.236:8765/app/";///
const base_url = "http://192.168.10.88:8775/app/";/// const base_url = "http://192.168.10.154:8775/app/";///
const baseUrl = "http://192.168.10.88:8775/app/";/// const baseUrl = "http://192.168.10.154:8775/app/";///
// const base_url = "http://192.168.10.37:8766/app/"; // const base_url = "http://192.168.10.37:8766/app/";

2
lib/retrofit/min_api.g.dart

@ -9,7 +9,7 @@ part of 'min_api.dart';
class _MinApiService implements MinApiService { class _MinApiService implements MinApiService {
_MinApiService(this._dio, {this.baseUrl}) { _MinApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.88:8775/app/'; baseUrl ??= 'http://192.168.10.154:8775/app/';
} }
final Dio _dio; final Dio _dio;

4
lib/retrofit/retrofit_api.dart

@ -71,8 +71,8 @@ part 'retrofit_api.g.dart';
// const baseUrl = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.88:8776/app/";/// const base_url = "http://192.168.10.154:8776/app/";///
const baseUrl = "http://192.168.10.88:8776/app/";/// const baseUrl = "http://192.168.10.154:8776/app/";///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {

2
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.88:8776/app/'; baseUrl ??= 'http://192.168.10.154:8776/app/';
} }
final Dio _dio; final Dio _dio;

70
lib/store/shopping/shopping_goods_details.dart

@ -103,6 +103,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
minLogin(value); minLogin(value);
queryStoreInfo();
}); });
} }
@ -120,6 +121,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}).then((baseData) { }).then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
minToken = baseData.data["token"]; minToken = baseData.data["token"];
queryStoreInfo();
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
@ -135,8 +137,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
storeId: storeId, storeId: storeId,
showLoading: false, showLoading: false,
); );
queryMemberInfo();
queryStoreInfo();
if (pageType == null) { if (pageType == null) {
queryMiNiDetail(id); queryMiNiDetail(id);
} else { } else {
@ -147,6 +148,19 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}); });
} }
///
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 { queryStoreInfo() async {
BaseData baseData = BaseData baseData =
@ -272,17 +286,17 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
/// ///
queryJoinAct() async { queryJoinAct() async {
BaseData baseData = await minService.joinAct({ BaseData baseData = await minService.joinAct({
"actProductId": "", "actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id,
"actRecordId": "", "actRecordId": launchJoinAct.actRecordId,
"actTemplateId": "", "actTemplateId": activityDetails.actProduct.templateId,
"actTimeId": "", "actTimeId": activityDetails.actProduct.timeId,
"addressId":"", "addressId":"",
"isDirectBuy":true, "isDirectBuy":pageType == "3" ? false : true,
"getType": 1, "getType": 1,
"productId": "", "productId": pageType == null ? productId :activityDetails.actProduct.productId,
"skuId": "", "skuId": skuId1,
"skuPrice": "", "skuPrice":skuPrice1,
"templateType": 1 "templateType": pageType,
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
@ -1546,7 +1560,18 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Row( GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pushNamed(
'/router/group_page_details',
arguments: {
"actRecordAndJoinlDTOList": json
.encode(activityDetails.actRecordAndJoinlDTOList),
});
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1560,18 +1585,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
), ),
), ),
GestureDetector( Text(
onTap: () {
setState(() {
Navigator.of(context).popAndPushNamed(
'/router/group_page_details',
arguments: {
"actRecordAndJoinlDTOList": json
.encode(activityDetails.actRecordAndJoinlDTOList),
});
});
},
child: Text(
"更多", "更多",
style: TextStyle( style: TextStyle(
fontSize: 11.sp, fontSize: 11.sp,
@ -1579,7 +1593,6 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
color: Color(0xFF585858), color: Color(0xFF585858),
), ),
), ),
),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
size: 16, size: 16,
@ -1587,6 +1600,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
], ],
), ),
),
SizedBox(height: 12.h), SizedBox(height: 12.h),
ListView.builder( ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -1685,7 +1699,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
toDownOrder(); if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
queryJoinAct();
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,

30
lib/store/shopping/shopping_home/group_details.dart

@ -41,7 +41,6 @@ class _GroupDetails extends State<GroupDetails> {
int tempHour = 0; int tempHour = 0;
int tempM = 0; int tempM = 0;
int tempS = 0; int tempS = 0;
int limitNumber = 0;
@override @override
void dispose() { void dispose() {
@ -58,7 +57,6 @@ class _GroupDetails extends State<GroupDetails> {
void initState() { void initState() {
super.initState(); super.initState();
actRecordId = widget.arguments["actRecordId"]; actRecordId = widget.arguments["actRecordId"];
limitNumber = widget.arguments["limitNumber"];
startCountdownTimer(); startCountdownTimer();
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken"); String minToken = value.getString("minToken");
@ -287,7 +285,7 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Color(0xFFD2D2D2), // 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)), borderRadius: BorderRadius.circular(4)),
child: Text( child: Text(
tempDay.toString(), tempDay.toString(),
@ -307,7 +305,7 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2), // 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<GroupDetails> {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Color(0xFFD2D2D2), // 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), ? Color(0xFFD2D2D2):Color(0xFFF8961E),
borderRadius: BorderRadius.circular(4)), borderRadius: BorderRadius.circular(4)),
child: Text( child: Text(
@ -341,7 +339,7 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2), // 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( InkWell(
@ -352,7 +350,7 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Color(0xFFD2D2D2), // 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)), borderRadius: BorderRadius.circular(4)),
child: Text( child: Text(
tempM.toString(), tempM.toString(),
@ -372,7 +370,7 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2), // 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( InkWell(
@ -383,7 +381,7 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Color(0xFFD2D2D2), // 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)), borderRadius: BorderRadius.circular(4)),
child: Text( child: Text(
tempS.toString(), tempS.toString(),
@ -400,7 +398,7 @@ class _GroupDetails extends State<GroupDetails> {
SizedBox( SizedBox(
height: 24, height: 24,
), ),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0)
Text( Text(
"恭喜您拼团成功", "恭喜您拼团成功",
style: TextStyle( style: TextStyle(
@ -409,7 +407,7 @@ class _GroupDetails extends State<GroupDetails> {
color: Colors.black, 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( Text.rich(
TextSpan( TextSpan(
children: [ children: [
@ -422,7 +420,7 @@ class _GroupDetails extends State<GroupDetails> {
), ),
), ),
TextSpan( TextSpan(
text:(limitNumber - (activityActRecordDetails?.actRecord?.joinNum ?? 0)).toString(), text:((activityActRecordDetails?.successNumber ?? 0) - (activityActRecordDetails?.actRecord?.joinNum ?? 0)).toString(),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -461,7 +459,7 @@ class _GroupDetails extends State<GroupDetails> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemCount:limitNumber, itemCount:(activityActRecordDetails?.successNumber ?? 0),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {},
@ -473,7 +471,7 @@ class _GroupDetails extends State<GroupDetails> {
SizedBox( SizedBox(
height:54.h, height:54.h,
), ),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == limitNumber) if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0)
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
@ -497,7 +495,7 @@ class _GroupDetails extends State<GroupDetails> {
), ),
)), )),
), ),
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( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
@ -535,7 +533,7 @@ class _GroupDetails extends State<GroupDetails> {
], ],
)), )),
), ),
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( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {

12
lib/store/shopping/shopping_home/group_page_details.dart

@ -148,14 +148,14 @@ class _GroupPageDetails extends State<GroupPageDetails> {
onTap: () { onTap: () {
setState(() {}); setState(() {});
}, },
child: groupItem(actRecordAndJoinlDTOList[position], position), child: groupItem(actRecordAndJoinlDTOList[position]),
); );
}, },
), ),
); );
} }
Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList, index) { Widget groupItem(ActRecordAndJoinlDTOList actRecordAndJoinlDTOList) {
return Container( return Container(
height: 44.h, height: 44.h,
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
@ -164,7 +164,7 @@ class _GroupPageDetails extends State<GroupPageDetails> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
MImage( MImage(
actRecordAndJoinlDTOList?.actRecordJoinList[index]?.memberAvatar ?? actRecordAndJoinlDTOList?.actRecordJoinList[0]?.memberAvatar ??
"", "",
width: 44, width: 44,
height: 44, height: 44,
@ -177,7 +177,7 @@ class _GroupPageDetails extends State<GroupPageDetails> {
Expanded( Expanded(
child: Text( child: Text(
actRecordAndJoinlDTOList actRecordAndJoinlDTOList
?.actRecordJoinList[index]?.memberNickname ?? ?.actRecordJoinList[0]?.memberNickname ??
"", "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -232,10 +232,10 @@ class _GroupPageDetails extends State<GroupPageDetails> {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).popAndPushNamed('/router/group_details', Navigator.of(context).pushNamed('/router/group_details',
arguments: { arguments: {
"actRecordId": actRecordAndJoinlDTOList "actRecordId": actRecordAndJoinlDTOList
.actRecordJoinList[index].actRecordId .actRecordJoinList[0].actRecordId,
}); });
}, },
child: Container( child: Container(

Loading…
Cancel
Save