|
@@ -1,269 +1,195 @@
|
1
|
|
-
|
2
|
1
|
import 'package:flutter/material.dart';
|
3
|
2
|
import 'package:flutter_picker/Picker.dart';
|
4
|
3
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
5
|
4
|
import 'package:get/get.dart';
|
6
|
|
-
|
|
5
|
+import 'package:worker_client/models/entities/BankCard.dart';
|
|
6
|
+import 'package:worker_client/services/bank.dart';
|
7
|
7
|
import 'package:worker_client/widgets/MoneyCard/index.dart';
|
8
|
|
-
|
9
|
|
-
|
10
|
|
-import '../../widgets/MyButton/index.dart';
|
11
|
|
-import '../../widgets/layout/BasicPage.dart';
|
12
|
|
-
|
|
8
|
+import 'package:worker_client/widgets/MyButton/index.dart';
|
|
9
|
+import 'package:worker_client/widgets/MyTitle/index.dart';
|
|
10
|
+import 'package:worker_client/widgets/layout/BasicPage.dart';
|
13
|
11
|
|
14
|
12
|
class MyWithdrawal extends BasicPage {
|
15
|
13
|
MyWithdrawal({Key? key}) : super(key: key) {
|
16
|
14
|
naviTitle = '我的钱包';
|
17
|
15
|
}
|
18
|
16
|
|
19
|
|
- final bankBrand = Rx<Map>({});
|
|
17
|
+ final withdrawal = Rx<Map>({});
|
|
18
|
+ final amounts = Rx<double>(0);
|
|
19
|
+ dynamic pickerData = [];
|
|
20
|
+ int index = 0;
|
|
21
|
+ final bankCardList = Rx<List<BankCardModel>>([]);
|
|
22
|
+
|
|
23
|
+ void headleWithdrawal(){
|
20
|
24
|
|
|
25
|
+ }
|
21
|
26
|
|
22
|
|
- @override
|
|
27
|
+ @override
|
23
|
28
|
void beforeShow() {
|
24
|
|
- // TODO: implement beforeShow
|
25
|
29
|
super.beforeShow();
|
26
|
|
- // Loading.before('2222');
|
27
|
|
-
|
28
|
|
-
|
|
30
|
+ if (Get.arguments != null) {
|
|
31
|
+ amounts(double.parse(Get.arguments['amounts'].toString()));
|
29
|
32
|
}
|
|
33
|
+ int itemlength = 0;
|
|
34
|
+ getBankCardList({'pageSize': 500}).then((value) {
|
|
35
|
+ dynamic list = <BankCardModel>[];
|
|
36
|
+ value['records'].forEach((item) {
|
|
37
|
+ list.add(BankCardModel.fromJson(item));
|
|
38
|
+ itemlength = BankCardModel.fromJson(item).cardNo.toString().length;
|
|
39
|
+ pickerData.add(BankCardModel.fromJson(item).ownerBank! +
|
|
40
|
+ '(' +
|
|
41
|
+ BankCardModel.fromJson(item)
|
|
42
|
+ .cardNo
|
|
43
|
+ .toString()
|
|
44
|
+ .substring(itemlength - 4, itemlength) +
|
|
45
|
+ ')');
|
|
46
|
+ });
|
|
47
|
+ bankCardList(list);
|
|
48
|
+ });
|
|
49
|
+ }
|
30
|
50
|
|
31
|
|
- // void _showDialog(BuildContext,context) {
|
32
|
|
- // BuildContext dialogContext;
|
33
|
|
- //
|
34
|
|
- // Navigator.pop(dialogContext);
|
35
|
|
- // showDialog(
|
36
|
|
- // context: context,
|
37
|
|
- // builder: (BuildContext context) {
|
38
|
|
- // dialogContext = context;
|
39
|
|
- // return LoadingDialog(true);
|
40
|
|
- // });
|
41
|
|
- // }
|
42
|
|
-
|
43
|
|
- @override
|
|
51
|
+ @override
|
44
|
52
|
Widget builder(BuildContext context) {
|
45
|
|
-
|
46
|
|
- return
|
47
|
|
- Container(
|
48
|
|
- alignment: Alignment.center,
|
49
|
|
- child: Column(
|
50
|
|
- children: [
|
51
|
|
- MoneyCard(type: true, amounts: 6, goWithDrawal: () { },),
|
52
|
|
- Container(
|
53
|
|
- margin: EdgeInsets.fromLTRB(20, 30.w, 0, 20.w),
|
54
|
|
- alignment: Alignment.topLeft,
|
55
|
|
- decoration: const BoxDecoration(
|
56
|
|
- border: Border(
|
57
|
|
- left: BorderSide(
|
58
|
|
- width: 5, color: Color(0xff000000)
|
59
|
|
- // 0x17000000
|
60
|
|
- ))),
|
61
|
|
- child: Padding(
|
62
|
|
- padding: EdgeInsets.fromLTRB(13.w, 0, 0, 0),
|
63
|
|
- child: Text(
|
64
|
|
- '选择银行卡',
|
|
53
|
+ return Container(
|
|
54
|
+ margin: EdgeInsets.all(15.w),
|
|
55
|
+ child: Column(
|
|
56
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
57
|
+ children: [
|
|
58
|
+ MoneyCard(
|
|
59
|
+ type: true,
|
|
60
|
+ amounts: amounts.value,
|
|
61
|
+ goWithDrawal: () {},
|
|
62
|
+ ),
|
|
63
|
+ const MyTitle(title: '选择银行卡'),
|
|
64
|
+ GestureDetector(
|
|
65
|
+ child: Container(
|
|
66
|
+ height: 54.h,
|
|
67
|
+ padding: EdgeInsets.symmetric(horizontal: 15.w),
|
|
68
|
+ margin: EdgeInsets.only(top: 15.h),
|
|
69
|
+ decoration: BoxDecoration(
|
|
70
|
+ borderRadius: BorderRadius.circular(20.w),
|
|
71
|
+ border: Border.all(
|
|
72
|
+ color: const Color(0xffF2F2F2),
|
|
73
|
+ width: 1.w,
|
|
74
|
+ ),
|
|
75
|
+ ),
|
|
76
|
+ child: Row(
|
|
77
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
78
|
+ children: [
|
|
79
|
+ Obx(
|
|
80
|
+ () => Text(
|
|
81
|
+ withdrawal.value['ownerBank'] == null
|
|
82
|
+ ? '请选择银行'
|
|
83
|
+ : withdrawal.value['ownerBank'].toString() +
|
|
84
|
+ '(' +
|
|
85
|
+ withdrawal.value['accountCardNo'].toString().substring(
|
|
86
|
+ withdrawal.value['accountCardNo'].toString().length -
|
|
87
|
+ 4,
|
|
88
|
+ withdrawal.value['accountCardNo'].toString().length) +
|
|
89
|
+ ')',
|
65
|
90
|
style: TextStyle(
|
66
|
|
- color: Color(0xff333333),
|
67
|
|
- fontWeight: FontWeight.w400,
|
68
|
|
- fontSize: 18,
|
|
91
|
+ fontSize: 16.sp,
|
|
92
|
+ fontWeight: FontWeight.w500,
|
|
93
|
+ color: const Color(0xff333333),
|
69
|
94
|
),
|
70
|
95
|
),
|
71
|
|
- )),
|
72
|
|
- Container(
|
73
|
|
- width:345.w ,
|
74
|
|
- alignment: Alignment.topLeft,
|
75
|
|
- decoration: BoxDecoration(
|
76
|
|
- borderRadius: BorderRadius.circular(20),
|
77
|
|
-
|
78
|
|
- border: Border.all(
|
79
|
|
- color: Color(0xffF2F2F2),
|
80
|
|
- width: 1,
|
81
|
|
- ),
|
82
|
|
- ),
|
83
|
|
- child: Row(
|
84
|
|
- children: [
|
85
|
|
- Expanded(
|
86
|
|
- child: ListTile(
|
87
|
|
- title:Obx(()=>Text(bankBrand.value.length==0?'请选择银行':bankBrand.value['name'])),
|
88
|
|
- onTap: () {
|
89
|
|
- showPicker(context);
|
90
|
|
- },
|
91
|
|
- ),
|
92
|
|
- ),
|
93
|
|
- Icon(Icons.keyboard_arrow_right_outlined,size: 30,color:Color(0xff999999) ,)
|
94
|
|
-
|
95
|
|
- ],)
|
|
96
|
+ ),
|
|
97
|
+ Image.asset(
|
|
98
|
+ 'images/main/goto.png',
|
|
99
|
+ height: 18.h,
|
|
100
|
+ fit: BoxFit.cover,
|
|
101
|
+ )
|
|
102
|
+ ],
|
96
|
103
|
),
|
97
|
|
-
|
98
|
|
- Container(
|
99
|
|
- margin: EdgeInsets.fromLTRB(20, 30.w, 0, 20.w),
|
100
|
|
- alignment: Alignment.topLeft,
|
101
|
|
- decoration: const BoxDecoration(
|
102
|
|
- border: Border(
|
103
|
|
- left: BorderSide(
|
104
|
|
- width: 5, color: Color(0xff000000)
|
105
|
|
- // 0x17000000
|
106
|
|
- ))),
|
107
|
|
- child: Padding(
|
108
|
|
- padding: EdgeInsets.fromLTRB(13.w, 0, 0, 0),
|
109
|
|
- child: Text(
|
110
|
|
- '提取金额',
|
111
|
|
- style: TextStyle(
|
112
|
|
- color: Color(0xff333333),
|
113
|
|
- fontWeight: FontWeight.w400,
|
114
|
|
- fontSize: 18,
|
115
|
|
- ),
|
|
104
|
+ ),
|
|
105
|
+ onTap: () {
|
|
106
|
+ showPicker(context);
|
|
107
|
+ },
|
|
108
|
+ ),
|
|
109
|
+ const MyTitle(title: '提取金额'),
|
|
110
|
+ Container(
|
|
111
|
+ height: 54.h,
|
|
112
|
+ padding: EdgeInsets.symmetric(horizontal: 15.w),
|
|
113
|
+ margin: EdgeInsets.only(top: 15.h),
|
|
114
|
+ decoration: BoxDecoration(
|
|
115
|
+ borderRadius: BorderRadius.circular(20.w),
|
|
116
|
+ border: Border.all(
|
|
117
|
+ color: const Color(0xffF2F2F2),
|
|
118
|
+ width: 1.w,
|
|
119
|
+ ),
|
|
120
|
+ ),
|
|
121
|
+ child: Row(
|
|
122
|
+ children: [
|
|
123
|
+ Padding(
|
|
124
|
+ padding: EdgeInsets.only(right: 10.w),
|
|
125
|
+ child: Text(
|
|
126
|
+ '¥',
|
|
127
|
+ style: TextStyle(
|
|
128
|
+ fontSize: 24.sp,
|
|
129
|
+ fontWeight: FontWeight.w500,
|
|
130
|
+ color: Color(0xff333333),
|
116
|
131
|
),
|
117
|
|
- )),
|
118
|
|
- Container(
|
119
|
|
- width:345.w ,
|
120
|
|
- alignment: Alignment.topLeft,
|
121
|
|
- decoration: BoxDecoration(
|
122
|
|
- borderRadius: BorderRadius.circular(20),
|
123
|
|
-
|
124
|
|
- border: Border.all(
|
125
|
|
- color: Color(0xffF2F2F2),
|
126
|
|
- width: 1,
|
|
132
|
+ ),
|
|
133
|
+ ),
|
|
134
|
+ Expanded(
|
|
135
|
+ child: TextField(
|
|
136
|
+ keyboardType: TextInputType.number,
|
|
137
|
+ decoration: const InputDecoration(
|
|
138
|
+ contentPadding: EdgeInsets.symmetric(vertical: 1),
|
|
139
|
+ hintText: '请输入提现金额',
|
|
140
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
127
|
141
|
),
|
|
142
|
+ onChanged: (e) {
|
|
143
|
+ withdrawal.value['money']=e;
|
|
144
|
+ },
|
128
|
145
|
),
|
129
|
|
- child: Row(
|
130
|
|
- children: [
|
131
|
|
- Padding(padding: EdgeInsets.fromLTRB(20, 0 , 15, 0),
|
132
|
|
- child:Icon(Icons.currency_yen_sharp,size: 30 ,) ,
|
133
|
|
- ),
|
134
|
|
-
|
135
|
|
- Expanded(
|
136
|
|
- child:TextField(
|
137
|
|
- keyboardType: TextInputType.number,
|
138
|
|
- decoration: InputDecoration(
|
139
|
|
- contentPadding:
|
140
|
|
- const EdgeInsets.symmetric(vertical: 4.0),
|
141
|
|
- hintText: '请输入提现金额',
|
142
|
|
- border: OutlineInputBorder(
|
143
|
|
- borderRadius: BorderRadius.circular(15),
|
144
|
|
- borderSide: BorderSide.none),
|
145
|
|
- ),
|
146
|
|
- // obscureText: true,
|
147
|
|
- ),
|
148
|
|
- ),
|
149
|
|
-
|
150
|
|
- ],)
|
151
|
|
- ),
|
152
|
|
- Padding(
|
153
|
|
- padding: const EdgeInsets.only(top: 35.0),
|
154
|
|
- child: Row(
|
155
|
|
- children: <Widget>[
|
156
|
|
- Container(
|
157
|
|
- width:360.w,
|
158
|
|
- height:65.w ,
|
159
|
|
- alignment:Alignment.center,
|
160
|
|
- child: MyButton(
|
161
|
|
- text: '提现',
|
162
|
|
- type: 0,
|
163
|
|
- disable: false,
|
164
|
|
- onClick: (){
|
165
|
|
- // showDialog(
|
166
|
|
- // context: context,
|
167
|
|
- // barrierDismissible: false, //点击遮罩不关闭对话框
|
168
|
|
- // builder: (BuildContext context) {
|
169
|
|
- // return LoadingDialog();
|
170
|
|
- // });
|
171
|
|
- // showDialog(
|
172
|
|
- // context: context,
|
173
|
|
- // barrierDismissible: false, //点击遮罩不关闭对话框
|
174
|
|
- // builder: (context) {
|
175
|
|
- // return AlertDialog(
|
176
|
|
- // content: Column(
|
177
|
|
- // mainAxisSize: MainAxisSize.min,
|
178
|
|
- // children: <Widget>[
|
179
|
|
- // CircularProgressIndicator(),
|
180
|
|
- // Padding(
|
181
|
|
- // padding: const EdgeInsets.only(top: 26.0),
|
182
|
|
- // child: Text("正在加载,请稍后..."),
|
183
|
|
- // )
|
184
|
|
- // ],
|
185
|
|
- // ),
|
186
|
|
- // );
|
187
|
|
- // },
|
188
|
|
- // );
|
189
|
|
- showDialog(
|
190
|
|
- context: context,
|
191
|
|
- builder: (context) {
|
192
|
|
- // 用Scaffold返回显示的内容,能跟随主题
|
193
|
|
- return Scaffold(
|
194
|
|
- backgroundColor: Colors.transparent, // 设置透明背影
|
195
|
|
- body: Center( // 居中显示
|
196
|
|
- child: Column( // 定义垂直布局
|
197
|
|
- mainAxisAlignment: MainAxisAlignment.center, // 主轴居中布局,相关介绍可以搜下flutter-ui的内容
|
198
|
|
- children: <Widget>[
|
199
|
|
- // CircularProgressIndicator自带loading效果,需要宽高设置可在外加一层sizedbox,设置宽高即可
|
200
|
|
- CircularProgressIndicator(),
|
201
|
|
- SizedBox(
|
202
|
|
- height: 10,
|
203
|
|
- ),
|
204
|
|
- Text('loading'), // 文字
|
205
|
|
- // 触发关闭窗口
|
206
|
|
- RaisedButton(
|
207
|
|
- child: Text('close dialog'),
|
208
|
|
- onPressed: () {
|
209
|
|
- Navigator.of(context, rootNavigator: true).pop();
|
210
|
|
- print('close');
|
211
|
|
- },
|
212
|
|
- ),
|
213
|
|
- ],
|
214
|
|
- ), // 自带loading效果,需要宽高设置可在外加一层sizedbox,设置宽高即可
|
215
|
|
- ),
|
216
|
|
- );
|
217
|
|
- },
|
218
|
|
- );
|
219
|
|
- // setTimeout((){
|
220
|
|
- // // Navigator.of(context).pop( Loading(canceledOnTouchOutside: false,));
|
221
|
|
- // Navigator.pop(context);
|
222
|
|
- //
|
223
|
|
- // }, 4000);
|
224
|
|
-
|
225
|
|
- print('ok');
|
226
|
|
-
|
227
|
|
- }
|
228
|
|
- ),
|
229
|
|
- )
|
230
|
|
-
|
231
|
|
- ],
|
232
|
146
|
),
|
233
|
|
- )
|
234
|
|
-
|
235
|
|
- ],
|
|
147
|
+ ],
|
|
148
|
+ ),
|
|
149
|
+ ),
|
|
150
|
+ const Spacer(),
|
|
151
|
+ Padding(
|
|
152
|
+ padding: EdgeInsets.only(bottom: 16.h),
|
|
153
|
+ child: MyButton(
|
|
154
|
+ pwith: 30.w,
|
|
155
|
+ text: '提现',
|
|
156
|
+ type: 0,
|
|
157
|
+ disable: false,
|
|
158
|
+ onClick: () {
|
|
159
|
+ headleWithdrawal();
|
|
160
|
+ },
|
|
161
|
+ ),
|
236
|
162
|
),
|
|
163
|
+ ],
|
|
164
|
+ ),
|
237
|
165
|
);
|
238
|
166
|
}
|
|
167
|
+
|
239
|
168
|
showPicker(BuildContext context) {
|
240
|
|
- const PickerData = ['中国建设银河','8s鱼就是','我的银行卡'];
|
241
|
169
|
Picker picker = Picker(
|
242
|
|
- height: 230.w,
|
243
|
|
- adapter: PickerDataAdapter<String>(
|
244
|
|
- pickerdata: PickerData),
|
|
170
|
+ height: 295.w,
|
|
171
|
+ itemExtent: 40.h,
|
|
172
|
+ adapter: PickerDataAdapter<String>(pickerdata: pickerData),
|
|
173
|
+ selecteds: [index],
|
245
|
174
|
changeToFirst: false,
|
246
|
|
- onCancel: (){
|
247
|
|
- print('object');
|
248
|
|
- },
|
|
175
|
+ onCancel: () {},
|
249
|
176
|
confirmText: '确定',
|
250
|
177
|
cancelText: '取消',
|
251
|
|
- textAlign: TextAlign.left,
|
252
|
|
- textStyle: TextStyle(color: Colors.blue, ),
|
253
|
|
- selectedTextStyle: TextStyle(color: Colors.red),
|
254
|
|
- columnPadding: const EdgeInsets.all(8.0),
|
|
178
|
+ cancelTextStyle:
|
|
179
|
+ const TextStyle(color: Color(0xff7f7f7f), fontSize: 20),
|
|
180
|
+ confirmTextStyle:
|
|
181
|
+ const TextStyle(color: Color(0xff07c160), fontSize: 20),
|
|
182
|
+ textStyle: const TextStyle(color: Color(0xff191919), fontSize: 20),
|
|
183
|
+ selectedTextStyle:
|
|
184
|
+ const TextStyle(color: Color(0xff191919), fontSize: 20),
|
255
|
185
|
onConfirm: (Picker picker, List<int> value) {
|
256
|
|
- print('666666666$value');
|
257
|
|
- // bankBrand(picker);
|
258
|
|
- int index = value.first;
|
259
|
|
- bankBrand({'id':index,'name':picker.getSelectedValues().first});
|
260
|
|
- print(bankBrand);
|
261
|
|
- }
|
262
|
|
- );
|
|
186
|
+ index = value.first;
|
|
187
|
+ withdrawal({
|
|
188
|
+ ...withdrawal(),
|
|
189
|
+ 'ownerBank': bankCardList.value[index].ownerBank.toString(),
|
|
190
|
+ 'accountCardNo': bankCardList.value[index].cardNo.toString()
|
|
191
|
+ });
|
|
192
|
+ });
|
263
|
193
|
picker.showModal(context);
|
264
|
194
|
}
|
265
|
|
-
|
266
|
|
-
|
267
|
195
|
}
|
268
|
|
-
|
269
|
|
-
|