Commit 546171fa353fecf9b89ccc9b41466073c28b6c7d

Authored by weixin_45529955
1 parent a2d191a0

结构调整OK

@@ -245,7 +245,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -245,7 +245,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
245 create: (_) => UserModel(), 245 create: (_) => UserModel(),
246 child: ChangeNotifierProvider<PersonnelProvider>( 246 child: ChangeNotifierProvider<PersonnelProvider>(
247 create: (_) => PersonnelProvider(), 247 create: (_) => PersonnelProvider(),
248 - child: MyPage())))), 248 + child: ChangeNotifierProvider<BaseIndoProvider>(
  249 + create: (_) => BaseIndoProvider(),
  250 + child: MyPage()))))),
249 ))); 251 )));
250 WidgetsBinding.instance.addPostFrameCallback((_) async { 252 WidgetsBinding.instance.addPostFrameCallback((_) async {
251 // bus.on('refresh_token', (arg) { 253 // bus.on('refresh_token', (arg) {
@@ -1882,7 +1884,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -1882,7 +1884,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
1882 child: ChangeNotifierProvider< 1884 child: ChangeNotifierProvider<
1883 PersonnelProvider>( 1885 PersonnelProvider>(
1884 create: (_) => PersonnelProvider(), 1886 create: (_) => PersonnelProvider(),
1885 - child: MyPage())))), 1887 + child: ChangeNotifierProvider<
  1888 + BaseIndoProvider>(
  1889 + create: (_) => BaseIndoProvider(),
  1890 + child: MyPage()))))),
1886 ))); 1891 )));
1887 setState(() {}); 1892 setState(() {});
1888 } 1893 }
1 -  
2 import 'dart:async'; 1 import 'dart:async';
3 import 'dart:convert'; 2 import 'dart:convert';
4 import 'dart:io'; 3 import 'dart:io';
@@ -136,7 +135,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -136,7 +135,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
136 bool success = 135 bool success =
137 await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); 136 await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
138 if (success) { 137 if (success) {
139 - _nameController.text = _baseIndoProvider.baseInfoSunModel!.name??""; 138 + _nameController.text = _baseIndoProvider.baseInfoSunModel!.name ?? "";
140 nameStr = _baseIndoProvider.baseInfoSunModel!.name; 139 nameStr = _baseIndoProvider.baseInfoSunModel!.name;
141 _uploadImageProvider.touxiang.qiniuUrl = 140 _uploadImageProvider.touxiang.qiniuUrl =
142 _baseIndoProvider.baseInfoSunModel!.photo; 141 _baseIndoProvider.baseInfoSunModel!.photo;
@@ -145,9 +144,9 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -145,9 +144,9 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
145 _uploadImageProvider.erweima.qiniuUrl = 144 _uploadImageProvider.erweima.qiniuUrl =
146 _baseIndoProvider.baseInfoSunModel!.qrcode; 145 _baseIndoProvider.baseInfoSunModel!.qrcode;
147 _uploadImageProvider.erweima.process = 1; 146 _uploadImageProvider.erweima.process = 1;
148 - _phoneController.text = _baseIndoProvider.baseInfoSunModel!.phone??""; 147 + _phoneController.text = _baseIndoProvider.baseInfoSunModel!.phone ?? "";
149 phoneStr = _baseIndoProvider.baseInfoSunModel!.phone ?? ''; 148 phoneStr = _baseIndoProvider.baseInfoSunModel!.phone ?? '';
150 - _wechatController.text = _baseIndoProvider.baseInfoSunModel!.wechat??""; 149 + _wechatController.text = _baseIndoProvider.baseInfoSunModel!.wechat ?? "";
151 if (_baseIndoProvider.baseInfoSunModel!.wechat != null && 150 if (_baseIndoProvider.baseInfoSunModel!.wechat != null &&
152 _baseIndoProvider.baseInfoSunModel!.wechat != '' && 151 _baseIndoProvider.baseInfoSunModel!.wechat != '' &&
153 phoneStr != '' && 152 phoneStr != '' &&
@@ -156,7 +155,8 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -156,7 +155,8 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
156 } else { 155 } else {
157 isSelect = false; 156 isSelect = false;
158 } 157 }
159 - _positionController.text = _baseIndoProvider.baseInfoSunModel!.position??""; 158 + _positionController.text =
  159 + _baseIndoProvider.baseInfoSunModel!.position ?? "";
160 _uploadImageProvider.imgSizeErweima = 64; 160 _uploadImageProvider.imgSizeErweima = 64;
161 // setState(() {}); 161 // setState(() {});
162 _uploadImageProvider.notifyListeners(); 162 _uploadImageProvider.notifyListeners();
@@ -216,7 +216,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -216,7 +216,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
216 params['id'] = _baseIndoProvider.baseInfoSunModel!.id; 216 params['id'] = _baseIndoProvider.baseInfoSunModel!.id;
217 } 217 }
218 bool isSuccess = 218 bool isSuccess =
219 - await _baseIndoProvider.setCustomerActivityBaseinfo(context, params) ; 219 + await _baseIndoProvider.setCustomerActivityBaseinfo(context, params);
220 // _baseIndoProvider.baseInfoSunModel = null; 220 // _baseIndoProvider.baseInfoSunModel = null;
221 if (isSuccess) { 221 if (isSuccess) {
222 // imgAll和images 比较,挑出不一样的,删除七牛云 222 // imgAll和images 比较,挑出不一样的,删除七牛云
@@ -236,6 +236,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -236,6 +236,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
236 //成功之后跳回前一个页面 236 //成功之后跳回前一个页面
237 // bus.emit('refresh_coupon_list'); 237 // bus.emit('refresh_coupon_list');
238 Utils.showToast('保存成功'); 238 Utils.showToast('保存成功');
  239 + bus.emit('refreshMyImage');
239 if (App.sp!.containsKey('user')) { 240 if (App.sp!.containsKey('user')) {
240 String s = App.sp!.getString('user')!; 241 String s = App.sp!.getString('user')!;
241 User _user = User.fromJson(json.decode(s)); 242 User _user = User.fromJson(json.decode(s));
@@ -421,7 +422,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -421,7 +422,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
421 } 422 }
422 423
423 ///#相机拍照,单图选择 424 ///#相机拍照,单图选择
424 - Future _getFromPictureOrCamera( 425 + Future _getFromPictureOrCamera(
425 String title, UploadImgModel imgModel, imageSource) async { 426 String title, UploadImgModel imgModel, imageSource) async {
426 final pickedFile = await picker.pickImage(source: imageSource); 427 final pickedFile = await picker.pickImage(source: imageSource);
427 if (pickedFile != null) { 428 if (pickedFile != null) {
@@ -733,8 +734,10 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -733,8 +734,10 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
733 _uploadImageProvider.touxiang.qiniuUrl == 734 _uploadImageProvider.touxiang.qiniuUrl ==
734 'http://nosqn.colorcun.com/yd_person.png') { 735 'http://nosqn.colorcun.com/yd_person.png') {
735 } else { 736 } else {
736 - if (_uploadImageProvider.touxiang.process! < 1 &&  
737 - _uploadImageProvider.touxiang.process! > 0.01 && 737 + if (_uploadImageProvider.touxiang.process! <
  738 + 1 &&
  739 + _uploadImageProvider.touxiang.process! >
  740 + 0.01 &&
738 _uploadImageProvider.touxiang.qiniuUrl != 741 _uploadImageProvider.touxiang.qiniuUrl !=
739 '') { 742 '') {
740 Utils.showToast('正在上传图片,请稍等!'); 743 Utils.showToast('正在上传图片,请稍等!');
@@ -756,8 +759,8 @@ class _BaseInfoPageState extends State<BaseInfoPage> { @@ -756,8 +759,8 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
756 } 759 }
757 760
758 //接口 761 //接口
759 - JhCommonUtils.debounce(() => _setCustomerActivityBaseinfo(), 500);  
760 - 762 + JhCommonUtils.debounce(
  763 + () => _setCustomerActivityBaseinfo(), 500);
761 }, 764 },
762 text: '保存', 765 text: '保存',
763 fontSize: 34, 766 fontSize: 34,
@@ -73,7 +73,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -73,7 +73,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
73 } 73 }
74 } 74 }
75 75
76 - _getNewRechargeData() async { 76 + _getNewRechargeData() async {
77 (bool, bool) result = 77 (bool, bool) result =
78 await (_getNewRechargeList(), getSellerTemplateConf(context)).wait; 78 await (_getNewRechargeList(), getSellerTemplateConf(context)).wait;
79 79
@@ -83,6 +83,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -83,6 +83,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
83 marketingCenterProvider.rechargeList!.forEach((element) { 83 marketingCenterProvider.rechargeList!.forEach((element) {
84 if (element.id == rechargeData!.id) { 84 if (element.id == rechargeData!.id) {
85 element.isMarking = true; 85 element.isMarking = true;
  86 +
86 } 87 }
87 }); 88 });
88 } 89 }
@@ -11,6 +11,7 @@ import 'package:one_key/models/sms_info.dart'; @@ -11,6 +11,7 @@ import 'package:one_key/models/sms_info.dart';
11 import 'package:one_key/models/store_info.dart'; 11 import 'package:one_key/models/store_info.dart';
12 import 'package:one_key/models/user.dart'; 12 import 'package:one_key/models/user.dart';
13 import 'package:one_key/models/version.dart'; 13 import 'package:one_key/models/version.dart';
  14 +import 'package:one_key/provider/base_info_provider.dart';
14 import 'package:one_key/provider/create_store_model.dart'; 15 import 'package:one_key/provider/create_store_model.dart';
15 import 'package:one_key/provider/my_model.dart'; 16 import 'package:one_key/provider/my_model.dart';
16 import 'package:one_key/provider/update_model.dart'; 17 import 'package:one_key/provider/update_model.dart';
@@ -63,6 +64,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -63,6 +64,10 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
63 late CollectStoreProvider collectStoreProvider; 64 late CollectStoreProvider collectStoreProvider;
64 bool isStoreWine = false; 65 bool isStoreWine = false;
65 66
  67 + late BaseIndoProvider _baseIndoProvider;
  68 +
  69 + String? selfImage;
  70 +
66 @override 71 @override
67 void initState() { 72 void initState() {
68 // TODO: implement initState 73 // TODO: implement initState
@@ -107,6 +112,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -107,6 +112,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
107 '迎宾') { 112 '迎宾') {
108 _getAuthUserLists(showLoading: false); 113 _getAuthUserLists(showLoading: false);
109 } 114 }
  115 + _getCustomerActivityBaseinfo();
110 getMyPageCountData(); 116 getMyPageCountData();
111 117
112 ///apk版本检测 118 ///apk版本检测
@@ -120,6 +126,12 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -120,6 +126,12 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
120 _getSmsInfo(context); 126 _getSmsInfo(context);
121 // getMyPageCountData(); 127 // getMyPageCountData();
122 }); 128 });
  129 +
  130 + EventBus().on('refreshMyImage', (arg) {
  131 + // _getSmsInfo(context);
  132 + _getCustomerActivityBaseinfo();
  133 + // getMyPageCountData();
  134 + });
123 } 135 }
124 136
125 @override 137 @override
@@ -129,6 +141,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -129,6 +141,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
129 // AzhonAppUpdate.dispose(); 141 // AzhonAppUpdate.dispose();
130 EventBus().off('changeStatusColor'); 142 EventBus().off('changeStatusColor');
131 EventBus().off('refreshMySms'); 143 EventBus().off('refreshMySms');
  144 +
  145 + EventBus().off('refreshMyImage');
132 } 146 }
133 147
134 @override 148 @override
@@ -184,6 +198,19 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -184,6 +198,19 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
184 // } 198 // }
185 // } 199 // }
186 200
  201 + _getCustomerActivityBaseinfo() async {
  202 + Map<String, String?> params = {
  203 + 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
  204 + "uid": Provider.of<UserModel>(context, listen: false).user!.openid,
  205 + };
  206 +
  207 + bool success =
  208 + await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
  209 + if (success) {
  210 + selfImage = _baseIndoProvider.baseInfoSunModel!.photo;
  211 + }
  212 + }
  213 +
187 //获取员工信息列表 214 //获取员工信息列表
188 _getAuthUserLists({bool showLoading = true}) async { 215 _getAuthUserLists({bool showLoading = true}) async {
189 Map<String, String?> params = { 216 Map<String, String?> params = {
@@ -489,6 +516,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -489,6 +516,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
489 createStoreModel = Provider.of<CreateStoreModel>(context, listen: false); 516 createStoreModel = Provider.of<CreateStoreModel>(context, listen: false);
490 collectStoreProvider = 517 collectStoreProvider =
491 Provider.of<CollectStoreProvider>(context, listen: true); 518 Provider.of<CollectStoreProvider>(context, listen: true);
  519 +
  520 + _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
492 return Scaffold( 521 return Scaffold(
493 backgroundColor: MyColours.color_f3f3f3, 522 backgroundColor: MyColours.color_f3f3f3,
494 // appBar: AppBar( 523 // appBar: AppBar(
@@ -534,86 +563,125 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -534,86 +563,125 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
534 child: Row( 563 child: Row(
535 crossAxisAlignment: CrossAxisAlignment.center, 564 crossAxisAlignment: CrossAxisAlignment.center,
536 children: [ 565 children: [
537 - Column(  
538 - crossAxisAlignment: CrossAxisAlignment.start,  
539 - mainAxisAlignment: MainAxisAlignment.center,  
540 - children: [  
541 - Padding(  
542 - padding: EdgeInsets.only(left: w(13)),  
543 - child: model.user!.sellerimage ==  
544 - null ||  
545 - model.user!.sellerimage == ''  
546 - ? Image.asset(  
547 - Utils.getImgPath('base_tx_bg'),  
548 - fit: BoxFit.cover,  
549 - width: ScreenUtil()  
550 - .setWidth(44 * 2),  
551 - height: ScreenUtil()  
552 - .setWidth(44 * 2),  
553 - )  
554 - : Container(  
555 - width: w(44),  
556 - height: w(44),  
557 - decoration: BoxDecoration(  
558 - border: Border.all(  
559 - width: w(2),  
560 - color: Colors.white),  
561 - borderRadius:  
562 - BorderRadius.all(Radius  
563 - .circular(r(44))),  
564 - image: DecorationImage(  
565 - image: NetworkImage(model  
566 - .user!.sellerimage!),  
567 - )))),  
568 - VEmptyView(8),  
569 - Container(  
570 - constraints: BoxConstraints(  
571 - maxWidth: ScreenUtil().setWidth(400),  
572 - ),  
573 - child: Text(  
574 - '杨经理 店长 >',  
575 - maxLines: 1,  
576 - overflow: TextOverflow.ellipsis,  
577 - style: TextStyle(  
578 - letterSpacing: 0.2,  
579 - fontWeight: FontWeight.w600,  
580 - color: MyColours.color_ffffff,  
581 - fontSize: ScreenUtil().setSp(24)),  
582 - ),  
583 - ),  
584 - VEmptyView(8),  
585 - Text(  
586 - '员工编号:' +  
587 - model.user!.account! +  
588 - " " +  
589 - (model.user!.role_name_addition ??  
590 - ''),  
591 - style: TextStyle(  
592 - fontWeight: FontWeight.bold,  
593 - color: MyColours.color_ffffff,  
594 - fontSize: font(10)),  
595 - ),  
596 - ],  
597 - ), 566 + InkWell(
  567 + onTap: () {
  568 + if (outDay == '0') {
  569 + return;
  570 + }
  571 +
  572 + if (Utils.getAuthority(context, '个人信息')) {
  573 + NavigatorUtil.goBaseInfoPage(
  574 + context, FromPage.FromPageMyPage);
  575 + }
  576 + },
  577 + child: Column(
  578 + crossAxisAlignment:
  579 + CrossAxisAlignment.start,
  580 + mainAxisAlignment:
  581 + MainAxisAlignment.center,
  582 + children: [
  583 + Padding(
  584 + padding:
  585 + EdgeInsets.only(left: w(13)),
  586 + child: selfImage == null ||
  587 + selfImage == ''
  588 + ? Image.asset(
  589 + Utils.getImgPath(
  590 + 'base_tx_bg'),
  591 + fit: BoxFit.cover,
  592 + width: ScreenUtil()
  593 + .setWidth(44 * 2),
  594 + height: ScreenUtil()
  595 + .setWidth(44 * 2),
  596 + )
  597 + : Container(
  598 + width: w(44),
  599 + height: w(44),
  600 + decoration: BoxDecoration(
  601 + border: Border.all(
  602 + width: w(2),
  603 + color:
  604 + Colors.white),
  605 + borderRadius:
  606 + BorderRadius.all(
  607 + Radius.circular(
  608 + r(44))),
  609 + image: DecorationImage(
  610 + fit: BoxFit.cover,
  611 + image: NetworkImage(
  612 + selfImage!),
  613 + )))),
  614 + VEmptyView(8),
  615 + Container(
  616 + constraints: BoxConstraints(
  617 + maxWidth:
  618 + ScreenUtil().setWidth(400),
  619 + ),
  620 + child: Text(
  621 + '${model.user!.nickName} ${model.user!.role_name_addition} >',
  622 + maxLines: 1,
  623 + overflow: TextOverflow.ellipsis,
  624 + style: TextStyle(
  625 + letterSpacing: 0.2,
  626 + fontWeight: FontWeight.w600,
  627 + color: MyColours.color_ffffff,
  628 + fontSize:
  629 + ScreenUtil().setSp(24)),
  630 + ),
  631 + ),
  632 + VEmptyView(8),
  633 + Text(
  634 + '员工编号:' + model.user!.account!,
  635 + style: TextStyle(
  636 + fontWeight: FontWeight.bold,
  637 + color: MyColours.color_ffffff,
  638 + fontSize: font(10)),
  639 + ),
  640 + ],
  641 + )),
598 HEmptyView(22), 642 HEmptyView(22),
599 Spacer(), 643 Spacer(),
600 Column( 644 Column(
601 crossAxisAlignment: CrossAxisAlignment.end, 645 crossAxisAlignment: CrossAxisAlignment.end,
602 mainAxisAlignment: MainAxisAlignment.center, 646 mainAxisAlignment: MainAxisAlignment.center,
603 children: [ 647 children: [
604 - Container(  
605 - child: Text(  
606 - '${model.user!.sellername} >',  
607 - maxLines: 1,  
608 - overflow: TextOverflow.ellipsis,  
609 - style: TextStyle(  
610 - letterSpacing: 0.2,  
611 - fontWeight: FontWeight.w600,  
612 - color: MyColours.color_ffffff,  
613 - fontSize: ScreenUtil().setSp(32)),  
614 - ),  
615 - ),  
616 - VEmptyView(12), 648 + InkWell(
  649 + onTap: () async {
  650 + //
  651 + if (outDay == '0') {
  652 + return;
  653 + }
  654 + if (Utils.getAuthority(
  655 + context, '店铺信息')) {
  656 + await NavigatorUtil
  657 + .goStoreBaseInfoPage(context);
  658 + // print(image['image']);
  659 + // UserModel userModel =
  660 + // Provider.of<UserModel>(context,
  661 + // listen: false);
  662 + // User user = userModel.user;
  663 + // user.sellerimage = image['image'];
  664 + // await App.sp.setString('user',
  665 + // json.encode(user.toJson()));
  666 + // print(userModel.user);
  667 + setState(() {});
  668 + }
  669 + },
  670 + child: Container(
  671 + padding:
  672 + EdgeInsets.only(bottom: w(6)),
  673 + child: Text(
  674 + '${model.user!.sellername} >',
  675 + maxLines: 1,
  676 + overflow: TextOverflow.ellipsis,
  677 + style: TextStyle(
  678 + letterSpacing: 0.2,
  679 + fontWeight: FontWeight.w600,
  680 + color: MyColours.color_ffffff,
  681 + fontSize:
  682 + ScreenUtil().setSp(32)),
  683 + ),
  684 + )),
617 Text( 685 Text(
618 '店铺编号:' + 686 '店铺编号:' +
619 model.user!.sellerid!.padLeft(6, '0'), 687 model.user!.sellerid!.padLeft(6, '0'),