Browse Source

详情更改

zyh
w-R 3 years ago
parent
commit
24b64ab183
  1. 27
      lib/retrofit/data/activity_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. 2
      lib/store/shopping/activity_prefecture_details.dart
  7. 161
      lib/store/shopping/shopping_goods_details.dart
  8. 7
      lib/store/shopping/shopping_home/group_details.dart

27
lib/retrofit/data/activity_details.dart

@ -458,6 +458,9 @@ class ActProduct {
int sellCount,
List<SkuJson> 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> _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<String, dynamic> toJson() {
final map = <String, dynamic>{};
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;

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.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/";

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.114:8775/app/';
baseUrl ??= 'http://192.168.10.66: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.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 {

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.114:8776/app/';
baseUrl ??= 'http://192.168.10.66:8776/app/';
}
final Dio _dio;

2
lib/store/shopping/activity_prefecture_details.dart

@ -873,7 +873,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
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,

161
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<ShoppingGoodsDetails> {
Timer _timer;
String testTime = "2021-12-30 10:00:00";
LaunchJoinAct launchJoinAct;
int bargainType = 0;
String indexP;
@override
void dispose() {
@ -150,8 +153,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
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) => {
@ -197,8 +201,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
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,14 +257,17 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
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,
"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,
"templateType": pageType
@ -271,7 +277,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
if (baseData != null && baseData.isSuccess) {
setState(() {
launchJoinAct = baseData.data;
if(pageType == "3"){
if (bargainType == 1) {
toBargain();
} else {
toOrder();
@ -279,6 +285,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
refreshController.refreshCompleted();
});
} else {
if((activityDetails?.actProduct?.productStock ?? 0) == 0)
SmartDialog.showToast("活动商品售罄",alignment: Alignment.center);
refreshController.refreshFailed();
}
}
@ -286,14 +294,17 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
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,
"getType": 1,
"productId": pageType == null ? productId :activityDetails.actProduct.productId,
"productId":
pageType == null ? productId : activityDetails.actProduct.productId,
"skuId": skuId1,
"skuPrice": skuPrice1,
"templateType": pageType,
@ -305,6 +316,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
toOrder();
refreshController.refreshCompleted();
} else {
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
refreshController.refreshFailed();
}
}
@ -489,7 +501,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
"storeInfo": storeInfo,
"pageType": pageType,
"isDirectBuy": true,
"productId": (pageType!=null) ? activityDetails.actProduct.productId : miNiDetail.id,
"productId": (pageType != null)
? activityDetails.actProduct.productId
: miNiDetail.id,
"skuId": skuId1,
"buyNum": count1,
"skuValue1": skuValue1,
@ -513,7 +527,6 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
});
}
@override
Widget build(BuildContext context) {
return Stack(
@ -582,20 +595,20 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
],
),
),
// 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<ShoppingGoodsDetails> {
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<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
bargainType = 1;
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
@ -997,7 +1016,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
TextSpan(
text: activityDetails?.actProduct?.promotionPrice ??
text: activityDetails
?.actProduct?.promotionPrice ??
"",
style: TextStyle(
fontSize: 10.sp,
@ -1090,6 +1110,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
bargainType = 2;
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
@ -1183,13 +1204,21 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
alignment: Alignment.center,
height: 50.h,
padding: EdgeInsets.only(left: 16.w),
decoration: BoxDecoration(
// image: DecorationImage(
// fit: BoxFit.fill,
// image: NetworkImage(bannerImg),
// decoration: BoxDecoration(
// // image: DecorationImage(
// // fit: BoxFit.fill,
// // image: NetworkImage(bannerImg),
// // ),
// color: Colors.green,
// ),
color: Colors.green,
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color(0xFF32A057),
Color(0xFF61CE6B)
])),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
@ -1245,7 +1274,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
color: Colors.white,
),
)
: Row(
: (pageType == "1"
? Row(
children: [
Container(
margin: EdgeInsets.only(right: 2),
@ -1275,6 +1305,47 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
],
)
: (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<ShoppingGoodsDetails> {
),
),
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<ShoppingGoodsDetails> {
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<ShoppingGoodsDetails> {
height: 8.h,
),
Text(
pageType == null ? (miNiDetail?.shortName ?? "") : ("没字段"),
pageType == null ? (miNiDetail?.shortName ?? "") : (activityDetails?.actProduct?.shortName ?? ""),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -1573,11 +1644,10 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
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),
});
});
},
@ -1709,6 +1779,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
indexP = actRecordAndJoinlDTOList.actRecord.id;
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;

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

@ -568,8 +568,7 @@ class _GroupDetails extends State<GroupDetails> {
),
)),
),
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<GroupDetails> {
],
)),
),
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(() {});

Loading…
Cancel
Save