Commit 8c5797881fdc5d54a6f519e968de3d04849f2783

Authored by wdn127929
1 parent f646d950

客户详情页

  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:json_annotation/json_annotation.dart';
  3 +import 'dart:convert' as convert;
  4 +import 'package:one_key/models/table_list.dart' as t;
  5 +
  6 +part 'guest_info_model.g.dart';
  7 +
  8 +@JsonSerializable()
  9 +class GuestInfoModel extends Object {
  10 + @JsonKey(name: 'ret')
  11 + int ret;
  12 +
  13 + @JsonKey(name: 'data')
  14 + GuestInfoSunModel data;
  15 +
  16 + @JsonKey(name: 'msg')
  17 + String msg;
  18 +
  19 + GuestInfoModel(
  20 + this.ret,
  21 + this.data,
  22 + this.msg,
  23 + );
  24 +
  25 + factory GuestInfoModel.fromJson(Map<String, dynamic> srcJson) =>
  26 + _$GuestInfoModelFromJson(srcJson);
  27 +
  28 + Map<String, dynamic> toJson() => _$GuestInfoModelToJson(this);
  29 +}
  30 +
  31 +@JsonSerializable()
  32 +class GuestInfoSunModel extends Object {
  33 + @JsonKey(name: 'guest')
  34 + Guest guest;
  35 +
  36 + @JsonKey(name: 'last')
  37 + Last last;
  38 +
  39 + @JsonKey(name: 'count')
  40 + Count count;
  41 +
  42 + @JsonKey(name: 'marketing')
  43 + List<Marketing> marketing;
  44 +
  45 + GuestInfoSunModel(
  46 + this.guest,
  47 + this.last,
  48 + this.count,
  49 + this.marketing,
  50 + );
  51 +
  52 + factory GuestInfoSunModel.fromJson(Map<String, dynamic> srcJson) =>
  53 + _$GuestInfoSunModelFromJson(srcJson);
  54 +
  55 + Map<String, dynamic> toJson() => _$GuestInfoSunModelToJson(this);
  56 +}
  57 +
  58 +@JsonSerializable()
  59 +class Guest extends Object {
  60 + @JsonKey(name: 'id')
  61 + String id;
  62 +
  63 + @JsonKey(name: 'sellerid')
  64 + String sellerid;
  65 +
  66 + @JsonKey(name: 'uid')
  67 + String uid;
  68 +
  69 + @JsonKey(name: 'rname')
  70 + String rname;
  71 +
  72 + @JsonKey(name: 'sex')
  73 + String sex;
  74 +
  75 + @JsonKey(name: 'phone')
  76 + String phone;
  77 +
  78 + @JsonKey(name: 'attr')
  79 + String attr;
  80 +
  81 + @JsonKey(name: 'company')
  82 + String company;
  83 +
  84 + @JsonKey(name: 'section')
  85 + String section;
  86 +
  87 + @JsonKey(name: 'position')
  88 + String position;
  89 + @JsonKey(name: 'taboos')
  90 + String taboos;
  91 + @JsonKey(name: 'like')
  92 + String like;
  93 + @JsonKey(name: 'serve')
  94 + String serve;
  95 + @JsonKey(name: 'c_day')
  96 + List cDay;
  97 + @JsonKey(name: 'udate')
  98 + String udate;
  99 +
  100 + @JsonKey(name: 'label')
  101 + String label;
  102 +
  103 + String get rnameStr {
  104 + if (rname == null || rname == '') return "";
  105 + return rname;
  106 + }
  107 +
  108 + String get sexStr {
  109 + if (sex == null || sex == '') return "";
  110 + switch (sex.toString()) {
  111 + case "1": //先生
  112 + case "男":
  113 + case "先生":
  114 + return "先生";
  115 + case "2": //女士
  116 + case "女":
  117 + case "女士":
  118 + return "女士";
  119 + case "3": //公司
  120 + case "公司":
  121 + return "公司";
  122 + }
  123 + }
  124 +
  125 + Guest(
  126 + this.id,
  127 + this.sellerid,
  128 + this.uid,
  129 + this.rname,
  130 + this.sex,
  131 + this.phone,
  132 + this.attr,
  133 + this.company,
  134 + this.section,
  135 + this.position,
  136 + this.taboos,
  137 + this.like,
  138 + this.serve,
  139 + this.cDay,
  140 + this.udate,
  141 + this.label);
  142 +
  143 + factory Guest.fromJson(Map<String, dynamic> srcJson) =>
  144 + _$GuestFromJson(srcJson);
  145 +
  146 + Map<String, dynamic> toJson() => _$GuestToJson(this);
  147 +}
  148 +
  149 +@JsonSerializable()
  150 +class Last extends Object {
  151 + @JsonKey(name: 'id')
  152 + String id;
  153 +
  154 + @JsonKey(name: 'ddate')
  155 + String ddate;
  156 +
  157 + @JsonKey(name: 'ddate_solt')
  158 + String ddateSolt;
  159 +
  160 + @JsonKey(name: 'tableinfo')
  161 + String tableinfo;
  162 +
  163 + @JsonKey(name: 'uid')
  164 + String uid;
  165 +
  166 + @JsonKey(name: 'seller_user_nick_name')
  167 + String sellerUserNickName;
  168 +
  169 + @JsonKey(name: 'seller_user_phone')
  170 + String sellerUserPhone;
  171 + @JsonKey(name: 'actual_pum')
  172 + String actualPum;
  173 + @JsonKey(name: 'con_amount')
  174 + String conAmount;
  175 +
  176 + String get ddateSoltStr {
  177 + switch (ddateSolt) {
  178 + case "1":
  179 + return " 早餐";
  180 + break;
  181 + case "2":
  182 + return " 午餐";
  183 + break;
  184 + case "3":
  185 + return " 晚餐";
  186 + break;
  187 + }
  188 + return '';
  189 + }
  190 +
  191 + String get tableinfoName {
  192 + List<dynamic> tableinfoList = convert.jsonDecode(tableinfo);
  193 + print(tableinfo);
  194 + String _nameStr = '';
  195 +
  196 + for (int i = 0; i < tableinfoList.length; i++) {
  197 + _nameStr += '${t.TableList.fromJson(tableinfoList[i]).name},';
  198 + }
  199 + if (_nameStr.endsWith(',')) {
  200 + _nameStr = _nameStr.substring(0, _nameStr.length - 1);
  201 + }
  202 + return _nameStr;
  203 + }
  204 +
  205 + Last(
  206 + this.id,
  207 + this.ddate,
  208 + this.ddateSolt,
  209 + this.tableinfo,
  210 + this.uid,
  211 + this.sellerUserNickName,
  212 + this.sellerUserPhone,
  213 + this.actualPum,
  214 + this.conAmount);
  215 +
  216 + factory Last.fromJson(Map<String, dynamic> srcJson) =>
  217 + _$LastFromJson(srcJson);
  218 +
  219 + Map<String, dynamic> toJson() => _$LastToJson(this);
  220 +}
  221 +
  222 +@JsonSerializable()
  223 +class Count extends Object {
  224 + @JsonKey(name: 'leiji')
  225 + String leiji;
  226 +
  227 + @JsonKey(name: 'quxiao')
  228 + int quxiao;
  229 +
  230 + @JsonKey(name: 'create_time')
  231 + int createTime;
  232 +
  233 + Count(
  234 + this.leiji,
  235 + this.quxiao,
  236 + this.createTime,
  237 + );
  238 +
  239 + factory Count.fromJson(Map<String, dynamic> srcJson) =>
  240 + _$CountFromJson(srcJson);
  241 +
  242 + Map<String, dynamic> toJson() => _$CountToJson(this);
  243 +}
  244 +
  245 +@JsonSerializable()
  246 +class Marketing extends Object {
  247 + @JsonKey(name: 'id')
  248 + String id;
  249 +
  250 + @JsonKey(name: 'uid')
  251 + String uid;
  252 +
  253 + @JsonKey(name: 'aid')
  254 + String aid;
  255 +
  256 + @JsonKey(name: 'gid')
  257 + String gid;
  258 +
  259 + @JsonKey(name: 'content')
  260 + String content;
  261 +
  262 + @JsonKey(name: 'cdate')
  263 + String cdate;
  264 +
  265 + String get cdateStr {
  266 + DateTime dateTime =
  267 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
  268 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  269 + }
  270 +
  271 + Marketing(
  272 + this.id,
  273 + this.uid,
  274 + this.aid,
  275 + this.gid,
  276 + this.content,
  277 + this.cdate,
  278 + );
  279 +
  280 + factory Marketing.fromJson(Map<String, dynamic> srcJson) =>
  281 + _$MarketingFromJson(srcJson);
  282 +
  283 + Map<String, dynamic> toJson() => _$MarketingToJson(this);
  284 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'guest_info_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +GuestInfoModel _$GuestInfoModelFromJson(Map<String, dynamic> json) {
  10 + return GuestInfoModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : GuestInfoSunModel.fromJson(json['data'] as Map<String, dynamic>),
  15 + json['msg'] as String,
  16 + );
  17 +}
  18 +
  19 +Map<String, dynamic> _$GuestInfoModelToJson(GuestInfoModel instance) =>
  20 + <String, dynamic>{
  21 + 'ret': instance.ret,
  22 + 'data': instance.data,
  23 + 'msg': instance.msg,
  24 + };
  25 +
  26 +GuestInfoSunModel _$GuestInfoSunModelFromJson(Map<String, dynamic> json) {
  27 + return GuestInfoSunModel(
  28 + json['guest'] == null
  29 + ? null
  30 + : Guest.fromJson(json['guest'] as Map<String, dynamic>),
  31 + json['last'] == null
  32 + ? null
  33 + : Last.fromJson(json['last'] as Map<String, dynamic>),
  34 + json['count'] == null
  35 + ? null
  36 + : Count.fromJson(json['count'] as Map<String, dynamic>),
  37 + (json['marketing'] as List)
  38 + ?.map((e) =>
  39 + e == null ? null : Marketing.fromJson(e as Map<String, dynamic>))
  40 + ?.toList(),
  41 + );
  42 +}
  43 +
  44 +Map<String, dynamic> _$GuestInfoSunModelToJson(GuestInfoSunModel instance) =>
  45 + <String, dynamic>{
  46 + 'guest': instance.guest,
  47 + 'last': instance.last,
  48 + 'count': instance.count,
  49 + 'marketing': instance.marketing,
  50 + };
  51 +
  52 +Guest _$GuestFromJson(Map<String, dynamic> json) {
  53 + return Guest(
  54 + json['id'] as String,
  55 + json['sellerid'] as String,
  56 + json['uid'] as String,
  57 + json['rname'] as String,
  58 + json['sex'] as String,
  59 + json['phone'] as String,
  60 + json['attr'] as String,
  61 + json['company'] as String,
  62 + json['section'] as String,
  63 + json['position'] as String,
  64 + json['taboos'] as String,
  65 + json['like'] as String,
  66 + json['serve'] as String,
  67 + json['c_day'] as List,
  68 + json['udate'] as String,
  69 + json['label'] as String,
  70 + );
  71 +}
  72 +
  73 +Map<String, dynamic> _$GuestToJson(Guest instance) => <String, dynamic>{
  74 + 'id': instance.id,
  75 + 'sellerid': instance.sellerid,
  76 + 'uid': instance.uid,
  77 + 'rname': instance.rname,
  78 + 'sex': instance.sex,
  79 + 'phone': instance.phone,
  80 + 'attr': instance.attr,
  81 + 'company': instance.company,
  82 + 'section': instance.section,
  83 + 'position': instance.position,
  84 + 'taboos': instance.taboos,
  85 + 'like': instance.like,
  86 + 'serve': instance.serve,
  87 + 'c_day': instance.cDay,
  88 + 'udate': instance.udate,
  89 + 'label': instance.label,
  90 + };
  91 +
  92 +Last _$LastFromJson(Map<String, dynamic> json) {
  93 + return Last(
  94 + json['id'] as String,
  95 + json['ddate'] as String,
  96 + json['ddate_solt'] as String,
  97 + json['tableinfo'] as String,
  98 + json['uid'] as String,
  99 + json['seller_user_nick_name'] as String,
  100 + json['seller_user_phone'] as String,
  101 + json['actual_pum'] as String,
  102 + json['con_amount'] as String,
  103 + );
  104 +}
  105 +
  106 +Map<String, dynamic> _$LastToJson(Last instance) => <String, dynamic>{
  107 + 'id': instance.id,
  108 + 'ddate': instance.ddate,
  109 + 'ddate_solt': instance.ddateSolt,
  110 + 'tableinfo': instance.tableinfo,
  111 + 'uid': instance.uid,
  112 + 'seller_user_nick_name': instance.sellerUserNickName,
  113 + 'seller_user_phone': instance.sellerUserPhone,
  114 + 'actual_pum': instance.actualPum,
  115 + 'con_amount': instance.conAmount,
  116 + };
  117 +
  118 +Count _$CountFromJson(Map<String, dynamic> json) {
  119 + return Count(
  120 + json['leiji'] as String,
  121 + json['quxiao'] as int,
  122 + json['create_time'] as int,
  123 + );
  124 +}
  125 +
  126 +Map<String, dynamic> _$CountToJson(Count instance) => <String, dynamic>{
  127 + 'leiji': instance.leiji,
  128 + 'quxiao': instance.quxiao,
  129 + 'create_time': instance.createTime,
  130 + };
  131 +
  132 +Marketing _$MarketingFromJson(Map<String, dynamic> json) {
  133 + return Marketing(
  134 + json['id'] as String,
  135 + json['uid'] as String,
  136 + json['aid'] as String,
  137 + json['gid'] as String,
  138 + json['content'] as String,
  139 + json['cdate'] as String,
  140 + );
  141 +}
  142 +
  143 +Map<String, dynamic> _$MarketingToJson(Marketing instance) => <String, dynamic>{
  144 + 'id': instance.id,
  145 + 'uid': instance.uid,
  146 + 'aid': instance.aid,
  147 + 'gid': instance.gid,
  148 + 'content': instance.content,
  149 + 'cdate': instance.cdate,
  150 + };
@@ -191,7 +191,7 @@ class DioUtil { @@ -191,7 +191,7 @@ class DioUtil {
191 queryParameters: data, 191 queryParameters: data,
192 options: _checkOptions(method, options, needHeader: needHeader), 192 options: _checkOptions(method, options, needHeader: needHeader),
193 cancelToken: cancelToken); 193 cancelToken: cancelToken);
194 - _printHttpLog(response); 194 + _printHttpLog(response);
195 String _status; 195 String _status;
196 int _code; 196 int _code;
197 String _msg; 197 String _msg;
@@ -174,5 +174,7 @@ class HttpUrl { @@ -174,5 +174,7 @@ class HttpUrl {
174 174
175 static const String get_customer_list = 175 static const String get_customer_list =
176 "?service=App.GuestManage.GetCustomerList"; //用来获取客户列表 176 "?service=App.GuestManage.GetCustomerList"; //用来获取客户列表
  177 + static const String get_guest_info =
  178 + "?service=App.GuestManage.GetGuestInfo"; // 获取客户详情
177 179
178 } 180 }
@@ -257,7 +257,7 @@ class _ContactListPageState extends State<ContactListPage> { @@ -257,7 +257,7 @@ class _ContactListPageState extends State<ContactListPage> {
257 // crossAxisAlignment: CrossAxisAlignment.end, 257 // crossAxisAlignment: CrossAxisAlignment.end,
258 children: [ 258 children: [
259 Text( 259 Text(
260 - Utils.format(model.ddate), 260 + Utils.formatFromYmd(model.ddate),
261 style: TextStyle( 261 style: TextStyle(
262 color: Color.fromRGBO(208, 31, 37, 1), 262 color: Color.fromRGBO(208, 31, 37, 1),
263 fontSize: ScreenUtil().setSp(24), 263 fontSize: ScreenUtil().setSp(24),
@@ -349,7 +349,7 @@ class _ContactListPageState extends State<ContactListPage> { @@ -349,7 +349,7 @@ class _ContactListPageState extends State<ContactListPage> {
349 CustomerListSunModel model = widget.contacts[index]; 349 CustomerListSunModel model = widget.contacts[index];
350 return InkWell( 350 return InkWell(
351 onTap: () { 351 onTap: () {
352 - NavigatorUtil.goCustomerDetailPage(context, model); 352 + NavigatorUtil.goCustomerDetailPage(context, model, widget.fromPage);
353 }, 353 },
354 child: _buildListItem(model), 354 child: _buildListItem(model),
355 ); 355 );
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/customer_list_model.dart'; 4 import 'package:one_key/models/customer_list_model.dart';
  5 +import 'package:one_key/models/guest_info_model.dart';
4 import 'package:one_key/models/user_history_entity.dart'; 6 import 'package:one_key/models/user_history_entity.dart';
  7 +import 'package:one_key/provider/customer_provider.dart';
5 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/route/navigator_util.dart'; 9 import 'package:one_key/route/navigator_util.dart';
7 import 'package:one_key/utils/dialog_util.dart'; 10 import 'package:one_key/utils/dialog_util.dart';
8 import 'package:one_key/utils/utils.dart'; 11 import 'package:one_key/utils/utils.dart';
9 import 'package:one_key/widgets/h_empty_view.dart'; 12 import 'package:one_key/widgets/h_empty_view.dart';
  13 +import 'package:one_key/widgets/page_exception.dart';
10 import 'package:one_key/widgets/round_button.dart'; 14 import 'package:one_key/widgets/round_button.dart';
11 import 'package:one_key/widgets/system_app_bar.dart'; 15 import 'package:one_key/widgets/system_app_bar.dart';
12 import 'package:one_key/widgets/v_empty_view.dart'; 16 import 'package:one_key/widgets/v_empty_view.dart';
  17 +import 'package:provider/provider.dart';
13 18
14 class CustomerDetailPage extends StatefulWidget { 19 class CustomerDetailPage extends StatefulWidget {
15 final CustomerListSunModel userHistoryEntity; 20 final CustomerListSunModel userHistoryEntity;
16 - CustomerDetailPage({Key key, this.userHistoryEntity}) : super(key: key); 21 + final FromPage fromPage;
  22 +
  23 + CustomerDetailPage({Key key, this.userHistoryEntity, this.fromPage})
  24 + : super(key: key);
17 25
18 @override 26 @override
19 _CustomerDetailPageState createState() => _CustomerDetailPageState(); 27 _CustomerDetailPageState createState() => _CustomerDetailPageState();
@@ -21,6 +29,26 @@ class CustomerDetailPage extends StatefulWidget { @@ -21,6 +29,26 @@ class CustomerDetailPage extends StatefulWidget {
21 29
22 class _CustomerDetailPageState extends State<CustomerDetailPage> { 30 class _CustomerDetailPageState extends State<CustomerDetailPage> {
23 ScrollController controller = ScrollController(); 31 ScrollController controller = ScrollController();
  32 + CustomerProvider customerProvider;
  33 +
  34 + @override
  35 + void initState() {
  36 + super.initState();
  37 +
  38 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  39 + _getGuestInfo();
  40 + });
  41 + }
  42 +
  43 + _getGuestInfo() async {
  44 + Map<String, String> params = {
  45 + "id": widget.userHistoryEntity.id,
  46 + 'phone': widget.userHistoryEntity.phone
  47 + };
  48 + await customerProvider.getGuestInfo(context, params);
  49 + // await customerProvider.searchData(customerProvider.controller.text);
  50 + }
  51 +
24 Widget _headerWidget() { 52 Widget _headerWidget() {
25 return Container( 53 return Container(
26 padding: EdgeInsets.symmetric( 54 padding: EdgeInsets.symmetric(
@@ -46,18 +74,20 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -46,18 +74,20 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
46 Container( 74 Container(
47 width: ScreenUtil().setWidth(120), 75 width: ScreenUtil().setWidth(120),
48 height: ScreenUtil().setWidth(120), 76 height: ScreenUtil().setWidth(120),
  77 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
49 alignment: Alignment.center, 78 alignment: Alignment.center,
50 decoration: BoxDecoration( 79 decoration: BoxDecoration(
51 color: Color.fromRGBO(239, 239, 239, 1), 80 color: Color.fromRGBO(239, 239, 239, 1),
52 borderRadius: 81 borderRadius:
53 BorderRadius.circular(ScreenUtil().setWidth(20))), 82 BorderRadius.circular(ScreenUtil().setWidth(20))),
54 child: Text( 83 child: Text(
55 - widget.userHistoryEntity.rnameStr != ''  
56 - ? widget.userHistoryEntity.rnameStr.substring(0, 1) 84 + customerProvider.guestInfoSunModel.guest.rnameStr != ''
  85 + ? customerProvider.guestInfoSunModel.guest.rnameStr
  86 + .substring(0, 1)
57 : '', 87 : '',
58 style: TextStyle( 88 style: TextStyle(
59 color: Color.fromRGBO(206, 206, 206, 1), 89 color: Color.fromRGBO(206, 206, 206, 1),
60 - fontSize: ScreenUtil().setSp(78)), 90 + fontSize: ScreenUtil().setSp(72)),
61 ), 91 ),
62 ), 92 ),
63 Positioned( 93 Positioned(
@@ -68,37 +98,60 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -68,37 +98,60 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
68 vertical: ScreenUtil().setWidth(2), 98 vertical: ScreenUtil().setWidth(2),
69 ), 99 ),
70 decoration: BoxDecoration( 100 decoration: BoxDecoration(
71 - color: Color.fromRGBO(223, 33, 81, 1), 101 + color: customerProvider
  102 + .guestInfoSunModel.guest.attr !=
  103 + null &&
  104 + customerProvider
  105 + .guestInfoSunModel.guest.attr !=
  106 + ''
  107 + ? customerProvider
  108 + .guestInfoSunModel.guest.attr ==
  109 + '沉睡'
  110 + ? Color.fromRGBO(223, 33, 81, 1)
  111 + : customerProvider
  112 + .guestInfoSunModel.guest.attr ==
  113 + '活跃'
  114 + ? Color.fromRGBO(81, 170, 94, 1)
  115 + : customerProvider.guestInfoSunModel
  116 + .guest.attr ==
  117 + '流失'
  118 + ? Color.fromRGBO(109, 101, 248, 1)
  119 + : Color.fromRGBO(239, 143, 49, 1)
  120 + : Colors.transparent,
72 borderRadius: BorderRadius.circular( 121 borderRadius: BorderRadius.circular(
73 ScreenUtil().setWidth(10), 122 ScreenUtil().setWidth(10),
74 ), 123 ),
75 ), 124 ),
76 - child: Text('沉睡', 125 + child: Text(
  126 + customerProvider.guestInfoSunModel.guest.attr,
77 style: TextStyle( 127 style: TextStyle(
78 color: MyColours.color_ffffff, 128 color: MyColours.color_ffffff,
79 fontSize: ScreenUtil().setSp(28))))) 129 fontSize: ScreenUtil().setSp(28)))))
80 ], 130 ],
81 ), 131 ),
82 - VEmptyView(40),  
83 - Container(  
84 - padding:  
85 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(10)),  
86 - decoration: BoxDecoration(  
87 - border: Border.all(  
88 - color: MyColours.color_199095,  
89 - width: ScreenUtil().setWidth(2)),  
90 - borderRadius:  
91 - BorderRadius.circular(ScreenUtil().setWidth(10))),  
92 - child: Text(  
93 - // widget.userHistoryEntity.rnameStr == ''  
94 - // ? '未指派经理'  
95 - // : widget.userHistoryEntity.rnameStr,  
96 - 'xxx经理',  
97 - style: TextStyle(  
98 - color: MyColours.color_333333,  
99 - fontSize: ScreenUtil().setSp(26)),  
100 - ),  
101 - ) 132 + widget.fromPage == FromPage.FromPageStoreCustomer
  133 + ? Container(
  134 + padding: EdgeInsets.only(
  135 + top: ScreenUtil().setWidth(40),
  136 + left: ScreenUtil().setWidth(10),
  137 + right: ScreenUtil().setWidth(10)),
  138 + decoration: BoxDecoration(
  139 + border: Border.all(
  140 + color: MyColours.color_199095,
  141 + width: ScreenUtil().setWidth(2)),
  142 + borderRadius:
  143 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  144 + child: Text(
  145 + // widget.userHistoryEntity.rnameStr == ''
  146 + // ? '未指派经理'
  147 + // : widget.userHistoryEntity.rnameStr,
  148 + 'xxx经理',
  149 + style: TextStyle(
  150 + color: MyColours.color_333333,
  151 + fontSize: ScreenUtil().setSp(26)),
  152 + ),
  153 + )
  154 + : SizedBox()
102 ], 155 ],
103 ), 156 ),
104 HEmptyView(30), 157 HEmptyView(30),
@@ -112,16 +165,16 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -112,16 +165,16 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
112 constraints: 165 constraints:
113 BoxConstraints(maxWidth: ScreenUtil().setWidth(260)), 166 BoxConstraints(maxWidth: ScreenUtil().setWidth(260)),
114 child: Text( 167 child: Text(
115 - widget.userHistoryEntity.rnameStr, 168 + customerProvider.guestInfoSunModel.guest.rnameStr,
116 overflow: TextOverflow.ellipsis, 169 overflow: TextOverflow.ellipsis,
117 style: TextStyle( 170 style: TextStyle(
118 color: MyColours.color_333333, 171 color: MyColours.color_333333,
119 - fontSize: ScreenUtil().setSp(68)), 172 + fontSize: ScreenUtil().setSp(64)),
120 )), 173 )),
121 HEmptyView(10), 174 HEmptyView(10),
122 Text( 175 Text(
123 - widget.userHistoryEntity.sexStr != ''  
124 - ? '[${widget.userHistoryEntity.sexStr}]' 176 + customerProvider.guestInfoSunModel.guest.sexStr != ''
  177 + ? '[${customerProvider.guestInfoSunModel.guest.sexStr}]'
125 : '', 178 : '',
126 style: TextStyle( 179 style: TextStyle(
127 color: MyColours.color_333333, 180 color: MyColours.color_333333,
@@ -130,22 +183,25 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -130,22 +183,25 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
130 ), 183 ),
131 ], 184 ],
132 ), 185 ),
133 - VEmptyView(10),  
134 - Container(  
135 - constraints:  
136 - BoxConstraints(maxWidth: ScreenUtil().setWidth(200)),  
137 - child: Text(  
138 - '低频高消费',  
139 - overflow: TextOverflow.ellipsis,  
140 - style: TextStyle(  
141 - color: Color.fromRGBO(193, 194, 63, 1),  
142 - fontSize: ScreenUtil().setSp(22),  
143 - ),  
144 - )), 186 + customerProvider.guestInfoSunModel.guest.label != null
  187 + ? Container(
  188 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
  189 + constraints:
  190 + BoxConstraints(maxWidth: ScreenUtil().setWidth(200)),
  191 + child: Text(
  192 + customerProvider.guestInfoSunModel.guest.label,
  193 + overflow: TextOverflow.ellipsis,
  194 + style: TextStyle(
  195 + color: Color.fromRGBO(193, 194, 63, 1),
  196 + fontSize: ScreenUtil().setSp(22),
  197 + ),
  198 + ))
  199 + : SizedBox(),
145 VEmptyView(20), 200 VEmptyView(20),
146 InkWell( 201 InkWell(
147 onTap: () { 202 onTap: () {
148 - DialogUtil.goPhone(widget.userHistoryEntity.phone); 203 + DialogUtil.goPhone(
  204 + customerProvider.guestInfoSunModel.guest.phone);
149 }, 205 },
150 child: Container( 206 child: Container(
151 padding: EdgeInsets.symmetric( 207 padding: EdgeInsets.symmetric(
@@ -163,12 +219,12 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -163,12 +219,12 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
163 ), 219 ),
164 HEmptyView(10), 220 HEmptyView(10),
165 Text( 221 Text(
166 - widget.userHistoryEntity.phone, 222 + customerProvider.guestInfoSunModel.guest.phone,
167 overflow: TextOverflow.ellipsis, 223 overflow: TextOverflow.ellipsis,
168 style: TextStyle( 224 style: TextStyle(
169 color: MyColours.color_ffffff, 225 color: MyColours.color_ffffff,
170 fontWeight: FontWeight.bold, 226 fontWeight: FontWeight.bold,
171 - fontSize: ScreenUtil().setSp(36), 227 + fontSize: ScreenUtil().setSp(34),
172 ), 228 ),
173 ) 229 )
174 ], 230 ],
@@ -219,6 +275,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -219,6 +275,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
219 275
220 @override 276 @override
221 Widget build(BuildContext context) { 277 Widget build(BuildContext context) {
  278 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
222 return Scaffold( 279 return Scaffold(
223 backgroundColor: Color.fromRGBO(246, 248, 250, 1), 280 backgroundColor: Color.fromRGBO(246, 248, 250, 1),
224 appBar: SystemAppBar( 281 appBar: SystemAppBar(
@@ -227,253 +284,298 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -227,253 +284,298 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
227 Navigator.of(context).pop(); 284 Navigator.of(context).pop();
228 }, 285 },
229 ), 286 ),
230 - body: Column(  
231 - children: [  
232 - Expanded(  
233 - child: SingleChildScrollView(  
234 - controller: controller,  
235 - child: Column(  
236 - children: [  
237 - Container(  
238 - width: double.infinity,  
239 - height: ScreenUtil().setWidth(20),  
240 - color: MyColours.color_ffffff,  
241 - ),  
242 - _headerWidget(),  
243 - VEmptyView(20),  
244 - Container(  
245 - padding: EdgeInsets.symmetric(  
246 - horizontal: ScreenUtil().setWidth(40),  
247 - vertical: ScreenUtil().setWidth(20)),  
248 - decoration: BoxDecoration(  
249 - color: MyColours.color_199095,  
250 - borderRadius: BorderRadius.only(  
251 - topRight: Radius.circular(ScreenUtil().setWidth(20)),  
252 - topLeft: Radius.circular(ScreenUtil().setWidth(20)))),  
253 - child: Row(  
254 - children: [  
255 - Expanded(  
256 - child: Text(  
257 - '已创建 97 天 累计 2 单',  
258 - overflow: TextOverflow.ellipsis,  
259 - style: TextStyle(  
260 - color: MyColours.color_ffffff,  
261 - fontSize: ScreenUtil().setSp(32)),  
262 - )),  
263 - InkWell(  
264 - onTap: () {  
265 - NavigatorUtil.goCustomerOrderPage(context);  
266 - },  
267 - child: Text('更多',  
268 - style: TextStyle(  
269 - decoration: TextDecoration.underline,  
270 - color: MyColours.color_ffffff,  
271 - fontSize: ScreenUtil().setSp(26)))),  
272 - ],  
273 - ),  
274 - ),  
275 - Container(  
276 - color: MyColours.color_ffffff,  
277 - padding: EdgeInsets.symmetric(  
278 - horizontal: ScreenUtil().setWidth(20),  
279 - vertical: ScreenUtil().setWidth(20)),  
280 - child: Column(  
281 - children: [  
282 - Wrap( 287 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  288 + if (model.pageStateGuestInfo != PageState.Success) {
  289 + return ExceptionPage(
  290 + pageState: model.pageStateGuestInfo,
  291 + callback: () {
  292 + model.pageStateGuestInfo = PageState.Loading;
  293 + model.notifyListeners();
  294 + _getGuestInfo();
  295 + },
  296 + emptyMsg: "暂时没有客户哦",
  297 + emptyImg: "empty_search",
  298 + showMsg: "加载中,请稍后...",
  299 + );
  300 + } else {
  301 + return Column(
  302 + children: [
  303 + Expanded(
  304 + child: SingleChildScrollView(
  305 + controller: controller,
  306 + child: Column(
  307 + children: [
  308 + Container(
  309 + width: double.infinity,
  310 + height: ScreenUtil().setWidth(20),
  311 + color: MyColours.color_ffffff,
  312 + ),
  313 + _headerWidget(),
  314 + VEmptyView(20),
  315 + Container(
  316 + padding: EdgeInsets.symmetric(
  317 + horizontal: ScreenUtil().setWidth(40),
  318 + vertical: ScreenUtil().setWidth(20)),
  319 + decoration: BoxDecoration(
  320 + color: MyColours.color_199095,
  321 + borderRadius: BorderRadius.only(
  322 + topRight:
  323 + Radius.circular(ScreenUtil().setWidth(20)),
  324 + topLeft:
  325 + Radius.circular(ScreenUtil().setWidth(20)))),
  326 + child: Row(
283 children: [ 327 children: [
284 - Text(  
285 - '最近一次:',  
286 - style: TextStyle(  
287 - fontSize: ScreenUtil().setSp(26),  
288 - color: MyColours.color_333333),  
289 - ),  
290 - Text(  
291 - '3天后 ', 328 + Expanded(
  329 + child: Text(
  330 + '已创建 ${customerProvider.guestInfoSunModel.count.createTime} 天 | 累计 ${customerProvider.guestInfoSunModel.count.leiji} 单 | 取消 ${customerProvider.guestInfoSunModel.count.quxiao} 单',
292 overflow: TextOverflow.ellipsis, 331 overflow: TextOverflow.ellipsis,
293 style: TextStyle( 332 style: TextStyle(
294 - fontSize: ScreenUtil().setSp(26),  
295 - color: Color.fromRGBO(193, 194, 63, 1)),  
296 - ),  
297 - Text(  
298 - '午餐',  
299 - style: TextStyle(  
300 - fontSize: ScreenUtil().setSp(26),  
301 - color: MyColours.color_199095),  
302 - ),  
303 - Text(  
304 - ' 桌位:',  
305 - style: TextStyle(  
306 - fontSize: ScreenUtil().setSp(26),  
307 - color: MyColours.color_333333),  
308 - ),  
309 - Text(  
310 - 'vip5',  
311 - style: TextStyle(  
312 - fontSize: ScreenUtil().setSp(26),  
313 - color: MyColours.color_199095),  
314 - ),  
315 - Text(  
316 - ' 人数:',  
317 - style: TextStyle(  
318 - fontSize: ScreenUtil().setSp(26),  
319 - color: MyColours.color_333333),  
320 - ),  
321 - Text(  
322 - '未记录',  
323 - style: TextStyle(  
324 - fontSize: ScreenUtil().setSp(26),  
325 - color: MyColours.color_199095),  
326 - ),  
327 - Text(  
328 - ' 消费:',  
329 - style: TextStyle(  
330 - fontSize: ScreenUtil().setSp(26),  
331 - color: MyColours.color_333333),  
332 - ),  
333 - Text(  
334 - '未记录',  
335 - style: TextStyle(  
336 - fontSize: ScreenUtil().setSp(26),  
337 - color: MyColours.color_199095),  
338 - ) 333 + color: MyColours.color_ffffff,
  334 + fontSize: ScreenUtil().setSp(30)),
  335 + )),
  336 + InkWell(
  337 + onTap: () {
  338 + NavigatorUtil.goCustomerOrderPage(context);
  339 + },
  340 + child: Text('更多',
  341 + style: TextStyle(
  342 + decoration: TextDecoration.underline,
  343 + color: MyColours.color_ffffff,
  344 + fontSize: ScreenUtil().setSp(26)))),
339 ], 345 ],
340 ), 346 ),
341 - Row(  
342 - mainAxisAlignment: MainAxisAlignment.center, 347 + ),
  348 + Container(
  349 + color: MyColours.color_ffffff,
  350 + padding: EdgeInsets.symmetric(
  351 + horizontal: ScreenUtil().setWidth(20),
  352 + vertical: ScreenUtil().setWidth(20)),
  353 + child: Column(
343 children: [ 354 children: [
344 - Text(  
345 - '客户经理:',  
346 - style: TextStyle(  
347 - fontSize: ScreenUtil().setSp(26),  
348 - color: MyColours.color_333333), 355 + Wrap(
  356 + children: [
  357 + Text(
  358 + '最近一次:',
  359 + style: TextStyle(
  360 + fontSize: ScreenUtil().setSp(24),
  361 + color: MyColours.color_333333),
  362 + ),
  363 + Text(
  364 + Utils.formatFromMill(customerProvider
  365 + .guestInfoSunModel.last.ddate),
  366 + overflow: TextOverflow.ellipsis,
  367 + style: TextStyle(
  368 + fontSize: ScreenUtil().setSp(24),
  369 + color: Color.fromRGBO(208, 31, 37, 1)),
  370 + ),
  371 + Text(
  372 + customerProvider
  373 + .guestInfoSunModel.last.ddateSoltStr,
  374 + style: TextStyle(
  375 + fontSize: ScreenUtil().setSp(24),
  376 + color: MyColours.color_199095),
  377 + ),
  378 + Text(
  379 + ' 桌位:',
  380 + style: TextStyle(
  381 + fontSize: ScreenUtil().setSp(24),
  382 + color: MyColours.color_333333),
  383 + ),
  384 + Text(
  385 + customerProvider
  386 + .guestInfoSunModel.last.tableinfoName,
  387 + style: TextStyle(
  388 + fontSize: ScreenUtil().setSp(24),
  389 + color: MyColours.color_199095),
  390 + ),
  391 + Text(
  392 + ' 人数:',
  393 + style: TextStyle(
  394 + fontSize: ScreenUtil().setSp(24),
  395 + color: MyColours.color_333333),
  396 + ),
  397 + Text(
  398 + customerProvider
  399 + .guestInfoSunModel.last.actualPum ==
  400 + null
  401 + ? '未记录'
  402 + : customerProvider
  403 + .guestInfoSunModel.last.actualPum,
  404 + style: TextStyle(
  405 + fontSize: ScreenUtil().setSp(24),
  406 + color: MyColours.color_199095),
  407 + ),
  408 + Text(
  409 + ' 消费:',
  410 + style: TextStyle(
  411 + fontSize: ScreenUtil().setSp(24),
  412 + color: MyColours.color_333333),
  413 + ),
  414 + Text(
  415 + customerProvider
  416 + .guestInfoSunModel.last.conAmount ==
  417 + null
  418 + ? '未记录'
  419 + : customerProvider
  420 + .guestInfoSunModel.last.conAmount,
  421 + style: TextStyle(
  422 + fontSize: ScreenUtil().setSp(24),
  423 + color: MyColours.color_199095),
  424 + )
  425 + ],
349 ), 426 ),
350 - Text(  
351 - 'xxx 18799999999',  
352 - style: TextStyle(  
353 - fontSize: ScreenUtil().setSp(26),  
354 - color: MyColours.color_199095), 427 + VEmptyView(6),
  428 + Row(
  429 + mainAxisAlignment: MainAxisAlignment.center,
  430 + children: [
  431 + Text(
  432 + '客户经理:',
  433 + style: TextStyle(
  434 + fontSize: ScreenUtil().setSp(24),
  435 + color: MyColours.color_333333),
  436 + ),
  437 + Text(
  438 + '${customerProvider.guestInfoSunModel.last.sellerUserNickName} ${customerProvider.guestInfoSunModel.last.sellerUserPhone}',
  439 + style: TextStyle(
  440 + fontSize: ScreenUtil().setSp(24),
  441 + color: MyColours.color_199095),
  442 + )
  443 + ],
355 ) 444 )
356 ], 445 ],
357 - )  
358 - ],  
359 - ),  
360 - ),  
361 - VEmptyView(20),  
362 - _lineItemWidget('工作单位', '政府部门 办公室主任'),  
363 - VEmptyView(20),  
364 - _lineItemWidget('忌口', '葱姜蒜'),  
365 - VEmptyView(20),  
366 - _lineItemWidget('喜好', '酸甜苦辣'),  
367 - VEmptyView(20),  
368 - _lineItemWidget('服务', '湿巾、茶水'),  
369 - VEmptyView(20),  
370 - Container(  
371 - padding: EdgeInsets.symmetric(  
372 - horizontal: ScreenUtil().setWidth(40),  
373 - vertical: ScreenUtil().setWidth(30)),  
374 - color: MyColours.color_ffffff,  
375 - child: Column(children: [  
376 - Row(  
377 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
378 - children: [  
379 - Text(  
380 - '纪念日',  
381 - style: TextStyle(  
382 - fontSize: ScreenUtil().setSp(36),  
383 - color: MyColours.color_333333), 446 + ),
  447 + ),
  448 + VEmptyView(20),
  449 + _lineItemWidget('工作单位',
  450 + '${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}'),
  451 + VEmptyView(20),
  452 + _lineItemWidget('忌口',
  453 + '${customerProvider.guestInfoSunModel.guest.taboos == null ? '' : customerProvider.guestInfoSunModel.guest.taboos}'),
  454 + VEmptyView(20),
  455 + _lineItemWidget('喜好',
  456 + '${customerProvider.guestInfoSunModel.guest.like == null ? '' : customerProvider.guestInfoSunModel.guest.like}'),
  457 + VEmptyView(20),
  458 + _lineItemWidget('服务',
  459 + '${customerProvider.guestInfoSunModel.guest.serve == null ? '' : customerProvider.guestInfoSunModel.guest.serve}'),
  460 + VEmptyView(20),
  461 + Container(
  462 + padding: EdgeInsets.symmetric(
  463 + horizontal: ScreenUtil().setWidth(40),
  464 + vertical: ScreenUtil().setWidth(30)),
  465 + color: MyColours.color_ffffff,
  466 + child: Column(children: [
  467 + Row(
  468 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  469 + children: [
  470 + Text(
  471 + '纪念日',
  472 + style: TextStyle(
  473 + fontSize: ScreenUtil().setSp(36),
  474 + color: MyColours.color_333333),
  475 + ),
  476 + RoundButton(
  477 + text: '编辑',
  478 + radius: ScreenUtil().setWidth(20),
  479 + width: ScreenUtil().setWidth(90),
  480 + height: ScreenUtil().setWidth(50),
  481 + fontSize: 26,
  482 + isBold: false,
  483 + onPressed: () {
  484 + NavigatorUtil.goFestivalEditPage(context);
  485 + },
  486 + ),
  487 + ],
384 ), 488 ),
385 - RoundButton(  
386 - text: '编辑',  
387 - radius: ScreenUtil().setWidth(20),  
388 - width: ScreenUtil().setWidth(90),  
389 - height: ScreenUtil().setWidth(50),  
390 - fontSize: 26,  
391 - isBold: false,  
392 - onPressed: () {  
393 - NavigatorUtil.goFestivalEditPage(context); 489 + ListView.builder(
  490 + shrinkWrap: true,
  491 + itemCount:
  492 + customerProvider.guestInfoSunModel.guest.cDay !=
  493 + null
  494 + ? customerProvider
  495 + .guestInfoSunModel.guest.cDay.length
  496 + : 0,
  497 + controller: controller,
  498 + itemBuilder: (BuildContext context, int index) {
  499 + return Center(
  500 + child: Padding(
  501 + padding: EdgeInsets.symmetric(
  502 + vertical: ScreenUtil().setWidth(10)),
  503 + child: Text(
  504 + '本人生日:12月18日(公历)',
  505 + style: TextStyle(
  506 + fontSize: ScreenUtil().setSp(26),
  507 + color: MyColours.color_333333),
  508 + ),
  509 + ));
394 }, 510 },
395 - ),  
396 - ],  
397 - ),  
398 - ListView.builder(  
399 - shrinkWrap: true,  
400 - itemCount: 10,  
401 - controller: controller,  
402 - itemBuilder: (BuildContext context, int index) {  
403 - return Center(  
404 - child: Padding(  
405 - padding: EdgeInsets.symmetric(  
406 - vertical: ScreenUtil().setWidth(10)),  
407 - child: Text(  
408 - '本人生日:12月18日(公历)',  
409 - style: TextStyle(  
410 - fontSize: ScreenUtil().setSp(26),  
411 - color: MyColours.color_333333),  
412 - ),  
413 - ));  
414 - },  
415 - )  
416 - ])),  
417 - VEmptyView(20),  
418 - Container(  
419 - padding: EdgeInsets.symmetric(  
420 - horizontal: ScreenUtil().setWidth(40),  
421 - vertical: ScreenUtil().setWidth(30)),  
422 - color: MyColours.color_ffffff,  
423 - child: Column(  
424 - children: [  
425 - Row(  
426 - mainAxisAlignment: MainAxisAlignment.spaceBetween, 511 + )
  512 + ])),
  513 + VEmptyView(20),
  514 + Container(
  515 + padding: EdgeInsets.symmetric(
  516 + horizontal: ScreenUtil().setWidth(40),
  517 + vertical: ScreenUtil().setWidth(30)),
  518 + color: MyColours.color_ffffff,
  519 + child: Column(
427 children: [ 520 children: [
428 - Text(  
429 - '营销记录',  
430 - style: TextStyle(  
431 - fontSize: ScreenUtil().setSp(36),  
432 - color: MyColours.color_333333), 521 + Row(
  522 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  523 + children: [
  524 + Text(
  525 + '营销记录',
  526 + style: TextStyle(
  527 + fontSize: ScreenUtil().setSp(36),
  528 + color: MyColours.color_333333),
  529 + ),
  530 + Text(
  531 + '共 ${customerProvider.guestInfoSunModel.marketing?.length} 个',
  532 + style: TextStyle(
  533 + fontSize: ScreenUtil().setSp(26),
  534 + color: MyColours.color_199095),
  535 + )
  536 + ],
433 ), 537 ),
434 - Text(  
435 - '共 1 个',  
436 - style: TextStyle(  
437 - fontSize: ScreenUtil().setSp(26),  
438 - color: MyColours.color_199095), 538 + ListView.builder(
  539 + shrinkWrap: true,
  540 + itemCount: customerProvider
  541 + .guestInfoSunModel.marketing?.length,
  542 + controller: controller,
  543 + itemBuilder: (BuildContext context, int index) {
  544 + Marketing marketing = customerProvider
  545 + .guestInfoSunModel.marketing[index];
  546 + return Center(
  547 + child: Padding(
  548 + padding: EdgeInsets.symmetric(
  549 + vertical: ScreenUtil().setWidth(10)),
  550 + child: Text(
  551 + '${marketing.cdateStr} ${marketing.content}',
  552 + style: TextStyle(
  553 + fontSize: ScreenUtil().setSp(26),
  554 + color: MyColours.color_333333),
  555 + ),
  556 + ));
  557 + },
439 ) 558 )
440 ], 559 ],
441 - ),  
442 - ListView.builder(  
443 - shrinkWrap: true,  
444 - itemCount: 10,  
445 - controller: controller,  
446 - itemBuilder: (BuildContext context, int index) {  
447 - return Center(  
448 - child: Padding(  
449 - padding: EdgeInsets.symmetric(  
450 - vertical: ScreenUtil().setWidth(10)),  
451 - child: Text(  
452 - '2021-12-12 短信营销 承诺优惠98折',  
453 - style: TextStyle(  
454 - fontSize: ScreenUtil().setSp(26),  
455 - color: MyColours.color_333333),  
456 - ),  
457 - ));  
458 - },  
459 - )  
460 - ],  
461 - ))  
462 - ],  
463 - ),  
464 - )),  
465 - RoundButton(  
466 - text: '创建预订',  
467 - radius: ScreenUtil().setWidth(10),  
468 - margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(90)),  
469 - height: ScreenUtil().setWidth(80),  
470 - fontSize: 26,  
471 - isBold: false,  
472 - onPressed: () {},  
473 - ),  
474 - VEmptyView(30)  
475 - ],  
476 - ), 560 + ))
  561 + ],
  562 + ),
  563 + )),
  564 + RoundButton(
  565 + text: '创建预订',
  566 + radius: ScreenUtil().setWidth(10),
  567 + margin:
  568 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(90)),
  569 + height: ScreenUtil().setWidth(80),
  570 + fontSize: 26,
  571 + isBold: false,
  572 + onPressed: () {},
  573 + ),
  574 + VEmptyView(30)
  575 + ],
  576 + );
  577 + }
  578 + }),
477 ); 579 );
478 } 580 }
479 } 581 }
@@ -1010,7 +1010,9 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1010,7 +1010,9 @@ class _CustomerListPageState extends State<CustomerListPage>
1010 resizeToAvoidBottomInset: false, 1010 resizeToAvoidBottomInset: false,
1011 backgroundColor: MyColours.color_ffffff, 1011 backgroundColor: MyColours.color_ffffff,
1012 appBar: SystemAppBar( 1012 appBar: SystemAppBar(
1013 - '全店客户', 1013 + widget.fromPage == FromPage.FromPageMyCustomer
  1014 + ? '我的客户'
  1015 + : '全店客户',
1014 onTap: () { 1016 onTap: () {
1015 Navigator.of(context).pop(); 1017 Navigator.of(context).pop();
1016 }, 1018 },
@@ -5,6 +5,7 @@ import 'package:one_key/constant/constant.dart'; @@ -5,6 +5,7 @@ import 'package:one_key/constant/constant.dart';
5 import 'package:one_key/constant/error.dart'; 5 import 'package:one_key/constant/error.dart';
6 import 'package:one_key/constant/state.dart'; 6 import 'package:one_key/constant/state.dart';
7 import 'package:one_key/models/customer_list_model.dart'; 7 import 'package:one_key/models/customer_list_model.dart';
  8 +import 'package:one_key/models/guest_info_model.dart';
8 import 'package:one_key/models/guest_manage_model.dart'; 9 import 'package:one_key/models/guest_manage_model.dart';
9 import 'package:one_key/models/user_history_entity.dart'; 10 import 'package:one_key/models/user_history_entity.dart';
10 import 'package:one_key/net/base_resp.dart'; 11 import 'package:one_key/net/base_resp.dart';
@@ -30,6 +31,8 @@ class CustomerProvider extends ChangeNotifier { @@ -30,6 +31,8 @@ class CustomerProvider extends ChangeNotifier {
30 PageState pageStateChenshui = PageState.Loading; 31 PageState pageStateChenshui = PageState.Loading;
31 PageState pageStateLiushi = PageState.Loading; 32 PageState pageStateLiushi = PageState.Loading;
32 GuestManageSunModel guestSunmodel; 33 GuestManageSunModel guestSunmodel;
  34 + PageState pageStateGuestInfo = PageState.Loading;
  35 + GuestInfoSunModel guestInfoSunModel;
33 36
34 //用来获取客户列表 37 //用来获取客户列表
35 getCustomerList(BuildContext context, Map<String, String> params) async { 38 getCustomerList(BuildContext context, Map<String, String> params) async {
@@ -120,6 +123,41 @@ class CustomerProvider extends ChangeNotifier { @@ -120,6 +123,41 @@ class CustomerProvider extends ChangeNotifier {
120 } 123 }
121 } 124 }
122 125
  126 + // 获取客户详情
  127 + getGuestInfo(BuildContext context, Map<String, String> params) async {
  128 + BaseResp<dynamic> baseResp = await DioUtil()
  129 + .request<dynamic>(context, Method.get, HttpUrl.get_guest_info,
  130 + data: params, showLoading: false)
  131 + .catchError((error) {
  132 + print(error.toString());
  133 + if (error is MyError) {
  134 + switch (error.type) {
  135 + case 1:
  136 + pageStateGuestInfo = PageState.ConnectivityError;
  137 + break;
  138 + case 2:
  139 + pageStateGuestInfo = PageState.ConnectivityTimeOut;
  140 + break;
  141 + default:
  142 + pageStateGuestInfo = PageState.ConnectivityError;
  143 + break;
  144 + }
  145 + }
  146 + notifyListeners();
  147 + });
  148 + if (baseResp != null && baseResp.code == Constant.status_success) {
  149 + pageStateGuestInfo = PageState.Success;
  150 + guestInfoSunModel = GuestInfoModel.fromJson(baseResp.responseData).data;
  151 + notifyListeners();
  152 + } else {
  153 + if (baseResp != null) {
  154 + Utils.showToast(baseResp.msg ?? "");
  155 + }
  156 + pageStateGuestInfo = PageState.ConnectivityTimeOut;
  157 + }
  158 + notifyListeners();
  159 + }
  160 +
123 // //获取历史录入 161 // //获取历史录入
124 // getUserHistorys(BuildContext context, Map<String, String> params) async { 162 // getUserHistorys(BuildContext context, Map<String, String> params) async {
125 // BaseResp<List> baseResp = await DioUtil() 163 // BaseResp<List> baseResp = await DioUtil()
@@ -574,11 +574,12 @@ class NavigatorUtil { @@ -574,11 +574,12 @@ class NavigatorUtil {
574 /// 客户详情 574 /// 客户详情
575 static Future<dynamic> goCustomerDetailPage( 575 static Future<dynamic> goCustomerDetailPage(
576 BuildContext context, 576 BuildContext context,
577 - CustomerListSunModel userHistoryEntity, { 577 + CustomerListSunModel userHistoryEntity,
  578 + FromPage fromPage, {
578 replace = false, 579 replace = false,
579 }) { 580 }) {
580 return _navigateTo(context, 581 return _navigateTo(context,
581 - "${Routes.customer_detail_page}?userHistoryEntity=${FluroConvertUtils.object2string(userHistoryEntity)}", 582 + "${Routes.customer_detail_page}?userHistoryEntity=${FluroConvertUtils.object2string(userHistoryEntity)}&fromPage=${FluroConvertUtils.enumToString(fromPage)}",
582 replace: replace); 583 replace: replace);
583 } 584 }
584 585
@@ -902,10 +902,14 @@ var customerDetailPageHandle = new Handler( @@ -902,10 +902,14 @@ var customerDetailPageHandle = new Handler(
902 CustomerListSunModel userHistoryEntity = CustomerListSunModel.fromJson( 902 CustomerListSunModel userHistoryEntity = CustomerListSunModel.fromJson(
903 json.decode(FluroConvertUtils.fluroCnParamsDecode( 903 json.decode(FluroConvertUtils.fluroCnParamsDecode(
904 params["userHistoryEntity"].first))); 904 params["userHistoryEntity"].first)));
  905 + FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>(
  906 + FromPage.values, params["fromPage"].first);
  907 + print(fromPage);
905 return ChangeNotifierProvider<CustomerProvider>( 908 return ChangeNotifierProvider<CustomerProvider>(
906 create: (_) => CustomerProvider(), 909 create: (_) => CustomerProvider(),
907 child: CustomerDetailPage( 910 child: CustomerDetailPage(
908 userHistoryEntity: userHistoryEntity, 911 userHistoryEntity: userHistoryEntity,
  912 + fromPage: fromPage,
909 )); 913 ));
910 }); 914 });
911 915
@@ -33,7 +33,68 @@ class Utils { @@ -33,7 +33,68 @@ class Utils {
33 // 33 //
34 34
35 //时间转换 35 //时间转换
36 - static String format(String datestr) { 36 + static String formatFromMill(String datestr) {
  37 + String date = '';
  38 + DateTime _strtimes = DateTime.fromMillisecondsSinceEpoch(
  39 + int.parse(datestr) *
  40 + 1000); //首先先将字符串格式的时间转为DateTime类型,因为millisecondsSinceEpoch方法转换要求为该格式
  41 + // int _intendtime = _strtimes.millisecondsSinceEpoch; //方法一
  42 + // var _intendtime = DateTime.fromMillisecondsSinceEpoch(_strtimes );//方法二
  43 + // //_intendtime 为以及转换好的时间戳
  44 + DateTime dateNow = DateTime.now();
  45 + // String ymd = "${day.year}-" +
  46 + // Utils.addZeroNumber(day.month) +
  47 + // "-" +
  48 + // Utils.addZeroNumber(day.day);
  49 +
  50 + if (Utils.isOneDay(_strtimes, dateNow)) {
  51 + date = "今天 ";
  52 + } else if (Utils.isOneDay(_strtimes, dateNow.add(Duration(days: 1)))) {
  53 + date = "明天 ";
  54 + } else if (Utils.isOneDay(_strtimes, dateNow.add(Duration(days: 2)))) {
  55 + date = "后天 ";
  56 + } else {
  57 + final num ONE_HOUR = 3600000;
  58 + final num ONE_DAY = 86400000;
  59 + final String ONE_DAY_AGO = "天前";
  60 + num delta = DateTime.now().millisecondsSinceEpoch -
  61 + _strtimes.millisecondsSinceEpoch;
  62 + // if (delta < 1 * ONE_MINUTE) {
  63 + // num seconds = toSeconds(delta);
  64 + // return (seconds <= 0 ? 1 : seconds).toInt().toString() + ONE_SECOND_AGO;
  65 + // }
  66 + // if (delta < 45 * ONE_MINUTE) {
  67 + // num minutes = toMinutes(delta);
  68 + // return (minutes <= 0 ? 1 : minutes).toInt().toString() + ONE_MINUTE_AGO;
  69 + // }
  70 + // if (delta < 24 * ONE_HOUR) {
  71 + // num hours = toHours(delta);
  72 + // return (hours <= 0 ? 1 : hours).toInt().toString() + ONE_HOUR_AGO;
  73 + // }
  74 + // if (delta < 48 * ONE_HOUR) {
  75 + // return "昨天";
  76 + // }
  77 + if (delta > 0) {
  78 + // if (delta < 30 * ONE_DAY) {
  79 + num days = toDays(delta);
  80 + date = (days <= 0 ? 1 : days).toInt().toString() + ONE_DAY_AGO;
  81 + // }
  82 + } else {
  83 + date = datestr;
  84 + }
  85 + return date;
  86 +
  87 + // if (delta < 12 * 4 * ONE_WEEK) {
  88 + // num months = toMonths(delta);
  89 + // return (months <= 0 ? 1 : months).toInt().toString() + ONE_MONTH_AGO;
  90 + // } else {
  91 + // num years = toYears(delta);
  92 + // return (years <= 0 ? 1 : years).toInt().toString() + ONE_YEAR_AGO;
  93 + // }
  94 + }
  95 + }
  96 +
  97 + static String formatFromYmd(String datestr) {
37 String date = ''; 98 String date = '';
38 String _str = 99 String _str =
39 datestr.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', ''); 100 datestr.replaceAll('年', '-').replaceAll('月', '-').replaceAll('日', '');