Commit 2402df49cbef8a1a20a128604261e03ecbd8b410

Authored by wdn127929
1 parent fc2df683

推送消息处理

@@ -61,6 +61,12 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean { @@ -61,6 +61,12 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean {
61 @JsonKey(name: 'nick_name') 61 @JsonKey(name: 'nick_name')
62 String nickName; 62 String nickName;
63 63
  64 + @JsonKey(name: 'gid')
  65 + String gid;
  66 +
  67 + @JsonKey(name: 'label')
  68 + String label;
  69 +
64 bool select = true; 70 bool select = true;
65 71
66 String pinyin; 72 String pinyin;
@@ -98,7 +104,9 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean { @@ -98,7 +104,9 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean {
98 this.ddate, 104 this.ddate,
99 this.ddateSolt, 105 this.ddateSolt,
100 this.uid, 106 this.uid,
101 - this.nickName); 107 + this.nickName,
  108 + this.gid,
  109 + this.label);
102 110
103 factory CustomerBySellerSunModel.fromJson(Map<String, dynamic> srcJson) => 111 factory CustomerBySellerSunModel.fromJson(Map<String, dynamic> srcJson) =>
104 _$CustomerBySellerSunModelFromJson(srcJson); 112 _$CustomerBySellerSunModelFromJson(srcJson);
@@ -41,6 +41,8 @@ CustomerBySellerSunModel _$CustomerBySellerSunModelFromJson( @@ -41,6 +41,8 @@ CustomerBySellerSunModel _$CustomerBySellerSunModelFromJson(
41 json['ddate_solt'] as String, 41 json['ddate_solt'] as String,
42 json['uid'] as String, 42 json['uid'] as String,
43 json['nick_name'] as String, 43 json['nick_name'] as String,
  44 + json['gid'] as String,
  45 + json['label'] as String,
44 ); 46 );
45 } 47 }
46 48
@@ -57,5 +59,7 @@ Map<String, dynamic> _$CustomerBySellerSunModelToJson( @@ -57,5 +59,7 @@ Map<String, dynamic> _$CustomerBySellerSunModelToJson(
57 'ddate': instance.ddate, 59 'ddate': instance.ddate,
58 'ddate_solt': instance.ddateSolt, 60 'ddate_solt': instance.ddateSolt,
59 'uid': instance.uid, 61 'uid': instance.uid,
60 - 'nick_name': instance.nickName 62 + 'nick_name': instance.nickName,
  63 + 'gid': instance.gid,
  64 + 'label': instance.label,
61 }; 65 };
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';  
4 -  
5 part 'guest_manage_model.g.dart'; 3 part 'guest_manage_model.g.dart';
6 4
7 @JsonSerializable() 5 @JsonSerializable()
@@ -118,13 +116,13 @@ class Drain extends Object { @@ -118,13 +116,13 @@ class Drain extends Object {
118 @JsonSerializable() 116 @JsonSerializable()
119 class Tips extends Object { 117 class Tips extends Object {
120 @JsonKey(name: 'task') 118 @JsonKey(name: 'task')
121 - List<List<String>> task; 119 + List<Task> task;
122 120
123 @JsonKey(name: 'recover') 121 @JsonKey(name: 'recover')
124 - List<String> recover; 122 + List<dynamic> recover;
125 123
126 @JsonKey(name: 'awaken') 124 @JsonKey(name: 'awaken')
127 - List<String> awaken; 125 + List<dynamic> awaken;
128 126
129 Tips( 127 Tips(
130 this.task, 128 this.task,
@@ -137,3 +135,64 @@ class Tips extends Object { @@ -137,3 +135,64 @@ class Tips extends Object {
137 135
138 Map<String, dynamic> toJson() => _$TipsToJson(this); 136 Map<String, dynamic> toJson() => _$TipsToJson(this);
139 } 137 }
  138 +
  139 +@JsonSerializable()
  140 +class Task extends Object {
  141 + @JsonKey(name: 'id')
  142 + String id;
  143 +
  144 + @JsonKey(name: 'sellerid')
  145 + String sellerid;
  146 +
  147 + @JsonKey(name: 'create_user')
  148 + String createUser;
  149 +
  150 + @JsonKey(name: 'uid')
  151 + String uid;
  152 +
  153 + @JsonKey(name: 'aid')
  154 + String aid;
  155 +
  156 + @JsonKey(name: 'gid')
  157 + String gid;
  158 +
  159 + @JsonKey(name: 'content')
  160 + String content;
  161 +
  162 + @JsonKey(name: 'is_update')
  163 + String isUpdate;
  164 +
  165 + @JsonKey(name: 'finished_status')
  166 + String finishedStatus;
  167 +
  168 + @JsonKey(name: 'edate')
  169 + String edate;
  170 +
  171 + @JsonKey(name: 'cdate')
  172 + String cdate;
  173 +
  174 + @JsonKey(name: 'remaining_time')
  175 + int remainingTime;
  176 +
  177 + String aidStr;
  178 +
  179 + Task(
  180 + this.id,
  181 + this.sellerid,
  182 + this.createUser,
  183 + this.uid,
  184 + this.aid,
  185 + this.gid,
  186 + this.content,
  187 + this.isUpdate,
  188 + this.finishedStatus,
  189 + this.edate,
  190 + this.cdate,
  191 + this.remainingTime
  192 + );
  193 +
  194 + factory Task.fromJson(Map<String, dynamic> srcJson) =>
  195 + _$TaskFromJson(srcJson);
  196 +
  197 + Map<String, dynamic> toJson() => _$TaskToJson(this);
  198 +}
@@ -90,10 +90,11 @@ Map<String, dynamic> _$DrainToJson(Drain instance) => <String, dynamic>{ @@ -90,10 +90,11 @@ Map<String, dynamic> _$DrainToJson(Drain instance) => <String, dynamic>{
90 Tips _$TipsFromJson(Map<String, dynamic> json) { 90 Tips _$TipsFromJson(Map<String, dynamic> json) {
91 return Tips( 91 return Tips(
92 (json['task'] as List) 92 (json['task'] as List)
93 - ?.map((e) => (e as List)?.map((e) => e as String)?.toList()) 93 + ?.map(
  94 + (e) => e == null ? null : Task.fromJson(e as Map<String, dynamic>))
94 ?.toList(), 95 ?.toList(),
95 - (json['recover'] as List)?.map((e) => e as String)?.toList(),  
96 - (json['awaken'] as List)?.map((e) => e as String)?.toList(), 96 + json['recover'] as List,
  97 + json['awaken'] as List,
97 ); 98 );
98 } 99 }
99 100
@@ -102,3 +103,35 @@ Map<String, dynamic> _$TipsToJson(Tips instance) => <String, dynamic>{ @@ -102,3 +103,35 @@ Map<String, dynamic> _$TipsToJson(Tips instance) => <String, dynamic>{
102 'recover': instance.recover, 103 'recover': instance.recover,
103 'awaken': instance.awaken, 104 'awaken': instance.awaken,
104 }; 105 };
  106 +
  107 +Task _$TaskFromJson(Map<String, dynamic> json) {
  108 + return Task(
  109 + json['id'] as String,
  110 + json['sellerid'] as String,
  111 + json['create_user'] as String,
  112 + json['uid'] as String,
  113 + json['aid'] as String,
  114 + json['gid'] as String,
  115 + json['content'] as String,
  116 + json['is_update'] as String,
  117 + json['finished_status'] as String,
  118 + json['edate'] as String,
  119 + json['cdate'] as String,
  120 + json['remaining_time'] as int,
  121 + );
  122 +}
  123 +
  124 +Map<String, dynamic> _$TaskToJson(Task instance) => <String, dynamic>{
  125 + 'id': instance.id,
  126 + 'sellerid': instance.sellerid,
  127 + 'create_user': instance.createUser,
  128 + 'uid': instance.uid,
  129 + 'aid': instance.aid,
  130 + 'gid': instance.gid,
  131 + 'content': instance.content,
  132 + 'is_update': instance.isUpdate,
  133 + 'finished_status': instance.finishedStatus,
  134 + 'edate': instance.edate,
  135 + 'cdate': instance.cdate,
  136 + 'remaining_time': instance.remainingTime
  137 + };
@@ -129,9 +129,12 @@ class SellerList extends Object { @@ -129,9 +129,12 @@ class SellerList extends Object {
129 String cdate; 129 String cdate;
130 130
131 String get cdateStr { 131 String get cdateStr {
132 - DateTime dateTime =  
133 - DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);  
134 - return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); 132 + if (cdate != null) {
  133 + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
  134 + int.parse(cdate.toString()) * 1000);
  135 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  136 + }
  137 + return '';
135 } 138 }
136 139
137 String get guestCount { 140 String get guestCount {
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'pull_marketing_by_uid_model.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class PullMarketingByUidModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + List<PullMarketingByUidSunModel> data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + PullMarketingByUidModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory PullMarketingByUidModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$PullMarketingByUidModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$PullMarketingByUidModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class PullMarketingByUidSunModel extends Object {
  30 + @JsonKey(name: 'id')
  31 + String id;
  32 +
  33 + @JsonKey(name: 'mid')
  34 + String mid;
  35 +
  36 + @JsonKey(name: 'uid')
  37 + String uid;
  38 +
  39 + @JsonKey(name: 'token')
  40 + String token;
  41 +
  42 + @JsonKey(name: 'content')
  43 + String content;
  44 +
  45 + @JsonKey(name: 'status')
  46 + String status;
  47 +
  48 + @JsonKey(name: 'is_pull')
  49 + String isPull;
  50 +
  51 + @JsonKey(name: 'cdate')
  52 + String cdate;
  53 +
  54 + PullMarketingByUidSunModel(
  55 + this.id,
  56 + this.mid,
  57 + this.uid,
  58 + this.token,
  59 + this.content,
  60 + this.status,
  61 + this.isPull,
  62 + this.cdate,
  63 + );
  64 +
  65 + factory PullMarketingByUidSunModel.fromJson(Map<String, dynamic> srcJson) =>
  66 + _$PullMarketingByUidSunModelFromJson(srcJson);
  67 +
  68 + Map<String, dynamic> toJson() => _$PullMarketingByUidSunModelToJson(this);
  69 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'pull_marketing_by_uid_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +PullMarketingByUidModel _$PullMarketingByUidModelFromJson(
  10 + Map<String, dynamic> json) {
  11 + return PullMarketingByUidModel(
  12 + json['ret'] as int,
  13 + (json['data'] as List)
  14 + ?.map((e) => e == null
  15 + ? null
  16 + : PullMarketingByUidSunModel.fromJson(e as Map<String, dynamic>))
  17 + ?.toList(),
  18 + json['msg'] as String,
  19 + );
  20 +}
  21 +
  22 +Map<String, dynamic> _$PullMarketingByUidModelToJson(
  23 + PullMarketingByUidModel instance) =>
  24 + <String, dynamic>{
  25 + 'ret': instance.ret,
  26 + 'data': instance.data,
  27 + 'msg': instance.msg,
  28 + };
  29 +
  30 +PullMarketingByUidSunModel _$PullMarketingByUidSunModelFromJson(
  31 + Map<String, dynamic> json) {
  32 + return PullMarketingByUidSunModel(
  33 + json['id'] as String,
  34 + json['mid'] as String,
  35 + json['uid'] as String,
  36 + json['token'] as String,
  37 + json['content'] as String,
  38 + json['status'] as String,
  39 + json['is_pull'] as String,
  40 + json['cdate'] as String,
  41 + );
  42 +}
  43 +
  44 +Map<String, dynamic> _$PullMarketingByUidSunModelToJson(
  45 + PullMarketingByUidSunModel instance) =>
  46 + <String, dynamic>{
  47 + 'id': instance.id,
  48 + 'mid': instance.mid,
  49 + 'uid': instance.uid,
  50 + 'token': instance.token,
  51 + 'content': instance.content,
  52 + 'status': instance.status,
  53 + 'is_pull': instance.isPull,
  54 + 'cdate': instance.cdate,
  55 + };
1 -import 'package:json_annotation/json_annotation.dart';  
2 -  
3 -part 'store_customer_home_model.g.dart'; 1 +import 'package:json_annotation/json_annotation.dart';
4 2
  3 +part 'store_customer_home_model.g.dart';
5 4
6 @JsonSerializable() 5 @JsonSerializable()
7 - class StoreCustomerHomeModel extends Object {  
8 - 6 +class StoreCustomerHomeModel extends Object {
9 @JsonKey(name: 'ret') 7 @JsonKey(name: 'ret')
10 int ret; 8 int ret;
11 9
@@ -15,18 +13,20 @@ part 'store_customer_home_model.g.dart'; @@ -15,18 +13,20 @@ part 'store_customer_home_model.g.dart';
15 @JsonKey(name: 'msg') 13 @JsonKey(name: 'msg')
16 String msg; 14 String msg;
17 15
18 - StoreCustomerHomeModel(this.ret,this.data,this.msg,); 16 + StoreCustomerHomeModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
19 21
20 - factory StoreCustomerHomeModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeModelFromJson(srcJson); 22 + factory StoreCustomerHomeModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$StoreCustomerHomeModelFromJson(srcJson);
21 24
22 Map<String, dynamic> toJson() => _$StoreCustomerHomeModelToJson(this); 25 Map<String, dynamic> toJson() => _$StoreCustomerHomeModelToJson(this);
23 -  
24 } 26 }
25 27
26 -  
27 @JsonSerializable() 28 @JsonSerializable()
28 - class StoreCustomerHomeSunModel extends Object {  
29 - 29 +class StoreCustomerHomeSunModel extends Object {
30 @JsonKey(name: 'myCustomer') 30 @JsonKey(name: 'myCustomer')
31 int myCustomer; 31 int myCustomer;
32 32
@@ -45,84 +45,93 @@ part 'store_customer_home_model.g.dart'; @@ -45,84 +45,93 @@ part 'store_customer_home_model.g.dart';
45 @JsonKey(name: 'distribution') 45 @JsonKey(name: 'distribution')
46 int distribution; 46 int distribution;
47 47
48 - StoreCustomerHomeSunModel(this.myCustomer,this.active,this.sleep,this.drain,this.sellerUser,this.distribution,); 48 + StoreCustomerHomeSunModel(
  49 + this.myCustomer,
  50 + this.active,
  51 + this.sleep,
  52 + this.drain,
  53 + this.sellerUser,
  54 + this.distribution,
  55 + );
49 56
50 - factory StoreCustomerHomeSunModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeSunModelFromJson(srcJson); 57 + factory StoreCustomerHomeSunModel.fromJson(Map<String, dynamic> srcJson) =>
  58 + _$StoreCustomerHomeSunModelFromJson(srcJson);
51 59
52 Map<String, dynamic> toJson() => _$StoreCustomerHomeSunModelToJson(this); 60 Map<String, dynamic> toJson() => _$StoreCustomerHomeSunModelToJson(this);
53 -  
54 } 61 }
55 62
56 -  
57 @JsonSerializable() 63 @JsonSerializable()
58 - class Active extends Object {  
59 - 64 +class Active extends Object {
60 @JsonKey(name: 'count') 65 @JsonKey(name: 'count')
61 int count; 66 int count;
62 67
63 @JsonKey(name: 'scale') 68 @JsonKey(name: 'scale')
64 double scale; 69 double scale;
65 70
66 - Active(this.count,this.scale,); 71 + Active(
  72 + this.count,
  73 + this.scale,
  74 + );
67 75
68 - factory Active.fromJson(Map<String, dynamic> srcJson) => _$ActiveFromJson(srcJson); 76 + factory Active.fromJson(Map<String, dynamic> srcJson) =>
  77 + _$ActiveFromJson(srcJson);
69 78
70 Map<String, dynamic> toJson() => _$ActiveToJson(this); 79 Map<String, dynamic> toJson() => _$ActiveToJson(this);
71 -  
72 } 80 }
73 81
74 -  
75 @JsonSerializable() 82 @JsonSerializable()
76 - class Sleep extends Object {  
77 - 83 +class Sleep extends Object {
78 @JsonKey(name: 'count') 84 @JsonKey(name: 'count')
79 int count; 85 int count;
80 86
81 @JsonKey(name: 'scale') 87 @JsonKey(name: 'scale')
82 double scale; 88 double scale;
83 89
84 - Sleep(this.count,this.scale,); 90 + Sleep(
  91 + this.count,
  92 + this.scale,
  93 + );
85 94
86 - factory Sleep.fromJson(Map<String, dynamic> srcJson) => _$SleepFromJson(srcJson); 95 + factory Sleep.fromJson(Map<String, dynamic> srcJson) =>
  96 + _$SleepFromJson(srcJson);
87 97
88 Map<String, dynamic> toJson() => _$SleepToJson(this); 98 Map<String, dynamic> toJson() => _$SleepToJson(this);
89 -  
90 } 99 }
91 100
92 -  
93 @JsonSerializable() 101 @JsonSerializable()
94 - class Drain extends Object {  
95 - 102 +class Drain extends Object {
96 @JsonKey(name: 'count') 103 @JsonKey(name: 'count')
97 int count; 104 int count;
98 105
99 @JsonKey(name: 'scale') 106 @JsonKey(name: 'scale')
100 double scale; 107 double scale;
101 108
102 - Drain(this.count,this.scale,); 109 + Drain(
  110 + this.count,
  111 + this.scale,
  112 + );
103 113
104 - factory Drain.fromJson(Map<String, dynamic> srcJson) => _$DrainFromJson(srcJson); 114 + factory Drain.fromJson(Map<String, dynamic> srcJson) =>
  115 + _$DrainFromJson(srcJson);
105 116
106 Map<String, dynamic> toJson() => _$DrainToJson(this); 117 Map<String, dynamic> toJson() => _$DrainToJson(this);
107 -  
108 } 118 }
109 119
110 -  
111 @JsonSerializable() 120 @JsonSerializable()
112 - class SellerUser extends Object {  
113 - 121 +class SellerUser extends Object {
114 @JsonKey(name: 'count') 122 @JsonKey(name: 'count')
115 String count; 123 String count;
116 124
117 @JsonKey(name: 'nick_name') 125 @JsonKey(name: 'nick_name')
118 String nickName; 126 String nickName;
119 127
120 - SellerUser(this.count,this.nickName,); 128 + @JsonKey(name: 'uid')
  129 + String uid;
121 130
122 - factory SellerUser.fromJson(Map<String, dynamic> srcJson) => _$SellerUserFromJson(srcJson); 131 + SellerUser(this.count, this.nickName, this.uid);
123 132
124 - Map<String, dynamic> toJson() => _$SellerUserToJson(this); 133 + factory SellerUser.fromJson(Map<String, dynamic> srcJson) =>
  134 + _$SellerUserFromJson(srcJson);
125 135
  136 + Map<String, dynamic> toJson() => _$SellerUserToJson(this);
126 } 137 }
127 -  
128 -  
@@ -98,6 +98,7 @@ SellerUser _$SellerUserFromJson(Map<String, dynamic> json) { @@ -98,6 +98,7 @@ SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
98 return SellerUser( 98 return SellerUser(
99 json['count'] as String, 99 json['count'] as String,
100 json['nick_name'] as String, 100 json['nick_name'] as String,
  101 + json['uid'] as String,
101 ); 102 );
102 } 103 }
103 104
@@ -105,4 +106,5 @@ Map<String, dynamic> _$SellerUserToJson(SellerUser instance) => @@ -105,4 +106,5 @@ Map<String, dynamic> _$SellerUserToJson(SellerUser instance) =>
105 <String, dynamic>{ 106 <String, dynamic>{
106 'count': instance.count, 107 'count': instance.count,
107 'nick_name': instance.nickName, 108 'nick_name': instance.nickName,
  109 + 'uid': instance.uid
108 }; 110 };
@@ -210,5 +210,9 @@ class HttpUrl { @@ -210,5 +210,9 @@ class HttpUrl {
210 "?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表 210 "?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表
211 static const String get_customer_by_seller = 211 static const String get_customer_by_seller =
212 "?service=App.GuestManage.GetCustomerBySeller"; // 全店客户列表 212 "?service=App.GuestManage.GetCustomerBySeller"; // 全店客户列表
  213 + static const String pull_marketing_by_uid =
  214 + "?service=App.GuestManage.PullMarketingByUid"; // 获取推送失败的营销消息
  215 + static const String set_pull_marketing_by_id =
  216 + "?service=App.GuestManage.SetPullMarketingByid"; // 修改拉取后消息的状态
213 217
214 } 218 }
@@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
6 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
7 import 'package:flutter_app_update/azhon_app_update.dart'; 7 import 'package:flutter_app_update/azhon_app_update.dart';
8 import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 import 'package:flutter_screenutil/flutter_screenutil.dart';
  9 +import 'package:one_key/models/pull_marketing_by_uid_model.dart';
9 10
10 import 'package:one_key/pages/message/message_page.dart'; 11 import 'package:one_key/pages/message/message_page.dart';
11 import 'package:one_key/pages/my/my_page.dart'; 12 import 'package:one_key/pages/my/my_page.dart';
@@ -52,6 +53,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -52,6 +53,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
52 int numPush = 0; //推送消息个数 53 int numPush = 0; //推送消息个数
53 54
54 Timer timer; 55 Timer timer;
  56 + Timer timerSeller;
55 57
56 int xgCount = 1; //注册信鸽次数,最多5次 58 int xgCount = 1; //注册信鸽次数,最多5次
57 59
@@ -64,13 +66,15 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -64,13 +66,15 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
64 // TODO: implement initState 66 // TODO: implement initState
65 super.initState(); 67 super.initState();
66 LogUtil.v("home_initState"); 68 LogUtil.v("home_initState");
  69 +
67 AzhonAppUpdate.listener( 70 AzhonAppUpdate.listener(
68 - // () {  
69 - // needUpdate = false;  
70 - // // print(map['type']);  
71 - // }  
72 - ); 71 + // () {
  72 + // needUpdate = false;
  73 + // // print(map['type']);
  74 + // }
  75 + );
73 WidgetsBinding.instance.addObserver(this); 76 WidgetsBinding.instance.addObserver(this);
  77 +
74 _currIndex = widget.initialIndex; 78 _currIndex = widget.initialIndex;
75 _pageController = PageController(initialPage: _currIndex); 79 _pageController = PageController(initialPage: _currIndex);
76 pages 80 pages
@@ -101,6 +105,33 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -101,6 +105,33 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
101 )); 105 ));
102 WidgetsBinding.instance.addPostFrameCallback((_) { 106 WidgetsBinding.instance.addPostFrameCallback((_) {
103 initPlatformState(); 107 initPlatformState();
  108 + List<PullMarketingByUidSunModel> data =
  109 + Provider.of<UserModel>(context, listen: false)
  110 + .pullMarketingByUidSunModel;
  111 + if (data != null && data.length > 0) {
  112 + Future.delayed(Duration(seconds: 300), () {
  113 + DialogUtil.cupertinoAlertDialog(context,
  114 + title: "全店任务",
  115 + content: "管理员发布了新的任务,请立即查看并完成任务",
  116 + lTitle: "稍后提醒",
  117 + rTitle: "立即查看", lCallback: () {
  118 + print("稍后提醒");
  119 + // 30分钟后重新弹窗
  120 + _startTimerSeller();
  121 + }, rCallback: () {
  122 + _endTimerSeller();
  123 + if (data.length == 1) {
  124 + //进入营销详情
  125 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
  126 + context, data[0].mid,
  127 + fromNotify: true);
  128 + } else {
  129 + //进入我的客情首页
  130 + NavigatorUtil.goMyCustomerPage(context);
  131 + }
  132 + });
  133 + });
  134 + }
104 if (widget.initialIndex == 0) return; 135 if (widget.initialIndex == 0) return;
105 _getIntent(); 136 _getIntent();
106 Future.delayed(Duration(milliseconds: 30000), () { 137 Future.delayed(Duration(milliseconds: 30000), () {
@@ -118,6 +149,42 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -118,6 +149,42 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
118 }); 149 });
119 } 150 }
120 151
  152 + _endTimerSeller() {
  153 + if (timerSeller != null) {
  154 + timerSeller.cancel();
  155 + }
  156 + }
  157 +
  158 + _startTimerSeller() {
  159 + _endTimerSeller();
  160 + timerSeller = Timer.periodic(Duration(minutes: 30), (_) {
  161 + _endTimerSeller();
  162 + List<PullMarketingByUidSunModel> data =
  163 + Provider.of<UserModel>(context, listen: false)
  164 + .pullMarketingByUidSunModel;
  165 + DialogUtil.cupertinoAlertDialog(context,
  166 + title: "全店任务",
  167 + content: "管理员发布了新的任务,请立即查看并完成任务",
  168 + lTitle: "稍后提醒",
  169 + rTitle: "立即查看", lCallback: () {
  170 + print("稍后提醒");
  171 + // 30分钟后重新弹窗
  172 + _startTimerSeller();
  173 + }, rCallback: () {
  174 + _endTimerSeller();
  175 + if (data.length == 1) {
  176 + //进入营销详情
  177 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
  178 + context, data[0].mid,
  179 + fromNotify: true);
  180 + } else {
  181 + //进入我的客情首页
  182 + NavigatorUtil.goMyCustomerPage(context);
  183 + }
  184 + });
  185 + });
  186 + }
  187 +
121 //获取点击通知栏的自定义参数 188 //获取点击通知栏的自定义参数
122 _getIntent() async { 189 _getIntent() async {
123 _clearBadge(() {}); 190 _clearBadge(() {});
@@ -129,6 +196,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -129,6 +196,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
129 LogUtil.v(param.toString()); 196 LogUtil.v(param.toString());
130 if (notifyParam != null && notifyParam.isNotEmpty) { 197 if (notifyParam != null && notifyParam.isNotEmpty) {
131 switch (notifyParam["messageType"]) { 198 switch (notifyParam["messageType"]) {
  199 + case "Marketing":
  200 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
  201 + context, notifyParam['mid'],
  202 + fromNotify: true);
  203 + break;
132 case "10": 204 case "10":
133 NavigatorUtil.goHandleOnlinePage( 205 NavigatorUtil.goHandleOnlinePage(
134 context, notifyParam["rid"], notifyParam['mid'], 206 context, notifyParam["rid"], notifyParam['mid'],
@@ -228,6 +300,25 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -228,6 +300,25 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
228 print("flutter onReceiveNotificationResponse $msg"); 300 print("flutter onReceiveNotificationResponse $msg");
229 numPush++; 301 numPush++;
230 _addBadge(); 302 _addBadge();
  303 + Uri u = Uri.parse(msg['activity']);
  304 + String messageType = u.queryParameters['messageType'];
  305 + if (messageType == "Marketing") {
  306 + String mid = u.queryParameters['mid'];
  307 + DialogUtil.cupertinoAlertDialog(context,
  308 + title: "全店任务",
  309 + content: "管理员发布了新的任务,请立即查看并完成任务",
  310 + lTitle: "稍后提醒",
  311 + rTitle: "立即查看", lCallback: () {
  312 + print("稍后提醒");
  313 + // 30分钟后重新弹窗
  314 + _startTimerSeller();
  315 + }, rCallback: () {
  316 + _endTimerSeller();
  317 + //进入营销详情
  318 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context, mid,
  319 + fromNotify: true);
  320 + });
  321 + }
231 }, 322 },
232 onReceiveMessage: (Map<String, dynamic> msg) async { 323 onReceiveMessage: (Map<String, dynamic> msg) async {
233 print("flutter onReceiveMessage $msg"); 324 print("flutter onReceiveMessage $msg");
@@ -251,10 +342,16 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -251,10 +342,16 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
251 print("flutter xgPushDidClearAllIdentifiers: $msg"); 342 print("flutter xgPushDidClearAllIdentifiers: $msg");
252 }, 343 },
253 xgPushClickAction: (Map<String, dynamic> msg) async { 344 xgPushClickAction: (Map<String, dynamic> msg) async {
  345 + print(msg);
254 _clearBadge(() {}); 346 _clearBadge(() {});
255 if (Platform.isIOS && msg != null && msg['custom'] != null) { 347 if (Platform.isIOS && msg != null && msg['custom'] != null) {
256 Map custom = json.decode(msg['custom'].toString()); 348 Map custom = json.decode(msg['custom'].toString());
257 switch (custom["messageType"].toString()) { 349 switch (custom["messageType"].toString()) {
  350 + case "Marketing":
  351 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
  352 + context, custom['mid'],
  353 + fromNotify: true);
  354 + break;
258 case "10": 355 case "10":
259 NavigatorUtil.goHandleOnlinePage( 356 NavigatorUtil.goHandleOnlinePage(
260 context, custom["rid"].toString(), custom['mid'].toString(), 357 context, custom["rid"].toString(), custom['mid'].toString(),
@@ -322,6 +419,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -322,6 +419,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
322 } 419 }
323 }, 420 },
324 ); 421 );
  422 +
325 registerPush(); 423 registerPush();
326 } 424 }
327 425
@@ -762,6 +860,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -762,6 +860,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
762 if (timer != null) { 860 if (timer != null) {
763 timer.cancel(); 861 timer.cancel();
764 } 862 }
  863 + if (timerSeller != null) {
  864 + timerSeller.cancel();
  865 + }
765 WidgetsBinding.instance.removeObserver(this); 866 WidgetsBinding.instance.removeObserver(this);
766 } 867 }
767 } 868 }
  1 +import 'dart:convert';
  2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 4 import 'package:flutter_screenutil/screenutil.dart';
3 import 'package:one_key/constant/state.dart'; 5 import 'package:one_key/constant/state.dart';
@@ -32,7 +34,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -32,7 +34,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
32 super.initState(); 34 super.initState();
33 35
34 WidgetsBinding.instance.addPostFrameCallback((_) { 36 WidgetsBinding.instance.addPostFrameCallback((_) {
35 - _getGuestManageData(); 37 + _couponNetworkData();
  38 +
36 _getMarketingByUid(); 39 _getMarketingByUid();
37 }); 40 });
38 41
@@ -55,6 +58,28 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -55,6 +58,28 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
55 // setState(() {}); 58 // setState(() {});
56 } 59 }
57 60
  61 + ///消费券
  62 + _couponNetworkData({bool isShowLoading = true}) async {
  63 + // customerMakingProvider.couponSelectIndex = 0;
  64 + Map<String, String> params = {
  65 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  66 + };
  67 + await customerProvider.getCustomerSelectActivityNew(context, params,
  68 + isShowLoading: isShowLoading);
  69 + //此人已经新建好券
  70 + // if (customerProvider.couponListSelect.length > 0) {
  71 + // for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  72 + // if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
  73 + // aidStr = customerProvider.couponListSelect[i].aname;
  74 + // }
  75 + // }
  76 + // customerProvider.notifyListeners();
  77 + // } else {
  78 + // //没有新建的优惠券
  79 + // }
  80 + _getGuestManageData();
  81 + }
  82 +
58 _getMarketingByUid() async { 83 _getMarketingByUid() async {
59 Map<String, String> params = { 84 Map<String, String> params = {
60 "uid": Provider.of<UserModel>(context, listen: false).user.openid 85 "uid": Provider.of<UserModel>(context, listen: false).user.openid
@@ -253,65 +278,73 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -253,65 +278,73 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
253 controller: _controller, 278 controller: _controller,
254 shrinkWrap: true, 279 shrinkWrap: true,
255 cacheExtent: ScreenUtil().setWidth(0), 280 cacheExtent: ScreenUtil().setWidth(0),
256 - itemCount:  
257 - customerProvider.guestSunmodel.tips.task.length, 281 + itemCount: customerProvider.guestSunmodel.tips.task ==
  282 + null
  283 + ? 0
  284 + : customerProvider.guestSunmodel.tips.task.length,
258 itemBuilder: (BuildContext context, int index) { 285 itemBuilder: (BuildContext context, int index) {
259 // locationState = state; 286 // locationState = state;
260 - List<String> data = 287 + Task data =
261 customerProvider.guestSunmodel.tips.task[index]; 288 customerProvider.guestSunmodel.tips.task[index];
262 return Column( 289 return Column(
263 children: [ 290 children: [
264 VEmptyView(10), 291 VEmptyView(10),
265 - Stack(children: [  
266 - Container(  
267 - color: MyColours.color_ffffff,  
268 - padding: EdgeInsets.symmetric(  
269 - horizontal: ScreenUtil().setWidth(20),  
270 - vertical: ScreenUtil().setWidth(30)),  
271 - child: Row(  
272 - children: [  
273 - Image.asset(  
274 - Utils.getImgPath('warning'),  
275 - width: ScreenUtil().setWidth(42),  
276 - ),  
277 - HEmptyView(15),  
278 - Expanded(  
279 - child: Column(  
280 - crossAxisAlignment:  
281 - CrossAxisAlignment.start,  
282 - children: [  
283 - Text(  
284 - '${data[0]}',  
285 - maxLines: 1,  
286 - overflow: TextOverflow.ellipsis,  
287 - style: TextStyle(  
288 - color: MyColours.color_333333,  
289 - fontSize:  
290 - ScreenUtil().setSp(32)),  
291 - ),  
292 - VEmptyView(8),  
293 - Text(  
294 - '${data[1]}',  
295 - maxLines: 1,  
296 - overflow: TextOverflow.ellipsis,  
297 - style: TextStyle(  
298 - color: MyColours.color_333333,  
299 - fontSize:  
300 - ScreenUtil().setSp(24)),  
301 - ),  
302 - VEmptyView(8),  
303 - Text(  
304 - '${data[2]}',  
305 - maxLines: 1,  
306 - overflow: TextOverflow.ellipsis,  
307 - style: TextStyle(  
308 - color: MyColours.color_333333,  
309 - fontSize:  
310 - ScreenUtil().setSp(26)),  
311 - )  
312 - ],  
313 - )),  
314 - HEmptyView(20), 292 + Container(
  293 + color: MyColours.color_ffffff,
  294 + padding: EdgeInsets.symmetric(
  295 + horizontal: ScreenUtil().setWidth(20),
  296 + vertical: ScreenUtil().setWidth(30)),
  297 + child: Row(
  298 + children: [
  299 + Image.asset(
  300 + Utils.getImgPath('warning'),
  301 + width: ScreenUtil().setWidth(42),
  302 + ),
  303 + HEmptyView(15),
  304 + Expanded(
  305 + child: Column(
  306 + crossAxisAlignment:
  307 + CrossAxisAlignment.start,
  308 + children: [
  309 + Text(
  310 + '店内任务:${data.content}',
  311 + maxLines: 1,
  312 + overflow: TextOverflow.ellipsis,
  313 + style: TextStyle(
  314 + color: MyColours.color_333333,
  315 + fontSize: ScreenUtil().setSp(32)),
  316 + ),
  317 + data.aid != null && data.aidStr != null
  318 + ? Padding(
  319 + padding: EdgeInsets.only(
  320 + top: ScreenUtil()
  321 + .setWidth(8)),
  322 + child: Text(
  323 + '优惠内容:${data.aidStr}',
  324 + maxLines: 1,
  325 + overflow:
  326 + TextOverflow.ellipsis,
  327 + style: TextStyle(
  328 + color: MyColours
  329 + .color_333333,
  330 + fontSize: ScreenUtil()
  331 + .setSp(24)),
  332 + ),
  333 + )
  334 + : SizedBox(),
  335 + VEmptyView(8),
  336 + Text(
  337 + '创建人:${data.createUser}',
  338 + maxLines: 1,
  339 + overflow: TextOverflow.ellipsis,
  340 + style: TextStyle(
  341 + color: MyColours.color_333333,
  342 + fontSize: ScreenUtil().setSp(26)),
  343 + )
  344 + ],
  345 + )),
  346 + HEmptyView(20),
  347 + Column(children: [
315 RoundButton( 348 RoundButton(
316 text: '立即完成', 349 text: '立即完成',
317 350
@@ -327,27 +360,34 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -327,27 +360,34 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
327 fontSize: 26, 360 fontSize: 26,
328 isBold: false, 361 isBold: false,
329 onPressed: () { 362 onPressed: () {
330 - // NavigatorUtil  
331 - // .goMyMakeMarkingPageOnlyShow(  
332 - // context, widget.sellerList);  
333 - // NavigatorUtil.goEnterStoreEnvironmentPage(context); 363 + SellerList sellerList =
  364 + SellerList.fromJson(json
  365 + .decode(json.encode(data)));
  366 + NavigatorUtil
  367 + .goMyMakeMarkingPageOnlyShow(
  368 + context, sellerList);
334 }, 369 },
335 ), 370 ),
336 - ],  
337 - ), 371 + data.remainingTime != null
  372 + ? Padding(
  373 + padding: EdgeInsets.only(
  374 + top:
  375 + ScreenUtil().setWidth(6)),
  376 + child: Text(
  377 + '${data.remainingTime}天内',
  378 + maxLines: 1,
  379 + overflow: TextOverflow.ellipsis,
  380 + style: TextStyle(
  381 + color: Color.fromRGBO(
  382 + 215, 30, 40, 1),
  383 + fontSize:
  384 + ScreenUtil().setSp(26)),
  385 + ))
  386 + : SizedBox()
  387 + ])
  388 + ],
338 ), 389 ),
339 - Positioned(  
340 - bottom: ScreenUtil().setWidth(24),  
341 - right: ScreenUtil().setWidth(70),  
342 - child: Text(  
343 - '${data[3]}',  
344 - maxLines: 1,  
345 - overflow: TextOverflow.ellipsis,  
346 - style: TextStyle(  
347 - color: Color.fromRGBO(215, 30, 40, 1),  
348 - fontSize: ScreenUtil().setSp(26)),  
349 - ))  
350 - ]) 390 + ),
351 ], 391 ],
352 ); 392 );
353 }), 393 }),
@@ -356,7 +396,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -356,7 +396,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
356 shrinkWrap: true, 396 shrinkWrap: true,
357 cacheExtent: ScreenUtil().setWidth(0), 397 cacheExtent: ScreenUtil().setWidth(0),
358 itemCount: 398 itemCount:
359 - customerProvider.guestSunmodel.tips.recover.length, 399 + customerProvider.guestSunmodel.tips.recover == null
  400 + ? 0
  401 + : customerProvider
  402 + .guestSunmodel.tips.recover.length,
360 itemBuilder: (BuildContext context, int index) { 403 itemBuilder: (BuildContext context, int index) {
361 // locationState = state; 404 // locationState = state;
362 405
@@ -416,8 +459,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -416,8 +459,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
416 controller: _controller, 459 controller: _controller,
417 shrinkWrap: true, 460 shrinkWrap: true,
418 cacheExtent: ScreenUtil().setWidth(0), 461 cacheExtent: ScreenUtil().setWidth(0),
419 - itemCount:  
420 - customerProvider.guestSunmodel.tips.recover.length, 462 + itemCount: customerProvider.guestSunmodel.tips.awaken ==
  463 + null
  464 + ? 0
  465 + : customerProvider.guestSunmodel.tips.awaken.length,
421 itemBuilder: (BuildContext context, int index) { 466 itemBuilder: (BuildContext context, int index) {
422 // locationState = state; 467 // locationState = state;
423 468
@@ -236,7 +236,8 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { @@ -236,7 +236,8 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
236 // await Sendsms.onGetPermission(); 236 // await Sendsms.onGetPermission();
237 237
238 // if (await Sendsms.hasPermission()) { 238 // if (await Sendsms.hasPermission()) {
239 - await Sendsms.onSendSMS(andriodPhone, message); 239 + bool suceess = await Sendsms.onSendSMS(andriodPhone, message);
  240 + print(suceess);
240 } 241 }
241 242
242 // } 243 // }
@@ -19,8 +19,10 @@ import 'package:provider/provider.dart'; @@ -19,8 +19,10 @@ import 'package:provider/provider.dart';
19 19
20 class SellerMyMarketingRecordsDetailPage extends StatefulWidget { 20 class SellerMyMarketingRecordsDetailPage extends StatefulWidget {
21 final String idstr; 21 final String idstr;
22 - final SellerList sellerList;  
23 - SellerMyMarketingRecordsDetailPage({Key key, this.idstr, this.sellerList}) 22 + final bool fromNotify;
  23 +
  24 + SellerMyMarketingRecordsDetailPage(
  25 + {Key key, this.idstr, this.fromNotify = false})
24 : super(key: key); 26 : super(key: key);
25 27
26 @override 28 @override
@@ -32,6 +34,7 @@ class _SellerMyMarketingRecordsDetailPageState @@ -32,6 +34,7 @@ class _SellerMyMarketingRecordsDetailPageState
32 extends State<SellerMyMarketingRecordsDetailPage> { 34 extends State<SellerMyMarketingRecordsDetailPage> {
33 CustomerProvider customerProvider; 35 CustomerProvider customerProvider;
34 String aidStr = ''; 36 String aidStr = '';
  37 + SellerList sellerList;
35 @override 38 @override
36 void initState() { 39 void initState() {
37 super.initState(); 40 super.initState();
@@ -40,7 +43,8 @@ class _SellerMyMarketingRecordsDetailPageState @@ -40,7 +43,8 @@ class _SellerMyMarketingRecordsDetailPageState
40 // _getMarketingBySeller(); 43 // _getMarketingBySeller();
41 // } 44 // }
42 // _getMarketingById(); 45 // _getMarketingById();
43 - _couponNetworkData(); 46 + _getMarketingByUid();
  47 + // _couponNetworkData();
44 }); 48 });
45 } 49 }
46 50
@@ -49,6 +53,22 @@ class _SellerMyMarketingRecordsDetailPageState @@ -49,6 +53,22 @@ class _SellerMyMarketingRecordsDetailPageState
49 super.dispose(); 53 super.dispose();
50 } 54 }
51 55
  56 + _getMarketingByUid() async {
  57 + Map<String, String> params = {
  58 + "uid": Provider.of<UserModel>(context, listen: false).user.openid
  59 + };
  60 + await customerProvider.getMarketingByUid(context, params);
  61 + for (SellerList item in customerProvider.myRecordData.sellerList) {
  62 + if (item.id == widget.idstr) {
  63 + setState(() {
  64 + sellerList = item;
  65 + });
  66 + }
  67 + }
  68 + _couponNetworkData();
  69 + // await customerProvider.searchData(customerProvider.controller.text);
  70 + }
  71 +
52 // _getMarketingById() async { 72 // _getMarketingById() async {
53 // Map<String, String> params = {"id": widget.idstr}; 73 // Map<String, String> params = {"id": widget.idstr};
54 // await customerProvider.getMarketingById(context, params); 74 // await customerProvider.getMarketingById(context, params);
@@ -69,7 +89,7 @@ class _SellerMyMarketingRecordsDetailPageState @@ -69,7 +89,7 @@ class _SellerMyMarketingRecordsDetailPageState
69 //此人已经新建好券 89 //此人已经新建好券
70 if (customerProvider.couponListSelect.length > 0) { 90 if (customerProvider.couponListSelect.length > 0) {
71 for (int i = 0; i < customerProvider.couponListSelect.length; i++) { 91 for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
72 - if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) { 92 + if (sellerList.aid == customerProvider.couponListSelect[i].id) {
73 aidStr = customerProvider.couponListSelect[i].aname; 93 aidStr = customerProvider.couponListSelect[i].aname;
74 } 94 }
75 } 95 }
@@ -120,156 +140,177 @@ class _SellerMyMarketingRecordsDetailPageState @@ -120,156 +140,177 @@ class _SellerMyMarketingRecordsDetailPageState
120 appBar: SystemAppBar( 140 appBar: SystemAppBar(
121 '营销任务详情', 141 '营销任务详情',
122 onTap: () { 142 onTap: () {
123 - Navigator.pop(context); 143 + if (widget.fromNotify) {
  144 + NavigatorUtil.goHomePage(context, initialIndex: 0);
  145 + } else {
  146 + Navigator.of(context).pop();
  147 + }
124 }, 148 },
125 ), 149 ),
126 - body: Padding( 150 + body: WillPopScope(
  151 + child: Padding(
127 padding: EdgeInsets.symmetric( 152 padding: EdgeInsets.symmetric(
128 horizontal: ScreenUtil().setWidth(30), 153 horizontal: ScreenUtil().setWidth(30),
129 // vertical: ScreenUtil().setWidth(40) 154 // vertical: ScreenUtil().setWidth(40)
130 ), 155 ),
131 - child: Column(  
132 - children: [  
133 - Expanded(  
134 - child: SingleChildScrollView(  
135 - child: Column(  
136 - crossAxisAlignment: CrossAxisAlignment.start,  
137 - children: [  
138 - Stack(  
139 - alignment: Alignment.bottomCenter,  
140 - children: [  
141 - Column(  
142 - children: [  
143 - RowMultiText(  
144 - '创建日期',  
145 - widget.sellerList.cdateStr,  
146 - textColor: MyColours.color_333333,  
147 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
148 - ),  
149 - RowMultiText(  
150 - '创建人',  
151 - widget.sellerList.createUser,  
152 - textColor: MyColours.color_333333,  
153 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
154 - ),  
155 - ],  
156 - ),  
157 - widget.sellerList.finishedStatus == '0' ||  
158 - widget.sellerList.finishedStatus == '1' ||  
159 - widget.sellerList.finishedStatus == '2'  
160 - ? Positioned(  
161 - child: Image.asset(  
162 - Utils.getImgPath(widget  
163 - .sellerList.finishedStatus ==  
164 - '0'  
165 - ? 'c_state_ing'  
166 - : widget.sellerList.finishedStatus == '1'  
167 - ? 'c_state_done'  
168 - : 'c_state_cancel'),  
169 - width: ScreenUtil().setWidth(140),  
170 - ))  
171 - : SizedBox()  
172 - ],  
173 - ),  
174 - RowMultiText(  
175 - '完成期限',  
176 - widget.sellerList.edate == null  
177 - ? '无限制'  
178 - : widget.sellerList.edate,  
179 - textColor: MyColours.color_333333,  
180 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
181 - ),  
182 - RowMultiText(  
183 - '修改短信内容',  
184 - widget.sellerList.isUpdate == '1' ? '可修改' : '不可修改',  
185 - textColor: MyColours.color_333333,  
186 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
187 - ),  
188 - RowMultiText(  
189 - '优惠信息',  
190 - aidStr,  
191 - textColor: MyColours.color_333333,  
192 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
193 - ),  
194 - Padding(  
195 - padding: EdgeInsets.only(  
196 - top: ScreenUtil().setWidth(25),  
197 - bottom: ScreenUtil().setWidth(20)),  
198 - child: Text(  
199 - '短信内容',  
200 - style: TextStyle(  
201 - color: MyColours.color_333333,  
202 - fontSize: ScreenUtil().setSp(30)),  
203 - )),  
204 - Padding(  
205 - padding: EdgeInsets.only(  
206 - bottom: ScreenUtil().setWidth(25)),  
207 - child: Text(  
208 - widget.sellerList.content,  
209 - style: TextStyle(  
210 - color: MyColours.color_999999,  
211 - fontSize: ScreenUtil().setSp(30)),  
212 - )),  
213 - InkWell(  
214 - onTap: () {  
215 - NavigatorUtil.goShowCustomerListPage(  
216 - context,  
217 - FromPage.FromPageStoreCustomer,  
218 - widget.sellerList.gid);  
219 - // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);  
220 - },  
221 - child: Padding(  
222 - padding: EdgeInsets.symmetric(  
223 - vertical: ScreenUtil().setWidth(25),  
224 - ),  
225 - child: Row(  
226 - crossAxisAlignment: CrossAxisAlignment.center, 156 + child: sellerList == null
  157 + ? SizedBox()
  158 + : Column(
  159 + children: [
  160 + Expanded(
  161 + child: SingleChildScrollView(
  162 + child: Column(
  163 + crossAxisAlignment: CrossAxisAlignment.start,
  164 + children: [
  165 + Stack(
  166 + alignment: Alignment.bottomCenter,
  167 + children: [
  168 + Column(
227 children: [ 169 children: [
228 - Text(  
229 - '总客户人数',  
230 - style: TextStyle(  
231 - color: MyColours.color_333333,  
232 - fontSize: ScreenUtil().setSp(30)), 170 + RowMultiText(
  171 + '创建日期',
  172 + sellerList.cdateStr,
  173 + textColor: MyColours.color_333333,
  174 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  175 + ),
  176 + RowMultiText(
  177 + '创建人',
  178 + sellerList.createUser,
  179 + textColor: MyColours.color_333333,
  180 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  181 + ),
  182 + ],
  183 + ),
  184 + sellerList.finishedStatus == '0' ||
  185 + sellerList.finishedStatus == '1' ||
  186 + sellerList.finishedStatus == '2'
  187 + ? Positioned(
  188 + child: Image.asset(
  189 + Utils.getImgPath(sellerList
  190 + .finishedStatus ==
  191 + '0'
  192 + ? 'c_state_ing'
  193 + : sellerList.finishedStatus == '1'
  194 + ? 'c_state_done'
  195 + : 'c_state_cancel'),
  196 + width: ScreenUtil().setWidth(140),
  197 + ))
  198 + : SizedBox()
  199 + ],
  200 + ),
  201 + RowMultiText(
  202 + '完成期限',
  203 + sellerList.edate == null
  204 + ? '无限制'
  205 + : sellerList.edate,
  206 + textColor: MyColours.color_333333,
  207 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  208 + ),
  209 + RowMultiText(
  210 + '修改短信内容',
  211 + sellerList.isUpdate == '1' ? '可修改' : '不可修改',
  212 + textColor: MyColours.color_333333,
  213 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  214 + ),
  215 + RowMultiText(
  216 + '优惠信息',
  217 + aidStr,
  218 + textColor: MyColours.color_333333,
  219 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  220 + ),
  221 + Padding(
  222 + padding: EdgeInsets.only(
  223 + top: ScreenUtil().setWidth(25),
  224 + bottom: ScreenUtil().setWidth(20)),
  225 + child: Text(
  226 + '短信内容',
  227 + style: TextStyle(
  228 + color: MyColours.color_333333,
  229 + fontSize: ScreenUtil().setSp(30)),
  230 + )),
  231 + Padding(
  232 + padding: EdgeInsets.only(
  233 + bottom: ScreenUtil().setWidth(25)),
  234 + child: Text(
  235 + sellerList.content,
  236 + style: TextStyle(
  237 + color: MyColours.color_999999,
  238 + fontSize: ScreenUtil().setSp(30)),
  239 + )),
  240 + InkWell(
  241 + onTap: () {
  242 + NavigatorUtil.goShowCustomerListPage(
  243 + context,
  244 + FromPage.FromPageStoreCustomer,
  245 + sellerList.gid);
  246 + // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
  247 + },
  248 + child: Padding(
  249 + padding: EdgeInsets.symmetric(
  250 + vertical: ScreenUtil().setWidth(25),
233 ), 251 ),
234 - Spacer(),  
235 - Text('${widget.sellerList.guestCount}人',  
236 - style: TextStyle(  
237 - color: MyColours.color_333333,  
238 - fontSize: ScreenUtil().setSp(30))),  
239 - HEmptyView(10),  
240 - Text('查看',  
241 - style: TextStyle(  
242 - decoration:  
243 - TextDecoration.underline,  
244 - color: MyColours.color_199095,  
245 - fontSize: ScreenUtil().setSp(30))),  
246 - ]))),  
247 - ]))),  
248 - Column(  
249 - children: [  
250 - widget.sellerList.finishedStatus == '0'  
251 - ? RoundButton(  
252 - text: '立刻完成',  
253 - gradientStart: MyColours.color_199095,  
254 - gradientEnd: MyColours.color_199095,  
255 - textColor: MyColours.color_ffffff,  
256 - // borderColor: MyColours.color_999999,  
257 - radius: ScreenUtil().setWidth(10),  
258 - height: ScreenUtil().setWidth(80),  
259 - fontSize: 26,  
260 - margin: EdgeInsets.symmetric(  
261 - horizontal: ScreenUtil().setWidth(200)),  
262 - isBold: false,  
263 - onPressed: () {  
264 - NavigatorUtil.goMyMakeMarkingPageOnlyShow(  
265 - context, widget.sellerList);  
266 - },  
267 - )  
268 - : SizedBox(),  
269 - VEmptyView(30),  
270 - ],  
271 - )  
272 - ],  
273 - ))); 252 + child: Row(
  253 + crossAxisAlignment:
  254 + CrossAxisAlignment.center,
  255 + children: [
  256 + Text(
  257 + '总客户人数',
  258 + style: TextStyle(
  259 + color: MyColours.color_333333,
  260 + fontSize:
  261 + ScreenUtil().setSp(30)),
  262 + ),
  263 + Spacer(),
  264 + Text('${sellerList.guestCount}人',
  265 + style: TextStyle(
  266 + color: MyColours.color_333333,
  267 + fontSize:
  268 + ScreenUtil().setSp(30))),
  269 + HEmptyView(10),
  270 + Text('查看',
  271 + style: TextStyle(
  272 + decoration:
  273 + TextDecoration.underline,
  274 + color: MyColours.color_199095,
  275 + fontSize:
  276 + ScreenUtil().setSp(30))),
  277 + ]))),
  278 + ]))),
  279 + Column(
  280 + children: [
  281 + sellerList.finishedStatus == '0'
  282 + ? RoundButton(
  283 + text: '立刻完成',
  284 + gradientStart: MyColours.color_199095,
  285 + gradientEnd: MyColours.color_199095,
  286 + textColor: MyColours.color_ffffff,
  287 + // borderColor: MyColours.color_999999,
  288 + radius: ScreenUtil().setWidth(10),
  289 + height: ScreenUtil().setWidth(80),
  290 + fontSize: 26,
  291 + margin: EdgeInsets.symmetric(
  292 + horizontal: ScreenUtil().setWidth(200)),
  293 + isBold: false,
  294 + onPressed: () {
  295 + NavigatorUtil.goMyMakeMarkingPageOnlyShow(
  296 + context, sellerList);
  297 + },
  298 + )
  299 + : SizedBox(),
  300 + VEmptyView(30),
  301 + ],
  302 + )
  303 + ],
  304 + ),
  305 + ),
  306 + onWillPop: () async {
  307 + if (widget.fromNotify) {
  308 + NavigatorUtil.goHomePage(context, initialIndex: 0);
  309 + return true;
  310 + }
  311 + Navigator.of(context).pop();
  312 + return true;
  313 + },
  314 + ));
274 } 315 }
275 } 316 }
@@ -156,7 +156,7 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> { @@ -156,7 +156,7 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> {
156 onTap: () { 156 onTap: () {
157 NavigatorUtil 157 NavigatorUtil
158 .goSellerMyMarketingRecordsDetailPage( 158 .goSellerMyMarketingRecordsDetailPage(
159 - context, data.id, data); 159 + context, data.id);
160 }, 160 },
161 child: Text('查看详情', 161 child: Text('查看详情',
162 style: TextStyle( 162 style: TextStyle(
@@ -111,17 +111,18 @@ class _ContactListPageState extends State<ContactListPage> { @@ -111,17 +111,18 @@ class _ContactListPageState extends State<ContactListPage> {
111 width: ScreenUtil().setWidth(2)))), 111 width: ScreenUtil().setWidth(2)))),
112 child: Row( 112 child: Row(
113 children: [ 113 children: [
114 - InkWell( 114 + GestureDetector(
  115 + behavior: HitTestBehavior.opaque,
115 onTap: () { 116 onTap: () {
116 List<CustomerBySellerSunModel> data = 117 List<CustomerBySellerSunModel> data =
117 widget.provider.customerBySellerList; 118 widget.provider.customerBySellerList;
118 data[index].select = !data[index].select; 119 data[index].select = !data[index].select;
119 if (data[index].select) { 120 if (data[index].select) {
120 - // widget.provider.addData(index); 121 + widget.provider.addData(index);
121 } else { 122 } else {
122 - // widget.provider.cancelData(index); 123 + widget.provider.cancelData(index);
123 } 124 }
124 - // widget.provider.getCheckValue(); 125 + widget.provider.getCheckValue();
125 }, 126 },
126 child: Stack( 127 child: Stack(
127 alignment: Alignment.bottomCenter, 128 alignment: Alignment.bottomCenter,
@@ -185,126 +186,138 @@ class _ContactListPageState extends State<ContactListPage> { @@ -185,126 +186,138 @@ class _ContactListPageState extends State<ContactListPage> {
185 )), 186 )),
186 HEmptyView(20), 187 HEmptyView(20),
187 Expanded( 188 Expanded(
188 - child: Column(  
189 - crossAxisAlignment: CrossAxisAlignment.start,  
190 - children: [  
191 - Row(  
192 - crossAxisAlignment: CrossAxisAlignment.end,  
193 - children: [  
194 - model.rnameStr != null && model.rnameStr != ''  
195 - ? Row(  
196 - crossAxisAlignment: CrossAxisAlignment.end,  
197 - children: [  
198 - Container(  
199 - constraints: BoxConstraints(  
200 - maxWidth: ScreenUtil().setWidth(200)),  
201 - child: Text(  
202 - model.rnameStr,  
203 - overflow: TextOverflow.ellipsis,  
204 - style: TextStyle(  
205 - color: MyColours.color_333333,  
206 - fontSize: ScreenUtil().setSp(36),  
207 - fontWeight: FontWeight.bold),  
208 - )),  
209 - HEmptyView(10),  
210 - Padding(  
211 - padding: EdgeInsets.only(  
212 - bottom: ScreenUtil().setWidth(4)),  
213 - child: Text(  
214 - model.sexStr != ''  
215 - ? '[${model.sexStr}]'  
216 - : '',  
217 - style: TextStyle(  
218 - color: MyColours.color_333333,  
219 - fontSize: ScreenUtil().setSp(22),  
220 - ),  
221 - )),  
222 - HEmptyView(10),  
223 - ],  
224 - )  
225 - : SizedBox(),  
226 - // model.label != null  
227 - // ? Container(  
228 - // padding: EdgeInsets.only(  
229 - // bottom: ScreenUtil().setWidth(4)),  
230 - // constraints: BoxConstraints(  
231 - // maxWidth: ScreenUtil().setWidth(150)),  
232 - // child: Text(  
233 - // model.label,  
234 - // overflow: TextOverflow.ellipsis,  
235 - // style: TextStyle(  
236 - // color: Color.fromRGBO(193, 194, 63, 1),  
237 - // fontSize: ScreenUtil().setSp(22),  
238 - // ),  
239 - // ))  
240 - // : SizedBox()  
241 - ],  
242 - ),  
243 - VEmptyView(10),  
244 - Row(  
245 - // crossAxisAlignment: CrossAxisAlignment.end,  
246 - children: [  
247 - Text(  
248 - Utils.formatFromYmd(model.ddate),  
249 - style: TextStyle(  
250 - color: Color.fromRGBO(208, 31, 37, 1),  
251 - fontSize: ScreenUtil().setSp(24),  
252 - fontWeight: FontWeight.bold),  
253 - ),  
254 - HEmptyView(10),  
255 - Text(  
256 - model.ddateSolt != null ? model.ddateSolt : '',  
257 - style: TextStyle(  
258 - color: Color.fromRGBO(208, 31, 37, 1),  
259 - fontSize: ScreenUtil().setSp(24),  
260 - ),  
261 - ),  
262 - model.monthCount == '0' || model.monthCount == null  
263 - ? SizedBox()  
264 - : Padding(  
265 - padding: EdgeInsets.only(  
266 - left: ScreenUtil().setWidth(10)),  
267 - child: Text(  
268 - '30天内${model.monthCount}单', 189 + child: GestureDetector(
  190 + behavior: HitTestBehavior.opaque,
  191 + onTap: () {},
  192 + child: Column(
  193 + crossAxisAlignment: CrossAxisAlignment.start,
  194 + children: [
  195 + Row(
  196 + crossAxisAlignment: CrossAxisAlignment.end,
  197 + children: [
  198 + model.rnameStr != null && model.rnameStr != ''
  199 + ? Row(
  200 + crossAxisAlignment:
  201 + CrossAxisAlignment.end,
  202 + children: [
  203 + Container(
  204 + constraints: BoxConstraints(
  205 + maxWidth:
  206 + ScreenUtil().setWidth(200)),
  207 + child: Text(
  208 + model.rnameStr,
  209 + overflow: TextOverflow.ellipsis,
  210 + style: TextStyle(
  211 + color: MyColours.color_333333,
  212 + fontSize:
  213 + ScreenUtil().setSp(36),
  214 + fontWeight: FontWeight.bold),
  215 + )),
  216 + HEmptyView(10),
  217 + Padding(
  218 + padding: EdgeInsets.only(
  219 + bottom:
  220 + ScreenUtil().setWidth(4)),
  221 + child: Text(
  222 + model.sexStr != ''
  223 + ? '[${model.sexStr}]'
  224 + : '',
  225 + style: TextStyle(
  226 + color: MyColours.color_333333,
  227 + fontSize:
  228 + ScreenUtil().setSp(22),
  229 + ),
  230 + )),
  231 + HEmptyView(10),
  232 + ],
  233 + )
  234 + : SizedBox(),
  235 + model.label != null
  236 + ? Container(
  237 + padding: EdgeInsets.only(
  238 + bottom: ScreenUtil().setWidth(4)),
  239 + constraints: BoxConstraints(
  240 + maxWidth: ScreenUtil().setWidth(150)),
  241 + child: Text(
  242 + model.label,
  243 + overflow: TextOverflow.ellipsis,
  244 + style: TextStyle(
  245 + color:
  246 + Color.fromRGBO(193, 194, 63, 1),
  247 + fontSize: ScreenUtil().setSp(22),
  248 + ),
  249 + ))
  250 + : SizedBox()
  251 + ],
  252 + ),
  253 + VEmptyView(10),
  254 + Row(
  255 + // crossAxisAlignment: CrossAxisAlignment.end,
  256 + children: [
  257 + Text(
  258 + Utils.formatFromYmd(model.ddate),
269 style: TextStyle( 259 style: TextStyle(
270 - color: MyColours.color_199095, 260 + color: Color.fromRGBO(208, 31, 37, 1),
  261 + fontSize: ScreenUtil().setSp(24),
  262 + fontWeight: FontWeight.bold),
  263 + ),
  264 + HEmptyView(10),
  265 + Text(
  266 + model.ddateSolt != null ? model.ddateSolt : '',
  267 + style: TextStyle(
  268 + color: Color.fromRGBO(208, 31, 37, 1),
271 fontSize: ScreenUtil().setSp(24), 269 fontSize: ScreenUtil().setSp(24),
272 ), 270 ),
273 ), 271 ),
274 - ),  
275 - HEmptyView(10),  
276 - Text(  
277 - '累计${model.leiji}单',  
278 - style: TextStyle(  
279 - color: MyColours.color_199095,  
280 - fontSize: ScreenUtil().setSp(24),  
281 - ),  
282 - )  
283 - ],  
284 - ),  
285 - model.nickName == null  
286 - ? SizedBox()  
287 - : Container(  
288 - padding: EdgeInsets.only(  
289 - left: ScreenUtil().setWidth(12),  
290 - right: ScreenUtil().setWidth(12),  
291 - top: ScreenUtil().setWidth(10),  
292 - ),  
293 - decoration: BoxDecoration(  
294 - border: Border.all( 272 + model.monthCount == '0' ||
  273 + model.monthCount == null
  274 + ? SizedBox()
  275 + : Padding(
  276 + padding: EdgeInsets.only(
  277 + left: ScreenUtil().setWidth(10)),
  278 + child: Text(
  279 + '30天内${model.monthCount}单',
  280 + style: TextStyle(
  281 + color: MyColours.color_199095,
  282 + fontSize: ScreenUtil().setSp(24),
  283 + ),
  284 + ),
  285 + ),
  286 + HEmptyView(10),
  287 + Text(
  288 + '累计${model.leiji}单',
  289 + style: TextStyle(
295 color: MyColours.color_199095, 290 color: MyColours.color_199095,
296 - width: ScreenUtil().setWidth(2)),  
297 - borderRadius: BorderRadius.circular(  
298 - ScreenUtil().setWidth(10))),  
299 - child: Text(  
300 - '${model.nickName}经理',  
301 - style: TextStyle(  
302 - fontSize: ScreenUtil().setSp(24),  
303 - color: MyColours.color_333333), 291 + fontSize: ScreenUtil().setSp(24),
  292 + ),
  293 + )
  294 + ],
304 ), 295 ),
305 - )  
306 - ],  
307 - )) 296 + model.nickName == null
  297 + ? SizedBox()
  298 + : Container(
  299 + margin: EdgeInsets.only(
  300 + top: ScreenUtil().setWidth(10),
  301 + ),
  302 + padding: EdgeInsets.symmetric(
  303 + horizontal: ScreenUtil().setWidth(10),
  304 + vertical: ScreenUtil().setWidth(4),
  305 + ),
  306 + decoration: BoxDecoration(
  307 + border: Border.all(
  308 + color: MyColours.color_199095,
  309 + width: ScreenUtil().setWidth(2)),
  310 + borderRadius: BorderRadius.circular(
  311 + ScreenUtil().setWidth(10))),
  312 + child: Text(
  313 + '${model.nickName}经理',
  314 + style: TextStyle(
  315 + fontSize: ScreenUtil().setSp(24),
  316 + color: MyColours.color_333333),
  317 + ),
  318 + )
  319 + ],
  320 + )))
308 ], 321 ],
309 ), 322 ),
310 ) 323 )
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/screenutil.dart'; @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
5 import 'package:one_key/models/customer_label_model.dart'; 5 import 'package:one_key/models/customer_label_model.dart';
6 import 'package:one_key/models/filter_btn_model.dart'; 6 import 'package:one_key/models/filter_btn_model.dart';
  7 +import 'package:one_key/models/store_customer_home_model.dart';
7 8
8 import 'package:one_key/pages/my/customer_type/store_customer/contant_list_page.dart'; 9 import 'package:one_key/pages/my/customer_type/store_customer/contant_list_page.dart';
9 import 'package:one_key/provider/customer_making_provider.dart'; 10 import 'package:one_key/provider/customer_making_provider.dart';
@@ -87,14 +88,24 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -87,14 +88,24 @@ class _CustomerListPageState extends State<CustomerListPage>
87 WidgetsBinding.instance.addPostFrameCallback((_) async { 88 WidgetsBinding.instance.addPostFrameCallback((_) async {
88 bool first = true; 89 bool first = true;
89 customerProvider.index = tabController.index; 90 customerProvider.index = tabController.index;
  91 +
90 if (widget.fromPage == FromPage.FromPageMakeRecord) { 92 if (widget.fromPage == FromPage.FromPageMakeRecord) {
91 - customerProvider.selectCustomerSeller = customerMakingProvider.selectCustomerSeller; 93 + customerProvider.selectCustomerSeller =
  94 + customerMakingProvider.selectCustomerSeller;
92 customerProvider.labels = customerMakingProvider.labels; 95 customerProvider.labels = customerMakingProvider.labels;
93 first = false; 96 first = false;
94 } 97 }
  98 +
95 customerProvider.initData(); 99 customerProvider.initData();
  100 + if (tabController.index == 0) {
  101 + customerProvider.hydSelAll = true;
  102 + for (FilterBtnModel item in customerProvider.filterHydList) {
  103 + item.select = true;
  104 + }
  105 + }
96 _getContantData(first: first); 106 _getContantData(first: first);
97 _filterLabelList(); 107 _filterLabelList();
  108 + _getSellerGuestManage();
98 }); 109 });
99 110
100 bus.on("refresh_guest_list", (arg) { 111 bus.on("refresh_guest_list", (arg) {
@@ -108,6 +119,31 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -108,6 +119,31 @@ class _CustomerListPageState extends State<CustomerListPage>
108 super.dispose(); 119 super.dispose();
109 } 120 }
110 121
  122 + // _getAuthUserLists() async {
  123 + // await customerProvider.getAuthUserLists(context);
  124 + // }
  125 +
  126 + ///全店客情首页 ----- 获取经理数据
  127 + _getSellerGuestManage() async {
  128 + StoreCustomerHomeSunModel model =
  129 + await customerProvider.getSellerGuestManage(context);
  130 + customerProvider.filterManageList = [];
  131 + if (model != null &&
  132 + model.sellerUser != null &&
  133 + model.sellerUser.length > 0) {
  134 + for (SellerUser item in model.sellerUser) {
  135 + if (item.nickName != null) {
  136 + FilterBtnModel model = FilterBtnModel();
  137 + model.id = item.uid;
  138 + model.title = item.nickName;
  139 + model.select = false;
  140 + customerProvider.filterManageList.add(model);
  141 + }
  142 + }
  143 + // setState(() {});
  144 + }
  145 + }
  146 +
111 _filterLabelList() async { 147 _filterLabelList() async {
112 await customerProvider.getLabelBySellerid(context); 148 await customerProvider.getLabelBySellerid(context);
113 if (customerProvider.labelList != null && 149 if (customerProvider.labelList != null &&
@@ -171,6 +207,18 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -171,6 +207,18 @@ class _CustomerListPageState extends State<CustomerListPage>
171 // 207 //
172 // 208 //
173 // params['uid'] 经理ID 209 // params['uid'] 经理ID
  210 + String uid = '';
  211 + for (FilterBtnModel item in customerProvider.filterManageList) {
  212 + if (item.select) {
  213 + uid += '${item.id},';
  214 + }
  215 + }
  216 + if (uid.length > 0) {
  217 + if (uid.endsWith(',')) {
  218 + uid = uid.substring(0, uid.length - 1);
  219 + }
  220 + params['uid'] = uid;
  221 + }
174 222
175 if (customerProvider.controllerstime.text.trim().length > 0) { 223 if (customerProvider.controllerstime.text.trim().length > 0) {
176 params['stime'] = customerProvider.controllerstime.text; 224 params['stime'] = customerProvider.controllerstime.text;
@@ -492,6 +540,10 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -492,6 +540,10 @@ class _CustomerListPageState extends State<CustomerListPage>
492 in customerProvider.filterLabelList) { 540 in customerProvider.filterLabelList) {
493 item.select = false; 541 item.select = false;
494 } 542 }
  543 + for (FilterBtnModel item
  544 + in customerProvider.filterManageList) {
  545 + item.select = false;
  546 + }
495 customerProvider.controllerstime.text = ''; 547 customerProvider.controllerstime.text = '';
496 customerProvider.controlleretime.text = ''; 548 customerProvider.controlleretime.text = '';
497 customerProvider.controllernum.text = ''; 549 customerProvider.controllernum.text = '';
@@ -579,7 +631,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -579,7 +631,7 @@ class _CustomerListPageState extends State<CustomerListPage>
579 } 631 }
580 632
581 ///客户经理 633 ///客户经理
582 - Widget _managerWidget() { 634 + Widget _managerWidget(state) {
583 return Column( 635 return Column(
584 crossAxisAlignment: CrossAxisAlignment.start, 636 crossAxisAlignment: CrossAxisAlignment.start,
585 children: [ 637 children: [
@@ -588,9 +640,33 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -588,9 +640,33 @@ class _CustomerListPageState extends State<CustomerListPage>
588 children: [ 640 children: [
589 _textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28), 641 _textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28),
590 GestureDetector( 642 GestureDetector(
591 - onTap: () {},  
592 - child: _textWidget(  
593 - '全选', MyColours.color_199095, FontWeight.normal, 24), 643 + onTap: () {
  644 + state(() {
  645 + customerProvider.manageSelAll =
  646 + !customerProvider.manageSelAll;
  647 + if (customerProvider.manageSelAll) {
  648 + for (FilterBtnModel item
  649 + in customerProvider.filterManageList) {
  650 + item.select = true;
  651 + }
  652 + } else {
  653 + for (FilterBtnModel item
  654 + in customerProvider.filterManageList) {
  655 + item.select = false;
  656 + }
  657 + }
  658 + });
  659 + },
  660 + child: Container(
  661 + color: Colors.white,
  662 + height: ScreenUtil().setWidth(40),
  663 + alignment: Alignment.center,
  664 + padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
  665 + child: _textWidget(
  666 + customerProvider.manageSelAll ? '全不选' : '全选',
  667 + MyColours.color_199095,
  668 + FontWeight.normal,
  669 + 24)),
594 ) 670 )
595 ], 671 ],
596 ), 672 ),
@@ -598,18 +674,12 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -598,18 +674,12 @@ class _CustomerListPageState extends State<CustomerListPage>
598 Wrap( 674 Wrap(
599 spacing: ScreenUtil().setWidth(20), 675 spacing: ScreenUtil().setWidth(20),
600 runSpacing: ScreenUtil().setWidth(20), 676 runSpacing: ScreenUtil().setWidth(20),
601 - children: _buildFilterItem([  
602 - {'title': 'kkkk', 'select': false},  
603 - {'title': 'kkkk', 'select': true},  
604 - {'title': 'kkkk', 'select': true},  
605 - {'title': 'kkkk', 'select': true},  
606 - {'title': 'k', 'select': true},  
607 - {'title': 'kkkk', 'select': true},  
608 - {'title': 'kkkk', 'select': true},  
609 - {'title': 'k', 'select': true},  
610 - {'title': 'kdsfjsfsdfhjsdfh', 'select': true},  
611 - {'title': 'kkkk', 'select': true},  
612 - ], false)), 677 + children: _buildFilterItem(customerProvider.filterManageList, false,
  678 + (FilterBtnModel item) {
  679 + state(() {
  680 + item.select = !item.select;
  681 + });
  682 + })),
613 ], 683 ],
614 ); 684 );
615 } 685 }
@@ -1108,8 +1178,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1108,8 +1178,8 @@ class _CustomerListPageState extends State<CustomerListPage>
1108 crossAxisAlignment: CrossAxisAlignment.start, 1178 crossAxisAlignment: CrossAxisAlignment.start,
1109 children: [ 1179 children: [
1110 VEmptyView(20), 1180 VEmptyView(20),
1111 - // _managerWidget(),  
1112 - // VEmptyView(30), 1181 + _managerWidget(state),
  1182 + VEmptyView(30),
1113 _activityWidget(state), 1183 _activityWidget(state),
1114 VEmptyView(30), 1184 VEmptyView(30),
1115 _labelWidget(state), 1185 _labelWidget(state),
@@ -70,7 +70,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { @@ -70,7 +70,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
70 }); 70 });
71 WidgetsBinding.instance.addPostFrameCallback((_) async { 71 WidgetsBinding.instance.addPostFrameCallback((_) async {
72 for (CustomerBySellerSunModel item in customerMakingProvider.selectCustomerSeller) { 72 for (CustomerBySellerSunModel item in customerMakingProvider.selectCustomerSeller) {
73 - gid += '${item.id},'; 73 + gid += '${item.gid},';
74 if (Platform.isIOS) { 74 if (Platform.isIOS) {
75 iosPhone.add(item.phone); 75 iosPhone.add(item.phone);
76 } else { 76 } else {
@@ -109,8 +109,8 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> { @@ -109,8 +109,8 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> {
109 } else if (btnTitle == '流失客户') { 109 } else if (btnTitle == '流失客户') {
110 index = '3'; 110 index = '3';
111 } 111 }
112 - NavigatorUtil.goCustomerListPage(  
113 - context, FromPage.FromPageHome,index:index); 112 + NavigatorUtil.goCustomerListPage(context, FromPage.FromPageHome,
  113 + index: index);
114 }, 114 },
115 text: btnTitle, 115 text: btnTitle,
116 fontSize: 24, 116 fontSize: 24,
@@ -15,6 +15,7 @@ import 'package:one_key/models/guest_reserve_model.dart'; @@ -15,6 +15,7 @@ import 'package:one_key/models/guest_reserve_model.dart';
15 import 'package:one_key/models/marketing_by_id_model.dart'; 15 import 'package:one_key/models/marketing_by_id_model.dart';
16 import 'package:one_key/models/marketing_by_seller_model.dart'; 16 import 'package:one_key/models/marketing_by_seller_model.dart';
17 import 'package:one_key/models/marketing_by_uid_model.dart'; 17 import 'package:one_key/models/marketing_by_uid_model.dart';
  18 +import 'package:one_key/models/personnel_manage_model.dart';
18 import 'package:one_key/models/store_customer_home_model.dart'; 19 import 'package:one_key/models/store_customer_home_model.dart';
19 import 'package:one_key/models/user_history_entity.dart'; 20 import 'package:one_key/models/user_history_entity.dart';
20 import 'package:one_key/net/base_resp.dart'; 21 import 'package:one_key/net/base_resp.dart';
@@ -77,6 +78,8 @@ class CustomerProvider extends ChangeNotifier { @@ -77,6 +78,8 @@ class CustomerProvider extends ChangeNotifier {
77 List<FilterBtnModel> filterDayList = []; //高级筛选---天数 7、30、60、120 78 List<FilterBtnModel> filterDayList = []; //高级筛选---天数 7、30、60、120
78 bool hydSelAll = false; 79 bool hydSelAll = false;
79 bool labelSelAll = false; 80 bool labelSelAll = false;
  81 + bool manageSelAll = false;
  82 + List<FilterBtnModel> filterManageList = []; //经理
80 83
81 initData() { 84 initData() {
82 filterDayList = []; 85 filterDayList = [];
@@ -940,6 +943,18 @@ class CustomerProvider extends ChangeNotifier { @@ -940,6 +943,18 @@ class CustomerProvider extends ChangeNotifier {
940 } 943 }
941 } 944 }
942 guestSunmodel = GuestManageModel.fromJson(baseResp.responseData).data; 945 guestSunmodel = GuestManageModel.fromJson(baseResp.responseData).data;
  946 + if (guestSunmodel.tips.task != null &&
  947 + guestSunmodel.tips.task.length > 0 &&
  948 + couponListSelect.length > 0) {
  949 + for (Task item in guestSunmodel.tips.task) {
  950 + for (CouponSunModel value in couponListSelect) {
  951 + if (item.aid == value.id) {
  952 + item.aidStr = value.aname;
  953 + }
  954 + }
  955 + }
  956 + }
  957 +
943 notifyListeners(); 958 notifyListeners();
944 } else { 959 } else {
945 if (isShowLoading) { 960 if (isShowLoading) {
@@ -1106,9 +1121,9 @@ class CustomerProvider extends ChangeNotifier { @@ -1106,9 +1121,9 @@ class CustomerProvider extends ChangeNotifier {
1106 1121
1107 //未选中 1122 //未选中
1108 cancelData(int index) { 1123 cancelData(int index) {
1109 - // userHistorys[index].select = false;  
1110 - selectCustomerSeller  
1111 - .removeWhere((element) => element.id == customerBySellerList[index].id); 1124 + userHistorys[index].select = false;
  1125 + selectCustomerSeller.removeWhere(
  1126 + (element) => element.gid == customerBySellerList[index].gid);
1112 labelsValueMy(); 1127 labelsValueMy();
1113 notifyListeners(); 1128 notifyListeners();
1114 } 1129 }
@@ -1275,6 +1290,47 @@ class CustomerProvider extends ChangeNotifier { @@ -1275,6 +1290,47 @@ class CustomerProvider extends ChangeNotifier {
1275 } 1290 }
1276 } 1291 }
1277 1292
  1293 + /// 获取店员列表
  1294 + getAuthUserLists(BuildContext context, {showLoading = false}) async {
  1295 + Map<String, String> params = {
  1296 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  1297 + };
  1298 + BaseResp<dynamic> baseResp = await DioUtil()
  1299 + .request<dynamic>(context, Method.get, HttpUrl.get_auth_user_lists,
  1300 + data: params, showLoading: showLoading)
  1301 + .catchError((error) {
  1302 + print(error.toString());
  1303 + });
  1304 + if (baseResp != null && baseResp.code == Constant.status_success) {
  1305 + Map data = baseResp.data;
  1306 + Map<String, dynamic> tempData = {};
  1307 + data.forEach((key, value) {
  1308 + String keyTemp = key.split('_')[0];
  1309 + String role_id = key.split('_')[1];
  1310 + tempData[keyTemp] = {'listdata': value, 'role_id': role_id};
  1311 + });
  1312 + baseResp.responseData['data'] = tempData;
  1313 + PersonnelManageModelData dataMap =
  1314 + PersonnelManageModel.fromJson(baseResp.responseData).data;
  1315 + filterManageList = [];
  1316 + if (dataMap.manager.listdata != null &&
  1317 + dataMap.manager.listdata.length > 0) {
  1318 + for (PersonnelManageSunModel item in dataMap.manager.listdata) {
  1319 + if (item.nickName != null) {
  1320 + FilterBtnModel model = FilterBtnModel();
  1321 + model.id = item.id;
  1322 + model.title = item.nickName;
  1323 + model.select = false;
  1324 + filterManageList.add(model);
  1325 + }
  1326 + }
  1327 + }
  1328 + } else {
  1329 + Utils.showToast(baseResp.msg ?? "");
  1330 + }
  1331 + notifyListeners();
  1332 + }
  1333 +
1278 //获取商家客情设置 1334 //获取商家客情设置
1279 Future<bool> getSellerGuest(BuildContext context, Map<String, String> params, 1335 Future<bool> getSellerGuest(BuildContext context, Map<String, String> params,
1280 {bool showLoading = false}) async { 1336 {bool showLoading = false}) async {
@@ -3,6 +3,8 @@ import 'dart:convert'; @@ -3,6 +3,8 @@ import 'dart:convert';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 import 'package:one_key/constant/constant.dart'; 5 import 'package:one_key/constant/constant.dart';
  6 +import 'package:one_key/constant/error.dart';
  7 +import 'package:one_key/models/pull_marketing_by_uid_model.dart';
6 import 'package:one_key/models/user.dart'; 8 import 'package:one_key/models/user.dart';
7 import 'package:one_key/net/base_resp.dart'; 9 import 'package:one_key/net/base_resp.dart';
8 import 'package:one_key/net/dio_util.dart'; 10 import 'package:one_key/net/dio_util.dart';
@@ -13,6 +15,7 @@ import 'package:one_key/utils/utils.dart'; @@ -13,6 +15,7 @@ import 'package:one_key/utils/utils.dart';
13 import 'package:one_key/widgets/MyDivider.dart'; 15 import 'package:one_key/widgets/MyDivider.dart';
14 import 'package:one_key/widgets/loading.dart'; 16 import 'package:one_key/widgets/loading.dart';
15 import 'package:one_key/widgets/v_empty_view.dart'; 17 import 'package:one_key/widgets/v_empty_view.dart';
  18 +import 'package:provider/provider.dart';
16 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; 19 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
17 20
18 import '../app.dart'; 21 import '../app.dart';
@@ -21,6 +24,7 @@ class UserModel with ChangeNotifier { @@ -21,6 +24,7 @@ class UserModel with ChangeNotifier {
21 User _user; 24 User _user;
22 String _registrationId; //极光推送registrationId 25 String _registrationId; //极光推送registrationId
23 String _token; //信鸽推送token 26 String _token; //信鸽推送token
  27 + List<PullMarketingByUidSunModel> pullMarketingByUidSunModel;
24 28
25 User get user => _user; 29 User get user => _user;
26 30
@@ -83,6 +87,71 @@ class UserModel with ChangeNotifier { @@ -83,6 +87,71 @@ class UserModel with ChangeNotifier {
83 } 87 }
84 } 88 }
85 89
  90 +// 获取推送失败的营销消息
  91 + Future pullMarketingByUid(BuildContext context,
  92 + {bool showLoading = false}) async {
  93 + Map<String, String> params = {
  94 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  95 + };
  96 + BaseResp<dynamic> baseResp = await DioUtil()
  97 + .request<dynamic>(context, Method.get, HttpUrl.pull_marketing_by_uid,
  98 + data: params, showLoading: showLoading)
  99 + .catchError((error) {
  100 + print(error.toString());
  101 + if (error is MyError) {}
  102 + });
  103 + if (baseResp != null && baseResp.code == Constant.status_success) {
  104 + pullMarketingByUidSunModel =
  105 + PullMarketingByUidModel.fromJson(baseResp.responseData).data;
  106 + if (pullMarketingByUidSunModel != null &&
  107 + pullMarketingByUidSunModel.length > 0) {
  108 + String id = '';
  109 + for (PullMarketingByUidSunModel item in pullMarketingByUidSunModel) {
  110 + id += '${item.id},';
  111 + }
  112 + if (id.length > 0) {
  113 + if (id.endsWith(',')) {
  114 + id = id.substring(0, id.length - 1);
  115 + }
  116 + }
  117 + print(id);
  118 +
  119 + setPullMarketingByid(context, id);
  120 + }
  121 + } else {
  122 + if (baseResp != null) {
  123 + Utils.showToast(baseResp.msg ?? "");
  124 + }
  125 + }
  126 + }
  127 +
  128 + // 修改拉取后消息的状态
  129 + Future<bool> setPullMarketingByid(BuildContext context, String id,
  130 + {bool showLoading = false}) async {
  131 + Map<String, String> params = {
  132 + "id": id,
  133 + };
  134 + BaseResp<dynamic> baseResp = await DioUtil()
  135 + .request<dynamic>(context, Method.get, HttpUrl.set_pull_marketing_by_id,
  136 + data: params, showLoading: showLoading)
  137 + .catchError((error) {
  138 + print(error.toString());
  139 + if (error is MyError) {}
  140 + });
  141 + if (baseResp != null && baseResp.code == Constant.status_success) {
  142 + if (baseResp.responseData['data'] != null &&
  143 + baseResp.responseData['data'] == 1) {
  144 + return true;
  145 + }
  146 + return false;
  147 + } else {
  148 + if (baseResp != null) {
  149 + Utils.showToast(baseResp.msg ?? "");
  150 + }
  151 + return false;
  152 + }
  153 + }
  154 +
86 ///获取商家信息 155 ///获取商家信息
87 Future<String> getSellerInfo(BuildContext context, Map<String, String> params, 156 Future<String> getSellerInfo(BuildContext context, Map<String, String> params,
88 Map<String, dynamic> userMap) async { 157 Map<String, dynamic> userMap) async {
@@ -109,6 +178,7 @@ class UserModel with ChangeNotifier { @@ -109,6 +178,7 @@ class UserModel with ChangeNotifier {
109 await saveUserInfo(User.fromJson(user)); 178 await saveUserInfo(User.fromJson(user));
110 App.sp.setBool("isLogin", true); 179 App.sp.setBool("isLogin", true);
111 App.sp.setString("is_call_tel", seller['is_call_tel'].toString()); 180 App.sp.setString("is_call_tel", seller['is_call_tel'].toString());
  181 + pullMarketingByUid(context);
112 NavigatorUtil.goHomePage(context); 182 NavigatorUtil.goHomePage(context);
113 return null; 183 return null;
114 } 184 }
@@ -676,10 +676,10 @@ class NavigatorUtil { @@ -676,10 +676,10 @@ class NavigatorUtil {
676 676
677 /// 我的营销记录详情 --- 全店任务 677 /// 我的营销记录详情 --- 全店任务
678 static Future<dynamic> goSellerMyMarketingRecordsDetailPage( 678 static Future<dynamic> goSellerMyMarketingRecordsDetailPage(
679 - BuildContext context, String idstr, SellerList sellerList,  
680 - {replace = false}) { 679 + BuildContext context, String idstr,
  680 + {fromNotify = false, replace = false}) {
681 return _navigateTo(context, 681 return _navigateTo(context,
682 - "${Routes.seller_my_marketing_records_detail_page}?idstr=${idstr}&sellerList=${FluroConvertUtils.object2string(sellerList)}", 682 + "${Routes.seller_my_marketing_records_detail_page}?idstr=${idstr}&fromNotify=$fromNotify",
683 replace: replace); 683 replace: replace);
684 } 684 }
685 685
@@ -876,9 +876,10 @@ var customerListPageHandle = new Handler( @@ -876,9 +876,10 @@ var customerListPageHandle = new Handler(
876 FromPage.values, params["fromPage"].first); 876 FromPage.values, params["fromPage"].first);
877 print(fromPage); 877 print(fromPage);
878 String index = params["index"].first; 878 String index = params["index"].first;
  879 +
879 return ChangeNotifierProvider<CustomerProvider>( 880 return ChangeNotifierProvider<CustomerProvider>(
880 create: (_) => CustomerProvider(), 881 create: (_) => CustomerProvider(),
881 - child: CustomerListPage(fromPage: fromPage,index:index)); 882 + child: CustomerListPage(fromPage: fromPage, index: index));
882 }); 883 });
883 884
884 ///仅供展示的客情列表 885 ///仅供展示的客情列表
@@ -963,12 +964,10 @@ var myMarketingRecordsDetailPageHandle = new Handler( @@ -963,12 +964,10 @@ var myMarketingRecordsDetailPageHandle = new Handler(
963 var sellerMyMarketingRecordsDetailPageHandle = new Handler( 964 var sellerMyMarketingRecordsDetailPageHandle = new Handler(
964 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 965 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
965 String idstr = params["idstr"].first; 966 String idstr = params["idstr"].first;
966 - SellerList sellerList = SellerList.fromJson(json.decode(  
967 - FluroConvertUtils.fluroCnParamsDecode(params["sellerList"].first))); 967 +
968 return ChangeNotifierProvider<CustomerProvider>( 968 return ChangeNotifierProvider<CustomerProvider>(
969 create: (_) => CustomerProvider(), 969 create: (_) => CustomerProvider(),
970 - child: SellerMyMarketingRecordsDetailPage(  
971 - idstr: idstr, sellerList: sellerList)); 970 + child: SellerMyMarketingRecordsDetailPage(idstr: idstr));
972 }); 971 });
973 972
974 ///创建营销 973 ///创建营销