Showing
4 changed files
with
75 additions
and
35 deletions
| @@ -457,7 +457,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -457,7 +457,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 457 | addManager | 457 | addManager |
| 458 | ? Row( | 458 | ? Row( |
| 459 | children: [ | 459 | children: [ |
| 460 | - HEmptyView(72), | 460 | + HEmptyView(20), |
| 461 | ClipRRect( | 461 | ClipRRect( |
| 462 | borderRadius: BorderRadius.circular(r(35)), | 462 | borderRadius: BorderRadius.circular(r(35)), |
| 463 | child: Image.network( | 463 | child: Image.network( |
| @@ -476,8 +476,10 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -476,8 +476,10 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 476 | height: w(70), | 476 | height: w(70), |
| 477 | ), | 477 | ), |
| 478 | ), | 478 | ), |
| 479 | - Spacer(), | ||
| 480 | - Column( | 479 | + HEmptyView(20), |
| 480 | + // Spacer(), | ||
| 481 | + Expanded( | ||
| 482 | + child: Column( | ||
| 481 | crossAxisAlignment: CrossAxisAlignment.start, | 483 | crossAxisAlignment: CrossAxisAlignment.start, |
| 482 | children: [ | 484 | children: [ |
| 483 | Text( | 485 | Text( |
| @@ -496,8 +498,8 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -496,8 +498,8 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 496 | fontSize: font(12)), | 498 | fontSize: font(12)), |
| 497 | ), | 499 | ), |
| 498 | ], | 500 | ], |
| 499 | - ), | ||
| 500 | - HEmptyView(6), | 501 | + )), |
| 502 | + HEmptyView(10), | ||
| 501 | Column( | 503 | Column( |
| 502 | crossAxisAlignment: CrossAxisAlignment.start, | 504 | crossAxisAlignment: CrossAxisAlignment.start, |
| 503 | children: [ | 505 | children: [ |
| @@ -566,7 +568,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -566,7 +568,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 566 | fontWeight: FontWeight.bold, | 568 | fontWeight: FontWeight.bold, |
| 567 | fontSize: font(14))), | 569 | fontSize: font(14))), |
| 568 | VEmptyView(10), | 570 | VEmptyView(10), |
| 569 | - Text('${address??''}', | 571 | + Text('${address ?? ''}', |
| 570 | style: TextStyle( | 572 | style: TextStyle( |
| 571 | height: 1.3, | 573 | height: 1.3, |
| 572 | color: MyColours.color_000000, | 574 | color: MyColours.color_000000, |
| @@ -992,17 +992,17 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -992,17 +992,17 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 992 | onTap: () async { | 992 | onTap: () async { |
| 993 | if (Utils.getAuthority( | 993 | if (Utils.getAuthority( |
| 994 | context, '店铺信息')) { | 994 | context, '店铺信息')) { |
| 995 | - Map image = await NavigatorUtil | 995 | + await NavigatorUtil |
| 996 | .goStoreBaseInfoPage(context); | 996 | .goStoreBaseInfoPage(context); |
| 997 | - print(image['image']); | ||
| 998 | - UserModel userModel = | ||
| 999 | - Provider.of<UserModel>(context, | ||
| 1000 | - listen: false); | ||
| 1001 | - User user = userModel.user; | ||
| 1002 | - user.sellerimage = image['image']; | ||
| 1003 | - await App.sp.setString('user', | ||
| 1004 | - json.encode(user.toJson())); | ||
| 1005 | - print(userModel.user); | 997 | + // print(image['image']); |
| 998 | + // UserModel userModel = | ||
| 999 | + // Provider.of<UserModel>(context, | ||
| 1000 | + // listen: false); | ||
| 1001 | + // User user = userModel.user; | ||
| 1002 | + // user.sellerimage = image['image']; | ||
| 1003 | + // await App.sp.setString('user', | ||
| 1004 | + // json.encode(user.toJson())); | ||
| 1005 | + // print(userModel.user); | ||
| 1006 | setState(() {}); | 1006 | setState(() {}); |
| 1007 | } | 1007 | } |
| 1008 | }, | 1008 | }, |
| 1 | +import 'dart:convert'; | ||
| 1 | import 'dart:io'; | 2 | import 'dart:io'; |
| 2 | import 'dart:ui'; | 3 | import 'dart:ui'; |
| 3 | 4 | ||
| @@ -111,13 +112,13 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | @@ -111,13 +112,13 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | ||
| 111 | // bool success = | 112 | // bool success = |
| 112 | // await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); | 113 | // await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); |
| 113 | // if (success) { | 114 | // if (success) { |
| 114 | - _nameController.text = widget.sunModel.nickName??''; | ||
| 115 | - nameStr = widget.sunModel.nickName??""; | 115 | + _nameController.text = widget.sunModel.nickName ?? ''; |
| 116 | + nameStr = widget.sunModel.nickName ?? ""; | ||
| 116 | // _uploadImageProvider.touxiang.qiniuUrl = | 117 | // _uploadImageProvider.touxiang.qiniuUrl = |
| 117 | // _baseIndoProvider.baseInfoSunModel.photo; | 118 | // _baseIndoProvider.baseInfoSunModel.photo; |
| 118 | // _uploadImageProvider.erweima.qiniuUrl = | 119 | // _uploadImageProvider.erweima.qiniuUrl = |
| 119 | // _baseIndoProvider.baseInfoSunModel.qrcode; | 120 | // _baseIndoProvider.baseInfoSunModel.qrcode; |
| 120 | - _phoneController.text = widget.sunModel.phone??""; | 121 | + _phoneController.text = widget.sunModel.phone ?? ""; |
| 121 | phoneStr = widget.sunModel.phone ?? ''; | 122 | phoneStr = widget.sunModel.phone ?? ''; |
| 122 | // _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; | 123 | // _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; |
| 123 | // if (_baseIndoProvider.baseInfoSunModel.wechat != null && | 124 | // if (_baseIndoProvider.baseInfoSunModel.wechat != null && |
| @@ -671,7 +672,7 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | @@ -671,7 +672,7 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | ||
| 671 | ScreenUtil().setWidth(40), | 672 | ScreenUtil().setWidth(40), |
| 672 | ScreenUtil().setWidth(56)), | 673 | ScreenUtil().setWidth(56)), |
| 673 | child: RoundButton( | 674 | child: RoundButton( |
| 674 | - onPressed: () { | 675 | + onPressed: () async { |
| 675 | if (_phoneController.text.trim().length == | 676 | if (_phoneController.text.trim().length == |
| 676 | 0 || | 677 | 0 || |
| 677 | _nameController.text.trim().length == 0) { | 678 | _nameController.text.trim().length == 0) { |
| @@ -685,7 +686,7 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | @@ -685,7 +686,7 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | ||
| 685 | Future.wait<bool>([ | 686 | Future.wait<bool>([ |
| 686 | _editAuthUser(nameTemp), | 687 | _editAuthUser(nameTemp), |
| 687 | _bindPhoneSellerUser(phoneTemp) | 688 | _bindPhoneSellerUser(phoneTemp) |
| 688 | - ]).then((results) { | 689 | + ]).then((results) async { |
| 689 | print(results[0]); | 690 | print(results[0]); |
| 690 | if (results[0] && results[1]) { | 691 | if (results[0] && results[1]) { |
| 691 | //成功 | 692 | //成功 |
| @@ -693,6 +694,23 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | @@ -693,6 +694,23 @@ class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | ||
| 693 | EventBus() | 694 | EventBus() |
| 694 | .emit('personnel_manage_detail_page'); | 695 | .emit('personnel_manage_detail_page'); |
| 695 | Navigator.pop(context); | 696 | Navigator.pop(context); |
| 697 | + if (widget.sunModel.id == | ||
| 698 | + Provider.of<UserModel>(context, | ||
| 699 | + listen: false) | ||
| 700 | + .user | ||
| 701 | + .openid && | ||
| 702 | + App.sp.containsKey('user')) { | ||
| 703 | + String s = App.sp.getString('user'); | ||
| 704 | + User _user = | ||
| 705 | + User.fromJson(json.decode(s)); | ||
| 706 | + | ||
| 707 | + _user.userphone = phoneTemp; | ||
| 708 | + _user.nickName = nameTemp; | ||
| 709 | + | ||
| 710 | + // print(userModel.user); | ||
| 711 | + | ||
| 712 | + await UserModel().saveUserInfo(_user); | ||
| 713 | + } | ||
| 696 | } else { | 714 | } else { |
| 697 | if (!results[0]) { | 715 | if (!results[0]) { |
| 698 | Utils.showToast('修改姓名失败'); | 716 | Utils.showToast('修改姓名失败'); |
| @@ -37,6 +37,8 @@ import 'package:image_picker/image_picker.dart'; | @@ -37,6 +37,8 @@ import 'package:image_picker/image_picker.dart'; | ||
| 37 | import 'package:permission_handler/permission_handler.dart'; | 37 | import 'package:permission_handler/permission_handler.dart'; |
| 38 | import 'package:provider/provider.dart'; | 38 | import 'package:provider/provider.dart'; |
| 39 | 39 | ||
| 40 | +import '../../app.dart'; | ||
| 41 | + | ||
| 40 | class StoreBaseInfoPage extends StatefulWidget { | 42 | class StoreBaseInfoPage extends StatefulWidget { |
| 41 | StoreBaseInfoPage({Key key}) : super(key: key); | 43 | StoreBaseInfoPage({Key key}) : super(key: key); |
| 42 | 44 | ||
| @@ -426,16 +428,37 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -426,16 +428,37 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 426 | SetSellerInfoSunModel sunModel = | 428 | SetSellerInfoSunModel sunModel = |
| 427 | await _baseIndoProvider.setSellerInfoById(context, formData); | 429 | await _baseIndoProvider.setSellerInfoById(context, formData); |
| 428 | if (sunModel != null) { | 430 | if (sunModel != null) { |
| 429 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 430 | - userModel.user.morning = morningStr; | ||
| 431 | - userModel.user.noon = noonStr; | ||
| 432 | - userModel.user.night = nightStr; | ||
| 433 | - userModel.user.sellername = _nameController.text; | ||
| 434 | - userModel.user.sellerphone = | ||
| 435 | - _phoneController.text + ',' + _phoneController2.text; | ||
| 436 | - userModel.user.sellerAddr = _addressController.text; | 431 | + // UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 432 | + // userModel.user.morning = morningStr; | ||
| 433 | + // userModel.user.noon = noonStr; | ||
| 434 | + // userModel.user.night = nightStr; | ||
| 435 | + // userModel.user.sellername = _nameController.text; | ||
| 436 | + // userModel.user.sellerphone = | ||
| 437 | + // _phoneController.text + ',' + _phoneController2.text; | ||
| 438 | + // userModel.user.sellerAddr = _addressController.text; | ||
| 439 | + | ||
| 440 | + // print(userModel.user); | ||
| 441 | + | ||
| 442 | + if (App.sp.containsKey('user')) { | ||
| 443 | + String s = App.sp.getString('user'); | ||
| 444 | + User _user = User.fromJson(json.decode(s)); | ||
| 445 | + | ||
| 446 | + _user.morning = morningStr; | ||
| 447 | + _user.noon = noonStr; | ||
| 448 | + _user.night = nightStr; | ||
| 449 | + _user.sellername = _nameController.text; | ||
| 450 | + _user.sellerphone = params['seller_tel']; | ||
| 451 | + _user.sellerAddr = _addressController.text; | ||
| 452 | + | ||
| 453 | + if (_uploadImageProvider.mentou.path != null && | ||
| 454 | + _uploadImageProvider.mentou.path != '') { | ||
| 455 | + _user.sellerimage = _uploadImageProvider.mentou.qiniuUrl; | ||
| 456 | + } | ||
| 437 | 457 | ||
| 438 | - print(userModel.user); | 458 | + // print(userModel.user); |
| 459 | + | ||
| 460 | + await UserModel().saveUserInfo(_user); | ||
| 461 | + } | ||
| 439 | // morning = | 462 | // morning = |
| 440 | // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | 463 | // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; |
| 441 | // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | 464 | // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; |
| @@ -445,11 +468,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | @@ -445,11 +468,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 445 | Utils.showToast('保存店铺信息成功'); | 468 | Utils.showToast('保存店铺信息成功'); |
| 446 | EventBus().emit('changeStatusColor'); | 469 | EventBus().emit('changeStatusColor'); |
| 447 | Navigator.pop( | 470 | Navigator.pop( |
| 448 | - context, | ||
| 449 | - _uploadImageProvider.mentou.qiniuUrl != null && | ||
| 450 | - _uploadImageProvider.mentou.qiniuUrl != '' | ||
| 451 | - ? {'image': _uploadImageProvider.mentou.qiniuUrl} | ||
| 452 | - : {'image': ''}); | 471 | + context, |
| 472 | + ); | ||
| 453 | } else { | 473 | } else { |
| 454 | // Utils.showToast('保存失败'); | 474 | // Utils.showToast('保存失败'); |
| 455 | } | 475 | } |
-
Please register or login to post a comment