123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- import 'dart:convert';
- import 'package:city_pickers/city_pickers.dart';
- import 'package:city_pickers/modal/result.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:webview_flutter/webview_flutter.dart';
- import 'package:ysairplane2/base/YSBase.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- class YSUnionJoin extends StatefulWidget {
- final String content;
- const YSUnionJoin({Key key, this.content = ''}) : super(key: key);
- @override
- _YSUnionJoinState createState() => _YSUnionJoinState();
- }
- class _YSUnionJoinState extends State<YSUnionJoin> {
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '顺翔航空',
- yscolor: Color(0xFFF5F6F8),
- yschild: Column(
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(140),
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(hsp(30)),
- child: WebView(
- javascriptMode: JavascriptMode.unrestricted,
- onWebViewCreated: (WebViewController webViewController) {
- webViewController.loadUrl(Uri.dataFromString(widget.content, mimeType: 'text/html', encoding: Encoding.getByName('utf-8')).toString());
- },
- ),
- ),
- GestureDetector(
- onTap: (){
- Navigator.pop(context);
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSUnionSubmit();
- }
- )
- );
- },
- child: Container(
- height: hsp(140),
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(50),right: hsp(50),top: hsp(20),bottom: hsp(20)),
- child: Container(
- decoration: BoxDecoration(
- color: Color(0xFF007AFF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- alignment: Alignment.center,
- child: Text('加入我们',style: TextStyle(fontSize: zsp(30),color: Colors.white),),
- ),
- ),
- )
- ],
- ),
- );
- }
- }
- class YSUnionSubmit extends StatefulWidget {
- const YSUnionSubmit({Key key}) : super(key: key);
- @override
- _YSUnionSubmitState createState() => _YSUnionSubmitState();
- }
- class _YSUnionSubmitState extends State<YSUnionSubmit> {
- List _array1 = ['姓名','身份证','地区'];
- String _province = '';
- String _city = '';
- String _area = '';
- TextEditingController _nameField = TextEditingController();
- TextEditingController _cardField = TextEditingController();
- TextEditingController _weChatField = TextEditingController();
- TextEditingController _aliField = TextEditingController();
- @override
- void dispose() {
- _nameField.dispose();
- _cardField.dispose();
- _weChatField.dispose();
- _aliField.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '加入我们',
- yscolor: Color(0xFFF5F6F8),
- yschild: Column(
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(140),
- width: MediaQuery.of(context).size.width,
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(top: hsp(20)),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- child: ListView.separated(
- itemCount: _array1.length,
- separatorBuilder: (context,index){
- return Divider(height: hsp(1),thickness: hsp(1),color: Color(0xFFF5F6F8),);
- },
- itemBuilder: (context,index){
- return Container(
- height: hsp(100),
- child: Row(
- children: [
- Container(
- width: hsp(200),
- child: Text(_array1[index],style: TextStyle(fontSize: zsp(32),color: Colors.black),),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(240),
- child: index==2?GestureDetector(
- onTap: () async{
- FocusScope.of(context).unfocus();
- Result result = await CityPickers.showCityPicker(
- context: context,
- );
- print(result);
- if(result!=null){
- _province = result.provinceName;
- _city = result.cityName;
- _area = result.areaName;
- setState(() {});
- }
- },
- behavior: HitTestBehavior.opaque,
- child: Row(
- children: [
- Container(
- width: MediaQuery.of(context).size.width-hsp(280),
- child: Text(_area.isEmpty?'请选择地区':'$_province $_city $_area',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF999999)),),
- alignment: Alignment.centerRight,
- ),
- Icon(Icons.chevron_right,size: hsp(40),color: Color(0xFF999999),)
- ],
- ),
- ):CupertinoTextField(
- placeholder: '请输入',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF999999)),
- textAlign: TextAlign.right,
- decoration: BoxDecoration(),
- controller: index==0?_nameField:_cardField,
- ),
- )
- ],
- ),
- );
- },
- shrinkWrap: true,
- ),
- color: Colors.white,
- ),
- Container(
- height: hsp(80),
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- child: Text('收款信息',style: TextStyle(fontSize: zsp(28),color: Color(0xFF666666)),),
- alignment: Alignment.centerLeft,
- ),
- ListView.separated(
- itemCount: 2,
- itemBuilder: (context,index){
- return Container(
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
- child: Column(
- children: [
- Container(
- height: hsp(100),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('类型',style: TextStyle(fontSize: zsp(32),color: Colors.black),),
- Text(index==0?'微信':'支付宝',style: TextStyle(fontSize: zsp(32),color: Color(0xFF999999)),)
- ],
- ),
- ),
- Divider(height: hsp(1),thickness: hsp(1),color: Color(0xFFF5F6F8),),
- Container(
- height: hsp(100),
- child: Row(
- children: [
- Container(
- width: hsp(200),
- child: Text('账号:',style: TextStyle(fontSize: zsp(32),color: Colors.black),),
- ),
- Container(
- width: MediaQuery.of(context).size.width-hsp(240),
- padding: EdgeInsets.only(left: hsp(10)),
- child: CupertinoTextField(
- placeholder: '请输入',
- style: TextStyle(fontSize: zsp(32),color: Color(0xFF999999)),
- textAlign: TextAlign.right,
- decoration: BoxDecoration(),
- controller: index==0?_weChatField:_aliField,
- ),
- )
- ],
- ),
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- shrinkWrap: true,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- )
- ],
- ),
- ),
- ),
- GestureDetector(
- onTap: (){
- _postUnionData();
- },
- child: Container(
- height: hsp(140),
- color: Colors.white,
- padding: EdgeInsets.only(left: hsp(50),right: hsp(50),top: hsp(20),bottom: hsp(20)),
- child: Container(
- decoration: BoxDecoration(
- color: Color(0xFF007AFF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- alignment: Alignment.center,
- child: Text('提交审核',style: TextStyle(fontSize: zsp(30),color: Colors.white),),
- ),
- ),
- )
- ],
- ),
- );
- }
- _postUnionData() async{
- if(_nameField.text.isEmpty){
- ysFlutterToast(context, '请输入姓名');
- return;
- }
- if(_cardField.text.isEmpty){
- ysFlutterToast(context, '请输入身份证号码');
- return;
- }
- if(isIdCard(_cardField.text)==false){
- ysFlutterToast(context, '身份证号码格式错误');
- return;
- }
- if(_area.isEmpty){
- ysFlutterToast(context, '请选择地区');
- return;
- }
- if(_weChatField.text.isEmpty){
- ysFlutterToast(context, '请输入微信账号');
- return;
- }
- if(_aliField.text.isEmpty){
- ysFlutterToast(context, '请输入支付宝账号');
- return;
- }
- Map request = {};
- request['username'] = _nameField.text;
- request['cardid'] = _cardField.text;
- request['paymentAccountWx'] = _weChatField.text;
- request['paymentAccountAlipay'] = _aliField.text;
- request['servantsProvince'] = _province;
- request['servantsCity'] = _city;
- request['servantsArea'] = _area;
- Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/servants/commit',parameter: request,isLoading: true,isToken: true);
- if(dict!=null){
- ysFlutterToast(context, '提交成功,待审核');
- Navigator.pop(context);
- }
- }
- }
- class YSUnionLoading extends StatelessWidget {
- final isLoading;
- final String msg;
- const YSUnionLoading({Key key, this.isLoading = true, this.msg = ''}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '审核中',
- yscolor: Color(0xFFF5F6F8),
- yschild: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: [
- Container(
- height: hsp(200),
- width: hsp(200),
- decoration: BoxDecoration(
- image: DecorationImage(image: AssetImage('lib/images/${isLoading==true?'审核中':'审核失败1'}.png'),)
- ),
- margin: EdgeInsets.only(top: hsp(200)),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(100)),
- padding: EdgeInsets.only(left: hsp(50),right: hsp(50)),
- child: Text(isLoading==true?'您的资料正在审核中\n一般在3个工作日内,完成审核。':
- '您的资料已被拒绝\n请重新提交。',style: TextStyle(fontSize: zsp(30),
- color: Color(0xFF333333)),textAlign: TextAlign.center,),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(80)),
- padding: EdgeInsets.only(left: hsp(50),right: hsp(50)),
- child: Text(msg,style: TextStyle(fontSize: zsp(30),
- color: Color(0xFF999999)),textAlign: TextAlign.center,),
- ),
- GestureDetector(
- onTap: (){
- Navigator.pop(context);
- if(isLoading==false){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return YSUnionSubmit();
- }
- )
- );
- }
- },
- child: Container(
- margin: EdgeInsets.only(top: hsp(100),left: hsp(100),right: hsp(100)),
- height: hsp(100),
- decoration: BoxDecoration(
- color: Color(0xFF007AFF),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- alignment: Alignment.center,
- child: Text('确定',style: TextStyle(fontSize: zsp(30),color: Colors.white),),
- ),
- )
- ],
- ),
- ),
- );
- }
- }
|