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. 51
      lib/settlement/settlement.dart
  5. 136
      lib/settlement/settlement_view/settlement_order_commodity.dart
  6. 90
      lib/store/shopping/shopping_goods_details.dart
  7. 224
      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: () { exitFull: () {
setState(() {}); setState(() {});
}, },
userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"], userId:widget.arguments !=null ? widget.arguments["userId"] ??widget.arguments["mid"]:"",
itemCount: 3, itemCount: 3,
isDetails: true, isDetails: true,
heightFun: (height) { 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} /// 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":"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}] /// 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} /// 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 { class ActivityActRecordDetails {
ActivityActRecordDetails({ ActivityActRecordDetails({
ActRecord actRecord, ActRecord actRecord,
List<ActRecordJoinList> actRecordJoinList, List<ActRecordJoinList> actRecordJoinList,
ActProduct actProduct, ActProduct actProduct,
String skuName,}){ dynamic skuName,
bool isBargain,}){
_actRecord = actRecord; _actRecord = actRecord;
_actRecordJoinList = actRecordJoinList; _actRecordJoinList = actRecordJoinList;
_actProduct = actProduct; _actProduct = actProduct;
_skuName = skuName; _skuName = skuName;
_isBargain = isBargain;
} }
ActivityActRecordDetails.fromJson(dynamic json) { ActivityActRecordDetails.fromJson(dynamic json) {
@ -25,16 +28,19 @@ 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'];
} }
ActRecord _actRecord; ActRecord _actRecord;
List<ActRecordJoinList> _actRecordJoinList; List<ActRecordJoinList> _actRecordJoinList;
ActProduct _actProduct; ActProduct _actProduct;
String _skuName; dynamic _skuName;
bool _isBargain;
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;
String get skuName => _skuName; dynamic get skuName => _skuName;
bool get isBargain => _isBargain;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
@ -48,6 +54,7 @@ class ActivityActRecordDetails {
map['actProduct'] = _actProduct.toJson(); map['actProduct'] = _actProduct.toJson();
} }
map['skuName'] = _skuName; map['skuName'] = _skuName;
map['isBargain'] = _isBargain;
return map; return map;
} }
@ -232,23 +239,23 @@ class SkuJson {
} }
/// id : "1494198857217605632" /// id : "1496692045677330432"
/// createTime : "2022-02-17 14:35:43" /// createTime : "2022-02-24 11:42:46"
/// createUser : "1478548720785031168" /// createUser : "1496056013827080192"
/// updateTime : "2022-02-17 14:35:43" /// updateTime : "2022-02-24 11:42:46"
/// updateUser : "1478548720785031168" /// updateUser : "1496056013827080192"
/// storeId : "1460885296764682240" /// storeId : "1460885296764682240"
/// type : 3 /// type : 3
/// actTemplateId : "1490572026815971328" /// actTemplateId : "1490572026815971328"
/// actTimeId : "1490572027034075136" /// actTimeId : "1490572027034075136"
/// actRecordId : "1494198857058222080" /// actRecordId : "1496692045555695616"
/// mid : "1478548720785031168" /// mid : "1496056013827080192"
/// orderId : null /// orderId : null
/// isLeader : true /// isLeader : true
/// memberAvatar : "" /// memberAvatar : ""
/// memberNickname : "" /// memberNickname : ""
/// productId : "1494198261018263552" /// productId : "1494198261018263552"
/// actPrice : "57.81" /// actPrice : "54.45"
/// state : true /// state : true
/// isDelete : 0 /// isDelete : 0
@ -381,21 +388,22 @@ class ActRecordJoinList {
} }
/// id : "1494198857058222080" /// id : "1496692045555695616"
/// createTime : "2022-02-17 14:35:43" /// createTime : "2022-02-24 11:42:46"
/// createUser : "1478548720785031168" /// createUser : "1496056013827080192"
/// updateTime : "2022-02-17 14:35:43" /// updateTime : "2022-02-24 11:42:46"
/// updateUser : "1478548720785031168" /// updateUser : "1496056013827080192"
/// storeId : "1460885296764682240" /// storeId : "1460885296764682240"
/// type : 3 /// type : 3
/// actTemplateId : "1490572026815971328" /// actTemplateId : "1490572026815971328"
/// actTimeId : "1490572027034075136" /// actTimeId : "1490572027034075136"
/// actProductId : "1494198261018263552" /// actProductId : "1494198261018263552"
/// mid : "1478548720785031168" /// mid : "1496056013827080192"
/// isDirectBuy : false
/// joinNum : 1 /// joinNum : 1
/// startTime : "2022-02-17 14:35:43" /// startTime : "2022-02-24 11:42:46"
/// endTime : "2022-02-17 16:35:43" /// endTime : "2022-02-24 13:42:46"
/// state : 2 /// state : 4
/// isDelete : 0 /// isDelete : 0
class ActRecord { class ActRecord {
@ -411,6 +419,7 @@ class ActRecord {
String actTimeId, String actTimeId,
String actProductId, String actProductId,
String mid, String mid,
bool isDirectBuy,
int joinNum, int joinNum,
String startTime, String startTime,
String endTime, String endTime,
@ -427,6 +436,7 @@ class ActRecord {
_actTimeId = actTimeId; _actTimeId = actTimeId;
_actProductId = actProductId; _actProductId = actProductId;
_mid = mid; _mid = mid;
_isDirectBuy = isDirectBuy;
_joinNum = joinNum; _joinNum = joinNum;
_startTime = startTime; _startTime = startTime;
_endTime = endTime; _endTime = endTime;
@ -446,6 +456,7 @@ class ActRecord {
_actTimeId = json['actTimeId']; _actTimeId = json['actTimeId'];
_actProductId = json['actProductId']; _actProductId = json['actProductId'];
_mid = json['mid']; _mid = json['mid'];
_isDirectBuy = json['isDirectBuy'];
_joinNum = json['joinNum']; _joinNum = json['joinNum'];
_startTime = json['startTime']; _startTime = json['startTime'];
_endTime = json['endTime']; _endTime = json['endTime'];
@ -463,6 +474,7 @@ class ActRecord {
String _actTimeId; String _actTimeId;
String _actProductId; String _actProductId;
String _mid; String _mid;
bool _isDirectBuy;
int _joinNum; int _joinNum;
String _startTime; String _startTime;
String _endTime; String _endTime;
@ -480,6 +492,7 @@ class ActRecord {
String get actTimeId => _actTimeId; String get actTimeId => _actTimeId;
String get actProductId => _actProductId; String get actProductId => _actProductId;
String get mid => _mid; String get mid => _mid;
bool get isDirectBuy => _isDirectBuy;
int get joinNum => _joinNum; int get joinNum => _joinNum;
String get startTime => _startTime; String get startTime => _startTime;
String get endTime => _endTime; String get endTime => _endTime;
@ -499,6 +512,7 @@ class ActRecord {
map['actTimeId'] = _actTimeId; map['actTimeId'] = _actTimeId;
map['actProductId'] = _actProductId; map['actProductId'] = _actProductId;
map['mid'] = _mid; map['mid'] = _mid;
map['isDirectBuy'] = _isDirectBuy;
map['joinNum'] = _joinNum; map['joinNum'] = _joinNum;
map['startTime'] = _startTime; map['startTime'] = _startTime;
map['endTime'] = _endTime; 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 'package:retrofit/retrofit.dart';
import 'data/achievement_detail_list.dart'; import 'data/achievement_detail_list.dart';
import 'data/activity_area_list.dart';
import 'data/address.dart'; import 'data/address.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand_data.dart'; import 'data/brand_data.dart';

51
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:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.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/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/down_order.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/min_order_info.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
@ -59,12 +61,13 @@ class _Settlement extends State<Settlement> {
int tableId = 0; int tableId = 0;
int numberOfPeople = 0; int numberOfPeople = 0;
String pageType = "1"; String pageType = "1";
Address address; Address address;
CouponListBean couponListBean; CouponListBean couponListBean;
PromotionInfoListBean promotion; PromotionInfoListBean promotion;
String mobile; String mobile;
bool placeOrder = false; bool placeOrder = false;
String actProductId;
String actProductSkuId;
@override @override
void initState() { void initState() {
@ -77,6 +80,8 @@ class _Settlement extends State<Settlement> {
promotions = widget.arguments["pName"] ?? ""; promotions = widget.arguments["pName"] ?? "";
coupons = widget.arguments["cName"] ?? ""; coupons = widget.arguments["cName"] ?? "";
pageType = widget.arguments["pageType"]; pageType = widget.arguments["pageType"];
actProductId = widget.arguments["actProductId"];
actProductSkuId = widget.arguments["actProductSkuId"];
if (tableId == 0) { if (tableId == 0) {
placeOrder = true; placeOrder = true;
} }
@ -98,6 +103,8 @@ class _Settlement extends State<Settlement> {
null, null,
0, 0,
widget.arguments["pid"], widget.arguments["pid"],
actProductId ?? "",
actProductSkuId ?? "",
); );
} else if (coupons != null && coupons != "" || tableId <= 0) { } else if (coupons != null && coupons != "" || tableId <= 0) {
queryOrderInfo( queryOrderInfo(
@ -106,9 +113,13 @@ class _Settlement extends State<Settlement> {
widget.arguments["cid"], widget.arguments["cid"],
0, 0,
null, null,
actProductId ?? "",
actProductSkuId ?? "",
); );
} else } else
queryOrderInfo(null, selectedBtn, null, 0, null); queryOrderInfo(null, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
}); });
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
@ -124,13 +135,17 @@ class _Settlement extends State<Settlement> {
memberCouponId, memberCouponId,
orderId, orderId,
promotionId, promotionId,
actProductId,
actProductSkuId,
) async { ) async {
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({ BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
"addressId": addressId, "addressId": addressId,
"isTake": isTake, "isTake": isTake,
"memberCouponId": memberCouponId, "memberCouponId": memberCouponId,
"orderId": orderId, "orderId": orderId,
"promotionId": promotionId "promotionId": promotionId,
"actProductId": actProductId,
"actProductSkuId": actProductSkuId
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
@ -138,7 +153,8 @@ class _Settlement extends State<Settlement> {
if (settleOrderInfo.orderProductList == null || if (settleOrderInfo.orderProductList == null ||
settleOrderInfo.orderProductList.length == 0) { settleOrderInfo.orderProductList.length == 0) {
placeOrder = true; placeOrder = true;
queryOrderDetails(parentId); queryOrderDetails(
pageType != null ? widget.arguments["orderId"] : parentId);
} }
}); });
} }
@ -148,7 +164,7 @@ class _Settlement extends State<Settlement> {
queryOrderDetails(id) async { queryOrderDetails(id) async {
print("ididididididid: $id"); print("ididididididid: $id");
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({ BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({
"id": id, "id": widget.arguments["orderId"],
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
@ -162,7 +178,9 @@ class _Settlement extends State<Settlement> {
this.selectedBtn = selectedBtn; this.selectedBtn = selectedBtn;
}); });
if (address != null) { if (address != null) {
queryOrderInfo(address.id, selectedBtn, null, 0, null); queryOrderInfo(address.id, selectedBtn, null, 0, null,
actProductId ?? "",
actProductSkuId ?? "",);
return; return;
} }
BaseData<List<Address>> baseDate = 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,7 +455,9 @@ class _Settlement extends State<Settlement> {
this.selectedBtn = 0; this.selectedBtn = 0;
}); });
queryOrderInfo(addressId, isTake, queryOrderInfo(addressId, isTake,
memberCouponId, orderId, promotionId); memberCouponId, orderId, promotionId,
actProductId ?? "",
actProductSkuId ?? "",);
}, queryAddress, storeInfo, address, }, queryAddress, storeInfo, address,
selectedAddress, pageType), selectedAddress, pageType),
@ -453,6 +477,7 @@ class _Settlement extends State<Settlement> {
settleOrderInfo, settleOrderInfo,
minOrderInfo, minOrderInfo,
tableId, tableId,
pageType,
), ),
///// /////
@ -505,9 +530,9 @@ class _Settlement extends State<Settlement> {
), ),
), ),
Text( Text(
minOrderInfo != null (minOrderInfo != null
? "${minOrderInfo.orderSumPrice}" ? "${minOrderInfo.orderSumPrice}"
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}", : "${settleOrderInfo == null ? "0" : settleOrderInfo.price}"),
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -593,6 +618,8 @@ class _Settlement extends State<Settlement> {
couponListBean != null ? couponListBean.id : null, couponListBean != null ? couponListBean.id : null,
0, 0,
null, null,
actProductId ?? "",
actProductSkuId ?? "",
); );
} }
} }
@ -617,6 +644,8 @@ class _Settlement extends State<Settlement> {
null, null,
0, 0,
promotion != null ? promotion.id : null, 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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.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/min_order_info.dart';
import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/order_product_vo.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
@ -14,9 +15,10 @@ class SettlementOrderCommodity extends StatefulWidget {
final SettleOrderInfo settleOrderInfo; final SettleOrderInfo settleOrderInfo;
final MinOrderInfo minOrderInfo; final MinOrderInfo minOrderInfo;
final String pageType;
SettlementOrderCommodity( SettlementOrderCommodity(
this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId); this.isTakeOut, this.settleOrderInfo, this.minOrderInfo,this.tableId,this.pageType,);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -111,7 +113,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
color: Colors.grey, color: Colors.grey,
), ),
)); ));
widgets.add(buildTotalPrice()); // widgets.add(buildTotalPrice());
return widgets; return widgets;
} }
@ -315,71 +317,71 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
); );
} }
Widget buildTotalPrice() { // Widget buildTotalPrice() {
return Container( // return Container(
margin: EdgeInsets.only(top: 7.h, bottom: 11.h), // margin: EdgeInsets.only(top: 7.h, bottom: 11.h),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.end, // mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.baseline, // crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic, // textBaseline: TextBaseline.alphabetic,
children: [ // children: [
Expanded( // Expanded(
child: Text( // child: Text(
S.of(context).gongjijianshangpin((widget.minOrderInfo != null) // S.of(context).gongjijianshangpin((widget.minOrderInfo != null)
? ((widget.minOrderInfo != null) // ? ((widget.minOrderInfo != null)
? widget.minOrderInfo.orderProductVOList.length // ? widget.minOrderInfo.orderProductVOList.length
: "0") // : "0")
: (widget.settleOrderInfo != null) // : (widget.settleOrderInfo != null)
? widget.settleOrderInfo.orderProductList.length // ? widget.settleOrderInfo.orderProductList.length
: "0"), // : "0"),
style: TextStyle( // style: TextStyle(
fontSize: 10.sp, // fontSize: 10.sp,
color: Color(0xFFA29E9E), // color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.semi_bold, // fontWeight: MyFontWeight.semi_bold,
), // ),
), // ),
flex: 1, // flex: 1,
), // ),
Container( // Container(
child: Text( // child: Text(
"已优惠:¥${discountPrice()}", // "已优惠:¥${discountPrice()}",
style: TextStyle( // style: TextStyle(
fontSize: 12.sp, // fontSize: 12.sp,
color: Color(0xFF7B7B7B), // color: Color(0xFF7B7B7B),
fontWeight: MyFontWeight.medium, // fontWeight: MyFontWeight.medium,
), // ),
), // ),
), // ),
SizedBox( // SizedBox(
width: 15.w, // width: 15.w,
), // ),
//
Container( // Container(
child: Text( // child: Text(
S.of(context).jiesuanjine, // S.of(context).jiesuanjine,
style: TextStyle( // style: TextStyle(
fontSize: 12.sp, // fontSize: 12.sp,
color: Color(0xFF353535), // color: Color(0xFF353535),
fontWeight: MyFontWeight.semi_bold, // fontWeight: MyFontWeight.semi_bold,
), // ),
), // ),
), // ),
SizedBox( // SizedBox(
width: 5.w, // width: 5.w,
), // ),
Text( // Text(
totalPrice(), // totalPrice(),
textAlign: TextAlign.end, // textAlign: TextAlign.end,
style: TextStyle( // style: TextStyle(
fontSize: 14.sp, // fontSize: 14.sp,
color: Color(0xFF32A060), // color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold, // fontWeight: MyFontWeight.semi_bold,
), // ),
), // ),
], // ],
), // ),
); // );
} // }
String discountPrice(){ String discountPrice(){
if(widget.minOrderInfo != null){ if(widget.minOrderInfo != null){

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

224
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:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; import 'package:huixiang/retrofit/data/activity_actRecord_details.dart';
import 'package:huixiang/retrofit/data/base_data.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/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -41,6 +44,9 @@ class _BargainDetails extends State<BargainDetails> {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
int limitNumber = 0; int limitNumber = 0;
double bargainNum = 0; double bargainNum = 0;
LaunchJoinAct launchJoinAct;
StoreInfo storeInfo;
String skuId;
@override @override
void dispose() { void dispose() {
@ -57,6 +63,8 @@ class _BargainDetails extends State<BargainDetails> {
super.initState(); super.initState();
actRecordId = widget.arguments["actRecordId"]; actRecordId = widget.arguments["actRecordId"];
limitNumber = widget.arguments["limitNumber"]; limitNumber = widget.arguments["limitNumber"];
storeInfo = widget.arguments["storeInfo"];
skuId = widget.arguments["skuId"];
startCountdownTimer(); startCountdownTimer();
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken"); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
@ -313,7 +366,10 @@ class _BargainDetails extends State<BargainDetails> {
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
), ),
child: Text( child: Text(
(limitNumber != (activityActRecordDetails?.actRecord?.joinNum ?? 0)) ? "已砍${bargainNum.toStringAsFixed(2)}":"砍价成功", (limitNumber !=
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
? "已砍${bargainNum.toStringAsFixed(2)}"
: "砍价成功",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -341,13 +397,27 @@ class _BargainDetails extends State<BargainDetails> {
child: Stack( child: Stack(
children: [ children: [
Container( Container(
width:double.infinity, width: MediaQuery.of(context).size.width * 0.8,
height: 8.h, height: 8.h,
color: Color(0xFFF5F5F5), color: Color(0xFFF5F5F5),
), ),
if (double.tryParse(activityActRecordDetails
?.actProduct?.productPrice ??
"0") >
0 &&
double.tryParse(activityActRecordDetails
?.actProduct?.promotionPrice ??
"0") >
0)
Container( Container(
width:(bargainNum/(double.tryParse(activityActRecordDetails?.actProduct?.productPrice ?? "0") - width: (bargainNum /
double.tryParse(activityActRecordDetails?.actProduct?.promotionPrice ?? "0")))*MediaQuery.of(context).size.width, (double.tryParse(activityActRecordDetails
?.actProduct?.productPrice ??
"0") -
double.tryParse(activityActRecordDetails
?.actProduct?.promotionPrice ??
"0"))) *
(MediaQuery.of(context).size.width * 0.8),
height: 8.h, height: 8.h,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
@ -384,7 +454,9 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
TextSpan( TextSpan(
text: activityActRecordDetails?.actProduct?.promotionPrice ?? "", text: activityActRecordDetails
?.actProduct?.promotionPrice ??
"",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -397,6 +469,10 @@ class _BargainDetails extends State<BargainDetails> {
], ],
), ),
SizedBox(height: 16), SizedBox(height: 16),
if ((activityActRecordDetails?.actRecord?.mid ?? "") !=
(activityActRecordDetails?.actRecordJoinList != null
? (activityActRecordDetails?.actRecordJoinList[0]?.mid ?? "")
: ""))
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -424,34 +500,37 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
)), )),
// Expanded(child:GestureDetector( if (activityActRecordDetails?.isBargain ?? false)
// child: Container( Expanded(
// alignment: Alignment.center, child: GestureDetector(
// width:double.infinity, child: Container(
// height:54.h, alignment: Alignment.center,
// margin: EdgeInsets.only(left:6.w), width: double.infinity,
// decoration: BoxDecoration( height: 54.h,
// color: Color(0xFF9476F7), margin: EdgeInsets.only(left: 6.w),
// borderRadius: BorderRadius.circular(27), decoration: BoxDecoration(
// boxShadow: [ color: Color(0xFF9476F7),
// BoxShadow( borderRadius: BorderRadius.circular(27),
// color: Colors.black.withAlpha(12), boxShadow: [
// offset: Offset(0, 3), BoxShadow(
// blurRadius: 14, color: Colors.black.withAlpha(12),
// spreadRadius: 0, offset: Offset(0, 3),
// ), blurRadius: 14,
// ], spreadRadius: 0,
// ), ),
// child: Text( ],
// "帮他砍价", ),
// style: TextStyle( child: Text(
// fontSize: 16.sp, "帮他砍价",
// fontWeight: MyFontWeight.medium, style: TextStyle(
// color: Colors.white, fontSize: 16.sp,
// ), fontWeight: MyFontWeight.medium,
// ), color: Colors.white,
// ) ),
// ),), ),
)),
),
if (activityActRecordDetails?.isBargain ?? true)
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
child: Container( child: Container(
@ -483,8 +562,12 @@ class _BargainDetails extends State<BargainDetails> {
), ),
], ],
), ),
if(limitNumber == (activityActRecordDetails?.actRecord?.joinNum ?? 0)) if (limitNumber ==
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
GestureDetector( GestureDetector(
onTap: (){
queryLaunchAct();
},
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width: double.infinity, width: double.infinity,
@ -510,41 +593,40 @@ class _BargainDetails extends State<BargainDetails> {
color: Colors.white, 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( Text(
// child:Container( "邀请微信好友帮忙砍价",
// width:double.infinity, style: TextStyle(
// height:54.h, fontSize: 16.sp,
// margin: EdgeInsets.only(bottom: 28), fontWeight: MyFontWeight.medium,
// alignment: Alignment.center, color: Colors.white,
// 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,
// ),
// )
// ],
// ))
// ),
SizedBox(height: 11.h), SizedBox(height: 11.h),
Text( Text(
"剩余时间 ${((tempDay == 0) ? "" : (tempDay.toString() + ":")).toString()} ${tempHour.toString()} : ${tempM.toString()} : ${tempS.toString()}", "剩余时间 ${((tempDay == 0) ? "" : (tempDay.toString() + ":")).toString()} ${tempHour.toString()} : ${tempM.toString()} : ${tempS.toString()}",
@ -832,7 +914,8 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
Text( Text(
handleDate(activityActRecordDetails.actRecordJoinList[index].createTime), handleDate(activityActRecordDetails
.actRecordJoinList[index].createTime),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -878,8 +961,7 @@ class _BargainDetails extends State<BargainDetails> {
} }
static handleDate(String oldTime) { static handleDate(String oldTime) {
String nowTime = String nowTime = new DateTime.now().toString().split('.')[0];
new DateTime.now().toString().split('.')[0];
int nowyear = int.parse(nowTime.split(" ")[0].split('-')[0]); int nowyear = int.parse(nowTime.split(" ")[0].split('-')[0]);
int nowmonth = int.parse(nowTime.split(" ")[0].split('-')[1]); int nowmonth = int.parse(nowTime.split(" ")[0].split('-')[1]);

Loading…
Cancel
Save