Commit df60ac84102cd74bfb5f2c06e959a2af6bababab

Authored by wdn127929
1 parent e0341dbf

我的和全店分开

Too many changes to show.

To preserve performance only 22 of 22+ files are displayed.

@@ -18,4 +18,8 @@ enum PageState { @@ -18,4 +18,8 @@ enum PageState {
18 enum FromPage { 18 enum FromPage {
19 FromPageMyCustomer, //我的客情 19 FromPageMyCustomer, //我的客情
20 FromPageStoreCustomer, //全店客情 20 FromPageStoreCustomer, //全店客情
  21 + FromPageHome, //客户列表页面来源---主页
  22 + FromPageMakeRecord, //客户列表页面来源---营销页面
  23 + FromPageCustomerList,
  24 + FromPageMakeRecordDetail,
21 } 25 }
@@ -70,6 +70,11 @@ class MarketingByIdSunModel extends Object { @@ -70,6 +70,11 @@ class MarketingByIdSunModel extends Object {
70 @JsonKey(name: 'create_user') 70 @JsonKey(name: 'create_user')
71 String createUser; 71 String createUser;
72 72
  73 + @JsonKey(name: 'finished_status')
  74 + String finishedStatus;
  75 +
  76 +
  77 +
73 String aidStr = ''; 78 String aidStr = '';
74 79
75 String get cdateStr { 80 String get cdateStr {
@@ -92,7 +97,8 @@ class MarketingByIdSunModel extends Object { @@ -92,7 +97,8 @@ class MarketingByIdSunModel extends Object {
92 this.sellerUserCount, 97 this.sellerUserCount,
93 this.notFinished, 98 this.notFinished,
94 this.sellerUser, 99 this.sellerUser,
95 - this.createUser 100 + this.createUser,
  101 + this.finishedStatus
96 ); 102 );
97 103
98 factory MarketingByIdSunModel.fromJson(Map<String, dynamic> srcJson) => 104 factory MarketingByIdSunModel.fromJson(Map<String, dynamic> srcJson) =>
@@ -43,6 +43,7 @@ MarketingByIdSunModel _$MarketingByIdSunModelFromJson( @@ -43,6 +43,7 @@ MarketingByIdSunModel _$MarketingByIdSunModelFromJson(
43 e == null ? null : SellerUser.fromJson(e as Map<String, dynamic>)) 43 e == null ? null : SellerUser.fromJson(e as Map<String, dynamic>))
44 ?.toList(), 44 ?.toList(),
45 json['create_user'] as String, 45 json['create_user'] as String,
  46 + json['finished_status'] as String,
46 ); 47 );
47 } 48 }
48 49
@@ -62,7 +63,8 @@ Map<String, dynamic> _$MarketingByIdSunModelToJson( @@ -62,7 +63,8 @@ Map<String, dynamic> _$MarketingByIdSunModelToJson(
62 'seller_user_count': instance.sellerUserCount, 63 'seller_user_count': instance.sellerUserCount,
63 'not_finished': instance.notFinished, 64 'not_finished': instance.notFinished,
64 'seller_user': instance.sellerUser, 65 'seller_user': instance.sellerUser,
65 - 'create_user': instance.createUser 66 + 'create_user': instance.createUser,
  67 + 'finished_status': instance.finishedStatus
66 }; 68 };
67 69
68 SellerUser _$SellerUserFromJson(Map<String, dynamic> json) { 70 SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:json_annotation/json_annotation.dart';
  3 +
  4 +part 'marketing_by_uid_model.g.dart';
  5 +
  6 +@JsonSerializable()
  7 +class MarketingByUidModel extends Object {
  8 + @JsonKey(name: 'ret')
  9 + int ret;
  10 +
  11 + @JsonKey(name: 'data')
  12 + MarketingByUidsSunModel data;
  13 +
  14 + @JsonKey(name: 'msg')
  15 + String msg;
  16 +
  17 + MarketingByUidModel(
  18 + this.ret,
  19 + this.data,
  20 + this.msg,
  21 + );
  22 +
  23 + factory MarketingByUidModel.fromJson(Map<String, dynamic> srcJson) =>
  24 + _$MarketingByUidModelFromJson(srcJson);
  25 +
  26 + Map<String, dynamic> toJson() => _$MarketingByUidModelToJson(this);
  27 +}
  28 +
  29 +@JsonSerializable()
  30 +class MarketingByUidsSunModel extends Object {
  31 + @JsonKey(name: 'self_list')
  32 + List<SelfList> selfList;
  33 +
  34 + @JsonKey(name: 'seller_list')
  35 + List<SellerList> sellerList;
  36 +
  37 + MarketingByUidsSunModel(
  38 + this.selfList,
  39 + this.sellerList,
  40 + );
  41 +
  42 + factory MarketingByUidsSunModel.fromJson(Map<String, dynamic> srcJson) =>
  43 + _$MarketingByUidsSunModelFromJson(srcJson);
  44 +
  45 + Map<String, dynamic> toJson() => _$MarketingByUidsSunModelToJson(this);
  46 +}
  47 +
  48 +@JsonSerializable()
  49 +class SelfList extends Object {
  50 + @JsonKey(name: 'id')
  51 + String id;
  52 +
  53 + @JsonKey(name: 'uid')
  54 + String uid;
  55 +
  56 + @JsonKey(name: 'aid')
  57 + String aid;
  58 +
  59 + @JsonKey(name: 'gid')
  60 + String gid;
  61 +
  62 + @JsonKey(name: 'content')
  63 + String content;
  64 +
  65 + @JsonKey(name: 'cdate')
  66 + String cdate;
  67 +
  68 + String get cdateStr {
  69 + DateTime dateTime =
  70 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
  71 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  72 + }
  73 +
  74 + String get guestCount {
  75 + if (gid == null || gid == '') {
  76 + return '0';
  77 + }
  78 + return '${gid.split(',').length}';
  79 + }
  80 +
  81 + SelfList(
  82 + this.id,
  83 + this.uid,
  84 + this.aid,
  85 + this.gid,
  86 + this.content,
  87 + this.cdate,
  88 + );
  89 +
  90 + factory SelfList.fromJson(Map<String, dynamic> srcJson) =>
  91 + _$SelfListFromJson(srcJson);
  92 +
  93 + Map<String, dynamic> toJson() => _$SelfListToJson(this);
  94 +}
  95 +
  96 +@JsonSerializable()
  97 +class SellerList extends Object {
  98 + @JsonKey(name: 'id')
  99 + String id;
  100 +
  101 + @JsonKey(name: 'sellerid')
  102 + String sellerid;
  103 +
  104 + @JsonKey(name: 'create_user')
  105 + String createUser;
  106 +
  107 + @JsonKey(name: 'uid')
  108 + String uid;
  109 +
  110 + @JsonKey(name: 'aid')
  111 + String aid;
  112 +
  113 + @JsonKey(name: 'gid')
  114 + String gid;
  115 +
  116 + @JsonKey(name: 'content')
  117 + String content;
  118 +
  119 + @JsonKey(name: 'is_update')
  120 + String isUpdate;
  121 +
  122 + @JsonKey(name: 'finished_status')
  123 + String finishedStatus;
  124 +
  125 + @JsonKey(name: 'edate')
  126 + String edate;
  127 +
  128 + @JsonKey(name: 'cdate')
  129 + String cdate;
  130 +
  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);
  135 + }
  136 +
  137 + String get guestCount {
  138 + if (gid == null || gid == '') {
  139 + return '0';
  140 + }
  141 + return '${gid.split(',').length}';
  142 + }
  143 +
  144 + SellerList(
  145 + this.id,
  146 + this.sellerid,
  147 + this.createUser,
  148 + this.uid,
  149 + this.aid,
  150 + this.gid,
  151 + this.content,
  152 + this.isUpdate,
  153 + this.finishedStatus,
  154 + this.edate,
  155 + this.cdate,
  156 + );
  157 +
  158 + factory SellerList.fromJson(Map<String, dynamic> srcJson) =>
  159 + _$SellerListFromJson(srcJson);
  160 +
  161 + Map<String, dynamic> toJson() => _$SellerListToJson(this);
  162 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'marketing_by_uid_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +MarketingByUidModel _$MarketingByUidModelFromJson(Map<String, dynamic> json) {
  10 + return MarketingByUidModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : MarketingByUidsSunModel.fromJson(
  15 + json['data'] as Map<String, dynamic>),
  16 + json['msg'] as String,
  17 + );
  18 +}
  19 +
  20 +Map<String, dynamic> _$MarketingByUidModelToJson(
  21 + MarketingByUidModel instance) =>
  22 + <String, dynamic>{
  23 + 'ret': instance.ret,
  24 + 'data': instance.data,
  25 + 'msg': instance.msg,
  26 + };
  27 +
  28 +MarketingByUidsSunModel _$MarketingByUidsSunModelFromJson(
  29 + Map<String, dynamic> json) {
  30 + return MarketingByUidsSunModel(
  31 + (json['self_list'] as List)
  32 + ?.map((e) =>
  33 + e == null ? null : SelfList.fromJson(e as Map<String, dynamic>))
  34 + ?.toList(),
  35 + (json['seller_list'] as List)
  36 + ?.map((e) =>
  37 + e == null ? null : SellerList.fromJson(e as Map<String, dynamic>))
  38 + ?.toList(),
  39 + );
  40 +}
  41 +
  42 +Map<String, dynamic> _$MarketingByUidsSunModelToJson(
  43 + MarketingByUidsSunModel instance) =>
  44 + <String, dynamic>{
  45 + 'self_list': instance.selfList,
  46 + 'seller_list': instance.sellerList,
  47 + };
  48 +
  49 +SelfList _$SelfListFromJson(Map<String, dynamic> json) {
  50 + return SelfList(
  51 + json['id'] as String,
  52 + json['uid'] as String,
  53 + json['aid'] as String,
  54 + json['gid'] as String,
  55 + json['content'] as String,
  56 + json['cdate'] as String,
  57 + );
  58 +}
  59 +
  60 +Map<String, dynamic> _$SelfListToJson(SelfList instance) => <String, dynamic>{
  61 + 'id': instance.id,
  62 + 'uid': instance.uid,
  63 + 'aid': instance.aid,
  64 + 'gid': instance.gid,
  65 + 'content': instance.content,
  66 + 'cdate': instance.cdate,
  67 + };
  68 +
  69 +SellerList _$SellerListFromJson(Map<String, dynamic> json) {
  70 + return SellerList(
  71 + json['id'] as String,
  72 + json['sellerid'] as String,
  73 + json['create_user'] as String,
  74 + json['uid'] as String,
  75 + json['aid'] as String,
  76 + json['gid'] as String,
  77 + json['content'] as String,
  78 + json['is_update'] as String,
  79 + json['finished_status'] as String,
  80 + json['edate'] as String,
  81 + json['cdate'] as String,
  82 + );
  83 +}
  84 +
  85 +Map<String, dynamic> _$SellerListToJson(SellerList instance) =>
  86 + <String, dynamic>{
  87 + 'id': instance.id,
  88 + 'sellerid': instance.sellerid,
  89 + 'create_user': instance.createUser,
  90 + 'uid': instance.uid,
  91 + 'aid': instance.aid,
  92 + 'gid': instance.gid,
  93 + 'content': instance.content,
  94 + 'is_update': instance.isUpdate,
  95 + 'finished_status': instance.finishedStatus,
  96 + 'edate': instance.edate,
  97 + 'cdate': instance.cdate,
  98 + };
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'store_customer_home_model.g.dart';
  4 +
  5 +
  6 +@JsonSerializable()
  7 + class StoreCustomerHomeModel extends Object {
  8 +
  9 + @JsonKey(name: 'ret')
  10 + int ret;
  11 +
  12 + @JsonKey(name: 'data')
  13 + StoreCustomerHomeSunModel data;
  14 +
  15 + @JsonKey(name: 'msg')
  16 + String msg;
  17 +
  18 + StoreCustomerHomeModel(this.ret,this.data,this.msg,);
  19 +
  20 + factory StoreCustomerHomeModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeModelFromJson(srcJson);
  21 +
  22 + Map<String, dynamic> toJson() => _$StoreCustomerHomeModelToJson(this);
  23 +
  24 +}
  25 +
  26 +
  27 +@JsonSerializable()
  28 + class StoreCustomerHomeSunModel extends Object {
  29 +
  30 + @JsonKey(name: 'myCustomer')
  31 + int myCustomer;
  32 +
  33 + @JsonKey(name: 'active')
  34 + Active active;
  35 +
  36 + @JsonKey(name: 'sleep')
  37 + Sleep sleep;
  38 +
  39 + @JsonKey(name: 'drain')
  40 + Drain drain;
  41 +
  42 + @JsonKey(name: 'seller_user')
  43 + List<SellerUser> sellerUser;
  44 +
  45 + @JsonKey(name: 'distribution')
  46 + int distribution;
  47 +
  48 + StoreCustomerHomeSunModel(this.myCustomer,this.active,this.sleep,this.drain,this.sellerUser,this.distribution,);
  49 +
  50 + factory StoreCustomerHomeSunModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeSunModelFromJson(srcJson);
  51 +
  52 + Map<String, dynamic> toJson() => _$StoreCustomerHomeSunModelToJson(this);
  53 +
  54 +}
  55 +
  56 +
  57 +@JsonSerializable()
  58 + class Active extends Object {
  59 +
  60 + @JsonKey(name: 'count')
  61 + int count;
  62 +
  63 + @JsonKey(name: 'scale')
  64 + double scale;
  65 +
  66 + Active(this.count,this.scale,);
  67 +
  68 + factory Active.fromJson(Map<String, dynamic> srcJson) => _$ActiveFromJson(srcJson);
  69 +
  70 + Map<String, dynamic> toJson() => _$ActiveToJson(this);
  71 +
  72 +}
  73 +
  74 +
  75 +@JsonSerializable()
  76 + class Sleep extends Object {
  77 +
  78 + @JsonKey(name: 'count')
  79 + int count;
  80 +
  81 + @JsonKey(name: 'scale')
  82 + double scale;
  83 +
  84 + Sleep(this.count,this.scale,);
  85 +
  86 + factory Sleep.fromJson(Map<String, dynamic> srcJson) => _$SleepFromJson(srcJson);
  87 +
  88 + Map<String, dynamic> toJson() => _$SleepToJson(this);
  89 +
  90 +}
  91 +
  92 +
  93 +@JsonSerializable()
  94 + class Drain extends Object {
  95 +
  96 + @JsonKey(name: 'count')
  97 + int count;
  98 +
  99 + @JsonKey(name: 'scale')
  100 + double scale;
  101 +
  102 + Drain(this.count,this.scale,);
  103 +
  104 + factory Drain.fromJson(Map<String, dynamic> srcJson) => _$DrainFromJson(srcJson);
  105 +
  106 + Map<String, dynamic> toJson() => _$DrainToJson(this);
  107 +
  108 +}
  109 +
  110 +
  111 +@JsonSerializable()
  112 + class SellerUser extends Object {
  113 +
  114 + @JsonKey(name: 'count')
  115 + String count;
  116 +
  117 + @JsonKey(name: 'nick_name')
  118 + String nickName;
  119 +
  120 + SellerUser(this.count,this.nickName,);
  121 +
  122 + factory SellerUser.fromJson(Map<String, dynamic> srcJson) => _$SellerUserFromJson(srcJson);
  123 +
  124 + Map<String, dynamic> toJson() => _$SellerUserToJson(this);
  125 +
  126 +}
  127 +
  128 +
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'store_customer_home_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +StoreCustomerHomeModel _$StoreCustomerHomeModelFromJson(
  10 + Map<String, dynamic> json) {
  11 + return StoreCustomerHomeModel(
  12 + json['ret'] as int,
  13 + json['data'] == null
  14 + ? null
  15 + : StoreCustomerHomeSunModel.fromJson(
  16 + json['data'] as Map<String, dynamic>),
  17 + json['msg'] as String,
  18 + );
  19 +}
  20 +
  21 +Map<String, dynamic> _$StoreCustomerHomeModelToJson(
  22 + StoreCustomerHomeModel instance) =>
  23 + <String, dynamic>{
  24 + 'ret': instance.ret,
  25 + 'data': instance.data,
  26 + 'msg': instance.msg,
  27 + };
  28 +
  29 +StoreCustomerHomeSunModel _$StoreCustomerHomeSunModelFromJson(
  30 + Map<String, dynamic> json) {
  31 + return StoreCustomerHomeSunModel(
  32 + json['myCustomer'] as int,
  33 + json['active'] == null
  34 + ? null
  35 + : Active.fromJson(json['active'] as Map<String, dynamic>),
  36 + json['sleep'] == null
  37 + ? null
  38 + : Sleep.fromJson(json['sleep'] as Map<String, dynamic>),
  39 + json['drain'] == null
  40 + ? null
  41 + : Drain.fromJson(json['drain'] as Map<String, dynamic>),
  42 + (json['seller_user'] as List)
  43 + ?.map((e) =>
  44 + e == null ? null : SellerUser.fromJson(e as Map<String, dynamic>))
  45 + ?.toList(),
  46 + json['distribution'] as int,
  47 + );
  48 +}
  49 +
  50 +Map<String, dynamic> _$StoreCustomerHomeSunModelToJson(
  51 + StoreCustomerHomeSunModel instance) =>
  52 + <String, dynamic>{
  53 + 'myCustomer': instance.myCustomer,
  54 + 'active': instance.active,
  55 + 'sleep': instance.sleep,
  56 + 'drain': instance.drain,
  57 + 'seller_user': instance.sellerUser,
  58 + 'distribution': instance.distribution,
  59 + };
  60 +
  61 +Active _$ActiveFromJson(Map<String, dynamic> json) {
  62 + return Active(
  63 + json['count'] as int,
  64 + (json['scale'] as num)?.toDouble(),
  65 + );
  66 +}
  67 +
  68 +Map<String, dynamic> _$ActiveToJson(Active instance) => <String, dynamic>{
  69 + 'count': instance.count,
  70 + 'scale': instance.scale,
  71 + };
  72 +
  73 +Sleep _$SleepFromJson(Map<String, dynamic> json) {
  74 + return Sleep(
  75 + json['count'] as int,
  76 + (json['scale'] as num)?.toDouble(),
  77 + );
  78 +}
  79 +
  80 +Map<String, dynamic> _$SleepToJson(Sleep instance) => <String, dynamic>{
  81 + 'count': instance.count,
  82 + 'scale': instance.scale,
  83 + };
  84 +
  85 +Drain _$DrainFromJson(Map<String, dynamic> json) {
  86 + return Drain(
  87 + json['count'] as int,
  88 + (json['scale'] as num)?.toDouble(),
  89 + );
  90 +}
  91 +
  92 +Map<String, dynamic> _$DrainToJson(Drain instance) => <String, dynamic>{
  93 + 'count': instance.count,
  94 + 'scale': instance.scale,
  95 + };
  96 +
  97 +SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
  98 + return SellerUser(
  99 + json['count'] as String,
  100 + json['nick_name'] as String,
  101 + );
  102 +}
  103 +
  104 +Map<String, dynamic> _$SellerUserToJson(SellerUser instance) =>
  105 + <String, dynamic>{
  106 + 'count': instance.count,
  107 + 'nick_name': instance.nickName,
  108 + };
@@ -21,6 +21,7 @@ class User { @@ -21,6 +21,7 @@ class User {
21 String night; //晚市时间段 21 String night; //晚市时间段
22 String userphone; //角色电话 22 String userphone; //角色电话
23 String token; //token 23 String token; //token
  24 + String nickName; // 昵称
24 25
25 User( 26 User(
26 this.openid, 27 this.openid,
@@ -39,7 +40,8 @@ class User { @@ -39,7 +40,8 @@ class User {
39 this.noon, 40 this.noon,
40 this.night, 41 this.night,
41 this.userphone, 42 this.userphone,
42 - this.token); 43 + this.token,
  44 + this.nickName);
43 45
44 factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json); 46 factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
45 47
@@ -47,6 +49,6 @@ class User { @@ -47,6 +49,6 @@ class User {
47 49
48 @override 50 @override
49 String toString() { 51 String toString() {
50 - return 'User{openid: $openid, account: $account, role_name: $role_name, sellerid: $sellerid, sellercode: $sellercode, sellername: $sellername,sellerimage:$sellerimage, sellerphone: $sellerphone, sellerAddr: $sellerAddr, scatter: $scatter, room: $room, cassette: $cassette, morning: $morning, noon: $noon, night: $night ,userphone:$userphone},token:$token}'; 52 + return 'User{openid: $openid, account: $account, role_name: $role_name, sellerid: $sellerid, sellercode: $sellercode, sellername: $sellername,sellerimage:$sellerimage, sellerphone: $sellerphone, sellerAddr: $sellerAddr, scatter: $scatter, room: $room, cassette: $cassette, morning: $morning, noon: $noon, night: $night ,userphone:$userphone},token:$token},nickName:$nickName}';
51 } 53 }
52 } 54 }
@@ -8,23 +8,25 @@ part of 'user.dart'; @@ -8,23 +8,25 @@ part of 'user.dart';
8 8
9 User _$UserFromJson(Map<String, dynamic> json) { 9 User _$UserFromJson(Map<String, dynamic> json) {
10 return User( 10 return User(
11 - json['openid'] as String,  
12 - json['account'] as String,  
13 - json['role_name'] as String,  
14 - json['sellerid'] as String,  
15 - json['sellercode'] as String,  
16 - json['sellername'] as String,  
17 - json['sellerimage'] as String,  
18 - json['sellerphone'] as String,  
19 - json['sellerAddr'] as String,  
20 - json['scatter'] as int,  
21 - json['room'] as int,  
22 - json['cassette'] as int,  
23 - json['morning'] as String,  
24 - json['noon'] as String,  
25 - json['night'] as String,  
26 - json['userphone'] as String,  
27 - json['token'] as String); 11 + json['openid'] as String,
  12 + json['account'] as String,
  13 + json['role_name'] as String,
  14 + json['sellerid'] as String,
  15 + json['sellercode'] as String,
  16 + json['sellername'] as String,
  17 + json['sellerimage'] as String,
  18 + json['sellerphone'] as String,
  19 + json['sellerAddr'] as String,
  20 + json['scatter'] as int,
  21 + json['room'] as int,
  22 + json['cassette'] as int,
  23 + json['morning'] as String,
  24 + json['noon'] as String,
  25 + json['night'] as String,
  26 + json['userphone'] as String,
  27 + json['token'] as String,
  28 + json['nickname'] as String,
  29 + );
28 } 30 }
29 31
30 Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{ 32 Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
@@ -44,5 +46,6 @@ Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{ @@ -44,5 +46,6 @@ Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
44 'noon': instance.noon, 46 'noon': instance.noon,
45 'night': instance.night, 47 'night': instance.night,
46 'userphone': instance.userphone, 48 'userphone': instance.userphone,
47 - 'token': instance.token 49 + 'token': instance.token,
  50 + 'nickname': instance.nickName
48 }; 51 };
@@ -200,5 +200,13 @@ class HttpUrl { @@ -200,5 +200,13 @@ class HttpUrl {
200 "?service=App.GuestManage.GetLabelBySellerid"; // 获取商家标签 200 "?service=App.GuestManage.GetLabelBySellerid"; // 获取商家标签
201 static const String set_label_by_sellerid = 201 static const String set_label_by_sellerid =
202 "?service=App.GuestManage.SetLabelBySellerid"; // 商家修改标签 202 "?service=App.GuestManage.SetLabelBySellerid"; // 商家修改标签
  203 + static const String seller_guest_manage =
  204 + "?service=App.GuestManage.SellerGuestManage"; // 全店客情
  205 + static const String set_marketing_by_seller =
  206 + "?service=App.GuestManage.SetMarketingBySeller"; // 商家修改营销
  207 + static const String get_guest_by_gid =
  208 + "?service=App.GuestManage.GetGuestByGid"; // 客户经理营销中的用户列表
  209 + static const String get_marketing_by_uid =
  210 + "?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表
203 211
204 } 212 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/customer_label_model.dart';
  5 +import 'package:one_key/models/guest_info_model.dart';
  6 +import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/dialog_util.dart';
  10 +import 'package:one_key/utils/event_bus.dart';
  11 +import 'package:one_key/utils/utils.dart';
  12 +import 'package:one_key/widgets/h_empty_view.dart';
  13 +import 'package:one_key/widgets/round_button.dart';
  14 +import 'package:one_key/widgets/system_app_bar.dart';
  15 +import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
  17 +
  18 +class MyCustomerDetailEditPage extends StatefulWidget {
  19 + final Guest guest;
  20 + final FromPage fromPage;
  21 + MyCustomerDetailEditPage({Key key, this.guest, this.fromPage})
  22 + : super(key: key);
  23 +
  24 + @override
  25 + _MyCustomerDetailEditPageState createState() => _MyCustomerDetailEditPageState();
  26 +}
  27 +
  28 +class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
  29 + List sexList = []; // 先生、女士、公司
  30 + TextEditingController nameController = TextEditingController();
  31 + FocusNode nameFocus = FocusNode();
  32 + String nameStr;
  33 + TextEditingController phoneController = TextEditingController();
  34 + FocusNode phoneFocus = FocusNode();
  35 + TextEditingController adressController = TextEditingController();
  36 + FocusNode adressFocus = FocusNode();
  37 + TextEditingController departmentController = TextEditingController();
  38 + FocusNode departmentFocus = FocusNode();
  39 + TextEditingController positionController = TextEditingController();
  40 + FocusNode positionFocus = FocusNode();
  41 + TextEditingController jkController = TextEditingController();
  42 + TextEditingController xhController = TextEditingController();
  43 + TextEditingController fwController = TextEditingController();
  44 + bool showLabel = false;
  45 +
  46 + CustomerProvider customerProvider;
  47 + String labelShow = '';
  48 + ScrollController scrollController = ScrollController();
  49 + @override
  50 + void initState() {
  51 + super.initState();
  52 + _initSexList();
  53 + nameFocus.addListener(() {
  54 + if (nameFocus.hasFocus) {
  55 + print('得到焦点');
  56 + } else {
  57 + print('失去焦点');
  58 + // _homeEnterModel.nameController.text = nameStr + _nameSuffix();
  59 + _addNameSuffix(nameStr, _nameSuffix());
  60 + }
  61 + setState(() {});
  62 + });
  63 + WidgetsBinding.instance.addPostFrameCallback((_) {
  64 + if (widget.guest.rname != '' &&
  65 + widget.guest.rname != null &&
  66 + widget.guest.sex != '' &&
  67 + widget.guest.sex != null) {
  68 + nameStr = widget.guest.rname;
  69 + for (var item in sexList) {
  70 + item['select'] = false;
  71 + if (item['code'] == widget.guest.sex) {
  72 + item['select'] = true;
  73 + }
  74 + }
  75 + _addNameSuffix(nameStr, _nameSuffix());
  76 + }
  77 + phoneController.text = widget.guest.phone ?? '';
  78 + adressController.text = widget.guest.company ?? '';
  79 + departmentController.text = widget.guest.section ?? '';
  80 + positionController.text = widget.guest.position ?? '';
  81 + jkController.text = widget.guest.taboos ?? '';
  82 + xhController.text = widget.guest.like ?? '';
  83 + fwController.text = widget.guest.serve ?? '';
  84 + labelShow = widget.guest.label ?? '';
  85 + setState(() {});
  86 + _getLabelBySellerid();
  87 + // scrollController.jumpTo(scrollController.position.minScrollExtent);
  88 + });
  89 + }
  90 +
  91 + ///获取商家标签
  92 + _getLabelBySellerid() async {
  93 + Map<String, String> params = {
  94 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  95 + };
  96 + List<CustomerLabelSunModel> modelLabel =
  97 + await customerProvider.getLabelBySellerid(context, params);
  98 +
  99 + if (modelLabel.length > 0) {
  100 + for (int i = 0; i < customerProvider.labelList.length; i++) {
  101 + if (labelShow == customerProvider.labelList[i].label) {
  102 + customerProvider.labelSelIndex = i;
  103 + }
  104 + }
  105 + }
  106 + }
  107 +
  108 + _setGuestInfo() async {
  109 + if (nameStr.trim().length == 0) {
  110 + Utils.showToast('请填写客户姓名');
  111 + return;
  112 + }
  113 + if (phoneController.text.trim().length == 0) {
  114 + Utils.showToast('请填写客户电话');
  115 + return;
  116 + }
  117 + String sex = '1';
  118 + for (var item in sexList) {
  119 + if (item['select']) {
  120 + sex = item['code'];
  121 + }
  122 + }
  123 + Map<String, String> params = {
  124 + "id": widget.guest.id,
  125 + 'sex': sex,
  126 + 'rname': nameStr,
  127 + 'phone': phoneController.text
  128 + };
  129 +
  130 + if (adressController.text.trim().length > 0) {
  131 + params['company'] = adressController.text;
  132 + }
  133 + if (departmentController.text.trim().length > 0) {
  134 + params['section'] = departmentController.text;
  135 + }
  136 + if (positionController.text.trim().length > 0) {
  137 + params['position'] = positionController.text;
  138 + }
  139 + if (labelShow != '') {
  140 + params['label'] = labelShow;
  141 + }
  142 + if (jkController.text.trim().length > 0) {
  143 + params['taboos'] = jkController.text;
  144 + }
  145 + if (xhController.text.trim().length > 0) {
  146 + params['like'] = xhController.text;
  147 + }
  148 + if (fwController.text.trim().length > 0) {
  149 + params['serve'] = fwController.text;
  150 + }
  151 + bool sucess =
  152 + await customerProvider.setGuestInfo(context, params, showLoading: true);
  153 + if (sucess) {
  154 + Utils.showToast('保存成功');
  155 + bus.emit('refresh_guest_info');
  156 + bus.emit('refresh_guest_list');
  157 + Navigator.pop(context);
  158 + // 刷新前一页
  159 + }
  160 + }
  161 +
  162 + ///称谓
  163 + _initSexList() {
  164 + // String sexStr = detailEntity.sex;
  165 + String sexStr = '1';
  166 + sexList = [
  167 + {
  168 + 'title': '先生',
  169 + 'select': sexStr == '1' ? true : false,
  170 + 'code': '1',
  171 + 'hasLeftBorder': true
  172 + },
  173 + {
  174 + 'title': '女士',
  175 + 'select': sexStr == '2' ? true : false,
  176 + 'code': '2',
  177 + 'hasLeftBorder': false
  178 + },
  179 + {
  180 + 'title': '公司',
  181 + 'select': sexStr == '3' ? true : false,
  182 + 'code': '3',
  183 + 'hasLeftBorder': false
  184 + }
  185 + ];
  186 + }
  187 +
  188 + _addNameSuffix(String name, String suffix) {
  189 + if (name == nameController.text && nameController.text.endsWith(suffix)) {
  190 + return;
  191 + }
  192 + nameController.text = name + suffix;
  193 + }
  194 +
  195 + //姓名后缀
  196 + _nameSuffix() {
  197 + for (var item in sexList) {
  198 + if (item['select'] == true) {
  199 + return item['title'];
  200 + }
  201 + }
  202 + }
  203 +
  204 + Widget _callButton(
  205 + {GestureTapCallback onPress,
  206 + content,
  207 + hasLeftBorder = true,
  208 + isSelect = false}) {
  209 + return InkWell(
  210 + onTap: onPress,
  211 + child: Container(
  212 + width: ScreenUtil().setWidth(84),
  213 + height: ScreenUtil().setHeight(48),
  214 + decoration: BoxDecoration(
  215 + color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe,
  216 + border: Border(
  217 + bottom: BorderSide(
  218 + color: MyColours.color_6AB6B9,
  219 + width: ScreenUtil().setWidth(2)),
  220 + top: BorderSide(
  221 + color: MyColours.color_6AB6B9,
  222 + width: ScreenUtil().setWidth(2)),
  223 + left: hasLeftBorder
  224 + ? BorderSide(
  225 + color: MyColours.color_6AB6B9,
  226 + width: ScreenUtil().setWidth(2))
  227 + : BorderSide.none,
  228 + right: BorderSide(
  229 + color: MyColours.color_6AB6B9,
  230 + width: ScreenUtil().setWidth(2)))),
  231 + child: Align(
  232 + alignment: Alignment.center,
  233 + child: Text(
  234 + content,
  235 + style: TextStyle(
  236 + color: isSelect ? Colors.white : MyColours.color_353535,
  237 + fontSize: ScreenUtil().setSp(28)),
  238 + ),
  239 + ),
  240 + ),
  241 + );
  242 + }
  243 +
  244 + Widget _textfieldWidget(String title, String hint,
  245 + TextEditingController controller, FocusNode focusNode) {
  246 + return Container(
  247 + // height: ScreenUtil().setWidth(60),
  248 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(10)),
  249 + decoration: BoxDecoration(
  250 + border: Border(
  251 + bottom: BorderSide(
  252 + width: ScreenUtil().setWidth(2),
  253 + color: Color.fromRGBO(220, 220, 220, 1)))),
  254 + child: Row(
  255 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  256 + crossAxisAlignment: CrossAxisAlignment.center,
  257 + children: [
  258 + Container(
  259 + width: ScreenUtil().setWidth(150),
  260 + height: ScreenUtil().setWidth(35),
  261 + child: Text(
  262 + title,
  263 + style: TextStyle(
  264 + fontSize: ScreenUtil().setSp(28),
  265 + color: MyColours.color_333333),
  266 + ),
  267 + ),
  268 + Expanded(
  269 + child: TextField(
  270 + maxLines: 1,
  271 +
  272 + //输入文本的样式
  273 + style: TextStyle(
  274 + fontSize: ScreenUtil().setSp(30),
  275 + color: MyColours.color_353535),
  276 + controller: controller,
  277 + focusNode: focusNode,
  278 + // textAlignVertical: TextAlignVertical.top,
  279 + decoration: InputDecoration(
  280 + hintText: hint,
  281 + hintStyle: TextStyle(
  282 + color: MyColours.color_999999,
  283 + fontSize: ScreenUtil().setSp(30),
  284 + ),
  285 + // contentPadding:
  286 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  287 + contentPadding: EdgeInsets.zero,
  288 + border: OutlineInputBorder(borderSide: BorderSide.none),
  289 + ),
  290 + onChanged: (value) {},
  291 + onEditingComplete: () {
  292 + // if (controller == nameController) {
  293 + // nameFocus.unfocus();
  294 + // // _homeEnterModel.nameController.text =
  295 + // // nameStr + _nameSuffix();
  296 + // _addNameSuffix(nameStr, _nameSuffix());
  297 + // }
  298 + print('fff');
  299 + },
  300 + keyboardType: TextInputType.text,
  301 + ),
  302 + ),
  303 + ],
  304 + ),
  305 + );
  306 + }
  307 +
  308 + ///忌口和喜好
  309 + Widget _textMulLine(
  310 + String title, String hintText, TextEditingController controller) {
  311 + return Container(
  312 + // height: ScreenUtil().setWidth(380),
  313 + child: Column(
  314 + crossAxisAlignment: CrossAxisAlignment.start,
  315 + children: [
  316 + Align(
  317 + alignment: Alignment.centerLeft,
  318 + child: Text(
  319 + title,
  320 + textAlign: TextAlign.left,
  321 + style: TextStyle(
  322 + color: MyColours.color_333333,
  323 + fontSize: ScreenUtil().setSp(28)),
  324 + )),
  325 + VEmptyView(20),
  326 + TextField(
  327 + controller: controller,
  328 + // keyboardType: TextInputType.number, //键盘类型,数字键盘
  329 + maxLines: 4,
  330 + // maxLength: 50,
  331 +
  332 + // maxLengthEnforced: true,
  333 + style: TextStyle(
  334 + fontSize: ScreenUtil().setSp(30),
  335 + color: MyColours.color_333333), //输入文本的样式
  336 + decoration: InputDecoration(
  337 + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
  338 + hintText: hintText,
  339 + hintStyle: TextStyle(
  340 + color: MyColours.color_999999,
  341 + fontSize: ScreenUtil().setSp(30),
  342 + ),
  343 + // fillColor: MyColours.color_F9F9F9,
  344 + // fillColor: Colors.red,
  345 + // filled: true,
  346 + enabledBorder: OutlineInputBorder(
  347 + //未选中时候的颜色
  348 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  349 + borderSide: BorderSide(
  350 + color: MyColours.color_cccccc,
  351 + width: ScreenUtil().setWidth(2)),
  352 + ),
  353 + focusedBorder: OutlineInputBorder(
  354 + //选中时外边框颜色
  355 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  356 + borderSide: BorderSide(
  357 + color: MyColours.app_main,
  358 + ),
  359 + ),
  360 + // border: OutlineInputBorder(
  361 + // borderRadius:
  362 + // BorderRadius.circular(ScreenUtil().setWidth(20)),
  363 + // borderSide: BorderSide(
  364 + // color: Colors.red, width: ScreenUtil().setWidth(2))),
  365 + ),
  366 + onChanged: (value) {},
  367 + ),
  368 + ],
  369 + ),
  370 + );
  371 + }
  372 +
  373 + @override
  374 + Widget build(BuildContext context) {
  375 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  376 + return Scaffold(
  377 + backgroundColor: MyColours.color_ffffff,
  378 + appBar: SystemAppBar(
  379 + '编辑客户详情',
  380 + onTap: () {
  381 + Navigator.of(context).pop();
  382 + },
  383 + ),
  384 + body: Column(
  385 + children: [
  386 + Expanded(
  387 + child: Padding(
  388 + padding: EdgeInsets.symmetric(
  389 + horizontal: ScreenUtil().setWidth(50)),
  390 + child: ListView(
  391 + controller: scrollController,
  392 + children: [
  393 + // VEmptyView(30),
  394 + Container(
  395 + // height: ScreenUtil().setWidth(60),
  396 + padding: EdgeInsets.symmetric(
  397 + vertical: ScreenUtil().setWidth(10)),
  398 + decoration: BoxDecoration(
  399 + border: Border(
  400 + bottom: BorderSide(
  401 + width: ScreenUtil().setWidth(2),
  402 + color:
  403 + Color.fromRGBO(220, 220, 220, 1)))),
  404 + child: Row(
  405 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  406 + crossAxisAlignment: CrossAxisAlignment.center,
  407 + children: [
  408 + Container(
  409 + // color: Colors.red,
  410 + width: ScreenUtil().setWidth(150),
  411 + height: ScreenUtil().setWidth(35),
  412 + child: Text(
  413 + '姓名',
  414 + style: TextStyle(
  415 + fontSize: ScreenUtil().setSp(28),
  416 + color: MyColours.color_333333),
  417 + ),
  418 + ),
  419 + Expanded(
  420 + child: TextField(
  421 + maxLines: 1,
  422 +
  423 + //输入文本的样式
  424 + style: TextStyle(
  425 + fontSize: ScreenUtil().setSp(30),
  426 + color: MyColours.color_353535),
  427 + controller: nameController,
  428 + focusNode: nameFocus,
  429 + // textAlignVertical: TextAlignVertical.top,
  430 + decoration: InputDecoration(
  431 + hintText: "填写姓名",
  432 + hintStyle: TextStyle(
  433 + color: MyColours.color_999999,
  434 + fontSize: ScreenUtil().setSp(30),
  435 + ),
  436 + // contentPadding:
  437 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  438 + contentPadding: EdgeInsets.zero,
  439 + border: OutlineInputBorder(
  440 + borderSide: BorderSide.none),
  441 + ),
  442 + onChanged: (value) {
  443 + print('ggg');
  444 +
  445 + if (value.endsWith('先生') ||
  446 + value.endsWith('女士') ||
  447 + value.endsWith('公司')) {
  448 + nameStr =
  449 + value.substring(0, value.length - 2);
  450 + } else {
  451 + nameStr = value;
  452 + }
  453 + },
  454 + onEditingComplete: () {
  455 + print('fff');
  456 + nameFocus.unfocus();
  457 + // _homeEnterModel.nameController.text =
  458 + // nameStr + _nameSuffix();
  459 + _addNameSuffix(nameStr, _nameSuffix());
  460 + },
  461 + keyboardType: TextInputType.text,
  462 + ),
  463 + ),
  464 + // HEmptyView(40),
  465 + Row(
  466 + children: sexList.map((value) {
  467 + return _callButton(
  468 + onPress: () {
  469 + for (var item in sexList) {
  470 + item['select'] = false;
  471 + if (item['title'] == value['title']) {
  472 + item['select'] = true;
  473 + // _homeEnterModel.nameController.text =
  474 + // nameStr + item['title'];
  475 + if (nameStr != null &&
  476 + nameStr != '') {
  477 + _addNameSuffix(
  478 + nameStr, item['title']);
  479 + }
  480 + }
  481 + }
  482 + setState(() {});
  483 + },
  484 + content: value['title'],
  485 + hasLeftBorder: value['hasLeftBorder'],
  486 + isSelect: value['select']);
  487 + }).toList()),
  488 + ],
  489 + ),
  490 + ),
  491 + _textfieldWidget(
  492 + '电话', '填写电话', phoneController, phoneFocus),
  493 + _textfieldWidget(
  494 + '工作单位', '填写工作单位', adressController, adressFocus),
  495 + _textfieldWidget('部门', '填写部门', departmentController,
  496 + departmentFocus),
  497 + _textfieldWidget(
  498 + '职位', '填写职位', positionController, positionFocus),
  499 + InkWell(
  500 + onTap: () {
  501 + FocusScope.of(context)
  502 + .requestFocus(FocusNode()); //隐藏键盘
  503 + DialogUtil.showSelectCusmanDialog(
  504 + context,
  505 + customerProvider.labelList.map((item) {
  506 + return item.label;
  507 + }).toList(), (value) {
  508 + if (value != null) {
  509 + setState(() {
  510 + customerProvider.labelSelIndex =
  511 + value.first;
  512 + labelShow = customerProvider
  513 + .labelList[
  514 + customerProvider.labelSelIndex]
  515 + .label;
  516 + });
  517 + }
  518 + },
  519 + selecteds:
  520 + customerProvider.labelSelIndex == null
  521 + ? []
  522 + : [
  523 + customerProvider.labelSelIndex
  524 + ])
  525 + .then((value) {});
  526 + },
  527 + child: Container(
  528 + // height: ScreenUtil().setWidth(60),
  529 + padding: EdgeInsets.symmetric(
  530 + vertical: ScreenUtil().setWidth(50)),
  531 + decoration: BoxDecoration(
  532 + border: Border(
  533 + bottom: BorderSide(
  534 + width: ScreenUtil().setWidth(2),
  535 + color: Color.fromRGBO(
  536 + 220, 220, 220, 1)))),
  537 + child: Row(
  538 + mainAxisAlignment:
  539 + MainAxisAlignment.spaceBetween,
  540 + crossAxisAlignment: CrossAxisAlignment.center,
  541 + children: [
  542 + Container(
  543 + // color: Colors.red,
  544 + width: ScreenUtil().setWidth(150),
  545 + height: ScreenUtil().setWidth(35),
  546 + child: Text(
  547 + '自定义标签',
  548 + style: TextStyle(
  549 + fontSize: ScreenUtil().setSp(28),
  550 + color: MyColours.color_333333),
  551 + ),
  552 + ),
  553 + Expanded(
  554 + child: Text(
  555 + labelShow,
  556 + overflow: TextOverflow.ellipsis,
  557 + style: TextStyle(
  558 + color: Color.fromRGBO(193, 194, 63, 1),
  559 + fontSize: ScreenUtil().setSp(28),
  560 + ),
  561 + )),
  562 + HEmptyView(10),
  563 + Image.asset(
  564 + Utils.getImgPath(showLabel
  565 + ? 'c_arrow_up'
  566 + : 'c_arrow_down'),
  567 + width: ScreenUtil().setWidth(24),
  568 + // height: ScreenUtil().setWidth(10),
  569 + )
  570 + ],
  571 + ),
  572 + )),
  573 +
  574 + VEmptyView(60),
  575 + _textMulLine('忌口', '输入忌口的东西', jkController),
  576 + VEmptyView(30),
  577 + _textMulLine('喜好', '输入喜好', xhController),
  578 + VEmptyView(30),
  579 + _textMulLine('服务', '输入服务', fwController),
  580 + ],
  581 + ))),
  582 + RoundButton(
  583 + text: '保存',
  584 + radius: ScreenUtil().setWidth(10),
  585 + margin:
  586 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(90)),
  587 + height: ScreenUtil().setWidth(80),
  588 + fontSize: 26,
  589 + isBold: false,
  590 + onPressed: () {
  591 + _setGuestInfo();
  592 + },
  593 + ),
  594 + VEmptyView(30)
  595 + ],
  596 + ));
  597 + }
  598 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/customer_list_model.dart';
  5 +import 'package:one_key/models/guest_info_model.dart';
  6 +import 'package:one_key/models/user_history_entity.dart';
  7 +import 'package:one_key/provider/customer_provider.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/event_bus.dart';
  12 +import 'package:one_key/utils/utils.dart';
  13 +import 'package:one_key/widgets/h_empty_view.dart';
  14 +import 'package:one_key/widgets/page_exception.dart';
  15 +import 'package:one_key/widgets/round_button.dart';
  16 +import 'package:one_key/widgets/system_app_bar.dart';
  17 +import 'package:one_key/widgets/v_empty_view.dart';
  18 +import 'package:provider/provider.dart';
  19 +
  20 +class MyCustomerDetailPage extends StatefulWidget {
  21 + final CustomerListSunModel userHistoryEntity;
  22 + final FromPage fromPage;
  23 +
  24 + MyCustomerDetailPage({Key key, this.userHistoryEntity, this.fromPage})
  25 + : super(key: key);
  26 +
  27 + @override
  28 + _MyCustomerDetailPageState createState() => _MyCustomerDetailPageState();
  29 +}
  30 +
  31 +class _MyCustomerDetailPageState extends State<MyCustomerDetailPage> {
  32 + ScrollController controller = ScrollController();
  33 + CustomerProvider customerProvider;
  34 +
  35 + @override
  36 + void initState() {
  37 + super.initState();
  38 +
  39 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  40 + _getGuestInfo();
  41 + });
  42 + bus.on("refresh_guest_info", (arg) {
  43 + _getGuestInfo();
  44 + });
  45 + }
  46 +
  47 + @override
  48 + void dispose() {
  49 + EventBus().emit('refresh_guest_info');
  50 + super.dispose();
  51 + }
  52 +
  53 + _getGuestInfo() async {
  54 + Map<String, String> params = {
  55 + "id": widget.userHistoryEntity.id,
  56 + 'phone': widget.userHistoryEntity.phone
  57 + };
  58 + await customerProvider.getGuestInfo(context, params);
  59 + // await customerProvider.searchData(customerProvider.controller.text);
  60 + }
  61 +
  62 + Widget _headerWidget() {
  63 + return Container(
  64 + padding: EdgeInsets.symmetric(
  65 + horizontal: ScreenUtil().setWidth(40),
  66 + vertical: ScreenUtil().setWidth(40),
  67 + ),
  68 + decoration: BoxDecoration(color: MyColours.color_ffffff, boxShadow: [
  69 + BoxShadow(
  70 + color: MyColours.color_E0E0E0,
  71 + offset: Offset(2, -2), //x,y轴
  72 + blurRadius: ScreenUtil().setWidth(6), //阴影模糊程度
  73 + spreadRadius: 0 //阴影扩散程度
  74 + )
  75 + ]),
  76 + child: Row(
  77 + children: [
  78 + Column(
  79 + children: [
  80 + Stack(
  81 + alignment: Alignment.bottomCenter,
  82 + clipBehavior: Clip.none,
  83 + children: [
  84 + Container(
  85 + width: ScreenUtil().setWidth(120),
  86 + height: ScreenUtil().setWidth(120),
  87 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
  88 + alignment: Alignment.center,
  89 + decoration: BoxDecoration(
  90 + color: Color.fromRGBO(239, 239, 239, 1),
  91 + borderRadius:
  92 + BorderRadius.circular(ScreenUtil().setWidth(20))),
  93 + child: Text(
  94 + customerProvider.guestInfoSunModel.guest.rnameStr != ''
  95 + ? customerProvider.guestInfoSunModel.guest.rnameStr
  96 + .substring(0, 1)
  97 + : '',
  98 + style: TextStyle(
  99 + color: Color.fromRGBO(206, 206, 206, 1),
  100 + fontSize: ScreenUtil().setSp(72)),
  101 + ),
  102 + ),
  103 + Positioned(
  104 + bottom: ScreenUtil().setWidth(-20),
  105 + child: Container(
  106 + padding: EdgeInsets.symmetric(
  107 + horizontal: ScreenUtil().setWidth(10),
  108 + vertical: ScreenUtil().setWidth(2),
  109 + ),
  110 + decoration: BoxDecoration(
  111 + color: customerProvider
  112 + .guestInfoSunModel.guest.attr !=
  113 + null &&
  114 + customerProvider
  115 + .guestInfoSunModel.guest.attr !=
  116 + ''
  117 + ? customerProvider
  118 + .guestInfoSunModel.guest.attr ==
  119 + '沉睡'
  120 + ? Color.fromRGBO(223, 33, 81, 1)
  121 + : customerProvider
  122 + .guestInfoSunModel.guest.attr ==
  123 + '活跃'
  124 + ? Color.fromRGBO(81, 170, 94, 1)
  125 + : customerProvider.guestInfoSunModel
  126 + .guest.attr ==
  127 + '流失'
  128 + ? Color.fromRGBO(109, 101, 248, 1)
  129 + : Color.fromRGBO(239, 143, 49, 1)
  130 + : Colors.transparent,
  131 + borderRadius: BorderRadius.circular(
  132 + ScreenUtil().setWidth(10),
  133 + ),
  134 + ),
  135 + child: Text(
  136 + customerProvider.guestInfoSunModel.guest.attr,
  137 + style: TextStyle(
  138 + color: MyColours.color_ffffff,
  139 + fontSize: ScreenUtil().setSp(28)))))
  140 + ],
  141 + ),
  142 +
  143 + ],
  144 + ),
  145 + HEmptyView(30),
  146 + Column(
  147 + crossAxisAlignment: CrossAxisAlignment.start,
  148 + children: [
  149 + Row(
  150 + crossAxisAlignment: CrossAxisAlignment.end,
  151 + children: [
  152 + Container(
  153 + height: ScreenUtil().setWidth(80),
  154 + constraints:
  155 + BoxConstraints(maxWidth: ScreenUtil().setWidth(260)),
  156 + child: Text(
  157 + customerProvider.guestInfoSunModel.guest.rnameStr,
  158 + overflow: TextOverflow.ellipsis,
  159 + style: TextStyle(
  160 + color: MyColours.color_333333,
  161 + fontSize: ScreenUtil().setSp(64)),
  162 + )),
  163 + HEmptyView(10),
  164 + Container(
  165 + height: ScreenUtil().setWidth(80),
  166 + padding:
  167 + EdgeInsets.only(bottom: ScreenUtil().setWidth(8)),
  168 + alignment: Alignment.bottomLeft,
  169 + child: Text(
  170 + customerProvider.guestInfoSunModel.guest.sexStr != ''
  171 + ? '[${customerProvider.guestInfoSunModel.guest.sexStr}]'
  172 + : '',
  173 + style: TextStyle(
  174 + color: MyColours.color_333333,
  175 + fontSize: ScreenUtil().setSp(22),
  176 + ),
  177 + )),
  178 + ],
  179 + ),
  180 + customerProvider.guestInfoSunModel.guest.label != null
  181 + ? Container(
  182 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
  183 + constraints:
  184 + BoxConstraints(maxWidth: ScreenUtil().setWidth(200)),
  185 + child: Text(
  186 + customerProvider.guestInfoSunModel.guest.label,
  187 + overflow: TextOverflow.ellipsis,
  188 + style: TextStyle(
  189 + color: Color.fromRGBO(193, 194, 63, 1),
  190 + fontSize: ScreenUtil().setSp(22),
  191 + ),
  192 + ))
  193 + : SizedBox(),
  194 + VEmptyView(20),
  195 + InkWell(
  196 + onTap: () {
  197 + DialogUtil.goPhone(
  198 + customerProvider.guestInfoSunModel.guest.phone);
  199 + },
  200 + child: Container(
  201 + padding: EdgeInsets.symmetric(
  202 + horizontal: ScreenUtil().setWidth(20),
  203 + vertical: ScreenUtil().setWidth(10)),
  204 + decoration: BoxDecoration(
  205 + color: MyColours.color_199095,
  206 + borderRadius:
  207 + BorderRadius.circular(ScreenUtil().setWidth(20))),
  208 + child: Row(
  209 + children: [
  210 + Image.asset(
  211 + Utils.getImgPath('c_phone'),
  212 + width: ScreenUtil().setWidth(30),
  213 + ),
  214 + HEmptyView(10),
  215 + Text(
  216 + customerProvider.guestInfoSunModel.guest.phone,
  217 + overflow: TextOverflow.ellipsis,
  218 + style: TextStyle(
  219 + color: MyColours.color_ffffff,
  220 + fontWeight: FontWeight.bold,
  221 + fontSize: ScreenUtil().setSp(34),
  222 + ),
  223 + )
  224 + ],
  225 + )))
  226 + ],
  227 + ),
  228 + Spacer(),
  229 + RoundButton(
  230 + text: '编辑',
  231 + radius: ScreenUtil().setWidth(20),
  232 + width: ScreenUtil().setWidth(90),
  233 + height: ScreenUtil().setWidth(50),
  234 + fontSize: 26,
  235 + isBold: false,
  236 + onPressed: () {
  237 + NavigatorUtil.goMyCustomerDetailEditPage(context,
  238 + customerProvider.guestInfoSunModel.guest, widget.fromPage);
  239 + },
  240 + ),
  241 + ],
  242 + ),
  243 + );
  244 + }
  245 +
  246 + Widget _lineItemWidget(String title, String content) {
  247 + return Container(
  248 + padding: EdgeInsets.symmetric(
  249 + horizontal: ScreenUtil().setWidth(40),
  250 + vertical: ScreenUtil().setWidth(30)),
  251 + color: MyColours.color_ffffff,
  252 + child: Row(
  253 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  254 + children: [
  255 + Text(
  256 + title,
  257 + style: TextStyle(
  258 + fontSize: ScreenUtil().setSp(36),
  259 + color: MyColours.color_333333),
  260 + ),
  261 + Text(
  262 + content,
  263 + style: TextStyle(
  264 + fontSize: ScreenUtil().setSp(26),
  265 + color: title == '忌口' ? Colors.red : MyColours.color_199095),
  266 + )
  267 + ],
  268 + ));
  269 + }
  270 +
  271 + @override
  272 + Widget build(BuildContext context) {
  273 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  274 + return Scaffold(
  275 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  276 + appBar: SystemAppBar(
  277 + '客户详情',
  278 + onTap: () {
  279 + Navigator.of(context).pop();
  280 + },
  281 + ),
  282 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  283 + if (model.pageStateGuestInfo != PageState.Success) {
  284 + return ExceptionPage(
  285 + pageState: model.pageStateGuestInfo,
  286 + callback: () {
  287 + model.pageStateGuestInfo = PageState.Loading;
  288 + model.notifyListeners();
  289 + _getGuestInfo();
  290 + },
  291 + emptyMsg: "暂时没有客户哦",
  292 + emptyImg: "empty_search",
  293 + showMsg: "加载中,请稍后...",
  294 + );
  295 + } else {
  296 + return Column(
  297 + children: [
  298 + Expanded(
  299 + child: SingleChildScrollView(
  300 + controller: controller,
  301 + child: Column(
  302 + children: [
  303 + Container(
  304 + width: double.infinity,
  305 + height: ScreenUtil().setWidth(20),
  306 + color: MyColours.color_ffffff,
  307 + ),
  308 + _headerWidget(),
  309 + VEmptyView(20),
  310 + Container(
  311 + padding: EdgeInsets.symmetric(
  312 + horizontal: ScreenUtil().setWidth(40),
  313 + vertical: ScreenUtil().setWidth(20)),
  314 + decoration: BoxDecoration(
  315 + color: MyColours.color_199095,
  316 + borderRadius: BorderRadius.only(
  317 + topRight:
  318 + Radius.circular(ScreenUtil().setWidth(20)),
  319 + topLeft:
  320 + Radius.circular(ScreenUtil().setWidth(20)))),
  321 + child: Row(
  322 + children: [
  323 + Expanded(
  324 + child: Text(
  325 + '已创建 ${customerProvider.guestInfoSunModel.count.createTime} 天 | 累计 ${customerProvider.guestInfoSunModel.count.leiji} 单 | 取消 ${customerProvider.guestInfoSunModel.count.quxiao} 单',
  326 + overflow: TextOverflow.ellipsis,
  327 + style: TextStyle(
  328 + color: MyColours.color_ffffff,
  329 + fontSize: ScreenUtil().setSp(30)),
  330 + )),
  331 + InkWell(
  332 + onTap: () {
  333 + NavigatorUtil.goMyCustomerOrderPage(
  334 + context,
  335 + customerProvider.guestInfoSunModel.guest.id,
  336 + customerProvider
  337 + .guestInfoSunModel.guest.phone);
  338 + },
  339 + child: Text('更多',
  340 + style: TextStyle(
  341 + decoration: TextDecoration.underline,
  342 + color: MyColours.color_ffffff,
  343 + fontSize: ScreenUtil().setSp(26)))),
  344 + ],
  345 + ),
  346 + ),
  347 + Container(
  348 + color: MyColours.color_ffffff,
  349 + padding: EdgeInsets.symmetric(
  350 + horizontal: ScreenUtil().setWidth(20),
  351 + vertical: ScreenUtil().setWidth(20)),
  352 + child: Column(
  353 + children: [
  354 + Wrap(
  355 + children: [
  356 + Text(
  357 + '最近一次:',
  358 + style: TextStyle(
  359 + fontSize: ScreenUtil().setSp(24),
  360 + color: MyColours.color_333333),
  361 + ),
  362 + Text(
  363 + Utils.formatFromMill(customerProvider
  364 + .guestInfoSunModel.last.ddate),
  365 + overflow: TextOverflow.ellipsis,
  366 + style: TextStyle(
  367 + fontSize: ScreenUtil().setSp(24),
  368 + color: Color.fromRGBO(208, 31, 37, 1)),
  369 + ),
  370 + Text(
  371 + customerProvider
  372 + .guestInfoSunModel.last.ddateSoltStr,
  373 + style: TextStyle(
  374 + fontSize: ScreenUtil().setSp(24),
  375 + color: MyColours.color_199095),
  376 + ),
  377 + Text(
  378 + ' 桌位:',
  379 + style: TextStyle(
  380 + fontSize: ScreenUtil().setSp(24),
  381 + color: MyColours.color_333333),
  382 + ),
  383 + Text(
  384 + customerProvider
  385 + .guestInfoSunModel.last.tableinfoName,
  386 + style: TextStyle(
  387 + fontSize: ScreenUtil().setSp(24),
  388 + color: MyColours.color_199095),
  389 + ),
  390 + Text(
  391 + ' 人数:',
  392 + style: TextStyle(
  393 + fontSize: ScreenUtil().setSp(24),
  394 + color: MyColours.color_333333),
  395 + ),
  396 + Text(
  397 + customerProvider
  398 + .guestInfoSunModel.last.actualPum ==
  399 + null
  400 + ? '未记录'
  401 + : customerProvider
  402 + .guestInfoSunModel.last.actualPum,
  403 + style: TextStyle(
  404 + fontSize: ScreenUtil().setSp(24),
  405 + color: MyColours.color_199095),
  406 + ),
  407 + Text(
  408 + ' 消费:',
  409 + style: TextStyle(
  410 + fontSize: ScreenUtil().setSp(24),
  411 + color: MyColours.color_333333),
  412 + ),
  413 + Text(
  414 + customerProvider
  415 + .guestInfoSunModel.last.conAmount ==
  416 + null
  417 + ? '未记录'
  418 + : customerProvider
  419 + .guestInfoSunModel.last.conAmount,
  420 + style: TextStyle(
  421 + fontSize: ScreenUtil().setSp(24),
  422 + color: MyColours.color_199095),
  423 + )
  424 + ],
  425 + ),
  426 + VEmptyView(6),
  427 + Row(
  428 + mainAxisAlignment: MainAxisAlignment.center,
  429 + children: [
  430 + Text(
  431 + '客户经理:',
  432 + style: TextStyle(
  433 + fontSize: ScreenUtil().setSp(24),
  434 + color: MyColours.color_333333),
  435 + ),
  436 + Text(
  437 + '${customerProvider.guestInfoSunModel.last.sellerUserNickName} ${customerProvider.guestInfoSunModel.last.sellerUserPhone}',
  438 + style: TextStyle(
  439 + fontSize: ScreenUtil().setSp(24),
  440 + color: MyColours.color_199095),
  441 + )
  442 + ],
  443 + )
  444 + ],
  445 + ),
  446 + ),
  447 + VEmptyView(20),
  448 + _lineItemWidget('工作单位',
  449 + '${customerProvider.guestInfoSunModel.guest.company == null ? '' : customerProvider.guestInfoSunModel.guest.company} ${customerProvider.guestInfoSunModel.guest.section == null ? '' : customerProvider.guestInfoSunModel.guest.section} ${customerProvider.guestInfoSunModel.guest.position == null ? '' : customerProvider.guestInfoSunModel.guest.position}'),
  450 + VEmptyView(20),
  451 + _lineItemWidget('忌口',
  452 + '${customerProvider.guestInfoSunModel.guest.taboos == null ? '' : customerProvider.guestInfoSunModel.guest.taboos}'),
  453 + VEmptyView(20),
  454 + _lineItemWidget('喜好',
  455 + '${customerProvider.guestInfoSunModel.guest.like == null ? '' : customerProvider.guestInfoSunModel.guest.like}'),
  456 + VEmptyView(20),
  457 + _lineItemWidget('服务',
  458 + '${customerProvider.guestInfoSunModel.guest.serve == null ? '' : customerProvider.guestInfoSunModel.guest.serve}'),
  459 + VEmptyView(20),
  460 + Container(
  461 + padding: EdgeInsets.symmetric(
  462 + horizontal: ScreenUtil().setWidth(40),
  463 + vertical: ScreenUtil().setWidth(30)),
  464 + color: MyColours.color_ffffff,
  465 + child: Column(children: [
  466 + Row(
  467 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  468 + children: [
  469 + Text(
  470 + '纪念日',
  471 + style: TextStyle(
  472 + fontSize: ScreenUtil().setSp(36),
  473 + color: MyColours.color_333333),
  474 + ),
  475 + RoundButton(
  476 + text: '编辑',
  477 + radius: ScreenUtil().setWidth(20),
  478 + width: ScreenUtil().setWidth(90),
  479 + height: ScreenUtil().setWidth(50),
  480 + fontSize: 26,
  481 + isBold: false,
  482 + onPressed: () {
  483 + NavigatorUtil.goMyFestivalEditPage(
  484 + context,
  485 + customerProvider.guestInfoSunModel.guest,
  486 + widget.userHistoryEntity.id,
  487 + widget.userHistoryEntity.phone);
  488 + },
  489 + ),
  490 + ],
  491 + ),
  492 + ListView.builder(
  493 + shrinkWrap: true,
  494 + itemCount:
  495 + customerProvider.guestInfoSunModel.guest.cDay !=
  496 + null
  497 + ? customerProvider
  498 + .guestInfoSunModel.guest.cDay.length
  499 + : 0,
  500 + controller: controller,
  501 + itemBuilder: (BuildContext context, int index) {
  502 + return Center(
  503 + child: Padding(
  504 + padding: EdgeInsets.symmetric(
  505 + vertical: ScreenUtil().setWidth(10)),
  506 + child: Text(
  507 + customerProvider.guestInfoSunModel.guest
  508 + .cDay[index].content,
  509 + style: TextStyle(
  510 + fontSize: ScreenUtil().setSp(26),
  511 + color: MyColours.color_333333),
  512 + ),
  513 + ));
  514 + },
  515 + )
  516 + ])),
  517 + VEmptyView(20),
  518 + Container(
  519 + padding: EdgeInsets.symmetric(
  520 + horizontal: ScreenUtil().setWidth(40),
  521 + vertical: ScreenUtil().setWidth(30)),
  522 + color: MyColours.color_ffffff,
  523 + child: Column(
  524 + children: [
  525 + Row(
  526 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  527 + children: [
  528 + Text(
  529 + '营销记录',
  530 + style: TextStyle(
  531 + fontSize: ScreenUtil().setSp(36),
  532 + color: MyColours.color_333333),
  533 + ),
  534 + Text(
  535 + '共 ${customerProvider.guestInfoSunModel.marketing?.length} 个',
  536 + style: TextStyle(
  537 + fontSize: ScreenUtil().setSp(26),
  538 + color: MyColours.color_199095),
  539 + )
  540 + ],
  541 + ),
  542 + ListView.builder(
  543 + shrinkWrap: true,
  544 + itemCount: customerProvider
  545 + .guestInfoSunModel.marketing?.length,
  546 + controller: controller,
  547 + itemBuilder: (BuildContext context, int index) {
  548 + Marketing marketing = customerProvider
  549 + .guestInfoSunModel.marketing[index];
  550 + return Center(
  551 + child: Padding(
  552 + padding: EdgeInsets.symmetric(
  553 + vertical: ScreenUtil().setWidth(10)),
  554 + child: Text(
  555 + '${marketing.cdateStr} ${marketing.content}',
  556 + style: TextStyle(
  557 + fontSize: ScreenUtil().setSp(26),
  558 + color: MyColours.color_333333),
  559 + ),
  560 + ));
  561 + },
  562 + )
  563 + ],
  564 + ))
  565 + ],
  566 + ),
  567 + )),
  568 + RoundButton(
  569 + text: '创建预订',
  570 + radius: ScreenUtil().setWidth(10),
  571 + margin:
  572 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(90)),
  573 + height: ScreenUtil().setWidth(80),
  574 + fontSize: 26,
  575 + isBold: false,
  576 + onPressed: () {},
  577 + ),
  578 + VEmptyView(30)
  579 + ],
  580 + );
  581 + }
  582 + }),
  583 + );
  584 + }
  585 +}
@@ -26,15 +26,15 @@ import 'package:provider/provider.dart'; @@ -26,15 +26,15 @@ import 'package:provider/provider.dart';
26 26
27 typedef ClickCallback = void Function(dynamic value); 27 typedef ClickCallback = void Function(dynamic value);
28 28
29 -class CustomerListPage extends StatefulWidget { 29 +class MyCustomerListPage extends StatefulWidget {
30 final FromPage fromPage; 30 final FromPage fromPage;
31 31
32 - const CustomerListPage({Key key, this.fromPage}) : super(key: key); 32 + const MyCustomerListPage({Key key, this.fromPage}) : super(key: key);
33 @override 33 @override
34 - _CustomerListPageState createState() => _CustomerListPageState(); 34 + _MyCustomerListPageState createState() => _MyCustomerListPageState();
35 } 35 }
36 36
37 -class _CustomerListPageState extends State<CustomerListPage> 37 +class _MyCustomerListPageState extends State<MyCustomerListPage>
38 with TickerProviderStateMixin, SingleTickerProviderStateMixin { 38 with TickerProviderStateMixin, SingleTickerProviderStateMixin {
39 List _tabBarTitle; 39 List _tabBarTitle;
40 TabController tabController; 40 TabController tabController;
@@ -137,11 +137,15 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -137,11 +137,15 @@ class _CustomerListPageState extends State<CustomerListPage>
137 Utils.showToast('请至少选择1名顾客'); 137 Utils.showToast('请至少选择1名顾客');
138 return; 138 return;
139 } 139 }
140 - customerMakingProvider.labels = customerProvider.labels;  
141 - customerMakingProvider.selectCustomer =  
142 - customerProvider.selectCustomer;  
143 - customerMakingProvider.fromPage = widget.fromPage;  
144 - NavigatorUtil.goMakeMarkingPage(context); 140 + if (widget.fromPage == FromPage.FromPageMyCustomer) {
  141 + customerMakingProvider.labels = customerProvider.labels;
  142 + customerMakingProvider.selectCustomer =
  143 + customerProvider.selectCustomer;
  144 + customerMakingProvider.fromPage = widget.fromPage;
  145 + NavigatorUtil.goMyMakeMarkingPage(context);
  146 + } else {
  147 + Navigator.pop(context);
  148 + }
145 }, 149 },
146 child: Container( 150 child: Container(
147 alignment: Alignment.center, 151 alignment: Alignment.center,
@@ -1057,9 +1061,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1057,9 +1061,7 @@ class _CustomerListPageState extends State<CustomerListPage>
1057 resizeToAvoidBottomInset: false, 1061 resizeToAvoidBottomInset: false,
1058 backgroundColor: MyColours.color_ffffff, 1062 backgroundColor: MyColours.color_ffffff,
1059 appBar: SystemAppBar( 1063 appBar: SystemAppBar(
1060 - widget.fromPage == FromPage.FromPageMyCustomer  
1061 - ? '我的客户'  
1062 - : '全店客户', 1064 + '我的客户',
1063 onTap: () { 1065 onTap: () {
1064 Navigator.of(context).pop(); 1066 Navigator.of(context).pop();
1065 }, 1067 },
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/models/guest_reserve_model.dart';
  6 +import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/res/colors.dart';
  8 +import 'package:one_key/utils/utils.dart';
  9 +import 'package:one_key/widgets/MyDivider.dart';
  10 +import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
  12 +import 'package:one_key/widgets/system_app_bar.dart';
  13 +import 'package:one_key/widgets/v_empty_view.dart';
  14 +import 'package:provider/provider.dart';
  15 +
  16 +class MyCustomerOrderPage extends StatefulWidget {
  17 + final String id;
  18 + final String phone;
  19 + MyCustomerOrderPage({Key key, this.id, this.phone}) : super(key: key);
  20 +
  21 + @override
  22 + _MyCustomerOrderPageState createState() => _MyCustomerOrderPageState();
  23 +}
  24 +
  25 +class _MyCustomerOrderPageState extends State<MyCustomerOrderPage> {
  26 + int year = DateTime.now().year;
  27 + CustomerProvider customerProvider;
  28 +
  29 + @override
  30 + void initState() {
  31 + super.initState();
  32 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  33 + _getGuestReserve();
  34 + });
  35 + }
  36 +
  37 + _getGuestReserve({bool showLoading = false}) async {
  38 + Map<String, String> params = {
  39 + "id": widget.id,
  40 + "phone": widget.phone,
  41 + 'year': year.toString()
  42 + };
  43 + await customerProvider.getGuestReserve(context, params,
  44 + showLoading: showLoading);
  45 + // await customerProvider.searchData(customerProvider.controller.text);
  46 + }
  47 +
  48 + @override
  49 + Widget build(BuildContext context) {
  50 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  51 + return Scaffold(
  52 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  53 + appBar: SystemAppBar(
  54 + '客户订单',
  55 + onTap: () {
  56 + Navigator.pop(context);
  57 + },
  58 + ),
  59 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  60 + if (model.pageStateGuestReserve != PageState.Success) {
  61 + return ExceptionPage(
  62 + pageState: model.pageStateGuestReserve,
  63 + callback: () {
  64 + model.pageStateGuestReserve = PageState.Loading;
  65 + model.notifyListeners();
  66 + _getGuestReserve();
  67 + },
  68 + emptyMsg: "暂时没有客户订单哦",
  69 + emptyImg: "empty_search",
  70 + showMsg: "加载中,请稍后...",
  71 + );
  72 + } else {
  73 + return Padding(
  74 + padding: EdgeInsets.symmetric(
  75 + // horizontal: ScreenUtil().setWidth(40),
  76 + vertical: ScreenUtil().setWidth(40)),
  77 + child: Column(
  78 + crossAxisAlignment: CrossAxisAlignment.start,
  79 + children: [
  80 + Row(
  81 + children: [
  82 + InkWell(
  83 + onTap: () {
  84 + setState(() {
  85 + year--;
  86 + });
  87 + _getGuestReserve(showLoading: true);
  88 + },
  89 + child: Padding(
  90 + padding: EdgeInsets.only(
  91 + left: ScreenUtil().setWidth(40),
  92 + right: ScreenUtil().setWidth(20)),
  93 + child: Image.asset(
  94 + Utils.getImgPath('c_arrow_left'),
  95 + width: ScreenUtil().setWidth(24),
  96 + ))),
  97 + Text(
  98 + '${year}年',
  99 + style: TextStyle(
  100 + fontSize: ScreenUtil().setSp(34),
  101 + color: MyColours.color_333333),
  102 + ),
  103 + InkWell(
  104 + onTap: () {
  105 + if (year >= DateTime.now().year) {
  106 + return;
  107 + }
  108 + setState(() {
  109 + year++;
  110 + });
  111 + _getGuestReserve(showLoading: true);
  112 + },
  113 + child: Padding(
  114 + padding: EdgeInsets.only(
  115 + left: ScreenUtil().setWidth(20),
  116 + right: ScreenUtil().setWidth(40)),
  117 + child: Image.asset(
  118 + Utils.getImgPath(year != DateTime.now().year
  119 + ? 'c_arrow_right'
  120 + : 'c_arrow_right_gray'),
  121 + width: ScreenUtil().setWidth(24),
  122 + )))
  123 + ],
  124 + ),
  125 + Padding(
  126 + padding: EdgeInsets.symmetric(
  127 + horizontal: ScreenUtil().setWidth(40),
  128 + ),
  129 + child: Column(
  130 + crossAxisAlignment: CrossAxisAlignment.start,
  131 + children: [
  132 + VEmptyView(20),
  133 + Wrap(
  134 + children: [
  135 + Text(
  136 + '全年累计',
  137 + style: TextStyle(
  138 + fontSize: ScreenUtil().setSp(24),
  139 + color: MyColours.color_353535),
  140 + ),
  141 + Text(
  142 + ' ${customerProvider.guestReserveSunModel.count.cumulative} ',
  143 + style: TextStyle(
  144 + fontSize: ScreenUtil().setSp(24),
  145 + color: MyColours.color_199095),
  146 + ),
  147 + Text(
  148 + '单',
  149 + style: TextStyle(
  150 + fontSize: ScreenUtil().setSp(24),
  151 + color: MyColours.color_353535),
  152 + ),
  153 + HEmptyView(20),
  154 + Text(
  155 + '全年取消',
  156 + style: TextStyle(
  157 + fontSize: ScreenUtil().setSp(24),
  158 + color: MyColours.color_353535),
  159 + ),
  160 + Text(
  161 + ' ${customerProvider.guestReserveSunModel.count.cancel} ',
  162 + style: TextStyle(
  163 + fontSize: ScreenUtil().setSp(24),
  164 + color: MyColours.color_199095),
  165 + ),
  166 + Text(
  167 + '单',
  168 + style: TextStyle(
  169 + fontSize: ScreenUtil().setSp(24),
  170 + color: MyColours.color_353535),
  171 + ),
  172 + ],
  173 + ),
  174 + VEmptyView(20),
  175 + Wrap(
  176 + children: [
  177 + Text(
  178 + '记录全额订单:',
  179 + style: TextStyle(
  180 + fontSize: ScreenUtil().setSp(24),
  181 + color: MyColours.color_353535),
  182 + ),
  183 + Text(
  184 + '${customerProvider.guestReserveSunModel.count.money} ',
  185 + style: TextStyle(
  186 + fontSize: ScreenUtil().setSp(24),
  187 + color: MyColours.color_353535),
  188 + ),
  189 + Text(
  190 + '单',
  191 + style: TextStyle(
  192 + fontSize: ScreenUtil().setSp(24),
  193 + color: MyColours.color_353535),
  194 + ),
  195 + HEmptyView(20),
  196 + Text(
  197 + '记录人数订单:',
  198 + style: TextStyle(
  199 + fontSize: ScreenUtil().setSp(24),
  200 + color: MyColours.color_353535),
  201 + ),
  202 + Text(
  203 + '${customerProvider.guestReserveSunModel.count.pnum} ',
  204 + style: TextStyle(
  205 + fontSize: ScreenUtil().setSp(24),
  206 + color: MyColours.color_353535),
  207 + ),
  208 + Text(
  209 + '单',
  210 + style: TextStyle(
  211 + fontSize: ScreenUtil().setSp(24),
  212 + color: MyColours.color_353535),
  213 + ),
  214 + ],
  215 + ),
  216 + VEmptyView(20),
  217 + Wrap(
  218 + children: [
  219 + Text(
  220 + '总消费:',
  221 + style: TextStyle(
  222 + fontSize: ScreenUtil().setSp(24),
  223 + color: MyColours.color_353535),
  224 + ),
  225 + Text(
  226 + '${customerProvider.guestReserveSunModel.count.countMoney} ',
  227 + style: TextStyle(
  228 + fontSize: ScreenUtil().setSp(24),
  229 + color: MyColours.color_353535),
  230 + ),
  231 + Text(
  232 + '元',
  233 + style: TextStyle(
  234 + fontSize: ScreenUtil().setSp(24),
  235 + color: MyColours.color_353535),
  236 + ),
  237 + HEmptyView(20),
  238 + Text(
  239 + '总人数:',
  240 + style: TextStyle(
  241 + fontSize: ScreenUtil().setSp(24),
  242 + color: MyColours.color_353535),
  243 + ),
  244 + Text(
  245 + '${customerProvider.guestReserveSunModel.count.countPnum} ',
  246 + style: TextStyle(
  247 + fontSize: ScreenUtil().setSp(24),
  248 + color: MyColours.color_353535),
  249 + ),
  250 + Text(
  251 + '人',
  252 + style: TextStyle(
  253 + fontSize: ScreenUtil().setSp(24),
  254 + color: MyColours.color_353535),
  255 + ),
  256 + HEmptyView(20),
  257 + Text(
  258 + '人均:',
  259 + style: TextStyle(
  260 + fontSize: ScreenUtil().setSp(24),
  261 + color: MyColours.color_353535),
  262 + ),
  263 + Text(
  264 + '${customerProvider.guestReserveSunModel.count.capita} ',
  265 + style: TextStyle(
  266 + fontSize: ScreenUtil().setSp(24),
  267 + color: MyColours.color_353535),
  268 + ),
  269 + Text(
  270 + '元/人',
  271 + style: TextStyle(
  272 + fontSize: ScreenUtil().setSp(24),
  273 + color: MyColours.color_353535),
  274 + ),
  275 + ],
  276 + ),
  277 + VEmptyView(20),
  278 + MyDivider(
  279 + double.infinity,
  280 + ScreenUtil().setWidth(1),
  281 + color: MyColours.color_E0E0E0,
  282 + ),
  283 + VEmptyView(20),
  284 + ],
  285 + )),
  286 + Expanded(
  287 + child: ListView.builder(
  288 + padding: EdgeInsets.symmetric(
  289 + horizontal: ScreenUtil().setWidth(40),
  290 + ),
  291 + shrinkWrap: true,
  292 + itemCount:
  293 + customerProvider.guestReserveSunModel.list?.length,
  294 + // controller: controller,
  295 + itemBuilder: (BuildContext context, int index) {
  296 + ListData listData =
  297 + customerProvider.guestReserveSunModel.list[index];
  298 + String tableinfo = listData.tableinfoName != ''
  299 + ? ' 【${listData.tableinfoName}】'
  300 + : '';
  301 + return Row(
  302 + crossAxisAlignment: CrossAxisAlignment.start,
  303 + children: [
  304 + Padding(
  305 + padding: EdgeInsets.only(
  306 + top: ScreenUtil().setWidth(6)),
  307 + child: CircleAvatar(
  308 + radius: ScreenUtil().setWidth(10),
  309 + backgroundColor: MyColours.color_199095,
  310 + ),
  311 + ),
  312 + HEmptyView(20),
  313 + Column(
  314 + crossAxisAlignment: CrossAxisAlignment.start,
  315 + children: [
  316 + Container(
  317 + constraints: BoxConstraints(
  318 + maxWidth: ScreenUtil.screenWidthDp -
  319 + ScreenUtil().setWidth(140)),
  320 + child: Text(
  321 + '[${listData.statusStr}] ${listData.ddateStr} ${listData.ddateSoltStr}${tableinfo}',
  322 + maxLines: 10,
  323 + overflow: TextOverflow.ellipsis,
  324 + style: TextStyle(
  325 + fontSize: ScreenUtil().setSp(24),
  326 + color: MyColours.color_353535),
  327 + )),
  328 + VEmptyView(20),
  329 + Row(
  330 + children: [
  331 + Text(
  332 + '人数:',
  333 + style: TextStyle(
  334 + fontSize: ScreenUtil().setSp(24),
  335 + color: MyColours.color_353535),
  336 + ),
  337 + Text(
  338 + listData.actualPum == null
  339 + ? '未记录'
  340 + : listData.actualPum,
  341 + style: TextStyle(
  342 + fontSize: ScreenUtil().setSp(24),
  343 + color: MyColours.color_353535),
  344 + ),
  345 + HEmptyView(20),
  346 + Text(
  347 + '消费:',
  348 + style: TextStyle(
  349 + fontSize: ScreenUtil().setSp(24),
  350 + color: MyColours.color_353535),
  351 + ),
  352 + Text(
  353 + listData.conAmount == null
  354 + ? '未记录'
  355 + : listData.conAmount,
  356 + style: TextStyle(
  357 + fontSize: ScreenUtil().setSp(24),
  358 + color: MyColours.color_353535),
  359 + ),
  360 + ],
  361 + ),
  362 + listData.nickName == null &&
  363 + listData.phone == null
  364 + ? SizedBox()
  365 + : Padding(
  366 + padding: EdgeInsets.only(
  367 + top: ScreenUtil().setWidth(20)),
  368 + child: Text(
  369 + '客户经理:${listData.nickName == null ? '' : listData.nickName} ${listData.phone == null ? '' : listData.phone}',
  370 + style: TextStyle(
  371 + fontSize: ScreenUtil().setSp(24),
  372 + color: MyColours.color_353535),
  373 + )),
  374 + VEmptyView(40),
  375 + ],
  376 + )
  377 + ],
  378 + );
  379 + },
  380 + ))
  381 + ],
  382 + ));
  383 + }
  384 + }));
  385 + }
  386 +}
@@ -2,7 +2,9 @@ import 'package:flutter/material.dart'; @@ -2,7 +2,9 @@ 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'; 3 import 'package:one_key/constant/state.dart';
4 import 'package:one_key/models/guest_manage_model.dart'; 4 import 'package:one_key/models/guest_manage_model.dart';
  5 +import 'package:one_key/models/marketing_by_uid_model.dart';
5 import 'package:one_key/provider/customer_provider.dart'; 6 import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
6 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
7 import 'package:one_key/route/navigator_util.dart'; 9 import 'package:one_key/route/navigator_util.dart';
8 import 'package:one_key/utils/event_bus.dart'; 10 import 'package:one_key/utils/event_bus.dart';
@@ -24,13 +26,26 @@ class MyCustomerPage extends StatefulWidget { @@ -24,13 +26,26 @@ class MyCustomerPage extends StatefulWidget {
24 class _MyCustomerPageState extends State<MyCustomerPage> { 26 class _MyCustomerPageState extends State<MyCustomerPage> {
25 ScrollController _controller = ScrollController(); 27 ScrollController _controller = ScrollController();
26 CustomerProvider customerProvider; 28 CustomerProvider customerProvider;
  29 + bool showWarning = false;
27 @override 30 @override
28 void initState() { 31 void initState() {
29 super.initState(); 32 super.initState();
30 33
31 WidgetsBinding.instance.addPostFrameCallback((_) { 34 WidgetsBinding.instance.addPostFrameCallback((_) {
32 _getGuestManageData(); 35 _getGuestManageData();
  36 + _getMarketingByUid();
33 }); 37 });
  38 +
  39 + bus.on("refresh_my_customer_home", (arg) {
  40 + _getMarketingByUid();
  41 + });
  42 + }
  43 +
  44 + @override
  45 + void dispose() {
  46 + bus.off('refresh_my_customer_home');
  47 + // bus.off("refresh_coupon_list");
  48 + super.dispose();
34 } 49 }
35 50
36 ///我的客户首页 51 ///我的客户首页
@@ -40,6 +55,25 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -40,6 +55,25 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
40 // setState(() {}); 55 // setState(() {});
41 } 56 }
42 57
  58 + _getMarketingByUid() async {
  59 + Map<String, String> params = {
  60 + "uid": Provider.of<UserModel>(context, listen: false).user.openid
  61 + };
  62 + await customerProvider.getMarketingByUid(context, params);
  63 +
  64 + MarketingByUidsSunModel myRecordData =
  65 + await customerProvider.getMarketingByUid(context, params);
  66 + if (myRecordData != null && myRecordData.sellerList.length > 0) {
  67 + bool temp = myRecordData.sellerList.any((value) {
  68 + return value.finishedStatus == '0';
  69 + });
  70 + setState(() {
  71 + showWarning = temp;
  72 + });
  73 + }
  74 + // await customerProvider.searchData(customerProvider.controller.text);
  75 + }
  76 +
43 ///活跃客户、沉睡客户、流失客户 77 ///活跃客户、沉睡客户、流失客户
44 Widget _percentWidget(String pnum, String btnTitle, String percent) { 78 Widget _percentWidget(String pnum, String btnTitle, String percent) {
45 return Container( 79 return Container(
@@ -109,9 +143,9 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -109,9 +143,9 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
109 return ExceptionPage( 143 return ExceptionPage(
110 pageState: model.pageStateMyHome, 144 pageState: model.pageStateMyHome,
111 callback: () { 145 callback: () {
112 - // getTableList(); 146 + _getGuestManageData();
113 }, 147 },
114 - emptyMsg: "暂时没有桌位哦", 148 + emptyMsg: "暂时没有我的客情哦",
115 emptyImg: "empty_search", 149 emptyImg: "empty_search",
116 showMsg: "加载中,请稍后...", 150 showMsg: "加载中,请稍后...",
117 ); 151 );
@@ -150,7 +184,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -150,7 +184,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
150 VEmptyView(10), 184 VEmptyView(10),
151 RoundButton( 185 RoundButton(
152 onPressed: () async { 186 onPressed: () async {
153 - NavigatorUtil.goCustomerListPage( 187 + NavigatorUtil.goMyCustomerListPage(
154 context, FromPage.FromPageMyCustomer); 188 context, FromPage.FromPageMyCustomer);
155 }, 189 },
156 text: '我的客户', 190 text: '我的客户',
@@ -277,6 +311,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -277,6 +311,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
277 // borderColor: MyColours.color_999999, 311 // borderColor: MyColours.color_999999,
278 radius: ScreenUtil().setWidth(40), 312 radius: ScreenUtil().setWidth(40),
279 height: ScreenUtil().setWidth(64), 313 height: ScreenUtil().setWidth(64),
  314 + width: ScreenUtil().setWidth(180),
280 fontSize: 26, 315 fontSize: 26,
281 isBold: false, 316 isBold: false,
282 onPressed: () { 317 onPressed: () {
@@ -345,6 +380,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -345,6 +380,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
345 // borderColor: MyColours.color_999999, 380 // borderColor: MyColours.color_999999,
346 radius: ScreenUtil().setWidth(40), 381 radius: ScreenUtil().setWidth(40),
347 height: ScreenUtil().setWidth(64), 382 height: ScreenUtil().setWidth(64),
  383 + width: ScreenUtil().setWidth(180),
348 fontSize: 26, 384 fontSize: 26,
349 isBold: false, 385 isBold: false,
350 onPressed: () { 386 onPressed: () {
@@ -401,6 +437,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -401,6 +437,7 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
401 // borderColor: MyColours.color_999999, 437 // borderColor: MyColours.color_999999,
402 radius: ScreenUtil().setWidth(40), 438 radius: ScreenUtil().setWidth(40),
403 height: ScreenUtil().setWidth(64), 439 height: ScreenUtil().setWidth(64),
  440 + width: ScreenUtil().setWidth(180),
404 fontSize: 26, 441 fontSize: 26,
405 isBold: false, 442 isBold: false,
406 onPressed: () { 443 onPressed: () {
@@ -417,25 +454,36 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -417,25 +454,36 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
417 ), 454 ),
418 )), 455 )),
419 Padding( 456 Padding(
420 - padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),  
421 - child: RoundButton(  
422 - onPressed: () {  
423 - NavigatorUtil.goMarketingRecordsPage(  
424 - context, FromPage.FromPageMyCustomer);  
425 - },  
426 - text: '营销记录',  
427 - fontSize: 24,  
428 - isBold: false,  
429 - textColor: MyColours.color_199095,  
430 - gradientStart: MyColours.color_ffffff,  
431 - gradientEnd: MyColours.color_ffffff,  
432 - borderColor: MyColours.color_199095,  
433 - height: ScreenUtil().setWidth(75),  
434 - width: ScreenUtil().setWidth(260),  
435 - radius: ScreenUtil().setWidth(10),  
436 - // image: Utils.getImgPath('add_area')  
437 - ),  
438 - ) 457 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  458 + child: Stack(
  459 + children: [
  460 + RoundButton(
  461 + onPressed: () {
  462 + NavigatorUtil.goMyMarketingRecordsPage(
  463 + context, FromPage.FromPageMyCustomer);
  464 + },
  465 + text: '营销记录',
  466 + fontSize: 24,
  467 + isBold: false,
  468 + textColor: MyColours.color_199095,
  469 + gradientStart: MyColours.color_ffffff,
  470 + gradientEnd: MyColours.color_ffffff,
  471 + borderColor: MyColours.color_199095,
  472 + height: ScreenUtil().setWidth(75),
  473 + width: ScreenUtil().setWidth(260),
  474 + radius: ScreenUtil().setWidth(10),
  475 + ),
  476 + showWarning
  477 + ? Positioned(
  478 + right: ScreenUtil().setWidth(30),
  479 + top: ScreenUtil().setWidth(40 / 2),
  480 + child: Image.asset(
  481 + Utils.getImgPath('warning'),
  482 + width: ScreenUtil().setWidth(35),
  483 + ))
  484 + : SizedBox()
  485 + ],
  486 + ))
439 ]); 487 ]);
440 } 488 }
441 }))); 489 })));
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/guest_info_model.dart';
  5 +import 'package:one_key/provider/customer_provider.dart';
  6 +import 'package:one_key/res/colors.dart';
  7 +import 'package:one_key/utils/dialog_util.dart';
  8 +import 'package:one_key/utils/event_bus.dart';
  9 +import 'package:one_key/utils/utils.dart';
  10 +import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
  12 +import 'package:one_key/widgets/round_button.dart';
  13 +import 'package:one_key/widgets/system_app_bar.dart';
  14 +import 'package:one_key/widgets/v_empty_view.dart';
  15 +import 'package:provider/provider.dart';
  16 +
  17 +class MyFestivalEditPage extends StatefulWidget {
  18 + final Guest guest;
  19 + final String idstr;
  20 + final String phone;
  21 + MyFestivalEditPage({Key key, this.guest, this.idstr, this.phone})
  22 + : super(key: key);
  23 +
  24 + @override
  25 + _MyFestivalEditPageState createState() => _MyFestivalEditPageState();
  26 +}
  27 +
  28 +class _MyFestivalEditPageState extends State<MyFestivalEditPage> {
  29 + CustomerProvider customerProvider;
  30 +
  31 + @override
  32 + void initState() {
  33 + super.initState();
  34 +
  35 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  36 + _getGuestInfoCday();
  37 + });
  38 + }
  39 +
  40 + _getGuestInfoCday() async {
  41 + Map<String, String> params = {"id": widget.idstr, 'phone': widget.phone};
  42 + await customerProvider.getGuestInfoCday(context, params);
  43 + // await customerProvider.searchData(customerProvider.controller.text);
  44 + }
  45 +
  46 + _setGuestInfocDay(String id, String cday) async {
  47 + Map<String, String> params = {"gid": widget.guest.id, 'content': cday};
  48 + if (id != '') {
  49 + params["id"] = id;
  50 + }
  51 + bool sucess = await customerProvider.setGuestInfocDay(context, params,
  52 + showLoading: true);
  53 + if (sucess) {
  54 + Utils.showToast('保存成功');
  55 + //刷新当前页
  56 + _getGuestInfoCday();
  57 + // 刷新
  58 + bus.emit('refresh_guest_info');
  59 + bus.emit('refresh_guest_list');
  60 + // Navigator.pop(context);
  61 +
  62 + }
  63 + }
  64 +
  65 + @override
  66 + Widget build(BuildContext context) {
  67 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  68 + return Scaffold(
  69 + backgroundColor: MyColours.color_ffffff,
  70 + appBar: SystemAppBar(
  71 + '纪念日',
  72 + onTap: () {
  73 + Navigator.pop(context);
  74 + },
  75 + ),
  76 + body: Padding(
  77 + padding: EdgeInsets.symmetric(
  78 + horizontal: ScreenUtil().setWidth(40),
  79 + vertical: ScreenUtil().setWidth(40)),
  80 + child: Column(children: [
  81 + Expanded(child:
  82 + Consumer<CustomerProvider>(builder: (context, model, _) {
  83 + if (model.pageStateGuestInfoCday != PageState.Success) {
  84 + return ExceptionPage(
  85 + pageState: model.pageStateGuestInfoCday,
  86 + callback: () {
  87 + model.pageStateGuestInfoCday = PageState.Loading;
  88 + model.notifyListeners();
  89 + _getGuestInfoCday();
  90 + },
  91 + emptyMsg: "暂时没有纪念日哦",
  92 + emptyImg: "empty_search",
  93 + showMsg: "加载中,请稍后...",
  94 + );
  95 + } else {
  96 + return ListView.builder(
  97 + shrinkWrap: true,
  98 + itemCount: model.cday.length,
  99 + itemBuilder: (BuildContext context, int index) {
  100 + return InkWell(
  101 + onTap: () {
  102 + String str = model.cday[index].content;
  103 + // str += '${name}:';
  104 + // if (yearStr != '' &&
  105 + // yearStr != null &&
  106 + // yearStr != '选填') {
  107 + // str += '${yearStr}年';
  108 + // }
  109 + // str += '${monthStr}月';
  110 + // str += '${dayStr}日';
  111 + // str += '(${gongli ? '公历' : '农历'})';
  112 + String yearStr = '选填';
  113 + String monthStr = '';
  114 + String dayStr = '';
  115 + bool gongli = true;
  116 + String content = str.substring(0, str.indexOf(':'));
  117 + if (str.contains('年')) {
  118 + yearStr = str.substring(
  119 + str.indexOf(':') + 1, str.indexOf('年'));
  120 + }
  121 + if (str.contains('月')) {
  122 + if (str.contains('年')) {
  123 + monthStr = str.substring(
  124 + str.indexOf('年') + 1, str.indexOf('月'));
  125 + } else {
  126 + monthStr = str.substring(
  127 + str.indexOf(':') + 1, str.indexOf('月'));
  128 + }
  129 + }
  130 + if (str.contains('日')) {
  131 + dayStr = str.substring(
  132 + str.indexOf('月') + 1, str.indexOf('日'));
  133 + }
  134 + if (str.contains('农历')) {
  135 + gongli = false;
  136 + }
  137 +
  138 + DialogUtil.festivalAlertDialog(
  139 + context, content, 520, rCallback: (name) {
  140 + print(name);
  141 + _setGuestInfocDay(model.cday[index].id, name);
  142 + // _addCookbookClass(name, showLoading: true);
  143 + },
  144 + yearStr: yearStr,
  145 + monthStr: monthStr,
  146 + dayStr: dayStr,
  147 + gongli: gongli);
  148 + },
  149 + child: Padding(
  150 + padding: EdgeInsets.symmetric(
  151 + horizontal: ScreenUtil().setWidth(20),
  152 + vertical: ScreenUtil().setWidth(20)),
  153 + child: Row(
  154 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  155 + children: [
  156 + Expanded(
  157 + child: Text(
  158 + model.cday[index].content,
  159 + overflow: TextOverflow.ellipsis,
  160 + style: TextStyle(
  161 + fontSize: ScreenUtil().setSp(26),
  162 + color: MyColours.color_333333),
  163 + )),
  164 + HEmptyView(10),
  165 + Image.asset(
  166 + Utils.getImgPath('c_edit'),
  167 + width: ScreenUtil().setWidth(40),
  168 + // height: ScreenUtil().setWidth(10),
  169 + )
  170 + ],
  171 + ),
  172 + ));
  173 + },
  174 + );
  175 + }
  176 + })),
  177 + RoundButton(
  178 + text: '新增',
  179 + radius: ScreenUtil().setWidth(10),
  180 + margin:
  181 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(90)),
  182 + height: ScreenUtil().setWidth(80),
  183 + fontSize: 26,
  184 + isBold: false,
  185 + onPressed: () {
  186 + DialogUtil.festivalAlertDialog(context, '', 520,
  187 + rCallback: (name) {
  188 + print(name);
  189 + _setGuestInfocDay('', name);
  190 + // _addCookbookClass(name, showLoading: true);
  191 + });
  192 + },
  193 + ),
  194 + VEmptyView(30)
  195 + ])));
  196 + // }
  197 + // }));
  198 + }
  199 +}
  1 +import 'dart:io';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
  4 +import 'package:flutter/material.dart';
  5 +import 'package:flutter_screenutil/screenutil.dart';
  6 +import 'package:flutter_sms/flutter_sms.dart';
  7 +import 'package:one_key/constant/state.dart';
  8 +import 'package:one_key/models/customer_list_model.dart';
  9 +import 'package:one_key/models/marketing_by_uid_model.dart';
  10 +import 'package:one_key/pages/coupon/coupon_page.dart';
  11 +import 'package:one_key/provider/customer_making_provider.dart';
  12 +import 'package:one_key/provider/customer_provider.dart';
  13 +import 'package:one_key/provider/user_model.dart';
  14 +import 'package:one_key/res/colors.dart';
  15 +import 'package:one_key/route/navigator_util.dart';
  16 +import 'package:one_key/utils/dialog_util.dart';
  17 +import 'package:one_key/utils/utils.dart';
  18 +import 'package:one_key/widgets/h_empty_view.dart';
  19 +import 'package:one_key/widgets/round_button.dart';
  20 +import 'package:one_key/widgets/system_app_bar.dart';
  21 +import 'package:one_key/widgets/v_empty_view.dart';
  22 +import 'package:provider/provider.dart';
  23 +import 'package:sendsms/sendsms.dart';
  24 +
  25 +typedef ClickCallback = void Function(dynamic value);
  26 +
  27 +class MyMakeMarkingPage extends StatefulWidget {
  28 + final FromPage fromPage;
  29 + final SelfList selfList;
  30 + MyMakeMarkingPage(
  31 + {Key key, this.fromPage = FromPage.FromPageCustomerList, this.selfList})
  32 + : super(key: key);
  33 +
  34 + @override
  35 + _MyMakeMarkingPageState createState() => _MyMakeMarkingPageState();
  36 +}
  37 +
  38 +class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
  39 + List<String> couponList = [];
  40 +
  41 + final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
  42 + FocusNode _focusNode = FocusNode();
  43 + bool showDateSelWidget = false;
  44 +
  45 + CustomerProvider customerProvider;
  46 + CustomerMakingProvider customerMakingProvider;
  47 + bool needClear = true;
  48 + String gid = '';
  49 + String andriodPhone = '';
  50 + List<String> iosPhone = [];
  51 +
  52 + @override
  53 + void initState() {
  54 + super.initState();
  55 +
  56 + _focusNode.addListener(() {
  57 + if (_focusNode.hasFocus) {
  58 + //有焦点
  59 + if (showDateSelWidget) {
  60 + Navigator.pop(context);
  61 + showDateSelWidget = false;
  62 + }
  63 + } else {
  64 + //失去焦点
  65 + // _editingController.text = '';
  66 + }
  67 + });
  68 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  69 + for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
  70 + gid += '${item.id},';
  71 + if (Platform.isIOS) {
  72 + iosPhone.add(item.phone);
  73 + } else {
  74 + andriodPhone += "${item.phone};";
  75 + }
  76 + }
  77 + if (gid.endsWith(',')) {
  78 + gid = gid.substring(0, gid.length - 1);
  79 + }
  80 + if (!Platform.isIOS && andriodPhone.endsWith(';')) {
  81 + andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
  82 + }
  83 + _couponNetworkData(isShowLoading: false);
  84 + if (widget.fromPage == FromPage.FromPageMakeRecordDetail) {
  85 + _getGuestByGid();
  86 + }
  87 + });
  88 + }
  89 +
  90 + @override
  91 + void dispose() {
  92 + super.dispose();
  93 + if (needClear) {
  94 + customerMakingProvider.clearData();
  95 + }
  96 + //
  97 + }
  98 +
  99 + ///客户经理营销中的用户列表
  100 + _getGuestByGid({bool isShowLoading = true}) async {
  101 + // customerMakingProvider.couponSelectIndex = 0;
  102 + Map<String, String> params = {
  103 + "gid": widget.selfList.gid,
  104 + };
  105 + await customerProvider.getGuestByGid(
  106 + context,
  107 + params,
  108 + );
  109 + print('''object''');
  110 + gid = widget.selfList.gid;
  111 + customerMakingProvider.labels = customerProvider.labels;
  112 + customerMakingProvider.selectCustomer = customerProvider.selectCustomer;
  113 + // customerMakingProvider.fromPage = widget.fromPage;
  114 +
  115 + customerMakingProvider.controller.text = widget.selfList.content;
  116 + if (widget.selfList.aid != null) {
  117 + //之前绑定过优惠
  118 + customerMakingProvider.isUse = true;
  119 + for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  120 + if (widget.selfList.aid == customerProvider.couponListSelect[i].id) {
  121 + customerMakingProvider.youhui =
  122 + customerProvider.couponListSelect[i].aname;
  123 + customerMakingProvider.couponSelectIndex = i;
  124 + }
  125 + }
  126 + }
  127 + customerMakingProvider.isUpdate = true;
  128 + setState(() {});
  129 + }
  130 +
  131 + ///消费券
  132 + _couponNetworkData({bool isShowLoading = true}) async {
  133 + // customerMakingProvider.couponSelectIndex = 0;
  134 + Map<String, String> params = {
  135 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  136 + 'status': '1'
  137 + };
  138 + await customerProvider.getCustomerSelectActivityNew(context, params,
  139 + isShowLoading: isShowLoading);
  140 + //此人已经新建好券
  141 + if (customerProvider.couponListSelect.length > 0) {
  142 + // couponProvider.initCouponSelect(context);
  143 + couponList = [];
  144 + for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  145 + couponList.add(customerProvider.couponListSelect[i].aname);
  146 + }
  147 + customerProvider.notifyListeners();
  148 + } else {
  149 + //没有新建的优惠券
  150 + }
  151 + }
  152 +
  153 + _createMarketing() async {
  154 + if (customerMakingProvider.controller.text.trim().length == 0) {
  155 + Utils.showToast('请输入营销内容');
  156 + return;
  157 + }
  158 + Map<String, String> params = {
  159 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  160 + "gid": gid,
  161 + "content": customerMakingProvider.controller.text
  162 + };
  163 + if (customerMakingProvider.youhui != '选择优惠' &&
  164 + customerMakingProvider.isUse) {
  165 + params['aid'] =
  166 + '${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}';
  167 + }
  168 + await customerProvider.createMarketing(context, params, showLoading: true);
  169 + _goSms();
  170 + }
  171 +
  172 + /// 商家创建营销
  173 + _createMarketingBySeller() async {
  174 + if (customerMakingProvider.controller.text.trim().length == 0) {
  175 + Utils.showToast('请输入营销内容');
  176 + return;
  177 + }
  178 + Map<String, String> params = {
  179 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  180 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  181 + "gid": gid,
  182 + "content": customerMakingProvider.controller.text,
  183 + 'is_update': customerMakingProvider.isUpdate ? '0' : '1',
  184 + 'create_user':
  185 + Provider.of<UserModel>(context, listen: false).user.role_name
  186 + };
  187 +
  188 + if (customerMakingProvider.youhui != '选择优惠' &&
  189 + customerMakingProvider.isUse) {
  190 + params['aid'] =
  191 + '${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}';
  192 + }
  193 + if (customerMakingProvider.isDate) {
  194 + if (customerMakingProvider.edate == '' ||
  195 + customerMakingProvider.edate == null) {
  196 + Utils.showToast('请选择最晚完成期限');
  197 + return;
  198 + }
  199 + params['edate'] = customerMakingProvider.edate;
  200 + }
  201 +
  202 + await customerProvider.createMarketingBySeller(context, params,
  203 + showLoading: true);
  204 + _goSms();
  205 + }
  206 +
  207 + _goSms() async {
  208 + // DialogUtil.cupertinoAlertDialog(context,
  209 + // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
  210 + // print('取消发送');
  211 + // }, rCallback: () async {
  212 + if (Platform.isIOS) {
  213 + // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
  214 + String message = "test";
  215 + try {
  216 + String _result = await sendSMS(message: message, recipients: iosPhone);
  217 + print(_result);
  218 + } catch (error) {
  219 + print(error.toString());
  220 + }
  221 + } else {
  222 + print('确定发送');
  223 + // String phoneNumber = "18161963378;18729572142";
  224 + String message = "test";
  225 +
  226 + // await Sendsms.onGetPermission();
  227 +
  228 + // if (await Sendsms.hasPermission()) {
  229 + await Sendsms.onSendSMS(andriodPhone, message);
  230 + }
  231 +
  232 + // }
  233 + // SmsModel smsModel = new SmsModel();
  234 + // // String sms = await smsModel.getSmsContent(context, params);
  235 + // String phoneNumber = "";
  236 + // await Sendsms.onSendSMS(phoneNumber, '短信内容');
  237 + // });
  238 + }
  239 +
  240 + _buttonChoose(String title, ClickCallback callback) {
  241 + return InkWell(
  242 + onTap: () {
  243 + callback(title);
  244 + },
  245 + child: Padding(
  246 + padding: EdgeInsets.symmetric(
  247 + horizontal: ScreenUtil().setWidth(20),
  248 + vertical: ScreenUtil().setWidth(10)),
  249 + // height: ScreenUtil().setWidth(50),
  250 + // decoration: BoxDecoration(
  251 + // // border: Border.all(
  252 + // // width: ScreenUtil().setWidth(2),
  253 + // // color: MyColours.color_199095),
  254 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  255 + child: Row(
  256 + children: [
  257 + Expanded(
  258 + child: Text(
  259 + title,
  260 + overflow: TextOverflow.ellipsis,
  261 + style: TextStyle(
  262 + color: title == '时间(选填)' ||
  263 + title == '(选填)' ||
  264 + title == '选择优惠' ||
  265 + !customerMakingProvider.isUse
  266 + ? MyColours.color_999999
  267 + : MyColours.color_199095,
  268 + fontSize: ScreenUtil().setWidth(30)),
  269 + )),
  270 + HEmptyView(10),
  271 + Image.asset(
  272 + // Utils.getImgPath(!customerMakingProvider.isUse
  273 + // ? 'c_arrow_down_unsel'
  274 + // : 'c_arrow_down'),
  275 + Utils.getImgPath('c_arrow_down'),
  276 + width: ScreenUtil().setWidth(30),
  277 + // height: ScreenUtil().setWidth(10),
  278 + )
  279 + ],
  280 + )));
  281 + }
  282 +
  283 + ///短信内容编辑UI
  284 + Widget _contentWidget(String hintText) {
  285 + return Container(
  286 + // height: ScreenUtil().setWidth(380),
  287 + child: Column(
  288 + crossAxisAlignment: CrossAxisAlignment.start,
  289 + children: [
  290 + // Align(
  291 + // alignment: Alignment.centerLeft,
  292 + // child: Text(
  293 + // title,
  294 + // textAlign: TextAlign.left,
  295 + // style: TextStyle(
  296 + // color: MyColours.color_333333,
  297 + // fontWeight: FontWeight.bold,
  298 + // fontSize: ScreenUtil().setSp(34)),
  299 + // )),
  300 + // VEmptyView(30),
  301 + TextField(
  302 + controller: customerMakingProvider.controller,
  303 + // keyboardType: TextInputType.number, //键盘类型,数字键盘
  304 + maxLines: 10,
  305 + focusNode: _focusNode,
  306 + // maxLength: 50,
  307 +
  308 + // maxLengthEnforced: true,
  309 + style: TextStyle(
  310 + fontSize: ScreenUtil().setSp(28),
  311 + color: MyColours.color_333333), //输入文本的样式
  312 + decoration: InputDecoration(
  313 + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
  314 + hintText: hintText,
  315 + hintStyle: TextStyle(
  316 + color: MyColours.color_999999,
  317 + fontSize: ScreenUtil().setSp(28),
  318 + ),
  319 + fillColor: MyColours.color_F9F9F9,
  320 + // fillColor: Colors.red,
  321 + filled: true,
  322 + enabledBorder: OutlineInputBorder(
  323 + //未选中时候的颜色
  324 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  325 + borderSide: BorderSide(
  326 + color: MyColours.color_cccccc,
  327 + width: ScreenUtil().setWidth(2)),
  328 + ),
  329 + focusedBorder: OutlineInputBorder(
  330 + //选中时外边框颜色
  331 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  332 + borderSide: BorderSide(
  333 + color: MyColours.app_main,
  334 + ),
  335 + ),
  336 + // border: OutlineInputBorder(
  337 + // borderRadius:
  338 + // BorderRadius.circular(ScreenUtil().setWidth(20)),
  339 + // borderSide: BorderSide(
  340 + // color: Colors.red, width: ScreenUtil().setWidth(2))),
  341 + ),
  342 + onChanged: (value) {
  343 + setState(() {});
  344 + },
  345 + ),
  346 + VEmptyView(20),
  347 + Row(
  348 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  349 + children: [
  350 + InkWell(
  351 + onTap: () {
  352 + customerMakingProvider.controller.text = '';
  353 + setState(() {});
  354 + // NavigatorUtil.goMarketingRecordsDetailPage(context);
  355 + },
  356 + child: Padding(
  357 + padding: EdgeInsets.symmetric(
  358 + horizontal: ScreenUtil().setWidth(20)),
  359 + child: Text('清空',
  360 + style: TextStyle(
  361 + color: MyColours.color_199095,
  362 + fontSize: ScreenUtil().setSp(26))),
  363 + )),
  364 + Text(
  365 + '共 ${customerMakingProvider.controller.text.length} 字 ${customerMakingProvider.selectCustomer.length} 条短信',
  366 + style: TextStyle(
  367 + color: MyColours.color_333333,
  368 + fontSize: ScreenUtil().setSp(26))),
  369 + ],
  370 + ),
  371 + VEmptyView(40),
  372 + InkWell(
  373 + onTap: () {
  374 + customerMakingProvider.isUse = !customerMakingProvider.isUse;
  375 + setState(() {});
  376 + },
  377 + child: Row(children: [
  378 + Image.asset(
  379 + Utils.getImgPath(customerMakingProvider.isUse
  380 + ? 'c_mul_select'
  381 + : 'c_mul_select_un'),
  382 + width: ScreenUtil().setWidth(30)),
  383 + HEmptyView(15),
  384 + Text(
  385 + '营销加入优惠',
  386 + style: TextStyle(
  387 + fontSize: ScreenUtil().setSp(36),
  388 + fontWeight: FontWeight.bold,
  389 + color: MyColours.color_333333),
  390 + ),
  391 + ])),
  392 + VEmptyView(30),
  393 + Row(children: [
  394 + Expanded(
  395 + child: Container(
  396 + height: ScreenUtil().setWidth(70),
  397 + // width: ScreenUtil().setWidth(130),
  398 + decoration: BoxDecoration(
  399 + borderRadius:
  400 + BorderRadius.circular(ScreenUtil().setWidth(10)),
  401 + color: Color.fromRGBO(239, 239, 239, 1)),
  402 + child:
  403 + _buttonChoose(customerMakingProvider.youhui, (value) {
  404 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  405 + if (couponList == null || couponList.length == 0) {
  406 + Utils.showToast('暂无优惠券,请创建新优惠');
  407 + return;
  408 + }
  409 + DialogUtil.showSelectCusmanDialog(context, couponList,
  410 + (value) {
  411 + if (value != null) {
  412 + setState(() {
  413 + customerMakingProvider.couponSelectIndex =
  414 + value.first;
  415 + customerMakingProvider.youhui = couponList[
  416 + customerMakingProvider.couponSelectIndex];
  417 + });
  418 + }
  419 + },
  420 + selecteds: customerMakingProvider
  421 + .couponSelectIndex ==
  422 + null
  423 + ? []
  424 + : [customerMakingProvider.couponSelectIndex])
  425 + .then((value) {});
  426 + }))),
  427 + HEmptyView(30),
  428 + InkWell(
  429 + onTap: () async {
  430 + // NavigatorUtil.goMarketingRecordsDetailPage(context);
  431 + bool needRefresh =
  432 + await NavigatorUtil.goCouponEditPage(context);
  433 + print(needRefresh);
  434 + if (needRefresh != null && needRefresh) {
  435 + //刷新页面数据
  436 + // _controller.callRefresh();
  437 + _couponNetworkData();
  438 + }
  439 + },
  440 + child: Text('创建新优惠',
  441 + style: TextStyle(
  442 + decoration: TextDecoration.underline,
  443 + color: MyColours.color_199095,
  444 + fontSize: ScreenUtil().setSp(26)))),
  445 + ]),
  446 + ],
  447 + ),
  448 + );
  449 + }
  450 +
  451 + @override
  452 + Widget build(BuildContext context) {
  453 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  454 + customerMakingProvider =
  455 + Provider.of<CustomerMakingProvider>(context, listen: true);
  456 + return Scaffold(
  457 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  458 + key: scaffoldKey,
  459 + appBar: SystemAppBar(
  460 + '创建营销任务',
  461 + onTap: () {
  462 + customerMakingProvider.clearData();
  463 + Navigator.pop(context);
  464 + },
  465 + ),
  466 + body: Column(
  467 + children: [
  468 + Expanded(
  469 + child: SingleChildScrollView(
  470 + child: Column(
  471 + children: [
  472 + VEmptyView(10),
  473 + Container(
  474 + color: MyColours.color_199095,
  475 + padding: EdgeInsets.symmetric(
  476 + horizontal: ScreenUtil().setWidth(30),
  477 + vertical: ScreenUtil().setWidth(30)),
  478 + child: Row(
  479 + children: [
  480 + Expanded(
  481 + child: Text(
  482 + '已选[${customerMakingProvider.labels}]${customerMakingProvider.selectCustomer.length}位顾客',
  483 + style: TextStyle(
  484 + color: MyColours.color_ffffff,
  485 + fontSize: ScreenUtil().setSp(32)),
  486 + )),
  487 + HEmptyView(10),
  488 + InkWell(
  489 + onTap: () {
  490 + needClear = false;
  491 + if (widget.fromPage ==
  492 + FromPage.FromPageMakeRecordDetail) {
  493 + NavigatorUtil.goMyCustomerListPage(
  494 + context, FromPage.FromPageMakeRecord);
  495 + } else {
  496 + Navigator.pop(context);
  497 + }
  498 + // NavigatorUtil.goMarketingRecordsDetailPage(context);
  499 + },
  500 + child: Text('查看',
  501 + style: TextStyle(
  502 + decoration: TextDecoration.underline,
  503 + color: MyColours.color_ffffff,
  504 + fontSize: ScreenUtil().setSp(26)))),
  505 + ],
  506 + ),
  507 + ),
  508 + Padding(
  509 + padding: EdgeInsets.symmetric(
  510 + horizontal: ScreenUtil().setWidth(30),
  511 + ),
  512 + child: Column(
  513 + children: [VEmptyView(50), _contentWidget('输入营销短信内容')],
  514 + ),
  515 + )
  516 + ],
  517 + ),
  518 + )),
  519 + RoundButton(
  520 + text: '群发短信',
  521 + gradientStart: MyColours.color_199095,
  522 + gradientEnd: MyColours.color_199095,
  523 + // borderColor: MyColours.color_999999,
  524 + radius: ScreenUtil().setWidth(40),
  525 + height: ScreenUtil().setWidth(80),
  526 + fontSize: 26,
  527 + margin:
  528 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
  529 + isBold: false,
  530 + onPressed: () {
  531 + //群发短信
  532 + _createMarketing();
  533 + },
  534 + ),
  535 + VEmptyView(30),
  536 + RoundButton(
  537 + text: '取消',
  538 + gradientStart: MyColours.color_ffffff,
  539 + gradientEnd: MyColours.color_ffffff,
  540 + textColor: MyColours.color_199095,
  541 + borderColor: MyColours.color_199095,
  542 + radius: ScreenUtil().setWidth(40),
  543 + height: ScreenUtil().setWidth(80),
  544 + fontSize: 26,
  545 + margin:
  546 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
  547 + isBold: false,
  548 + onPressed: () {
  549 + customerMakingProvider.clearData();
  550 + Navigator.pop(context);
  551 + },
  552 + ),
  553 + VEmptyView(40),
  554 + ],
  555 + ),
  556 + );
  557 + }
  558 +}
  1 +import 'dart:io';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
  4 +import 'package:flutter/material.dart';
  5 +import 'package:flutter_screenutil/screenutil.dart';
  6 +import 'package:flutter_sms/flutter_sms.dart';
  7 +import 'package:one_key/constant/state.dart';
  8 +import 'package:one_key/models/customer_list_model.dart';
  9 +import 'package:one_key/models/marketing_by_uid_model.dart';
  10 +import 'package:one_key/pages/coupon/coupon_page.dart';
  11 +import 'package:one_key/provider/customer_making_provider.dart';
  12 +import 'package:one_key/provider/customer_provider.dart';
  13 +import 'package:one_key/provider/user_model.dart';
  14 +import 'package:one_key/res/colors.dart';
  15 +import 'package:one_key/route/navigator_util.dart';
  16 +import 'package:one_key/utils/dialog_util.dart';
  17 +import 'package:one_key/utils/utils.dart';
  18 +import 'package:one_key/widgets/h_empty_view.dart';
  19 +import 'package:one_key/widgets/round_button.dart';
  20 +import 'package:one_key/widgets/system_app_bar.dart';
  21 +import 'package:one_key/widgets/v_empty_view.dart';
  22 +import 'package:provider/provider.dart';
  23 +import 'package:sendsms/sendsms.dart';
  24 +
  25 +typedef ClickCallback = void Function(dynamic value);
  26 +
  27 +class MyMakeMarkingPageOnlyShow extends StatefulWidget {
  28 + final SellerList sellerList;
  29 + MyMakeMarkingPageOnlyShow({Key key, this.sellerList}) : super(key: key);
  30 +
  31 + @override
  32 + _MyMakeMarkingPageOnlyShowState createState() =>
  33 + _MyMakeMarkingPageOnlyShowState();
  34 +}
  35 +
  36 +class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
  37 + List<String> couponList = [];
  38 +
  39 + final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
  40 + FocusNode _focusNode = FocusNode();
  41 + bool showDateSelWidget = false;
  42 +
  43 + CustomerProvider customerProvider;
  44 + CustomerMakingProvider customerMakingProvider;
  45 + bool needClear = true;
  46 + String gid = '';
  47 + String andriodPhone = '';
  48 + List<String> iosPhone = [];
  49 +
  50 + @override
  51 + void initState() {
  52 + super.initState();
  53 +
  54 + _focusNode.addListener(() {
  55 + if (_focusNode.hasFocus) {
  56 + //有焦点
  57 + if (showDateSelWidget) {
  58 + Navigator.pop(context);
  59 + showDateSelWidget = false;
  60 + }
  61 + } else {
  62 + //失去焦点
  63 + // _editingController.text = '';
  64 + }
  65 + });
  66 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  67 + for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
  68 + gid += '${item.id},';
  69 + if (Platform.isIOS) {
  70 + iosPhone.add(item.phone);
  71 + } else {
  72 + andriodPhone += "${item.phone};";
  73 + }
  74 + }
  75 + if (gid.endsWith(',')) {
  76 + gid = gid.substring(0, gid.length - 1);
  77 + }
  78 + if (!Platform.isIOS && andriodPhone.endsWith(';')) {
  79 + andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
  80 + }
  81 + customerMakingProvider.controller.text = widget.sellerList.content;
  82 + _couponNetworkData(isShowLoading: false);
  83 + });
  84 + }
  85 +
  86 + @override
  87 + void dispose() {
  88 + super.dispose();
  89 + if (needClear) {
  90 + customerMakingProvider.clearData();
  91 + }
  92 + //
  93 + }
  94 +
  95 + ///消费券
  96 + _couponNetworkData({bool isShowLoading = true}) async {
  97 + // customerMakingProvider.couponSelectIndex = 0;
  98 + Map<String, String> params = {
  99 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  100 + 'status': '1'
  101 + };
  102 + await customerProvider.getCustomerSelectActivityNew(context, params,
  103 + isShowLoading: isShowLoading);
  104 + //此人已经新建好券
  105 + if (customerProvider.couponListSelect.length > 0) {
  106 + // couponProvider.initCouponSelect(context);
  107 + couponList = [];
  108 + for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  109 + couponList.add(customerProvider.couponListSelect[i].aname);
  110 +
  111 + if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
  112 + customerMakingProvider.youhui =
  113 + customerProvider.couponListSelect[i].aname;
  114 + }
  115 + }
  116 + customerProvider.notifyListeners();
  117 + } else {
  118 + //没有新建的优惠券
  119 + }
  120 + }
  121 +
  122 + _createMarketing() async {
  123 + Map<String, String> params = {
  124 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  125 + "gid": gid,
  126 + "content": customerMakingProvider.controller.text
  127 + };
  128 + if (widget.sellerList.aid != null) {
  129 + params['aid'] = widget.sellerList.aid;
  130 + }
  131 + await customerProvider.createMarketing(context, params, showLoading: true);
  132 + _goSms();
  133 + }
  134 +
  135 + /// 商家创建营销
  136 + _createMarketingBySeller() async {
  137 + if (customerMakingProvider.controller.text.trim().length == 0) {
  138 + Utils.showToast('请输入营销内容');
  139 + return;
  140 + }
  141 + Map<String, String> params = {
  142 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  143 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  144 + "gid": gid,
  145 + "content": customerMakingProvider.controller.text,
  146 + 'is_update': customerMakingProvider.isUpdate ? '0' : '1',
  147 + 'create_user':
  148 + Provider.of<UserModel>(context, listen: false).user.role_name
  149 + };
  150 +
  151 + if (customerMakingProvider.youhui != '选择优惠' &&
  152 + customerMakingProvider.isUse) {
  153 + params['aid'] =
  154 + '${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}';
  155 + }
  156 + if (customerMakingProvider.isDate) {
  157 + if (customerMakingProvider.edate == '' ||
  158 + customerMakingProvider.edate == null) {
  159 + Utils.showToast('请选择最晚完成期限');
  160 + return;
  161 + }
  162 + params['edate'] = customerMakingProvider.edate;
  163 + }
  164 +
  165 + await customerProvider.createMarketingBySeller(context, params,
  166 + showLoading: true);
  167 + _goSms();
  168 + }
  169 +
  170 + _goSms() async {
  171 + // DialogUtil.cupertinoAlertDialog(context,
  172 + // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
  173 + // print('取消发送');
  174 + // }, rCallback: () async {
  175 + if (Platform.isIOS) {
  176 + // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
  177 + String message = "test";
  178 + try {
  179 + String _result = await sendSMS(message: message, recipients: iosPhone);
  180 + print(_result);
  181 + } catch (error) {
  182 + print(error.toString());
  183 + }
  184 + } else {
  185 + print('确定发送');
  186 + // String phoneNumber = "18161963378;18729572142";
  187 + String message = "test";
  188 +
  189 + // await Sendsms.onGetPermission();
  190 +
  191 + // if (await Sendsms.hasPermission()) {
  192 + await Sendsms.onSendSMS(andriodPhone, message);
  193 + }
  194 +
  195 + // }
  196 + // SmsModel smsModel = new SmsModel();
  197 + // // String sms = await smsModel.getSmsContent(context, params);
  198 + // String phoneNumber = "";
  199 + // await Sendsms.onSendSMS(phoneNumber, '短信内容');
  200 + // });
  201 + }
  202 +
  203 + _buttonChoose(String title, ClickCallback callback) {
  204 + return InkWell(
  205 + onTap: () {
  206 + callback(title);
  207 + },
  208 + child: Padding(
  209 + padding: EdgeInsets.symmetric(
  210 + horizontal: ScreenUtil().setWidth(20),
  211 + vertical: ScreenUtil().setWidth(10)),
  212 + // height: ScreenUtil().setWidth(50),
  213 + // decoration: BoxDecoration(
  214 + // // border: Border.all(
  215 + // // width: ScreenUtil().setWidth(2),
  216 + // // color: MyColours.color_199095),
  217 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  218 + child: Row(
  219 + children: [
  220 + Expanded(
  221 + child: Text(
  222 + title,
  223 + overflow: TextOverflow.ellipsis,
  224 + style: TextStyle(
  225 + color: MyColours.color_999999,
  226 + fontSize: ScreenUtil().setWidth(30)),
  227 + )),
  228 + // HEmptyView(10),
  229 + // Image.asset(
  230 + // // Utils.getImgPath(!customerMakingProvider.isUse
  231 + // // ? 'c_arrow_down_unsel'
  232 + // // : 'c_arrow_down'),
  233 + // Utils.getImgPath('c_arrow_down'),
  234 + // width: ScreenUtil().setWidth(30),
  235 + // // height: ScreenUtil().setWidth(10),
  236 + // )
  237 + ],
  238 + )));
  239 + }
  240 +
  241 + ///短信内容编辑UI
  242 + Widget _contentWidget(String hintText) {
  243 + return Container(
  244 + // height: ScreenUtil().setWidth(380),
  245 + child: Column(
  246 + crossAxisAlignment: CrossAxisAlignment.start,
  247 + children: [
  248 + // Align(
  249 + // alignment: Alignment.centerLeft,
  250 + // child: Text(
  251 + // title,
  252 + // textAlign: TextAlign.left,
  253 + // style: TextStyle(
  254 + // color: MyColours.color_333333,
  255 + // fontWeight: FontWeight.bold,
  256 + // fontSize: ScreenUtil().setSp(34)),
  257 + // )),
  258 + // VEmptyView(30),
  259 + TextField(
  260 + // enabled: false,
  261 + enableInteractiveSelection: false,
  262 + onTap: () {
  263 + FocusScope.of(context).requestFocus(new FocusNode());
  264 + },
  265 + // enableInteractiveSelection: false,
  266 + controller: customerMakingProvider.controller,
  267 + // keyboardType: TextInputType.number, //键盘类型,数字键盘
  268 + maxLines: 10,
  269 + focusNode: _focusNode,
  270 + // maxLength: 50,
  271 +
  272 + // maxLengthEnforced: true,
  273 + style: TextStyle(
  274 + fontSize: ScreenUtil().setSp(28),
  275 + color: MyColours.color_333333), //输入文本的样式
  276 + decoration: InputDecoration(
  277 + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
  278 + hintText: hintText,
  279 + hintStyle: TextStyle(
  280 + color: MyColours.color_999999,
  281 + fontSize: ScreenUtil().setSp(28),
  282 + ),
  283 + fillColor: MyColours.color_F9F9F9,
  284 + // fillColor: Colors.red,
  285 + filled: true,
  286 + enabledBorder: OutlineInputBorder(
  287 + //未选中时候的颜色
  288 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  289 + borderSide: BorderSide(
  290 + color: MyColours.color_cccccc,
  291 + width: ScreenUtil().setWidth(2)),
  292 + ),
  293 + focusedBorder: OutlineInputBorder(
  294 + //选中时外边框颜色
  295 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  296 + borderSide: BorderSide(
  297 + color: MyColours.app_main,
  298 + ),
  299 + ),
  300 + // border: OutlineInputBorder(
  301 + // borderRadius:
  302 + // BorderRadius.circular(ScreenUtil().setWidth(20)),
  303 + // borderSide: BorderSide(
  304 + // color: Colors.red, width: ScreenUtil().setWidth(2))),
  305 + ),
  306 + onChanged: (value) {
  307 + setState(() {});
  308 + },
  309 + ),
  310 + VEmptyView(20),
  311 + Row(
  312 + mainAxisAlignment: MainAxisAlignment.end,
  313 + children: [
  314 + // InkWell(
  315 + // onTap: () {
  316 + // customerMakingProvider.controller.text = '';
  317 + // setState(() {});
  318 + // // NavigatorUtil.goMarketingRecordsDetailPage(context);
  319 + // },
  320 + // child: Padding(
  321 + // padding: EdgeInsets.symmetric(
  322 + // horizontal: ScreenUtil().setWidth(20)),
  323 + // child: Text('清空',
  324 + // style: TextStyle(
  325 + // color: MyColours.color_199095,
  326 + // fontSize: ScreenUtil().setSp(26))),
  327 + // )),
  328 + Text(
  329 + '共 ${customerMakingProvider.controller.text.length} 字 ${widget.sellerList.guestCount} 条短信',
  330 + style: TextStyle(
  331 + color: MyColours.color_333333,
  332 + fontSize: ScreenUtil().setSp(26))),
  333 + ],
  334 + ),
  335 + widget.sellerList.aid != null
  336 + ? Column(children: [
  337 + VEmptyView(40),
  338 + InkWell(
  339 + onTap: () {
  340 + customerMakingProvider.isUse =
  341 + !customerMakingProvider.isUse;
  342 + setState(() {});
  343 + },
  344 + child: Row(children: [
  345 + Image.asset(Utils.getImgPath('c_not_edit'),
  346 + width: ScreenUtil().setWidth(30)),
  347 + HEmptyView(15),
  348 + Text(
  349 + '营销加入优惠',
  350 + style: TextStyle(
  351 + fontSize: ScreenUtil().setSp(36),
  352 + fontWeight: FontWeight.bold,
  353 + color: MyColours.color_333333),
  354 + ),
  355 + ])),
  356 + VEmptyView(30),
  357 + Row(children: [
  358 + Expanded(
  359 + child: Container(
  360 + height: ScreenUtil().setWidth(70),
  361 + // width: ScreenUtil().setWidth(130),
  362 + decoration: BoxDecoration(
  363 + borderRadius: BorderRadius.circular(
  364 + ScreenUtil().setWidth(10)),
  365 + color: Color.fromRGBO(239, 239, 239, 1)),
  366 + child: _buttonChoose(customerMakingProvider.youhui,
  367 + (value) {
  368 + // FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  369 + // if (couponList == null || couponList.length == 0) {
  370 + // Utils.showToast('暂无优惠券,请创建新优惠');
  371 + // return;
  372 + // }
  373 + // DialogUtil.showSelectCusmanDialog(context, couponList,
  374 + // (value) {
  375 + // if (value != null) {
  376 + // setState(() {
  377 + // customerMakingProvider.couponSelectIndex =
  378 + // value.first;
  379 + // customerMakingProvider.youhui = couponList[
  380 + // customerMakingProvider.couponSelectIndex];
  381 + // });
  382 + // }
  383 + // },
  384 + // selecteds: customerMakingProvider
  385 + // .couponSelectIndex ==
  386 + // null
  387 + // ? []
  388 + // : [customerMakingProvider.couponSelectIndex])
  389 + // .then((value) {});
  390 + }))),
  391 + // HEmptyView(30),
  392 + // InkWell(
  393 + // onTap: () async {
  394 + // // NavigatorUtil.goMarketingRecordsDetailPage(context);
  395 + // bool needRefresh =
  396 + // await NavigatorUtil.goCouponEditPage(context);
  397 + // print(needRefresh);
  398 + // if (needRefresh != null && needRefresh) {
  399 + // //刷新页面数据
  400 + // // _controller.callRefresh();
  401 + // _couponNetworkData();
  402 + // }
  403 + // },
  404 + // child: Text('创建新优惠',
  405 + // style: TextStyle(
  406 + // decoration: TextDecoration.underline,
  407 + // color: MyColours.color_199095,
  408 + // fontSize: ScreenUtil().setSp(26)))),
  409 + ])
  410 + ])
  411 + : SizedBox()
  412 + ],
  413 + ),
  414 + );
  415 + }
  416 +
  417 + @override
  418 + Widget build(BuildContext context) {
  419 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  420 + customerMakingProvider =
  421 + Provider.of<CustomerMakingProvider>(context, listen: true);
  422 + return Scaffold(
  423 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  424 + key: scaffoldKey,
  425 + appBar: SystemAppBar(
  426 + '创建营销任务',
  427 + onTap: () {
  428 + customerMakingProvider.clearData();
  429 + Navigator.pop(context);
  430 + },
  431 + ),
  432 + body: Column(
  433 + children: [
  434 + Expanded(
  435 + child: SingleChildScrollView(
  436 + child: Column(
  437 + children: [
  438 + VEmptyView(10),
  439 + Container(
  440 + color: MyColours.color_199095,
  441 + padding: EdgeInsets.symmetric(
  442 + horizontal: ScreenUtil().setWidth(30),
  443 + vertical: ScreenUtil().setWidth(30)),
  444 + child: Row(
  445 + children: [
  446 + Expanded(
  447 + child: Text(
  448 + '已选[全店任务]${widget.sellerList.guestCount}位顾客',
  449 + style: TextStyle(
  450 + color: MyColours.color_ffffff,
  451 + fontSize: ScreenUtil().setSp(32)),
  452 + )),
  453 + HEmptyView(10),
  454 + InkWell(
  455 + onTap: () {
  456 + needClear = false;
  457 + Navigator.pop(context);
  458 + // NavigatorUtil.goMarketingRecordsDetailPage(context);
  459 + },
  460 + child: Text('仅查看',
  461 + style: TextStyle(
  462 + decoration: TextDecoration.underline,
  463 + color: MyColours.color_ffffff,
  464 + fontSize: ScreenUtil().setSp(26)))),
  465 + ],
  466 + ),
  467 + ),
  468 + Padding(
  469 + padding: EdgeInsets.symmetric(
  470 + horizontal: ScreenUtil().setWidth(30),
  471 + ),
  472 + child: Column(
  473 + children: [VEmptyView(50), _contentWidget('输入营销短信内容')],
  474 + ),
  475 + )
  476 + ],
  477 + ),
  478 + )),
  479 + RoundButton(
  480 + text: '群发短信',
  481 + gradientStart: MyColours.color_199095,
  482 + gradientEnd: MyColours.color_199095,
  483 + // borderColor: MyColours.color_999999,
  484 + radius: ScreenUtil().setWidth(40),
  485 + height: ScreenUtil().setWidth(80),
  486 + fontSize: 26,
  487 + margin:
  488 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
  489 + isBold: false,
  490 + onPressed: () {
  491 + //群发短信
  492 + _createMarketing();
  493 + },
  494 + ),
  495 + VEmptyView(30),
  496 + RoundButton(
  497 + text: '取消',
  498 + gradientStart: MyColours.color_ffffff,
  499 + gradientEnd: MyColours.color_ffffff,
  500 + textColor: MyColours.color_199095,
  501 + borderColor: MyColours.color_199095,
  502 + radius: ScreenUtil().setWidth(40),
  503 + height: ScreenUtil().setWidth(80),
  504 + fontSize: 26,
  505 + margin:
  506 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
  507 + isBold: false,
  508 + onPressed: () {
  509 + customerMakingProvider.clearData();
  510 + Navigator.pop(context);
  511 + },
  512 + ),
  513 + VEmptyView(40),
  514 + ],
  515 + ),
  516 + );
  517 + }
  518 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_id_model.dart';
  5 +import 'package:one_key/models/marketing_by_uid_model.dart';
  6 +import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/utils.dart';
  12 +import 'package:one_key/widgets/h_empty_view.dart';
  13 +import 'package:one_key/widgets/page_exception.dart';
  14 +import 'package:one_key/widgets/round_button.dart';
  15 +import 'package:one_key/widgets/row_multi_text.dart';
  16 +import 'package:one_key/widgets/system_app_bar.dart';
  17 +import 'package:one_key/widgets/v_empty_view.dart';
  18 +import 'package:provider/provider.dart';
  19 +
  20 +class MyMarketingRecordsDetailPage extends StatefulWidget {
  21 + final String idstr;
  22 + final SelfList selfList;
  23 + MyMarketingRecordsDetailPage({Key key, this.idstr, this.selfList})
  24 + : super(key: key);
  25 +
  26 + @override
  27 + _MyMarketingRecordsDetailPageState createState() =>
  28 + _MyMarketingRecordsDetailPageState();
  29 +}
  30 +
  31 +class _MyMarketingRecordsDetailPageState
  32 + extends State<MyMarketingRecordsDetailPage> {
  33 + CustomerProvider customerProvider;
  34 + String aidStr = '';
  35 + @override
  36 + void initState() {
  37 + super.initState();
  38 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  39 + // if (widget.fromPage == FromPage.FromPageStoreCustomer) {
  40 + // _getMarketingBySeller();
  41 + // }
  42 + // _getMarketingById();
  43 + _couponNetworkData();
  44 + });
  45 + }
  46 +
  47 + @override
  48 + void dispose() {
  49 + super.dispose();
  50 + }
  51 +
  52 + // _getMarketingById() async {
  53 + // Map<String, String> params = {"id": widget.idstr};
  54 + // await customerProvider.getMarketingById(context, params);
  55 + // if (customerProvider.pageStateMarketingRecordDetail == PageState.Success) {
  56 + // _couponNetworkData();
  57 + // }
  58 + // // await customerProvider.searchData(customerProvider.controller.text);
  59 + // }
  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.selfList.aid == customerProvider.couponListSelect[i].id) {
  73 + aidStr = customerProvider.couponListSelect[i].aname;
  74 + }
  75 + }
  76 + customerProvider.notifyListeners();
  77 + } else {
  78 + //没有新建的优惠券
  79 + }
  80 + }
  81 +
  82 + @override
  83 + Widget build(BuildContext context) {
  84 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  85 + return Scaffold(
  86 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  87 + appBar: SystemAppBar(
  88 + '营销详情',
  89 + onTap: () {
  90 + Navigator.pop(context);
  91 + },
  92 + ),
  93 + body: Padding(
  94 + padding: EdgeInsets.symmetric(
  95 + horizontal: ScreenUtil().setWidth(30),
  96 + // vertical: ScreenUtil().setWidth(40)
  97 + ),
  98 + child: Column(
  99 + children: [
  100 + Expanded(
  101 + child: SingleChildScrollView(
  102 + child: Column(
  103 + crossAxisAlignment: CrossAxisAlignment.start,
  104 + children: [
  105 + Stack(
  106 + alignment: Alignment.bottomCenter,
  107 + children: [
  108 + Column(
  109 + children: [
  110 + RowMultiText(
  111 + '创建日期',
  112 + widget.selfList.cdateStr,
  113 + textColor: MyColours.color_333333,
  114 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  115 + ),
  116 + RowMultiText(
  117 + '创建人',
  118 + Provider.of<UserModel>(context, listen: false)
  119 + .user
  120 + .nickName,
  121 + textColor: MyColours.color_333333,
  122 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  123 + ),
  124 + ],
  125 + ),
  126 + // Positioned(
  127 + // child: Image.asset(
  128 + // Utils.getImgPath('c_state_ing'),
  129 + // width: ScreenUtil().setWidth(140),
  130 + // ))
  131 + ],
  132 + ),
  133 + RowMultiText(
  134 + '优惠信息',
  135 + aidStr,
  136 + textColor: MyColours.color_333333,
  137 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  138 + ),
  139 + Padding(
  140 + padding: EdgeInsets.only(
  141 + top: ScreenUtil().setWidth(25),
  142 + bottom: ScreenUtil().setWidth(20)),
  143 + child: Text(
  144 + '短信内容',
  145 + style: TextStyle(
  146 + color: MyColours.color_333333,
  147 + fontSize: ScreenUtil().setSp(30)),
  148 + )),
  149 + Padding(
  150 + padding: EdgeInsets.only(
  151 + bottom: ScreenUtil().setWidth(25)),
  152 + child: Text(
  153 + widget.selfList.content,
  154 + style: TextStyle(
  155 + color: MyColours.color_999999,
  156 + fontSize: ScreenUtil().setSp(30)),
  157 + )),
  158 + Padding(
  159 + padding: EdgeInsets.symmetric(
  160 + vertical: ScreenUtil().setWidth(25),
  161 + ),
  162 + child: Row(
  163 + crossAxisAlignment: CrossAxisAlignment.center,
  164 + children: [
  165 + Text(
  166 + '我的客户人数',
  167 + style: TextStyle(
  168 + color: MyColours.color_333333,
  169 + fontSize: ScreenUtil().setSp(30)),
  170 + ),
  171 + Spacer(),
  172 + Text('${widget.selfList.guestCount}人',
  173 + style: TextStyle(
  174 + color: MyColours.color_333333,
  175 + fontSize: ScreenUtil().setSp(30))),
  176 + HEmptyView(10),
  177 + InkWell(
  178 + onTap: () {
  179 + // NavigatorUtil.goMyMarketingRecordsDetailPage(context);
  180 + },
  181 + child: Text('查看',
  182 + style: TextStyle(
  183 + decoration:
  184 + TextDecoration.underline,
  185 + color: MyColours.color_199095,
  186 + fontSize: ScreenUtil().setSp(30)))),
  187 + ])),
  188 + ]))),
  189 + Column(
  190 + children: [
  191 + RoundButton(
  192 + text: '再次创建',
  193 + gradientStart: MyColours.color_199095,
  194 + gradientEnd: MyColours.color_199095,
  195 + textColor: MyColours.color_ffffff,
  196 + // borderColor: MyColours.color_999999,
  197 + radius: ScreenUtil().setWidth(10),
  198 + height: ScreenUtil().setWidth(80),
  199 + fontSize: 26,
  200 + margin: EdgeInsets.symmetric(
  201 + horizontal: ScreenUtil().setWidth(200)),
  202 + isBold: false,
  203 + onPressed: () {
  204 + NavigatorUtil.goMyMakeMarkingPage(context,
  205 + selfList:
  206 + widget.selfList,
  207 + fromPage:
  208 + FromPage.FromPageMakeRecordDetail);
  209 + },
  210 + ),
  211 + VEmptyView(30),
  212 + ],
  213 + )
  214 + ],
  215 + )));
  216 + }
  217 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_id_model.dart';
  5 +import 'package:one_key/models/marketing_by_uid_model.dart';
  6 +import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/utils.dart';
  12 +import 'package:one_key/widgets/h_empty_view.dart';
  13 +import 'package:one_key/widgets/page_exception.dart';
  14 +import 'package:one_key/widgets/round_button.dart';
  15 +import 'package:one_key/widgets/row_multi_text.dart';
  16 +import 'package:one_key/widgets/system_app_bar.dart';
  17 +import 'package:one_key/widgets/v_empty_view.dart';
  18 +import 'package:provider/provider.dart';
  19 +
  20 +class SellerMyMarketingRecordsDetailPage extends StatefulWidget {
  21 + final String idstr;
  22 + final SellerList sellerList;
  23 + SellerMyMarketingRecordsDetailPage({Key key, this.idstr, this.sellerList})
  24 + : super(key: key);
  25 +
  26 + @override
  27 + _SellerMyMarketingRecordsDetailPageState createState() =>
  28 + _SellerMyMarketingRecordsDetailPageState();
  29 +}
  30 +
  31 +class _SellerMyMarketingRecordsDetailPageState
  32 + extends State<SellerMyMarketingRecordsDetailPage> {
  33 + CustomerProvider customerProvider;
  34 + String aidStr = '';
  35 + @override
  36 + void initState() {
  37 + super.initState();
  38 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  39 + // if (widget.fromPage == FromPage.FromPageStoreCustomer) {
  40 + // _getMarketingBySeller();
  41 + // }
  42 + // _getMarketingById();
  43 + _couponNetworkData();
  44 + });
  45 + }
  46 +
  47 + @override
  48 + void dispose() {
  49 + super.dispose();
  50 + }
  51 +
  52 + // _getMarketingById() async {
  53 + // Map<String, String> params = {"id": widget.idstr};
  54 + // await customerProvider.getMarketingById(context, params);
  55 + // if (customerProvider.pageStateMarketingRecordDetail == PageState.Success) {
  56 + // _couponNetworkData();
  57 + // }
  58 + // // await customerProvider.searchData(customerProvider.controller.text);
  59 + // }
  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 + }
  81 +
  82 + //构建经理btn
  83 + List<Widget> _buildLabelItem(List<SellerUser> data,
  84 + {Color bgColor = MyColours.color_199095}) {
  85 + List<Widget> items = [];
  86 +
  87 + for (SellerUser item in data) {
  88 + String title = '${item.nickName}经理';
  89 + title += item.finishedStatus == 0 ? '(未完成)' : '(已完成)';
  90 +
  91 + items.add(InkWell(
  92 + onTap: () {},
  93 + child: Container(
  94 + // height: ScreenUtil().setWidth(40),
  95 + padding: EdgeInsets.symmetric(
  96 + horizontal: ScreenUtil().setWidth(20),
  97 + vertical: ScreenUtil().setWidth(6)),
  98 + decoration: BoxDecoration(
  99 + color: title.contains('未完成')
  100 + ? Color.fromRGBO(207, 29, 35, 1)
  101 + : MyColours.color_199095,
  102 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  103 + child: Text(
  104 + title,
  105 + style: TextStyle(
  106 + color: MyColours.color_ffffff,
  107 + fontSize: ScreenUtil().setSp(26),
  108 + ),
  109 + ),
  110 + )));
  111 + }
  112 + return items;
  113 + }
  114 +
  115 + @override
  116 + Widget build(BuildContext context) {
  117 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  118 + return Scaffold(
  119 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  120 + appBar: SystemAppBar(
  121 + '营销任务详情',
  122 + onTap: () {
  123 + Navigator.pop(context);
  124 + },
  125 + ),
  126 + body: Padding(
  127 + padding: EdgeInsets.symmetric(
  128 + horizontal: ScreenUtil().setWidth(30),
  129 + // vertical: ScreenUtil().setWidth(40)
  130 + ),
  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 + Padding(
  214 + padding: EdgeInsets.symmetric(
  215 + vertical: ScreenUtil().setWidth(25),
  216 + ),
  217 + child: Row(
  218 + crossAxisAlignment: CrossAxisAlignment.center,
  219 + children: [
  220 + Text(
  221 + '总客户人数',
  222 + style: TextStyle(
  223 + color: MyColours.color_333333,
  224 + fontSize: ScreenUtil().setSp(30)),
  225 + ),
  226 + Spacer(),
  227 + Text('${widget.sellerList.guestCount}人',
  228 + style: TextStyle(
  229 + color: MyColours.color_333333,
  230 + fontSize: ScreenUtil().setSp(30))),
  231 + HEmptyView(10),
  232 + InkWell(
  233 + onTap: () {
  234 + // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
  235 + },
  236 + child: Text('查看',
  237 + style: TextStyle(
  238 + decoration:
  239 + TextDecoration.underline,
  240 + color: MyColours.color_199095,
  241 + fontSize: ScreenUtil().setSp(30)))),
  242 + ])),
  243 + ]))),
  244 + Column(
  245 + children: [
  246 + widget.sellerList.finishedStatus == '0'
  247 + ? RoundButton(
  248 + text: '立刻完成',
  249 + gradientStart: MyColours.color_199095,
  250 + gradientEnd: MyColours.color_199095,
  251 + textColor: MyColours.color_ffffff,
  252 + // borderColor: MyColours.color_999999,
  253 + radius: ScreenUtil().setWidth(10),
  254 + height: ScreenUtil().setWidth(80),
  255 + fontSize: 26,
  256 + margin: EdgeInsets.symmetric(
  257 + horizontal: ScreenUtil().setWidth(200)),
  258 + isBold: false,
  259 + onPressed: () {
  260 + NavigatorUtil.goMyMakeMarkingPageOnlyShow(
  261 + context, widget.sellerList);
  262 + },
  263 + )
  264 + : SizedBox(),
  265 + VEmptyView(30),
  266 + ],
  267 + )
  268 + ],
  269 + )));
  270 + }
  271 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_seller_model.dart';
  5 +import 'package:one_key/models/marketing_by_uid_model.dart';
  6 +import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/utils.dart';
  11 +import 'package:one_key/widgets/h_empty_view.dart';
  12 +import 'package:one_key/widgets/page_exception.dart';
  13 +import 'package:one_key/widgets/round_button.dart';
  14 +import 'package:one_key/widgets/system_app_bar.dart';
  15 +import 'package:provider/provider.dart';
  16 +
  17 +class MyMarketingRecordsPage extends StatefulWidget {
  18 + final FromPage fromPage;
  19 + MyMarketingRecordsPage({Key key, this.fromPage}) : super(key: key);
  20 +
  21 + @override
  22 + _MyMarketingRecordsPageState createState() => _MyMarketingRecordsPageState();
  23 +}
  24 +
  25 +class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> {
  26 + CustomerProvider customerProvider;
  27 + ScrollController _controller = ScrollController();
  28 + @override
  29 + void initState() {
  30 + super.initState();
  31 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  32 + _getMarketingByUid();
  33 + });
  34 + }
  35 +
  36 + @override
  37 + void dispose() {
  38 + super.dispose();
  39 + }
  40 +
  41 + _getMarketingByUid() async {
  42 + Map<String, String> params = {
  43 + "uid": Provider.of<UserModel>(context, listen: false).user.openid
  44 + };
  45 + await customerProvider.getMarketingByUid(context, params);
  46 + // await customerProvider.searchData(customerProvider.controller.text);
  47 + }
  48 +
  49 + @override
  50 + Widget build(BuildContext context) {
  51 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  52 + return Scaffold(
  53 + backgroundColor: MyColours.color_ffffff,
  54 + appBar: SystemAppBar(
  55 + widget.fromPage == FromPage.FromPageMyCustomer ? '营销记录' : '全店营销记录',
  56 + onTap: () {
  57 + Navigator.pop(context);
  58 + },
  59 + ),
  60 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  61 + if (model.pageStateMarketingRecordMy != PageState.Success) {
  62 + return ExceptionPage(
  63 + pageState: model.pageStateMarketingRecordMy,
  64 + callback: () {
  65 + model.pageStateMarketingRecordMy = PageState.Loading;
  66 + model.notifyListeners();
  67 + _getMarketingByUid();
  68 + },
  69 + emptyMsg: "暂时没有营销记录哦",
  70 + emptyImg: "empty_search",
  71 + showMsg: "加载中,请稍后...",
  72 + );
  73 + } else {
  74 + return SingleChildScrollView(
  75 + controller: _controller,
  76 + child: Column(
  77 + children: [
  78 + ListView.builder(
  79 + shrinkWrap: true,
  80 + controller: _controller,
  81 + padding: EdgeInsets.symmetric(
  82 + horizontal: ScreenUtil().setWidth(20),
  83 + // vertical: ScreenUtil().setWidth(40)
  84 + ),
  85 + itemCount: model.myRecordData.sellerList.length,
  86 + itemBuilder: (BuildContext context, int index) {
  87 + SellerList data = model.myRecordData.sellerList[index];
  88 + return Padding(
  89 + padding: EdgeInsets.symmetric(
  90 + vertical: ScreenUtil().setWidth(20)),
  91 + child: Row(
  92 + children: [
  93 + data.finishedStatus == '0'
  94 + ? Image.asset(Utils.getImgPath('warning'),
  95 + width: ScreenUtil().setWidth(30))
  96 + : Container(
  97 + width: ScreenUtil().setWidth(30),
  98 + ),
  99 + HEmptyView(10),
  100 + Text(data.cdateStr,
  101 + style: TextStyle(
  102 + color: MyColours.color_333333,
  103 + fontSize: ScreenUtil().setSp(26))),
  104 + HEmptyView(10),
  105 + RoundButton(
  106 + text: '全店任务',
  107 + gradientStart: MyColours.color_199095,
  108 + gradientEnd: MyColours.color_199095,
  109 + // borderColor: MyColours.color_999999,
  110 + radius: ScreenUtil().setWidth(10),
  111 + width: ScreenUtil().setWidth(132),
  112 + height: ScreenUtil().setWidth(50),
  113 + fontSize: 26,
  114 + padding: EdgeInsets.symmetric(
  115 + horizontal: ScreenUtil().setWidth(10)),
  116 + isBold: false,
  117 + onPressed: () {
  118 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  119 + },
  120 + ),
  121 + HEmptyView(10),
  122 + Container(
  123 + width: ScreenUtil().setWidth(110),
  124 + child: Text(
  125 + data.finishedStatus == '0'
  126 + ? '暂未完成'
  127 + : data.finishedStatus == '1'
  128 + ? '已完成'
  129 + : data.finishedStatus == '2'
  130 + ? '已取消'
  131 + : '',
  132 + overflow: TextOverflow.ellipsis,
  133 + style: TextStyle(
  134 + color: data.finishedStatus == '0'
  135 + ? Colors.red
  136 + : data.finishedStatus == '1'
  137 + ? MyColours.color_199095
  138 + : MyColours.color_999999,
  139 + fontSize: ScreenUtil().setSp(26)))),
  140 + HEmptyView(10),
  141 + Expanded(
  142 + child: Text(
  143 + data.edate == null
  144 + ? '无限制'
  145 + : '剩余${11111}天',
  146 + overflow: TextOverflow.ellipsis,
  147 + style: TextStyle(
  148 + color: MyColours.color_333333,
  149 + fontSize: ScreenUtil().setSp(26)))),
  150 + InkWell(
  151 + onTap: () {
  152 + NavigatorUtil
  153 + .goSellerMyMarketingRecordsDetailPage(
  154 + context, data.id, data);
  155 + },
  156 + child: Text('查看详情',
  157 + style: TextStyle(
  158 + decoration:
  159 + TextDecoration.underline,
  160 + color: MyColours.color_199095,
  161 + fontSize: ScreenUtil().setSp(26)))),
  162 + ],
  163 + ));
  164 + }),
  165 + ListView.builder(
  166 + shrinkWrap: true,
  167 + controller: _controller,
  168 + padding: EdgeInsets.symmetric(
  169 + horizontal: ScreenUtil().setWidth(20),
  170 + // vertical: ScreenUtil().setWidth(40)
  171 + ),
  172 + itemCount: model.myRecordData.selfList.length,
  173 + itemBuilder: (BuildContext context, int index) {
  174 + SelfList data = model.myRecordData.selfList[index];
  175 + return Padding(
  176 + padding: EdgeInsets.symmetric(
  177 + vertical: ScreenUtil().setWidth(20)),
  178 + child: Row(
  179 + children: [
  180 + // data.finishedStatus == '0'
  181 + // ? Image.asset(Utils.getImgPath('warning'),
  182 + // width: ScreenUtil().setWidth(30))
  183 + // :
  184 + Container(
  185 + width: ScreenUtil().setWidth(30),
  186 + ),
  187 + HEmptyView(10),
  188 + Text(data.cdateStr,
  189 + style: TextStyle(
  190 + color: MyColours.color_333333,
  191 + fontSize: ScreenUtil().setSp(26))),
  192 + HEmptyView(10),
  193 + RoundButton(
  194 + text: '个人',
  195 + gradientStart: MyColours.color_199095,
  196 + gradientEnd: MyColours.color_199095,
  197 + // borderColor: MyColours.color_999999,
  198 + radius: ScreenUtil().setWidth(10),
  199 + width: ScreenUtil().setWidth(132),
  200 + height: ScreenUtil().setWidth(50),
  201 + fontSize: 26,
  202 + padding: EdgeInsets.symmetric(
  203 + horizontal: ScreenUtil().setWidth(10)),
  204 + isBold: false,
  205 + onPressed: () {
  206 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  207 + },
  208 + ),
  209 + Spacer(),
  210 + // HEmptyView(10),
  211 + // Expanded(
  212 + // child: Text(
  213 + // data.finishedStatus == '0'
  214 + // ? '暂未完成'
  215 + // : data.finishedStatus == '1'
  216 + // ? '已完成'
  217 + // : data.finishedStatus == '2'
  218 + // ? '已取消'
  219 + // : '',
  220 + // overflow: TextOverflow.ellipsis,
  221 + // style: TextStyle(
  222 + // color: data.finishedStatus == '0'
  223 + // ? Colors.red
  224 + // : data.finishedStatus == '1'
  225 + // ? MyColours.color_199095
  226 + // : MyColours.color_999999,
  227 + // fontSize: ScreenUtil().setSp(26)))),
  228 + // HEmptyView(10),
  229 + // Expanded(
  230 + // child: Text(
  231 + // data.edate == null ? '无限制' : '剩余${11111}天',
  232 + // overflow: TextOverflow.ellipsis,
  233 + // style: TextStyle(
  234 + // color: MyColours.color_333333,
  235 + // fontSize: ScreenUtil().setSp(26)))),
  236 + InkWell(
  237 + onTap: () {
  238 + NavigatorUtil
  239 + .goMyMarketingRecordsDetailPage(
  240 + context, data.id, data);
  241 + },
  242 + child: Text('查看详情',
  243 + style: TextStyle(
  244 + decoration:
  245 + TextDecoration.underline,
  246 + color: MyColours.color_199095,
  247 + fontSize: ScreenUtil().setSp(26)))),
  248 + ],
  249 + ));
  250 + }),
  251 + ],
  252 + ));
  253 + }
  254 + }),
  255 + );
  256 + }
  257 +}