From 6bcabaf14d9aa6405851756f896e2c077d2f5648 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 30 Nov 2021 22:22:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E=E5=85=91?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E5=8A=9F=E6=98=BE=E7=A4=BA=E6=9B=B4=E6=94=B9?= =?UTF-8?q?,=20=E5=B9=B3=E5=8F=B0=E4=BD=99=E9=A2=9D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/headlines/article_page.dart | 2 +- .../integral_store_details_page.dart | 3 +- lib/order/exchange_order_page.dart | 1752 +++++++++-------- lib/settlement/settlement.dart | 30 +- lib/store/store_order.dart | 16 +- 5 files changed, 945 insertions(+), 858 deletions(-) diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index 8785cb79..ae63500a 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -217,7 +217,7 @@ class _ArticlePage extends State List classChildItem() { var widgets = [ - ///课程banner + ///文章banner HeadlinesBanner(bannerData,), SizedBox(height: 28), diff --git a/lib/integral_store/integral_store_details_page.dart b/lib/integral_store/integral_store_details_page.dart index 89d4afaa..0681a11a 100644 --- a/lib/integral_store/integral_store_details_page.dart +++ b/lib/integral_store/integral_store_details_page.dart @@ -298,7 +298,8 @@ class _IntegralStoreDetailsPage extends State { : Image.network( goods.viceImgPaths.elementAt(position), fit: BoxFit.cover, - ); + ) + ; }, itemCount: (goods == null || goods.viceImgPaths == null) ? 1 diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 22ecde99..ccf80c64 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -9,8 +9,10 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart'; +import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/receiving_method_dialog.dart'; import 'package:huixiang/view_widget/round_button.dart'; @@ -31,902 +33,959 @@ class ExchangeOrderPage extends StatefulWidget { class _ExchangeOrderPage extends State { ApiService apiService; - String money = "0"; - String balance = "0"; int buyNum = 1; var checkIndex = 1; + UserInfo userInfo; + dynamic mBalance = 0; @override void initState() { super.initState(); - SharedPreferences.getInstance().then((value) { - if(value.getString("minMember") == null){ - return; - } - Map memberInfo = - jsonDecode(value.getString("minMember")); - balance = memberInfo["balance"]; - money = memberInfo["money"]; - setState(() {}); - }); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token")), points = UserInfo.fromJson(jsonDecode(value.getString('user'))).points, + queryUserBalance(), }); } + queryUserBalance() async { + BaseData baseData = await apiService.queryInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + mBalance = double.tryParse(userInfo.money); + if (mounted) setState(() {}); + } + } + String points; @override Widget build(BuildContext context) { return Scaffold( - appBar: MyAppBar( - title: S.of(context).dingdanqueren, - titleColor: Colors.black, - titleSize: 18.sp, - background: Color(0xFFFAFAFA), - leadingColor: Colors.black, - ), - body: Stack(children: [ - SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - widget.arguments["useTyped"] == 1? - Container( - margin: - EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( - children: [ - Row( - children: [ - Image.asset( - "assets/image/icon_order_exchange_info.png", - width: 24, - height: 24, - ), - SizedBox(width: 4), - Text( - S.of(context).duihuanxinxi, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Color(0xFF353535)), - ), - ], - ), - SizedBox( - height: 18.h, - ), - GestureDetector(onTap: (){ - setState(() { - showAlertDialog(); - }); - }, - child: Row( - children: [ - Text( - S.of(context).lingqufangshi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + appBar: MyAppBar( + title: S.of(context).dingdanqueren, + titleColor: Colors.black, + titleSize: 18.sp, + background: Color(0xFFFAFAFA), + leadingColor: Colors.black, + ), + body: Stack( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + widget.arguments["useTyped"] == 1 + ? Container( + margin: EdgeInsets.only( + left: 16, right: 16, top: 26, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: + BorderRadius.all(Radius.circular(8)), ), - ), - SizedBox( - width: 12.w, - ), - Expanded(child:Text( - widget.arguments["useTyped"] == 1 - ? S.of(context).ziti - : widget.arguments["useTyped"] == 2 - ? S.of(context).peisong - : S.of(context).xianshangfafang, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - ), - )), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Color(0xFF32A060), - ), - ], - ),), - Visibility( - child: SizedBox( - height: 13.h, - ), - visible: widget.arguments["useTyped"] != 3, - ), - Visibility( - child: Row( - children: [ - Text( - S.of(context).zitidizhi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - ), - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: GestureDetector( - onTap: () { - toAddressPicker(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, + child: Column( + children: [ + Row( children: [ - Expanded( - child: Text( - (address != null && address != "") - ? address - : widget.arguments["useTyped"] == 1 - ? S.of(context).qingxuanzhemendian - : widget.arguments["useTyped"] == - 2 - ? S - .of(context) - .qingxuanzeshouhuodizhi - : S.of(context).xuni, - overflow: TextOverflow.ellipsis, + Image.asset( + "assets/image/icon_order_exchange_info.png", + width: 24, + height: 24, + ), + SizedBox(width: 4), + Text( + S.of(context).duihuanxinxi, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: Color(0xFF353535)), + ), + ], + ), + SizedBox( + height: 18.h, + ), + GestureDetector( + onTap: () { + setState(() { + showAlertDialog(); + }); + }, + child: Row( + children: [ + Text( + S.of(context).lingqufangshi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Text( + widget.arguments["useTyped"] == 1 + ? S.of(context).ziti + : widget.arguments["useTyped"] == 2 + ? S.of(context).peisong + : S.of(context).xianshangfafang, style: TextStyle( fontSize: 14.sp, - color: Color(0xFF32A060), + color: Color(0xFF353535), ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ), + ), + Visibility( + child: SizedBox( + height: 13.h, + ), + visible: widget.arguments["useTyped"] != 3, + ), + Visibility( + child: Row( + children: [ + Text( + S.of(context).zitidizhi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: GestureDetector( + onTap: () { + toAddressPicker(); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Text( + (address != null && + address != "") + ? address + : widget.arguments[ + "useTyped"] == + 1 + ? S + .of(context) + .qingxuanzhemendian + : widget.arguments[ + "useTyped"] == + 2 + ? S + .of(context) + .qingxuanzeshouhuodizhi + : S + .of(context) + .xuni, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + flex: 1, + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ), + ), + flex: 1, + ), + ], + ), + visible: widget.arguments["useTyped"] != 3, + ), + SizedBox( + height: 12.h, + ), + Row( + children: [ + Visibility( + visible: + widget.arguments["useTyped"] != 3, + child: Text( + S.of(context).zitishijian, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535)), ), - flex: 1, ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Color(0xFF32A060), + Visibility( + visible: + widget.arguments["useTyped"] != 3, + child: SizedBox( + width: 12.w, + ), + ), + Text( + widget.arguments["useTyped"] == 1 + ? S + .of(context) + .duihuanhouwugegongzuori + : widget.arguments["useTyped"] == 2 + ? S.of(context).duihuanhoufahuo + : S.of(context).feishiwushangpin, + style: TextStyle( + fontSize: 14.sp, + color: + widget.arguments["useTyped"] == 3 + ? Color(0xFF32A060) + : Color(0xFF353535)), ), ], ), - ), - flex: 1, + ], ), - ], - ), - visible: widget.arguments["useTyped"] != 3, - ), - SizedBox( - height: 12.h, - ), - Row( - children: [ - Visibility( - visible: widget.arguments["useTyped"] != 3, - child: Text( - S.of(context).zitishijian, - style: TextStyle( - fontSize: 14.sp, color: Color(0xFF353535)), + ) + : + // Container( + // margin: + // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), + // padding: EdgeInsets.all(20), + // decoration: BoxDecoration( + // color: Colors.white, + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // borderRadius: BorderRadius.all(Radius.circular(8)), + // ), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Image.asset( + // "assets/image/icon_order_exchange_info.png", + // width: 24, + // height: 24, + // ), + // SizedBox(width: 4), + // Text( + // S.of(context).duihuanxinxi, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 16, + // color: Color(0xFF353535)), + // ), + // ], + // ), + // SizedBox( + // height: 18.h, + // ), + // Row( + // children: [ + // Text( + // S.of(context).lingqufangshi, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // SizedBox( + // width: 12.w, + // ), + // Text( + // widget.arguments["useTyped"] == 1 + // ? S.of(context).ziti + // : widget.arguments["useTyped"] == 2 + // ? S.of(context).peisong + // : S.of(context).xianshangfafang, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // ], + // ), + // SizedBox( + // height: 12.h, + // ), + // Text( + // "非实物商品兑换后领取到卡包即可使用!", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF32A060), + // fontWeight: MyFontWeight.medium + // ), + // ), + // ], + // ), + // ), + Container( + margin: EdgeInsets.only( + left: 16, right: 16, top: 26, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: + BorderRadius.all(Radius.circular(8)), ), - ), - Visibility( - visible: widget.arguments["useTyped"] != 3, - child: SizedBox( - width: 12.w, + child: Column( + children: [ + Row( + children: [ + Image.asset( + "assets/image/icon_order_exchange_info.png", + width: 24, + height: 24, + ), + SizedBox(width: 4), + Text( + S.of(context).duihuanxinxi, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: Color(0xFF353535)), + ), + ], + ), + SizedBox( + height: 18.h, + ), + GestureDetector( + onTap: () { + setState(() { + showAlertDialog(); + }); + }, + child: Row( + children: [ + Text( + S.of(context).lingqufangshi, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Text( + widget.arguments["useTyped"] == 1 + ? S.of(context).ziti + : widget.arguments["useTyped"] == 2 + ? S.of(context).peisong + : S.of(context).xianshangfafang, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ), + ), + Visibility( + child: SizedBox( + height: 13.h, + ), + visible: widget.arguments["useTyped"] != 3, + ), + Visibility( + child: Row( + children: [ + Text( + "收货地址", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: GestureDetector( + onTap: () { + toAddressPicker(); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Text( + (address != null && + address != "") + ? address + : widget.arguments[ + "useTyped"] == + 1 + ? S + .of(context) + .qingxuanzhemendian + : widget.arguments[ + "useTyped"] == + 2 + ? S + .of(context) + .qingxuanzeshouhuodizhi + : S + .of(context) + .xuni, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + flex: 1, + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ), + ), + flex: 1, + ), + ], + ), + visible: widget.arguments["useTyped"] != 3, + ), + SizedBox( + height: 12.h, + ), + ], ), ), - Text( - widget.arguments["useTyped"] == 1 - ? S.of(context).duihuanhouwugegongzuori - : widget.arguments["useTyped"] == 2 - ? S.of(context).duihuanhoufahuo - : S.of(context).feishiwushangpin, - style: TextStyle( - fontSize: 14.sp, - color: widget.arguments["useTyped"] == 3 - ? Color(0xFF32A060) - : Color(0xFF353535)), - ), + Container( + margin: EdgeInsets.only( + left: 16, right: 16, top: 8, bottom: 16), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) ], + borderRadius: BorderRadius.all(Radius.circular(8)), ), - ], - ), - ): - // Container( - // margin: - // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - // padding: EdgeInsets.all(20), - // decoration: BoxDecoration( - // color: Colors.white, - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ) - // ], - // borderRadius: BorderRadius.all(Radius.circular(8)), - // ), - // child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // Image.asset( - // "assets/image/icon_order_exchange_info.png", - // width: 24, - // height: 24, - // ), - // SizedBox(width: 4), - // Text( - // S.of(context).duihuanxinxi, - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 16, - // color: Color(0xFF353535)), - // ), - // ], - // ), - // SizedBox( - // height: 18.h, - // ), - // Row( - // children: [ - // Text( - // S.of(context).lingqufangshi, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF353535), - // ), - // ), - // SizedBox( - // width: 12.w, - // ), - // Text( - // widget.arguments["useTyped"] == 1 - // ? S.of(context).ziti - // : widget.arguments["useTyped"] == 2 - // ? S.of(context).peisong - // : S.of(context).xianshangfafang, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF353535), - // ), - // ), - // ], - // ), - // SizedBox( - // height: 12.h, - // ), - // Text( - // "非实物商品兑换后领取到卡包即可使用!", - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xFF32A060), - // fontWeight: MyFontWeight.medium - // ), - // ), - // ], - // ), - // ), - Container( - margin: - EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( - children: [ - Row( + child: Column( children: [ - Image.asset( - "assets/image/icon_order_exchange_info.png", - width: 24, - height: 24, - ), - SizedBox(width: 4), - Text( - S.of(context).duihuanxinxi, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Color(0xFF353535)), - ), - ], - ), - SizedBox( - height: 18.h, - ), - GestureDetector(onTap: (){ - setState(() { - showAlertDialog(); - }); - }, - child: Row( - children: [ - Text( - S.of(context).lingqufangshi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + Row( + children: [ + Image.asset( + "assets/image/icon_order_commodity_info.png", + width: 24, + height: 24, ), - ), - SizedBox( - width: 12.w, - ), - Expanded(child:Text( - widget.arguments["useTyped"] == 1 - ? S.of(context).ziti - : widget.arguments["useTyped"] == 2 - ? S.of(context).peisong - : S.of(context).xianshangfafang, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + SizedBox(width: 4), + Text( + S.of(context).duihuanshangpinxiangqing, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: Color(0xFF353535), + ), ), - )), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Color(0xFF32A060), - ), - ], - ),), - Visibility( - child: SizedBox( - height: 13.h, - ), - visible: widget.arguments["useTyped"] != 3, - ), - Visibility( - child: Row( - children: [ - Text( - "收货地址", - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + ], + ), + SizedBox( + height: 18, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + MImage( + widget?.arguments["image"] ?? "", + width: 80, + height: 80, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: GestureDetector( - onTap: () { - toAddressPicker(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Text( - (address != null && address != "") - ? address - : widget.arguments["useTyped"] == 1 - ? S.of(context).qingxuanzhemendian - : widget.arguments["useTyped"] == - 2 - ? S - .of(context) - .qingxuanzeshouhuodizhi - : S.of(context).xuni, + Expanded( + child: Container( + height: 80.h, + margin: EdgeInsets.only(left: 16.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + widget.arguments["name"], + maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - ), + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF353535)), ), - flex: 1, - ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - color: Color(0xFF32A060), - ), - ], + // SizedBox( + // height: 4.h, + // ), + // Text( + // "x1", + // style: TextStyle( + // fontSize: 12.sp, + // color: Color(0xFF727272)), + // ), + ], + ), ), + flex: 1, + ) + ], + ), + SizedBox( + height: 12.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "应付数额", + style: TextStyle( + fontSize: 14, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular), ), - flex: 1, - ), - ], - ), - visible: widget.arguments["useTyped"] != 3, - ), - SizedBox( - height: 12.h, - ), - ], - ), - ), - Container( - margin: - EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 16), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( - children: [ - Row( - children: [ - Image.asset( - "assets/image/icon_order_commodity_info.png", - width: 24, - height: 24, + SizedBox( + width: 12, + ), + Text( + widget.arguments["payType"] == 1 + ? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分" + : ((widget.arguments["price"] == null || + widget.arguments["price"] == "0" + ? "" + : "${double.parse(widget.arguments["price"]) * buyNum}积分") + + (widget.arguments["money"] == null || + widget.arguments["money"] == + "0.00" + ? "" + : " + ${double.parse(widget.arguments["money"]) * buyNum}元")), + style: TextStyle( + fontSize: 12, + decoration: (widget.arguments["payType"] == 3) + ? TextDecoration.lineThrough + : TextDecoration.none, + color: Color(0xFF32A060), + ), + ), + ], + ), + SizedBox( + height: 12, ), - SizedBox(width: 4), - Text( - S.of(context).duihuanshangpinxiangqing, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Color(0xFF353535), + if (widget.arguments["payType"] == 3) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "现金抵扣积分", + style: TextStyle( + fontSize: 14, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 12, + ), + Text( + "${double.parse(widget.arguments["oneMoney"]) * buyNum}元", + style: TextStyle( + fontSize: 12, + color: Colors.black, + ), + ), + ], ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "合计", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular), + ), + SizedBox( + width: 12.w, + ), + Text( + handleNeedPay(), + style: TextStyle( + fontSize: 12.sp, color: Color(0xFF32A060)), + ), + ], ), ], ), - SizedBox( - height: 18, + ), + Container( + margin: EdgeInsets.only(left: 16, right: 16, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.all(Radius.circular(8)), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, + child: Column( children: [ - if (widget.arguments["image"] != null) - Image.network( - widget.arguments["image"], - fit: BoxFit.cover, - width: 80, - height: 80, - ) - else - Image.asset( - "assets/image/default_1.png", - fit: BoxFit.cover, - width: 80, - height: 80, + Row( + children: [ + Expanded( + child: Text( + "兑换数量", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535)), + )), + InkWell( + onTap: () { + setState(() { + if (buyNum > 1) buyNum -= 1; + }); + }, + child: Image.asset( + "assets/image/reduce.png", + width: 22, + height: 22, + ), + ), + Container( + width: 30, + alignment: Alignment.center, + child: Text( + buyNum.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + InkWell( + onTap: () { + setState(() { + if (widget.arguments["payType"] == 1 + ? (double.parse(widget + .arguments["onePrice"]) * + (buyNum + 1)) > + double.parse(points) + : (widget.arguments["price"] == null || + widget.arguments["price"] == "0" + ? false + : (double.parse(widget + .arguments["price"]) * + (buyNum + 1)) > + double.parse(points))) { + SmartDialog.showToast("您的积分不足", + alignment: Alignment.center); + return; + } + buyNum += 1; + }); + }, + child: Image.asset( + "assets/image/add.png", + width: 22, + height: 22, + ), + ), + ], + ), + ], + ), + ), + if (widget.arguments["payType"] == 3 || + (widget.arguments["payType"] == 2 && + widget.arguments["money"] != "0.00")) + Container( + width: double.infinity, + margin: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 12.h, + bottom: 20.h, + ), + padding: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 20.h, + bottom: 20.h, + ), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color(0x000000).withAlpha(25), + offset: Offset(0, 1), + blurRadius: 12.0, + ), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: MyFontWeight.regular, + ), + ), ), - Expanded( - child: Container( - height: 80.h, - margin: EdgeInsets.only(left: 16.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, + GestureDetector( + onTap: () { + setState(() { + checkIndex = 1; + }); + // widget.payChannelCheck(4); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ + checkPayView(1), + Expanded( + child: Container(), + flex: 1, + ), Text( - widget.arguments["name"], + "¥$mBalance", style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF353535)), + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + width: 10, + ), + Text( + S.of(context).pingtaiyue, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), ), - // SizedBox( - // height: 4.h, - // ), - // Text( - // "x1", - // style: TextStyle( - // fontSize: 12.sp, - // color: Color(0xFF727272)), - // ), ], ), ), - flex: 1, - ) - ], - ), - SizedBox( - height: 12.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "应付数额", - style: - TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), - ), - SizedBox( - width: 12, - ), - Text( - widget.arguments["payType"] == 1 ? "${double.parse(widget.arguments["onePrice"])*buyNum}积分": - ((widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? "" - : "${double.parse(widget.arguments["price"])*buyNum}积分") + - (widget.arguments["money"] == null || widget.arguments["money"] == "0.00" - ? "" - : " + ${double.parse(widget.arguments["money"])*buyNum}元")), - style: TextStyle( - fontSize: 12, - decoration:(widget.arguments["payType"] == 3) ? TextDecoration.lineThrough:TextDecoration.none, - color: Color(0xFF32A060), - ), - ), - ], - ), - SizedBox( - height: 12, - ), - if(widget.arguments["payType"] == 3) - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "现金抵扣积分", - style: - TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), + SizedBox( + height: 10, ), + // GestureDetector( + // onTap: () { + // setState(() { + // checkIndex = 2; + // }); + // }, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // checkPayView(2), + // Expanded( + // child: Container(), + // flex: 1, + // ), + // Text( + // "¥$balance", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // SizedBox( + // width: 10, + // ), + // Text( + // S.of(context).dianpuyue, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ], + // ), + // ), SizedBox( - width: 12, + height: 10, ), - Text( - "${double.parse(widget.arguments["oneMoney"])*buyNum}元", - style: TextStyle( - fontSize: 12, - color: Colors.black, + GestureDetector( + onTap: () { + setState(() { + checkIndex = 3; + }); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + checkPayView(3), + Spacer(), + Image.asset("assets/image/icon_we_chat.png"), + Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ), + ], ), ), ], ), - SizedBox( - height: 12, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "合计", - style: TextStyle( - fontSize: 14.sp, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), - ), - SizedBox( - width: 12.w, - ), - Text( - handleNeedPay(), - style: TextStyle( - fontSize: 12.sp, color: Color(0xFF32A060)), - ), - ], - ), - ], - ), - ), - Container( - margin: - EdgeInsets.only(left: 16, right: 16, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( + SizedBox(height: 40) + ], + )), + Align( + alignment: Alignment.bottomCenter, + child: Container( + height: 54.h, + color: Colors.white, + child: Row( children: [ - Row( - children: [ - Expanded(child: Text( - "兑换数量", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535)), - )), - InkWell( - onTap: () { - setState(() { - if(buyNum > 1) - buyNum -= 1; - }); - }, - child: Image.asset( - "assets/image/reduce.png", - width: 22, - height: 22, - ), - ), - Container( - width: 30, - alignment: Alignment.center, - child: Text( - buyNum.toString(), - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - ), - ), - ), - InkWell( - onTap: () { - setState(() { - if(widget.arguments["payType"] == 1 ? - (double.parse(widget.arguments["onePrice"])*(buyNum+1)) - > double.parse(points): - (widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? false - : (double.parse(widget.arguments["price"])*(buyNum+1)) > double.parse(points))){ - SmartDialog.showToast("您的积分不足", alignment: Alignment.center); - return; - } - buyNum += 1; - }); - }, - child: Image.asset( - "assets/image/add.png", - width: 22, - height: 22, - ), - ), - ], - ), - ], - ), - ), - if(widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && - widget.arguments["money"] != "0.00")) - Container( - width: double.infinity, - margin: EdgeInsets.only( - left: 16.w, - right: 16.w, - top: 12.h, - bottom:20.h, - ), - padding: EdgeInsets.only( - left: 16.w, - right: 16.w, - top: 20.h, - bottom: 20.h, - ), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontSize: 16.sp, - color: Colors.black, - fontWeight: MyFontWeight.regular, - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 1; - }); - // widget.payChannelCheck(4); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, + Spacer(), + Padding( + padding: EdgeInsets.only(top: 7, right: 16), + child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - checkPayView(1), - Expanded( - child: Container(), - flex: 1, - ), Text( - "¥$money", + S.of(context).heji, style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, ), ), - SizedBox( - width: 10, - ), Text( - S.of(context).pingtaiyue, + handleNeedPay(), style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - // GestureDetector( - // onTap: () { - // setState(() { - // checkIndex = 2; - // }); - // }, - // child: Row( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - // children: [ - // checkPayView(2), - // Expanded( - // child: Container(), - // flex: 1, - // ), - // Text( - // "¥$balance", - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xff353535), - // fontWeight: MyFontWeight.semi_bold, - // ), - // ), - // SizedBox( - // width: 10, - // ), - // Text( - // S.of(context).dianpuyue, - // style: TextStyle( - // fontSize: 14.sp, - // color: Color(0xff353535), - // fontWeight: MyFontWeight.semi_bold, - // ), - // ), - // ], - // ), - // ), - SizedBox( - height: 10, - ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 3; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - checkPayView(3), - Spacer(), - Image.asset("assets/image/icon_we_chat.png"), - Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), ), ), ], - ), - ), - ], - ), - ), - SizedBox(height: 40) - ], - )), - Align(alignment: Alignment.bottomCenter,child: - Container( - height: 54.h, - color: Colors.white, - child: Row( - children: [ - Spacer(), - Padding(padding: EdgeInsets.only(top: 7,right: 16), - child:Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - S.of(context).heji, - style: TextStyle( - fontSize: 12.sp, + )), + GestureDetector( + onTap: () { + if (!storeIsSelected) return; + creditOrder(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: widget.arguments["payType"] == 3 || + (widget.arguments["payType"] == 2 && + widget.arguments["money"] != "0.00") + ? S.current.jiesuan + : S.current.duihuan, + textColor: Colors.white, fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ), - Text(handleNeedPay(), - style: TextStyle( + backgroup: Color(0xFF32A060), + radius: 0, fontSize: 16.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF32A060), + padding: EdgeInsets.symmetric(vertical: 5.h), ), ), ], - )), - GestureDetector( - onTap: () { - if (!storeIsSelected) return; - creditOrder(); - }, - child: RoundButton( - width: 103.w, - height: 54.h, - text: widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && - widget.arguments["money"] != "0.00") ? - S.current.jiesuan : S.current.duihuan, - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - radius: 0, - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), - ), - ), - ], - ), - )) - ],) - ); + ), + )) + ], + )); } ///领取方式弹窗 @@ -935,7 +994,7 @@ class _ExchangeOrderPage extends State { showDialog( context: context, builder: (BuildContext context) { - return ReceivingMethodDialog(widget.arguments["useTyped"],(value){ + return ReceivingMethodDialog(widget.arguments["useTyped"], (value) { setState(() { widget.arguments["useTyped"] = value; }); @@ -944,13 +1003,19 @@ class _ExchangeOrderPage extends State { ); } - String handleNeedPay(){ - return widget.arguments["payType"] == 1 ? - "${double.parse(widget.arguments["onePrice"])*buyNum}积分".toString() : (widget.arguments["payType"] == 2 - ? ((widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? "" : "${double.parse(widget.arguments["price"]) * buyNum}积分") + - (widget.arguments["money"] == null || widget.arguments["money"] == "0.00" - ? "" : " + ${double.parse(widget.arguments["money"])*buyNum}元")):"${double.parse(widget.arguments["oneMoney"])*buyNum}元"); + String handleNeedPay() { + return widget.arguments["payType"] == 1 + ? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分".toString() + : (widget.arguments["payType"] == 2 + ? ((widget.arguments["price"] == null || + widget.arguments["price"] == "0" + ? "" + : "${double.parse(widget.arguments["price"]) * buyNum}积分") + + (widget.arguments["money"] == null || + widget.arguments["money"] == "0.00" + ? "" + : " + ${double.parse(widget.arguments["money"]) * buyNum}元")) + : "${double.parse(widget.arguments["oneMoney"]) * buyNum}元"); } Widget checkPayView(var index) { @@ -1004,24 +1069,26 @@ class _ExchangeOrderPage extends State { } BaseData baseDate = await apiService.creditOrder({ "goodsId": widget.arguments["goodsId"], - "isOneSell":widget.arguments["payType"] != 2, - "isPoints":!handleNeedPay().contains("元"), + "isOneSell": widget.arguments["payType"] != 2, + "isPoints": !handleNeedPay().contains("元"), "number": buyNum, "useTyped": widget.arguments["useTyped"], - "payChannel":handleNeedPay().contains("元") ? (checkIndex == 3?"1":"4") : "0", + "payChannel": + handleNeedPay().contains("元") ? (checkIndex == 3 ? "1" : "4") : "0", if (widget.arguments["useTyped"] == 1) "storeId": storeId, if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, }); if (baseDate.isSuccess) { - if((widget.arguments["payType"] == 3 || - (widget.arguments["payType"] == 2 && - widget.arguments["money"] != "0.00")) && - checkIndex == 3){ + String realPay = handleNeedPay(); + if ((widget.arguments["payType"] == 3 || + (widget.arguments["payType"] == 2 && + widget.arguments["money"] != "0.00")) && + checkIndex == 3) { // if (!(await Min.isInitialize())) { - // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, - // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, - // 故而在此初始化一下 - // await Min.initialize(); + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + // await Min.initialize(); // } WxPay wxPay = WxPay.fromJson(baseDate.data); await registerWxApi( @@ -1040,39 +1107,30 @@ class _ExchangeOrderPage extends State { ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); - if(event.errCode == 0){ + if (event.errCode == 0) { Navigator.of(context).popAndPushNamed( '/router/exchange_order_success_page', arguments: { "id": widget.arguments["goodsId"], - "price": (widget.arguments["payType"] == 1 ? - (double.parse(widget.arguments["onePrice"])*buyNum).toString(): - (widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? "0" - : (double.parse(widget.arguments["price"])*buyNum).toString())), + "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", "points": points, - "realPay":handleNeedPay(), - "payChannel":widget.arguments["payChannel"], + "realPay": realPay, + "payChannel": widget.arguments["payChannel"], }, ); - }else { + } else { SmartDialog.showToast("支付失败", alignment: Alignment.center); return; } - }); return; } await Navigator.of(context) .pushNamed('/router/exchange_order_success_page', arguments: { - "price": (widget.arguments["payType"] == 1 ? - (double.parse(widget.arguments["onePrice"])*buyNum).toString(): - (widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? "0" - : (double.parse(widget.arguments["price"])*buyNum).toString())), - "realPay":handleNeedPay(), + "price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", + "realPay": realPay, "points": points, - "payChannel":widget.arguments["payChannel"], + "payChannel": widget.arguments["payChannel"], "id": baseDate.data }); points = diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index ed321d52..34f3331f 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -72,8 +74,8 @@ class _Settlement extends State { parentId = widget.arguments["parentId"] ?? ""; storeInfo = widget.arguments["storeInfo"]; numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; - promotions=widget.arguments["pid"]??""; - coupons=widget.arguments["cid"]??""; + promotions=widget.arguments["pName"]??""; + coupons=widget.arguments["cName"]??""; if (tableId == 0) { placeOrder = true; } @@ -89,7 +91,25 @@ class _Settlement extends State { tenant: tenant, storeId: storeId, ); - queryOrderInfo(null, selectedBtn, null, 0, null); + if(promotions != null && promotions != ""){ + queryOrderInfo( + address != null ? address.id : null, + selectedBtn, + null, + 0, + widget.arguments["pid"], + ); + }else if(coupons != null && coupons != ""){ + queryOrderInfo( + address != null ? address.id : null, + selectedBtn, + widget.arguments["cid"], + 0, + null, + ); + } + else + queryOrderInfo(null, selectedBtn, null, 0, null); }); } @@ -209,9 +229,9 @@ class _Settlement extends State { placeOrderFirst.payChannel = payChannel; placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO.promotionId = - promotion != null ? promotion.id : ""; + promotion != null ? promotion.id : widget.arguments["pid"]??""; placeOrderFirst.promotionInfoDTO.couponId = - couponListBean != null ? couponListBean.id : ""; + couponListBean != null ? couponListBean.id : widget.arguments["cid"]??""; placeOrderFirst.recMobile = (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; placeOrderFirst.shoppingCartSkuItemList = settleOrderInfo.orderProductList; diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 975a42bf..069bdc0c 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -62,7 +62,9 @@ class _StoreOrderPage extends State int numberOfPeople = 0; ///小程序token String minToken; + String pName; String pid; + String cName; String cid; @override @@ -554,7 +556,9 @@ class _StoreOrderPage extends State "tableId": tableId, "parentCode": parentCode, "parentId": parentId, + "pName":pName, "pid":pid, + "cName":cName, "cid":cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, @@ -733,8 +737,10 @@ class _StoreOrderPage extends State ///查询购物车 Future queryShopCar() async { - pid=""; - cid=""; + pName="";//活动 + pid="";//活动 + cName="";//优惠券 + cid="";//优惠券 BaseData> baseDate = await minService.getShoppingCart(tableId); if (baseDate != null && @@ -744,13 +750,15 @@ class _StoreOrderPage extends State if( baseDate.data[0].selectDiscount ==1){ baseDate.data[0].couponList.forEach((element) { if(element.isMaxCoupon){ - cid = element.promotionName; + cName = element.promotionName; + cid = element.id; } }); }else if(baseDate.data[0].selectDiscount==2){ baseDate.data[0].promotionInfoList.forEach((element) { if(element.isMaxPromotion){ - pid=element.name; + pName=element.name; + pid=element.id; } }); }