Merge branch 'master' into newHost

# Conflicts:
#	lib/pages/personal/clock_in/clock_in_page.dart
#	lib/ui/market/search/submit_order_page_normal.dart
pull/1/head
张萌 3 years ago
commit f6feb831db

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

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

@ -1060,6 +1060,10 @@ class $AssetsImagesGen {
AssetGenImage get equipmentEmpty =>
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
AssetGenImage get houseAttestation =>
const AssetGenImage('assets/images/house_attestation.png');

@ -15,24 +15,8 @@ class UserDetailModel {
String? nickName;
List<String>? estateNames;
int? nowEstateExamineId;
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});
int? points;
bool? isSign;
UserDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -57,6 +41,16 @@ class UserDetailModel {
estateNames = [];
}
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() {
@ -77,6 +71,29 @@ class UserDetailModel {
data['nickName'] = this.nickName;
data['estateNames'] = this.estateNames;
data['nowEstateExamineId'] = this.nowEstateExamineId;
data['points'] = this.points;
data['isSign'] = this.isSign;
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 'dart:ui' as ui;
import 'package:aku_new_community/base/base_style.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/good/category_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/provider/app_provider.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/search_goods_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 {
late EasyRefreshController _refreshController;
late ScrollController _sliverListController;
late ScrollController _horListController;
GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey();
GlobalKey<AnimatedHomeBackgroundState> _animatedBackgroundState = GlobalKey();
int _pageNum = 1;
@ -73,6 +79,8 @@ class _MarketPageState extends State<MarketPage>
List<GoodsPopularModel> _goodsPopularModelList = [];
List<IntegralSkuModel> get _integralModelList => IntegralSkuModel.examples;
int? orderBySalesVolume;
int? orderByPrice;
@ -124,10 +132,10 @@ class _MarketPageState extends State<MarketPage>
_goodsPopularModelList.add(
GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0));
}
_refreshController = EasyRefreshController();
_sliverListController = ScrollController();
_horListController = ScrollController();
_tabController = TabController(initialIndex: 0, length: 3, vsync: this);
_refreshController = EasyRefreshController();
///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async {
@ -150,11 +158,14 @@ class _MarketPageState extends State<MarketPage>
final mediaWidth = MediaQuery.of(context).size.width;
return Scaffold(
body: EasyRefresh(
body: EasyRefresh.custom(
firstRefresh: false,
enableControlFinishLoad: false,
header: MaterialHeader(),
header: BallPulseHeader(
backgroundColor: Colors.red.withOpacity(0.8), color: Colors.white),
footer: MaterialFooter(),
topBouncing: false,
scrollController: _sliverListController,
controller: _refreshController,
onRefresh: () async {
_refresh();
@ -167,7 +178,7 @@ class _MarketPageState extends State<MarketPage>
}
setState(() {});
},
child: _buildBody(context),
slivers: _buildBody(context),
),
);
}
@ -191,7 +202,7 @@ class _MarketPageState extends State<MarketPage>
setState(() {});
}
Widget _buildBody(BuildContext context) {
List<Widget> _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton(
onPressed: () async {
_orderType = OrderType.NORMAL;
@ -292,39 +303,37 @@ class _MarketPageState extends State<MarketPage>
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
return CustomScrollView(
controller: _sliverListController,
slivers: <Widget>[
HomeSliverAppBar(
key: _sliverAppBarGlobalKey,
actions: _actionsWidget(),
title: _buildTitle(),
backgroundColor: Colors.red,
expandedHeight: MessageHeight +
bannerHeight +
buttonsHeight +
searchHeight +
tabBarHeight +
ScreenUtil().statusBarHeight +
kToolbarHeight +
280.w,
flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight),
child: _goodsTitle(
normalTypeButton,
salesTypeButton,
priceButton,
))),
SliverPadding(
padding: EdgeInsets.all(10.w),
),
SliverPadding(
padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(),
),
],
);
return <Widget>[
HomeSliverAppBar(
key: _sliverAppBarGlobalKey,
actions: _actionsWidget(),
title: _buildTitle(),
backgroundColor: Colors.red,
expandedHeight: MessageHeight +
bannerHeight +
buttonsHeight +
searchHeight +
tabBarHeight +
ScreenUtil().statusBarHeight +
kToolbarHeight +
280.w +
172 * 2.w,
flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize(
preferredSize: Size.fromHeight(tabBarHeight),
child: _goodsTitle(
normalTypeButton,
salesTypeButton,
priceButton,
))),
SliverPadding(
padding: EdgeInsets.all(10.w),
),
SliverPadding(
padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(),
),
];
}
SliverGrid buildSliverGrid() {
@ -474,6 +483,8 @@ class _MarketPageState extends State<MarketPage>
_buttonTitle(),
20.hb,
_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() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 24.w),

@ -8,6 +8,7 @@ import 'package:aku_new_community/ui/market/order/my_order_detail_page.dart';
import 'package:aku_new_community/ui/market/order/my_order_evaluation_page.dart';
import 'package:aku_new_community/ui/market/order/my_order_func.dart';
import 'package:aku_new_community/ui/market/order/my_order_refund_page.dart';
import 'package:aku_new_community/ui/market/order/receive_success.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/buttons/card_bottom_button.dart';
import 'package:flutter/material.dart';
@ -110,16 +111,6 @@ class _MyOrderCardState extends State<MyOrderCard> {
.make()
],
),
// 12.w.heightBox,
// Row(
// children: [
// ('${widget.model.levelTwoCategory}')
// .text
// .size(24.sp)
// .color(ktextSubColor)
// .make()
// ],
// ),
],
),
).expand()
@ -175,8 +166,11 @@ class _MyOrderCardState extends State<MyOrderCard> {
CardBottomButton.yellow(
text: '确认收货',
onPressed: () async {
await MyOrderFunc.confirmReceive(widget.model.id);
var re = await MyOrderFunc.confirmReceive(widget.model.id);
widget.callRefresh();
if (re) {
Get.to(() => ReceiveSuccess());
}
}),
].sepWidget(separate: 24.w.widthBox);
case 4:

@ -6,9 +6,10 @@ import 'package:aku_new_community/utils/network/net_util.dart';
class MyOrderFunc {
///
static Future confirmReceive(int goodsAppointmentId) async {
await NetUtil().get(API.market.confirmReceive,
static Future<bool> confirmReceive(int goodsAppointmentId) async {
var result = await NetUtil().get(API.market.confirmReceive,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
return result.success;
}
///退

@ -3,6 +3,7 @@ import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/model/order/order_list_model.dart';
import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart';
import 'package:aku_new_community/pages/life_pay/pay_util.dart';
import 'package:aku_new_community/ui/market/order/receive_success.dart';
import 'package:aku_new_community/ui/market/search/settlementGoodsDTO.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
@ -169,7 +170,10 @@ class _OrderCardState extends State<OrderCard> {
});
if (baseModel.success) {
BotToast.showText(text: '收货成功');
Get.back();
Get.off(() => ReceiveSuccess(
integralGood: widget.model.payType == 10,
integral: widget.model.payPrice!.toInt(),
));
widget.callRefresh();
}
cancel();

@ -0,0 +1,109 @@
import 'package:aku_new_community/pages/tab_navigator.dart';
import 'package:aku_new_community/ui/profile/order/order_page.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.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 ReceiveSuccess extends StatefulWidget {
final bool integralGood;
final int? integral;
const ReceiveSuccess({Key? key, this.integralGood = false, this.integral})
: super(key: key);
@override
_ReceiveSuccessState createState() => _ReceiveSuccessState();
}
class _ReceiveSuccessState extends State<ReceiveSuccess> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '订单结果',
body: SafeArea(
child: Center(
child: Column(
children: [
Container(
width: 56.w,
height: 56.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28.w),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFE52E2E), Color(0xFFF58123)],
),
),
child: Icon(
CupertinoIcons.check_mark,
size: 42.w,
color: Colors.white,
),
),
24.w.heightBox,
'收货成功'.text.size(32.sp).color(Colors.black).make(),
widget.integral != null
? Column(
children: [
8.w.heightBox,
'已获得${widget.integral}积分'
.text
.size(28.sp)
.color(Colors.red)
.make(),
48.w.heightBox,
],
)
: Column(
children: [
8.w.heightBox,
'本单已享受积分兑换不予返还积分'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
32.w.heightBox,
],
),
Row(
children: [
MaterialButton(
onPressed: () {
Get.offAll(() => TabNavigator());
},
color: Colors.white,
minWidth: 168.w,
height: 68.w,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(34.w),
side: BorderSide(color: Colors.red),
),
child: '返回首页'.text.size(28.sp).color(Colors.red).make(),
),
24.w.widthBox,
MaterialButton(
onPressed: () {
Get.off(() => OrderPage(initIndex: 3));
},
color: Colors.white,
minWidth: 168.w,
height: 68.w,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(34.w),
side: BorderSide(color: Colors.red),
),
child: '查看详情'.text.size(28.sp).color(Colors.red).make(),
)
],
)
],
),
)),
);
}
}

@ -1,4 +1,7 @@
import 'dart:async';
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/user/adress_model.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/shop_car/shop_car_page.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:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
@ -20,8 +24,15 @@ import 'good_detail_bottomSheet.dart';
class GoodDetailPage extends StatefulWidget {
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
_GoodDetailPageState createState() => _GoodDetailPageState();
@ -29,7 +40,6 @@ class GoodDetailPage extends StatefulWidget {
class _GoodDetailPageState extends State<GoodDetailPage> {
late EasyRefreshController _refreshController;
bool _showList = true;
late PageController _pageController;
int _currentIndex = 0;
@ -39,16 +49,29 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
AddressModel? _addressModel;
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
void initState() {
final appProvider = Provider.of<AppProvider>(Get.context!);
super.initState();
// Future.delayed(Duration(milliseconds: 0), () async {
// _imageList = await SearchFunc.getGoodDetailImage(widget.goodId);
// setState(() {
//
// });
// });
_pageController = PageController();
_sliverListController = ScrollController();
_refreshController = EasyRefreshController();
@ -57,6 +80,11 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
} else {
_addressModel = null;
}
if (widget.integralGood) {
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
setState(() {});
});
}
}
@override
@ -64,21 +92,19 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
_refreshController.dispose();
_pageController.dispose();
_sliverListController.dispose();
_timer?.cancel();
_timer == null;
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '',
titleSpacing: 0,
bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9),
// title: Row(
// children: [
// ],
// ),
bottomNavi: _onload ? SizedBox() : _bottomButton(),
body: Stack(
children: [
EasyRefresh(
@ -91,7 +117,6 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
if (_goodDetail != GoodDetailModel.fail()) {
_onload = false;
}
setState(() {});
},
child: _onload ? SizedBox() : _buildBody(context)),
@ -129,8 +154,8 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
return Column(
children: [
_imageView(_goodDetail!.goodsDetailImageVos ?? []),
20.hb,
_goodInfo(),
widget.integralGood ? _integralExchange() : 20.hb,
widget.integralGood ? _integralGoodInfo() : _goodInfo(),
20.hb,
_address(context),
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() {
return Container(
padding: EdgeInsets.all(20.w),
@ -449,10 +601,7 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
blurRadius: 0, //
spreadRadius: 0 //
)
]
// border: Border(top:BorderSide( width: 2.w,
// color: kPrimaryColor,))
),
]),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -534,6 +683,8 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
} else {
Get.to(() => SubmitOrderNormalPage(
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/const/resource.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/order/create_order_model.dart';
import 'package:aku_new_community/model/user/adress_model.dart';
@ -19,15 +19,21 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
class SubmitOrderNormalPage extends StatefulWidget {
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
_SubmitOrderNormalPageState createState() => _SubmitOrderNormalPageState();
@ -95,49 +101,124 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
20.hb,
_goodCard(widget.goodModel),
20.hb,
_priceView(),
if (!widget.integralGood) _priceView(),
20.hb,
_payWay(),
widget.integralGood ? _integralTile() : _payWay(),
20.hb,
],
),
bottomNavi: Container(
width: double.infinity,
height: 120.w,
color: Colors.white,
child: Row(
children: [
Spacer(),
EndButton(
onPressed: () async {
if (_addressModel == null) {
BotToast.showText(text: '请先选择地址');
}
Function cancel = BotToast.showLoading();
BaseModel baseModel = await NetUtil()
.post(API.pay.jcookOrderCreateOrder, params: {
"addressId": _addressModel!.id!,
"settlementGoodsDTOList":
_goodsList.map((v) => v.toJson()).toList(),
"payType": 1, //
"payPrice": _allPrice
});
if (baseModel.success) {
bool result = await PayUtil().callAliPay(
baseModel.msg, API.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => OrderPage(initIndex: 2));
} else {
///
Get.off(() => OrderPage(initIndex: 1));
}
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.success) {
Get.off(() => OrderPage(initIndex: 2));
}
cancel();
},
text: '提交订单'.text.size(32.sp).color(Colors.white).make()),
10.widthBox,
],
),
);
}
Container _normalBottom() {
return Container(
width: double.infinity,
height: 120.w,
color: Colors.white,
child: Row(
children: [
Spacer(),
EndButton(
onPressed: () async {
if (_addressModel == null) {
BotToast.showText(text: '请先选择地址');
}
Function cancel = BotToast.showLoading();
BaseModel baseModel = await NetUtil()
.post(API.pay.jcookOrderCreateOrder, params: {
"addressId": _addressModel!.id!,
"settlementGoodsDTOList":
_goodsList.map((v) => v.toJson()).toList(),
"payType": 1, //
"payPrice": _allPrice
});
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.msg, API.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => OrderPage(initIndex: 2));
} else {
///
Get.off(() => OrderPage(initIndex: 1));
}
cancel();
},
text: '提交订单'.text.size(32.sp).color(Colors.white).make()),
10.widthBox,
],
),
}
cancel();
},
text: '提交订单'.text.size(32.sp).color(Colors.white).make()),
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.userInfoModel!.points ?? 0)
(0).text.size(28.sp).color(Colors.red).make(),
],
),
);
}
@ -308,17 +389,6 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
)
: SizedBox(),
16.hb,
// Row(
// children: [
// Spacer(),
// '(小提示:京东自营商品加入购物车后一起下单,运费会更划算)'
// .text
// .size(18.sp)
// .color(Color(0xFFBBBBBB))
// .make(),
// ],
// ),
//16.hb,
Row(
children: [
Spacer(),
@ -521,8 +591,13 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
),
bottom,
Spacer(),
price,
30.hb,
if (!widget.integralGood)
Column(
children: [
price,
30.hb,
],
),
],
),
);

Loading…
Cancel
Save