diff --git a/lib/constants/api.dart b/lib/constants/api.dart index dfc7e902..12ea24c2 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -279,6 +279,9 @@ class _Market { ///app商城中心:根据商品主键id查询商品详情 String get goodsDetail => '/user/shop/findDetailByGoodsId'; + + ///app商城中心:商品预约 + String get appointment => '/user/shop/goodsAppointment'; } class _Upload { diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index c5fb9b52..92176fd5 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -351,15 +351,15 @@ class _LifePayPageState extends State { ], ), 24.w.widthBox, - MaterialButton( - elevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(37.w)), - color: kPrimaryColor, - padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w), - onPressed: () {}, - child: '去缴费'.text.black.size(32.sp).bold.make(), - ), + // MaterialButton( + // elevation: 0, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(37.w)), + // color: kPrimaryColor, + // padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w), + // onPressed: () {}, + // child: '去缴费'.text.black.size(32.sp).bold.make(), + // ), ], ), ), diff --git a/lib/ui/market/goods/goods_detail_page.dart b/lib/ui/market/goods/goods_detail_page.dart index 039ffcdb..5ab0983c 100644 --- a/lib/ui/market/goods/goods_detail_page.dart +++ b/lib/ui/market/goods/goods_detail_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -22,6 +23,7 @@ import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/widget/bee_back_button.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/utils/headers.dart'; ///商品详情页面 class GoodsDetailPage extends StatefulWidget { @@ -41,11 +43,17 @@ class _GoodsDetailPageState extends State { List _topGoods = []; late PageController _pageController; int _currentIndex = 0; + TextEditingController _nameController = TextEditingController(); + TextEditingController _phoneController = TextEditingController(); + @override void initState() { super.initState(); + final userProvider = Provider.of(context, listen: false); _refreshController = EasyRefreshController(); _pageController = PageController(); + _nameController.text = userProvider.userInfoModel?.name ?? ''; + _phoneController.text = userProvider.userInfoModel?.tel ?? ''; } @override @@ -57,7 +65,6 @@ class _GoodsDetailPageState extends State { @override Widget build(BuildContext context) { - UserProvider userProvider = Provider.of(context); return BeeScaffold( leading: BeeBackButton(), title: '商品详情', @@ -143,6 +150,84 @@ class _GoodsDetailPageState extends State { ), controller: _refreshController, ), + bottomNavi: BottomButton( + onPressed: () { + Get.bottomSheet(Material( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(24.w), + ), + ), + child: Container( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + '预约后商户将通过电话联系您', + style: TextStyle( + fontSize: 28.sp, + ), + ), + 40.hb, + TextField( + controller: _nameController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(48), + borderSide: BorderSide.none, + ), + fillColor: Color(0xFFEEEEEE), + filled: true, + ), + ), + 32.hb, + TextField( + controller: _phoneController, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(48), + borderSide: BorderSide.none, + ), + fillColor: Color(0xFFEEEEEE), + filled: true, + ), + ), + 80.hb, + MaterialButton( + elevation: 0, + minWidth: double.infinity, + shape: StadiumBorder(), + color: kPrimaryColor, + height: 80.w, + onPressed: () async { + final cancel = BotToast.showLoading(); + BaseModel baseModel = await NetUtil().post( + API.market.appointment, + params: { + 'goodsId': widget.id, + 'userName': _nameController.text, + 'userTel': _phoneController.text, + 'num': 1, + }, + showMessage: true, + ); + cancel(); + if (baseModel.status == true) { + Get.back(); + Get.back(); + } + }, + child: Text('确认报名'), + ), + ], + ), + ), + )); + }, + child: Text('立即报名'), + ), ); }