From 3f1dd6b0b02143c013a128380a504c5139f2bbce Mon Sep 17 00:00:00 2001 From: ZHR007 Date: Wed, 26 Nov 2025 16:59:34 +0800 Subject: [PATCH] no message --- lib/components/page_appbar.dart | 2 +- lib/controller/mine/league_controller.dart | 9 +- lib/controller/setting/spread_controller.dart | 84 ++++++++ lib/model/mine/rose_data.dart | 7 +- lib/network/api_urls.dart | 2 + lib/network/user_api.dart | 3 + lib/network/user_api.g.dart | 38 ++++ lib/pages/setting/match_league_page.dart | 2 +- lib/pages/setting/match_spread_page.dart | 197 ++++++++++++++++++ 9 files changed, 337 insertions(+), 7 deletions(-) create mode 100644 lib/controller/setting/spread_controller.dart create mode 100644 lib/pages/setting/match_spread_page.dart diff --git a/lib/components/page_appbar.dart b/lib/components/page_appbar.dart index 68dd6a7..ef87634 100644 --- a/lib/components/page_appbar.dart +++ b/lib/components/page_appbar.dart @@ -21,7 +21,7 @@ class PageAppbar extends StatelessWidget implements PreferredSizeWidget { title: Text( title, style: TextStyle( - fontSize: 16, + fontSize: 18, fontWeight: FontWeight.bold, color: const Color.fromRGBO(51, 51, 51, 1) ), diff --git a/lib/controller/mine/league_controller.dart b/lib/controller/mine/league_controller.dart index ecadc9c..0e2d782 100644 --- a/lib/controller/mine/league_controller.dart +++ b/lib/controller/mine/league_controller.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:get/get.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import '../../network/user_api.dart'; +import '../../pages/setting/match_spread_page.dart'; import '../global.dart'; class LeagueController extends GetxController { @@ -74,12 +75,13 @@ class LeagueController extends GetxController { }); } - Future changePhone() async { + Future submitInfo() async { if(isSendingCode.value){ return; } if (phoneNumber.value.isEmpty) { SmartDialog.showToast('请输入手机号'); + Get.off(() => MatchSpreadPage()); return; } if (verificationCode.value.isEmpty) { @@ -94,9 +96,8 @@ class LeagueController extends GetxController { final response = await _userApi.updatePhone(param); // 处理响应 if (response.data.isSuccess) { - GlobalData().userData!.phone = phoneNumber.value; - SmartDialog.showToast('更换成功'); - Get.back(result: 1); + SmartDialog.showToast('提交成功'); + Get.off(() => MatchSpreadPage()); } else { SmartDialog.showToast(response.data.message); } diff --git a/lib/controller/setting/spread_controller.dart b/lib/controller/setting/spread_controller.dart new file mode 100644 index 0000000..d85aeea --- /dev/null +++ b/lib/controller/setting/spread_controller.dart @@ -0,0 +1,84 @@ +import 'package:dating_touchme_app/model/mine/rose_data.dart'; +import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:fluwx/fluwx.dart'; +import 'package:get/get.dart'; + +class SpreadController extends GetxController { + + // UserApi实例 + late UserApi _userApi; + final roseList = [].obs; + + final roseNum = 0.obs; + + final payChecked = true.obs; + + final activePay = 0.obs; + + final Fluwx fluwx = Fluwx(); + + changePayActive(int index){ + activePay.value = index; + } + + List list2 = [ + {'title': '邀请注册', 'unit': '10%', 'desc': '分佣', 'enable': 1, 'value': 111, 'icon': 'icon-right1'}, + {'title': '发布悬赏', 'unit': '10%', 'desc': '分佣', 'enable': 1, 'value': 112, 'icon': 'icon-right2'}, + {'title': '匹配悬赏', 'unit': '10%', 'desc': '分佣', 'enable': 0, 'value': 113, 'icon': 'icon-right41'}, + {'title': '推荐红娘', 'unit': '10%', 'desc': '分佣', 'enable': 1, 'value': 114, 'icon': 'icon-right3'}, + {'title': '免费升级', 'desc': '门店合伙人', 'enable': 0, 'value': 0, 'icon': 'icon-right51'}, + {'title': '资源共享', 'desc': '所有资料', 'enable': 1, 'value': 0, 'icon': 'icon-right6'}, + {'title': '业绩奖励', 'unit': '5%', 'desc': '奖励', 'enable': 1, 'value': 0, 'icon': 'icon-right71'}, + {'title': '次年续签', 'unit': '90%', 'desc': '减免', 'enable': 1, 'value': 0, 'icon': 'icon-right8'} + ].obs; + + @override + void onInit() { + super.onInit(); + _userApi = Get.find(); + getRoseList(); + } + + getRoseList() async { + try{ + final response = await _userApi.getMatchmakerFee(); + if (response.data.isSuccess && response.data.data != null) { + final data = response.data.data!.records; + roseList.addAll(data.toList()); + } + print('rose>>>${roseList.length}'); + } catch (e) { + print('玫瑰列表获取失败: $e'); + rethrow; + } + } + + submitOrder() async { + try { + final response = await _userApi.submitOrder({ + "productSpecId": roseList[activePay.value].productSpecId + }); + if (response.data.isSuccess && response.data.data != null) { + final data = response.data.data; + fluwx.open(target: MiniProgram( + username: 'gh_9ea8d46add6f', + path:"pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data!.paymentOrderId}&url=match-fee" + )); + + SmartDialog.showToast('开始支付'); + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch (e) { + print('玫瑰列表获取失败: $e'); + SmartDialog.showToast('下单失败'); + rethrow; + } + + + } + +} \ No newline at end of file diff --git a/lib/model/mine/rose_data.dart b/lib/model/mine/rose_data.dart index 3bae08c..0410a90 100644 --- a/lib/model/mine/rose_data.dart +++ b/lib/model/mine/rose_data.dart @@ -9,6 +9,7 @@ class RoseData { num? unitOriginalPrice; num? unitSellingPrice; String? purchaseTimeValue; + String? validityPeriodDays; RoseData( {this.productId, @@ -20,7 +21,9 @@ class RoseData { this.detailDesc, this.unitOriginalPrice, this.unitSellingPrice, - this.purchaseTimeValue}); + this.purchaseTimeValue, + this.validityPeriodDays + }); RoseData.fromJson(Map json) { productId = json['productId']; @@ -33,6 +36,7 @@ class RoseData { unitOriginalPrice = json['unitOriginalPrice']; unitSellingPrice = json['unitSellingPrice']; purchaseTimeValue = json['purchaseTimeValue']; + validityPeriodDays = json['validityPeriodDays']; } Map toJson() { @@ -47,6 +51,7 @@ class RoseData { data['unitOriginalPrice'] = this.unitOriginalPrice; data['unitSellingPrice'] = this.unitSellingPrice; data['purchaseTimeValue'] = this.purchaseTimeValue; + data['validityPeriodDays'] = this.validityPeriodDays; return data; } } diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index 5aefe9b..003242f 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -86,4 +86,6 @@ class ApiUrls { 'dating-agency-service/user/page/dongwo/marriage-information'; // 后续可以在此添加更多API端点 + static const String listMatchmakerProduct = + 'dating-agency-mall/user/page/product/by/matchmaker'; } diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index 2e29f99..2b986d5 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -185,4 +185,7 @@ abstract class UserApi { @Query('miId') required String miId, } ); + + @GET(ApiUrls.listMatchmakerProduct) + Future>>> getMatchmakerFee(); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index eefaa2e..d2bab25 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1129,6 +1129,44 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>>> + getMatchmakerFee() async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + const Map? _data = null; + final _options = + _setStreamType>>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-mall/user/page/product/by/matchmaker', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl), + ), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse> _value; + try { + _value = BaseResponse>.fromJson( + _result.data!, + (json) => PaginatedResponse.fromJson( + json as Map, + (json) => RoseData.fromJson(json as Map), + ), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/pages/setting/match_league_page.dart b/lib/pages/setting/match_league_page.dart index b9f7c77..bbc4a5d 100644 --- a/lib/pages/setting/match_league_page.dart +++ b/lib/pages/setting/match_league_page.dart @@ -107,7 +107,7 @@ class MatchLeaguePage extends StatelessWidget { backgroundColor: Color(0xC37562F9), ), onTap: (){ - // controller.startAuthing(); + controller.submitInfo(); }, ), ], diff --git a/lib/pages/setting/match_spread_page.dart b/lib/pages/setting/match_spread_page.dart new file mode 100644 index 0000000..ab39f08 --- /dev/null +++ b/lib/pages/setting/match_spread_page.dart @@ -0,0 +1,197 @@ +import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; +import 'package:dating_touchme_app/generated/assets.dart'; +import 'package:dating_touchme_app/model/mine/rose_data.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:tdesign_flutter/tdesign_flutter.dart'; + +import '../../controller/setting/spread_controller.dart'; + +class MatchSpreadPage extends StatelessWidget { + const MatchSpreadPage({super.key}); + + @override + Widget build(BuildContext context) { + 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( + children: [ + ...controller.roseList.asMap().entries.map((entry){ + return PayItem(item: entry.value, active: controller.activePay.value, index: entry.key, changeActive: controller.changePayActive); + }), + ], + ), + ), + SizedBox(height: 32.w), + Row( + children: [ + Text('红娘权益', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + ], + ), + SizedBox(height: 24.w,), + 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))), + ], + ) + ], + ), + ); + }), + ], + ), + ], + ), + ), + ), + bottomNavigationBar: 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), + ), + onTap: (){ + controller.submitOrder(); + }, + ), + ) + ), + ); + }, + ); + } +} + + +class PayItem extends StatefulWidget { + final RoseData item; + final int active; + final int index; + final void Function(int) changeActive; + const PayItem({super.key, required this.item, required this.active, required this.index, required this.changeActive, }); + + @override + State createState() => _PayItemState(); +} + +class _PayItemState extends State { + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + width: 124.w, + 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)) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const SizedBox(height: 32), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.only(bottom: 5), + child: Text( + "¥", + style: TextStyle( + fontSize: 16.w, + color: Color(0xFFEE811B), + fontWeight: FontWeight.bold + ), + ), + ), + const SizedBox(width: 2), + Text( + "${widget.item.unitSellingPrice}", + style: TextStyle( + fontSize: 26.w, + color: Color(0xFFEE811B), + fontWeight: FontWeight.bold + ), + ), + ], + ), + 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 + ), + ), + ], + ), + ), + Positioned( + left: 0, + top: 0, + child: Container( + padding: EdgeInsets.symmetric(vertical: 2.w, horizontal: 6.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6.w), + bottomRight: Radius.circular(6.w), + ), + color: widget.active == widget.index ? const Color(0xFFEE811B) : Color(0xFFCCCCCC) + ), + child: Center( + child: Text(widget.item.productTitle!.replaceAll('加盟费', ''), style: TextStyle(fontSize: 12, color: Colors.white)), + ), + ), + ) + ], + ).onTap((){ + widget.changeActive(widget.index); + }); + } +} \ No newline at end of file