From 80eee8b2ac453e28d31b0e43d9e824e17f421a42 Mon Sep 17 00:00:00 2001 From: ZHR007 Date: Sat, 29 Nov 2025 17:17:43 +0800 Subject: [PATCH] no message --- lib/controller/setting/spread_controller.dart | 31 +- lib/model/mine/user_data.dart | 2 + lib/pages/setting/match_spread_page.dart | 311 +++++++++++++----- 3 files changed, 256 insertions(+), 88 deletions(-) diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart index cda96ed..019bdc8 100644 --- a/lib/controller/setting/spread_controller.dart +++ b/lib/controller/setting/spread_controller.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:fluwx/fluwx.dart'; import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; class SpreadController extends GetxController with WidgetsBindingObserver { @@ -17,11 +18,27 @@ class SpreadController extends GetxController with WidgetsBindingObserver { final payChecked = true.obs; final activePay = 0.obs; - + final enableIndex = (-1).obs; final Fluwx fluwx = Fluwx(); + final matchmakerFlag = false.obs; + final button = '去相亲'.obs; changePayActive(int index){ + if(index < enableIndex.value && enableIndex.value >= 0){ + return; + } activePay.value = index; + if(matchmakerFlag.value){ + if(activePay.value > enableIndex.value){ + button.value = '立即升级'; + } else { + button.value = '立即续费'; + } + } else if(activePay.value == 0){ + button.value = '去相亲'; + } else { + button.value = '立即加入'; + } } List list2 = [ @@ -43,6 +60,9 @@ class SpreadController extends GetxController with WidgetsBindingObserver { super.onInit(); WidgetsBinding.instance.addObserver(this); _userApi = Get.find(); + if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){ + matchmakerFlag.value = true; + } getRoseList(); } @@ -91,6 +111,11 @@ class SpreadController extends GetxController with WidgetsBindingObserver { if (response.data.isSuccess && response.data.data != null) { final data = response.data.data!.records; roseList.addAll(data.toList()); + if(matchmakerFlag.value){ + final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!); + enableIndex.value = index >= 0 ? index : 0; + changePayActive(enableIndex.value); + } } print('rose>>>${roseList.length}'); } catch (e) { @@ -100,6 +125,10 @@ class SpreadController extends GetxController with WidgetsBindingObserver { } submitOrder() async { + if(activePay.value == 0){ + Get.back(); + return; + } try { final response = await _userApi.submitOrder({ "productSpecId": roseList[activePay.value].productSpecId diff --git a/lib/model/mine/user_data.dart b/lib/model/mine/user_data.dart index 7f8f284..cb52c99 100644 --- a/lib/model/mine/user_data.dart +++ b/lib/model/mine/user_data.dart @@ -65,6 +65,7 @@ class UserData { String? phone; String? realName; bool? matchmakerFlag; + int? matchmakerType; List? photoList; UserData({ @@ -132,6 +133,7 @@ class UserData { this.realName, this.matchmakerFlag, this.photoList, + this.matchmakerType }); // 从JSON映射创建实例 diff --git a/lib/pages/setting/match_spread_page.dart b/lib/pages/setting/match_spread_page.dart index d4b9ebb..292fe84 100644 --- a/lib/pages/setting/match_spread_page.dart +++ b/lib/pages/setting/match_spread_page.dart @@ -17,85 +17,213 @@ class MatchSpreadPage extends StatelessWidget { return GetX( init: SpreadController(), builder: (controller){ - return Scaffold( - appBar: PageAppbar(title: "入驻加盟"), - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w), - child: Column( - children: [ - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( + return Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, // 0%:左边开始 + end: Alignment.bottomCenter, // 100%:右边结束 + colors: [ + Color.fromRGBO(172, 89, 255, 1), // 紫色 + Color.fromRGBO(117, 98, 249, 1), // 中间淡蓝 + Color.fromRGBO(255, 255, 255, 1), + Color.fromRGBO(255, 255, 255, 1),// 右侧深蓝 + ], + stops: [0.0, 0.32, 0.66, 1.0], // 对应 CSS 百分比:0%、77.53%、100% + ), + ), + child: controller.roseList.isNotEmpty ? Scaffold( + backgroundColor: Colors.transparent, + appBar: PageAppbar(title: "入驻加盟", backgroundColor: Colors.transparent, color: Colors.white), + body: SingleChildScrollView( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(18.w)), + color: Colors.white + ), + padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w), + margin: EdgeInsets.symmetric(vertical: 10.w, horizontal: 12.w), + child: Column( + children: [ + SizedBox(height: 6.w,), + Row( children: [ - ...controller.roseList.asMap().entries.map((entry){ - return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive); - }), + Text( + "趣恋恋,让婚恋服务更高效", + style: TextStyle( + fontSize: 16.w, + fontWeight: FontWeight.w500 + ), + ) ], ), - ), - SizedBox(height: 32.w), - if(controller.roseList.isNotEmpty)Row( - children: [ - Text('红娘权益', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), - ], - ), - SizedBox(height: 24.w,), - if(controller.roseList.isNotEmpty)Wrap( - spacing: 10.w, - runSpacing: 18.w, - children: [ - ...controller.list2.map((e){ - return SizedBox( - width: 80.w, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon(TDIcons.help_circle, color: Colors.orange, size: 36), - SizedBox(height: 8.w,), - Text(e['title'], style: TextStyle(fontSize: 14, color: Color(0xFF999999))), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - if(e['unit'] != null)Text(e['unit'], style: TextStyle(fontSize: 14)), - Text(e['desc'], style: TextStyle(fontSize: 14, color: Color(0xFF999999))), - ], - ) - ], + SizedBox(height: 15.w,), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + ...controller.roseList.asMap().entries.map((entry){ + return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive); + }), + ], + ), + ), + SizedBox(height: 24.w), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text('新红娘入驻权益', style: TextStyle(fontSize: 22, color: Color(0xFF333333))), + SizedBox(width: 4.w), + Container( + padding: EdgeInsets.symmetric(vertical: 2.w, horizontal: 4.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(4.w)), + gradient: LinearGradient( + begin: Alignment.topLeft, // 0%:左边开始 + end: Alignment.bottomRight, // 100%:右边结束 + colors: [ + Color(0xFFF8C18E), // 紫色 + Color(0xFFF9DFC3),// 右侧深蓝 + ], + stops: [0.0, 1.0], // 对应 CSS 百分比:0%、77.53%、100% + ), ), - ); - }), - ], - ), - ], + child: Text('限时', style: TextStyle(fontSize: 12, color: Color(0xFF894A0D))), + ) + ], + ), + SizedBox(height: 16.w,), + Container( + padding: EdgeInsets.symmetric( + vertical: 12.w, + horizontal: 18.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: const Color.fromRGBO(117, 98, 249, .1) + ), + child: Row( + children: [ + Image.asset( + Assets.imagesVipGift, + width: 34.w, + ), + SizedBox(width: 16.w,), + Expanded( + child: Text( + '礼物收益范围15%-30%,嘉宾消费的分成3%;', + style: TextStyle(color: Color(0xFF333333)), + ), + ) + ], + ), + ), + SizedBox(height: 12.w,), + Container( + padding: EdgeInsets.symmetric( + vertical: 12.w, + horizontal: 18.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: const Color.fromRGBO(117, 98, 249, .1) + ), + child: Row( + children: [ + Image.asset( + Assets.imagesMatchmakerIcon2, + width: 34.w, + ), + SizedBox(width: 16.w,), + Expanded( + child: Text( + '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;', + style: TextStyle(color: Color(0xFF333333)), + ), + ) + ], + ), + ), + SizedBox(height: 12.w,), + Container( + padding: EdgeInsets.symmetric( + vertical: 12.w, + horizontal: 18.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: const Color.fromRGBO(117, 98, 249, .1) + ), + child: Row( + children: [ + Image.asset( + Assets.imagesMatchmakerIcon3, + width: 34.w, + ), + SizedBox(width: 16.w,), + Expanded( + child: Text( + '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;', + style: TextStyle(color: Color(0xFF333333)), + ), + ) + ], + ), + ), + SizedBox(height: 12.w,), + Container( + padding: EdgeInsets.symmetric( + vertical: 18.w, + horizontal: 18.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: const Color.fromRGBO(117, 98, 249, .1) + ), + child: Row( + children: [ + Image.asset( + Assets.imagesMatchmakerIcon4, + width: 34.w, + ), + SizedBox(width: 16.w,), + Expanded( + child: Text( + '新徒弟首月收益的10%(平台奖励)', + style: TextStyle(color: Color(0xFF333333)), + ), + ) + ], + ), + ), + ], + ), ), ), - ), - bottomNavigationBar: controller.roseList.isNotEmpty ? SafeArea( - child: Container( - height: 60, - padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 16.w), - child: TDButton( - text: '立即加入', - width: MediaQuery.of(context).size.width - 40, - size: TDButtonSize.large, - type: TDButtonType.fill, - shape: TDButtonShape.round, - style: TDButtonStyle( - textColor: Colors.white, - backgroundColor: Color(0xFFEE811B), - ), - activeStyle: TDButtonStyle( - textColor: Colors.white, - backgroundColor: Color(0xC3EE811B), + bottomNavigationBar: SafeArea( + child: Container( + height: 60, + padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 20.w), + child: TDButton( + text: controller.button.value, + width: MediaQuery.of(context).size.width - 40, + size: TDButtonSize.large, + type: TDButtonType.fill, + shape: TDButtonShape.round, + style: TDButtonStyle( + textColor: Colors.white, + backgroundColor: Color(0xFF7562F9), + ), + activeStyle: TDButtonStyle( + textColor: Colors.white, + backgroundColor: Color(0xC37562F9), + ), + onTap: (){ + controller.submitOrder(); + }, ), - onTap: (){ - controller.submitOrder(); - }, - ), - ) + ) + ), ) : null, ); }, @@ -125,9 +253,9 @@ class _PayItemState extends State { height: 160.h, margin: const EdgeInsets.only(right: 10), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.w)), - color: widget.active == widget.index ? const Color.fromRGBO(239, 19, 46, .05) : Colors.white, - border: widget.active == widget.index ? Border.all(width: 1, color: const Color(0xFFEE811B)) : Border.all(width: 1, color: const Color(0xFFEEEEEE)) + borderRadius: BorderRadius.all(Radius.circular(18.w)), + color: Colors.white, + border: widget.active == widget.index ? Border.all(width: 1, color: const Color(0xFF7562F9)) : Border.all(width: 1, color: const Color(0xFFEEEEEE)) ), child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -143,7 +271,7 @@ class _PayItemState extends State { "¥", style: TextStyle( fontSize: 16.w, - color: Color(0xFFEE811B), + color: Color(0xFF7562F9), fontWeight: FontWeight.bold ), ), @@ -153,7 +281,7 @@ class _PayItemState extends State { "${widget.item.unitSellingPrice}", style: TextStyle( fontSize: 26.w, - color: Color(0xFFEE811B), + color: Color(0xFF7562F9), fontWeight: FontWeight.bold ), ), @@ -161,12 +289,21 @@ class _PayItemState extends State { ), TDText("¥${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),), const SizedBox(height: 18), - Text( - "有效期:${widget.item.validityPeriodDays}天", - style: TextStyle( - fontSize: 14.w, - color: Color(0xFF333333), - fontWeight: FontWeight.bold + SizedBox( + height: 24, + child: widget.item.validityPeriodDays != null ? Text( + "有效期:${widget.item.validityPeriodDays}天", + style: TextStyle( + fontSize: 14.w, + color: Color(0xFF333333), + fontWeight: FontWeight.bold + ), + ) : Text('+10小时视频相亲', + style: TextStyle( + fontSize: 12.w, + color: Color(0xFF999999), + fontWeight: FontWeight.bold + ), ), ), ], @@ -176,13 +313,13 @@ class _PayItemState extends State { left: 0, top: 0, child: Container( - padding: EdgeInsets.symmetric(vertical: 2.w, horizontal: 6.w), + padding: EdgeInsets.symmetric(vertical: 4.w, horizontal: 12.w), decoration: BoxDecoration( borderRadius: BorderRadius.only( - topLeft: Radius.circular(6.w), - bottomRight: Radius.circular(6.w), + topLeft: Radius.circular(18.w), + bottomRight: Radius.circular(18.w), ), - color: widget.active == widget.index ? const Color(0xFFEE811B) : Color(0xFFCCCCCC) + color: widget.active == widget.index ? const Color(0xFF7562F9) : Color(0xFFCCCCCC) ), child: Center( child: Text(widget.item.productTitle!.replaceAll('加盟费', ''), style: TextStyle(fontSize: 12, color: Colors.white)),