|
|
@@ -15,6 +15,7 @@ import 'package:location/resource/colors.gen.dart';
|
|
|
import 'package:location/utils/common_expand.dart';
|
|
|
import 'package:location/utils/project_expand.dart';
|
|
|
import 'package:location/widget/auto_scroll_list_view.dart';
|
|
|
+import '../../data/bean/goods_bean.dart';
|
|
|
import '../../data/bean/member_status_info.dart';
|
|
|
import '../../data/bean/pay_item_bean.dart';
|
|
|
import '../../data/consts/payment_type.dart';
|
|
|
@@ -238,123 +239,228 @@ class MemberPage extends BasePage<MemberController> {
|
|
|
|
|
|
Widget buildGoodsList() {
|
|
|
return Obx(() {
|
|
|
- return SizedBox(
|
|
|
- height: 123.w,
|
|
|
- child: ListView.builder(
|
|
|
- padding: EdgeInsets.only(left: 12.w),
|
|
|
- physics: const BouncingScrollPhysics(
|
|
|
- parent: AlwaysScrollableScrollPhysics()),
|
|
|
- scrollDirection: Axis.horizontal,
|
|
|
- itemBuilder: (BuildContext ctx, int index) {
|
|
|
- return Obx(() {
|
|
|
- final item = controller.goodsList[index];
|
|
|
- bool isSelected = controller.selectedGoods?.id == item.id;
|
|
|
- return GestureDetector(
|
|
|
- behavior: HitTestBehavior.translucent,
|
|
|
- onTap: () => controller.onGoodsItemClick(item),
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.only(right: 10.w),
|
|
|
- width: 138.w,
|
|
|
- height: 123.w,
|
|
|
- child: Stack(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- width: double.infinity,
|
|
|
- height: double.infinity,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: isSelected
|
|
|
- ? '#6BC4BAFF'.color
|
|
|
- : ColorName.white20,
|
|
|
- borderRadius: BorderRadius.circular(18.w),
|
|
|
- border: Border.all(
|
|
|
- color: isSelected
|
|
|
- ? '#C4BAFF'.color
|
|
|
- : '#E8E8E8'.color,
|
|
|
- width: 3.w)),
|
|
|
- padding: EdgeInsets.only(left: 10.w),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Spacer(flex: 2),
|
|
|
- Text(
|
|
|
- item.name,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14.sp,
|
|
|
- color: ColorName.black90,
|
|
|
- fontWeight: FontWeight.bold),
|
|
|
- ),
|
|
|
- SizedBox(height: 3.w),
|
|
|
- Text('¥${item.originalAmount.divideBy100()}',
|
|
|
- style: TextStyle(
|
|
|
- decoration: TextDecoration.lineThrough,
|
|
|
- fontSize: 10.sp,
|
|
|
- color: ColorName.black60)),
|
|
|
- Spacer(flex: 1),
|
|
|
- RichText(
|
|
|
- text: TextSpan(
|
|
|
- style: TextStyle(
|
|
|
- color: isSelected
|
|
|
- ? '#EA1231'.color
|
|
|
- : ColorName.black80,
|
|
|
- fontWeight: FontWeight.bold),
|
|
|
- children: [
|
|
|
- TextSpan(
|
|
|
- text: '¥',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 20.sp, height: 1)),
|
|
|
- TextSpan(
|
|
|
- text: item.amount.divideBy100(),
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 34.sp,
|
|
|
- height: 1,
|
|
|
- fontFamily: FontFamily.oppoSans))
|
|
|
- ])),
|
|
|
- Padding(
|
|
|
- padding: EdgeInsets.only(left: 7.w),
|
|
|
- child: Text(item.description ?? '',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.black40)),
|
|
|
- ),
|
|
|
- Spacer(
|
|
|
- flex: 1,
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- Visibility(
|
|
|
- visible: item.tag?.isNotEmpty == true,
|
|
|
- child: Positioned(
|
|
|
- top: 0,
|
|
|
- right: 0,
|
|
|
- child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- gradient: LinearGradient(colors: [
|
|
|
- '#A26CFF'.color,
|
|
|
- '#FF7CD8'.color,
|
|
|
- '#898BFF'.color
|
|
|
- ]),
|
|
|
- borderRadius: BorderRadius.only(
|
|
|
- topRight: Radius.circular(11.w),
|
|
|
- bottomLeft: Radius.circular(11.w))),
|
|
|
- padding: EdgeInsets.symmetric(
|
|
|
- horizontal: 10.w, vertical: 4.w),
|
|
|
- child: Text(item.tag ?? '',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: Colors.white)),
|
|
|
- ),
|
|
|
- ))
|
|
|
- ],
|
|
|
- )),
|
|
|
- );
|
|
|
- });
|
|
|
- },
|
|
|
- itemCount: controller.goodsList.length),
|
|
|
+ if (controller.goodsList.isEmpty) {
|
|
|
+ return Container();
|
|
|
+ }
|
|
|
+ if (controller.goodsList.length == 1) {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
+ //height: 165.w,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ _createSpecialProduct(controller.goodsList.first)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ } else if (controller.goodsList.length == 2) {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
+ //height: 165.w,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Expanded(child: _ordinaryProductWidget(controller.goodsList.first)),
|
|
|
+ SizedBox(width: 8,),
|
|
|
+ Expanded(child: _ordinaryProductWidget(controller.goodsList[1]))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 14.w),
|
|
|
+ //height: 165.w,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ _createSpecialProduct(controller.goodsList.first),
|
|
|
+ SizedBox(height: 7.w,),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Expanded(child: _ordinaryProductWidget(controller.goodsList[1])),
|
|
|
+ SizedBox(width: 8,),
|
|
|
+ Expanded(child: _ordinaryProductWidget(controller.goodsList[2]))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ //特惠产品
|
|
|
+ Widget _createSpecialProduct(GoodsBean goodsInfo) {
|
|
|
+ bool isSelected = controller.selectedGoods?.id == goodsInfo.id;
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.onGoodsItemClick(goodsInfo);
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ height: 96.w,
|
|
|
+ padding: EdgeInsets.only(left: 17.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: isSelected ? Assets.images.iconMemberSpecialProductsSelect.provider() : Assets.images.iconMemberSpecialProductsNormal.provider(),
|
|
|
+ fit: BoxFit.cover
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 29.w,),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Column(
|
|
|
+ children: [
|
|
|
+ RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ style: TextStyle(
|
|
|
+ color: isSelected
|
|
|
+ ? '#FF5656'.color
|
|
|
+ : "#323133".color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ children: [
|
|
|
+ TextSpan(
|
|
|
+ text: '¥',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp, height: 1)),
|
|
|
+ TextSpan(
|
|
|
+ text: goodsInfo.amount.divideBy100(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 28.sp,
|
|
|
+ height: 1,
|
|
|
+ //fontFamily: FontFamily.oppoSans
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ Text('¥${goodsInfo.originalAmount.divideBy100()}',
|
|
|
+ style: TextStyle(
|
|
|
+ decoration: TextDecoration.lineThrough,
|
|
|
+ decorationColor: ColorName.black40,
|
|
|
+ decorationThickness: 1.0,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.black40))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(width: 22.24.w,),
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ goodsInfo.name,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 17.sp,
|
|
|
+ color: "#333333".color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ height: 3.w,
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ goodsInfo.description ?? "",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 11.sp ,
|
|
|
+ color: "#9191BA".color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ ///普通产品
|
|
|
+ Widget _ordinaryProductWidget(GoodsBean goodsInfo) {
|
|
|
+ bool isSelected = controller.selectedGoods?.id == goodsInfo.id;
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.onGoodsItemClick(goodsInfo);
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ height: 62.w,
|
|
|
+ padding: EdgeInsets.only(left: 16.w,right: 12.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: isSelected ? Assets.images.iconMemberOrdinaryProductSelect.provider() : Assets.images.iconMemberOrdinaryProductNormal.provider(),
|
|
|
+ fit: BoxFit.cover
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 15.w,),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ goodsInfo.name,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: "#333333".color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ //SizedBox(height: 6.w,),
|
|
|
+ Text(
|
|
|
+ goodsInfo.description ?? "",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 10.sp ,
|
|
|
+ color: ColorName.black40,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ //SizedBox(width: 22.24.w,),
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
+ children: [
|
|
|
+ RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ style: TextStyle(
|
|
|
+ color: isSelected
|
|
|
+ ? '#FF5656'.color
|
|
|
+ : "#323133".color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ children: [
|
|
|
+ TextSpan(
|
|
|
+ text: '¥',
|
|
|
+ style: TextStyle(
|
|
|
+ color: isSelected? "#FF5656".color : ColorName.black80,
|
|
|
+ fontSize: 11.sp, height: 1)),
|
|
|
+ TextSpan(
|
|
|
+ text: goodsInfo.amount.divideBy100(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20.sp,
|
|
|
+ height: 1,))
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ Text('¥${goodsInfo.originalAmount.divideBy100()}',
|
|
|
+ style: TextStyle(
|
|
|
+ decoration: TextDecoration.lineThrough,
|
|
|
+ decorationColor: ColorName.black30,
|
|
|
+ decorationThickness: 1.0,
|
|
|
+ fontSize: 10.sp,
|
|
|
+ color: ColorName.black30))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Widget buildMemberBottomView() {
|
|
|
return Obx(() {
|
|
|
return Visibility(
|