Browse Source

no message

ios
ZHR007 4 months ago
parent
commit
80eee8b2ac
3 changed files with 256 additions and 88 deletions
  1. 31
      lib/controller/setting/spread_controller.dart
  2. 2
      lib/model/mine/user_data.dart
  3. 311
      lib/pages/setting/match_spread_page.dart

31
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:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
class SpreadController extends GetxController with WidgetsBindingObserver { class SpreadController extends GetxController with WidgetsBindingObserver {
@ -17,11 +18,27 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
final payChecked = true.obs; final payChecked = true.obs;
final activePay = 0.obs; final activePay = 0.obs;
final enableIndex = (-1).obs;
final Fluwx fluwx = Fluwx(); final Fluwx fluwx = Fluwx();
final matchmakerFlag = false.obs;
final button = '去相亲'.obs;
changePayActive(int index){ changePayActive(int index){
if(index < enableIndex.value && enableIndex.value >= 0){
return;
}
activePay.value = index; 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<Map> list2 = [ List<Map> list2 = [
@ -43,6 +60,9 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
super.onInit(); super.onInit();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
_userApi = Get.find<UserApi>(); _userApi = Get.find<UserApi>();
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){
matchmakerFlag.value = true;
}
getRoseList(); getRoseList();
} }
@ -91,6 +111,11 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
if (response.data.isSuccess && response.data.data != null) { if (response.data.isSuccess && response.data.data != null) {
final data = response.data.data!.records; final data = response.data.data!.records;
roseList.addAll(data.toList()); 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}'); print('rose>>>${roseList.length}');
} catch (e) { } catch (e) {
@ -100,6 +125,10 @@ class SpreadController extends GetxController with WidgetsBindingObserver {
} }
submitOrder() async { submitOrder() async {
if(activePay.value == 0){
Get.back();
return;
}
try { try {
final response = await _userApi.submitOrder({ final response = await _userApi.submitOrder({
"productSpecId": roseList[activePay.value].productSpecId "productSpecId": roseList[activePay.value].productSpecId

2
lib/model/mine/user_data.dart

@ -65,6 +65,7 @@ class UserData {
String? phone; String? phone;
String? realName; String? realName;
bool? matchmakerFlag; bool? matchmakerFlag;
int? matchmakerType;
List<PhotoItem>? photoList; List<PhotoItem>? photoList;
UserData({ UserData({
@ -132,6 +133,7 @@ class UserData {
this.realName, this.realName,
this.matchmakerFlag, this.matchmakerFlag,
this.photoList, this.photoList,
this.matchmakerType
}); });
// JSON映射创建实例 // JSON映射创建实例

311
lib/pages/setting/match_spread_page.dart

@ -17,85 +17,213 @@ class MatchSpreadPage extends StatelessWidget {
return GetX<SpreadController>( return GetX<SpreadController>(
init: SpreadController(), init: SpreadController(),
builder: (controller){ 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: [ 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, ) : null,
); );
}, },
@ -125,9 +253,9 @@ class _PayItemState extends State<PayItem> {
height: 160.h, height: 160.h,
margin: const EdgeInsets.only(right: 10), margin: const EdgeInsets.only(right: 10),
decoration: BoxDecoration( 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( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -143,7 +271,7 @@ class _PayItemState extends State<PayItem> {
"¥", "¥",
style: TextStyle( style: TextStyle(
fontSize: 16.w, fontSize: 16.w,
color: Color(0xFFEE811B),
color: Color(0xFF7562F9),
fontWeight: FontWeight.bold fontWeight: FontWeight.bold
), ),
), ),
@ -153,7 +281,7 @@ class _PayItemState extends State<PayItem> {
"${widget.item.unitSellingPrice}", "${widget.item.unitSellingPrice}",
style: TextStyle( style: TextStyle(
fontSize: 26.w, fontSize: 26.w,
color: Color(0xFFEE811B),
color: Color(0xFF7562F9),
fontWeight: FontWeight.bold fontWeight: FontWeight.bold
), ),
), ),
@ -161,12 +289,21 @@ class _PayItemState extends State<PayItem> {
), ),
TDText("${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),), TDText("${widget.item.unitOriginalPrice}", isTextThrough: true, style: TextStyle(color: Color(0xFFCCCCCC)),),
const SizedBox(height: 18), 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<PayItem> {
left: 0, left: 0,
top: 0, top: 0,
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 2.w, horizontal: 6.w),
padding: EdgeInsets.symmetric(vertical: 4.w, horizontal: 12.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( 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: Center(
child: Text(widget.item.productTitle!.replaceAll('加盟费', ''), style: TextStyle(fontSize: 12, color: Colors.white)), child: Text(widget.item.productTitle!.replaceAll('加盟费', ''), style: TextStyle(fontSize: 12, color: Colors.white)),

Loading…
Cancel
Save