Commit c4da864047e22fd241064ec08248448d05a64175

Authored by wdn127929
1 parent 2777354c

取消手机绑定,第一次建店跳转小程序

@@ -31,8 +31,8 @@ class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> { @@ -31,8 +31,8 @@ class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> {
31 Widget build(BuildContext context) { 31 Widget build(BuildContext context) {
32 CreateStoreModel createStoreModel = 32 CreateStoreModel createStoreModel =
33 Provider.of<CreateStoreModel>(context, listen: false); 33 Provider.of<CreateStoreModel>(context, listen: false);
34 - _controller.text = createStoreModel.storeInfo.addressDetail;  
35 - if (createStoreModel.storeInfo.address != null) { 34 + _controller.text = createStoreModel.storeInfo?.addressDetail;
  35 + if (createStoreModel.storeInfo?.address != null) {
36 storeAddress = createStoreModel.storeInfo.address; 36 storeAddress = createStoreModel.storeInfo.address;
37 } 37 }
38 38
@@ -72,10 +72,10 @@ class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> { @@ -72,10 +72,10 @@ class _EnterStoreAddressPageState extends State<EnterStoreAddressPage> {
72 if (address != null) { 72 if (address != null) {
73 setState(() { 73 setState(() {
74 storeAddress = address['address']; 74 storeAddress = address['address'];
75 - createStoreModel.storeInfo.address = 75 + createStoreModel.storeInfo?.address =
76 storeAddress; 76 storeAddress;
77 - createStoreModel.storeInfo.lat = address['lat'];  
78 - createStoreModel.storeInfo.lng = address['lng']; 77 + createStoreModel.storeInfo?.lat = address['lat'];
  78 + createStoreModel.storeInfo?.lng = address['lng'];
79 }); 79 });
80 } 80 }
81 }, Permission.location); 81 }, Permission.location);
@@ -3,6 +3,7 @@ import 'package:flutter_screenutil/screenutil.dart'; @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/screenutil.dart';
3 import 'package:one_key/provider/create_store_model.dart'; 3 import 'package:one_key/provider/create_store_model.dart';
4 import 'package:one_key/res/colors.dart'; 4 import 'package:one_key/res/colors.dart';
5 import 'package:one_key/route/navigator_util.dart'; 5 import 'package:one_key/route/navigator_util.dart';
  6 +import 'package:one_key/utils/event_bus.dart';
6 import 'package:one_key/widgets/round_button.dart'; 7 import 'package:one_key/widgets/round_button.dart';
7 import 'package:one_key/widgets/system_app_bar.dart'; 8 import 'package:one_key/widgets/system_app_bar.dart';
8 import 'package:one_key/widgets/v_empty_view.dart'; 9 import 'package:one_key/widgets/v_empty_view.dart';
@@ -28,88 +29,94 @@ class _EnterStoreNamePageState extends State<EnterStoreNamePage> { @@ -28,88 +29,94 @@ class _EnterStoreNamePageState extends State<EnterStoreNamePage> {
28 Widget build(BuildContext context) { 29 Widget build(BuildContext context) {
29 CreateStoreModel createStoreModel = 30 CreateStoreModel createStoreModel =
30 Provider.of<CreateStoreModel>(context, listen: false); 31 Provider.of<CreateStoreModel>(context, listen: false);
31 - _controller.text = createStoreModel.storeInfo.name; 32 + _controller.text = createStoreModel.storeInfo?.name;
32 return Scaffold( 33 return Scaffold(
33 backgroundColor: Colors.white, 34 backgroundColor: Colors.white,
34 appBar: SystemAppBar( 35 appBar: SystemAppBar(
35 '', 36 '',
36 onTap: () { 37 onTap: () {
  38 + EventBus().emit('refresh_store_list');
37 Navigator.pop(context); 39 Navigator.pop(context);
38 }, 40 },
39 ), 41 ),
40 - body: InkWell(  
41 - onTap: () {  
42 - FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 42 + body: WillPopScope(
  43 + onWillPop: () {
  44 + EventBus().emit('refresh_store_list');
  45 + Navigator.of(context).pop();
43 }, 46 },
44 - child: Container(  
45 - padding: EdgeInsets.symmetric(  
46 - horizontal: ScreenUtil().setWidth(70),  
47 - vertical: ScreenUtil().setWidth(60)),  
48 - child: SingleChildScrollView(  
49 - child: Column(  
50 - crossAxisAlignment: CrossAxisAlignment.start,  
51 - children: [  
52 - Text('您的店铺名称是?',  
53 - style: TextStyle( 47 + child: InkWell(
  48 + onTap: () {
  49 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  50 + },
  51 + child: Container(
  52 + padding: EdgeInsets.symmetric(
  53 + horizontal: ScreenUtil().setWidth(70),
  54 + vertical: ScreenUtil().setWidth(60)),
  55 + child: SingleChildScrollView(
  56 + child: Column(
  57 + crossAxisAlignment: CrossAxisAlignment.start,
  58 + children: [
  59 + Text('您的店铺名称是?',
  60 + style: TextStyle(
  61 + color: MyColours.color_333333,
  62 + fontSize: ScreenUtil().setSp(40),
  63 + fontWeight: FontWeight.bold)),
  64 + VEmptyView(100),
  65 + TextField(
  66 + controller: _controller,
  67 + // textAlignVertical: TextAlignVertical.bottom,
  68 + maxLines: 1,
  69 + // //光标颜色
  70 + // cursorColor:
  71 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  72 + //输入文本的样式
  73 + style: TextStyle(
54 color: MyColours.color_333333, 74 color: MyColours.color_333333,
55 - fontSize: ScreenUtil().setSp(40),  
56 - fontWeight: FontWeight.bold)),  
57 - VEmptyView(100),  
58 - TextField(  
59 - controller: _controller,  
60 - // textAlignVertical: TextAlignVertical.bottom,  
61 - maxLines: 1,  
62 - // //光标颜色  
63 - // cursorColor:  
64 - // widget.isSelect ? Colors.white : MyColours.color_199095,  
65 - //输入文本的样式  
66 - style: TextStyle(  
67 - color: MyColours.color_333333,  
68 - fontSize: ScreenUtil().setSp(28),  
69 - ),  
70 - // focusNode: _codeNode,  
71 - decoration: InputDecoration(  
72 - contentPadding: EdgeInsets.symmetric(  
73 - vertical: ScreenUtil().setWidth(32),  
74 - horizontal: ScreenUtil().setWidth(40)),  
75 - border: OutlineInputBorder(),  
76 - hintText: '请输入店铺名称',  
77 - hintStyle: TextStyle(  
78 - color: MyColours.color_999999,  
79 - fontSize: ScreenUtil().setSp(28), 75 + fontSize: ScreenUtil().setSp(28),
  76 + ),
  77 + // focusNode: _codeNode,
  78 + decoration: InputDecoration(
  79 + contentPadding: EdgeInsets.symmetric(
  80 + vertical: ScreenUtil().setWidth(32),
  81 + horizontal: ScreenUtil().setWidth(40)),
  82 + border: OutlineInputBorder(),
  83 + hintText: '请输入店铺名称',
  84 + hintStyle: TextStyle(
  85 + color: MyColours.color_999999,
  86 + fontSize: ScreenUtil().setSp(28),
  87 + ),
  88 + enabledBorder: OutlineInputBorder(
  89 + borderSide: BorderSide(
  90 + color: MyColours.color_bff6f7,
  91 + width: ScreenUtil().setWidth(2))),
  92 + focusedBorder: OutlineInputBorder(
  93 + borderSide: BorderSide(
  94 + color: MyColours.color_bff6f7,
  95 + width: ScreenUtil().setWidth(2))),
  96 + ),
  97 + onChanged: (value) {
  98 + createStoreModel.storeInfo.name = value;
  99 + },
  100 + onEditingComplete: () {
  101 + FocusScope.of(context)
  102 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  103 + },
  104 + keyboardType: TextInputType.text,
80 ), 105 ),
81 - enabledBorder: OutlineInputBorder(  
82 - borderSide: BorderSide(  
83 - color: MyColours.color_bff6f7,  
84 - width: ScreenUtil().setWidth(2))),  
85 - focusedBorder: OutlineInputBorder(  
86 - borderSide: BorderSide(  
87 - color: MyColours.color_bff6f7,  
88 - width: ScreenUtil().setWidth(2))),  
89 - ),  
90 - onChanged: (value) {  
91 - createStoreModel.storeInfo.name = value;  
92 - },  
93 - onEditingComplete: () {  
94 - FocusScope.of(context)  
95 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
96 - },  
97 - keyboardType: TextInputType.text,  
98 - ),  
99 - VEmptyView(160),  
100 - RoundButton(  
101 - text: '下一步',  
102 - gradientStart: MyColours.color_199095,  
103 - gradientEnd: MyColours.color_199095,  
104 - // borderColor: MyColours.color_999999,  
105 - radius: ScreenUtil().setWidth(20),  
106 - fontSize: 28,  
107 - isBold: false,  
108 - onPressed: () {  
109 - NavigatorUtil.goEnterStoreAddressPage(context);  
110 - },  
111 - )  
112 - ]))))); 106 + VEmptyView(160),
  107 + RoundButton(
  108 + text: '下一步',
  109 + gradientStart: MyColours.color_199095,
  110 + gradientEnd: MyColours.color_199095,
  111 + // borderColor: MyColours.color_999999,
  112 + radius: ScreenUtil().setWidth(20),
  113 + fontSize: 28,
  114 + isBold: false,
  115 + onPressed: () {
  116 + NavigatorUtil.goEnterStoreAddressPage(context);
  117 + },
  118 + )
  119 + ]))))));
113 ; 120 ;
114 } 121 }
115 } 122 }
@@ -34,27 +34,27 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> { @@ -34,27 +34,27 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> {
34 Provider.of<CreateStoreModel>(context, listen: false); 34 Provider.of<CreateStoreModel>(context, listen: false);
35 // UploadImageProvider uploadImageProvider = 35 // UploadImageProvider uploadImageProvider =
36 // Provider.of<UploadImageProvider>(context, listen: false); 36 // Provider.of<UploadImageProvider>(context, listen: false);
37 - if (createStoreModel.storeInfo.name == null ||  
38 - createStoreModel.storeInfo.name.trim().length == 0) { 37 + if (createStoreModel.storeInfo?.name == null ||
  38 + createStoreModel.storeInfo?.name.trim().length == 0) {
39 Utils.showToast('请填写店铺名称!'); 39 Utils.showToast('请填写店铺名称!');
40 return; 40 return;
41 } 41 }
42 - if (createStoreModel.storeInfo.address == null ||  
43 - createStoreModel.storeInfo.address.trim().length == 0) { 42 + if (createStoreModel.storeInfo?.address == null ||
  43 + createStoreModel.storeInfo?.address.trim().length == 0) {
44 Utils.showToast('请选择店铺地址!'); 44 Utils.showToast('请选择店铺地址!');
45 return; 45 return;
46 } 46 }
47 - if (createStoreModel.storeInfo.phone == null ||  
48 - createStoreModel.storeInfo.phone.trim().length == 0) { 47 + if (createStoreModel.storeInfo?.phone == null ||
  48 + createStoreModel.storeInfo?.phone.trim().length == 0) {
49 Utils.showToast('请填写店铺接单电话!'); 49 Utils.showToast('请填写店铺接单电话!');
50 return; 50 return;
51 } 51 }
52 Map<String, String> params = { 52 Map<String, String> params = {
53 - "name": createStoreModel.storeInfo.name,  
54 - "phone": createStoreModel.storeInfo.phone,  
55 - "map_address": createStoreModel.storeInfo.address,  
56 - "long": createStoreModel.storeInfo.lng.toString(),  
57 - "lat": createStoreModel.storeInfo.lat.toString(), 53 + "name": createStoreModel.storeInfo?.name,
  54 + "phone": createStoreModel.storeInfo?.phone,
  55 + "map_address": createStoreModel.storeInfo?.address,
  56 + "long": createStoreModel.storeInfo?.lng.toString(),
  57 + "lat": createStoreModel.storeInfo?.lat.toString(),
58 }; 58 };
59 // print(App.sp.getString("unionid")); 59 // print(App.sp.getString("unionid"));
60 // if (uploadImageProvider.imageListFront.length > 0) { 60 // if (uploadImageProvider.imageListFront.length > 0) {
@@ -106,7 +106,7 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> { @@ -106,7 +106,7 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> {
106 fontWeight: FontWeight.bold)), 106 fontWeight: FontWeight.bold)),
107 VEmptyView(100), 107 VEmptyView(100),
108 Consumer<CreateStoreModel>(builder: (context, model, _) { 108 Consumer<CreateStoreModel>(builder: (context, model, _) {
109 - _controller.text = model.storeInfo.phone; 109 + _controller.text = model.storeInfo?.phone;
110 return TextField( 110 return TextField(
111 // textAlignVertical: TextAlignVertical.bottom, 111 // textAlignVertical: TextAlignVertical.bottom,
112 maxLines: 1, 112 maxLines: 1,
@@ -140,7 +140,7 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> { @@ -140,7 +140,7 @@ class _EnterStorePhonePageState extends State<EnterStorePhonePage> {
140 width: ScreenUtil().setWidth(2))), 140 width: ScreenUtil().setWidth(2))),
141 ), 141 ),
142 onChanged: (value) { 142 onChanged: (value) {
143 - model.storeInfo.phone = value; 143 + model.storeInfo?.phone = value;
144 }, 144 },
145 onEditingComplete: () { 145 onEditingComplete: () {
146 FocusScope.of(context) 146 FocusScope.of(context)
@@ -28,7 +28,7 @@ class _EnterStorePositionPageState extends State<EnterStorePositionPage> { @@ -28,7 +28,7 @@ class _EnterStorePositionPageState extends State<EnterStorePositionPage> {
28 Widget build(BuildContext context) { 28 Widget build(BuildContext context) {
29 CreateStoreModel createStoreModel = 29 CreateStoreModel createStoreModel =
30 Provider.of<CreateStoreModel>(context, listen: false); 30 Provider.of<CreateStoreModel>(context, listen: false);
31 - _controller.text = createStoreModel.storeInfo.position; 31 + _controller.text = createStoreModel.storeInfo?.position;
32 return Scaffold( 32 return Scaffold(
33 backgroundColor: Colors.white, 33 backgroundColor: Colors.white,
34 appBar: SystemAppBar( 34 appBar: SystemAppBar(
@@ -89,7 +89,7 @@ class _EnterStorePositionPageState extends State<EnterStorePositionPage> { @@ -89,7 +89,7 @@ class _EnterStorePositionPageState extends State<EnterStorePositionPage> {
89 width: ScreenUtil().setWidth(2))), 89 width: ScreenUtil().setWidth(2))),
90 ), 90 ),
91 onChanged: (value) { 91 onChanged: (value) {
92 - createStoreModel.storeInfo.position = value; 92 + createStoreModel.storeInfo?.position = value;
93 }, 93 },
94 onEditingComplete: () { 94 onEditingComplete: () {
95 FocusScope.of(context) 95 FocusScope.of(context)
@@ -16,6 +16,7 @@ import 'package:one_key/provider/other_login_provider.dart'; @@ -16,6 +16,7 @@ import 'package:one_key/provider/other_login_provider.dart';
16 import 'package:one_key/provider/user_model.dart'; 16 import 'package:one_key/provider/user_model.dart';
17 import 'package:one_key/res/colors.dart'; 17 import 'package:one_key/res/colors.dart';
18 import 'package:one_key/route/navigator_util.dart'; 18 import 'package:one_key/route/navigator_util.dart';
  19 +import 'package:one_key/utils/event_bus.dart';
19 import 'package:one_key/utils/utils.dart'; 20 import 'package:one_key/utils/utils.dart';
20 import 'package:one_key/widgets/page_exception.dart'; 21 import 'package:one_key/widgets/page_exception.dart';
21 import 'package:one_key/widgets/round_button.dart'; 22 import 'package:one_key/widgets/round_button.dart';
@@ -43,12 +44,16 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> @@ -43,12 +44,16 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
43 WidgetsBinding.instance.addPostFrameCallback((_) { 44 WidgetsBinding.instance.addPostFrameCallback((_) {
44 _checkSellerAcc(); 45 _checkSellerAcc();
45 }); 46 });
  47 + bus.on("refresh_store_list", (arg) {
  48 + _checkSellerAcc();
  49 + });
46 } 50 }
47 51
48 @override 52 @override
49 void dispose() { 53 void dispose() {
50 super.dispose(); 54 super.dispose();
51 WidgetsBinding.instance.removeObserver(this); //销毁观察者 55 WidgetsBinding.instance.removeObserver(this); //销毁观察者
  56 + EventBus().emit('refresh_store_list');
52 } 57 }
53 58
54 @override 59 @override
@@ -79,7 +84,8 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> @@ -79,7 +84,8 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
79 CreateStoreModel createStoreModel = 84 CreateStoreModel createStoreModel =
80 Provider.of<CreateStoreModel>(context, listen: false); 85 Provider.of<CreateStoreModel>(context, listen: false);
81 Map<String, String> params = { 86 Map<String, String> params = {
82 - "phone": createStoreModel.storeInfo.phone, 87 + // "phone": createStoreModel.storeInfo.phone,
  88 + // "phone": '',
83 "unionid": App.sp.getString("unionid"), 89 "unionid": App.sp.getString("unionid"),
84 }; 90 };
85 await otherLoginProvider.checkSellerAcc(context, params, 91 await otherLoginProvider.checkSellerAcc(context, params,
@@ -156,15 +162,15 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> @@ -156,15 +162,15 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
156 VEmptyView(172), 162 VEmptyView(172),
157 InkWell( 163 InkWell(
158 onTap: () { 164 onTap: () {
159 - if (!App.sp.containsKey('openid') ||  
160 - App.sp.get("openid") == null ||  
161 - App.sp.get("openid") == '') {  
162 - //跳转小程序  
163 - Utils.goMiniProgramCreatePage(context);  
164 - } else {  
165 - //跳转至新建店铺流程  
166 - NavigatorUtil.goEnterStoreNamePage(context);  
167 - } 165 + // if (!App.sp.containsKey('openid') ||
  166 + // App.sp.get("openid") == null ||
  167 + // App.sp.get("openid") == '') {
  168 + //跳转小程序
  169 + Utils.goMiniProgramCreatePage(context);
  170 + // } else {
  171 + // //跳转至新建店铺流程
  172 + // NavigatorUtil.goEnterStoreNamePage(context);
  173 + // }
168 }, 174 },
169 child: Container( 175 child: Container(
170 width: double.infinity, 176 width: double.infinity,
@@ -232,16 +238,16 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> @@ -232,16 +238,16 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore>
232 if (index == model.sellerList.length) { 238 if (index == model.sellerList.length) {
233 return InkWell( 239 return InkWell(
234 onTap: () { 240 onTap: () {
235 - if (!App.sp.containsKey('openid') ||  
236 - App.sp.get("openid") == null ||  
237 - App.sp.get("openid") == '') {  
238 - //跳转小程序  
239 - Utils.goMiniProgramCreatePage(context);  
240 - } else {  
241 - //跳转至新建店铺流程  
242 - NavigatorUtil.goEnterStoreNamePage(  
243 - context);  
244 - } 241 + // if (!App.sp.containsKey('openid') ||
  242 + // App.sp.get("openid") == null ||
  243 + // App.sp.get("openid") == '') {
  244 + // //跳转小程序
  245 + // Utils.goMiniProgramCreatePage(context);
  246 + // } else {
  247 + //跳转至新建店铺流程
  248 + NavigatorUtil.goEnterStoreNamePage(
  249 + context);
  250 + // }
245 }, 251 },
246 child: DottedBorder( 252 child: DottedBorder(
247 dashPattern: [5, 5, 5, 5], 253 dashPattern: [5, 5, 5, 5],
@@ -183,21 +183,22 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { @@ -183,21 +183,22 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
183 //判断是否已经绑定手机号码 ******调用接口******* 183 //判断是否已经绑定手机号码 ******调用接口*******
184 //有,通过手机号吗或者opened查找店铺信息进行登陆 184 //有,通过手机号吗或者opened查找店铺信息进行登陆
185 //没有,跳转至绑定手机号码页面 185 //没有,跳转至绑定手机号码页面
186 - Map<String, String> params = {  
187 - "unionid": responseData["unionid"],  
188 - };  
189 - BuildContext contextTemp =  
190 - App.getIt<NavigateService>().key.currentState.overlay.context;  
191 - CheckbindPhoneSunModel model =  
192 - await otherLoginProvider.checkbindPhone(contextTemp, params);  
193 - // Loading.hideLoading(context);  
194 - if (model != null) {  
195 - createStoreModel.storeInfo = StoreInfo();  
196 - createStoreModel.storeInfo.phone = model.phone;  
197 - NavigatorUtil.goIfNeedCreateStorePage(context);  
198 - } else {  
199 - NavigatorUtil.goBindingPhonePage(context);  
200 - } 186 + // Map<String, String> params = {
  187 + // "unionid": responseData["unionid"],
  188 + // };
  189 + // BuildContext contextTemp =
  190 + // App.getIt<NavigateService>().key.currentState.overlay.context;
  191 + // CheckbindPhoneSunModel model =
  192 + // await otherLoginProvider.checkbindPhone(contextTemp, params);
  193 + // // Loading.hideLoading(context);
  194 + // if (model != null) {
  195 + // createStoreModel.storeInfo = StoreInfo();
  196 + // createStoreModel.storeInfo.phone = model.phone;
  197 + createStoreModel.storeInfo = StoreInfo();
  198 + NavigatorUtil.goIfNeedCreateStorePage(context);
  199 + // } else {
  200 + // NavigatorUtil.goBindingPhonePage(context);
  201 + // }
201 202
202 // _getUserInfo(responseData["access_token"], responseData["openid"]); 203 // _getUserInfo(responseData["access_token"], responseData["openid"]);
203 } 204 }
@@ -282,7 +282,7 @@ class Utils { @@ -282,7 +282,7 @@ class Utils {
282 // UserModel model = Provider.of<UserModel>(context, listen: false); 282 // UserModel model = Provider.of<UserModel>(context, listen: false);
283 launchWeChatMiniProgram( 283 launchWeChatMiniProgram(
284 username: "gh_1007de739c65", 284 username: "gh_1007de739c65",
285 - path: "pages/login/l_info", 285 + path: "pages/login/l_login",
286 miniProgramType: WXMiniProgramType.RELEASE); 286 miniProgramType: WXMiniProgramType.RELEASE);
287 } 287 }
288 288