|
|
@ -1,17 +1,17 @@ |
|
|
import 'package:dating_touchme_app/controller/global.dart'; |
|
|
import 'package:dating_touchme_app/controller/global.dart'; |
|
|
import 'package:dating_touchme_app/model/mine/rose_data.dart'; |
|
|
|
|
|
|
|
|
import 'package:dating_touchme_app/model/mine/chat_static_data.dart'; |
|
|
|
|
|
import 'package:dating_touchme_app/model/mine/matchmaker_requirement_data.dart'; |
|
|
import 'package:dating_touchme_app/network/user_api.dart'; |
|
|
import 'package:dating_touchme_app/network/user_api.dart'; |
|
|
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'; |
|
|
|
|
|
|
|
|
class SpreadController extends GetxController with WidgetsBindingObserver { |
|
|
|
|
|
|
|
|
class SpreadController extends GetxController { |
|
|
|
|
|
|
|
|
// UserApi实例 |
|
|
// UserApi实例 |
|
|
late UserApi _userApi; |
|
|
late UserApi _userApi; |
|
|
final roseList = <RoseData>[].obs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final roseList = <MatchmakerRequirement>[].obs; |
|
|
|
|
|
final loading = true.obs; |
|
|
final roseNum = 0.obs; |
|
|
final roseNum = 0.obs; |
|
|
|
|
|
|
|
|
final payChecked = true.obs; |
|
|
final payChecked = true.obs; |
|
|
@ -20,8 +20,8 @@ class SpreadController extends GetxController with WidgetsBindingObserver { |
|
|
final enableIndex = (-1).obs; |
|
|
final enableIndex = (-1).obs; |
|
|
final Fluwx fluwx = Fluwx(); |
|
|
final Fluwx fluwx = Fluwx(); |
|
|
final matchmakerFlag = false.obs; |
|
|
final matchmakerFlag = false.obs; |
|
|
final button = '去相亲'.obs; |
|
|
|
|
|
bool canApply = false; |
|
|
|
|
|
|
|
|
final button = '立即申请'.obs; |
|
|
|
|
|
final canApply = false.obs; |
|
|
String paymentOrderId = ''; |
|
|
String paymentOrderId = ''; |
|
|
final revenue = [ |
|
|
final revenue = [ |
|
|
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'}, |
|
|
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'}, |
|
|
@ -29,48 +29,109 @@ class SpreadController extends GetxController with WidgetsBindingObserver { |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
].obs; |
|
|
].obs; |
|
|
|
|
|
final userData = GlobalData().userData.obs; |
|
|
|
|
|
final userId = GlobalData().userId.obs; |
|
|
|
|
|
|
|
|
|
|
|
final consumption = ChatStaticData().obs; |
|
|
|
|
|
// final nowBankCard = BankCardData().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 if(activePay.value == 0){ |
|
|
|
|
|
// button.value = '去直播'; |
|
|
|
|
|
// } else { |
|
|
|
|
|
// button.value = '立即续费'; |
|
|
|
|
|
// } |
|
|
|
|
|
// } else if(activePay.value == 0){ |
|
|
|
|
|
// button.value = canApply.value ? '免费加入' : '去相亲'; |
|
|
|
|
|
// } else { |
|
|
|
|
|
// button.value = '立即加入'; |
|
|
|
|
|
// } |
|
|
|
|
|
// // 实习红娘 |
|
|
|
|
|
// if(roseList[activePay.value].type == 88804){ |
|
|
|
|
|
// revenue.value = [ |
|
|
|
|
|
// {'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'}, |
|
|
|
|
|
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
|
|
|
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
|
|
|
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
|
|
|
// ]; |
|
|
|
|
|
// } else if(roseList[activePay.value].type == 88803){ |
|
|
|
|
|
// revenue.value = [ |
|
|
|
|
|
// {'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'}, |
|
|
|
|
|
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'}, |
|
|
|
|
|
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
|
|
|
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
|
|
|
// ]; |
|
|
|
|
|
// } else if(roseList[activePay.value].type == 88802){ |
|
|
|
|
|
// revenue.value = [ |
|
|
|
|
|
// {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'}, |
|
|
|
|
|
// // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
|
|
|
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
|
|
|
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
|
|
|
// ]; |
|
|
|
|
|
// } else if(roseList[activePay.value].type == 88801){ |
|
|
|
|
|
// revenue.value = [ |
|
|
|
|
|
// {'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'}, |
|
|
|
|
|
// // {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
|
|
|
// {'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
|
|
|
// {'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
|
|
|
// ]; |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// } |
|
|
|
|
|
// 倒计时秒数 |
|
|
|
|
|
final countdownSeconds = 0.obs; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void onInit() { |
|
|
|
|
|
super.onInit(); |
|
|
|
|
|
// WidgetsBinding.instance.addObserver(this); |
|
|
|
|
|
_userApi = Get.find<UserApi>(); |
|
|
|
|
|
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){ |
|
|
|
|
|
matchmakerFlag.value = true; |
|
|
|
|
|
} |
|
|
|
|
|
initDataList(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
changePayActive(int index){ |
|
|
changePayActive(int index){ |
|
|
if(index < enableIndex.value && enableIndex.value >= 0){ |
|
|
if(index < enableIndex.value && enableIndex.value >= 0){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
activePay.value = index; |
|
|
activePay.value = index; |
|
|
if(matchmakerFlag.value){ |
|
|
|
|
|
if(activePay.value > enableIndex.value){ |
|
|
|
|
|
button.value = '立即升级'; |
|
|
|
|
|
} else if(activePay.value == 0){ |
|
|
|
|
|
button.value = '去直播'; |
|
|
|
|
|
} else { |
|
|
|
|
|
button.value = '立即续费'; |
|
|
|
|
|
|
|
|
canApply.value = false; |
|
|
|
|
|
int hours = roseList[activePay.value].liveDurationHours!; |
|
|
|
|
|
int rose = roseList[activePay.value].liveConsumptionAmount!; |
|
|
|
|
|
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){ |
|
|
|
|
|
if(rose <= 0){ |
|
|
|
|
|
canApply.value = true; |
|
|
|
|
|
} else if(consumption.value.liveConsumptionAmount! >= rose){ |
|
|
|
|
|
canApply.value = true; |
|
|
} |
|
|
} |
|
|
} else if(activePay.value == 0){ |
|
|
|
|
|
button.value = canApply ? '免费加入' : '去相亲'; |
|
|
|
|
|
} else { |
|
|
|
|
|
button.value = '立即加入'; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
button.value = canApply.value ? '立即申请' : '条件不满足'; |
|
|
// 实习红娘 |
|
|
// 实习红娘 |
|
|
if(roseList[activePay.value].subCategory == 88804){ |
|
|
|
|
|
|
|
|
if(roseList[activePay.value].type == 1){ |
|
|
revenue.value = [ |
|
|
revenue.value = [ |
|
|
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'}, |
|
|
{'icon': '1', 'desc': '礼物收益范围15%-30%,嘉宾消费的分成3%;'}, |
|
|
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
{'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
]; |
|
|
]; |
|
|
} else if(roseList[activePay.value].subCategory == 88803){ |
|
|
|
|
|
|
|
|
} else if(roseList[activePay.value].type == 2){ |
|
|
revenue.value = [ |
|
|
revenue.value = [ |
|
|
{'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'}, |
|
|
{'icon': '1', 'desc': '礼物收益范围30%-40%,嘉宾消费的分成6%;'}, |
|
|
{'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'}, |
|
|
{'icon': '2', 'desc': '每天前5人连麦的礼物收益30%,第6-10人连麦的礼物收益35%,第11人以上连麦的礼物收益40%;'}, |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
]; |
|
|
]; |
|
|
} else if(roseList[activePay.value].subCategory == 88802){ |
|
|
|
|
|
revenue.value = [ |
|
|
|
|
|
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'}, |
|
|
|
|
|
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
|
|
|
{'icon': '3', 'desc': '红娘推荐的嘉宾成为红娘,赚取入驻费的20%分成;'}, |
|
|
|
|
|
{'icon': '4', 'desc': '新徒弟首月收益的10%(平台奖励)'}, |
|
|
|
|
|
]; |
|
|
|
|
|
} else if(roseList[activePay.value].subCategory == 88801){ |
|
|
|
|
|
|
|
|
} else if(roseList[activePay.value].type == 3){ |
|
|
revenue.value = [ |
|
|
revenue.value = [ |
|
|
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'}, |
|
|
{'icon': '1', 'desc': '礼物收益范围40%,嘉宾消费的分成10%;'}, |
|
|
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
// {'icon': '2', 'desc': '每天前5人连麦的礼物收益15%,第6-10人连麦的礼物收益20%,第11-15人连麦的礼物收益25%,第16人以上连麦的礼物收益30%;'}, |
|
|
@ -80,85 +141,78 @@ class SpreadController extends GetxController with WidgetsBindingObserver { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 倒计时秒数 |
|
|
|
|
|
final countdownSeconds = 0.obs; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void onInit() { |
|
|
|
|
|
super.onInit(); |
|
|
|
|
|
WidgetsBinding.instance.addObserver(this); |
|
|
|
|
|
_userApi = Get.find<UserApi>(); |
|
|
|
|
|
if(GlobalData().userData!.matchmakerFlag != null && GlobalData().userData!.matchmakerFlag!){ |
|
|
|
|
|
matchmakerFlag.value = true; |
|
|
|
|
|
} |
|
|
|
|
|
initDataList(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
|
|
if(state == AppLifecycleState.resumed){ |
|
|
|
|
|
if (countdownSeconds.value > 0) { |
|
|
|
|
|
startCountdown(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// @override |
|
|
|
|
|
// void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
|
|
// if(state == AppLifecycleState.resumed){ |
|
|
|
|
|
// if (countdownSeconds.value > 0) { |
|
|
|
|
|
// startCountdown(); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
// 开始倒计时 |
|
|
// 开始倒计时 |
|
|
void startCountdown() async { |
|
|
|
|
|
try{ |
|
|
|
|
|
bool audit = false; |
|
|
|
|
|
if(matchmakerFlag.value){ |
|
|
|
|
|
// 如果是红娘,那么就要检测支付单是否支付成功, |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是不是红娘,那么就要检测用户是否变成了红娘, |
|
|
|
|
|
final response = await _userApi.getAuditMatchmaker(); |
|
|
|
|
|
if (response.data.isSuccess && response.data.data != null) { |
|
|
|
|
|
audit = response.data.data['needAudit']; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(audit){ |
|
|
|
|
|
Future.delayed(const Duration(milliseconds: 300), () { |
|
|
|
|
|
if (countdownSeconds.value > 0) { |
|
|
|
|
|
countdownSeconds.value--; |
|
|
|
|
|
startCountdown(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
countdownSeconds.value = 0; |
|
|
|
|
|
GlobalData().userData!.matchmakerFlag = true; |
|
|
|
|
|
GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory; |
|
|
|
|
|
Get.back(result: 1); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
print('87$e'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// void startCountdown() async { |
|
|
|
|
|
// try{ |
|
|
|
|
|
// bool audit = false; |
|
|
|
|
|
// if(matchmakerFlag.value){ |
|
|
|
|
|
// // 如果是红娘,那么就要检测支付单是否支付成功, |
|
|
|
|
|
// |
|
|
|
|
|
// } else { |
|
|
|
|
|
// // 如果是不是红娘,那么就要检测用户是否变成了红娘, |
|
|
|
|
|
// final response = await _userApi.getAuditMatchmaker(); |
|
|
|
|
|
// if (response.data.isSuccess && response.data.data != null) { |
|
|
|
|
|
// audit = response.data.data['needAudit']; |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// if(audit){ |
|
|
|
|
|
// Future.delayed(const Duration(milliseconds: 300), () { |
|
|
|
|
|
// if (countdownSeconds.value > 0) { |
|
|
|
|
|
// countdownSeconds.value--; |
|
|
|
|
|
// startCountdown(); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// countdownSeconds.value = 0; |
|
|
|
|
|
// GlobalData().userData!.matchmakerFlag = true; |
|
|
|
|
|
// GlobalData().userData!.matchmakerType = roseList[activePay.value].type; |
|
|
|
|
|
// Get.back(result: 1); |
|
|
|
|
|
// } |
|
|
|
|
|
// } catch (e) { |
|
|
|
|
|
// print('87$e'); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
void onClose() { |
|
|
void onClose() { |
|
|
WidgetsBinding.instance.removeObserver(this); |
|
|
|
|
|
|
|
|
// WidgetsBinding.instance.removeObserver(this); |
|
|
super.onClose(); |
|
|
super.onClose(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
initDataList() async { |
|
|
initDataList() async { |
|
|
try{ |
|
|
try{ |
|
|
final result = await _userApi.getMatchmakerFee(); |
|
|
|
|
|
|
|
|
loading.value = true; |
|
|
|
|
|
final result = await _userApi.getMatchmakerRequirement(); |
|
|
if (result.data.isSuccess && result.data.data != null) { |
|
|
if (result.data.isSuccess && result.data.data != null) { |
|
|
roseList.value = result.data.data!.records; |
|
|
|
|
|
|
|
|
roseList.value = result.data.data!; |
|
|
} |
|
|
} |
|
|
final response = await _userApi.getChatStaticsInfo(); |
|
|
final response = await _userApi.getChatStaticsInfo(); |
|
|
if (response.data.isSuccess && response.data.data != null) { |
|
|
if (response.data.isSuccess && response.data.data != null) { |
|
|
final data = response.data.data!; |
|
|
|
|
|
|
|
|
consumption.value = response.data.data!; |
|
|
if(roseList[activePay.value].liveDurationHours != null){ |
|
|
if(roseList[activePay.value].liveDurationHours != null){ |
|
|
int hours = int.parse(roseList[activePay.value].liveDurationHours!); |
|
|
|
|
|
if(hours > 0 && data.liveDurationMins >= 60 * hours && !matchmakerFlag.value){ |
|
|
|
|
|
canApply = true; |
|
|
|
|
|
|
|
|
int hours = roseList[activePay.value].liveDurationHours!; |
|
|
|
|
|
int rose = roseList[activePay.value].liveConsumptionAmount!; |
|
|
|
|
|
if(hours > 0 && consumption.value.liveDurationMins! >= 60 * hours){ |
|
|
|
|
|
if(rose <= 0){ |
|
|
|
|
|
canApply.value = true; |
|
|
|
|
|
} else if(consumption.value.liveConsumptionAmount! >= rose){ |
|
|
|
|
|
canApply.value = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(matchmakerFlag.value){ |
|
|
if(matchmakerFlag.value){ |
|
|
final index = roseList.indexWhere((item) => item.subCategory == GlobalData().userData!.matchmakerType!); |
|
|
|
|
|
|
|
|
final index = roseList.indexWhere((item) => item.type == GlobalData().userData!.matchmakerType!); |
|
|
enableIndex.value = index >= 0 ? index : 0; |
|
|
enableIndex.value = index >= 0 ? index : 0; |
|
|
changePayActive(enableIndex.value); |
|
|
changePayActive(enableIndex.value); |
|
|
} else { |
|
|
} else { |
|
|
@ -166,57 +220,26 @@ class SpreadController extends GetxController with WidgetsBindingObserver { |
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
print('spread: $e'); |
|
|
print('spread: $e'); |
|
|
|
|
|
} finally { |
|
|
|
|
|
loading.value = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
submitOrder() async { |
|
|
submitOrder() async { |
|
|
if(activePay.value == 0 && !canApply){ |
|
|
|
|
|
Get.back(); |
|
|
|
|
|
|
|
|
if(!canApply.value){ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
try { |
|
|
try { |
|
|
var matchmakerOrderType = 1; |
|
|
|
|
|
var matchmakerType = roseList[activePay.value].subCategory; |
|
|
|
|
|
if(GlobalData().userData!.matchmakerFlag!){ |
|
|
|
|
|
if(matchmakerType != GlobalData().userData!.matchmakerType){ |
|
|
|
|
|
matchmakerOrderType = 2; |
|
|
|
|
|
} else { |
|
|
|
|
|
matchmakerOrderType = 3; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
await _userApi.applyMatchmaker({ |
|
|
|
|
|
"phone": GlobalData().userData!.phone, |
|
|
|
|
|
"name": GlobalData().userData!.name |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
final response = await _userApi.submitMatchmakerOrder({ |
|
|
|
|
|
"productSpecId": roseList[activePay.value].productSpecId, |
|
|
|
|
|
"matchmakerOrderType": matchmakerOrderType |
|
|
|
|
|
|
|
|
final response = await _userApi.applyLiveMatchmaker({ |
|
|
|
|
|
"behavior": GlobalData().userData!.matchmakerFlag! ? 2 : 1, |
|
|
|
|
|
"type": roseList[activePay.value].type |
|
|
}); |
|
|
}); |
|
|
if (response.data.isSuccess && response.data.data != null) { |
|
|
|
|
|
final data = response.data.data; |
|
|
|
|
|
|
|
|
|
|
|
if(data!.freeSettlement!){ |
|
|
|
|
|
SmartDialog.showToast('加入成功'); |
|
|
|
|
|
GlobalData().userData!.matchmakerFlag = true; |
|
|
|
|
|
GlobalData().userData!.matchmakerType = roseList[activePay.value].subCategory; |
|
|
|
|
|
Get.back(result: 1); |
|
|
|
|
|
} else { |
|
|
|
|
|
paymentOrderId = data.paymentOrderId!; |
|
|
|
|
|
fluwx.open(target: MiniProgram( |
|
|
|
|
|
username: 'gh_9ea8d46add6f', |
|
|
|
|
|
path: "pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data.paymentOrderId}&url=match-fee", |
|
|
|
|
|
miniProgramType: WXMiniProgramType.preview |
|
|
|
|
|
)); |
|
|
|
|
|
countdownSeconds.value = 3; |
|
|
|
|
|
SmartDialog.showToast('开始支付'); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 响应失败,抛出异常 |
|
|
|
|
|
SmartDialog.showToast(response.data.message ?? '网络异常'); |
|
|
|
|
|
|
|
|
if (response.data.isSuccess) { |
|
|
|
|
|
SmartDialog.showToast('申请成功,请等待审核'); |
|
|
|
|
|
Get.back(); |
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
SmartDialog.showToast('下单失败'); |
|
|
|
|
|
|
|
|
SmartDialog.showToast('申请失败'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|