You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

330 lines
13 KiB

import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/mine/withdraw_controller.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/bank_card_data.dart';
import 'package:dating_touchme_app/pages/mine/add_bankcard_page.dart';
import 'package:dating_touchme_app/pages/mine/withdraw_history_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class WithdrawPage extends StatelessWidget {
const WithdrawPage({super.key});
String maskKeepLast(String s, int keep) {
if (s.length <= keep) return s;
return '*' * (s.length - keep) + s.substring(s.length - keep);
}
@override
Widget build(BuildContext context) {
return GetX<WithdrawController>(
init: WithdrawController(),
builder: (controller){
return Scaffold(
appBar: PageAppbar(title: "提现"),
body: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsetsGeometry.symmetric(
horizontal: 16.w,
vertical: 19.w
),
margin: EdgeInsets.only(
bottom: 17.w
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"到账银行卡",
style: TextStyle(
fontSize: 12.w,
),
),
SizedBox(width: 24.w,),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if(controller.nowBankCard.value.id != null) Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${controller.nowBankCard.value.bankName}${controller.nowBankCard.value.cardNum!.substring(controller.nowBankCard.value.cardNum!.length - 4)}",
style: TextStyle(
fontSize: 13.w,
fontWeight: FontWeight.w500
),
),
SizedBox(height: 6.w,),
Text(
"1个工作日内到账",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(153, 153, 153, 1)
),
)
],
),
if(controller.nowBankCard.value.id == null) Text(
"点击选择银行卡",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(153, 153, 153, 1)
),
),
Icon(
Icons.keyboard_arrow_right,
size: 15.w,
color: const Color.fromRGBO(153, 153, 153, 1),
)
],
),
)
],
).onTap(() {
showModalBottomSheet(
context: Get.context!,
builder: (BuildContext context) {
return Obx(() {
return Container(
height: 357.w,
color: Colors.white,
child: Column(
children: [
Container(
height: 37.w,
color: const Color.fromRGBO(247, 247, 247, 1),
padding: EdgeInsetsGeometry.symmetric(
horizontal: 16.w
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"取消",
style: TextStyle(
fontSize: 14.w,
color: const Color.fromRGBO(153, 153, 153, 1)
),
).onTap((){
Navigator.pop(context);
}),
Text(
"选择到账银行卡",
style: TextStyle(
fontSize: 14.w,
fontWeight: FontWeight.w500
),
),
Text(
"取消",
style: TextStyle(
fontSize: 14.w,
color: const Color.fromRGBO(153, 153, 153, 0)
),
),
],
),
),
Expanded(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16.w),
child: Column(
children: [
...controller.bankCardList.map((e){
return cardItem(e, controller).onTap((){
controller.nowBankCard.value = e;
Get.back();
});
}),
addCard().onTap((){
Get.to(() => AddBankcardPage())?.then((e){
controller.getBankCard();
});
}),
],
),
),
),
)
],
),
);
});
}
);
}),
),
Container(
padding: EdgeInsetsGeometry.symmetric(
horizontal: 16.w
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"提现金额",
style: TextStyle(
fontSize: 12.w,
color: Colors.black
),
)
],
),
SizedBox(height: 12.w,),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"",
style: TextStyle(
fontSize: 24.w,
color: Colors.black,
fontWeight: FontWeight.w500
),
)
],
),
SizedBox(height: 16.w,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"可提现金额:${controller.money}",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(153, 153, 153, 1)
),
),
Text(
"提现记录",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(25, 114, 248, 1)
),
).onTap((){
Get.to(() => WithdrawHistoryPage());
})
],
)
],
),
)
],
),
),
);
},
);
}
Widget cardItem(BankCardData item, WithdrawController controller){
return Container(
padding: EdgeInsets.only(
bottom: 12.w
),
margin: EdgeInsets.only(
bottom: 20.w
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1,
color: const Color.fromRGBO(238, 238, 238, 1)
)
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row (
children: [
Image.asset(
Assets.imagesBankIcon,
width: 16.w,
),
SizedBox(width: 10.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${item.bankName}",
style: TextStyle(
fontSize: 14.w,
fontWeight: FontWeight.w500
),
),
Text(
"${maskKeepLast(item.cardNum ?? "", 4)}",
style: TextStyle(
fontSize: 14.w,
color: const Color.fromRGBO(153, 153, 153, 1)
),
),
],
)
],
),
if(item.id == controller.nowBankCard.value.id) Icon(
Icons.check,
size: 20.w,
color: const Color.fromRGBO(238, 129, 27, 1),
)
],
),
);
}
Widget addCard(){
return Container(
padding: EdgeInsets.only(
bottom: 12.w
),
margin: EdgeInsets.only(
bottom: 20.w
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1,
color: const Color.fromRGBO(238, 238, 238, 1)
)
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row (
children: [
Image.asset(
Assets.imagesBankcardIcon,
width: 16.w,
),
SizedBox(width: 10.w,),
Text(
"使用新卡提现",
style: TextStyle(
fontSize: 14.w,
fontWeight: FontWeight.w500
),
),
],
),
Icon(
Icons.keyboard_arrow_right,
size: 20.w,
color: const Color.fromRGBO(153, 153, 153, 1),
)
],
),
);
}
}