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. 104
      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,
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> _actRecordJoinList;
ActProduct _actProduct;
dynamic _skuName;
bool _isBargain;
int _successNumber;
ActRecord get actRecord => _actRecord;
List<ActRecordJoinList> get actRecordJoinList => _actRecordJoinList;
ActProduct get actProduct => _actProduct;
dynamic get skuName => _skuName;
bool get isBargain => _isBargain;
int get successNumber => _successNumber;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
@ -55,6 +61,7 @@ class ActivityActRecordDetails {
}
map['skuName'] = _skuName;
map['isBargain'] = _isBargain;
map['successNumber'] = _successNumber;
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 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/";

2
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;

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 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 {

2
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;

104
lib/store/shopping/shopping_goods_details.dart

@ -103,6 +103,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
SharedPreferences.getInstance().then((value) {
minLogin(value);
queryStoreInfo();
});
}
@ -120,6 +121,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}).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<ShoppingGoodsDetails> {
storeId: storeId,
showLoading: false,
);
queryStoreInfo();
queryMemberInfo();
if (pageType == null) {
queryMiNiDetail(id);
} 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 {
BaseData baseData =
@ -272,17 +286,17 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
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<ShoppingGoodsDetails> {
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<ShoppingGoodsDetails> {
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<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
toDownOrder();
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
queryJoinAct();
},
child: Container(
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 tempM = 0;
int tempS = 0;
int limitNumber = 0;
@override
void dispose() {
@ -58,7 +57,6 @@ class _GroupDetails extends State<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
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<GroupDetails> {
),
),
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<GroupDetails> {
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<GroupDetails> {
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<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(
onTap: () {
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(
onTap: () {
setState(() {

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

@ -148,14 +148,14 @@ class _GroupPageDetails extends State<GroupPageDetails> {
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<GroupPageDetails> {
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<GroupPageDetails> {
Expanded(
child: Text(
actRecordAndJoinlDTOList
?.actRecordJoinList[index]?.memberNickname ??
?.actRecordJoinList[0]?.memberNickname ??
"",
style: TextStyle(
fontSize: 12.sp,
@ -232,10 +232,10 @@ class _GroupPageDetails extends State<GroupPageDetails> {
),
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(

Loading…
Cancel
Save