Commit 889a13b3ad6bb6be9558fbddbdf1d8dea523c340

Authored by wdn127929
1 parent b69ed69d

纪念日部分

@@ -93,7 +93,7 @@ class Guest extends Object { @@ -93,7 +93,7 @@ class Guest extends Object {
93 @JsonKey(name: 'serve') 93 @JsonKey(name: 'serve')
94 String serve; 94 String serve;
95 @JsonKey(name: 'c_day') 95 @JsonKey(name: 'c_day')
96 - List cDay; 96 + List<Cday> cDay;
97 @JsonKey(name: 'udate') 97 @JsonKey(name: 'udate')
98 String udate; 98 String udate;
99 99
@@ -147,6 +147,33 @@ class Guest extends Object { @@ -147,6 +147,33 @@ class Guest extends Object {
147 } 147 }
148 148
149 @JsonSerializable() 149 @JsonSerializable()
  150 +class Cday extends Object {
  151 + @JsonKey(name: 'id')
  152 + String id;
  153 +
  154 + @JsonKey(name: 'gid')
  155 + String gid;
  156 +
  157 + @JsonKey(name: 'content')
  158 + String content;
  159 +
  160 + @JsonKey(name: 'cdate')
  161 + String cdate;
  162 +
  163 + Cday(
  164 + this.id,
  165 + this.gid,
  166 + this.content,
  167 + this.cdate,
  168 + );
  169 +
  170 + factory Cday.fromJson(Map<String, dynamic> srcJson) =>
  171 + _$CdayFromJson(srcJson);
  172 +
  173 + Map<String, dynamic> toJson() => _$CdayToJson(this);
  174 +}
  175 +
  176 +@JsonSerializable()
150 class Last extends Object { 177 class Last extends Object {
151 @JsonKey(name: 'id') 178 @JsonKey(name: 'id')
152 String id; 179 String id;
@@ -64,7 +64,10 @@ Guest _$GuestFromJson(Map<String, dynamic> json) { @@ -64,7 +64,10 @@ Guest _$GuestFromJson(Map<String, dynamic> json) {
64 json['taboos'] as String, 64 json['taboos'] as String,
65 json['like'] as String, 65 json['like'] as String,
66 json['serve'] as String, 66 json['serve'] as String,
67 - json['c_day'] as List, 67 + (json['c_day'] as List)
  68 + ?.map(
  69 + (e) => e == null ? null : Cday.fromJson(e as Map<String, dynamic>))
  70 + ?.toList(),
68 json['udate'] as String, 71 json['udate'] as String,
69 json['label'] as String, 72 json['label'] as String,
70 ); 73 );
@@ -89,6 +92,22 @@ Map<String, dynamic> _$GuestToJson(Guest instance) => <String, dynamic>{ @@ -89,6 +92,22 @@ Map<String, dynamic> _$GuestToJson(Guest instance) => <String, dynamic>{
89 'label': instance.label, 92 'label': instance.label,
90 }; 93 };
91 94
  95 +Cday _$CdayFromJson(Map<String, dynamic> json) {
  96 + return Cday(
  97 + json['id'] as String,
  98 + json['gid'] as String,
  99 + json['content'] as String,
  100 + json['cdate'] as String,
  101 + );
  102 +}
  103 +
  104 +Map<String, dynamic> _$CdayToJson(Cday instance) => <String, dynamic>{
  105 + 'id': instance.id,
  106 + 'gid': instance.gid,
  107 + 'content': instance.content,
  108 + 'cdate': instance.cdate,
  109 + };
  110 +
92 Last _$LastFromJson(Map<String, dynamic> json) { 111 Last _$LastFromJson(Map<String, dynamic> json) {
93 return Last( 112 return Last(
94 json['id'] as String, 113 json['id'] as String,
@@ -118,8 +137,8 @@ Map<String, dynamic> _$LastToJson(Last instance) => <String, dynamic>{ @@ -118,8 +137,8 @@ Map<String, dynamic> _$LastToJson(Last instance) => <String, dynamic>{
118 Count _$CountFromJson(Map<String, dynamic> json) { 137 Count _$CountFromJson(Map<String, dynamic> json) {
119 return Count( 138 return Count(
120 json['leiji'] as String, 139 json['leiji'] as String,
121 - json['quxiao'] as dynamic,  
122 - json['create_time'] as dynamic, 140 + json['quxiao'],
  141 + json['create_time'],
123 ); 142 );
124 } 143 }
125 144
@@ -67,6 +67,9 @@ class MarketingByIdSunModel extends Object { @@ -67,6 +67,9 @@ class MarketingByIdSunModel extends Object {
67 @JsonKey(name: 'seller_user') 67 @JsonKey(name: 'seller_user')
68 List<SellerUser> sellerUser; 68 List<SellerUser> sellerUser;
69 69
  70 + @JsonKey(name: 'create_user')
  71 + String createUser;
  72 +
70 String aidStr = ''; 73 String aidStr = '';
71 74
72 String get cdateStr { 75 String get cdateStr {
@@ -89,6 +92,7 @@ class MarketingByIdSunModel extends Object { @@ -89,6 +92,7 @@ class MarketingByIdSunModel extends Object {
89 this.sellerUserCount, 92 this.sellerUserCount,
90 this.notFinished, 93 this.notFinished,
91 this.sellerUser, 94 this.sellerUser,
  95 + this.createUser
92 ); 96 );
93 97
94 factory MarketingByIdSunModel.fromJson(Map<String, dynamic> srcJson) => 98 factory MarketingByIdSunModel.fromJson(Map<String, dynamic> srcJson) =>
@@ -42,6 +42,7 @@ MarketingByIdSunModel _$MarketingByIdSunModelFromJson( @@ -42,6 +42,7 @@ MarketingByIdSunModel _$MarketingByIdSunModelFromJson(
42 ?.map((e) => 42 ?.map((e) =>
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 ); 46 );
46 } 47 }
47 48
@@ -61,6 +62,7 @@ Map<String, dynamic> _$MarketingByIdSunModelToJson( @@ -61,6 +62,7 @@ Map<String, dynamic> _$MarketingByIdSunModelToJson(
61 'seller_user_count': instance.sellerUserCount, 62 'seller_user_count': instance.sellerUserCount,
62 'not_finished': instance.notFinished, 63 'not_finished': instance.notFinished,
63 'seller_user': instance.sellerUser, 64 'seller_user': instance.sellerUser,
  65 + 'create_user': instance.createUser
64 }; 66 };
65 67
66 SellerUser _$SellerUserFromJson(Map<String, dynamic> json) { 68 SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
@@ -61,6 +61,12 @@ class MarketingBySellerSunModel extends Object { @@ -61,6 +61,12 @@ class MarketingBySellerSunModel extends Object {
61 @JsonKey(name: 'remaining_time') 61 @JsonKey(name: 'remaining_time')
62 int remainingTime; 62 int remainingTime;
63 63
  64 +
  65 + @JsonKey(name: 'finished_status')
  66 + String finishedStatus;
  67 +
  68 +
  69 +
64 String get cdateStr { 70 String get cdateStr {
65 DateTime dateTime = 71 DateTime dateTime =
66 DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000); 72 DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
@@ -79,6 +85,7 @@ class MarketingBySellerSunModel extends Object { @@ -79,6 +85,7 @@ class MarketingBySellerSunModel extends Object {
79 this.cdate, 85 this.cdate,
80 this.notFinished, 86 this.notFinished,
81 this.remainingTime, 87 this.remainingTime,
  88 + this.finishedStatus
82 ); 89 );
83 90
84 factory MarketingBySellerSunModel.fromJson(Map<String, dynamic> srcJson) => 91 factory MarketingBySellerSunModel.fromJson(Map<String, dynamic> srcJson) =>
@@ -41,6 +41,7 @@ MarketingBySellerSunModel _$MarketingBySellerSunModelFromJson( @@ -41,6 +41,7 @@ MarketingBySellerSunModel _$MarketingBySellerSunModelFromJson(
41 json['cdate'] as String, 41 json['cdate'] as String,
42 json['not_finished'] as String, 42 json['not_finished'] as String,
43 json['remaining_time'] as int, 43 json['remaining_time'] as int,
  44 + json['finished_status'] as String,
44 ); 45 );
45 } 46 }
46 47
@@ -58,4 +59,5 @@ Map<String, dynamic> _$MarketingBySellerSunModelToJson( @@ -58,4 +59,5 @@ Map<String, dynamic> _$MarketingBySellerSunModelToJson(
58 'cdate': instance.cdate, 59 'cdate': instance.cdate,
59 'not_finished': instance.notFinished, 60 'not_finished': instance.notFinished,
60 'remaining_time': instance.remainingTime, 61 'remaining_time': instance.remainingTime,
  62 + 'finished_status': instance.finishedStatus
61 }; 63 };
@@ -192,5 +192,7 @@ class HttpUrl { @@ -192,5 +192,7 @@ class HttpUrl {
192 "?service=App.GuestManage.GetMarketingBySeller"; // 商家营销列表 192 "?service=App.GuestManage.GetMarketingBySeller"; // 商家营销列表
193 static const String get_marketing_by_id = 193 static const String get_marketing_by_id =
194 "?service=App.GuestManage.GetMarketingById"; // 商家营销详情 194 "?service=App.GuestManage.GetMarketingById"; // 商家营销详情
  195 + static const String set_guest_info_cday =
  196 + "?service=App.GuestManage.SetGuestCday"; // 设置客户纪念日
195 197
196 } 198 }
@@ -496,8 +496,11 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -496,8 +496,11 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
496 fontSize: 26, 496 fontSize: 26,
497 isBold: false, 497 isBold: false,
498 onPressed: () { 498 onPressed: () {
499 - NavigatorUtil.goFestivalEditPage(context,  
500 - customerProvider.guestInfoSunModel.guest); 499 + NavigatorUtil.goFestivalEditPage(
  500 + context,
  501 + customerProvider.guestInfoSunModel.guest,
  502 + widget.userHistoryEntity.id,
  503 + widget.userHistoryEntity.phone);
501 }, 504 },
502 ), 505 ),
503 ], 506 ],
@@ -517,7 +520,8 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -517,7 +520,8 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
517 padding: EdgeInsets.symmetric( 520 padding: EdgeInsets.symmetric(
518 vertical: ScreenUtil().setWidth(10)), 521 vertical: ScreenUtil().setWidth(10)),
519 child: Text( 522 child: Text(
520 - '本人生日:12月18日(公历)', 523 + customerProvider.guestInfoSunModel.guest
  524 + .cDay[index].content,
521 style: TextStyle( 525 style: TextStyle(
522 fontSize: ScreenUtil().setSp(26), 526 fontSize: ScreenUtil().setSp(26),
523 color: MyColours.color_333333), 527 color: MyColours.color_333333),
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 2 import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
3 import 'package:one_key/models/guest_info_model.dart'; 4 import 'package:one_key/models/guest_info_model.dart';
4 import 'package:one_key/provider/customer_provider.dart'; 5 import 'package:one_key/provider/customer_provider.dart';
5 import 'package:one_key/res/colors.dart'; 6 import 'package:one_key/res/colors.dart';
@@ -7,6 +8,7 @@ import 'package:one_key/utils/dialog_util.dart'; @@ -7,6 +8,7 @@ import 'package:one_key/utils/dialog_util.dart';
7 import 'package:one_key/utils/event_bus.dart'; 8 import 'package:one_key/utils/event_bus.dart';
8 import 'package:one_key/utils/utils.dart'; 9 import 'package:one_key/utils/utils.dart';
9 import 'package:one_key/widgets/h_empty_view.dart'; 10 import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
10 import 'package:one_key/widgets/round_button.dart'; 12 import 'package:one_key/widgets/round_button.dart';
11 import 'package:one_key/widgets/system_app_bar.dart'; 13 import 'package:one_key/widgets/system_app_bar.dart';
12 import 'package:one_key/widgets/v_empty_view.dart'; 14 import 'package:one_key/widgets/v_empty_view.dart';
@@ -14,7 +16,10 @@ import 'package:provider/provider.dart'; @@ -14,7 +16,10 @@ import 'package:provider/provider.dart';
14 16
15 class FestivalEditPage extends StatefulWidget { 17 class FestivalEditPage extends StatefulWidget {
16 final Guest guest; 18 final Guest guest;
17 - FestivalEditPage({Key key, this.guest}) : super(key: key); 19 + final String idstr;
  20 + final String phone;
  21 + FestivalEditPage({Key key, this.guest, this.idstr, this.phone})
  22 + : super(key: key);
18 23
19 @override 24 @override
20 _FestivalEditPageState createState() => _FestivalEditPageState(); 25 _FestivalEditPageState createState() => _FestivalEditPageState();
@@ -23,18 +28,36 @@ class FestivalEditPage extends StatefulWidget { @@ -23,18 +28,36 @@ class FestivalEditPage extends StatefulWidget {
23 class _FestivalEditPageState extends State<FestivalEditPage> { 28 class _FestivalEditPageState extends State<FestivalEditPage> {
24 CustomerProvider customerProvider; 29 CustomerProvider customerProvider;
25 30
26 - _setGuestInfo(String cday) async {  
27 - Map<String, String> params = {"id": widget.guest.id, 'c_day': cday}; 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 + }
28 45
29 - bool sucess =  
30 - await customerProvider.setGuestInfo(context, params, showLoading: true); 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);
31 if (sucess) { 53 if (sucess) {
32 Utils.showToast('保存成功'); 54 Utils.showToast('保存成功');
  55 + //刷新当前页
  56 + _getGuestInfoCday();
33 // 刷新 57 // 刷新
34 bus.emit('refresh_guest_info'); 58 bus.emit('refresh_guest_info');
35 bus.emit('refresh_guest_list'); 59 bus.emit('refresh_guest_list');
36 // Navigator.pop(context); 60 // Navigator.pop(context);
37 - //刷新当前页? 还没做???????  
38 61
39 } 62 }
40 } 63 }
@@ -55,44 +78,102 @@ class _FestivalEditPageState extends State<FestivalEditPage> { @@ -55,44 +78,102 @@ class _FestivalEditPageState extends State<FestivalEditPage> {
55 horizontal: ScreenUtil().setWidth(40), 78 horizontal: ScreenUtil().setWidth(40),
56 vertical: ScreenUtil().setWidth(40)), 79 vertical: ScreenUtil().setWidth(40)),
57 child: Column(children: [ 80 child: Column(children: [
58 - Expanded(  
59 - child: ListView.builder(  
60 - shrinkWrap: true,  
61 - itemCount: 10,  
62 - itemBuilder: (BuildContext context, int index) {  
63 - return InkWell(  
64 - onTap: () {  
65 - DialogUtil.festivalAlertDialog(context, 'ggg', 520,  
66 - rCallback: (name) {  
67 - // _addCookbookClass(name, showLoading: true);  
68 - });  
69 - },  
70 - child: Padding(  
71 - padding: EdgeInsets.symmetric(  
72 - horizontal: ScreenUtil().setWidth(20),  
73 - vertical: ScreenUtil().setWidth(20)),  
74 - child: Row(  
75 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
76 - children: [  
77 - Expanded(  
78 - child: Text(  
79 - '本人生日:12月18日(公历)',  
80 - overflow: TextOverflow.ellipsis,  
81 - style: TextStyle(  
82 - fontSize: ScreenUtil().setSp(26),  
83 - color: MyColours.color_333333),  
84 - )),  
85 - HEmptyView(10),  
86 - Image.asset(  
87 - Utils.getImgPath('c_edit'),  
88 - width: ScreenUtil().setWidth(40),  
89 - // height: ScreenUtil().setWidth(10),  
90 - )  
91 - ],  
92 - ),  
93 - ));  
94 - },  
95 - )), 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 + })),
96 RoundButton( 177 RoundButton(
97 text: '新增', 178 text: '新增',
98 radius: ScreenUtil().setWidth(10), 179 radius: ScreenUtil().setWidth(10),
@@ -105,12 +186,14 @@ class _FestivalEditPageState extends State<FestivalEditPage> { @@ -105,12 +186,14 @@ class _FestivalEditPageState extends State<FestivalEditPage> {
105 DialogUtil.festivalAlertDialog(context, '', 520, 186 DialogUtil.festivalAlertDialog(context, '', 520,
106 rCallback: (name) { 187 rCallback: (name) {
107 print(name); 188 print(name);
108 - _setGuestInfo(name); 189 + _setGuestInfocDay('', name);
109 // _addCookbookClass(name, showLoading: true); 190 // _addCookbookClass(name, showLoading: true);
110 }); 191 });
111 }, 192 },
112 ), 193 ),
113 VEmptyView(30) 194 VEmptyView(30)
114 ]))); 195 ])));
  196 + // }
  197 + // }));
115 } 198 }
116 } 199 }
@@ -140,7 +140,9 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { @@ -140,7 +140,9 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
140 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, 140 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
141 "gid": gid, 141 "gid": gid,
142 "content": customerMakingProvider.controller.text, 142 "content": customerMakingProvider.controller.text,
143 - 'is_update': customerMakingProvider.isUpdate ? '0' : '1' 143 + 'is_update': customerMakingProvider.isUpdate ? '0' : '1',
  144 + 'create_user':
  145 + Provider.of<UserModel>(context, listen: false).user.role_name
144 }; 146 };
145 147
146 if (customerMakingProvider.youhui != '选择优惠' && 148 if (customerMakingProvider.youhui != '选择优惠' &&
@@ -158,7 +158,7 @@ class _MarketingRecordsDetailPageState @@ -158,7 +158,7 @@ class _MarketingRecordsDetailPageState
158 ), 158 ),
159 RowMultiText( 159 RowMultiText(
160 '创建人', 160 '创建人',
161 - '管理员(未返回)', 161 + model.marketingByIdSunModel.createUser,
162 textColor: MyColours.color_333333, 162 textColor: MyColours.color_333333,
163 bgColor: Color.fromRGBO(246, 248, 250, 1), 163 bgColor: Color.fromRGBO(246, 248, 250, 1),
164 ), 164 ),
@@ -173,7 +173,9 @@ class _MarketingRecordsDetailPageState @@ -173,7 +173,9 @@ class _MarketingRecordsDetailPageState
173 ), 173 ),
174 RowMultiText( 174 RowMultiText(
175 '完成期限', 175 '完成期限',
176 - model.marketingByIdSunModel.edate, 176 + model.marketingByIdSunModel.edate == null
  177 + ? '无限制'
  178 + : model.marketingByIdSunModel.edate,
177 textColor: MyColours.color_333333, 179 textColor: MyColours.color_333333,
178 bgColor: Color.fromRGBO(246, 248, 250, 1), 180 bgColor: Color.fromRGBO(246, 248, 250, 1),
179 ), 181 ),
@@ -117,11 +117,13 @@ class _MarketingRecordsPageState extends State<MarketingRecordsPage> { @@ -117,11 +117,13 @@ class _MarketingRecordsPageState extends State<MarketingRecordsPage> {
117 HEmptyView(10), 117 HEmptyView(10),
118 Expanded( 118 Expanded(
119 child: Text( 119 child: Text(
120 - data.notFinished != '' &&  
121 - data.notFinished != null &&  
122 - data.notFinished != '0' 120 + data.finishedStatus == '0'
123 ? '${data.notFinished}位未完成' 121 ? '${data.notFinished}位未完成'
124 - : '全部完成/取消任务', 122 + : data.finishedStatus == '1'
  123 + ? '全部完成'
  124 + : data.finishedStatus == '2'
  125 + ? '取消任务'
  126 + : '',
125 overflow: TextOverflow.ellipsis, 127 overflow: TextOverflow.ellipsis,
126 style: TextStyle( 128 style: TextStyle(
127 color: data.notFinished != '' && 129 color: data.notFinished != '' &&
@@ -132,7 +134,10 @@ class _MarketingRecordsPageState extends State<MarketingRecordsPage> { @@ -132,7 +134,10 @@ class _MarketingRecordsPageState extends State<MarketingRecordsPage> {
132 fontSize: ScreenUtil().setSp(26)))), 134 fontSize: ScreenUtil().setSp(26)))),
133 HEmptyView(10), 135 HEmptyView(10),
134 Expanded( 136 Expanded(
135 - child: Text('剩余${data.remainingTime}天', 137 + child: Text(
  138 + data.remainingTime == null
  139 + ? '无限制'
  140 + : '剩余${data.remainingTime}天',
136 overflow: TextOverflow.ellipsis, 141 overflow: TextOverflow.ellipsis,
137 style: TextStyle( 142 style: TextStyle(
138 color: MyColours.color_333333, 143 color: MyColours.color_333333,
@@ -39,6 +39,8 @@ class CustomerProvider extends ChangeNotifier { @@ -39,6 +39,8 @@ class CustomerProvider extends ChangeNotifier {
39 PageState pageStateGuestReserve = PageState.Loading; //订单统计 39 PageState pageStateGuestReserve = PageState.Loading; //订单统计
40 PageState pageStateMarketingRecord = PageState.Loading; //营销记录 40 PageState pageStateMarketingRecord = PageState.Loading; //营销记录
41 PageState pageStateMarketingRecordDetail = PageState.Loading; //营销记录详情 41 PageState pageStateMarketingRecordDetail = PageState.Loading; //营销记录详情
  42 + PageState pageStateGuestInfoCday = PageState.Loading; //客户详情纪念日
  43 + List<Cday> cday; //纪念日列表
42 44
43 GuestInfoSunModel guestInfoSunModel; 45 GuestInfoSunModel guestInfoSunModel;
44 GuestReserveSunModel guestReserveSunModel; 46 GuestReserveSunModel guestReserveSunModel;
@@ -202,6 +204,44 @@ class CustomerProvider extends ChangeNotifier { @@ -202,6 +204,44 @@ class CustomerProvider extends ChangeNotifier {
202 notifyListeners(); 204 notifyListeners();
203 } 205 }
204 206
  207 + // 获取客户纪念日列表
  208 + getGuestInfoCday(BuildContext context, Map<String, String> params) async {
  209 + BaseResp<dynamic> baseResp = await DioUtil()
  210 + .request<dynamic>(context, Method.get, HttpUrl.get_guest_info,
  211 + data: params, showLoading: false)
  212 + .catchError((error) {
  213 + print(error.toString());
  214 + if (error is MyError) {
  215 + switch (error.type) {
  216 + case 1:
  217 + pageStateGuestInfoCday = PageState.ConnectivityError;
  218 + break;
  219 + case 2:
  220 + pageStateGuestInfoCday = PageState.ConnectivityTimeOut;
  221 + break;
  222 + default:
  223 + pageStateGuestInfoCday = PageState.ConnectivityError;
  224 + break;
  225 + }
  226 + }
  227 + notifyListeners();
  228 + });
  229 + if (baseResp != null && baseResp.code == Constant.status_success) {
  230 + cday = GuestInfoModel.fromJson(baseResp.responseData).data.guest.cDay;
  231 + if (cday.length > 0) {
  232 + pageStateGuestInfoCday = PageState.Success;
  233 + } else {
  234 + pageStateGuestInfoCday = PageState.Empty;
  235 + }
  236 + notifyListeners();
  237 + } else {
  238 + if (baseResp != null) {
  239 + Utils.showToast(baseResp.msg ?? "");
  240 + }
  241 + pageStateGuestInfoCday = PageState.ConnectivityTimeOut;
  242 + }
  243 + notifyListeners();
  244 + }
205 // //获取历史录入 245 // //获取历史录入
206 // getUserHistorys(BuildContext context, Map<String, String> params) async { 246 // getUserHistorys(BuildContext context, Map<String, String> params) async {
207 // BaseResp<List> baseResp = await DioUtil() 247 // BaseResp<List> baseResp = await DioUtil()
@@ -351,6 +391,41 @@ class CustomerProvider extends ChangeNotifier { @@ -351,6 +391,41 @@ class CustomerProvider extends ChangeNotifier {
351 } 391 }
352 } 392 }
353 393
  394 + //修改客户信息纪念日
  395 + Future<bool> setGuestInfocDay(
  396 + BuildContext context, Map<String, String> params,
  397 + {bool showLoading = false}) async {
  398 + BaseResp<dynamic> baseResp = await DioUtil()
  399 + .request<dynamic>(context, Method.get, HttpUrl.set_guest_info_cday,
  400 + data: params, showLoading: showLoading)
  401 + .catchError((error) {
  402 + print(error.toString());
  403 + if (error is MyError) {}
  404 + notifyListeners();
  405 + });
  406 + if (baseResp != null && baseResp.code == Constant.status_success) {
  407 + // guestReserveSunModel =
  408 + // GuestReserveModel.fromJson(baseResp.responseData).data;
  409 + if (params.containsKey('id')) {
  410 + if (baseResp.responseData['data'] == 1) {
  411 + return true;
  412 + }
  413 + return false;
  414 + } else {
  415 + if (baseResp.responseData['data'] != null &&
  416 + baseResp.responseData['data']['id'] != '') {
  417 + return true;
  418 + }
  419 + return false;
  420 + }
  421 + } else {
  422 + if (baseResp != null) {
  423 + Utils.showToast(baseResp.msg ?? "");
  424 + }
  425 + return false;
  426 + }
  427 + }
  428 +
354 //全选按钮执行“全选” 429 //全选按钮执行“全选”
355 addAll() async { 430 addAll() async {
356 List<CustomerListSunModel> temp = returnNowList(); 431 List<CustomerListSunModel> temp = returnNowList();
@@ -604,11 +604,13 @@ class NavigatorUtil { @@ -604,11 +604,13 @@ class NavigatorUtil {
604 ///纪念日 604 ///纪念日
605 static Future<dynamic> goFestivalEditPage( 605 static Future<dynamic> goFestivalEditPage(
606 BuildContext context, 606 BuildContext context,
607 - Guest guest, { 607 + Guest guest,
  608 + String id,
  609 + String phone, {
608 replace = false, 610 replace = false,
609 }) { 611 }) {
610 return _navigateTo(context, 612 return _navigateTo(context,
611 - "${Routes.festival_edit_page}?guest=${FluroConvertUtils.object2string(guest)}", 613 + "${Routes.festival_edit_page}?guest=${FluroConvertUtils.object2string(guest)}&idstr=${id}&phone=${phone}",
612 replace: replace); 614 replace: replace);
613 } 615 }
614 616
@@ -889,7 +889,8 @@ var marketingRecordsDetailPageHandle = new Handler( @@ -889,7 +889,8 @@ var marketingRecordsDetailPageHandle = new Handler(
889 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 889 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
890 String idstr = params["idstr"].first; 890 String idstr = params["idstr"].first;
891 return ChangeNotifierProvider<CustomerProvider>( 891 return ChangeNotifierProvider<CustomerProvider>(
892 - create: (_) => CustomerProvider(), child: MarketingRecordsDetailPage(idstr:idstr)); 892 + create: (_) => CustomerProvider(),
  893 + child: MarketingRecordsDetailPage(idstr: idstr));
893 }); 894 });
894 895
895 ///创建营销 896 ///创建营销
@@ -938,7 +939,9 @@ var customerDetailEditPageHandle = new Handler( @@ -938,7 +939,9 @@ var customerDetailEditPageHandle = new Handler(
938 ///纪念日 939 ///纪念日
939 var festivalEditPageHandle = new Handler( 940 var festivalEditPageHandle = new Handler(
940 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 941 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
941 - // String idstr = params["idstr"].first; 942 + String idstr = params["idstr"].first;
  943 +
  944 + String phone = params["phone"].first;
942 // UserHistoryEntity userHistoryEntity = UserHistoryEntity.fromJson(json.decode( 945 // UserHistoryEntity userHistoryEntity = UserHistoryEntity.fromJson(json.decode(
943 // FluroConvertUtils.fluroCnParamsDecode( 946 // FluroConvertUtils.fluroCnParamsDecode(
944 // params["userHistoryEntity"].first))); 947 // params["userHistoryEntity"].first)));
@@ -946,9 +949,7 @@ var festivalEditPageHandle = new Handler( @@ -946,9 +949,7 @@ var festivalEditPageHandle = new Handler(
946 .decode(FluroConvertUtils.fluroCnParamsDecode(params["guest"].first))); 949 .decode(FluroConvertUtils.fluroCnParamsDecode(params["guest"].first)));
947 return ChangeNotifierProvider<CustomerProvider>( 950 return ChangeNotifierProvider<CustomerProvider>(
948 create: (_) => CustomerProvider(), 951 create: (_) => CustomerProvider(),
949 - child: FestivalEditPage(  
950 - guest: guest,  
951 - )); 952 + child: FestivalEditPage(guest: guest, idstr: idstr, phone: phone));
952 }); 953 });
953 954
954 ///客户订单 955 ///客户订单
@@ -2345,11 +2345,12 @@ class DialogUtil { @@ -2345,11 +2345,12 @@ class DialogUtil {
2345 2345
2346 static Future festivalAlertDialog( 2346 static Future festivalAlertDialog(
2347 BuildContext context, String name, double height, 2347 BuildContext context, String name, double height,
2348 - {CustomCallBack rCallback, double fontSize = 28}) async {  
2349 - String yearStr = '选填';  
2350 - String monthStr = '';  
2351 - String dayStr = '';  
2352 - bool gongli = true; 2348 + {CustomCallBack rCallback,
  2349 + double fontSize = 28,
  2350 + String yearStr = '选填',
  2351 + String monthStr = '',
  2352 + String dayStr = '',
  2353 + bool gongli = true}) async {
2353 final action = await showDialog( 2354 final action = await showDialog(
2354 context: context, 2355 context: context,
2355 barrierDismissible: true, 2356 barrierDismissible: true,