Commit 51df2b836ae6f0e4191bed915030895c94becb39

Authored by wdn127929
1 parent 8c221f31

创建新优惠

@@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
8 import 'package:flutter/rendering.dart'; 8 import 'package:flutter/rendering.dart';
9 import 'package:flutter/services.dart'; 9 import 'package:flutter/services.dart';
10 import 'package:flutter_screenutil/flutter_screenutil.dart'; 10 import 'package:flutter_screenutil/flutter_screenutil.dart';
  11 +import 'package:one_key/constant/state.dart';
11 import 'package:one_key/models/coupon_model.dart'; 12 import 'package:one_key/models/coupon_model.dart';
12 import 'package:one_key/models/notebook_detail.dart'; 13 import 'package:one_key/models/notebook_detail.dart';
13 import 'package:one_key/models/seller_phone_model.dart'; 14 import 'package:one_key/models/seller_phone_model.dart';
@@ -24,6 +25,7 @@ import 'package:one_key/utils/misc.dart'; @@ -24,6 +25,7 @@ import 'package:one_key/utils/misc.dart';
24 import 'package:one_key/route/navigator_util.dart'; 25 import 'package:one_key/route/navigator_util.dart';
25 import 'package:one_key/utils/utils.dart'; 26 import 'package:one_key/utils/utils.dart';
26 import 'package:one_key/widgets/h_empty_view.dart'; 27 import 'package:one_key/widgets/h_empty_view.dart';
  28 +import 'package:one_key/widgets/page_exception.dart';
27 import 'package:one_key/widgets/round_button.dart'; 29 import 'package:one_key/widgets/round_button.dart';
28 import 'package:one_key/widgets/system_app_bar.dart'; 30 import 'package:one_key/widgets/system_app_bar.dart';
29 import 'package:one_key/widgets/v_empty_view.dart'; 31 import 'package:one_key/widgets/v_empty_view.dart';
@@ -92,13 +94,12 @@ class InvicationPageState extends State<InvicationPage> { @@ -92,13 +94,12 @@ class InvicationPageState extends State<InvicationPage> {
92 void initState() { 94 void initState() {
93 super.initState(); 95 super.initState();
94 96
95 - WidgetsBinding.instance.addPostFrameCallback((_) { 97 + WidgetsBinding.instance.addPostFrameCallback((_) async {
96 couponProvider.sendSMS = false; 98 couponProvider.sendSMS = false;
97 - _couponNetworkData(isShowLoading: false);  
98 -  
99 - _getCustomerActivityBaseinfo();  
100 - _getTablesPhoto();  
101 - _getReserveDetail(); 99 + await _couponNetworkData(isShowLoading: false);
  100 + await _getCustomerActivityBaseinfo();
  101 + await _getTablesPhoto();
  102 + await _getReserveDetail(showCicle: false);
102 }); 103 });
103 bus.on("refresh_coupon_invitation", (args) { 104 bus.on("refresh_coupon_invitation", (args) {
104 _couponNetworkData(isShowLoading: false); 105 _couponNetworkData(isShowLoading: false);
@@ -130,7 +131,8 @@ class InvicationPageState extends State<InvicationPage> { @@ -130,7 +131,8 @@ class InvicationPageState extends State<InvicationPage> {
130 { 131 {
131 "rid": widget.rid, 132 "rid": widget.rid,
132 }, 133 },
133 - showCircle: showCicle); 134 + showCircle: false);
  135 + _baseIndoProvider.pageState = PageState.Success;
134 String _nameStr = ''; 136 String _nameStr = '';
135 String _tid = ''; 137 String _tid = '';
136 for (int i = 0; i < detailEntity.tables.length; i++) { 138 for (int i = 0; i < detailEntity.tables.length; i++) {
@@ -177,7 +179,8 @@ class InvicationPageState extends State<InvicationPage> { @@ -177,7 +179,8 @@ class InvicationPageState extends State<InvicationPage> {
177 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, 179 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
178 "tableids": tid, 180 "tableids": tid,
179 }; 181 };
180 - bool success = await _baseIndoProvider.getTablesPhoto(context, params); 182 + bool success = await _baseIndoProvider.getTablesPhoto(context, params,
  183 + isShowLoading: false);
181 } 184 }
182 185
183 //客户经理添加/修改基本信息 186 //客户经理添加/修改基本信息
@@ -213,8 +216,8 @@ class InvicationPageState extends State<InvicationPage> { @@ -213,8 +216,8 @@ class InvicationPageState extends State<InvicationPage> {
213 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, 216 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
214 "uid": Provider.of<UserModel>(context, listen: false).user.openid, 217 "uid": Provider.of<UserModel>(context, listen: false).user.openid,
215 }; 218 };
216 - bool success =  
217 - await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); 219 + bool success = await _baseIndoProvider
  220 + .getCustomerActivityBaseinfo(context, params, isShowLoading: false);
218 if (success) { 221 if (success) {
219 name = _baseIndoProvider.baseInfoSunModel.name; 222 name = _baseIndoProvider.baseInfoSunModel.name;
220 qiniuUrl = _baseIndoProvider.baseInfoSunModel.photo; 223 qiniuUrl = _baseIndoProvider.baseInfoSunModel.photo;
@@ -267,7 +270,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -267,7 +270,7 @@ class InvicationPageState extends State<InvicationPage> {
267 //此人已经新建好券 270 //此人已经新建好券
268 if (couponProvider.couponListSelect.length > 0) { 271 if (couponProvider.couponListSelect.length > 0) {
269 // couponProvider.initCouponSelect(context); 272 // couponProvider.initCouponSelect(context);
270 - 273 + couponsCan = [];
271 for (int i = 0; i < couponProvider.couponListSelect.length; i++) { 274 for (int i = 0; i < couponProvider.couponListSelect.length; i++) {
272 couponsCan.add(couponProvider.couponListSelect[i].aname); 275 couponsCan.add(couponProvider.couponListSelect[i].aname);
273 } 276 }
@@ -1301,8 +1304,15 @@ class InvicationPageState extends State<InvicationPage> { @@ -1301,8 +1304,15 @@ class InvicationPageState extends State<InvicationPage> {
1301 }))), 1304 }))),
1302 HEmptyView(40), 1305 HEmptyView(40),
1303 InkWell( 1306 InkWell(
1304 - onTap: () { 1307 + onTap: () async {
1305 // NavigatorUtil.goMarketingRecordsDetailPage(context); 1308 // NavigatorUtil.goMarketingRecordsDetailPage(context);
  1309 + bool needRefresh = await NavigatorUtil.goCouponEditPage(context);
  1310 + print(needRefresh);
  1311 + if (needRefresh != null && needRefresh) {
  1312 + //刷新页面数据
  1313 + // _controller.callRefresh();
  1314 + _couponNetworkData();
  1315 + }
1306 }, 1316 },
1307 child: Text('创建新优惠', 1317 child: Text('创建新优惠',
1308 style: TextStyle( 1318 style: TextStyle(
@@ -1589,23 +1599,42 @@ class InvicationPageState extends State<InvicationPage> { @@ -1589,23 +1599,42 @@ class InvicationPageState extends State<InvicationPage> {
1589 ], 1599 ],
1590 )), 1600 )),
1591 Expanded( 1601 Expanded(
1592 - child: Container(  
1593 - padding:  
1594 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),  
1595 - child: SingleChildScrollView(  
1596 - child: Column(  
1597 - children: [  
1598 - VEmptyView(40),  
1599 - _managerWidget(),  
1600 - VEmptyView(50),  
1601 - _orderInfoWidget(),  
1602 - VEmptyView(30),  
1603 - _couponWidget(),  
1604 - VEmptyView(20),  
1605 - _btnWidget(),  
1606 - ],  
1607 - )),  
1608 - )), 1602 + child: Consumer<BaseIndoProvider>(builder: (context, model, _) {
  1603 + if (model.pageState != PageState.Success) {
  1604 + return ExceptionPage(
  1605 + pageState: model.pageState,
  1606 + callback: () async {
  1607 + model.pageState = PageState.Loading;
  1608 + await _couponNetworkData(isShowLoading: false);
  1609 + await _getCustomerActivityBaseinfo();
  1610 + await _getTablesPhoto();
  1611 + await _getReserveDetail(showCicle: false);
  1612 + model.notifyListeners();
  1613 + },
  1614 + emptyMsg: "稍后加载",
  1615 + emptyImg: "empty_search",
  1616 + showMsg: "加载中,请稍后...",
  1617 + );
  1618 + } else {
  1619 + return Container(
  1620 + padding:
  1621 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
  1622 + child: SingleChildScrollView(
  1623 + child: Column(
  1624 + children: [
  1625 + VEmptyView(40),
  1626 + _managerWidget(),
  1627 + VEmptyView(50),
  1628 + _orderInfoWidget(),
  1629 + VEmptyView(30),
  1630 + _couponWidget(),
  1631 + VEmptyView(20),
  1632 + _btnWidget(),
  1633 + ],
  1634 + )),
  1635 + );
  1636 + }
  1637 + })),
1609 ], 1638 ],
1610 ), 1639 ),
1611 1640
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/constant.dart'; 2 import 'package:one_key/constant/constant.dart';
3 import 'package:one_key/constant/error.dart'; 3 import 'package:one_key/constant/error.dart';
  4 +import 'package:one_key/constant/state.dart';
4 import 'package:one_key/models/base_info_model.dart'; 5 import 'package:one_key/models/base_info_model.dart';
5 import 'package:one_key/models/seller_phone_model.dart'; 6 import 'package:one_key/models/seller_phone_model.dart';
6 import 'package:one_key/models/table_photo_model.dart'; 7 import 'package:one_key/models/table_photo_model.dart';
@@ -16,6 +17,8 @@ class BaseIndoProvider with ChangeNotifier { @@ -16,6 +17,8 @@ class BaseIndoProvider with ChangeNotifier {
16 BaseInfoSunModel baseInfoSunModel; //客户经理基础信息 17 BaseInfoSunModel baseInfoSunModel; //客户经理基础信息
17 List<String> photoList = []; //商家图片信息 18 List<String> photoList = []; //商家图片信息
18 19
  20 + PageState pageState = PageState.Loading;
  21 +
19 TextEditingController phoneController = TextEditingController(); 22 TextEditingController phoneController = TextEditingController();
20 TextEditingController nameController = TextEditingController(); 23 TextEditingController nameController = TextEditingController();
21 List sexList; 24 List sexList;