enterprise_information_upload_page.dart 19.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
import 'package:cached_network_image/cached_network_image.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_picker_plus/picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';

import '../../../models/upload_img_model.dart';
import '../../../provider/finance_provider.dart';
import '../../../provider/upload_img_provider.dart';
import '../../../res/colors.dart';
import '../../../utils/dialog_util.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/upload_image_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/round_button.dart';
import '../../../widgets/v_empty_view.dart';
import '../../online_check/img_picker_widget.dart';
import '../marketing_center/book_notification/img_picker_invitation_widget.dart';

/**
 * 企业资料上传
 */

class EnterpriseInformationUploadPage extends StatefulWidget {
  const EnterpriseInformationUploadPage({super.key});

  @override
  State<EnterpriseInformationUploadPage> createState() =>
      _EnterpriseInformationUploadPageState();
}

class _EnterpriseInformationUploadPageState
    extends State<EnterpriseInformationUploadPage> {
  String stime = '点击选择营业执照开始日期';
  String etime = '点击选择营业执照结束日期';
  ScrollController _controller = ScrollController();
  late UploadImageProvider _uploadImageProvider;
  late FinanceProvider financeProvider;

  final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((_) {
      _getQiniuInfo();
    });
  }

  @override
  void dispose() {
    _uploadImageProvider.storeImage1 = UploadImgModel();
    _uploadImageProvider.storeImage2 = UploadImgModel();

    super.dispose();
  }

  ///获取七牛云token
  ///
  _getQiniuInfo() async {
    await _uploadImageProvider.getQiniuInfo(context, {});
  }

  Widget _title(String title) {
    return Padding(
      padding: EdgeInsets.only(left: w(16), top: w(10), bottom: w(10)),
      child: Text(
        title,
        style: TextStyle(color: MyColours.color_515151, fontSize: font(16)),
      ),
    );
  }

  Widget _inputWidget(String title, TextEditingController controller,
      FocusNode focusNode, String hintText,
      {num width = 40}) {
    return Container(
      margin: EdgeInsets.only(left: w(width)),
      padding: EdgeInsets.only(top: w(10), bottom: w(10), right: w(16)),
      decoration: BoxDecoration(
          border: Border(
              bottom:
                  BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
      child: Row(
        children: [
          Text(
            title,
            style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
          ),
          HEmptyView(10),
          Expanded(
            child: TextField(
                controller: controller,
                textAlign: TextAlign.right,
                textAlignVertical: TextAlignVertical.center,
                maxLines: 1,
                // //光标颜色
                // cursorColor:
                //     widget.isSelect ? Colors.white : MyColours.color_199095,
                //输入文本的样式
                inputFormatters: [
                  // FilteringTextInputFormatter.allow(RegExp("[0-9.]")),
                ], // 限制输入为数字,
                style: TextStyle(
                  color: MyColours.color_515151,
                  fontSize: ScreenUtil().setSp(24),
                ),
                focusNode: focusNode,
                decoration: InputDecoration(
                  isCollapsed: true,
                  border: OutlineInputBorder(borderSide: BorderSide.none),
                  hintText: hintText,
                  hintStyle: TextStyle(
                    color: MyColours.color_999999,
                    fontSize: ScreenUtil().setSp(24),
                  ),
                  enabledBorder: new UnderlineInputBorder(
                    borderSide: BorderSide.none,
                  ),
                  focusedBorder: new UnderlineInputBorder(
                    borderSide: BorderSide.none,
                  ),
                ),
                onChanged: (value) {},
                onEditingComplete: () {
                  FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
                },
                keyboardType: TextInputType.numberWithOptions()),
          ),
        ],
      ),
    );
  }

  ///是否立即启用
  Widget _canUse(
    String title,
    bool swich,
    GestureTapCallback onTap,
  ) {
    return InkWell(
      onTap: onTap,
      child: Container(
        margin: EdgeInsets.only(left: w(40)),
        padding: EdgeInsets.only(top: w(10), bottom: w(10), right: w(16)),
        decoration: BoxDecoration(
            border: Border(
                bottom:
                    BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              // height: ScreenUtil().setWidth(40),
              // color: Colors.red,
              child: Text(
                title,
                style: TextStyle(
                    color: MyColours.color_515151,
                    fontWeight: FontWeight.normal,
                    fontSize: font(14)),
              ),
            ),
            Spacer(),
            Image.asset(
              swich
                  ? Utils.getImgPath('swich_on_lit')
                  : Utils.getImgPath('swich_off_lit'),
              width: ScreenUtil().setWidth(44 * 2),
            )
          ],
        ),
      ),
    );
  }

  ///时间选择
  Widget _select(String title, String hintText, GestureTapCallback onTap) {
    return InkWell(
      onTap: onTap,
      child: Container(
        margin: EdgeInsets.only(left: w(40)),
        padding: EdgeInsets.only(top: w(10), bottom: w(10), right: w(16)),
        decoration: BoxDecoration(
            border: Border(
                bottom:
                    BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              // height: ScreenUtil().setWidth(40),
              // color: Colors.red,
              child: Text(
                title,
                style: TextStyle(
                    color: MyColours.color_515151, fontSize: font(14)),
              ),
            ),
            HEmptyView(20),
            Spacer(),
            Text(hintText,
                style: TextStyle(
                  color: hintText == '点击选择营业执照开始日期' ||
                          hintText == '点击选择营业执照结束日期' ||
                          hintText == '点击选择开户银行'
                      ? MyColours.color_999999
                      : MyColours.color_515151,
                  fontSize: font(12),
                )),
            HEmptyView(8),
            Image.asset(
              Utils.getImgPath('arrow_right_new'),
              width: w(7),
            ),
          ],
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    _uploadImageProvider =
        Provider.of<UploadImageProvider>(context, listen: false);
    financeProvider = Provider.of<FinanceProvider>(context, listen: false);
    return Scaffold(
      backgroundColor: MyColours.color_ffffff,
      key: scaffoldKey,
      appBar: SystemAppBar('资料上传'),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Expanded(
              child: SingleChildScrollView(
            controller: _controller,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                _title('营业执照信息'),
                Container(
                  padding:
                      EdgeInsets.only(top: w(8), bottom: w(8), right: w(16)),
                  margin: EdgeInsets.only(left: w(40)),
                  decoration: BoxDecoration(
                      border: Border(
                          bottom: BorderSide(
                              width: w(0.5), color: MyColours.color_E7E7E7))),
                  child: Row(
                    children: [
                      Text(
                        '企业/个体户选择',
                        style: TextStyle(
                            color: MyColours.color_515151, fontSize: font(14)),
                      ),
                      Spacer(),
                      Container(
                        // width: w(100),
                        // height: w(30),
                        padding: EdgeInsets.symmetric(
                            horizontal: w(10), vertical: w(5)),
                        decoration: BoxDecoration(
                            color: MyColours.color_438E93,
                            borderRadius: BorderRadius.only(
                                topLeft: Radius.circular(r(5)),
                                bottomLeft: Radius.circular(r(5)))),
                        child: Text(
                          '企业',
                          style: TextStyle(
                              color: MyColours.color_ffffff,
                              fontSize: font(14)),
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(
                            horizontal: w(10), vertical: w(5)),
                        decoration: BoxDecoration(
                            color: MyColours.color_DBDBDB,
                            borderRadius: BorderRadius.only(
                                topRight: Radius.circular(r(5)),
                                bottomRight: Radius.circular(r(5)))),
                        child: Text(
                          '个体',
                          style: TextStyle(
                              color: MyColours.color_438E93,
                              fontSize: font(14)),
                        ),
                      )
                    ],
                  ),
                ),
                _inputWidget(
                    '注册号', TextEditingController(), FocusNode(), '点击输入营业执照注册号'),
                _inputWidget('注册名称', TextEditingController(), FocusNode(),
                    '点击输入营业执照上的企业名称'),
                _select('营业执照开始于', stime, () {
                  FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
                  //弹出时间选择器

                  DialogUtil.showPickerDateTime24(
                      context,
                      scaffoldKey,
                      (value) {
                        // {'text': picker.adapter.text, 'select': selecteds}
                        if (value != null) {
                          setState(() {
                            print(value);
                            stime = DateUtil.formatDateStr(value,
                                format: DateFormats.y_mo_d);
                          });
                        }
                        // showDateSelWidget = false;
                      },
                      dateTime: stime == '点击选择营业执照开始日期'
                          ? null
                          : DateUtil.getDateTime(stime),
                      pickerDateTimeType: PickerDateTimeType.kYMD,
                      onCancel: () {
                        // showDateSelWidget = false;
                      });
                }),
                _canUse('营业期限长期有效', true, () {}),
                _select(
                  '营业执照结束于',
                  etime,
                  () {
                    FocusScope.of(context)
                        .requestFocus(FocusNode()); //点击空白处隐藏键盘
                    //弹出时间选择器

                    DialogUtil.showPickerDateTime24(
                        context,
                        scaffoldKey,
                        (value) {
                          // {'text': picker.adapter.text, 'select': selecteds}
                          if (value != null) {
                            setState(() {
                              print(value);
                              etime = DateUtil.formatDateStr(value,
                                  format: DateFormats.y_mo_d);
                            });
                          }
                          // showDateSelWidget = false;
                        },
                        dateTime: etime == '点击选择营业执照结束日期'
                            ? null
                            : DateUtil.getDateTime(etime),
                        pickerDateTimeType: PickerDateTimeType.kYMD,
                        onCancel: () {
                          // showDateSelWidget = false;
                        });
                  },
                ),
                _inputWidget('经营者/法人姓名', TextEditingController(), FocusNode(),
                    '点击输入经营者/法人姓名'),
                _inputWidget(
                    '注册地址', TextEditingController(), FocusNode(), '点击输入注册地址'),
                Consumer<UploadImageProvider>(builder: (context, model, _) {
                  return Padding(
                      padding: EdgeInsets.only(
                          left: w(20), top: w(20), bottom: w(12)),
                      child: ImgPickerWidget(
                        scrollController: _controller,
                        model: model,
                        maxImageNumber: 1,
                        uploadType: UploadType.TableManagerType,
                        subTips: '营业执照照片',
                        deleteCallback: (int index) {
                          // _delTablePhoto(
                          //     context,
                          //     _uploadImageProvider.tableImageList[index].photoID,
                          //     index);
                        },
                        callback: () {
                          // for (UploadImgModel item
                          //     in _uploadImageProvider.tableImageList) {
                          //   if (item.process! < 1) {
                          //     Utils.showToast('正在上传图片,请稍等');
                          //     return;
                          //   }
                          // }
                          // //接口,和桌子绑定
                          // List imageQiniuUrlList = [];
                          // for (int i = 0;
                          //     i < _uploadImageProvider.tableImageList.length;
                          //     i++) {
                          //   if (!_uploadImageProvider.tableImageList[i].isUpload) {
                          //     imageQiniuUrlList.add({
                          //       "url":
                          //           _uploadImageProvider.tableImageList[i].qiniuUrl
                          //     });
                          //   }
                          // }
                          // _setTablePhoto(context, imageQiniuUrlList);
                        },
                      ));
                }),
                VEmptyView(24),
                _title('经营者/法人信息'),
                VEmptyView(20),
                _inputWidget('法人身份证号码', TextEditingController(), FocusNode(),
                    '点击输入法人身份证号码'),
                _inputWidget('法人身份证住址', TextEditingController(), FocusNode(),
                    '点击输入法人身份证住址'),
                _inputWidget(
                    '电话', TextEditingController(), FocusNode(), '点击输入法人电话号码'),
                _inputWidget('邮箱', TextEditingController(), FocusNode(),
                    '点击输入用来收取支付信息的邮箱'),
                Row(children: [
                  Padding(
                      padding: EdgeInsets.only(
                          left: w(20), top: w(20), bottom: w(12)),
                      child: ImgPickerInvitationWidget(
                        scrollController: _controller,
                        uploadType: UploadType.InvitationStoreType,
                        model: _uploadImageProvider,
                        index: 5,
                        imageModel: _uploadImageProvider.storeImage1,
                        subTips: '法人身份证人像页',
                        callback: () {},
                      )),
                  Padding(
                      padding: EdgeInsets.only(
                          left: w(20), top: w(20), bottom: w(12)),
                      child: ImgPickerInvitationWidget(
                        scrollController: _controller,
                        uploadType: UploadType.InvitationStoreType,
                        model: _uploadImageProvider,
                        index: 6,
                        imageModel: _uploadImageProvider.storeImage2,
                        subTips: '法人身份证国徽页',
                        callback: () {},
                      )),
                ]),
                _title('收款信息'),
                VEmptyView(20),
                _select('开户银行', '点击选择开户银行', () {
                  FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
                  //弹出开户银行
                }),
                _inputWidget('开户银行网点', TextEditingController(), FocusNode(),
                    '点击输入开户银行网点全称'),
                _inputWidget(
                    '银行账户', TextEditingController(), FocusNode(), '点击录入银行账户号'),
                _inputWidget('收款商户简称', TextEditingController(), FocusNode(),
                    '点击输入商户简称,用户支付时可见'),
                _inputWidget(
                    '服务电话', TextEditingController(), FocusNode(), '点击输入服务电话'),
                VEmptyView(44),
                Padding(
                  padding: EdgeInsets.only(left: w(16)),
                  child: Text(
                    '注:如果填写信息遇到问题,请联系400-000-9690解决。',
                    style: TextStyle(
                        fontSize: font(10), color: MyColours.color_515151),
                  ),
                ),
                VEmptyView(44),
              ],
            ),
          )),
          Container(
            padding: EdgeInsets.only(
                top: w(13), left: w(45), right: w(45), bottom: w(26)),
            child: RoundButton(
              text: '立即提交',
              height: w(43),
              radius: r(5),
              gradientStart: MyColours.color_438E93,
              gradientEnd: MyColours.color_438E93,
              borderColor: MyColours.color_438E93,
              textColor: MyColours.color_ffffff,
              isBold: true,
              fontSize: 32,
              onPressed: () {},
            ),
          )
        ],
      ),
    );
  }
}