parent
274f77ecb8
commit
d9d3eaf202
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,37 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
part 'trade_record_list_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class TradeRecordListModel extends Equatable {
|
||||
final int id;
|
||||
final int type;
|
||||
final String content;
|
||||
final double payAmount;
|
||||
final String createName;
|
||||
final String createDate;
|
||||
|
||||
factory TradeRecordListModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$TradeRecordListModelFromJson(json);
|
||||
|
||||
|
||||
const TradeRecordListModel({
|
||||
required this.id,
|
||||
required this.type,
|
||||
required this.content,
|
||||
required this.payAmount,
|
||||
required this.createName,
|
||||
required this.createDate,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
type,
|
||||
content,
|
||||
payAmount,
|
||||
createName,
|
||||
createDate,
|
||||
];
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'trade_record_list_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
TradeRecordListModel _$TradeRecordListModelFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
TradeRecordListModel(
|
||||
id: json['id'] as int,
|
||||
type: json['type'] as int,
|
||||
content: json['content'] as String,
|
||||
payAmount: (json['payAmount'] as num).toDouble(),
|
||||
createName: json['createName'] as String,
|
||||
createDate: json['createDate'] as String,
|
||||
);
|
@ -0,0 +1,210 @@
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/models/wallet/trade_record_list_model.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class BalanceRecordView extends StatefulWidget {
|
||||
const BalanceRecordView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BalanceRecordViewState createState() => _BalanceRecordViewState();
|
||||
}
|
||||
|
||||
class _BalanceRecordViewState extends State<BalanceRecordView> {
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
|
||||
List<TradeRecordListModel> _models = [];
|
||||
int _pageNum = 1;
|
||||
int _size = 10;
|
||||
DateTime _pickTime = DateTime.now();
|
||||
int _pickType = 0;
|
||||
|
||||
Map<int, String> _types = {
|
||||
1: '支付',
|
||||
2: '退还',
|
||||
3: '充值',
|
||||
4: '收入',
|
||||
5: '提现',
|
||||
6: '抵扣',
|
||||
};
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var date = await BeeDatePicker.monthPicker(
|
||||
DateTime.now().subtract(Duration(days: 365)));
|
||||
if (date != null) {
|
||||
_pickTime = date;
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
'${_pickTime.year}年${_pickTime.month}月'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 32.w,
|
||||
color: Colors.black.withOpacity(0.45),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
MaterialButton(
|
||||
color: Colors.black.withOpacity(0.06),
|
||||
onPressed: () async {
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return BeePickerBox(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
setState(() {});
|
||||
},
|
||||
child: CupertinoPicker.builder(
|
||||
itemExtent: 60.w,
|
||||
childCount: _types.values.length,
|
||||
onSelectedItemChanged: (index) {
|
||||
_pickType = _types.keys.toList()[index];
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
var str = _types.values.toList()[index];
|
||||
return Center(
|
||||
child: str.text.size(32.sp).isIntrinsic.make(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
shape: StadiumBorder(),
|
||||
elevation: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
'${_pickType == 0 ? '全部类型' : _types[_pickType]}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 24.w,
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
footer: MaterialFooter(),
|
||||
firstRefresh: true,
|
||||
controller: _refreshController,
|
||||
onRefresh: () async {
|
||||
_pageNum = 1;
|
||||
var baseList = await NetUtil()
|
||||
.getList(SAASAPI.balance.tradeRecordList, params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'modelType': 0,
|
||||
'type': _pickType,
|
||||
'createDate': _pickTime,
|
||||
});
|
||||
|
||||
_models = baseList.rows
|
||||
.map((e) => TradeRecordListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
onLoad: () async {
|
||||
_pageNum++;
|
||||
var baseList = await NetUtil()
|
||||
.getList(SAASAPI.balance.tradeRecordList, params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'modelType': 0,
|
||||
'type': _pickType,
|
||||
'createDate': _pickTime,
|
||||
});
|
||||
if (baseList.total > _models.length) {
|
||||
_models.addAll(baseList.rows
|
||||
.map((e) => TradeRecordListModel.fromJson(e))
|
||||
.toList());
|
||||
} else {
|
||||
_refreshController.finishLoad(noMore: true);
|
||||
}
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
||||
children: _models.map((e) => _buildCard(e)).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
bool incom(type) => [2, 3, 4].contains(type);
|
||||
|
||||
Widget _buildCard(TradeRecordListModel model) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'${_types[model.type]}-${model.content}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
Spacer(),
|
||||
'${incom(model.type) ? '+' : '-'}¥${model.payAmount}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(incom(model.type)
|
||||
? Colors.red
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
8.hb,
|
||||
'${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sms_autofill/sms_autofill.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class InputPayPasswordDialog extends StatefulWidget {
|
||||
final int balance;
|
||||
|
||||
const InputPayPasswordDialog({
|
||||
Key? key,
|
||||
required this.balance,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_InputPayPasswordDialogState createState() => _InputPayPasswordDialogState();
|
||||
}
|
||||
|
||||
class _InputPayPasswordDialogState extends State<InputPayPasswordDialog> {
|
||||
String? _currentCode;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 300.w),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(24.w),
|
||||
child: Container(
|
||||
width: 630.w,
|
||||
height: 480.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
|
||||
child: Column(
|
||||
children: [
|
||||
96.hb,
|
||||
'请输入您的支付密码'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.bold
|
||||
.make(),
|
||||
40.hb,
|
||||
'支付密码仅用于对钱包余额支付时确认'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
PinFieldAutoFill(
|
||||
autoFocus: true,
|
||||
currentCode: _currentCode,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
codeLength: 6,
|
||||
onCodeChanged: (code) async {
|
||||
if ((code?.length ?? 0) >= 6) {
|
||||
Get.back();
|
||||
var base = await NetUtil()
|
||||
.post(SAASAPI.balance.buyPointsByBalance, params: {
|
||||
'balance': widget.balance,
|
||||
'balancePayPwd': code
|
||||
});
|
||||
Get.back();
|
||||
if (!base.success) {
|
||||
BotToast.showText(text: base.msg);
|
||||
}
|
||||
}
|
||||
_currentCode = code;
|
||||
},
|
||||
decoration: UnderlineDecoration(
|
||||
colorBuilder: FixedColorListBuilder([
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
])),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,240 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/gen/assets.gen.dart';
|
||||
import 'package:aku_new_community/pages/life_pay/pay_util.dart';
|
||||
import 'package:aku_new_community/pages/personal/wallet/input_pay_password_dialog.dart';
|
||||
import 'package:aku_new_community/pages/personal/wallet/set_pay_password_dialog.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/buttons/bee_check_radio.dart';
|
||||
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
|
||||
import 'package:aku_new_community/widget/others/user_tool.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class PayWayDialog extends StatefulWidget {
|
||||
final bool isBalance;
|
||||
final int amount;
|
||||
final bool insufficientBalance;
|
||||
|
||||
const PayWayDialog(
|
||||
{Key? key,
|
||||
required this.isBalance,
|
||||
required this.amount,
|
||||
required this.insufficientBalance})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_PayWayDialogState createState() => _PayWayDialogState();
|
||||
}
|
||||
|
||||
class _PayWayDialogState extends State<PayWayDialog> {
|
||||
List<int> _payType = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget.isBalance) {
|
||||
_payType.add(1);
|
||||
} else {
|
||||
if (widget.insufficientBalance) {
|
||||
_payType.add(1);
|
||||
} else {
|
||||
_payType.add(0);
|
||||
}
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var wallet = GestureDetector(
|
||||
onTap: () {
|
||||
if (widget.insufficientBalance) {
|
||||
return;
|
||||
}
|
||||
_payType.clear();
|
||||
_payType.add(0);
|
||||
setState(() {});
|
||||
},
|
||||
child: ClipRect(
|
||||
child: Stack(
|
||||
children: [
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
Assets.newIcon.walletBalance.image(width: 48.w, height: 48.w),
|
||||
8.wb,
|
||||
'钱包余额'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
16.wb,
|
||||
Visibility(
|
||||
visible: widget.insufficientBalance,
|
||||
child:
|
||||
'钱包余额不足'.text.size(24.sp).color(Colors.red).make()),
|
||||
Spacer(),
|
||||
BeeCheckRadio(
|
||||
groupValue: _payType,
|
||||
value: 0,
|
||||
size: 36.w,
|
||||
indent: Icon(
|
||||
CupertinoIcons.checkmark_alt,
|
||||
color: Colors.black,
|
||||
size: 28.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: widget.insufficientBalance ? 1 : 0,
|
||||
sigmaY: widget.insufficientBalance ? 1 : 0),
|
||||
child: Container(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
var alipay = GestureDetector(
|
||||
onTap: () {
|
||||
_payType.clear();
|
||||
_payType.add(1);
|
||||
setState(() {});
|
||||
},
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
Assets.newIcon.alipay.image(width: 48.w, height: 48.w),
|
||||
8.wb,
|
||||
'支付宝'.text.size(28.sp).color(Colors.black.withOpacity(0.85)).make(),
|
||||
Spacer(),
|
||||
BeeCheckRadio(
|
||||
groupValue: _payType,
|
||||
value: 1,
|
||||
size: 36.w,
|
||||
indent: Icon(
|
||||
CupertinoIcons.checkmark_alt,
|
||||
color: Colors.black,
|
||||
size: 28.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
'支付'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.bold
|
||||
.isIntrinsic
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
48.hb,
|
||||
Column(
|
||||
children: [
|
||||
'¥'
|
||||
.richText
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.size(26.sp)
|
||||
.withTextSpanChildren([
|
||||
widget.amount
|
||||
.toString()
|
||||
.textSpan
|
||||
.size(40.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
]).make(),
|
||||
Offstage(
|
||||
offstage: widget.isBalance,
|
||||
child: '总共购买${widget.amount * 10}积分'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
),
|
||||
60.hb,
|
||||
Offstage(
|
||||
offstage: widget.isBalance,
|
||||
child: Column(
|
||||
children: [
|
||||
wallet,
|
||||
40.hb,
|
||||
],
|
||||
),
|
||||
),
|
||||
alipay,
|
||||
80.hb,
|
||||
BeeLongButton(
|
||||
width: double.infinity,
|
||||
onPressed: () async {
|
||||
if (_payType.contains(0)) {
|
||||
if (!UserTool
|
||||
.userProvider.userInfoModel!.isBalancePayPwd) {
|
||||
Get.dialog(SetPayPasswordDialog());
|
||||
} else {
|
||||
Get.back();
|
||||
Get.dialog(
|
||||
InputPayPasswordDialog(balance: widget.amount));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_payType.contains(1)) {
|
||||
var cancel = BotToast.showLoading();
|
||||
await _alipayFuc();
|
||||
cancel();
|
||||
Get.back();
|
||||
return;
|
||||
}
|
||||
},
|
||||
text: '确认支付${widget.amount}元'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future _alipayFuc() async {
|
||||
if (widget.isBalance) {
|
||||
var base = await NetUtil().post(SAASAPI.pay.createBalanceOrder, params: {
|
||||
'balance': widget.amount,
|
||||
});
|
||||
if (base.success) {
|
||||
var re = await PayUtil()
|
||||
.callAliPay(base.data, SAASAPI.pay.balanceOrderCheckAlipay);
|
||||
} else {
|
||||
BotToast.showText(text: base.msg);
|
||||
}
|
||||
} else {
|
||||
var base = await NetUtil().post(SAASAPI.pay.createPointsOrder, params: {
|
||||
'payAmount': widget.amount,
|
||||
});
|
||||
if (base.success) {
|
||||
var re = await PayUtil()
|
||||
.callAliPay(base.data, SAASAPI.pay.pointsOrderCheckAlipay);
|
||||
} else {
|
||||
BotToast.showText(text: base.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/models/wallet/trade_record_list_model.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class PointRecordView extends StatefulWidget {
|
||||
const PointRecordView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PointRecordViewState createState() => _PointRecordViewState();
|
||||
}
|
||||
|
||||
class _PointRecordViewState extends State<PointRecordView> {
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
|
||||
List<TradeRecordListModel> _models = [];
|
||||
int _pageNum = 1;
|
||||
int _size = 10;
|
||||
DateTime _pickTime = DateTime.now();
|
||||
int _pickType = 0;
|
||||
|
||||
Map<int, String> _types = {
|
||||
1: '支付',
|
||||
2: '退还',
|
||||
3: '充值',
|
||||
4: '收入',
|
||||
5: '提现',
|
||||
6: '抵扣',
|
||||
};
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var date = await BeeDatePicker.monthPicker(
|
||||
DateTime.now().subtract(Duration(days: 365)));
|
||||
if (date != null) {
|
||||
_pickTime = date;
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
'${_pickTime.year}年${_pickTime.month}月'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 32.w,
|
||||
color: Colors.black.withOpacity(0.45),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
MaterialButton(
|
||||
color: Colors.black.withOpacity(0.06),
|
||||
onPressed: () async {
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return BeePickerBox(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
setState(() {});
|
||||
},
|
||||
child: CupertinoPicker.builder(
|
||||
itemExtent: 60.w,
|
||||
childCount: _types.values.length,
|
||||
onSelectedItemChanged: (index) {
|
||||
_pickType = _types.keys.toList()[index];
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
var str = _types.values.toList()[index];
|
||||
return Center(
|
||||
child: str.text.size(32.sp).isIntrinsic.make(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
shape: StadiumBorder(),
|
||||
elevation: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
'${_pickType == 0 ? '全部类型' : _types[_pickType]}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 24.w,
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
footer: MaterialFooter(),
|
||||
firstRefresh: true,
|
||||
controller: _refreshController,
|
||||
onRefresh: () async {
|
||||
_pageNum = 1;
|
||||
var baseList = await NetUtil()
|
||||
.getList(SAASAPI.balance.tradeRecordList, params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'modelType': 1,
|
||||
'type': _pickType,
|
||||
'createDate': _pickTime,
|
||||
});
|
||||
|
||||
_models = baseList.rows
|
||||
.map((e) => TradeRecordListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
onLoad: () async {
|
||||
_pageNum++;
|
||||
var baseList = await NetUtil()
|
||||
.getList(SAASAPI.balance.tradeRecordList, params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'modelType': 0,
|
||||
'type': _pickType,
|
||||
'createDate': _pickTime,
|
||||
});
|
||||
if (baseList.total > _models.length) {
|
||||
_models.addAll(baseList.rows
|
||||
.map((e) => TradeRecordListModel.fromJson(e))
|
||||
.toList());
|
||||
} else {
|
||||
_refreshController.finishLoad(noMore: true);
|
||||
}
|
||||
},
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
||||
children: _models.map((e) => _buildCard(e)).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
bool incom(type) => [2, 3, 4].contains(type);
|
||||
|
||||
Widget _buildCard(TradeRecordListModel model) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'${_types[model.type]}-${model.content}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
Spacer(),
|
||||
'${incom(model.type) ? '+' : '-'}¥${model.payAmount}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(incom(model.type)
|
||||
? Colors.red
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
8.hb,
|
||||
'${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/pages/personal/wallet/set_pay_password_verify_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sms_autofill/sms_autofill.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class SetPayPasswordDialog extends StatefulWidget {
|
||||
const SetPayPasswordDialog({Key? key, }) : super(key: key);
|
||||
|
||||
@override
|
||||
_SetPayPasswordDialogState createState() => _SetPayPasswordDialogState();
|
||||
}
|
||||
|
||||
class _SetPayPasswordDialogState extends State<SetPayPasswordDialog> {
|
||||
String? _currentCode;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding:EdgeInsets.only(bottom: 300.w),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(24.w),
|
||||
child: Container(
|
||||
width: 630.w,
|
||||
height: 480.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
|
||||
child: Column(
|
||||
children: [
|
||||
96.hb,
|
||||
'请先设置支付密码'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.bold
|
||||
.make(),
|
||||
40.hb,
|
||||
'支付密码仅用于对钱包余额支付时确认'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
PinFieldAutoFill(
|
||||
autoFocus: true,
|
||||
currentCode: _currentCode,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
codeLength: 6,
|
||||
onCodeChanged: (code) async {
|
||||
if ((code?.length ?? 0) >= 6) {
|
||||
Get.back();
|
||||
Get.dialog(SetPayVerifyPasswordDialog(firstCode:code!,));
|
||||
}
|
||||
_currentCode = code;
|
||||
},
|
||||
decoration: UnderlineDecoration(
|
||||
colorBuilder: FixedColorListBuilder([
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
])),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/pages/personal/wallet/input_pay_password_dialog.dart';
|
||||
import 'package:aku_new_community/pages/sign/login/psd_verify.dart';
|
||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||
import 'package:aku_new_community/widget/others/user_tool.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sms_autofill/sms_autofill.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class SetPayVerifyPasswordDialog extends StatefulWidget {
|
||||
final String firstCode;
|
||||
|
||||
const SetPayVerifyPasswordDialog({Key? key, required this.firstCode})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_SetPayVerifyPasswordDialogState createState() =>
|
||||
_SetPayVerifyPasswordDialogState();
|
||||
}
|
||||
|
||||
class _SetPayVerifyPasswordDialogState
|
||||
extends State<SetPayVerifyPasswordDialog> {
|
||||
String _currentCode = '';
|
||||
|
||||
bool get checkVerify => widget.firstCode == _currentCode;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 300.w),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(24.w),
|
||||
child: Container(
|
||||
width: 630.w,
|
||||
height: 480.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||
decoration:
|
||||
BoxDecoration(borderRadius: BorderRadius.circular(24.w)),
|
||||
child: Column(
|
||||
children: [
|
||||
96.hb,
|
||||
'请再次输入支付密码'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.bold
|
||||
.make(),
|
||||
40.hb,
|
||||
'支付密码仅用于对钱包余额支付时确认'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
PinFieldAutoFill(
|
||||
autoFocus: true,
|
||||
currentCode: _currentCode,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
codeLength: 6,
|
||||
onCodeChanged: (code) async {
|
||||
_currentCode = code ?? '';
|
||||
if ((code?.length ?? 0) >= 6) {
|
||||
print(checkVerify);
|
||||
if (!checkVerify) {
|
||||
return;
|
||||
}
|
||||
var base = await NetUtil()
|
||||
.post(SAASAPI.balance.setBalancePayPsd, params: {
|
||||
'pwd': widget.firstCode,
|
||||
'rePwd': _currentCode,
|
||||
});
|
||||
if (base.success) {
|
||||
Get.back();
|
||||
UserTool.userProvider.updateUserInfo();
|
||||
} else {
|
||||
BotToast.showText(text: base.msg);
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
decoration: UnderlineDecoration(
|
||||
colorBuilder: FixedColorListBuilder([
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
Colors.black.withOpacity(0.3),
|
||||
])),
|
||||
),
|
||||
24.hb,
|
||||
Offstage(
|
||||
offstage: (_currentCode.isEmptyOrNull) || (checkVerify),
|
||||
child: Row(
|
||||
children: [
|
||||
'密码输入不一致'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.isIntrinsic
|
||||
.color(Colors.red)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,496 @@
|
||||
import 'package:aku_new_community/extensions/num_ext.dart';
|
||||
import 'package:aku_new_community/extensions/widget_list_ext.dart';
|
||||
import 'package:aku_new_community/gen/assets.gen.dart';
|
||||
import 'package:aku_new_community/pages/personal/wallet/pay_way_dialog.dart';
|
||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
|
||||
import 'package:aku_new_community/widget/others/user_tool.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:collection/src/iterable_extensions.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/src/size_extension.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/src/extensions/num_ext.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class WalletRechargePage extends StatefulWidget {
|
||||
final initIndex;
|
||||
|
||||
const WalletRechargePage({Key? key, this.initIndex = 0}) : super(key: key);
|
||||
|
||||
@override
|
||||
_WalletRechargePageState createState() => _WalletRechargePageState();
|
||||
}
|
||||
|
||||
class _WalletRechargePageState extends State<WalletRechargePage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
int _currentIndex = 0;
|
||||
int _currentSelect = 0;
|
||||
late TabController _tabController;
|
||||
List<String> _tabs = ['余额充值', '积分充值'];
|
||||
|
||||
List<int> _balanceValue = [10, 20, 30, 50, 00, 200, 300, 500];
|
||||
List<int> _pointValue = [10, 200, 300, 500, 1000, 2000, 5000, 10000];
|
||||
|
||||
int _rechargeValue = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_tabController =
|
||||
TabController(length: 2, vsync: this, initialIndex: widget.initIndex);
|
||||
_currentIndex = widget.initIndex;
|
||||
_rechargeValue = widget.initIndex == 0 ? _balanceValue[0] : _pointValue[0];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '钱包充值',
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: '账单'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
),
|
||||
],
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||
child: Row(
|
||||
children: [
|
||||
'余额:${UserTool.userProvider.userInfoModel!.balance ?? 0}'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
64.wb,
|
||||
'积分:'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
'${UserTool.userProvider.userInfoModel!.points ?? 0}'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
|
||||
decoration: BoxDecoration(color: Colors.white),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: _tabs
|
||||
.mapIndexed((index, element) => GestureDetector(
|
||||
onTap: () {
|
||||
_currentIndex = index;
|
||||
_tabController.animateTo(_currentIndex);
|
||||
setState(() {});
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
element.text
|
||||
.size(28.sp)
|
||||
.fontWeight(_currentIndex == index
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal)
|
||||
.color(Colors.black.withOpacity(
|
||||
_currentIndex == index ? 0.85 : 0.65))
|
||||
.make(),
|
||||
8.hb,
|
||||
AnimatedOpacity(
|
||||
duration: Duration(microseconds: 500),
|
||||
opacity: _currentIndex == index ? 1 : 0,
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 8.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius:
|
||||
BorderRadius.circular(4.w),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
.toList()
|
||||
.sepWidget(separate: 48.wb),
|
||||
),
|
||||
48.hb,
|
||||
Expanded(
|
||||
child: TabBarView(controller: _tabController, children: [
|
||||
_balanceView(),
|
||||
_pointView(),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavi: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32.w,
|
||||
right: 32.w,
|
||||
bottom: 32.w + MediaQuery.of(context).padding.bottom),
|
||||
child: BeeLongButton(
|
||||
onPressed: () async {
|
||||
if (_currentSelect == 9) {
|
||||
_rechargeValue = 0;
|
||||
Get.bottomSheet(_customValueDialog(_currentIndex == 0));
|
||||
} else {
|
||||
Get.bottomSheet(PayWayDialog(
|
||||
isBalance: _currentIndex == 0,
|
||||
amount: _rechargeValue,
|
||||
insufficientBalance: _rechargeValue >
|
||||
(UserTool.userProvider.userInfoModel!.balance ?? 0)));
|
||||
}
|
||||
},
|
||||
text: '下一步'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _balanceView() {
|
||||
return GridView.count(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 20.w,
|
||||
crossAxisSpacing: 20.w,
|
||||
children: [
|
||||
..._balanceValue
|
||||
.mapIndexed((index, e) => _card(index, e, true))
|
||||
.toList(),
|
||||
_customValueCard(9, true)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pointView() {
|
||||
return GridView.count(
|
||||
mainAxisSpacing: 20.w,
|
||||
crossAxisSpacing: 20.w,
|
||||
crossAxisCount: 3,
|
||||
children: [
|
||||
..._pointValue
|
||||
.mapIndexed((index, element) => _card(index, element, false))
|
||||
.toList(),
|
||||
_customValueCard(9, false)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _card(int index, int value, bool isBalance) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_currentSelect = index;
|
||||
_rechargeValue = isBalance ? _balanceValue[index] : (_pointValue[index]~/10);
|
||||
setState(() {});
|
||||
},
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
fit: StackFit.passthrough,
|
||||
children: [
|
||||
Container(
|
||||
width: 214.w,
|
||||
height: 202.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
color:
|
||||
_currentSelect != index ? Color(0xFFF9F9F9) : Colors.black,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Offstage(
|
||||
offstage: isBalance,
|
||||
child: Assets.icons.intergral
|
||||
.image(width: 48.w, height: 48.w)),
|
||||
8.hb,
|
||||
'$value '
|
||||
.richText
|
||||
.withTextSpanChildren([
|
||||
'${isBalance ? '元' : '积分'} '
|
||||
.textSpan
|
||||
.size(26.sp)
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
])
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.size(40.w)
|
||||
.make(),
|
||||
16.hb,
|
||||
Offstage(
|
||||
offstage: isBalance,
|
||||
child: '${value ~/ 10}元'
|
||||
.text
|
||||
.size(26.sp)
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AnimatedPositioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Offstage(
|
||||
offstage: _currentSelect != index,
|
||||
child: ClipPath(
|
||||
clipper: _TriangleClipPath(),
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 48.w,
|
||||
color: Color(0xFFFBE541),
|
||||
child: Transform.translate(
|
||||
offset: Offset(10.w, 12.w),
|
||||
child: Icon(
|
||||
CupertinoIcons.checkmark_alt,
|
||||
size: 24.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
duration: Duration(microseconds: 500))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customValueCard(int index, bool isBalance) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
_currentSelect = index;
|
||||
setState(() {});
|
||||
},
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
fit: StackFit.passthrough,
|
||||
children: [
|
||||
Container(
|
||||
width: 214.w,
|
||||
height: 202.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
color:
|
||||
_currentSelect != index ? Color(0xFFF9F9F9) : Colors.black,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Offstage(
|
||||
offstage: isBalance,
|
||||
child: Assets.icons.intergral
|
||||
.image(width: 48.w, height: 48.w)),
|
||||
8.hb,
|
||||
''
|
||||
.richText
|
||||
.withTextSpanChildren([
|
||||
'${isBalance ? '其他金额' : '其他积分'} '
|
||||
.textSpan
|
||||
.size(26.sp)
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
])
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.size(40.w)
|
||||
.make(),
|
||||
16.hb,
|
||||
Offstage(
|
||||
offstage: isBalance,
|
||||
child: '自定义'
|
||||
.text
|
||||
.size(26.sp)
|
||||
.color(_currentSelect == index
|
||||
? Color(0xFFFBE541)
|
||||
: Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AnimatedPositioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Offstage(
|
||||
offstage: _currentSelect != index,
|
||||
child: ClipPath(
|
||||
clipper: _TriangleClipPath(),
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 48.w,
|
||||
color: Color(0xFFFBE541),
|
||||
child: Transform.translate(
|
||||
offset: Offset(10.w, 12.w),
|
||||
child: Icon(
|
||||
CupertinoIcons.checkmark_alt,
|
||||
size: 24.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
duration: Duration(microseconds: 500))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customValueDialog(bool isBalance) {
|
||||
return StatefulBuilder(
|
||||
builder: (context, reSet) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
'${isBalance ? '充值金额' : '充值积分'}'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.bold
|
||||
.isIntrinsic
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
48.hb,
|
||||
Container(
|
||||
height: 88.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF5F5F5),
|
||||
borderRadius: BorderRadius.circular(16.w)),
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
child: Row(
|
||||
children: [
|
||||
24.wb,
|
||||
'¥'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
12.wb,
|
||||
Expanded(
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
onChanged: (text) {
|
||||
if (text.trim().isNotEmpty) {
|
||||
_rechargeValue = int.parse(text);
|
||||
reSet(() {});
|
||||
}
|
||||
},
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(border: InputBorder.none),
|
||||
)),
|
||||
Offstage(
|
||||
offstage: isBalance,
|
||||
child: Row(
|
||||
children: [
|
||||
Assets.icons.intergral
|
||||
.image(width: 32.w, height: 32.w),
|
||||
16.wb,
|
||||
(_rechargeValue * 10)
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.black.withOpacity(0.855))
|
||||
.make(),
|
||||
12.wb,
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (_rechargeValue == 0) {
|
||||
BotToast.showText(text: '金额不能为0');
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
Get.bottomSheet(PayWayDialog(
|
||||
insufficientBalance: (UserTool.userProvider
|
||||
.userInfoModel!.balance ??
|
||||
0) <
|
||||
_rechargeValue,
|
||||
isBalance: isBalance,
|
||||
amount: _rechargeValue));
|
||||
},
|
||||
child: Material(
|
||||
child: Container(
|
||||
width: 132.w,
|
||||
color: Color(0xFFFBE541),
|
||||
child: Center(
|
||||
child: '去支付'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.85))
|
||||
.make(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TriangleClipPath extends CustomClipper<Path> {
|
||||
@override
|
||||
Path getClip(Size size) {
|
||||
Path path = Path();
|
||||
path.moveTo(0, size.height);
|
||||
path.lineTo(size.width, size.height);
|
||||
path.lineTo(size.width, 0 + 5.w);
|
||||
path.lineTo(0, size.height);
|
||||
path.close();
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import 'package:aku_new_community/pages/personal/wallet/point_record_view.dart';
|
||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'balance_record_view.dart';
|
||||
|
||||
class WalletTradeRecordPage extends StatefulWidget {
|
||||
const WalletTradeRecordPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_WalletTradeRecordPageState createState() => _WalletTradeRecordPageState();
|
||||
}
|
||||
|
||||
class _WalletTradeRecordPageState extends State<WalletTradeRecordPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
List<String> _tabs = ['余额账单', '积分账单'];
|
||||
late TabController _tabController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_tabController = TabController(length: _tabs.length, vsync: this);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: BeeTabBar(
|
||||
controller: _tabController,
|
||||
tabs: _tabs,
|
||||
scrollable: true,
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
BalanceRecordView(),
|
||||
PointRecordView(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ClockTimerProvider extends ChangeNotifier{
|
||||
///登录页验证码计时器
|
||||
int second = 60;
|
||||
bool timerStart = false;
|
||||
Timer? timer;
|
||||
|
||||
void startTimer() {
|
||||
timerStart = true;
|
||||
timer = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||
if (second > 0) {
|
||||
second--;
|
||||
notifyListeners();
|
||||
} else {
|
||||
stopTimer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void stopTimer() {
|
||||
second = 60;
|
||||
timerStart = false;
|
||||
timer?.cancel();
|
||||
timer = null;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
import 'package:aku_new_community/saas_model/login/china_region_model.dart';
|
||||
import 'package:aku_new_community/saas_model/login/picked_city_model.dart';
|
||||
import 'package:aku_new_community/utils/hive_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
import 'bee_picker_box.dart';
|
||||
|
||||
class BeeMonthPickBody extends StatefulWidget {
|
||||
final DateTime initTime;
|
||||
|
||||
BeeMonthPickBody({Key? key, required this.initTime}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BeeMonthPickBodyState createState() => _BeeMonthPickBodyState();
|
||||
}
|
||||
|
||||
class _BeeMonthPickBodyState extends State<BeeMonthPickBody> {
|
||||
final FixedExtentScrollController _yearController =
|
||||
FixedExtentScrollController();
|
||||
final FixedExtentScrollController _monthController =
|
||||
FixedExtentScrollController();
|
||||
DateTime get _pickedTime => DateTime(_pickYear,_pickMonth) ;
|
||||
|
||||
List<int> get _years => List.generate(
|
||||
DateTime.now().year - widget.initTime.year+1,
|
||||
(index) => widget.initTime.year + index);
|
||||
late int _pickYear;
|
||||
late int _pickMonth;
|
||||
|
||||
List<int> get _months => List.generate(
|
||||
_pickYear == DateTime.now().year ? DateTime.now().month : 12,
|
||||
(index) => index + 1);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_pickYear = widget.initTime.year;
|
||||
_pickMonth = 1;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_yearController.dispose();
|
||||
_monthController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeePickerBox(
|
||||
onPressed: () {
|
||||
Navigator.pop(context, _pickedTime);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 80.w,
|
||||
magnification: 1.0,
|
||||
looping: false,
|
||||
scrollController: _yearController,
|
||||
onSelectedItemChanged: (index) {
|
||||
_pickYear = _years[index];
|
||||
_pickMonth = 1;
|
||||
setState(() {});
|
||||
},
|
||||
children: _years
|
||||
.map((e) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||
child:
|
||||
Text(e.toString()+'年', textAlign: TextAlign.center),
|
||||
),
|
||||
))
|
||||
.toList()),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 80.w,
|
||||
magnification: 1.0,
|
||||
// offAxisFraction: 0.6,
|
||||
looping: true,
|
||||
scrollController: _monthController,
|
||||
onSelectedItemChanged: (index) {
|
||||
_pickMonth = _months[index];
|
||||
setState(() {});
|
||||
},
|
||||
children: _months.isEmpty
|
||||
? [Container()]
|
||||
: _months
|
||||
.map((e) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w,
|
||||
right: 20.w,
|
||||
top: 10.w,
|
||||
bottom: 10.w),
|
||||
child: Text(e.toString()+'月',
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +1,19 @@
|
||||
class Config {
|
||||
///用户根目录
|
||||
static const String homeDir = 'G:\\apk';
|
||||
static const String homeDir = '/users/zhangmeng';
|
||||
|
||||
///包名
|
||||
static const String packageName = 'aku_new_community';
|
||||
|
||||
///打包目录
|
||||
static String get buildPath =>
|
||||
'\\build\\app\\outputs\\flutter-apk\\app-release.apk';
|
||||
'./build/app/outputs/flutter-apk/app-release.apk';
|
||||
|
||||
///测试包文件夹
|
||||
static String get apkDevDir =>
|
||||
'$homeDir\\aku_new_community\\dev';
|
||||
'$homeDir/team/bee/aku_new_community_manager/dev';
|
||||
|
||||
///正式包文件夹
|
||||
static String get apkDir =>
|
||||
'$homeDir\\aku_new_community\\release';
|
||||
'$homeDir/team/bee/aku_new_community_manager/release';
|
||||
}
|
||||
|
Loading…
Reference in new issue