Commit b3ddaaa14066cfebdcd9290ed7cde8c5d9a6cc31

Authored by wdn127929
1 parent ff3170bd

我的客户接口percent%

1 -import 'package:json_annotation/json_annotation.dart'; 1 +import 'package:json_annotation/json_annotation.dart';
2 2
  3 +import 'package:json_annotation/json_annotation.dart';
3 4
4 - import 'package:json_annotation/json_annotation.dart';  
5 -  
6 part 'guest_manage_model.g.dart'; 5 part 'guest_manage_model.g.dart';
7 6
8 -  
9 @JsonSerializable() 7 @JsonSerializable()
10 - class GuestManageModel extends Object {  
11 - 8 +class GuestManageModel extends Object {
12 @JsonKey(name: 'ret') 9 @JsonKey(name: 'ret')
13 int ret; 10 int ret;
14 11
@@ -18,18 +15,20 @@ part 'guest_manage_model.g.dart'; @@ -18,18 +15,20 @@ part 'guest_manage_model.g.dart';
18 @JsonKey(name: 'msg') 15 @JsonKey(name: 'msg')
19 String msg; 16 String msg;
20 17
21 - GuestManageModel(this.ret,this.data,this.msg,); 18 + GuestManageModel(
  19 + this.ret,
  20 + this.data,
  21 + this.msg,
  22 + );
22 23
23 - factory GuestManageModel.fromJson(Map<String, dynamic> srcJson) => _$GuestManageModelFromJson(srcJson); 24 + factory GuestManageModel.fromJson(Map<String, dynamic> srcJson) =>
  25 + _$GuestManageModelFromJson(srcJson);
24 26
25 Map<String, dynamic> toJson() => _$GuestManageModelToJson(this); 27 Map<String, dynamic> toJson() => _$GuestManageModelToJson(this);
26 -  
27 } 28 }
28 29
29 -  
30 @JsonSerializable() 30 @JsonSerializable()
31 - class GuestManageSunModel extends Object {  
32 - 31 +class GuestManageSunModel extends Object {
33 @JsonKey(name: 'myCustomer') 32 @JsonKey(name: 'myCustomer')
34 int myCustomer; 33 int myCustomer;
35 34
@@ -45,72 +44,79 @@ part 'guest_manage_model.g.dart'; @@ -45,72 +44,79 @@ part 'guest_manage_model.g.dart';
45 @JsonKey(name: 'Tips') 44 @JsonKey(name: 'Tips')
46 Tips tips; 45 Tips tips;
47 46
48 - GuestManageSunModel(this.myCustomer,this.active,this.sleep,this.drain,this.tips,); 47 + GuestManageSunModel(
  48 + this.myCustomer,
  49 + this.active,
  50 + this.sleep,
  51 + this.drain,
  52 + this.tips,
  53 + );
49 54
50 - factory GuestManageSunModel.fromJson(Map<String, dynamic> srcJson) => _$GuestManageSunModelFromJson(srcJson); 55 + factory GuestManageSunModel.fromJson(Map<String, dynamic> srcJson) =>
  56 + _$GuestManageSunModelFromJson(srcJson);
51 57
52 Map<String, dynamic> toJson() => _$GuestManageSunModelToJson(this); 58 Map<String, dynamic> toJson() => _$GuestManageSunModelToJson(this);
53 -  
54 } 59 }
55 60
56 -  
57 @JsonSerializable() 61 @JsonSerializable()
58 - class Active extends Object {  
59 - 62 +class Active extends Object {
60 @JsonKey(name: 'count') 63 @JsonKey(name: 'count')
61 int count; 64 int count;
62 65
63 @JsonKey(name: 'scale') 66 @JsonKey(name: 'scale')
64 - String scale; 67 + dynamic scale;
65 68
66 - Active(this.count,this.scale,); 69 + Active(
  70 + this.count,
  71 + this.scale,
  72 + );
67 73
68 - factory Active.fromJson(Map<String, dynamic> srcJson) => _$ActiveFromJson(srcJson); 74 + factory Active.fromJson(Map<String, dynamic> srcJson) =>
  75 + _$ActiveFromJson(srcJson);
69 76
70 Map<String, dynamic> toJson() => _$ActiveToJson(this); 77 Map<String, dynamic> toJson() => _$ActiveToJson(this);
71 -  
72 } 78 }
73 79
74 -  
75 @JsonSerializable() 80 @JsonSerializable()
76 - class Sleep extends Object {  
77 - 81 +class Sleep extends Object {
78 @JsonKey(name: 'count') 82 @JsonKey(name: 'count')
79 int count; 83 int count;
80 84
81 @JsonKey(name: 'scale') 85 @JsonKey(name: 'scale')
82 - String scale; 86 + dynamic scale;
83 87
84 - Sleep(this.count,this.scale,); 88 + Sleep(
  89 + this.count,
  90 + this.scale,
  91 + );
85 92
86 - factory Sleep.fromJson(Map<String, dynamic> srcJson) => _$SleepFromJson(srcJson); 93 + factory Sleep.fromJson(Map<String, dynamic> srcJson) =>
  94 + _$SleepFromJson(srcJson);
87 95
88 Map<String, dynamic> toJson() => _$SleepToJson(this); 96 Map<String, dynamic> toJson() => _$SleepToJson(this);
89 -  
90 } 97 }
91 98
92 -  
93 @JsonSerializable() 99 @JsonSerializable()
94 - class Drain extends Object {  
95 - 100 +class Drain extends Object {
96 @JsonKey(name: 'count') 101 @JsonKey(name: 'count')
97 int count; 102 int count;
98 103
99 @JsonKey(name: 'scale') 104 @JsonKey(name: 'scale')
100 - String scale; 105 + dynamic scale;
101 106
102 - Drain(this.count,this.scale,); 107 + Drain(
  108 + this.count,
  109 + this.scale,
  110 + );
103 111
104 - factory Drain.fromJson(Map<String, dynamic> srcJson) => _$DrainFromJson(srcJson); 112 + factory Drain.fromJson(Map<String, dynamic> srcJson) =>
  113 + _$DrainFromJson(srcJson);
105 114
106 Map<String, dynamic> toJson() => _$DrainToJson(this); 115 Map<String, dynamic> toJson() => _$DrainToJson(this);
107 -  
108 } 116 }
109 117
110 -  
111 @JsonSerializable() 118 @JsonSerializable()
112 - class Tips extends Object {  
113 - 119 +class Tips extends Object {
114 @JsonKey(name: 'task') 120 @JsonKey(name: 'task')
115 List<List<String>> task; 121 List<List<String>> task;
116 122
@@ -120,12 +126,14 @@ part 'guest_manage_model.g.dart'; @@ -120,12 +126,14 @@ part 'guest_manage_model.g.dart';
120 @JsonKey(name: 'awaken') 126 @JsonKey(name: 'awaken')
121 List<String> awaken; 127 List<String> awaken;
122 128
123 - Tips(this.task,this.recover,this.awaken,); 129 + Tips(
  130 + this.task,
  131 + this.recover,
  132 + this.awaken,
  133 + );
124 134
125 - factory Tips.fromJson(Map<String, dynamic> srcJson) => _$TipsFromJson(srcJson); 135 + factory Tips.fromJson(Map<String, dynamic> srcJson) =>
  136 + _$TipsFromJson(srcJson);
126 137
127 Map<String, dynamic> toJson() => _$TipsToJson(this); 138 Map<String, dynamic> toJson() => _$TipsToJson(this);
128 -  
129 } 139 }
130 -  
131 -  
@@ -54,7 +54,7 @@ Map<String, dynamic> _$GuestManageSunModelToJson( @@ -54,7 +54,7 @@ Map<String, dynamic> _$GuestManageSunModelToJson(
54 Active _$ActiveFromJson(Map<String, dynamic> json) { 54 Active _$ActiveFromJson(Map<String, dynamic> json) {
55 return Active( 55 return Active(
56 json['count'] as int, 56 json['count'] as int,
57 - json['scale'] as String, 57 + json['scale'] as dynamic,
58 ); 58 );
59 } 59 }
60 60
@@ -66,7 +66,7 @@ Map<String, dynamic> _$ActiveToJson(Active instance) => <String, dynamic>{ @@ -66,7 +66,7 @@ Map<String, dynamic> _$ActiveToJson(Active instance) => <String, dynamic>{
66 Sleep _$SleepFromJson(Map<String, dynamic> json) { 66 Sleep _$SleepFromJson(Map<String, dynamic> json) {
67 return Sleep( 67 return Sleep(
68 json['count'] as int, 68 json['count'] as int,
69 - json['scale'] as String, 69 + json['scale'] as dynamic,
70 ); 70 );
71 } 71 }
72 72
@@ -78,7 +78,7 @@ Map<String, dynamic> _$SleepToJson(Sleep instance) => <String, dynamic>{ @@ -78,7 +78,7 @@ Map<String, dynamic> _$SleepToJson(Sleep instance) => <String, dynamic>{
78 Drain _$DrainFromJson(Map<String, dynamic> json) { 78 Drain _$DrainFromJson(Map<String, dynamic> json) {
79 return Drain( 79 return Drain(
80 json['count'] as int, 80 json['count'] as int,
81 - json['scale'] as String, 81 + json['scale'] as dynamic,
82 ); 82 );
83 } 83 }
84 84
@@ -169,4 +169,7 @@ class HttpUrl { @@ -169,4 +169,7 @@ class HttpUrl {
169 static const String update_password = 169 static const String update_password =
170 "?service=App.Seller.UpdatePassword"; // 员工密码修改 170 "?service=App.Seller.UpdatePassword"; // 员工密码修改
171 171
  172 + static const String guest_manage =
  173 + "?service=App.GuestManage.GuestManage"; //我的客户首页
  174 +
172 } 175 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 2 import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/guest_manage_model.dart';
  5 +import 'package:one_key/provider/customer_provider.dart';
3 import 'package:one_key/res/colors.dart'; 6 import 'package:one_key/res/colors.dart';
4 import 'package:one_key/route/navigator_util.dart'; 7 import 'package:one_key/route/navigator_util.dart';
5 import 'package:one_key/utils/event_bus.dart'; 8 import 'package:one_key/utils/event_bus.dart';
6 import 'package:one_key/utils/utils.dart'; 9 import 'package:one_key/utils/utils.dart';
7 import 'package:one_key/widgets/h_empty_view.dart'; 10 import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
8 import 'package:one_key/widgets/round_button.dart'; 12 import 'package:one_key/widgets/round_button.dart';
9 import 'package:one_key/widgets/system_app_bar.dart'; 13 import 'package:one_key/widgets/system_app_bar.dart';
10 import 'package:one_key/widgets/v_empty_view.dart'; 14 import 'package:one_key/widgets/v_empty_view.dart';
  15 +import 'package:provider/provider.dart';
11 16
12 class MyCustomerPage extends StatefulWidget { 17 class MyCustomerPage extends StatefulWidget {
13 MyCustomerPage({Key key}) : super(key: key); 18 MyCustomerPage({Key key}) : super(key: key);
@@ -18,12 +23,30 @@ class MyCustomerPage extends StatefulWidget { @@ -18,12 +23,30 @@ class MyCustomerPage extends StatefulWidget {
18 23
19 class _MyCustomerPageState extends State<MyCustomerPage> { 24 class _MyCustomerPageState extends State<MyCustomerPage> {
20 ScrollController _controller = ScrollController(); 25 ScrollController _controller = ScrollController();
  26 + CustomerProvider customerProvider;
  27 + @override
  28 + void initState() {
  29 + super.initState();
  30 +
  31 + WidgetsBinding.instance.addPostFrameCallback((_) {
  32 + _getGuestManageData();
  33 + });
  34 + }
  35 +
  36 + ///我的客户首页
  37 + _getGuestManageData() async {
  38 + GuestManageSunModel model =
  39 + await customerProvider.getGuestManageData(context);
  40 + // setState(() {});
  41 + }
21 42
22 ///活跃客户、沉睡客户、流失客户 43 ///活跃客户、沉睡客户、流失客户
23 Widget _percentWidget(String pnum, String btnTitle, String percent) { 44 Widget _percentWidget(String pnum, String btnTitle, String percent) {
24 return Container( 45 return Container(
25 color: MyColours.color_ffffff, 46 color: MyColours.color_ffffff,
26 // height: ScreenUtil().setWidth(230), 47 // height: ScreenUtil().setWidth(230),
  48 + width: (ScreenUtil.screenWidthDp - ScreenUtil().setWidth(20)) / 3,
  49 + height: (ScreenUtil.screenWidthDp - ScreenUtil().setWidth(20)) / 3,
27 child: Column( 50 child: Column(
28 mainAxisAlignment: MainAxisAlignment.center, 51 mainAxisAlignment: MainAxisAlignment.center,
29 children: [ 52 children: [
@@ -71,169 +94,348 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -71,169 +94,348 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
71 94
72 @override 95 @override
73 Widget build(BuildContext context) { 96 Widget build(BuildContext context) {
  97 + customerProvider = Provider.of<CustomerProvider>(context, listen: false);
74 return Scaffold( 98 return Scaffold(
75 - backgroundColor: Color.fromRGBO(246, 248, 250, 1),  
76 - appBar: SystemAppBar('我的客情', onTap: () {  
77 - EventBus().emit('changeStatusColor');  
78 - Navigator.pop(context);  
79 - }),  
80 - body: WillPopScope(  
81 - onWillPop: () async {  
82 - EventBus().emit('changeStatusColor');  
83 - return true;  
84 - },  
85 - child: Column(children: [  
86 - Expanded(  
87 - child: SingleChildScrollView(  
88 - controller: _controller,  
89 - child: Column(  
90 - children: [  
91 - Container(  
92 - color: MyColours.color_ffffff,  
93 - padding: EdgeInsets.symmetric(  
94 - vertical: ScreenUtil().setWidth(30)),  
95 - child: Column( 99 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  100 + appBar: SystemAppBar('我的客情', onTap: () {
  101 + EventBus().emit('changeStatusColor');
  102 + Navigator.pop(context);
  103 + }),
  104 + body: WillPopScope(onWillPop: () async {
  105 + EventBus().emit('changeStatusColor');
  106 + return true;
  107 + }, child: Consumer<CustomerProvider>(builder: (context, model, _) {
  108 + if (model.pageStateMyHome != PageState.Success) {
  109 + return ExceptionPage(
  110 + pageState: model.pageStateMyHome,
  111 + callback: () {
  112 + // getTableList();
  113 + },
  114 + emptyMsg: "暂时没有桌位哦",
  115 + emptyImg: "empty_search",
  116 + showMsg: "加载中,请稍后...",
  117 + );
  118 + } else {
  119 + return Column(children: [
  120 + Expanded(
  121 + child: SingleChildScrollView(
  122 + controller: _controller,
  123 + child: Column(
  124 + children: [
  125 + Container(
  126 + color: MyColours.color_ffffff,
  127 + padding: EdgeInsets.symmetric(
  128 + vertical: ScreenUtil().setWidth(30)),
  129 + child: Column(
  130 + children: [
  131 + Row(
  132 + mainAxisAlignment: MainAxisAlignment.center,
  133 + children: [
  134 + Text(
  135 + '${customerProvider.guestSunmodel.myCustomer}',
  136 + style: TextStyle(
  137 + color: MyColours.color_199095,
  138 + fontSize: ScreenUtil().setSp(60),
  139 + fontWeight: FontWeight.bold),
  140 + ),
  141 + Text(
  142 + '位',
  143 + style: TextStyle(
  144 + color: MyColours.color_199095,
  145 + fontWeight: FontWeight.bold,
  146 + fontSize: ScreenUtil().setSp(30)),
  147 + )
  148 + ],
  149 + ),
  150 + VEmptyView(10),
  151 + RoundButton(
  152 + onPressed: () async {
  153 + NavigatorUtil.goCustomerListPage(context);
  154 + },
  155 + text: '我的客户',
  156 + fontSize: 24,
  157 + isBold: false,
  158 + textColor: MyColours.color_333333,
  159 + gradientStart: MyColours.color_ffffff,
  160 + gradientEnd: MyColours.color_ffffff,
  161 + borderColor: Color.fromRGBO(118, 118, 118, 1),
  162 + height: ScreenUtil().setWidth(45),
  163 + width: ScreenUtil().setWidth(160),
  164 + radius: ScreenUtil().setWidth(30),
  165 + )
  166 + ],
  167 + ),
  168 + ),
  169 + VEmptyView(10),
  170 + // GridView.builder(
  171 + // controller: _controller,
  172 + // shrinkWrap: true,
  173 + // cacheExtent: ScreenUtil().setWidth(0),
  174 + // itemCount: 3,
  175 + // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  176 + // crossAxisCount: 3,
  177 + // childAspectRatio: 1,
  178 + // mainAxisSpacing: ScreenUtil().setWidth(10),
  179 + // crossAxisSpacing: ScreenUtil().setWidth(10)),
  180 + // itemBuilder: (BuildContext context, int index) {
  181 + // // locationState = state;
  182 + // return _percentWidget(
  183 + // '${customerProvider.guestSunmodel.active.count}',
  184 + // '活跃客户',
  185 + // '${customerProvider.guestSunmodel.active.scale}');
  186 + // }),
  187 + Row(
96 children: [ 188 children: [
97 - Row(  
98 - mainAxisAlignment: MainAxisAlignment.center,  
99 - children: [  
100 - Text(  
101 - '19',  
102 - style: TextStyle(  
103 - color: MyColours.color_199095,  
104 - fontSize: ScreenUtil().setSp(60),  
105 - fontWeight: FontWeight.bold),  
106 - ),  
107 - Text(  
108 - '位',  
109 - style: TextStyle(  
110 - color: MyColours.color_199095,  
111 - fontWeight: FontWeight.bold,  
112 - fontSize: ScreenUtil().setSp(30)),  
113 - )  
114 - ],  
115 - ),  
116 - VEmptyView(10),  
117 - RoundButton(  
118 - onPressed: () async {  
119 - NavigatorUtil.goCustomerListPage(context);  
120 - },  
121 - text: '我的客户',  
122 - fontSize: 24,  
123 - isBold: false,  
124 - textColor: MyColours.color_333333,  
125 - gradientStart: MyColours.color_ffffff,  
126 - gradientEnd: MyColours.color_ffffff,  
127 - borderColor: Color.fromRGBO(118, 118, 118, 1),  
128 - height: ScreenUtil().setWidth(45),  
129 - width: ScreenUtil().setWidth(160),  
130 - radius: ScreenUtil().setWidth(30),  
131 - ) 189 + _percentWidget(
  190 + '${customerProvider.guestSunmodel.active.count}',
  191 + '活跃客户',
  192 + '${customerProvider.guestSunmodel.active.scale}'),
  193 + HEmptyView(10),
  194 + _percentWidget(
  195 + '${customerProvider.guestSunmodel.sleep.count}',
  196 + '沉睡客户',
  197 + '${customerProvider.guestSunmodel.sleep.scale}'),
  198 + HEmptyView(10),
  199 + _percentWidget(
  200 + '${customerProvider.guestSunmodel.drain.count}',
  201 + '流失客户',
  202 + '${customerProvider.guestSunmodel.drain.scale}'),
132 ], 203 ],
133 ), 204 ),
134 - ),  
135 - VEmptyView(10),  
136 - GridView.builder(  
137 - controller: _controller,  
138 - shrinkWrap: true,  
139 - cacheExtent: ScreenUtil().setWidth(0),  
140 - itemCount: 3,  
141 - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
142 - crossAxisCount: 3,  
143 - childAspectRatio: 1,  
144 - mainAxisSpacing: ScreenUtil().setWidth(10),  
145 - crossAxisSpacing: ScreenUtil().setWidth(10)),  
146 - itemBuilder: (BuildContext context, int index) {  
147 - // locationState = state;  
148 - return _percentWidget('1999', '活跃客户', '39.20');  
149 - }),  
150 - // Row(  
151 - // children: [  
152 - // _percentWidget('19992', '活跃客户', '90.90'),  
153 - // HEmptyView(10),  
154 - // _percentWidget('19992', '沉睡客户', '90.90'),  
155 - // HEmptyView(10),  
156 - // _percentWidget('19992', '流失客户', '5.90'),  
157 - // ],  
158 - // ), 205 + ListView.builder(
  206 + controller: _controller,
  207 + shrinkWrap: true,
  208 + cacheExtent: ScreenUtil().setWidth(0),
  209 + itemCount:
  210 + customerProvider.guestSunmodel.tips.task.length,
  211 + itemBuilder: (BuildContext context, int index) {
  212 + // locationState = state;
  213 + List<String> data =
  214 + customerProvider.guestSunmodel.tips.task[index];
  215 + return Column(
  216 + children: [
  217 + VEmptyView(10),
  218 + Stack(children: [
  219 + Container(
  220 + color: MyColours.color_ffffff,
  221 + padding: EdgeInsets.symmetric(
  222 + horizontal: ScreenUtil().setWidth(20),
  223 + vertical: ScreenUtil().setWidth(30)),
  224 + child: Row(
  225 + children: [
  226 + Image.asset(
  227 + Utils.getImgPath('warning'),
  228 + width: ScreenUtil().setWidth(42),
  229 + ),
  230 + HEmptyView(15),
  231 + Expanded(
  232 + child: Column(
  233 + crossAxisAlignment:
  234 + CrossAxisAlignment.start,
  235 + children: [
  236 + Text(
  237 + '${data[0]}',
  238 + maxLines: 1,
  239 + overflow: TextOverflow.ellipsis,
  240 + style: TextStyle(
  241 + color: MyColours.color_333333,
  242 + fontSize:
  243 + ScreenUtil().setSp(32)),
  244 + ),
  245 + VEmptyView(8),
  246 + Text(
  247 + '${data[1]}',
  248 + maxLines: 1,
  249 + overflow: TextOverflow.ellipsis,
  250 + style: TextStyle(
  251 + color: MyColours.color_333333,
  252 + fontSize:
  253 + ScreenUtil().setSp(24)),
  254 + ),
  255 + VEmptyView(8),
  256 + Text(
  257 + '${data[2]}',
  258 + maxLines: 1,
  259 + overflow: TextOverflow.ellipsis,
  260 + style: TextStyle(
  261 + color: MyColours.color_333333,
  262 + fontSize:
  263 + ScreenUtil().setSp(26)),
  264 + )
  265 + ],
  266 + )),
  267 + HEmptyView(20),
  268 + RoundButton(
  269 + text: '立即完成',
159 270
160 - ListView.builder(  
161 - controller: _controller,  
162 - shrinkWrap: true,  
163 - cacheExtent: ScreenUtil().setWidth(0),  
164 - itemCount: 20,  
165 - itemBuilder: (BuildContext context, int index) {  
166 - // locationState = state;  
167 - return Column(  
168 - children: [  
169 - VEmptyView(10),  
170 - Container(  
171 - color: MyColours.color_ffffff,  
172 - padding: EdgeInsets.symmetric(  
173 - horizontal: ScreenUtil().setWidth(20),  
174 - vertical: ScreenUtil().setWidth(30)),  
175 - child: Row(  
176 - children: [  
177 - Image.asset(  
178 - Utils.getImgPath('warning'),  
179 - width: ScreenUtil().setWidth(34), 271 + padding: EdgeInsets.symmetric(
  272 + horizontal:
  273 + ScreenUtil().setWidth(26)),
  274 + gradientStart: MyColours.color_199095,
  275 + gradientEnd: MyColours.color_199095,
  276 + // borderColor: MyColours.color_999999,
  277 + radius: ScreenUtil().setWidth(40),
  278 + height: ScreenUtil().setWidth(64),
  279 + fontSize: 26,
  280 + isBold: false,
  281 + onPressed: () {
  282 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  283 + },
  284 + ),
  285 + ],
180 ), 286 ),
181 - HEmptyView(10),  
182 - Expanded(  
183 - child: Text(  
184 - '2为顾客马上快递费哈健身房哈尽快发货阿花房间卡都会发觉客服哈空间发哈尽快发货卡上的房间卡上发哈尽快',  
185 - maxLines: 10,  
186 - overflow: TextOverflow.ellipsis,  
187 - style: TextStyle(  
188 - color: MyColours.color_333333,  
189 - fontSize: ScreenUtil().setSp(28)),  
190 - )),  
191 - HEmptyView(30),  
192 - RoundButton(  
193 - text: '立即完成', 287 + ),
  288 + Positioned(
  289 + bottom: ScreenUtil().setWidth(24),
  290 + right: ScreenUtil().setWidth(70),
  291 + child: Text(
  292 + '${data[3]}',
  293 + maxLines: 1,
  294 + overflow: TextOverflow.ellipsis,
  295 + style: TextStyle(
  296 + color: Color.fromRGBO(215, 30, 40, 1),
  297 + fontSize: ScreenUtil().setSp(26)),
  298 + ))
  299 + ])
  300 + ],
  301 + );
  302 + }),
  303 + ListView.builder(
  304 + controller: _controller,
  305 + shrinkWrap: true,
  306 + cacheExtent: ScreenUtil().setWidth(0),
  307 + itemCount:
  308 + customerProvider.guestSunmodel.tips.recover.length,
  309 + itemBuilder: (BuildContext context, int index) {
  310 + // locationState = state;
194 311
195 - padding: EdgeInsets.symmetric(  
196 - horizontal: ScreenUtil().setWidth(26)),  
197 - gradientStart: MyColours.color_199095,  
198 - gradientEnd: MyColours.color_199095,  
199 - // borderColor: MyColours.color_999999,  
200 - radius: ScreenUtil().setWidth(40),  
201 - height: ScreenUtil().setWidth(64),  
202 - fontSize: 26,  
203 - isBold: false,  
204 - onPressed: () {  
205 - // NavigatorUtil.goEnterStoreEnvironmentPage(context);  
206 - },  
207 - ),  
208 - ], 312 + return Column(
  313 + children: [
  314 + VEmptyView(10),
  315 + Container(
  316 + color: MyColours.color_ffffff,
  317 + padding: EdgeInsets.symmetric(
  318 + horizontal: ScreenUtil().setWidth(20),
  319 + vertical: ScreenUtil().setWidth(30)),
  320 + child: Row(
  321 + children: [
  322 + Image.asset(
  323 + Utils.getImgPath('warning'),
  324 + width: ScreenUtil().setWidth(42),
  325 + ),
  326 + HEmptyView(15),
  327 + Expanded(
  328 + child: Text(
  329 + '${customerProvider.guestSunmodel.tips.recover[index]}',
  330 + maxLines: 10,
  331 + overflow: TextOverflow.ellipsis,
  332 + style: TextStyle(
  333 + color: MyColours.color_333333,
  334 + fontSize: ScreenUtil().setSp(32)),
  335 + )),
  336 + HEmptyView(20),
  337 + RoundButton(
  338 + text: '一键追回',
  339 + padding: EdgeInsets.symmetric(
  340 + horizontal:
  341 + ScreenUtil().setWidth(26)),
  342 + gradientStart: MyColours.color_199095,
  343 + gradientEnd: MyColours.color_199095,
  344 + // borderColor: MyColours.color_999999,
  345 + radius: ScreenUtil().setWidth(40),
  346 + height: ScreenUtil().setWidth(64),
  347 + fontSize: 26,
  348 + isBold: false,
  349 + onPressed: () {
  350 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  351 + },
  352 + ),
  353 + ],
  354 + ),
209 ), 355 ),
210 - )  
211 - ],  
212 - );  
213 - })  
214 - ],  
215 - ),  
216 - )),  
217 - Padding(  
218 - padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),  
219 - child: RoundButton(  
220 - onPressed: () {  
221 - NavigatorUtil.goMarketingRecordsPage(context);  
222 - },  
223 - text: '营销记录',  
224 - fontSize: 24,  
225 - isBold: false,  
226 - textColor: MyColours.color_199095,  
227 - gradientStart: MyColours.color_ffffff,  
228 - gradientEnd: MyColours.color_ffffff,  
229 - borderColor: MyColours.color_199095,  
230 - height: ScreenUtil().setWidth(75),  
231 - width: ScreenUtil().setWidth(260),  
232 - radius: ScreenUtil().setWidth(10),  
233 - // image: Utils.getImgPath('add_area')  
234 - ),  
235 - )  
236 - ])),  
237 - ); 356 + ],
  357 + );
  358 + }),
  359 + ListView.builder(
  360 + controller: _controller,
  361 + shrinkWrap: true,
  362 + cacheExtent: ScreenUtil().setWidth(0),
  363 + itemCount:
  364 + customerProvider.guestSunmodel.tips.recover.length,
  365 + itemBuilder: (BuildContext context, int index) {
  366 + // locationState = state;
  367 +
  368 + return Column(
  369 + children: [
  370 + VEmptyView(10),
  371 + Container(
  372 + color: MyColours.color_ffffff,
  373 + padding: EdgeInsets.symmetric(
  374 + horizontal: ScreenUtil().setWidth(20),
  375 + vertical: ScreenUtil().setWidth(30)),
  376 + child: Row(
  377 + children: [
  378 + Image.asset(
  379 + Utils.getImgPath('warning'),
  380 + width: ScreenUtil().setWidth(42),
  381 + ),
  382 + HEmptyView(15),
  383 + Expanded(
  384 + child: Text(
  385 + '${customerProvider.guestSunmodel.tips.awaken[index]}',
  386 + maxLines: 10,
  387 + overflow: TextOverflow.ellipsis,
  388 + style: TextStyle(
  389 + color: MyColours.color_333333,
  390 + fontSize: ScreenUtil().setSp(32)),
  391 + )),
  392 + HEmptyView(20),
  393 + RoundButton(
  394 + text: '一键唤醒',
  395 + padding: EdgeInsets.symmetric(
  396 + horizontal:
  397 + ScreenUtil().setWidth(26)),
  398 + gradientStart: MyColours.color_199095,
  399 + gradientEnd: MyColours.color_199095,
  400 + // borderColor: MyColours.color_999999,
  401 + radius: ScreenUtil().setWidth(40),
  402 + height: ScreenUtil().setWidth(64),
  403 + fontSize: 26,
  404 + isBold: false,
  405 + onPressed: () {
  406 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  407 + },
  408 + ),
  409 + ],
  410 + ),
  411 + ),
  412 + ],
  413 + );
  414 + })
  415 + ],
  416 + ),
  417 + )),
  418 + Padding(
  419 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  420 + child: RoundButton(
  421 + onPressed: () {
  422 + NavigatorUtil.goMarketingRecordsPage(context);
  423 + },
  424 + text: '营销记录',
  425 + fontSize: 24,
  426 + isBold: false,
  427 + textColor: MyColours.color_199095,
  428 + gradientStart: MyColours.color_ffffff,
  429 + gradientEnd: MyColours.color_ffffff,
  430 + borderColor: MyColours.color_199095,
  431 + height: ScreenUtil().setWidth(75),
  432 + width: ScreenUtil().setWidth(260),
  433 + radius: ScreenUtil().setWidth(10),
  434 + // image: Utils.getImgPath('add_area')
  435 + ),
  436 + )
  437 + ]);
  438 + }
  439 + })));
238 } 440 }
239 } 441 }
@@ -4,11 +4,15 @@ import 'package:lpinyin/lpinyin.dart'; @@ -4,11 +4,15 @@ import 'package:lpinyin/lpinyin.dart';
4 import 'package:one_key/constant/constant.dart'; 4 import 'package:one_key/constant/constant.dart';
5 import 'package:one_key/constant/error.dart'; 5 import 'package:one_key/constant/error.dart';
6 import 'package:one_key/constant/state.dart'; 6 import 'package:one_key/constant/state.dart';
  7 +import 'package:one_key/models/guest_manage_model.dart';
7 import 'package:one_key/models/user_history_entity.dart'; 8 import 'package:one_key/models/user_history_entity.dart';
8 import 'package:one_key/net/base_resp.dart'; 9 import 'package:one_key/net/base_resp.dart';
9 import 'package:one_key/net/dio_util.dart'; 10 import 'package:one_key/net/dio_util.dart';
10 import 'package:one_key/net/http_url.dart'; 11 import 'package:one_key/net/http_url.dart';
  12 +import 'package:one_key/provider/user_model.dart';
  13 +import 'package:one_key/utils/utils.dart';
11 import 'package:one_key/widgets/loading.dart'; 14 import 'package:one_key/widgets/loading.dart';
  15 +import 'package:provider/provider.dart';
12 16
13 class CustomerProvider extends ChangeNotifier { 17 class CustomerProvider extends ChangeNotifier {
14 PageState pageState = PageState.Loading; 18 PageState pageState = PageState.Loading;
@@ -16,6 +20,9 @@ class CustomerProvider extends ChangeNotifier { @@ -16,6 +20,9 @@ class CustomerProvider extends ChangeNotifier {
16 List<UserHistoryEntity> userHistorysShow = []; //历史录入展示 20 List<UserHistoryEntity> userHistorysShow = []; //历史录入展示
17 TextEditingController controller = TextEditingController(); //搜索框 21 TextEditingController controller = TextEditingController(); //搜索框
18 22
  23 + PageState pageStateMyHome = PageState.Loading;
  24 + GuestManageSunModel guestSunmodel;
  25 +
19 //获取历史录入 26 //获取历史录入
20 getUserHistorys(BuildContext context, Map<String, String> params) async { 27 getUserHistorys(BuildContext context, Map<String, String> params) async {
21 BaseResp<List> baseResp = await DioUtil() 28 BaseResp<List> baseResp = await DioUtil()
@@ -157,4 +164,59 @@ class CustomerProvider extends ChangeNotifier { @@ -157,4 +164,59 @@ class CustomerProvider extends ChangeNotifier {
157 notifyListeners(); 164 notifyListeners();
158 } 165 }
159 } 166 }
  167 +
  168 + ///客户经理获取所创建活动列表
  169 + Future<GuestManageSunModel> getGuestManageData(BuildContext context,
  170 + {isShowLoading = true}) async {
  171 + if (isShowLoading) {
  172 + pageStateMyHome = PageState.Loading;
  173 + notifyListeners();
  174 + }
  175 + Map<String, String> params = {
  176 + 'uid': Provider.of<UserModel>(context, listen: false).user.openid
  177 + };
  178 + BaseResp<dynamic> baseResp = await DioUtil()
  179 + .request<dynamic>(context, Method.get, HttpUrl.guest_manage,
  180 + data: params, showLoading: false)
  181 + .catchError((error) {
  182 + print(error.toString());
  183 + if (error is MyError) {
  184 + if (isShowLoading) {
  185 + switch (error.type) {
  186 + case 1:
  187 + pageStateMyHome = PageState.ConnectivityError;
  188 + break;
  189 + case 2:
  190 + pageStateMyHome = PageState.ConnectivityTimeOut;
  191 + break;
  192 + default:
  193 + pageStateMyHome = PageState.ConnectivityError;
  194 + break;
  195 + }
  196 + }
  197 + }
  198 + notifyListeners();
  199 + });
  200 + if (baseResp.code == Constant.status_success) {
  201 + if (baseResp.data.isEmpty) {
  202 + if (isShowLoading) {
  203 + pageStateMyHome = PageState.Empty;
  204 + }
  205 + } else {
  206 + if (isShowLoading) {
  207 + pageStateMyHome = PageState.Success;
  208 + }
  209 + }
  210 + guestSunmodel = GuestManageModel.fromJson(baseResp.responseData).data;
  211 + notifyListeners();
  212 + } else {
  213 + if (isShowLoading) {
  214 + pageStateMyHome = PageState.ConnectivityError;
  215 + }
  216 + if (baseResp != null) {
  217 + Utils.showToast(baseResp.msg ?? "");
  218 + }
  219 + }
  220 + return guestSunmodel;
  221 + }
160 } 222 }