Commit 72bb927db6cce3e3f89b2f3ffe9b8203d477d081

Authored by wdn127929
1 parent 32edc052

企业上传资料OK

@@ -612,9 +612,19 @@ class HttpUrl { @@ -612,9 +612,19 @@ class HttpUrl {
612 static const discount_pay_refund_apply = 612 static const discount_pay_refund_apply =
613 "?service=App.PayOnline.DiscountPayRefundApply"; // 优惠支付订单退款 613 "?service=App.PayOnline.DiscountPayRefundApply"; // 优惠支付订单退款
614 static const set_activity_config = 614 static const set_activity_config =
615 - "?service=App.Activity.SetActivityConfig"; // 获取商家券赠送规则配置 615 + "?service=App.Activity.SetActivityConfig"; // 设置商家券赠送规则配置
616 static const get_activity_config = 616 static const get_activity_config =
617 "?service=App.Activity.GetActivityConfig"; // 获取商家券赠送规则配置 617 "?service=App.Activity.GetActivityConfig"; // 获取商家券赠送规则配置
618 618
  619 + static const applyments=
  620 + "?service=App.PayOnline.Applyments"; // 二级商户进件
  621 +
  622 +
  623 + static const upLoad_applyments=
  624 + "?service=App.PayOnline.UpLoadApplyments"; // 上传身份证、营业执照图片
  625 +
  626 +
  627 +
  628 +
619 629
620 } 630 }
  1 +import 'dart:io';
  2 +
1 import 'package:cached_network_image/cached_network_image.dart'; 3 import 'package:cached_network_image/cached_network_image.dart';
  4 +import 'package:city_pickers/city_pickers.dart';
  5 +import 'package:city_pickers/modal/result.dart';
2 import 'package:common_utils/common_utils.dart'; 6 import 'package:common_utils/common_utils.dart';
  7 +import 'package:dio/dio.dart';
3 import 'package:flutter/material.dart'; 8 import 'package:flutter/material.dart';
  9 +import 'package:flutter_native_image/flutter_native_image.dart';
4 import 'package:flutter_picker_plus/picker.dart'; 10 import 'package:flutter_picker_plus/picker.dart';
5 import 'package:flutter_screenutil/flutter_screenutil.dart'; 11 import 'package:flutter_screenutil/flutter_screenutil.dart';
  12 +import 'package:image_picker/image_picker.dart';
  13 +import 'package:one_key/pages/online_check/photo_view_wiget.dart';
  14 +import 'package:one_key/provider/user_model.dart';
  15 +import 'package:one_key/widgets/MyDivider.dart';
6 import 'package:one_key/widgets/system_app_bar.dart'; 16 import 'package:one_key/widgets/system_app_bar.dart';
  17 +import 'package:permission_handler/permission_handler.dart';
7 import 'package:provider/provider.dart'; 18 import 'package:provider/provider.dart';
8 19
9 import '../../../models/get_reserve_type_field_model.dart'; 20 import '../../../models/get_reserve_type_field_model.dart';
@@ -25,6 +36,13 @@ import '../marketing_center/book_notification/img_picker_invitation_widget.dart' @@ -25,6 +36,13 @@ import '../marketing_center/book_notification/img_picker_invitation_widget.dart'
25 * 企业资料上传 36 * 企业资料上传
26 */ 37 */
27 38
  39 +enum UpaloadSource {
  40 + /// Opens up the device camera, letting the user to take a new picture.
  41 + frontid,
  42 + backid,
  43 + business,
  44 +}
  45 +
28 class EnterpriseInformationUploadPage extends StatefulWidget { 46 class EnterpriseInformationUploadPage extends StatefulWidget {
29 const EnterpriseInformationUploadPage({super.key}); 47 const EnterpriseInformationUploadPage({super.key});
30 48
@@ -35,8 +53,8 @@ class EnterpriseInformationUploadPage extends StatefulWidget { @@ -35,8 +53,8 @@ class EnterpriseInformationUploadPage extends StatefulWidget {
35 53
36 class _EnterpriseInformationUploadPageState 54 class _EnterpriseInformationUploadPageState
37 extends State<EnterpriseInformationUploadPage> { 55 extends State<EnterpriseInformationUploadPage> {
38 - String stime = '点击选择营业执照开始日期';  
39 - String etime = '点击选择营业执照结束日期'; 56 + String stime = '点击选择';
  57 + String etime = '点击选择';
40 ScrollController _controller = ScrollController(); 58 ScrollController _controller = ScrollController();
41 late UploadImageProvider _uploadImageProvider; 59 late UploadImageProvider _uploadImageProvider;
42 late FinanceProvider financeProvider; 60 late FinanceProvider financeProvider;
@@ -80,7 +98,15 @@ class _EnterpriseInformationUploadPageState @@ -80,7 +98,15 @@ class _EnterpriseInformationUploadPageState
80 FocusNode servicePhoneFoc = FocusNode(); 98 FocusNode servicePhoneFoc = FocusNode();
81 99
82 List<GetReserveTypeFieldsSunModel> bankData = []; 100 List<GetReserveTypeFieldsSunModel> bankData = [];
83 - String bankType='点击选择开户银行'; 101 + String bankType = '点击选择开户银行';
  102 + String cityString = '请选择';
  103 +
  104 + String cityStringData = '请选择';
  105 + bool isCard = true;
  106 +
  107 + String? idPersonPath;
  108 + String? idPersonUnPath;
  109 + String? businessCard;
84 110
85 @override 111 @override
86 void initState() { 112 void initState() {
@@ -127,6 +153,130 @@ class _EnterpriseInformationUploadPageState @@ -127,6 +153,130 @@ class _EnterpriseInformationUploadPageState
127 }).toList(); 153 }).toList();
128 } 154 }
129 155
  156 + _upLoadApplyments() async {
  157 + if (registrNoC.text.trim().length == 0) {
  158 + Utils.showToast('请输入注册号!');
  159 + return;
  160 + }
  161 + if (registrNameC.text.trim().length == 0) {
  162 + Utils.showToast('请输入注册名称!');
  163 + return;
  164 + }
  165 + if (legalNameC.text.trim().length == 0) {
  166 + Utils.showToast('请输入经营者/法人姓名!');
  167 + return;
  168 + }
  169 + if (registrAddressC.text.trim().length == 0) {
  170 + Utils.showToast('请输入注册地址!');
  171 + return;
  172 + }
  173 + if (businessCard == null || businessCard == '') {
  174 + Utils.showToast('请上传营业执照照片!');
  175 + return;
  176 + }
  177 + if (idNumC.text.trim().length == 0) {
  178 + Utils.showToast('请输入法人身份证号码!');
  179 + return;
  180 + }
  181 + if (stime == '点击选择') {
  182 + Utils.showToast('请选择身份证有效期的开始时间!');
  183 + return;
  184 + }
  185 + if (etime == '点击选择' && !isCard) {
  186 + Utils.showToast('请选择身份证有效期的结束时间!');
  187 + return;
  188 + }
  189 + if (legalPhoneC.text.trim().length == 0) {
  190 + Utils.showToast('请输入法人电话号码!');
  191 + return;
  192 + }
  193 +
  194 + if (!Utils.is11PhoneS(legalPhoneC.text.trim())) {
  195 + Utils.showToast('请输入正确的11位电话号码!');
  196 + return;
  197 + }
  198 + if (emailC.text.trim().length == 0) {
  199 + Utils.showToast('请输入邮箱!');
  200 + return;
  201 + }
  202 +
  203 + if (idPersonPath == null || idPersonPath == '') {
  204 + Utils.showToast('请上传法人身份证人像页!');
  205 + return;
  206 + }
  207 + if (idPersonUnPath == null || idPersonUnPath == '') {
  208 + Utils.showToast('法人身份证国徽页!');
  209 + return;
  210 + }
  211 +
  212 + int index = bankData.indexWhere((e) => e.select!);
  213 + String bankname = '';
  214 + if (index > 0) {
  215 + bankname = bankData[index].name!;
  216 + } else {
  217 + Utils.showToast('请选择开户银行!');
  218 + return;
  219 + }
  220 + if (bankname == '其他银行' && bankAllNameC.text.trim().length == 0) {
  221 + //需要输入网点全名称
  222 + Utils.showToast('请输入开户银行网点全称!');
  223 + return;
  224 + }
  225 + if (cityString == '请选择') {
  226 + Utils.showToast('请输入开户银行所在省市区!');
  227 + return;
  228 + }
  229 + if (bankNumC.text.trim().length == 0) {
  230 + Utils.showToast('请输入银行账户!');
  231 + return;
  232 + }
  233 + if (bankNumC.text.trim().length == 0) {
  234 + Utils.showToast('请输入银行账户!');
  235 + return;
  236 + }
  237 +
  238 + Map<String, dynamic> params = {
  239 + 'sellerid':
  240 + Provider.of<UserModel>(context, listen: false).user!.sellerid!,
  241 + 'id_card_copy': await MultipartFile.fromFile(idPersonPath!),
  242 + 'id_card_national': await MultipartFile.fromFile(idPersonUnPath!),
  243 + 'business_license_copy': await MultipartFile.fromFile(businessCard!),
  244 + };
  245 + FormData formData = FormData.fromMap(params);
  246 + bool suceess = await financeProvider.upLoadApplyments(context, formData);
  247 + if (suceess) {
  248 + _submitData(bankname);
  249 + }
  250 + }
  251 +
  252 + _submitData(String bankname) async {
  253 + //接口提交
  254 + Map<String, String> pramas = {
  255 + 'sellerid':
  256 + Provider.of<UserModel>(context, listen: false).user!.sellerid!,
  257 + 'account_type': accountType ? '3' : '2',
  258 + 'id_card_name': legalNameC.text,
  259 + 'id_card_number': idNumC.text,
  260 + 'account_number': bankNumC.text,
  261 + 'mobile_phone': legalPhoneC.text,
  262 + 'contact_email': emailC.text,
  263 + 'id_card_valid_time_begin': stime,
  264 + 'id_card_valid_time': isCard ? '长期' : etime,
  265 + 'bank_address_code': cityStringData,
  266 + 'business_license_number': registrNoC.text,
  267 + 'merchant_name': registrNameC.text,
  268 + 'legal_person': legalNameC.text,
  269 + 'company_address': registrAddressC.text
  270 + };
  271 + if (bankname == '其他银行') {
  272 + pramas['bank_name'] = bankAllNameC.text;
  273 + } else {
  274 + pramas['account_bank'] = bankname;
  275 + }
  276 +
  277 + await financeProvider.setApplyments(context, pramas);
  278 + }
  279 +
130 Widget _title(String title) { 280 Widget _title(String title) {
131 return Padding( 281 return Padding(
132 padding: EdgeInsets.only(left: w(16), top: w(10), bottom: w(10)), 282 padding: EdgeInsets.only(left: w(16), top: w(10), bottom: w(10)),
@@ -198,6 +348,16 @@ class _EnterpriseInformationUploadPageState @@ -198,6 +348,16 @@ class _EnterpriseInformationUploadPageState
198 ); 348 );
199 } 349 }
200 350
  351 + ///弹框text
  352 + _textWidget(String title, Color textColor, FontWeight fontWeight, int size) {
  353 + return Text(title,
  354 + style: TextStyle(
  355 + color: textColor,
  356 + decoration: TextDecoration.none,
  357 + fontWeight: fontWeight,
  358 + fontSize: ScreenUtil().setSp(size)));
  359 + }
  360 +
201 ///是否立即启用 361 ///是否立即启用
202 Widget _canUse( 362 Widget _canUse(
203 String title, 363 String title,
@@ -269,8 +429,8 @@ class _EnterpriseInformationUploadPageState @@ -269,8 +429,8 @@ class _EnterpriseInformationUploadPageState
269 Spacer(), 429 Spacer(),
270 Text(hintText, 430 Text(hintText,
271 style: TextStyle( 431 style: TextStyle(
272 - color: hintText == '点击选择营业执照开始日期' ||  
273 - hintText == '点击选择营业执照结束日期' || 432 + color: hintText == '点击选择' ||
  433 + hintText == '点击选择' ||
274 hintText == '点击选择开户银行' 434 hintText == '点击选择开户银行'
275 ? MyColours.color_999999 435 ? MyColours.color_999999
276 : MyColours.color_515151, 436 : MyColours.color_515151,
@@ -287,6 +447,344 @@ class _EnterpriseInformationUploadPageState @@ -287,6 +447,344 @@ class _EnterpriseInformationUploadPageState
287 ); 447 );
288 } 448 }
289 449
  450 + _addressWidget(String name, String subtitle, GestureTapCallback onTap) {
  451 + return InkWell(
  452 + onTap: onTap,
  453 + child: Container(
  454 + margin: EdgeInsets.only(left: w(40)),
  455 + padding: EdgeInsets.only(top: w(10), bottom: w(10), right: w(16)),
  456 + decoration: BoxDecoration(
  457 + border: Border(
  458 + bottom: BorderSide(
  459 + color: MyColours.color_E7E7E7, width: w(0.5)))),
  460 + // height: w(48),
  461 + alignment: Alignment.center,
  462 + child: Row(
  463 + // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  464 + crossAxisAlignment: CrossAxisAlignment.center,
  465 + children: [
  466 + _textWidget(
  467 + name, MyColours.color_515151, FontWeight.normal, 28),
  468 + Expanded(
  469 + child: Text(
  470 + subtitle,
  471 + textAlign: TextAlign.right,
  472 + style: TextStyle(
  473 + color: subtitle == '请选择'
  474 + ? MyColours.color_999999
  475 + : MyColours.color_515151,
  476 + fontSize: ScreenUtil().setSp(24),
  477 + ),
  478 + )),
  479 + HEmptyView(20),
  480 + Image.asset(
  481 + "assets/arrow_right_new.png",
  482 + width: w(7),
  483 + // height: ScreenUtil().setWidth(22),
  484 + )
  485 + ])));
  486 + }
  487 +
  488 + ///添加图片UI弹出
  489 + Future _openModalBottomSheet(context, UpaloadSource source) async {
  490 + final option = await showModalBottomSheet(
  491 + context: context,
  492 + backgroundColor: Colors.transparent,
  493 + isDismissible: false,
  494 + builder: (BuildContext context) {
  495 + return Container(
  496 + // height: ScreenUtil().setWidth(180 * 2),
  497 + decoration: BoxDecoration(
  498 + color: MyColours.color_ffffff,
  499 + borderRadius: BorderRadius.only(
  500 + topLeft: Radius.circular(ScreenUtil().setWidth(24)),
  501 + topRight: Radius.circular(ScreenUtil().setWidth(24)))),
  502 + child: Column(
  503 + mainAxisSize: MainAxisSize.min,
  504 + children: <Widget>[
  505 + InkWell(
  506 + onTap: () {
  507 + Utils.getPickPermission(context, () {
  508 + _getFromPictureOrCamera(ImageSource.camera, source);
  509 + if (Navigator.canPop(context)) {
  510 + Navigator.pop(context);
  511 + }
  512 + }, Permission.camera);
  513 + },
  514 + child: Container(
  515 + width: double.infinity,
  516 + height: ScreenUtil().setWidth(58 * 2),
  517 + child: Center(
  518 + child: Text(
  519 + '拍摄',
  520 + style: TextStyle(
  521 + fontSize: ScreenUtil().setSp(32),
  522 + color: MyColours.color_353535,
  523 + fontWeight: FontWeight.bold),
  524 + ),
  525 + )),
  526 + ),
  527 + MyDivider(
  528 + double.infinity,
  529 + ScreenUtil().setWidth(2),
  530 + color: MyColours.color_EEEEEE,
  531 + ),
  532 + InkWell(
  533 + onTap: () {
  534 + Utils.getPickPermission(context, () {
  535 + _getFromPictureOrCamera(ImageSource.gallery, source);
  536 + if (Navigator.canPop(context)) {
  537 + Navigator.pop(context);
  538 + }
  539 + },
  540 + Platform.isAndroid
  541 + ? Permission.storage
  542 + : Permission.photos);
  543 + },
  544 + child: Container(
  545 + width: double.infinity,
  546 + height: ScreenUtil().setWidth(58 * 2),
  547 + child: Center(
  548 + child: Text(
  549 + '从相册选择',
  550 + style: TextStyle(
  551 + fontSize: ScreenUtil().setSp(32),
  552 + color: MyColours.color_353535,
  553 + fontWeight: FontWeight.bold),
  554 + ),
  555 + )),
  556 + ),
  557 + MyDivider(
  558 + double.infinity,
  559 + ScreenUtil().setWidth(10),
  560 + color: MyColours.color_EEEEEE,
  561 + ),
  562 + InkWell(
  563 + onTap: () {
  564 + if (Navigator.canPop(context)) {
  565 + Navigator.pop(context, '取消');
  566 + }
  567 + },
  568 + child: Container(
  569 + width: double.infinity,
  570 + height: ScreenUtil().setWidth(58 * 2),
  571 + child: Center(
  572 + child: Text(
  573 + '取消',
  574 + style: TextStyle(
  575 + fontSize: ScreenUtil().setSp(32),
  576 + color: MyColours.color_353535,
  577 + fontWeight: FontWeight.bold),
  578 + ),
  579 + )))
  580 + ],
  581 + ),
  582 + );
  583 + });
  584 + }
  585 +
  586 + //查看大图
  587 + _showPhotoView(BuildContext context, int index, List<String?> imgs,
  588 + {isShow = false, List? dashName}) async {
  589 + // if (imgs.length == 1 &&
  590 + // imgs[0] ==
  591 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  592 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  593 + // }
  594 + Utils.setBarStatus(false, color: Colors.black);
  595 + dynamic result = await showGeneralDialog(
  596 + context: context,
  597 + barrierDismissible: false,
  598 + // barrierColor: Colors.red,
  599 + barrierLabel:
  600 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  601 + transitionDuration: const Duration(milliseconds: 150),
  602 + pageBuilder: (BuildContext context, Animation animation,
  603 + Animation secondaryAnimation) {
  604 + Widget child = Stack(
  605 + children: <Widget>[
  606 + PhotoPreview(
  607 + initialIndex: index,
  608 + photoList: imgs,
  609 + isShow: isShow,
  610 + dashName: dashName)
  611 + ],
  612 + );
  613 + return child;
  614 + });
  615 + Utils.setBarStatus(true, color: Colors.white);
  616 + }
  617 +
  618 + /// 九宫格
  619 + Widget _getGridImg(context, String subTips, UpaloadSource source) {
  620 + String? path;
  621 + if (source == UpaloadSource.business) {
  622 + path = businessCard;
  623 + } else if (source == UpaloadSource.frontid) {
  624 + path = idPersonPath;
  625 + } else if (source == UpaloadSource.backid) {
  626 + path = idPersonUnPath;
  627 + }
  628 +
  629 + if (path == null) {
  630 + return InkWell(
  631 + onTap: () {
  632 + // 触摸收起键盘
  633 + FocusScope.of(context).requestFocus(FocusNode());
  634 + _openModalBottomSheet(context, source);
  635 + },
  636 + child: Container(
  637 + width: ScreenUtil().setWidth(90 * 2),
  638 + height: ScreenUtil().setWidth(90 * 2),
  639 + decoration: BoxDecoration(
  640 + border: Border.all(
  641 + color: MyColours.color_E0E0E0,
  642 + width: ScreenUtil().setWidth(2)),
  643 + ),
  644 + child: Column(
  645 + children: [
  646 + VEmptyView(46),
  647 + Image.asset(
  648 + Utils.getImgPath('add_image'),
  649 + width: ScreenUtil().setWidth(44),
  650 + height: ScreenUtil().setWidth(40),
  651 + ),
  652 + VEmptyView(10),
  653 + Text(
  654 + '上传照片',
  655 + style: TextStyle(
  656 + fontSize: ScreenUtil().setSp(24),
  657 + color: MyColours.color_999999),
  658 + ),
  659 + Padding(
  660 + padding: EdgeInsets.only(top: w(5)),
  661 + child: Text(
  662 + '${subTips}',
  663 + style: TextStyle(
  664 + fontSize: ScreenUtil().setSp(18),
  665 + color: MyColours.color_999999),
  666 + )),
  667 + ],
  668 + )),
  669 + );
  670 + }
  671 + return InkWell(
  672 + onTap: () {
  673 + // if (temp[index].process == 1) {
  674 + // widget.model!.imageQiniuUrlList = [];
  675 + // if (temp[index].qiniuUrl != null) {
  676 + // for (int i = 0; i < temp.length; i++) {
  677 + // widget.model!.imageQiniuUrlList.add(temp[i].qiniuUrl);
  678 + // }
  679 +
  680 + ///没有上传完成的不可以点击
  681 + // if(path != null){
  682 +
  683 + // }
  684 + // _showPhotoView(
  685 + // context,0, []);
  686 + // }
  687 + // }
  688 + },
  689 + child: Stack(
  690 + // alignment: Alignment.topRight,
  691 + children: [
  692 + // path != null
  693 + // ?
  694 + Container(
  695 + child: Image.file(
  696 + File(path),
  697 + fit: BoxFit.contain,
  698 + width: ScreenUtil().setWidth(100 * 2),
  699 + height: ScreenUtil().setWidth(100 * 2),
  700 + ),
  701 + ),
  702 + // : CachedNetworkImage(
  703 + // imageUrl: '',
  704 + // fit: BoxFit.cover,
  705 + // width: ScreenUtil().setWidth(100 * 2),
  706 + // height: ScreenUtil().setWidth(100 * 2),
  707 + // ),
  708 + Positioned(
  709 + right: 0,
  710 + top: 0,
  711 + child: GestureDetector(
  712 + child: Image.asset(
  713 + Utils.getImgPath("delete"),
  714 + width: ScreenUtil().setWidth(40),
  715 + height: ScreenUtil().setWidth(40),
  716 + ),
  717 + onTap: () {
  718 + if (source == UpaloadSource.business) {
  719 + businessCard = null;
  720 + } else if (source == UpaloadSource.frontid) {
  721 + idPersonPath = null;
  722 + } else if (source == UpaloadSource.backid) {
  723 + idPersonUnPath = null;
  724 + }
  725 + setState(() {});
  726 + // if (widget.uploadType ==
  727 + // UploadType.TableManagerType ||
  728 + // widget.uploadType ==
  729 + // UploadType.RemarkImagesType) {
  730 + // if (temp[index].isUpload) {
  731 + // //已经传到服务器,弹提醒窗口,是否删除
  732 + // //修改之前有内容,则弹框
  733 + // DialogUtil.cupertinoAlertDialog(context,
  734 + // title: "确认删除",
  735 + // content: "是否确定删除该照片,删除操作不可逆转,请谨慎操作",
  736 + // lCallback: () {
  737 + // print("取消");
  738 + // }, rCallback: () {
  739 + // print("确定");
  740 + // widget.deleteCallback!(index);
  741 + // });
  742 + // } else {
  743 + // //直接删除
  744 + // setState(() {
  745 + // temp.removeWhere((element) =>
  746 + // element == temp[index]);
  747 + // });
  748 + // }
  749 + // } else {
  750 + // //点击删除按钮
  751 + // setState(() {
  752 + // temp.removeWhere((element) =>
  753 + // element == temp[index]);
  754 + // widget.model!.imageQiniuUrlList
  755 + // .removeWhere((element) =>
  756 + // element ==
  757 + // widget.model!
  758 + // .imageQiniuUrlList[index]);
  759 + // });
  760 + // }
  761 + },
  762 + )),
  763 + ],
  764 + ),
  765 + );
  766 + }
  767 +
  768 + ///#相机拍照,单图选择
  769 + Future _getFromPictureOrCamera(imageSource, UpaloadSource source) async {
  770 + final picker = ImagePicker();
  771 + final pickedFile = await picker.pickImage(source: imageSource);
  772 + if (pickedFile != null) {
  773 + File compressedFile = await FlutterNativeImage.compressImage(
  774 + pickedFile.path,
  775 + quality: 90,
  776 + percentage: 50);
  777 + if (source == UpaloadSource.business) {
  778 + businessCard = compressedFile.absolute.path;
  779 + } else if (source == UpaloadSource.frontid) {
  780 + idPersonPath = compressedFile.absolute.path;
  781 + } else if (source == UpaloadSource.backid) {
  782 + idPersonUnPath = compressedFile.absolute.path;
  783 + }
  784 + setState(() {});
  785 + }
  786 + }
  787 +
290 @override 788 @override
291 Widget build(BuildContext context) { 789 Widget build(BuildContext context) {
292 _uploadImageProvider = 790 _uploadImageProvider =
@@ -380,7 +878,61 @@ class _EnterpriseInformationUploadPageState @@ -380,7 +878,61 @@ class _EnterpriseInformationUploadPageState
380 _inputWidget('注册号', registrNoC, registrNoFoc, '点击输入营业执照注册号'), 878 _inputWidget('注册号', registrNoC, registrNoFoc, '点击输入营业执照注册号'),
381 _inputWidget( 879 _inputWidget(
382 '注册名称', registrNameC, registrNameFoc, '点击输入营业执照上的企业名称'), 880 '注册名称', registrNameC, registrNameFoc, '点击输入营业执照上的企业名称'),
383 - _select('营业执照开始于', stime, () { 881 + _inputWidget(
  882 + '经营者/法人姓名', legalNameC, legalNameFoc, '点击输入经营者/法人姓名'),
  883 + _inputWidget(
  884 + '注册地址', registrAddressC, registrAddressFoc, '点击输入注册地址'),
  885 + Consumer<UploadImageProvider>(builder: (context, model, _) {
  886 + return Padding(
  887 + padding: EdgeInsets.only(
  888 + left: w(20), top: w(20), bottom: w(12)),
  889 + child:
  890 + _getGridImg(context, '营业执照照片', UpaloadSource.business)
  891 + /*
  892 + ImgPickerWidget(
  893 + scrollController: _controller,
  894 + model: model,
  895 + maxImageNumber: 1,
  896 + uploadType: UploadType.TableManagerType,
  897 + subTips: '营业执照照片',
  898 + deleteCallback: (int index) {
  899 + // _delTablePhoto(
  900 + // context,
  901 + // _uploadImageProvider.tableImageList[index].photoID,
  902 + // index);
  903 + },
  904 + callback: () {
  905 + // for (UploadImgModel item
  906 + // in _uploadImageProvider.tableImageList) {
  907 + // if (item.process! < 1) {
  908 + // Utils.showToast('正在上传图片,请稍等');
  909 + // return;
  910 + // }
  911 + // }
  912 + // //接口,和桌子绑定
  913 + // List imageQiniuUrlList = [];
  914 + // for (int i = 0;
  915 + // i < _uploadImageProvider.tableImageList.length;
  916 + // i++) {
  917 + // if (!_uploadImageProvider.tableImageList[i].isUpload) {
  918 + // imageQiniuUrlList.add({
  919 + // "url":
  920 + // _uploadImageProvider.tableImageList[i].qiniuUrl
  921 + // });
  922 + // }
  923 + // }
  924 + // _setTablePhoto(context, imageQiniuUrlList);
  925 + },
  926 + )
  927 + */
  928 +
  929 + );
  930 + }),
  931 + VEmptyView(24),
  932 + _title('经营者/法人信息'),
  933 + VEmptyView(20),
  934 + _inputWidget('法人身份证号码', idNumC, idNumFoc, '点击输入法人身份证号码'),
  935 + _select('身份证有效期的开始时间', stime, () {
384 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 936 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
385 //弹出时间选择器 937 //弹出时间选择器
386 938
@@ -398,9 +950,8 @@ class _EnterpriseInformationUploadPageState @@ -398,9 +950,8 @@ class _EnterpriseInformationUploadPageState
398 } 950 }
399 // showDateSelWidget = false; 951 // showDateSelWidget = false;
400 }, 952 },
401 - dateTime: stime == '点击选择营业执照开始日期'  
402 - ? null  
403 - : DateUtil.getDateTime(stime), 953 + dateTime:
  954 + stime == '点击选择' ? null : DateUtil.getDateTime(stime),
404 minValue: DateTime(1987), 955 minValue: DateTime(1987),
405 yearBegin: 1987, 956 yearBegin: 1987,
406 pickerDateTimeType: PickerDateTimeType.kYMD, 957 pickerDateTimeType: PickerDateTimeType.kYMD,
@@ -408,11 +959,20 @@ class _EnterpriseInformationUploadPageState @@ -408,11 +959,20 @@ class _EnterpriseInformationUploadPageState
408 // showDateSelWidget = false; 959 // showDateSelWidget = false;
409 }); 960 });
410 }), 961 }),
411 - _canUse('营业期限长期有效', true, () {}), 962 + _canUse('身份证有效期长期有效', isCard, () {
  963 + setState(() {
  964 + isCard = !isCard;
  965 + etime = '点击选择';
  966 + });
  967 + }),
412 _select( 968 _select(
413 - '营业执照结束于', 969 + '身份证有效期的结束时间',
414 etime, 970 etime,
415 () { 971 () {
  972 + if (isCard) {
  973 + Utils.showToast('已选择长期有效!');
  974 + return;
  975 + }
416 FocusScope.of(context) 976 FocusScope.of(context)
417 .requestFocus(FocusNode()); //点击空白处隐藏键盘 977 .requestFocus(FocusNode()); //点击空白处隐藏键盘
418 //弹出时间选择器 978 //弹出时间选择器
@@ -431,7 +991,7 @@ class _EnterpriseInformationUploadPageState @@ -431,7 +991,7 @@ class _EnterpriseInformationUploadPageState
431 } 991 }
432 // showDateSelWidget = false; 992 // showDateSelWidget = false;
433 }, 993 },
434 - dateTime: etime == '点击选择营业执照结束日期' 994 + dateTime: etime == '点击选择'
435 ? null 995 ? null
436 : DateUtil.getDateTime(etime), 996 : DateUtil.getDateTime(etime),
437 minValue: DateTime(1987), 997 minValue: DateTime(1987),
@@ -442,83 +1002,41 @@ class _EnterpriseInformationUploadPageState @@ -442,83 +1002,41 @@ class _EnterpriseInformationUploadPageState
442 }); 1002 });
443 }, 1003 },
444 ), 1004 ),
445 - _inputWidget(  
446 - '经营者/法人姓名', legalNameC, legalNameFoc, '点击输入经营者/法人姓名'),  
447 - _inputWidget(  
448 - '注册地址', registrAddressC, registrAddressFoc, '点击输入注册地址'),  
449 - Consumer<UploadImageProvider>(builder: (context, model, _) {  
450 - return Padding(  
451 - padding: EdgeInsets.only(  
452 - left: w(20), top: w(20), bottom: w(12)),  
453 - child: ImgPickerWidget(  
454 - scrollController: _controller,  
455 - model: model,  
456 - maxImageNumber: 1,  
457 - uploadType: UploadType.TableManagerType,  
458 - subTips: '营业执照照片',  
459 - deleteCallback: (int index) {  
460 - // _delTablePhoto(  
461 - // context,  
462 - // _uploadImageProvider.tableImageList[index].photoID,  
463 - // index);  
464 - },  
465 - callback: () {  
466 - // for (UploadImgModel item  
467 - // in _uploadImageProvider.tableImageList) {  
468 - // if (item.process! < 1) {  
469 - // Utils.showToast('正在上传图片,请稍等');  
470 - // return;  
471 - // }  
472 - // }  
473 - // //接口,和桌子绑定  
474 - // List imageQiniuUrlList = [];  
475 - // for (int i = 0;  
476 - // i < _uploadImageProvider.tableImageList.length;  
477 - // i++) {  
478 - // if (!_uploadImageProvider.tableImageList[i].isUpload) {  
479 - // imageQiniuUrlList.add({  
480 - // "url":  
481 - // _uploadImageProvider.tableImageList[i].qiniuUrl  
482 - // });  
483 - // }  
484 - // }  
485 - // _setTablePhoto(context, imageQiniuUrlList);  
486 - },  
487 - ));  
488 - }),  
489 - VEmptyView(24),  
490 - _title('经营者/法人信息'),  
491 - VEmptyView(20),  
492 - _inputWidget('法人身份证号码', idNumC, idNumFoc, '点击输入法人身份证号码'),  
493 - _inputWidget(  
494 - '法人身份证住址', idAddressC, idAddressFoc, '点击输入法人身份证住址'), 1005 + // _inputWidget(
  1006 + // '法人身份证住址', idAddressC, idAddressFoc, '点击输入法人身份证住址'),
495 _inputWidget('电话', legalPhoneC, legalPhoneFoc, '点击输入法人电话号码'), 1007 _inputWidget('电话', legalPhoneC, legalPhoneFoc, '点击输入法人电话号码'),
496 _inputWidget('邮箱', emailC, emailFoc, '点击输入用来收取支付信息的邮箱'), 1008 _inputWidget('邮箱', emailC, emailFoc, '点击输入用来收取支付信息的邮箱'),
497 Row(children: [ 1009 Row(children: [
498 Padding( 1010 Padding(
499 padding: EdgeInsets.only( 1011 padding: EdgeInsets.only(
500 left: w(20), top: w(20), bottom: w(12)), 1012 left: w(20), top: w(20), bottom: w(12)),
501 - child: ImgPickerInvitationWidget(  
502 - scrollController: _controller,  
503 - uploadType: UploadType.InvitationStoreType,  
504 - model: _uploadImageProvider,  
505 - index: 5,  
506 - imageModel: _uploadImageProvider.storeImage1,  
507 - subTips: '法人身份证人像页',  
508 - callback: () {},  
509 - )), 1013 + child: _getGridImg(
  1014 + context, '法人身份证人像页', UpaloadSource.frontid)
  1015 + // ImgPickerInvitationWidget(
  1016 + // scrollController: _controller,
  1017 + // uploadType: UploadType.InvitationStoreType,
  1018 + // model: _uploadImageProvider,
  1019 + // index: 5,
  1020 + // imageModel: _uploadImageProvider.storeImage1,
  1021 + // subTips: '法人身份证人像页',
  1022 + // callback: () {},
  1023 + // )
  1024 + ),
510 Padding( 1025 Padding(
511 padding: EdgeInsets.only( 1026 padding: EdgeInsets.only(
512 left: w(20), top: w(20), bottom: w(12)), 1027 left: w(20), top: w(20), bottom: w(12)),
513 - child: ImgPickerInvitationWidget(  
514 - scrollController: _controller,  
515 - uploadType: UploadType.InvitationStoreType,  
516 - model: _uploadImageProvider,  
517 - index: 6,  
518 - imageModel: _uploadImageProvider.storeImage2,  
519 - subTips: '法人身份证国徽页',  
520 - callback: () {},  
521 - )), 1028 + child:
  1029 + _getGridImg(context, '法人身份证国徽页', UpaloadSource.backid)
  1030 + // ImgPickerInvitationWidget(
  1031 + // scrollController: _controller,
  1032 + // uploadType: UploadType.InvitationStoreType,
  1033 + // model: _uploadImageProvider,
  1034 + // index: 6,
  1035 + // imageModel: _uploadImageProvider.storeImage2,
  1036 + // subTips: '法人身份证国徽页',
  1037 + // callback: () {},
  1038 + // )
  1039 + ),
522 ]), 1040 ]),
523 _title('收款信息'), 1041 _title('收款信息'),
524 VEmptyView(20), 1042 VEmptyView(20),
@@ -535,13 +1053,61 @@ class _EnterpriseInformationUploadPageState @@ -535,13 +1053,61 @@ class _EnterpriseInformationUploadPageState
535 } 1053 }
536 }); 1054 });
537 }), 1055 }),
  1056 + _addressWidget('开户银行所在省市区', cityString, () async {
  1057 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  1058 + Result? result = await CityPickers.showCityPicker(
  1059 + context: context,
  1060 + borderRadius: r(8),
  1061 + cancelWidget: Container(
  1062 + padding: EdgeInsets.symmetric(
  1063 + horizontal: w(20), vertical: w(20)),
  1064 + child: Text(
  1065 + '取消',
  1066 + style: TextStyle(
  1067 + color: MyColours.color_515151,
  1068 + fontSize: ScreenUtil().setSp(32)),
  1069 + ),
  1070 + ),
  1071 + confirmWidget: Container(
  1072 + padding: EdgeInsets.symmetric(
  1073 + horizontal: w(20), vertical: w(20)),
  1074 + child: Text(
  1075 + '确定',
  1076 + style: TextStyle(
  1077 + color: MyColours.color_438E93,
  1078 + fontSize: ScreenUtil().setSp(32)),
  1079 + ),
  1080 + ),
  1081 + theme: ThemeData(
  1082 + textTheme: TextTheme(
  1083 + bodyLarge: TextStyle(
  1084 + fontSize: font(11),
  1085 + // fontWeight: FontWeight.w200,
  1086 + ),
  1087 + )));
  1088 + print(result);
  1089 + if (result != null) {
  1090 + // proCode = result.provinceId;
  1091 + // cityCode = result.cityId;
  1092 + // disCode = result.areaId;
  1093 + cityString = result.provinceName! +
  1094 + result.cityName! +
  1095 + result.areaName!;
  1096 +
  1097 + cityStringData = result.provinceName! +
  1098 + result.cityName! +
  1099 + ' ${result.cityId}';
  1100 +
  1101 + setState(() {});
  1102 + }
  1103 + }),
538 _inputWidget( 1104 _inputWidget(
539 '开户银行网点', bankAllNameC, bankAllNameFoc, '点击输入开户银行网点全称'), 1105 '开户银行网点', bankAllNameC, bankAllNameFoc, '点击输入开户银行网点全称'),
540 _inputWidget('银行账户', bankNumC, bankNumFoc, '点击录入银行账户号'), 1106 _inputWidget('银行账户', bankNumC, bankNumFoc, '点击录入银行账户号'),
541 - _inputWidget('收款商户简称', merchantNameC, merchantNameFoc,  
542 - '点击输入商户简称,用户支付时可见'),  
543 - _inputWidget(  
544 - '服务电话', servicePhoneC, servicePhoneFoc, '点击输入服务电话'), 1107 + // _inputWidget('收款商户简称', merchantNameC, merchantNameFoc,
  1108 + // '点击输入商户简称,用户支付时可见'),
  1109 + // _inputWidget(
  1110 + // '服务电话', servicePhoneC, servicePhoneFoc, '点击输入服务电话'),
545 VEmptyView(44), 1111 VEmptyView(44),
546 Padding( 1112 Padding(
547 padding: EdgeInsets.only(left: w(16)), 1113 padding: EdgeInsets.only(left: w(16)),
@@ -568,7 +1134,10 @@ class _EnterpriseInformationUploadPageState @@ -568,7 +1134,10 @@ class _EnterpriseInformationUploadPageState
568 textColor: MyColours.color_ffffff, 1134 textColor: MyColours.color_ffffff,
569 isBold: true, 1135 isBold: true,
570 fontSize: 32, 1136 fontSize: 32,
571 - onPressed: () {}, 1137 + onPressed: () {
  1138 + //接口提交
  1139 + _upLoadApplyments();
  1140 + },
572 ), 1141 ),
573 ) 1142 )
574 ], 1143 ],
  1 +import 'dart:convert';
  2 +import 'dart:io';
  3 +
  4 +import 'package:dio/dio.dart';
1 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
2 import 'package:one_key/models/ladder_coupons_model.dart'; 6 import 'package:one_key/models/ladder_coupons_model.dart';
3 import 'package:one_key/provider/user_model.dart'; 7 import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/widgets/loading.dart';
4 import 'package:provider/provider.dart'; 9 import 'package:provider/provider.dart';
5 10
6 import '../constant/constant.dart'; 11 import '../constant/constant.dart';
@@ -79,6 +84,101 @@ class FinanceProvider extends ChangeNotifier { @@ -79,6 +84,101 @@ class FinanceProvider extends ChangeNotifier {
79 } 84 }
80 } 85 }
81 86
  87 + Map<String, dynamic>? _decodeData(Response response) {
  88 + if (response == null ||
  89 + response.data == null ||
  90 + response.data.toString().isEmpty) {
  91 + return new Map();
  92 + }
  93 + return json.decode(response.data.toString());
  94 + }
  95 +
  96 +
  97 + // 二级商户进件-上传身份证、营业执照图片
  98 + Future<bool> upLoadApplyments(BuildContext context, FormData params,
  99 + {bool showLoading = true, bool needToast = true}) async {
  100 + Loading.showLoading(context);
  101 + var dio = new Dio();
  102 + Response response = await dio.post(
  103 + "https://xt04.colorcun.com/?service=App.PayOnline.UpLoadApplyments",
  104 + data: params);
  105 + print(response);
  106 +
  107 + Map? _responseData;
  108 + if (response.statusCode == HttpStatus.ok ||
  109 + response.statusCode == HttpStatus.created) {
  110 + try {
  111 + if (response.data is Map) {
  112 + _responseData = response.data;
  113 + } else {
  114 + Map<String, dynamic>? _dataMap = _decodeData(response);
  115 +
  116 + _responseData = _dataMap;
  117 + }
  118 +
  119 + Loading.hideLoading(context);
  120 + // SetSellerInfoSunModel? itemModel;
  121 +
  122 + if (_responseData!['ret'] == Constant.status_success) {
  123 + if (_responseData['data'] != null) {
  124 + // itemModel = SetSellerInfoModel.fromJson(
  125 + // _responseData as Map<String, dynamic>)
  126 + // .data;
  127 + return true;
  128 + } else {
  129 + Utils.showToast(_responseData['msg'] ?? "");
  130 + return false;
  131 + }
  132 + // return itemModel;
  133 + }
  134 + } catch (e) {
  135 + Loading.hideLoading(context);
  136 + throw DioException(
  137 + requestOptions: response.requestOptions,
  138 + response: response,
  139 + error: "data parsing exception...",
  140 + type: DioErrorType.badResponse,
  141 + );
  142 + }
  143 + }
  144 + return false;
  145 + }
  146 +
  147 +
  148 + // 二级商户进件
  149 + Future<bool> setApplyments(BuildContext context, Map<String, String?> params,
  150 + {bool showLoading = true, bool needToast = true}) async {
  151 + try {
  152 + BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
  153 + context, Method.post, HttpUrl.applyments,
  154 + data: params, showLoading: showLoading);
  155 + if (baseResp.code == Constant.status_success) {
  156 + if (baseResp.data == 0 || baseResp.data == 1) {
  157 + if (needToast) {
  158 + Utils.showToast('设置成功');
  159 + }
  160 + return true;
  161 + } else {
  162 + if (needToast) {
  163 + Utils.showToast('设置失败,请重试');
  164 + }
  165 + }
  166 + } else {
  167 + if (needToast) {
  168 + Utils.showToast(baseResp.msg ?? '设置失败,请重试');
  169 + }
  170 + }
  171 + return false;
  172 + } catch (error) {
  173 + print(error.toString());
  174 + if (needToast) {
  175 + Utils.showToast('设置失败,请重试');
  176 + }
  177 +
  178 + return false;
  179 + }
  180 + }
  181 +
82 // 商家券赠送规则配置 182 // 商家券赠送规则配置
83 Future<bool> setActivityConfig( 183 Future<bool> setActivityConfig(
84 BuildContext context, Map<String, String?> params, 184 BuildContext context, Map<String, String?> params,
@@ -122,11 +222,7 @@ class FinanceProvider extends ChangeNotifier { @@ -122,11 +222,7 @@ class FinanceProvider extends ChangeNotifier {
122 context, Method.post, HttpUrl.get_activity_config, 222 context, Method.post, HttpUrl.get_activity_config,
123 data: params, showLoading: isShowLoading); 223 data: params, showLoading: isShowLoading);
124 if (baseResp.code == Constant.status_success) { 224 if (baseResp.code == Constant.status_success) {
125 -  
126 - giftData =  
127 - LadderCouponsModel.fromJson(baseResp.responseData!).data;  
128 -  
129 - 225 + giftData = LadderCouponsModel.fromJson(baseResp.responseData!).data;
130 } else { 226 } else {
131 if (baseResp != null) { 227 if (baseResp != null) {
132 Utils.showToast(baseResp.msg ?? ""); 228 Utils.showToast(baseResp.msg ?? "");
@@ -222,6 +222,13 @@ class Utils { @@ -222,6 +222,13 @@ class Utils {
222 return reg.hasMatch(str); 222 return reg.hasMatch(str);
223 } 223 }
224 224
  225 + // 验证是否为11位电话号码
  226 + static bool is11PhoneS(String str) {
  227 + final reg = RegExp(r'^1[3-9]\d{9}$');
  228 + print('$str 是否11位电话号码:${reg.hasMatch(str)}');
  229 + return reg.hasMatch(str);
  230 + }
  231 +
225 //请求参数按key按ASCII排序key1=value1&key2=value2&...&keyN=valueN 232 //请求参数按key按ASCII排序key1=value1&key2=value2&...&keyN=valueN
226 static String keySort(Map<String, String?> oldParamsMap) { 233 static String keySort(Map<String, String?> oldParamsMap) {
227 List attrKeys = oldParamsMap.keys.toList(); 234 List attrKeys = oldParamsMap.keys.toList();