From a913520b6dc30491678410e7d1e829c8d58709de Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 7 Jun 2022 15:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AB=E9=94=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/home_page.dart | 2 +- lib/home/home_view/top_selling_list.dart | 8 +- .../points_mall_view/points_goods_view.dart | 2 +- lib/home/welfare_exchange.dart | 43 ++++---- lib/home/welfare_page.dart | 13 ++- lib/login/new_login_page.dart | 8 +- lib/mine/mine_page.dart | 2 +- lib/order/order_history_page.dart | 101 +++++++++--------- lib/retrofit/min_api.g.dart | 2 +- lib/settlement/settlement.dart | 40 ++++--- lib/union/union_list.dart | 8 +- lib/union/union_page.dart | 12 +-- lib/view_widget/activity_poster.dart | 31 +++--- 13 files changed, 150 insertions(+), 122 deletions(-) diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 94d6bc5e..c1c7533a 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -513,7 +513,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { // }); // }), - //特惠专区 + ///特惠专区 DiscountZone(coupons), ///特惠专区-推荐商品展示 diff --git a/lib/home/home_view/top_selling_list.dart b/lib/home/home_view/top_selling_list.dart index 86edbea9..a4c74345 100644 --- a/lib/home/home_view/top_selling_list.dart +++ b/lib/home/home_view/top_selling_list.dart @@ -32,7 +32,7 @@ class _TopSellingList extends State { @override Widget build(BuildContext context) { return Container( - height: 388.h, + height: 347.h, width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), @@ -55,7 +55,7 @@ class _TopSellingList extends State { color: Color(0x33000000), alignment: Alignment.center, child:Text( - "4月热推榜", + "${DateTime.now().month}月热推榜", style: TextStyle( fontWeight: MyFontWeight.medium, color: Color(0xFFFFFFFF), @@ -64,11 +64,11 @@ class _TopSellingList extends State { ), ), Container( - height: 330.h, + height: 285.h, child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), - itemCount:widget.homeRank.commodityList.length ?? 0, + itemCount:widget?.homeRank?.commodityList?.length ?? 0, itemBuilder: (context, position) { return GestureDetector( onTap: () { diff --git a/lib/home/points_mall_view/points_goods_view.dart b/lib/home/points_mall_view/points_goods_view.dart index dce3faf7..8bc275d9 100644 --- a/lib/home/points_mall_view/points_goods_view.dart +++ b/lib/home/points_mall_view/points_goods_view.dart @@ -52,7 +52,7 @@ class _PointGoods extends State { mainAxisSpacing: 16.w, //子Widget宽高比例 0.59 childAspectRatio: - 200 / (305 / 2 + (305 / 2) * AppUtils.textScale(context)), + 200 / (295.w / 2 + (295.h / 2) * AppUtils.textScale(context)), ), itemBuilder: (context, index) { return GestureDetector( diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index e6377c49..fd096098 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -218,23 +218,30 @@ class _WelfareExchange extends State { ///积分商城的用户信息 pointUser(), - ///积分商品头Tab - PointsGoodsTitle( - gooodsCategorys, - (orderType, orderDesc) { - this.orderType = orderType; - this.orderDesc = orderDesc; - setState(() {}); - }, - (index) { - categoryId = gooodsCategorys[index].id; - pageNum = 1; - setState(() {}); - }, - ), + Container( + color: Colors.white, + child: Column( + children: [ + ///积分商品头Tab + PointsGoodsTitle( + gooodsCategorys, + (orderType, orderDesc) { + this.orderType = orderType; + this.orderDesc = orderDesc; + setState(() {}); + }, + (index) { + categoryId = gooodsCategorys[index].id; + pageNum = 1; + setState(() {}); + }, + ), - ///积分商品列表, - pointList() + ///积分商品列表, + pointList() + ], + ), + ) ], ); }, @@ -484,8 +491,8 @@ class _WelfareExchange extends State { right: 12.w, top: 10.h, ),padding: EdgeInsets.only( - bottom: 8, - left: 8 + bottom: 8.h, + left: 8.w ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index 1335656a..f1187936 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -41,8 +41,8 @@ class _WelfarePage extends State { bool orderDesc = true; int orderType = 1; int type = 1; - // int index = 0; - + int couponIndex = 0; + int swiperIndex = 0; @override void initState() { @@ -262,6 +262,10 @@ class _WelfarePage extends State { AspectRatio( aspectRatio: 1.10, child: Swiper( + onIndexChanged: (it){ + swiperIndex = it; + }, + index: couponIndex, viewportFraction: 0.9, scale: 0.7, key: UniqueKey(), @@ -582,9 +586,7 @@ class _WelfarePage extends State { alignment: Alignment.centerRight, child: InkWell( onTap: () { - setState(() { - receiveCoupon(cop.id); - }); + receiveCoupon(cop.id); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2), @@ -645,6 +647,7 @@ class _WelfarePage extends State { } receiveCoupon(couponId) async { + couponIndex = swiperIndex; BaseData baseData = await apiService.receiveCoupon(couponId); if (baseData != null && baseData.isSuccess) { queryCoupon(); diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart index 322e9e5a..89fd1f3b 100644 --- a/lib/login/new_login_page.dart +++ b/lib/login/new_login_page.dart @@ -150,11 +150,11 @@ class _NewLoginPage extends State { bool statusPhoneVisible = false; Color statusPhoneTextColor = Color(0xFF353535); - Color statusPhoneLineColor = Color(0xFFF4F4F4); + Color statusPhoneLineColor = Color(0xFFE7E3E3); bool statusCodeVisible = false; Color statusCodeTextColor = Color(0xFF353535); - Color statusCodeLineColor = Color(0xFFF4F4F4); + Color statusCodeLineColor = Color(0xFFE7E3E3); countdown() { if (_timer != null && _timer.isActive) return; @@ -338,7 +338,7 @@ class _NewLoginPage extends State { children: [ Container( width: double.infinity, - padding: EdgeInsets.only(left: 16.w,top:60+ MediaQuery.of(context).padding.top,right: 12.w), + padding: EdgeInsets.only(left: 16.w,top:60.h+ MediaQuery.of(context).padding.top,right: 12.w), child:Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -438,7 +438,7 @@ class _NewLoginPage extends State { ), Container( height:30.h, - width: MediaQuery.of(context).size.width - 80.h, + width: MediaQuery.of(context).size.width - 30.h, child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 90485ebb..d801ec42 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -245,7 +245,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ), ), Container( - margin: EdgeInsets.only(top: 285.h), + margin: EdgeInsets.only(top: 265.h), child: Column( children: [ ///我的订单 diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 85fc6405..65072393 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -258,55 +258,58 @@ class _OrderHistoryList extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - (orderInfo != null && orderInfo.orderType == 0) - ? Container() - : Container( - width: 19, - height: 21, - margin: EdgeInsets.only(left: 12.w, top: 12.h), - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - border: Border.all( - width: 1, - color: Color(0xFF32A060), - style: BorderStyle.solid, - )), - child: Text( - (orderInfo != null && orderInfo.orderType == 1) - ? "团" - : ((orderInfo != null && orderInfo.orderType == 2) - ? "秒" - : "砍"), - style: TextStyle( - fontSize: 12.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF32A060), - ), - ), - ), + // (orderInfo != null && orderInfo.orderType == 0) + // ? Container() + // : Container( + // width: 19, + // height: 21, + // margin: EdgeInsets.only(left: 12.w, top: 12.h), + // alignment: Alignment.center, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(2), + // border: Border.all( + // width: 1, + // color: Color(0xFF32A060), + // style: BorderStyle.solid, + // )), + // child: Text( + // (orderInfo != null && orderInfo.orderType == 1) + // ? "团" + // : ((orderInfo != null && orderInfo.orderType == 2) + // ? "秒" + // : "砍"), + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: FontWeight.bold, + // color: Color(0xFF32A060), + // ), + // ), + // ), + // Container( + // width: 19, + // height: 21, + // margin: EdgeInsets.only(left: 7.w, top: 12.h), + // alignment: Alignment.center, + // decoration: BoxDecoration( + // color: Color(0xff32A060), + // borderRadius: BorderRadius.circular(2), + // ), + // child: Text( + // (orderInfo != null && orderInfo.isTakeOut == 0) + // ? "自" + // : ((orderInfo != null && orderInfo.isTakeOut == 1) + // ? "外" + // : "物"), + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: FontWeight.bold, + // color: Colors.white, + // ), + // ), + // ), Container( - width: 19, - height: 21, - margin: EdgeInsets.only(left: 7.w, top: 12.h), - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xff32A060), - borderRadius: BorderRadius.circular(2), - ), - child: Text( - (orderInfo != null && orderInfo.isTakeOut == 0) - ? "自" - : ((orderInfo != null && orderInfo.isTakeOut == 1) - ? "外" - : "物"), - style: TextStyle( - fontSize: 12.sp, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), + margin: EdgeInsets.only(left: 5.w, top: 12.h), ), Expanded( child: Container( @@ -355,7 +358,7 @@ class _OrderHistoryList extends State ], ), Container( - margin: EdgeInsets.only(left: 37.w), + margin: EdgeInsets.only(left: 12.w), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 9ea65389..057554c3 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -308,7 +308,7 @@ class _MinApiService implements MinApiService { data: _data); final value = BaseData.fromJson( _result.data, - (json) => DownOrder.fromJson(json), + (json) => json==null?null:DownOrder.fromJson(json), ); return value; } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 3814fe3c..f19a53d9 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -124,7 +124,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } else if (coupons != null && coupons != "" && tableId <= 0) { queryOrderInfo( address != null ? address.id : null, @@ -136,7 +137,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } else queryOrderInfo( null, @@ -148,7 +150,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); }); weChatResponseEventHandler.listen((event) async { @@ -159,7 +162,7 @@ class _Settlement extends State { ///订单结算信息 queryOrderInfo(addressId, isTake, memberCouponId, orderId, promotionId, - productSkuId, actProductId, actProductSkuId, buyNum, payChannel) async { + productSkuId, actProductId, actProductSkuId, buyNum, payChannel,tableId) async { BaseData baseData = await minService.getOrderInfo({ "addressId": addressId, "isTake": isTake, @@ -170,7 +173,8 @@ class _Settlement extends State { "actProductId": actProductId, "actProductSkuId": actProductSkuId, "buyNum": buyNum, - "payChannel": payChannel + "payChannel": payChannel, + "tableId":tableId }).catchError((error) {}); this.promotion = null; promotions = ""; @@ -209,7 +213,7 @@ class _Settlement extends State { queryOrderDetails(id) async { print("ididididididid: $id"); BaseData baseData = await minService.getOrderDetails({ - "id": widget.arguments["orderId"], + "id": widget.arguments["orderId"] ?? parentId, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { @@ -235,7 +239,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); return; } BaseData> baseDate = @@ -289,7 +294,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } } @@ -315,7 +321,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } } @@ -461,7 +468,7 @@ class _Settlement extends State { } if (baseData != null && baseData.isSuccess) { placeOrder = true; - this.downOrder = DownOrder.fromJson(baseData.data); + this.downOrder = baseData.data; queryOrderDetails( (parentId == null || parentId == "") ? baseData.data.id : parentId); setState(() {}); @@ -515,6 +522,7 @@ class _Settlement extends State { print(error); }); if (baseData != null && baseData.isSuccess) { + SmartDialog.showToast(baseData?.msg == "ok" ? "订单支付成功":"", alignment: Alignment.center); toOrderDetails(placeOrderFirst.id); } else { SmartDialog.show( @@ -660,7 +668,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId ?? 0); }, queryAddress, storeInfo, address, selectedAddress, pageType), @@ -805,7 +814,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } mobileChange(String mobile) { @@ -853,7 +863,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); // } } @@ -882,7 +893,8 @@ class _Settlement extends State { actProductId ?? "", actProductSkuId ?? "", count1, - payChannel); + payChannel, + tableId); } // } } diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index ae35ef11..6166bb62 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -33,6 +33,7 @@ class _UnionList extends State { Widget build(BuildContext context) { return Column( children: [ + buildSearchItem(), Container( height: MediaQuery.of(context).size.height - 103.h - @@ -221,7 +222,7 @@ class _UnionList extends State { SizedBox( height: 5.h, ), - Text( + Expanded(child: Text( "${S.of(context).dizhi}:${store.address}", maxLines: 2, overflow: TextOverflow.ellipsis, @@ -230,7 +231,8 @@ class _UnionList extends State { fontSize: 12.sp, fontWeight: MyFontWeight.regular, ), - ), + ),) + ], )), Container( @@ -274,7 +276,7 @@ class _UnionList extends State { builder: (context) { return AlertDialog( content: Container( - width: MediaQuery.of(context).size.width - 84, + width: MediaQuery.of(context).size.width - 84.w, height: 130.h, child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 71ac0c77..319c63f1 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -618,7 +618,7 @@ class UnionPageState extends State ) ]), width: double.infinity, - height: 228, + height: 228.h, child: Stack( children: [ Positioned( @@ -629,7 +629,7 @@ class UnionPageState extends State child: MImage( store.facade, width: double.infinity, - height: 140, + height: 140.h, fit: BoxFit.cover, errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", @@ -646,11 +646,11 @@ class UnionPageState extends State child: Container(), ), Positioned( - bottom: 16, - left: 12, + bottom: 16.h, + left: 12.w, right: 0, child: Container( - height: 100, + height: 100.h, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -740,7 +740,7 @@ class UnionPageState extends State builder: (context) { return AlertDialog( content: Container( - width: MediaQuery.of(context).size.width - 84, + width: MediaQuery.of(context).size.width - 84.w, height: 130.h, child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/view_widget/activity_poster.dart b/lib/view_widget/activity_poster.dart index 2899b944..69c9711d 100644 --- a/lib/view_widget/activity_poster.dart +++ b/lib/view_widget/activity_poster.dart @@ -4,6 +4,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:huixiang/retrofit/data/activity_pos.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'custom_image.dart'; @@ -23,13 +24,15 @@ class _ActivityPoster extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - height: 289, + height: 332.h, alignment: Alignment.center, margin: EdgeInsets.only( - left:37, - right:37, + left:27.w, + right:27.w, ), - child: Stack( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ GestureDetector( onTap: (){ @@ -44,28 +47,26 @@ class _ActivityPoster extends State { widget?.activityPos?.showImage ?? "", width: double.infinity, height: MediaQuery.of(context).size.height / 2, - fit: BoxFit.cover, + fit: BoxFit.fill, radius: BorderRadius.all(Radius.circular(12)), errorSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp", ),), ), Container( - padding: EdgeInsets.only(top: 8,right: 8,bottom:8), + margin: EdgeInsets.only(top:35.h,right: 8.w,bottom:8.w), child:GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ Navigator.of(context).pop(); }, - child: Row(children: [ - Spacer(), - Image.asset( - "assets/image/cancel.webp", - width: 24, - height: 24, - color: Colors.white, - ) - ],) + child: Image.asset( + "assets/image/yq_qx.webp", + width: 40, + height: 40, + fit: BoxFit.cover, + color: Colors.white, + ) ) ) ], ),