From 5ab6129100409517d2fb5b846e1a70ecc2176fcb Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 28 Mar 2022 18:20:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/order_detail_page.dart | 4 +- lib/retrofit/min_api.dart | 4 +- lib/retrofit/min_api.g.dart | 2 +- lib/retrofit/retrofit_api.dart | 4 +- lib/retrofit/retrofit_api.g.dart | 2 +- lib/settlement/settlement.dart | 108 ++- lib/settlement/settlement_model.dart | 15 + .../shopping/activity_prefecture_details.dart | 2 +- .../shopping/shopping_goods_details.dart | 625 +++++++++--------- .../shopping_home/bargain_details.dart | 78 +-- .../shopping/shopping_home/search_page.dart | 1 + 11 files changed, 451 insertions(+), 394 deletions(-) create mode 100644 lib/settlement/settlement_model.dart diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 18cec76c..bab21ef5 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -350,9 +350,7 @@ class _OrderDetailPage extends State { ), ), Text( - S - .of(context) - .yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), + S.of(context).yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), style: TextStyle( fontSize: 20.sp, color: Color(0xFF32A060), diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 1b7d24cd..1a323135 100644 --- a/lib/retrofit/min_api.dart +++ b/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.66:8775/app/";///詹云久 -const baseUrl = "http://192.168.10.66:8775/app/";///詹云久 +const base_url = "http://192.168.10.96:8765/app/";///詹云久 +const baseUrl = "http://192.168.10.96:8765/app/";///詹云久 // const base_url = "http://192.168.10.37:8766/app/"; diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 1c268f85..55c6150f 100644 --- a/lib/retrofit/min_api.g.dart +++ b/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.66:8775/app/'; + baseUrl ??= 'http://192.168.10.96:8765/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index ac8c2789..f3b2c7b5 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/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.66:8776/app/";///詹云久 -const baseUrl = "http://192.168.10.66:8776/app/";///詹云久 +const base_url = "http://192.168.10.96:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.96:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 55bd06ea..c8cf94eb 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/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.66:8776/app/'; + baseUrl ??= 'http://192.168.10.96:8766/app/'; } final Dio _dio; diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index ae5d9339..0a861987 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -20,6 +20,7 @@ import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/min_api.dart'; +import 'package:huixiang/settlement/settlement_model.dart'; import 'package:huixiang/settlement/settlement_view/activity_coupon_remarks.dart'; import 'package:huixiang/settlement/settlement_view/distribution.dart'; import 'package:huixiang/settlement/settlement_view/pay_method.dart'; @@ -69,10 +70,14 @@ class _Settlement extends State { String actProductId; String actProductSkuId; ActivityDetails activityDetails; - int bargainType = 0; + BargainType bargainType = BargainType.BargainZBug; LaunchJoinAct launchJoinAct; String skuPrice1; - int joinA = 0; + JoinActivity joinA = JoinActivity.GoJoin; + String bargainOrderId; + String productSkuId; + int count1 = 0; + String productId; @override void initState() { @@ -91,6 +96,10 @@ class _Settlement extends State { bargainType = widget.arguments["bargainType"]; skuPrice1 = widget.arguments["skuPrice1"]; joinA = widget.arguments["joinA"]; + bargainOrderId = widget.arguments["bargainOrderId"]; + productSkuId = widget.arguments["productSkuId"]; + count1 = widget.arguments["buyNum"]; + productId = widget.arguments["productId"]; if (tableId == 0) { placeOrder = true; } @@ -111,9 +120,11 @@ class _Settlement extends State { selectedBtn, null, 0, - widget.arguments["pid"], + widget.arguments["pid"] ?? (productId?? ""), + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1, ); } else if (coupons != null && coupons != "" || tableId <= 0) { queryOrderInfo( @@ -121,9 +132,11 @@ class _Settlement extends State { selectedBtn, widget.arguments["cid"], 0, - null, + productId?? null, + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1, ); } else queryOrderInfo( @@ -131,9 +144,11 @@ class _Settlement extends State { selectedBtn, null, 0, - null, + productId ?? "", + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1, ); }); @@ -150,8 +165,10 @@ class _Settlement extends State { memberCouponId, orderId, promotionId, + productSkuId, actProductId, actProductSkuId, + buyNum, ) async { BaseData baseData = await minService.getOrderInfo({ "addressId": addressId, @@ -159,8 +176,10 @@ class _Settlement extends State { "memberCouponId": memberCouponId, "orderId": orderId, "promotionId": promotionId, + "productSkuId":productSkuId, "actProductId": actProductId, - "actProductSkuId": actProductSkuId + "actProductSkuId": actProductSkuId, + "buyNum":buyNum }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { @@ -186,7 +205,7 @@ class _Settlement extends State { minOrderInfo = baseData.data; }); } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); } } @@ -200,9 +219,11 @@ class _Settlement extends State { selectedBtn, null, 0, - null, + productId?? null, + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); return; } @@ -252,9 +273,11 @@ class _Settlement extends State { selectedBtn, null, 0, - null, + productId?? null, + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); } } @@ -276,9 +299,11 @@ class _Settlement extends State { selectedBtn, null, 0, - null, + productId?? null, + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); } } @@ -288,32 +313,26 @@ class _Settlement extends State { ///发起活动 queryLaunchAct() async { - // if (minService == null) - // minService = MinApiService( - // Dio(), - // context: context, - // token: minToken, - // tenant: tenant, - // storeId: storeId, - // showLoading: false, - // ); BaseData baseData = await minService.launchAct({ "actProductId": activityDetails.actProduct.id, "actRecordId": 0, "actTemplateId": activityDetails.actProduct.templateId, "actTimeId": activityDetails.actProduct.timeId, "addressId": address == null ? null : address.id, - "isDirectBuy": (bargainType == 1 || bargainType == 2) ? false : true, + "isDirectBuy": (bargainType == BargainType.BargainBug || + bargainType == BargainType.CollageBug) + ? false + : true, "getType": selectedBtn, "productId": activityDetails.actProduct.productId, "skuId": actProductSkuId ?? "", - "skuPrice": skuPrice1, + "skuPrice": settleOrderInfo.price, "templateType": pageType, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { launchJoinAct = baseData.data; - if (bargainType == 1) { + if (bargainType == BargainType.BargainBug) { toBargain(); } else { activityPay(); @@ -333,7 +352,10 @@ class _Settlement extends State { "actTemplateId": activityDetails.actProduct.templateId, "actTimeId": activityDetails.actProduct.timeId, "addressId": address == null ? null : address.id, - "isDirectBuy": (bargainType == 1 || bargainType == 2) ? false : true, + "isDirectBuy": (bargainType == BargainType.BargainBug || + bargainType == BargainType.CollageBug) + ? false + : true, "getType": selectedBtn, "productId": activityDetails.actProduct.productId, "skuId": actProductSkuId ?? "", @@ -517,7 +539,8 @@ class _Settlement extends State { } } BaseData baseData = await minService.actPay({ - "orderId": launchJoinAct.orderId, + "orderId": + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId, "payChannel": placeOrderFirst.payChannel }).catchError((error) { print(error); @@ -541,18 +564,22 @@ class _Settlement extends State { } } else { BaseData baseData = await minService.actPay({ - "orderId": launchJoinAct.orderId, + "orderId": + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId, "payChannel": payChannel }).catchError((error) { print(error); }); if (baseData != null && baseData.isSuccess) { - toOrderDetails(launchJoinAct.orderId); + toOrderDetails( + bargainOrderId != null ? bargainOrderId : launchJoinAct.orderId); } else { SmartDialog.show( widget: Tips( () { - toOrderDetails(launchJoinAct.orderId); + toOrderDetails(bargainOrderId != null + ? bargainOrderId + : launchJoinAct.orderId); }, text: "${baseData.msg}", )); @@ -627,9 +654,11 @@ class _Settlement extends State { isTake, memberCouponId, orderId, - promotionId, + promotionId ?? (productId?? ""), + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); }, queryAddress, storeInfo, address, selectedAddress, pageType), @@ -676,7 +705,8 @@ class _Settlement extends State { tableId, ), - if (placeOrder) + if (placeOrder && + joinA != JoinActivity.BargainBug) ///支付方式 PayMethod(payChannelCheck), @@ -718,7 +748,9 @@ class _Settlement extends State { RoundButton( width: 103.w, height: 54.h, - text: placeOrder ? S.current.jiesuan : "下单", + text: joinA == JoinActivity.BargainBug + ? "发起砍价" + : (placeOrder ? S.current.jiesuan : "下单"), textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFF32A060), @@ -728,9 +760,11 @@ class _Settlement extends State { ), callback: () { pageType != null - ? joinA == 0 - ? queryJoinAct() - : queryLaunchAct() + ? bargainOrderId != null + ? activityPay() + : joinA == JoinActivity.GoJoin + ? queryJoinAct() + : queryLaunchAct() : queryPlaceOrderFirst(); }, ), @@ -794,9 +828,11 @@ class _Settlement extends State { selectedBtn, couponListBean != null ? couponListBean.id : null, 0, - null, + productId?? null, + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); } } @@ -820,9 +856,11 @@ class _Settlement extends State { selectedBtn, null, 0, - promotion != null ? promotion.id : null, + promotion != null ? promotion.id : (productId?? null), + productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", + count1 ); } } diff --git a/lib/settlement/settlement_model.dart b/lib/settlement/settlement_model.dart new file mode 100644 index 00000000..57147d92 --- /dev/null +++ b/lib/settlement/settlement_model.dart @@ -0,0 +1,15 @@ +enum BargainType { + BargainZBug, + BargainBug, + CollageBug, +} + +enum JoinActivity { + GoJoin, + CollageBug, + CollageZBug, + BargainZBug, + MZBug, + MBug, + BargainBug, +} diff --git a/lib/store/shopping/activity_prefecture_details.dart b/lib/store/shopping/activity_prefecture_details.dart index 8ccdbbbd..f85b873f 100644 --- a/lib/store/shopping/activity_prefecture_details.dart +++ b/lib/store/shopping/activity_prefecture_details.dart @@ -873,7 +873,7 @@ class _ActivityPrefectureDetails extends State { color: Color(0xFFFFCD00), ), child: Text( - "最高可砍${double.parse(productList?.productPrice ?? "0") - double.parse(productList?.promotionPrice ?? "0")}元", + "最高可砍${(double.parse(productList?.productPrice ?? "0") - double.parse(productList?.promotionPrice ?? "0")).toStringAsFixed(2)}元", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, diff --git a/lib/store/shopping/shopping_goods_details.dart b/lib/store/shopping/shopping_goods_details.dart index dc059f91..617aaa34 100644 --- a/lib/store/shopping/shopping_goods_details.dart +++ b/lib/store/shopping/shopping_goods_details.dart @@ -18,6 +18,7 @@ import 'package:huixiang/retrofit/data/shoppingCart.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/settlement/settlement_model.dart'; import 'package:huixiang/store/store_view/product_sku.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -80,9 +81,9 @@ class _ShoppingGoodsDetails extends State { int tempM = 0; int tempS = 0; LaunchJoinAct launchJoinAct; - int bargainType = 0; + BargainType bargainType = BargainType.BargainZBug; String indexP; - int joinA = 0; + JoinActivity joinA = JoinActivity.GoJoin; @override void dispose() { @@ -105,8 +106,7 @@ class _ShoppingGoodsDetails extends State { limitTime = widget.arguments["limitTime"]; bannerImg = widget.arguments["bannerImg"]; productId = widget.arguments["productId"]; - - startCountdownTimer(); + if (pageType == "1") startCountdownTimer(); debugPrint("store_param tenant:$tenant storeId:$storeId"); SharedPreferences.getInstance().then((value) { @@ -251,7 +251,7 @@ class _ShoppingGoodsDetails extends State { } } - ///发起活动 + // ///发起活动 // queryLaunchAct() async { // if (minService == null) // minService = MinApiService( @@ -270,7 +270,10 @@ class _ShoppingGoodsDetails extends State { // "actTemplateId": activityDetails.actProduct.templateId, // "actTimeId": activityDetails.actProduct.timeId, // "addressId": "", - // "isDirectBuy": (bargainType == 1 || bargainType == 2) ? false : true, + // "isDirectBuy": (bargainType == BargainType.BargainBug || + // bargainType == BargainType.CollageBug) + // ? false + // : true, // "getType": 3, // "productId": // pageType == null ? productId : activityDetails.actProduct.productId, @@ -283,42 +286,12 @@ class _ShoppingGoodsDetails extends State { // if (baseData != null && baseData.isSuccess) { // setState(() { // launchJoinAct = baseData.data; - // toBargain(); + // toBargain(); // refreshController.refreshCompleted(); // }); // } else { - // if((activityDetails?.actProduct?.productStock ?? 0) == 0) - // SmartDialog.showToast("活动商品售罄",alignment: Alignment.center); - // refreshController.refreshFailed(); - // } - // } - // - // ///参与活动 - // queryJoinAct() async { - // BaseData baseData = await minService.joinAct({ - // "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, - // "skuId": skuId1, - // "skuPrice": skuPrice1, - // "templateType": pageType, - // }).catchError((error) { - // refreshController.refreshFailed(); - // }); - // if (baseData != null && baseData.isSuccess) { - // launchJoinAct = baseData.data; - // toOrder(); - // refreshController.refreshCompleted(); - // } else { - // SmartDialog.showToast(baseData.msg,alignment: Alignment.center); + // if ((activityDetails?.actProduct?.productStock ?? 0) == 0) + // SmartDialog.showToast("活动商品售罄", alignment: Alignment.center); // refreshController.refreshFailed(); // } // } @@ -468,7 +441,7 @@ class _ShoppingGoodsDetails extends State { if (isDispose) return; setState(() { var tempDateTime = - DateTime.parse(activityDetails.endTime).difference(DateTime.now()); + DateTime.parse(activityDetails.endTime).difference(DateTime.now()); if (tempDateTime.inSeconds < 0) { tempDay = 0; tempHour = 0; @@ -520,6 +493,23 @@ class _ShoppingGoodsDetails extends State { ); } + ///普通商品直接购买去下单结算页面 + toGoods() async { + if (count1 == 0) { + SmartDialog.showToast("请先选择您要购买的商品!~"); + return; + } + await Navigator.of(context).pushNamed( + '/router/settlement', + arguments: { + "storeInfo": storeInfo, + "productId": miNiDetail.id, + "productSkuId": skuId1, + "buyNum": count1, + }, + ); + } + ///直接购买去下单结算页面 toOrder() async { await Navigator.of(context).pushNamed( @@ -534,14 +524,13 @@ class _ShoppingGoodsDetails extends State { "skuId": skuId1, "buyNum": count1, "skuValue1": skuValue1, - // "orderId": launchJoinAct.orderId, "actProductId": actProductId, "actProductSkuId": skuId1, - "activityDetails":activityDetails, - "bargainType":bargainType, - "skuPrice1":skuPrice1, - "joinA":joinA, - "indexP":indexP + "activityDetails": activityDetails, + "bargainType": bargainType, + "skuPrice1": skuPrice1, + "joinA": joinA, + "indexP": indexP }, ).then((value) { _onRefresh(); @@ -549,15 +538,15 @@ class _ShoppingGoodsDetails extends State { }); } - ///去砍价详情页面 - toBargain() async { - await Navigator.of(context) - .pushNamed('/router/bargain_details', arguments: { - "actRecordId": launchJoinAct.actRecordId, - "limitNumber": limitNumber, - "storeInfo": storeInfo, - }); - } + // ///去砍价详情页面 + // toBargain() async { + // await Navigator.of(context) + // .pushNamed('/router/bargain_details', arguments: { + // "actRecordId": launchJoinAct.actRecordId, + // "limitNumber": limitNumber, + // "storeInfo": storeInfo, + // }); + // } @override Widget build(BuildContext context) { @@ -631,7 +620,9 @@ class _ShoppingGoodsDetails extends State { color: Colors.white, margin: EdgeInsets.only(bottom: 72.h), child: Html( - data: pageType != null ? (activityDetails?.actProduct?.detail ?? "") : (miNiDetail?.detail ?? ""), + data: pageType != null + ? (activityDetails?.actProduct?.detail ?? "") + : (miNiDetail?.detail ?? ""), customImageRenders: { networkSourceMatcher(): networkImageRender( loadingWidget: () { @@ -777,11 +768,7 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - if (count1 == 0) { - SmartDialog.showToast("请先选择您要购买的商品!~"); - return; - } - // queryLaunchAct(); + toGoods(); }, child: Container( alignment: Alignment.center, @@ -818,7 +805,7 @@ class _ShoppingGoodsDetails extends State { children: [ GestureDetector( onTap: () { - joinA=4; + joinA = JoinActivity.MZBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -879,7 +866,7 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - joinA=5; + joinA = JoinActivity.MBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -951,8 +938,8 @@ class _ShoppingGoodsDetails extends State { children: [ GestureDetector( onTap: () { - bargainType = 0; - joinA=3; + bargainType = BargainType.BargainZBug; + joinA = JoinActivity.BargainZBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -1013,7 +1000,8 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - bargainType = 1; + bargainType = BargainType.BargainBug; + joinA = JoinActivity.BargainBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -1085,7 +1073,7 @@ class _ShoppingGoodsDetails extends State { children: [ GestureDetector( onTap: () { - joinA = 2; + joinA = JoinActivity.CollageZBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -1146,8 +1134,8 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - bargainType = 2; - joinA = 1; + bargainType = BargainType.CollageBug; + joinA = JoinActivity.CollageBug; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); return; @@ -1252,12 +1240,8 @@ class _ShoppingGoodsDetails extends State { gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, - colors: [ - Color(0xFF32A057), - Color(0xFF61CE6B) - ])), - child: - Row( + colors: [Color(0xFF32A057), Color(0xFF61CE6B)])), + child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -1276,7 +1260,7 @@ class _ShoppingGoodsDetails extends State { text: pageType == null ? (miNiDetail?.price ?? "") : (activityDetails?.actProduct?.promotionPrice ?? - ""), + ""), style: TextStyle( fontSize: 28.sp, fontWeight: MyFontWeight.semi_bold, @@ -1287,8 +1271,8 @@ class _ShoppingGoodsDetails extends State { ), ), SizedBox(width: 4.w), - Expanded(child: - Column( + Expanded( + child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1306,250 +1290,266 @@ class _ShoppingGoodsDetails extends State { ), pageType == null ? Text( - "已售${miNiDetail?.sellCount ?? 0}件", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 10.sp, - color: Colors.white, - ), - ) - : (pageType == "1" - ? 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( - "${limitNumber ?? 0}人团", + "已售${miNiDetail?.sellCount ?? 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, - ), - ), - ], - ) - : (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, - ), - ))) - ], - )), - pageType != null ? - (pageType == "2" ? - Row( - children: [ - MImage( - activityDetails?.actProduct?.rightImg ?? "", - width:72, - height:30.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - Container( - width:91, - height:50, - color: Color(0xFFB1F6CD), - margin: EdgeInsets.only(left: 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "距离结束", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, + fontWeight: MyFontWeight.medium, fontSize: 10.sp, - color: Color(0xFF32A060), + color: Colors.white, ), - ), - SizedBox(height: 3), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - setState(() {}); - }, - child: Container( - width: 13, - height: 14, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempDay.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, + ) + : (pageType == "1" + ? 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( + "${limitNumber ?? 0}人团", + style: TextStyle( + fontSize: 9.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF45B35F), + ), ), ), - ), - ), - Padding( - padding: EdgeInsets.only(left: 2.w, right: 2.w), - child: Text( - ":", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 10.sp, - color: Color(0xFF32A060), - ), - ), - ), - InkWell( - onTap: () { - setState(() {}); - }, - child: Container( - width: 13, - height: 14, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempHour.toString(), + Text( + "已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", style: TextStyle( - color: Colors.white, - fontSize: 10.sp, fontWeight: MyFontWeight.medium, + fontSize: 11.sp, + color: Colors.white, ), ), - ), - ), - Padding( - padding: EdgeInsets.only(left: 2.w, right: 2.w), - child: Text( - ":", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 10.sp, - color: Color(0xFF32A060), - ), - ), - ),InkWell( - onTap: () { - setState(() {}); - }, - child: Container( - width: 13, - height: 14, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempM.toString(), + ], + ) + : (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")).toStringAsFixed(2)}元", + 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( - color: Colors.white, - fontSize: 10.sp, fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Colors.white, ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(left: 2.w, right: 2.w), - child: Text( - ":", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 10.sp, - color: Color(0xFF32A060), - ), - ), + ))) + ], + )), + pageType != null + ? (pageType == "2" + ? Row( + children: [ + MImage( + activityDetails?.actProduct?.rightImg ?? "", + width: 72, + height: 30.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - InkWell( - onTap: () { - setState(() {}); - }, - child: Container( - width: 13, - height: 14, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(1)), - child: Text( - tempS.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - fontWeight: MyFontWeight.medium, + Container( + width: 91, + height: 50, + color: Color(0xFFB1F6CD), + margin: EdgeInsets.only(left: 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "距离结束", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), ), - ), + SizedBox(height: 3), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempDay.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempHour.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempM.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only( + left: 2.w, right: 2.w), + child: Text( + ":", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 10.sp, + color: Color(0xFF32A060), + ), + ), + ), + InkWell( + onTap: () { + setState(() {}); + }, + child: Container( + width: 13, + height: 14, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: + BorderRadius.circular(1)), + child: Text( + tempS.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ), + ], + ) + ], ), - ), - ],) - ],), - ) - ],):Padding(padding:EdgeInsets.only(right:16), - child: - MImage( - activityDetails?.actProduct?.rightImg ?? "", - width:72, - height:30.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ),)) : Container(), + ) + ], + ) + : Padding( + padding: EdgeInsets.only(right: 16), + child: MImage( + activityDetails?.actProduct?.rightImg ?? "", + width: 72, + height: 30.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + )) + : Container(), ], ), ), @@ -1577,7 +1577,7 @@ class _ShoppingGoodsDetails extends State { ), Container( margin: EdgeInsets.only(right: 8), - padding: EdgeInsets.only(left:3, right:3), + padding: EdgeInsets.only(left: 3, right: 3), height: 17.h, alignment: Alignment.center, decoration: BoxDecoration( @@ -1601,7 +1601,9 @@ class _ShoppingGoodsDetails extends State { height: 8.h, ), Text( - pageType == null ? (miNiDetail?.shortName ?? "") : (activityDetails?.actProduct?.shortName ?? ""), + pageType == null + ? (miNiDetail?.shortName ?? "") + : (activityDetails?.actProduct?.shortName ?? ""), maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -1763,7 +1765,8 @@ class _ShoppingGoodsDetails extends State { ), Expanded( child: Text( - (skuValue1 ?? "请选择規格") + (count1 > 0 ? "x${count1}" : ""), + (skuValue1 ?? "请选择規格") + + (count1 > 0 ? "x${count1.toInt()}" : ""), overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -1981,7 +1984,7 @@ class _ShoppingGoodsDetails extends State { ), GestureDetector( onTap: () { - joinA = 0; + joinA = JoinActivity.GoJoin; indexP = actRecordAndJoinlDTOList.actRecord.id; if (count1 == 0) { SmartDialog.showToast("请先选择您要购买的商品!~"); diff --git a/lib/store/shopping/shopping_home/bargain_details.dart b/lib/store/shopping/shopping_home/bargain_details.dart index a5aabe8b..bfa2f269 100644 --- a/lib/store/shopping/shopping_home/bargain_details.dart +++ b/lib/store/shopping/shopping_home/bargain_details.dart @@ -134,14 +134,14 @@ class _BargainDetails extends State { arguments: { "storeInfo": storeInfo, "pageType": "3", - "isDirectBuy":true, + "isDirectBuy": true, "productId": activityActRecordDetails.actProduct.productId, - "skuId":activityActRecordDetails.skuId, + "skuId": activityActRecordDetails.skuId, "buyNum": 1, - "skuValue1":activityActRecordDetails.skuName, - "orderId":activityActRecordDetails.actRecordJoinList[0].orderId, - "actProductId":activityActRecordDetails.actProduct.id, - "actProductSkuId":activityActRecordDetails.skuId, + "skuValue1": activityActRecordDetails.skuName, + "bargainOrderId": activityActRecordDetails.actRecordJoinList[0].orderId, + "actProductId": activityActRecordDetails.actProduct.id, + "actProductSkuId": activityActRecordDetails.skuId, }, ); } @@ -339,8 +339,8 @@ class _BargainDetails extends State { color: Color(0xFF9476F7), ), child: Text( - (limitNumber != - (activityActRecordDetails?.actRecord?.joinNum ?? 0)) + ((activityActRecordDetails?.actRecord?.joinNum ?? 0) != + (activityActRecordDetails?.successNumber ?? 0)) ? "已砍${bargainNum.toStringAsFixed(2)}" : "砍价成功", style: TextStyle( @@ -535,37 +535,39 @@ class _BargainDetails extends State { ), ], ), - if ((activityActRecordDetails?.actRecord?.state ?? 0) == 1) + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) == + (activityActRecordDetails?.successNumber ?? 0) && + (activityActRecordDetails?.actRecord?.state ?? 0) != 3) GestureDetector( - onTap: (){ - toOrder(); - }, + onTap: () { + toOrder(); + }, 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, + 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, - ), - ), - )), + child: Text( + "立即购买", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + )), if ((activityActRecordDetails?.actRecord?.state ?? 0) == 3) Text( "恭喜您砍价成功", @@ -575,8 +577,8 @@ class _BargainDetails extends State { color: Colors.black, ), ), - if (limitNumber != - (activityActRecordDetails?.actRecord?.joinNum ?? 0)) + if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) != + (activityActRecordDetails?.successNumber ?? 0)) GestureDetector( child: Container( width: double.infinity, diff --git a/lib/store/shopping/shopping_home/search_page.dart b/lib/store/shopping/shopping_home/search_page.dart index ac874ba5..0acde597 100644 --- a/lib/store/shopping/shopping_home/search_page.dart +++ b/lib/store/shopping/shopping_home/search_page.dart @@ -145,6 +145,7 @@ class _SearchPage extends State with AutomaticKeepAliveClientMixin, await minService.findMiNiGroupList({ "id":widget.arguments["storeId"], "searchKey" :text, + }).catchError((error) { }).catchError((error) { refreshController.refreshFailed(); });