Browse Source

直接购买更改

zyh
w-R 3 years ago
parent
commit
fc50c4d476
  1. 2
      lib/community/community_details.dart
  2. 60
      lib/retrofit/data/activity_actRecord_details.dart
  3. 1
      lib/retrofit/retrofit_api.dart
  4. 55
      lib/settlement/settlement.dart
  5. 136
      lib/settlement/settlement_view/settlement_order_commodity.dart
  6. 116
      lib/store/shopping/shopping_goods_details.dart
  7. 232
      lib/store/shopping/shopping_home/bargain_details.dart

2
lib/community/community_details.dart

@ -127,7 +127,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
exitFull: () {
setState(() {});
},
userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"],
userId:widget.arguments !=null ? widget.arguments["userId"] ??widget.arguments["mid"]:"",
itemCount: 3,
isDetails: true,
heightFun: (height) {

60
lib/retrofit/data/activity_actRecord_details.dart

@ -1,18 +1,21 @@
/// actRecord : {"id":"1494198857058222080","createTime":"2022-02-17 14:35:43","createUser":"1478548720785031168","updateTime":"2022-02-17 14:35:43","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actProductId":"1494198261018263552","mid":"1478548720785031168","joinNum":1,"startTime":"2022-02-17 14:35:43","endTime":"2022-02-17 16:35:43","state":2,"isDelete":0}
/// actRecordJoinList : [{"id":"1494198857217605632","createTime":"2022-02-17 14:35:43","createUser":"1478548720785031168","updateTime":"2022-02-17 14:35:43","updateUser":"1478548720785031168","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actRecordId":"1494198857058222080","mid":"1478548720785031168","orderId":null,"isLeader":true,"memberAvatar":"","memberNickname":"","productId":"1494198261018263552","actPrice":"57.81","state":true,"isDelete":0}]
/// actRecord : {"id":"1496692045555695616","createTime":"2022-02-24 11:42:46","createUser":"1496056013827080192","updateTime":"2022-02-24 11:42:46","updateUser":"1496056013827080192","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actProductId":"1494198261018263552","mid":"1496056013827080192","isDirectBuy":false,"joinNum":1,"startTime":"2022-02-24 11:42:46","endTime":"2022-02-24 13:42:46","state":4,"isDelete":0}
/// actRecordJoinList : [{"id":"1496692045677330432","createTime":"2022-02-24 11:42:46","createUser":"1496056013827080192","updateTime":"2022-02-24 11:42:46","updateUser":"1496056013827080192","storeId":"1460885296764682240","type":3,"actTemplateId":"1490572026815971328","actTimeId":"1490572027034075136","actRecordId":"1496692045555695616","mid":"1496056013827080192","orderId":null,"isLeader":true,"memberAvatar":"","memberNickname":"","productId":"1494198261018263552","actPrice":"54.45","state":true,"isDelete":0}]
/// actProduct : {"id":"1494198261018263552","createTime":"2022-02-17 14:33:21","createUser":"1364043181062094848","updateTime":"2022-02-17 14:33:21","updateUser":"1364043181062094848","storeId":"1460885296764682240","templateId":"1490572026815971328","timeId":"1490572027034075136","productId":"1461246266586431488","productName":"野生羊肚菌","productImg":"https://pos.upload.gznl.top/1179/2021/11/298d1e1c-2a5f-4b9d-95a7-87b3f88a9cd1.jpg","productPrice":"150.00","promotionPrice":"11.00","productStock":200,"sellCount":0,"skuJson":[{"skuId":"1461246266661928960","skuPrice":11,"skuStock":100},{"skuId":"1461246266687094784","skuPrice":100,"skuStock":100}],"isDelete":0}
/// skuName : "50g/袋"
/// skuName : null
/// isBargain : true
class ActivityActRecordDetails {
ActivityActRecordDetails({
ActRecord actRecord,
List<ActRecordJoinList> actRecordJoinList,
ActProduct actProduct,
String skuName,}){
dynamic skuName,
bool isBargain,}){
_actRecord = actRecord;
_actRecordJoinList = actRecordJoinList;
_actProduct = actProduct;
_skuName = skuName;
_isBargain = isBargain;
}
ActivityActRecordDetails.fromJson(dynamic json) {
@ -25,16 +28,19 @@ class ActivityActRecordDetails {
}
_actProduct = json['actProduct'] != null ? ActProduct.fromJson(json['actProduct']) : null;
_skuName = json['skuName'];
_isBargain = json['isBargain'];
}
ActRecord _actRecord;
List<ActRecordJoinList> _actRecordJoinList;
ActProduct _actProduct;
String _skuName;
dynamic _skuName;
bool _isBargain;
ActRecord get actRecord => _actRecord;
List<ActRecordJoinList> get actRecordJoinList => _actRecordJoinList;
ActProduct get actProduct => _actProduct;
String get skuName => _skuName;
dynamic get skuName => _skuName;
bool get isBargain => _isBargain;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
@ -48,6 +54,7 @@ class ActivityActRecordDetails {
map['actProduct'] = _actProduct.toJson();
}
map['skuName'] = _skuName;
map['isBargain'] = _isBargain;
return map;
}
@ -232,23 +239,23 @@ class SkuJson {
}
/// id : "1494198857217605632"
/// createTime : "2022-02-17 14:35:43"
/// createUser : "1478548720785031168"
/// updateTime : "2022-02-17 14:35:43"
/// updateUser : "1478548720785031168"
/// id : "1496692045677330432"
/// createTime : "2022-02-24 11:42:46"
/// createUser : "1496056013827080192"
/// updateTime : "2022-02-24 11:42:46"
/// updateUser : "1496056013827080192"
/// storeId : "1460885296764682240"
/// type : 3
/// actTemplateId : "1490572026815971328"
/// actTimeId : "1490572027034075136"
/// actRecordId : "1494198857058222080"
/// mid : "1478548720785031168"
/// actRecordId : "1496692045555695616"
/// mid : "1496056013827080192"
/// orderId : null
/// isLeader : true
/// memberAvatar : ""
/// memberNickname : ""
/// productId : "1494198261018263552"
/// actPrice : "57.81"
/// actPrice : "54.45"
/// state : true
/// isDelete : 0
@ -381,21 +388,22 @@ class ActRecordJoinList {
}
/// id : "1494198857058222080"
/// createTime : "2022-02-17 14:35:43"
/// createUser : "1478548720785031168"
/// updateTime : "2022-02-17 14:35:43"
/// updateUser : "1478548720785031168"
/// id : "1496692045555695616"
/// createTime : "2022-02-24 11:42:46"
/// createUser : "1496056013827080192"
/// updateTime : "2022-02-24 11:42:46"
/// updateUser : "1496056013827080192"
/// storeId : "1460885296764682240"
/// type : 3
/// actTemplateId : "1490572026815971328"
/// actTimeId : "1490572027034075136"
/// actProductId : "1494198261018263552"
/// mid : "1478548720785031168"
/// mid : "1496056013827080192"
/// isDirectBuy : false
/// joinNum : 1
/// startTime : "2022-02-17 14:35:43"
/// endTime : "2022-02-17 16:35:43"
/// state : 2
/// startTime : "2022-02-24 11:42:46"
/// endTime : "2022-02-24 13:42:46"
/// state : 4
/// isDelete : 0
class ActRecord {
@ -411,6 +419,7 @@ class ActRecord {
String actTimeId,
String actProductId,
String mid,
bool isDirectBuy,
int joinNum,
String startTime,
String endTime,
@ -427,6 +436,7 @@ class ActRecord {
_actTimeId = actTimeId;
_actProductId = actProductId;
_mid = mid;
_isDirectBuy = isDirectBuy;
_joinNum = joinNum;
_startTime = startTime;
_endTime = endTime;
@ -446,6 +456,7 @@ class ActRecord {
_actTimeId = json['actTimeId'];
_actProductId = json['actProductId'];
_mid = json['mid'];
_isDirectBuy = json['isDirectBuy'];
_joinNum = json['joinNum'];
_startTime = json['startTime'];
_endTime = json['endTime'];
@ -463,6 +474,7 @@ class ActRecord {
String _actTimeId;
String _actProductId;
String _mid;
bool _isDirectBuy;
int _joinNum;
String _startTime;
String _endTime;
@ -480,6 +492,7 @@ class ActRecord {
String get actTimeId => _actTimeId;
String get actProductId => _actProductId;
String get mid => _mid;
bool get isDirectBuy => _isDirectBuy;
int get joinNum => _joinNum;
String get startTime => _startTime;
String get endTime => _endTime;
@ -499,6 +512,7 @@ class ActRecord {
map['actTimeId'] = _actTimeId;
map['actProductId'] = _actProductId;
map['mid'] = _mid;
map['isDirectBuy'] = _isDirectBuy;
map['joinNum'] = _joinNum;
map['startTime'] = _startTime;
map['endTime'] = _endTime;

1
lib/retrofit/retrofit_api.dart

@ -19,7 +19,6 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import 'data/achievement_detail_list.dart';
import 'data/activity_area_list.dart';
import 'data/address.dart';
import 'data/banner.dart';
import 'data/brand_data.dart';

55
lib/settlement/settlement.dart

@ -9,9 +9,11 @@ import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity_details.dart';
import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/down_order.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
@ -58,13 +60,14 @@ class _Settlement extends State<Settlement> {
int payChannel = 4;
int tableId = 0;
int numberOfPeople = 0;
String pageType ="1";
String pageType = "1";
Address address;
CouponListBean couponListBean;
PromotionInfoListBean promotion;
String mobile;
bool placeOrder = false;
String actProductId;
String actProductSkuId;
@override
void initState() {
@ -77,6 +80,8 @@ class _Settlement extends State<Settlement> {
promotions = widget.arguments["pName"] ?? "";
coupons = widget.arguments["cName"] ?? "";
pageType = widget.arguments["pageType"];
actProductId = widget.arguments["actProductId"];
actProductSkuId = widget.arguments["actProductSkuId"];
if (tableId == 0) {
placeOrder = true;
}
@ -98,6 +103,8 @@ class _Settlement extends State<Settlement> {
null,
0,
widget.arguments["pid"],
actProductId ?? "",
actProductSkuId ?? "",
);
} else if (coupons != null && coupons != "" || tableId <= 0) {
queryOrderInfo(
@ -106,9 +113,13 @@ class _Settlement extends State<Settlement> {
widget.arguments["cid"],
0,
null,
actProductId ?? "",
actProductSkuId ?? "",
);
} else
queryOrderInfo(null, selectedBtn, null, 0, null);
queryOrderInfo(null, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
});
weChatResponseEventHandler.listen((event) async {
@ -124,13 +135,17 @@ class _Settlement extends State<Settlement> {
memberCouponId,
orderId,
promotionId,
actProductId,
actProductSkuId,
) async {
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
"addressId": addressId,
"isTake": isTake,
"memberCouponId": memberCouponId,
"orderId": orderId,
"promotionId": promotionId
"promotionId": promotionId,
"actProductId": actProductId,
"actProductSkuId": actProductSkuId
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
@ -138,7 +153,8 @@ class _Settlement extends State<Settlement> {
if (settleOrderInfo.orderProductList == null ||
settleOrderInfo.orderProductList.length == 0) {
placeOrder = true;
queryOrderDetails(parentId);
queryOrderDetails(
pageType != null ? widget.arguments["orderId"] : parentId);
}
});
}
@ -148,7 +164,7 @@ class _Settlement extends State<Settlement> {
queryOrderDetails(id) async {
print("ididididididid: $id");
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({
"id": id,
"id": widget.arguments["orderId"],
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
@ -162,7 +178,9 @@ class _Settlement extends State<Settlement> {
this.selectedBtn = selectedBtn;
});
if (address != null) {
queryOrderInfo(address.id, selectedBtn, null, 0, null);
queryOrderInfo(address.id, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
return;
}
BaseData<List<Address>> baseDate =
@ -206,7 +224,9 @@ class _Settlement extends State<Settlement> {
}
}
queryOrderInfo(address.id, selectedBtn, null, 0, null);
queryOrderInfo(address.id, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
}
}
@ -222,7 +242,9 @@ class _Settlement extends State<Settlement> {
});
});
queryOrderInfo(address.id, selectedBtn, null, 0, null);
queryOrderInfo(address.id, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
}
}
@ -433,9 +455,11 @@ class _Settlement extends State<Settlement> {
this.selectedBtn = 0;
});
queryOrderInfo(addressId, isTake,
memberCouponId, orderId, promotionId);
memberCouponId, orderId, promotionId,
actProductId ?? "",
actProductSkuId ?? "",);
}, queryAddress, storeInfo, address,
selectedAddress,pageType),
selectedAddress, pageType),
SizedBox(
height: 16,
@ -453,6 +477,7 @@ class _Settlement extends State<Settlement> {
settleOrderInfo,
minOrderInfo,
tableId,
pageType,
),
/////
@ -505,9 +530,9 @@ class _Settlement extends State<Settlement> {
),
),
Text(
minOrderInfo != null
(minOrderInfo != null
? "${minOrderInfo.orderSumPrice}"
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}",
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}"),
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
@ -593,6 +618,8 @@ class _Settlement extends State<Settlement> {
couponListBean != null ? couponListBean.id : null,
0,
null,
actProductId ?? "",
actProductSkuId ?? "",
);
}
}
@ -617,6 +644,8 @@ class _Settlement extends State<Settlement> {
null,
0,
promotion != null ? promotion.id : null,
actProductId ?? "",
actProductSkuId ?? "",
);
}
}

136
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity_details.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/order_product_vo.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
@ -14,9 +15,10 @@ class SettlementOrderCommodity extends StatefulWidget {
final SettleOrderInfo settleOrderInfo;
final MinOrderInfo minOrderInfo;
final String pageType;
SettlementOrderCommodity(
this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId);
this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId,this.pageType,);
@override
State<StatefulWidget> createState() {
@ -111,7 +113,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
color: Colors.grey,
),
));
widgets.add(buildTotalPrice());
// widgets.add(buildTotalPrice());
return widgets;
}
@ -315,71 +317,71 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
);
}
Widget buildTotalPrice() {
return Container(
margin: EdgeInsets.only(top: 7.h, bottom: 11.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Expanded(
child: Text(
S.of(context).gongjijianshangpin((widget.minOrderInfo != null)
? ((widget.minOrderInfo != null)
? widget.minOrderInfo.orderProductVOList.length
: "0")
: (widget.settleOrderInfo != null)
? widget.settleOrderInfo.orderProductList.length
: "0"),
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.semi_bold,
),
),
flex: 1,
),
Container(
child: Text(
"已优惠:¥${discountPrice()}",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7B7B7B),
fontWeight: MyFontWeight.medium,
),
),
),
SizedBox(
width: 15.w,
),
Container(
child: Text(
S.of(context).jiesuanjine,
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF353535),
fontWeight: MyFontWeight.semi_bold,
),
),
),
SizedBox(
width: 5.w,
),
Text(
totalPrice(),
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
);
}
// Widget buildTotalPrice() {
// return Container(
// margin: EdgeInsets.only(top: 7.h, bottom: 11.h),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
// crossAxisAlignment: CrossAxisAlignment.baseline,
// textBaseline: TextBaseline.alphabetic,
// children: [
// Expanded(
// child: Text(
// S.of(context).gongjijianshangpin((widget.minOrderInfo != null)
// ? ((widget.minOrderInfo != null)
// ? widget.minOrderInfo.orderProductVOList.length
// : "0")
// : (widget.settleOrderInfo != null)
// ? widget.settleOrderInfo.orderProductList.length
// : "0"),
// style: TextStyle(
// fontSize: 10.sp,
// color: Color(0xFFA29E9E),
// fontWeight: MyFontWeight.semi_bold,
// ),
// ),
// flex: 1,
// ),
// Container(
// child: Text(
// "已优惠:¥${discountPrice()}",
// style: TextStyle(
// fontSize: 12.sp,
// color: Color(0xFF7B7B7B),
// fontWeight: MyFontWeight.medium,
// ),
// ),
// ),
// SizedBox(
// width: 15.w,
// ),
//
// Container(
// child: Text(
// S.of(context).jiesuanjine,
// style: TextStyle(
// fontSize: 12.sp,
// color: Color(0xFF353535),
// fontWeight: MyFontWeight.semi_bold,
// ),
// ),
// ),
// SizedBox(
// width: 5.w,
// ),
// Text(
// totalPrice(),
// textAlign: TextAlign.end,
// style: TextStyle(
// fontSize: 14.sp,
// color: Color(0xFF32A060),
// fontWeight: MyFontWeight.semi_bold,
// ),
// ),
// ],
// ),
// );
// }
String discountPrice(){
if(widget.minOrderInfo != null){

116
lib/store/shopping/shopping_goods_details.dart

@ -15,6 +15,7 @@ import 'package:huixiang/retrofit/data/activity_details.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
@ -53,6 +54,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
MiNiDetail miNiDetail;
bool dialogShowing = false;
String skuId1;
String skuPrice1;
String skuValue1;
int count1 = 0;
int tableId = 0;
@ -184,7 +186,8 @@ 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 {
@ -240,21 +243,28 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
showLoading: false,
);
BaseData baseData = await minService.launchAct({
"actProductId":activityDetails.actProduct.id,
"actRecordId":0,
"actTemplateId":activityDetails.actProduct.templateId,
"actTimeId":activityDetails.actProduct.timeId,
"getType":1,
"productId":activityDetails.actProduct.productId,
"skuId":activityDetails.actProduct.skuJson[0].skuId,
"skuPrice":activityDetails.actProduct.skuJson[0].skuPrice,
"templateType":pageType
"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,
"getType": 1,
"productId": pageType == null ? productId :activityDetails.actProduct.productId,
"skuId": skuId1,
"skuPrice":skuPrice1,
"templateType": pageType
}).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
launchJoinAct = baseData.data;
if(pageType == "3"){
toBargain();
}else{
toOrder();
}
refreshController.refreshCompleted();
});
} else {
@ -262,26 +272,28 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}
}
///
queryJoinAct() async {
BaseData baseData = await minService.joinAct({
"actProductId": "",
"actRecordId": "",
"actTemplateId": "",
"actTimeId":"",
"getType":1,
"productId":"",
"skuId":"",
"skuPrice":"",
"templateType":1
"actTimeId": "",
"addressId":"",
"isDirectBuy":true,
"getType": 1,
"productId": "",
"skuId": "",
"skuPrice": "",
"templateType": 1
}).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
launchJoinAct = baseData.data;
toOrder();
refreshController.refreshCompleted();
}else {
} else {
refreshController.refreshFailed();
}
}
@ -340,9 +352,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
.replaceAll("[", "")
.replaceAll("]", "")
.replaceAll(",", "");
String skuPrice = productSku.skuPrice;
setState(() {
skuId1 = skuId;
skuValue1 = skuValue;
skuPrice1 =skuPrice;
count1 = count;
});
}
@ -438,7 +452,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
"pid": pid,
"cName": cName,
"cid": cid,
"pageType":pageType,
"pageType": pageType,
"shoppingCartSkuItemList": [
{
"buyNum": count1,
@ -456,6 +470,37 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
);
}
///
toOrder() async {
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": storeInfo,
"pageType": pageType,
"isDirectBuy":true,
"productId": (pageType!=null) ? activityDetails.actProduct.productId : miNiDetail.id,
"skuId":skuId1,
"buyNum": count1,
"skuValue1":skuValue1,
"orderId":launchJoinAct.orderId,
"actProductId":actProductId,
"actProductSkuId":skuId1,
},
);
}
///
toBargain() async {
await Navigator.of(context)
.pushNamed('/router/bargain_details',arguments: {
"actRecordId": launchJoinAct.actRecordId,
"limitNumber":limitNumber,
"storeInfo":storeInfo,
"skuId":skuId1
});
}
@override
Widget build(BuildContext context) {
return Stack(
@ -674,7 +719,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
toDownOrder();
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
queryLaunchAct();
},
child: Container(
alignment: Alignment.center,
@ -894,12 +943,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
Navigator.of(context)
.popAndPushNamed('/router/bargain_details',arguments: {
// "actRecordId": activityDetails.actRecordAndJoinlDTOList[0]
// .actRecordJoinList[index].actRecordId,
// "actProduct":activityDetails.actProduct,
});
queryLaunchAct();
},
child: Container(
alignment: Alignment.center,
@ -932,8 +976,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
TextSpan(
text: activityDetails
?.actProduct?.promotionPrice ??
text: activityDetails?.actProduct?.promotionPrice ??
"",
style: TextStyle(
fontSize: 10.sp,
@ -966,7 +1009,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
children: [
GestureDetector(
onTap: () {
toDownOrder();
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
queryLaunchAct();
},
child: Container(
alignment: Alignment.center,
@ -1022,7 +1069,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
GestureDetector(
onTap: () {
toDownOrder();
if (count1 == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
queryLaunchAct();
},
child: Container(
alignment: Alignment.center,
@ -1605,7 +1656,10 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
TextSpan(
text: (limitNumber - (activityDetails.actRecordAndJoinlDTOList[0].actRecord.joinNum)).toString(),
text: (limitNumber -
(activityDetails.actRecordAndJoinlDTOList[0]
.actRecord.joinNum))
.toString(),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,

232
lib/store/shopping/shopping_home/bargain_details.dart

@ -6,7 +6,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/activity_actRecord_details.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
@ -41,6 +44,9 @@ class _BargainDetails extends State<BargainDetails> {
final RefreshController refreshController = RefreshController();
int limitNumber = 0;
double bargainNum = 0;
LaunchJoinAct launchJoinAct;
StoreInfo storeInfo;
String skuId;
@override
void dispose() {
@ -57,6 +63,8 @@ class _BargainDetails extends State<BargainDetails> {
super.initState();
actRecordId = widget.arguments["actRecordId"];
limitNumber = widget.arguments["limitNumber"];
storeInfo = widget.arguments["storeInfo"];
skuId = widget.arguments["skuId"];
startCountdownTimer();
SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken");
@ -120,6 +128,51 @@ class _BargainDetails extends State<BargainDetails> {
}
}
///
queryLaunchAct() async {
BaseData baseData = await minService.launchAct({
"actProductId": activityActRecordDetails.actRecord.actProductId,
"actRecordId": 0,
"actTemplateId": activityActRecordDetails.actRecord.actTemplateId,
"actTimeId": activityActRecordDetails.actRecord.actTimeId,
"addressId":"",
"isDirectBuy":true,
"getType": 1,
"productId":activityActRecordDetails.actProduct.productId,
"skuId": skuId,
"skuPrice": activityActRecordDetails.actProduct.promotionPrice,
"templateType": 3
}).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
launchJoinAct = baseData.data;
toOrder();
refreshController.refreshCompleted();
});
} else {
refreshController.refreshFailed();
}
}
///
toOrder() async {
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": storeInfo,
"pageType": 3,
"isDirectBuy":true,
"productId": activityActRecordDetails.actProduct.productId,
"skuId":skuId,
"buyNum": 1,
"skuValue1":activityActRecordDetails.skuName,
"orderId":launchJoinAct.orderId
},
);
}
@override
Widget build(BuildContext context) {
return Stack(
@ -312,8 +365,11 @@ class _BargainDetails extends State<BargainDetails> {
borderRadius: BorderRadius.circular(4),
color: Color(0xFF9476F7),
),
child:Text(
(limitNumber != (activityActRecordDetails?.actRecord?.joinNum ?? 0)) ? "已砍${bargainNum.toStringAsFixed(2)}":"砍价成功",
child: Text(
(limitNumber !=
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
? "已砍${bargainNum.toStringAsFixed(2)}"
: "砍价成功",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -341,13 +397,27 @@ class _BargainDetails extends State<BargainDetails> {
child: Stack(
children: [
Container(
width:double.infinity,
width: MediaQuery.of(context).size.width * 0.8,
height: 8.h,
color: Color(0xFFF5F5F5),
),
if (double.tryParse(activityActRecordDetails
?.actProduct?.productPrice ??
"0") >
0 &&
double.tryParse(activityActRecordDetails
?.actProduct?.promotionPrice ??
"0") >
0)
Container(
width:(bargainNum/(double.tryParse(activityActRecordDetails?.actProduct?.productPrice ?? "0") -
double.tryParse(activityActRecordDetails?.actProduct?.promotionPrice ?? "0")))*MediaQuery.of(context).size.width,
width: (bargainNum /
(double.tryParse(activityActRecordDetails
?.actProduct?.productPrice ??
"0") -
double.tryParse(activityActRecordDetails
?.actProduct?.promotionPrice ??
"0"))) *
(MediaQuery.of(context).size.width * 0.8),
height: 8.h,
decoration: BoxDecoration(
gradient: LinearGradient(
@ -384,7 +454,9 @@ class _BargainDetails extends State<BargainDetails> {
),
),
TextSpan(
text: activityActRecordDetails?.actProduct?.promotionPrice ?? "",
text: activityActRecordDetails
?.actProduct?.promotionPrice ??
"",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
@ -397,6 +469,10 @@ class _BargainDetails extends State<BargainDetails> {
],
),
SizedBox(height: 16),
if ((activityActRecordDetails?.actRecord?.mid ?? "") !=
(activityActRecordDetails?.actRecordJoinList != null
? (activityActRecordDetails?.actRecordJoinList[0]?.mid ?? "")
: ""))
Row(
children: [
Expanded(
@ -424,34 +500,37 @@ class _BargainDetails extends State<BargainDetails> {
),
),
)),
// Expanded(child:GestureDetector(
// child: Container(
// alignment: Alignment.center,
// width:double.infinity,
// height:54.h,
// margin: EdgeInsets.only(left:6.w),
// decoration: BoxDecoration(
// color: Color(0xFF9476F7),
// borderRadius: BorderRadius.circular(27),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Text(
// "帮他砍价",
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// )
// ),),
if (activityActRecordDetails?.isBargain ?? false)
Expanded(
child: GestureDetector(
child: Container(
alignment: Alignment.center,
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF9476F7),
borderRadius: BorderRadius.circular(27),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Text(
"帮他砍价",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
)),
),
if (activityActRecordDetails?.isBargain ?? true)
Expanded(
child: GestureDetector(
child: Container(
@ -483,13 +562,17 @@ class _BargainDetails extends State<BargainDetails> {
),
],
),
if(limitNumber == (activityActRecordDetails?.actRecord?.joinNum ?? 0))
if (limitNumber ==
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
GestureDetector(
onTap: (){
queryLaunchAct();
},
child: Container(
alignment: Alignment.center,
width:double.infinity,
height:54.h,
margin: EdgeInsets.only(left:6.w),
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF9476F7),
borderRadius: BorderRadius.circular(27),
@ -510,41 +593,40 @@ class _BargainDetails extends State<BargainDetails> {
color: Colors.white,
),
),
)
)),
if (limitNumber !=
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
GestureDetector(
child: Container(
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(bottom: 28),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF9476F7),
borderRadius: BorderRadius.circular(27)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset("assets/image/wx.png",
width: 24,
height: 24,
fit: BoxFit.cover,
color: Colors.white),
SizedBox(
width: 8,
),
// GestureDetector(
// child:Container(
// width:double.infinity,
// height:54.h,
// margin: EdgeInsets.only(bottom: 28),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// color: Color(0xFF9476F7),
// borderRadius: BorderRadius.circular(27)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Image.asset(
// "assets/image/wx.png",
// width:24,
// height:24,
// fit: BoxFit.cover,
// ),
// SizedBox(
// width:8,
// ),
// Text(
// "邀请微信好友帮忙砍价",
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// )
// ],
// ))
// ),
Text(
"邀请微信好友帮忙砍价",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
)
],
))),
SizedBox(height: 11.h),
Text(
"剩余时间 ${((tempDay == 0) ? "" : (tempDay.toString() + ":")).toString()} ${tempHour.toString()} : ${tempM.toString()} : ${tempS.toString()}",
@ -832,7 +914,8 @@ class _BargainDetails extends State<BargainDetails> {
),
),
Text(
handleDate(activityActRecordDetails.actRecordJoinList[index].createTime),
handleDate(activityActRecordDetails
.actRecordJoinList[index].createTime),
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
@ -878,8 +961,7 @@ class _BargainDetails extends State<BargainDetails> {
}
static handleDate(String oldTime) {
String nowTime =
new DateTime.now().toString().split('.')[0];
String nowTime = new DateTime.now().toString().split('.')[0];
int nowyear = int.parse(nowTime.split(" ")[0].split('-')[0]);
int nowmonth = int.parse(nowTime.split(" ")[0].split('-')[1]);

Loading…
Cancel
Save