对接积分兑换

master
张萌 3 years ago
parent ce22405a71
commit cf7d73171e

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

@ -713,6 +713,10 @@ class _Pay {
///app jcook(APP) ///app jcook(APP)
String get jcookOrderCreateOrder => '/user/alipay/jcookOrderCreateOrder'; String get jcookOrderCreateOrder => '/user/alipay/jcookOrderCreateOrder';
///app jcook
String get jcookOrderCreateByIntegral =>
'/user/points/jcookPointConvertOrder';
///jcook ///jcook
String get jcookOrderCheckAlipay => '/user/alipay/jcookOrderCheckAlipay'; String get jcookOrderCheckAlipay => '/user/alipay/jcookOrderCheckAlipay';
} }

@ -1043,6 +1043,10 @@ class $AssetsImagesGen {
AssetGenImage get equipmentEmpty => AssetGenImage get equipmentEmpty =>
const AssetGenImage('assets/images/equipment_empty.png'); const AssetGenImage('assets/images/equipment_empty.png');
/// File path: assets/images/good_detail_integral_back.png
AssetGenImage get goodDetailIntegralBack =>
const AssetGenImage('assets/images/good_detail_integral_back.png');
/// File path: assets/images/house_attestation.png /// File path: assets/images/house_attestation.png
AssetGenImage get houseAttestation => AssetGenImage get houseAttestation =>
const AssetGenImage('assets/images/house_attestation.png'); const AssetGenImage('assets/images/house_attestation.png');

@ -15,24 +15,8 @@ class UserDetailModel {
String? nickName; String? nickName;
List<String>? estateNames; List<String>? estateNames;
int? nowEstateExamineId; int? nowEstateExamineId;
int? points;
UserDetailModel( bool? isSign;
{this.id,
this.name,
this.type,
this.tel,
this.idType,
this.idNumber,
this.pwd,
this.confuse,
this.email,
this.createId,
this.createDate,
this.identity,
this.roomStatus,
this.nickName,
this.estateNames,
this.nowEstateExamineId});
UserDetailModel.fromJson(Map<String, dynamic> json) { UserDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -57,6 +41,16 @@ class UserDetailModel {
estateNames = []; estateNames = [];
} }
nowEstateExamineId = json['nowEstateExamineId']; nowEstateExamineId = json['nowEstateExamineId'];
if (json['points'] != null) {
points = json['points'];
} else {
points = 0;
}
if (json['isSign'] != null) {
isSign = json['isSign'];
} else {
isSign = false;
}
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -77,6 +71,29 @@ class UserDetailModel {
data['nickName'] = this.nickName; data['nickName'] = this.nickName;
data['estateNames'] = this.estateNames; data['estateNames'] = this.estateNames;
data['nowEstateExamineId'] = this.nowEstateExamineId; data['nowEstateExamineId'] = this.nowEstateExamineId;
data['points'] = this.points;
data['isSign'] = this.isSign;
return data; return data;
} }
UserDetailModel({
this.id,
this.name,
this.type,
this.tel,
this.idType,
this.idNumber,
this.pwd,
this.confuse,
this.email,
this.createId,
this.createDate,
this.identity,
this.roomStatus,
this.nickName,
this.estateNames,
this.nowEstateExamineId,
required this.points,
required this.isSign,
});
} }

@ -0,0 +1,79 @@
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/ui/market/integral/integral_sku_model.dart';
import 'package:aku_new_community/ui/market/search/good_detail_page.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class IntegralExchangePage extends StatefulWidget {
const IntegralExchangePage({Key? key}) : super(key: key);
@override
_IntegralExchangePageState createState() => _IntegralExchangePageState();
}
class _IntegralExchangePageState extends State<IntegralExchangePage> {
List<IntegralSkuModel> _models = IntegralSkuModel.examples;
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '积分商城',
body: SafeArea(
child: GridView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
itemCount: _models.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 332 / 480,
mainAxisSpacing: 16.w,
crossAxisSpacing: 24.w),
itemBuilder: (context, index) {
return _card(_models[index]);
})),
);
}
Widget _card(IntegralSkuModel model) {
return GestureDetector(
onTap: () {
Get.to(() => GoodDetailPage(
goodId: model.goodId,
integral: model.integral,
integralGood: true,
));
},
child: Column(
children: [
Container(
color: Color(0xFFF9F9F),
child: Image.network(model.imgPath, width: 332.w, height: 332.w)),
16.w.heightBox,
'${model.skuName}'
.text
.size(28.sp)
.maxLines(2)
.overflow(TextOverflow.ellipsis)
.color(Color(0xFF4F4F4F))
.make(),
16.w.heightBox,
Row(
children: [
Assets.icons.intergral.image(width: 24.w, height: 24.w),
4.w.widthBox,
'${model.integral}'.text.size(24.sp).color(Colors.red).make(),
Spacer(),
'已售${model.sold}'
.text
.size(24.sp)
.color(Color(0xFFBDBDBD))
.make(),
],
)
],
),
);
}
}

@ -0,0 +1,80 @@
class IntegralSkuModel {
final String imgPath;
final String skuName;
final int integral;
final int sold;
final int skuId;
final int goodId;
static List<IntegralSkuModel> get examples => [
IntegralSkuModel(
imgPath: 'http://oss.jcook.com.cn/file5/1509704/1509704_0.jpg',
skuName: '3M 耳塞 降噪睡眠 弹性舒适1100耳塞一副',
integral: 1050,
skuId: 1509704,
goodId: 438052,
sold: 89),
IntegralSkuModel(
imgPath: 'http://oss.jcook.com.cn/file5/5059614/5059614_0.jpg',
skuName: '一品巷子 休闲零食 泡面搭档 卤蛋32g/个',
integral: 1060,
skuId: 5059614,
goodId: 451850,
sold: 156),
IntegralSkuModel(
imgPath: 'http://oss.jcook.com.cn/file5/1146553/1146553_0.jpg',
skuName: '齐心(Comix)美工刀/裁纸刀/壁纸刀工具 小号9mm 颜色随机',
integral: 1750,
skuId: 1146553,
goodId: 435913,
sold: 34),
IntegralSkuModel(
imgPath:
'http://oss.jcook.com.cn/file5/100014750256/100014750256_0.jpg',
skuName: '公牛(BULL)118型开关插座布线盒 六孔插座暗盒墙插底盒2位暗盒H14适用120mm面板',
integral: 1910,
skuId: 100014750256,
goodId: 562798,
sold: 49),
IntegralSkuModel(
imgPath: 'http://oss.jcook.com.cn/file5/1033528/1033528_0.jpg',
skuName: '广博GuangBo0.5mm黑色中性笔 经典子弹头签字笔 水笔 12支装',
integral: 6250,
skuId: 1033528,
goodId: 435216,
sold: 298),
IntegralSkuModel(
imgPath:
'http://oss.jcook.com.cn/file5/100017573108/100017573108_0.jpg',
skuName: '惠寻 100ml小白鞋清洁剂擦洗鞋清洗剂 1瓶',
integral: 6250,
skuId: 100017573108,
goodId: 572690,
sold: 74),
IntegralSkuModel(
imgPath:
'http://oss.jcook.com.cn/file4/100009789209/100009789209_0.jpg',
skuName: '东园(TONGGARDEN)蚕豆 泰国进口 兰花豆盐焗味每日坚果炒货休闲零食非油炸',
integral: 6250,
skuId: 10009789209,
goodId: 535330,
sold: 330),
IntegralSkuModel(
imgPath:
'http://oss.jcook.com.cn/file5/100010670794/100010670794_0.jpg',
skuName: '伊利 优酸乳 蓝莓味 250g*24盒/箱 乳饮料 聚会乐享 春节年货礼盒装早餐伴侣',
integral: 35680,
skuId: 100010670794,
goodId: 539334,
sold: 25),
];
const IntegralSkuModel({
required this.imgPath,
required this.skuName,
required this.integral,
required this.sold,
required this.skuId,
required this.goodId,
});
}

@ -1,7 +1,10 @@
// import 'package:aku_new_community/base/base_style.dart'; // import 'package:aku_new_community/base/base_style.dart';
import 'dart:ui' as ui;
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/good/category_model.dart'; import 'package:aku_new_community/model/good/category_model.dart';
import 'package:aku_new_community/model/good/market_swiper_model.dart'; import 'package:aku_new_community/model/good/market_swiper_model.dart';
@ -10,6 +13,8 @@ import 'package:aku_new_community/models/market/goods_popular_model.dart';
import 'package:aku_new_community/models/market/order/goods_home_model.dart'; import 'package:aku_new_community/models/market/order/goods_home_model.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/ui/community/community_func.dart'; import 'package:aku_new_community/ui/community/community_func.dart';
import 'package:aku_new_community/ui/market/integral/integral_exchange_page.dart';
import 'package:aku_new_community/ui/market/integral/integral_sku_model.dart';
import 'package:aku_new_community/ui/market/search/good_detail_page.dart'; import 'package:aku_new_community/ui/market/search/good_detail_page.dart';
import 'package:aku_new_community/ui/market/search/search_goods_page.dart'; import 'package:aku_new_community/ui/market/search/search_goods_page.dart';
import 'package:aku_new_community/ui/market/shop_car/shop_car_page.dart'; import 'package:aku_new_community/ui/market/shop_car/shop_car_page.dart';
@ -43,6 +48,7 @@ class _MarketPageState extends State<MarketPage>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
late ScrollController _sliverListController; late ScrollController _sliverListController;
late ScrollController _horListController;
GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey(); GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey();
GlobalKey<AnimatedHomeBackgroundState> _animatedBackgroundState = GlobalKey(); GlobalKey<AnimatedHomeBackgroundState> _animatedBackgroundState = GlobalKey();
int _pageNum = 1; int _pageNum = 1;
@ -73,6 +79,8 @@ class _MarketPageState extends State<MarketPage>
List<GoodsPopularModel> _goodsPopularModelList = []; List<GoodsPopularModel> _goodsPopularModelList = [];
List<IntegralSkuModel> get _integralModelList => IntegralSkuModel.examples;
int? orderBySalesVolume; int? orderBySalesVolume;
int? orderByPrice; int? orderByPrice;
@ -124,10 +132,10 @@ class _MarketPageState extends State<MarketPage>
_goodsPopularModelList.add( _goodsPopularModelList.add(
GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0)); GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0));
} }
_refreshController = EasyRefreshController();
_sliverListController = ScrollController(); _sliverListController = ScrollController();
_horListController = ScrollController();
_tabController = TabController(initialIndex: 0, length: 3, vsync: this); _tabController = TabController(initialIndex: 0, length: 3, vsync: this);
_refreshController = EasyRefreshController();
///appbar refresh ///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
@ -150,11 +158,14 @@ class _MarketPageState extends State<MarketPage>
final mediaWidth = MediaQuery.of(context).size.width; final mediaWidth = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
body: EasyRefresh( body: EasyRefresh.custom(
firstRefresh: false, firstRefresh: false,
enableControlFinishLoad: false, enableControlFinishLoad: false,
header: MaterialHeader(), header: BallPulseHeader(
backgroundColor: Colors.red.withOpacity(0.8), color: Colors.white),
footer: MaterialFooter(), footer: MaterialFooter(),
topBouncing: false,
scrollController: _sliverListController,
controller: _refreshController, controller: _refreshController,
onRefresh: () async { onRefresh: () async {
_refresh(); _refresh();
@ -167,7 +178,7 @@ class _MarketPageState extends State<MarketPage>
} }
setState(() {}); setState(() {});
}, },
child: _buildBody(context), slivers: _buildBody(context),
), ),
); );
} }
@ -191,7 +202,7 @@ class _MarketPageState extends State<MarketPage>
setState(() {}); setState(() {});
} }
Widget _buildBody(BuildContext context) { List<Widget> _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () async { onPressed: () async {
_orderType = OrderType.NORMAL; _orderType = OrderType.NORMAL;
@ -292,9 +303,7 @@ class _MarketPageState extends State<MarketPage>
height: 80.w, height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
); );
return CustomScrollView( return <Widget>[
controller: _sliverListController,
slivers: <Widget>[
HomeSliverAppBar( HomeSliverAppBar(
key: _sliverAppBarGlobalKey, key: _sliverAppBarGlobalKey,
actions: _actionsWidget(), actions: _actionsWidget(),
@ -307,7 +316,8 @@ class _MarketPageState extends State<MarketPage>
tabBarHeight + tabBarHeight +
ScreenUtil().statusBarHeight + ScreenUtil().statusBarHeight +
kToolbarHeight + kToolbarHeight +
280.w, 280.w +
172 * 2.w,
flexibleSpace: _flexibleSpaceBar(context), flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight), preferredSize: Size.fromHeight(tabBarHeight),
@ -323,8 +333,7 @@ class _MarketPageState extends State<MarketPage>
padding: EdgeInsets.only(left: 20.w, right: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(), sliver: buildSliverGrid(),
), ),
], ];
);
} }
SliverGrid buildSliverGrid() { SliverGrid buildSliverGrid() {
@ -474,6 +483,8 @@ class _MarketPageState extends State<MarketPage>
_buttonTitle(), _buttonTitle(),
20.hb, 20.hb,
_recommend(), _recommend(),
20.hb,
_integralMarket(),
], ],
), ),
], ],
@ -481,6 +492,109 @@ class _MarketPageState extends State<MarketPage>
); );
} }
Widget _integralMarket() {
return Container(
width: 720.w,
height: 172 * 2.w,
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24.w),
),
child: Column(
children: [
Row(
children: [
'积分商城'.richText.size(28.sp).italic.bold.black.make(),
8.wb,
Text(
'限时兑换',
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
foreground: Paint()
..shader = ui.Gradient.linear(
Offset(150, 690), Offset(150, 695), [
Color(0xFFF94B4B),
Color(0xFFF7B86F),
])),
),
Spacer(),
GestureDetector(
onTap: () {
Get.to(() => IntegralExchangePage());
},
child: Row(
children: [
'查看更多'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
4.wb,
Icon(
CupertinoIcons.chevron_right,
size: 20.w,
color: Colors.black.withOpacity(0.45),
)
],
),
)
],
),
18.hb,
Flexible(
child: ListView.separated(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
controller: _horListController,
itemBuilder: (context, index) {
return _horizontalListCard(_integralModelList[index]);
},
separatorBuilder: (_, __) {
return 24.wb;
},
itemCount: 4),
),
],
),
);
}
Widget _horizontalListCard(IntegralSkuModel model) {
return GestureDetector(
onTap: () {},
child: SizedBox(
width: 148.w,
child: Column(
children: [
Image.network(
model.imgPath,
width: 148.w,
height: 148.w,
),
'${model.skuName}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.maxLines(2)
.overflow(TextOverflow.ellipsis)
.make(),
10.hb,
Row(
children: [
Assets.icons.intergral.image(width: 24.w, height: 24.w),
4.wb,
'${model.integral}'.text.size(24.sp).color(Colors.red).make()
],
)
],
),
),
);
}
geSearch() { geSearch() {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 24.w), margin: EdgeInsets.symmetric(horizontal: 24.w),

@ -1,4 +1,7 @@
import 'dart:async';
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/good/good_detail_model.dart'; import 'package:aku_new_community/model/good/good_detail_model.dart';
import 'package:aku_new_community/model/user/adress_model.dart'; import 'package:aku_new_community/model/user/adress_model.dart';
import 'package:aku_new_community/pages/personal/address/address_list_page.dart'; import 'package:aku_new_community/pages/personal/address/address_list_page.dart';
@ -8,6 +11,7 @@ import 'package:aku_new_community/ui/market/search/search_func.dart';
import 'package:aku_new_community/ui/market/search/submit_order_page_normal.dart'; import 'package:aku_new_community/ui/market/search/submit_order_page_normal.dart';
import 'package:aku_new_community/ui/market/shop_car/shop_car_page.dart'; import 'package:aku_new_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -20,8 +24,15 @@ import 'good_detail_bottomSheet.dart';
class GoodDetailPage extends StatefulWidget { class GoodDetailPage extends StatefulWidget {
final int goodId; final int goodId;
final bool integralGood;
final int integral;
GoodDetailPage({Key? key, required this.goodId}) : super(key: key); GoodDetailPage({
Key? key,
required this.goodId,
this.integral = 0,
this.integralGood = false,
}) : super(key: key);
@override @override
_GoodDetailPageState createState() => _GoodDetailPageState(); _GoodDetailPageState createState() => _GoodDetailPageState();
@ -29,7 +40,6 @@ class GoodDetailPage extends StatefulWidget {
class _GoodDetailPageState extends State<GoodDetailPage> { class _GoodDetailPageState extends State<GoodDetailPage> {
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
bool _showList = true;
late PageController _pageController; late PageController _pageController;
int _currentIndex = 0; int _currentIndex = 0;
@ -39,16 +49,29 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
AddressModel? _addressModel; AddressModel? _addressModel;
List _imageList = []; List _imageList = [];
DateTime _deadline = DateTime(2022, 4, 17, 0, 0, 0, 0, 0).toUtc();
int get days => _deadline.difference(DateTime.now().toUtc()).inDays;
int get hours =>
_deadline.difference(DateTime.now().toUtc()).inHours - days * 24;
int get mins =>
_deadline.difference(DateTime.now().toUtc()).inMinutes -
days * 1440 -
hours * 60;
int get seconds => (_deadline.difference(DateTime.now().toUtc()).inSeconds -
days * 86400 -
hours * 3600 -
mins * 60);
Timer? _timer;
@override @override
void initState() { void initState() {
final appProvider = Provider.of<AppProvider>(Get.context!); final appProvider = Provider.of<AppProvider>(Get.context!);
super.initState(); super.initState();
// Future.delayed(Duration(milliseconds: 0), () async {
// _imageList = await SearchFunc.getGoodDetailImage(widget.goodId);
// setState(() {
//
// });
// });
_pageController = PageController(); _pageController = PageController();
_sliverListController = ScrollController(); _sliverListController = ScrollController();
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
@ -57,6 +80,11 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
} else { } else {
_addressModel = null; _addressModel = null;
} }
if (widget.integralGood) {
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
setState(() {});
});
}
} }
@override @override
@ -64,21 +92,19 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
_refreshController.dispose(); _refreshController.dispose();
_pageController.dispose(); _pageController.dispose();
_sliverListController.dispose(); _sliverListController.dispose();
_timer?.cancel();
_timer == null;
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '',
titleSpacing: 0, titleSpacing: 0,
bgColor: Color(0xFFF9F9F9), bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9), bodyColor: Color(0xFFF9F9F9),
// title: Row(
// children: [
// ],
// ),
bottomNavi: _onload ? SizedBox() : _bottomButton(), bottomNavi: _onload ? SizedBox() : _bottomButton(),
body: Stack( body: Stack(
children: [ children: [
EasyRefresh( EasyRefresh(
@ -91,7 +117,6 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
if (_goodDetail != GoodDetailModel.fail()) { if (_goodDetail != GoodDetailModel.fail()) {
_onload = false; _onload = false;
} }
setState(() {}); setState(() {});
}, },
child: _onload ? SizedBox() : _buildBody(context)), child: _onload ? SizedBox() : _buildBody(context)),
@ -129,8 +154,8 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
return Column( return Column(
children: [ children: [
_imageView(_goodDetail!.goodsDetailImageVos ?? []), _imageView(_goodDetail!.goodsDetailImageVos ?? []),
20.hb, widget.integralGood ? _integralExchange() : 20.hb,
_goodInfo(), widget.integralGood ? _integralGoodInfo() : _goodInfo(),
20.hb, 20.hb,
_address(context), _address(context),
20.hb, 20.hb,
@ -139,6 +164,133 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
); );
} }
Widget _integralExchange() {
return Container(
width: double.infinity,
height: 152.w,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.goodDetailIntegralBack.path))),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Row(
children: [
Assets.icons.intergral.image(width: 40.w, height: 40.w),
8.w.widthBox,
'${widget.integral}'.text.size(40.sp).color(Colors.white).make(),
Spacer(),
BeeDivider.vertical(
indent: 20.w,
endIndent: 20.w,
),
24.wb,
Column(
children: [
SizedBox(
width: 272.w,
child: Text(
'限时兑换',
style: TextStyle(
fontStyle: FontStyle.italic,
color: Colors.white,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
),
8.hb,
Row(
children: [
'距结束'.text.size(24.sp).color(Colors.white).make(),
16.wb,
_timerContainer(days),
8.wb,
''.text.size(24.sp).white.make(),
8.wb,
_timerContainer(hours),
8.wb,
':'.text.white.size(24.sp).make(),
8.wb,
_timerContainer(mins),
8.wb,
':'.text.white.size(24.sp).make(),
8.wb,
_timerContainer(seconds),
],
),
],
)
],
),
);
}
Widget _timerContainer(int num) {
return Container(
width: 27.w,
height: 27.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.white, Colors.white.withOpacity(0.5)])),
child: num.text.size(20.sp).color(Color(0xFFE52E2E)).make(),
);
}
_integralGoodInfo() {
return Container(
padding: EdgeInsets.all(20.w),
margin: EdgeInsets.symmetric(horizontal: 20.w),
width: double.infinity,
// height: 256.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(24.w)),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 16.w),
height: 100.w,
width: double.infinity,
child: Text(
(_goodDetail!.skuName ?? ''),
style: TextStyle(
fontSize: 36.sp,
fontWeight: FontWeight.bold,
color: ktextPrimary),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
_getIcon(_goodDetail!.kind ?? 0),
24.hb,
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
16.wb,
'原价:¥'.text.color(Color(0xFFBBBBBB)).size(24.sp).make(),
Text(
_goodDetail!.sellPrice == null
? ''
: (_goodDetail!.sellPrice!).toStringAsFixed(2),
style: TextStyle(
fontSize: 24.sp,
decoration: TextDecoration.lineThrough,
decorationThickness: 2,
decorationStyle: TextDecorationStyle.solid,
color: Color(0xFFBBBBBB)),
),
],
),
],
),
);
}
_goodInfo() { _goodInfo() {
return Container( return Container(
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
@ -449,10 +601,7 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
blurRadius: 0, // blurRadius: 0, //
spreadRadius: 0 // spreadRadius: 0 //
) )
] ]),
// border: Border(top:BorderSide( width: 2.w,
// color: kPrimaryColor,))
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -534,6 +683,8 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
} else { } else {
Get.to(() => SubmitOrderNormalPage( Get.to(() => SubmitOrderNormalPage(
goodModel: _goodDetail!, goodModel: _goodDetail!,
integralGood: widget.integralGood,
integral: widget.integral,
)); ));
} }
}, },

@ -1,6 +1,6 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/good/good_detail_model.dart'; import 'package:aku_new_community/model/good/good_detail_model.dart';
import 'package:aku_new_community/model/order/create_order_model.dart'; import 'package:aku_new_community/model/order/create_order_model.dart';
import 'package:aku_new_community/model/user/adress_model.dart'; import 'package:aku_new_community/model/user/adress_model.dart';
@ -15,19 +15,26 @@ import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/end_button.dart'; import 'package:aku_new_community/widget/buttons/end_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
class SubmitOrderNormalPage extends StatefulWidget { class SubmitOrderNormalPage extends StatefulWidget {
final GoodDetailModel goodModel; final GoodDetailModel goodModel;
final bool integralGood;
final int? integral;
SubmitOrderNormalPage({Key? key, required this.goodModel}) : super(key: key); SubmitOrderNormalPage(
{Key? key,
required this.goodModel,
this.integralGood = false,
this.integral})
: assert(!integralGood || integral != null),
super(key: key);
@override @override
_SubmitOrderNormalPageState createState() => _SubmitOrderNormalPageState(); _SubmitOrderNormalPageState createState() => _SubmitOrderNormalPageState();
@ -95,13 +102,69 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
20.hb, 20.hb,
_goodCard(widget.goodModel), _goodCard(widget.goodModel),
20.hb, 20.hb,
_priceView(), if (!widget.integralGood) _priceView(),
20.hb, 20.hb,
_payWay(), widget.integralGood ? _integralTile() : _payWay(),
20.hb, 20.hb,
], ],
), ),
bottomNavi: Container( bottomNavi: widget.integralGood ? _integralBottom() : _normalBottom(),
);
}
Container _integralBottom() {
return Container(
width: double.infinity,
height: 120.w,
color: Colors.white,
child: Row(
children: [
if (widget.integralGood)
Row(
children: [
20.w.widthBox,
'应付积分:'.text.size(32.sp).color(Colors.black).bold.make(),
24.w.widthBox,
Assets.icons.intergral.image(width: 40.w, height: 40.w),
8.w.widthBox,
widget.integral
.toString()
.text
.size(28.sp)
.color(Colors.red)
.make(),
],
),
Spacer(),
EndButton(
onPressed: () async {
if (_addressModel == null) {
BotToast.showText(text: '请先选择地址');
}
Function cancel = BotToast.showLoading();
BaseModel baseModel = await NetUtil()
.post(API.pay.jcookOrderCreateByIntegral, params: {
"addressId": _addressModel!.id!,
"settlementGoodsDTOList":
_goodsList.map((v) => v.toJson()).toList(),
"payType": 10, //
"payPrice": _allPrice,
'points': widget.integral,
});
if (baseModel.status ?? false) {
Get.off(() => OrderPage(initIndex: 2));
}
cancel();
},
text: '提交订单'.text.size(32.sp).color(Colors.white).make()),
10.widthBox,
],
),
);
}
Container _normalBottom() {
return Container(
width: double.infinity, width: double.infinity,
height: 120.w, height: 120.w,
color: Colors.white, color: Colors.white,
@ -138,6 +201,28 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
10.widthBox, 10.widthBox,
], ],
), ),
);
}
Widget _integralTile() {
return Container(
width: 710.w,
height: 96.w,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(24.w)),
child: Row(
children: [
Assets.icons.intergral.image(width: 40.w, height: 40.w),
8.w.widthBox,
'当前积分'.text.size(28.sp).color(Color(0xFF4F4F4F)).make(),
Spacer(),
(UserTool.userProvider.userDetailModel!.points ?? 0)
.text
.size(28.sp)
.color(Colors.red)
.make(),
],
), ),
); );
} }
@ -308,17 +393,6 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
) )
: SizedBox(), : SizedBox(),
16.hb, 16.hb,
// Row(
// children: [
// Spacer(),
// '(小提示:京东自营商品加入购物车后一起下单,运费会更划算)'
// .text
// .size(18.sp)
// .color(Color(0xFFBBBBBB))
// .make(),
// ],
// ),
//16.hb,
Row( Row(
children: [ children: [
Spacer(), Spacer(),
@ -521,10 +595,15 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
), ),
bottom, bottom,
Spacer(), Spacer(),
if (!widget.integralGood)
Column(
children: [
price, price,
30.hb, 30.hb,
], ],
), ),
],
),
); );
} }

Loading…
Cancel
Save