Commit 659be1c457444255d1f7262f94c9f3d86ac852ee

Authored by wdn127929
1 parent df60ac84

全店用户列表接口部分

@@ -21,5 +21,6 @@ enum FromPage { @@ -21,5 +21,6 @@ enum FromPage {
21 FromPageHome, //客户列表页面来源---主页 21 FromPageHome, //客户列表页面来源---主页
22 FromPageMakeRecord, //客户列表页面来源---营销页面 22 FromPageMakeRecord, //客户列表页面来源---营销页面
23 FromPageCustomerList, 23 FromPageCustomerList,
24 - FromPageMakeRecordDetail, 24 + FromPageMakeRecordDetail,
  25 + FromPageShowCutomerList, //仅展示客户列表,没有选择按钮
25 } 26 }
  1 +import 'package:azlistview/azlistview.dart';
  2 +import 'package:json_annotation/json_annotation.dart';
  3 +
  4 +part 'customer_by_seller_model.g.dart';
  5 +
  6 +@JsonSerializable()
  7 +class CustomerBySellerModel extends Object {
  8 + @JsonKey(name: 'ret')
  9 + int ret;
  10 +
  11 + @JsonKey(name: 'data')
  12 + List<CustomerBySellerSunModel> data;
  13 +
  14 + @JsonKey(name: 'msg')
  15 + String msg;
  16 +
  17 + CustomerBySellerModel(
  18 + this.ret,
  19 + this.data,
  20 + this.msg,
  21 + );
  22 +
  23 + factory CustomerBySellerModel.fromJson(Map<String, dynamic> srcJson) =>
  24 + _$CustomerBySellerModelFromJson(srcJson);
  25 +
  26 + Map<String, dynamic> toJson() => _$CustomerBySellerModelToJson(this);
  27 +}
  28 +
  29 +@JsonSerializable()
  30 +class CustomerBySellerSunModel extends Object with ISuspensionBean {
  31 + @JsonKey(name: 'rname')
  32 + String rname;
  33 +
  34 + @JsonKey(name: 'sex')
  35 + String sex;
  36 +
  37 + @JsonKey(name: 'phone')
  38 + String phone;
  39 +
  40 + @JsonKey(name: 'sellerid')
  41 + String sellerid;
  42 +
  43 + @JsonKey(name: 'month_count')
  44 + String monthCount;
  45 +
  46 + @JsonKey(name: 'leiji')
  47 + String leiji;
  48 +
  49 + @JsonKey(name: 'attr')
  50 + String attr;
  51 +
  52 + @JsonKey(name: 'ddate')
  53 + String ddate;
  54 +
  55 + @JsonKey(name: 'ddate_solt')
  56 + String ddateSolt;
  57 +
  58 + @JsonKey(name: 'uid')
  59 + String uid;
  60 +
  61 + @JsonKey(name: 'nick_name')
  62 + String nickName;
  63 +
  64 + bool select = true;
  65 +
  66 + String pinyin;
  67 + String tagIndex; //abcdefg
  68 + String get rnameStr {
  69 + if (rname == null || rname == '') return "";
  70 + return rname;
  71 + }
  72 +
  73 + String get sexStr {
  74 + if (sex == null || sex == '') return "";
  75 + switch (sex.toString()) {
  76 + case "1": //先生
  77 + case "男":
  78 + case "先生":
  79 + return "先生";
  80 + case "2": //女士
  81 + case "女":
  82 + case "女士":
  83 + return "女士";
  84 + case "3": //公司
  85 + case "公司":
  86 + return "公司";
  87 + }
  88 + }
  89 +
  90 + CustomerBySellerSunModel(
  91 + this.rname,
  92 + this.sex,
  93 + this.phone,
  94 + this.sellerid,
  95 + this.monthCount,
  96 + this.leiji,
  97 + this.attr,
  98 + this.ddate,
  99 + this.ddateSolt,
  100 + this.uid,
  101 + this.nickName);
  102 +
  103 + factory CustomerBySellerSunModel.fromJson(Map<String, dynamic> srcJson) =>
  104 + _$CustomerBySellerSunModelFromJson(srcJson);
  105 +
  106 + Map<String, dynamic> toJson() => _$CustomerBySellerSunModelToJson(this);
  107 +
  108 + @override
  109 + String getSuspensionTag() => tagIndex;
  110 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'customer_by_seller_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +CustomerBySellerModel _$CustomerBySellerModelFromJson(
  10 + Map<String, dynamic> json) {
  11 + return CustomerBySellerModel(
  12 + json['ret'] as int,
  13 + (json['data'] as List)
  14 + ?.map((e) => e == null
  15 + ? null
  16 + : CustomerBySellerSunModel.fromJson(e as Map<String, dynamic>))
  17 + ?.toList(),
  18 + json['msg'] as String,
  19 + );
  20 +}
  21 +
  22 +Map<String, dynamic> _$CustomerBySellerModelToJson(
  23 + CustomerBySellerModel instance) =>
  24 + <String, dynamic>{
  25 + 'ret': instance.ret,
  26 + 'data': instance.data,
  27 + 'msg': instance.msg,
  28 + };
  29 +
  30 +CustomerBySellerSunModel _$CustomerBySellerSunModelFromJson(
  31 + Map<String, dynamic> json) {
  32 + return CustomerBySellerSunModel(
  33 + json['rname'] as String,
  34 + json['sex'] as String,
  35 + json['phone'] as String,
  36 + json['sellerid'] as String,
  37 + json['month_count'] as String,
  38 + json['leiji'] as String,
  39 + json['attr'] as String,
  40 + json['ddate'] as String,
  41 + json['ddate_solt'] as String,
  42 + json['uid'] as String,
  43 + json['nick_name'] as String,
  44 + );
  45 +}
  46 +
  47 +Map<String, dynamic> _$CustomerBySellerSunModelToJson(
  48 + CustomerBySellerSunModel instance) =>
  49 + <String, dynamic>{
  50 + 'rname': instance.rname,
  51 + 'sex': instance.sex,
  52 + 'phone': instance.phone,
  53 + 'sellerid': instance.sellerid,
  54 + 'month_count': instance.monthCount,
  55 + 'leiji': instance.leiji,
  56 + 'attr': instance.attr,
  57 + 'ddate': instance.ddate,
  58 + 'ddate_solt': instance.ddateSolt,
  59 + 'uid': instance.uid,
  60 + 'nick_name': instance.nickName
  61 + };
@@ -208,5 +208,7 @@ class HttpUrl { @@ -208,5 +208,7 @@ class HttpUrl {
208 "?service=App.GuestManage.GetGuestByGid"; // 客户经理营销中的用户列表 208 "?service=App.GuestManage.GetGuestByGid"; // 客户经理营销中的用户列表
209 static const String get_marketing_by_uid = 209 static const String get_marketing_by_uid =
210 "?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表 210 "?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表
  211 + static const String get_customer_by_seller =
  212 + "?service=App.GuestManage.GetCustomerBySeller"; // 全店客户列表
211 213
212 } 214 }
@@ -11,20 +11,21 @@ import 'package:one_key/utils/utils.dart'; @@ -11,20 +11,21 @@ import 'package:one_key/utils/utils.dart';
11 import 'package:one_key/widgets/h_empty_view.dart'; 11 import 'package:one_key/widgets/h_empty_view.dart';
12 import 'package:one_key/widgets/v_empty_view.dart'; 12 import 'package:one_key/widgets/v_empty_view.dart';
13 13
14 -class ContactListPage extends StatefulWidget { 14 +class MyContactListPage extends StatefulWidget {
15 final List<CustomerListSunModel> contacts; 15 final List<CustomerListSunModel> contacts;
16 final CustomerProvider provider; 16 final CustomerProvider provider;
17 final FromPage fromPage; 17 final FromPage fromPage;
18 18
19 - const ContactListPage({Key key, this.contacts, this.provider, this.fromPage}) 19 + const MyContactListPage(
  20 + {Key key, this.contacts, this.provider, this.fromPage})
20 : super(key: key); 21 : super(key: key);
21 @override 22 @override
22 State<StatefulWidget> createState() { 23 State<StatefulWidget> createState() {
23 - return new _ContactListPageState(); 24 + return new _MyContactListPageState();
24 } 25 }
25 } 26 }
26 27
27 -class _ContactListPageState extends State<ContactListPage> { 28 +class _MyContactListPageState extends State<MyContactListPage> {
28 // List<contan> _contacts = []; 29 // List<contan> _contacts = [];
29 double susItemHeight = ScreenUtil().setWidth(10); 30 double susItemHeight = ScreenUtil().setWidth(10);
30 31
@@ -32,7 +33,7 @@ class _ContactListPageState extends State<ContactListPage> { @@ -32,7 +33,7 @@ class _ContactListPageState extends State<ContactListPage> {
32 void initState() { 33 void initState() {
33 super.initState(); 34 super.initState();
34 // loadData(); 35 // loadData();
35 - widget.provider.handleList(widget.contacts); 36 + widget.provider.myHandleList(widget.contacts);
36 } 37 }
37 38
38 // void loadData() async { 39 // void loadData() async {
@@ -372,7 +373,7 @@ class _ContactListPageState extends State<ContactListPage> { @@ -372,7 +373,7 @@ class _ContactListPageState extends State<ContactListPage> {
372 CustomerListSunModel model = widget.contacts[index]; 373 CustomerListSunModel model = widget.contacts[index];
373 return InkWell( 374 return InkWell(
374 onTap: () { 375 onTap: () {
375 - NavigatorUtil.goCustomerDetailPage(context, model, widget.fromPage); 376 + NavigatorUtil.goMyCustomerDetailPage(context, model, widget.fromPage);
376 }, 377 },
377 child: _buildListItem(model, index), 378 child: _buildListItem(model, index),
378 ); 379 );
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; @@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
2 2
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/pages/my/customer_type/my_customer/my_contant_list_page.dart';
5 6
6 -import 'package:one_key/pages/my/customer_type/contant_list_page.dart';  
7 import 'package:one_key/provider/customer_making_provider.dart'; 7 import 'package:one_key/provider/customer_making_provider.dart';
8 8
9 import 'package:one_key/provider/customer_provider.dart'; 9 import 'package:one_key/provider/customer_provider.dart';
@@ -1090,7 +1090,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1090,7 +1090,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1090 controller: tabController, 1090 controller: tabController,
1091 physics: NeverScrollableScrollPhysics(), 1091 physics: NeverScrollableScrollPhysics(),
1092 children: <Widget>[ 1092 children: <Widget>[
1093 - ContactListPage( 1093 + MyContactListPage(
1094 contacts: model.userHistorysShow, 1094 contacts: model.userHistorysShow,
1095 provider: customerProvider, 1095 provider: customerProvider,
1096 fromPage: widget.fromPage), 1096 fromPage: widget.fromPage),
@@ -1109,7 +1109,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1109,7 +1109,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1109 showMsg: "加载中,请稍后...", 1109 showMsg: "加载中,请稍后...",
1110 ); 1110 );
1111 } else { 1111 } else {
1112 - return ContactListPage( 1112 + return MyContactListPage(
1113 contacts: model.userHistorysShowHuoyue, 1113 contacts: model.userHistorysShowHuoyue,
1114 provider: customerProvider, 1114 provider: customerProvider,
1115 fromPage: widget.fromPage); 1115 fromPage: widget.fromPage);
@@ -1131,7 +1131,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1131,7 +1131,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1131 showMsg: "加载中,请稍后...", 1131 showMsg: "加载中,请稍后...",
1132 ); 1132 );
1133 } else { 1133 } else {
1134 - return ContactListPage( 1134 + return MyContactListPage(
1135 contacts: model.userHistorysShowChenshui, 1135 contacts: model.userHistorysShowChenshui,
1136 provider: customerProvider, 1136 provider: customerProvider,
1137 fromPage: widget.fromPage); 1137 fromPage: widget.fromPage);
@@ -1152,7 +1152,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1152,7 +1152,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1152 showMsg: "加载中,请稍后...", 1152 showMsg: "加载中,请稍后...",
1153 ); 1153 );
1154 } else { 1154 } else {
1155 - return ContactListPage( 1155 + return MyContactListPage(
1156 contacts: model.userHistorysShowLiushi, 1156 contacts: model.userHistorysShowLiushi,
1157 provider: customerProvider, 1157 provider: customerProvider,
1158 fromPage: widget.fromPage); 1158 fromPage: widget.fromPage);
@@ -176,6 +176,10 @@ class _MyMarketingRecordsDetailPageState @@ -176,6 +176,10 @@ class _MyMarketingRecordsDetailPageState
176 HEmptyView(10), 176 HEmptyView(10),
177 InkWell( 177 InkWell(
178 onTap: () { 178 onTap: () {
  179 + NavigatorUtil.goShowCustomerListPage(
  180 + context,
  181 + FromPage.FromPageStoreCustomer,
  182 + widget.selfList.gid);
179 // NavigatorUtil.goMyMarketingRecordsDetailPage(context); 183 // NavigatorUtil.goMyMarketingRecordsDetailPage(context);
180 }, 184 },
181 child: Text('查看', 185 child: Text('查看',
@@ -201,11 +205,9 @@ class _MyMarketingRecordsDetailPageState @@ -201,11 +205,9 @@ class _MyMarketingRecordsDetailPageState
201 horizontal: ScreenUtil().setWidth(200)), 205 horizontal: ScreenUtil().setWidth(200)),
202 isBold: false, 206 isBold: false,
203 onPressed: () { 207 onPressed: () {
204 - NavigatorUtil.goMyMakeMarkingPage(context,  
205 - selfList:  
206 - widget.selfList,  
207 - fromPage:  
208 - FromPage.FromPageMakeRecordDetail); 208 + NavigatorUtil.goMyMakeMarkingPage(context,
  209 + selfList: widget.selfList,
  210 + fromPage: FromPage.FromPageMakeRecordDetail);
209 }, 211 },
210 ), 212 ),
211 VEmptyView(30), 213 VEmptyView(30),
@@ -231,6 +231,10 @@ class _SellerMyMarketingRecordsDetailPageState @@ -231,6 +231,10 @@ class _SellerMyMarketingRecordsDetailPageState
231 HEmptyView(10), 231 HEmptyView(10),
232 InkWell( 232 InkWell(
233 onTap: () { 233 onTap: () {
  234 + NavigatorUtil.goShowCustomerListPage(
  235 + context,
  236 + FromPage.FromPageStoreCustomer,
  237 + widget.sellerList.gid);
234 // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context); 238 // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
235 }, 239 },
236 child: Text('查看', 240 child: Text('查看',
@@ -2,8 +2,9 @@ import 'package:flutter/material.dart'; @@ -2,8 +2,9 @@ import 'package:flutter/material.dart';
2 2
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/pages/my/customer_type/my_customer/my_contant_list_page.dart';
5 6
6 -import 'package:one_key/pages/my/customer_type/contant_list_page.dart'; 7 +import 'package:one_key/pages/my/customer_type/store_customer/contant_list_page.dart';
7 import 'package:one_key/provider/customer_making_provider.dart'; 8 import 'package:one_key/provider/customer_making_provider.dart';
8 9
9 import 'package:one_key/provider/customer_provider.dart'; 10 import 'package:one_key/provider/customer_provider.dart';
@@ -1065,11 +1066,11 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1065,11 +1066,11 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1065 _searchWidget(), _menuWidget(), 1066 _searchWidget(), _menuWidget(),
1066 Expanded(child: 1067 Expanded(child:
1067 Consumer<CustomerProvider>(builder: (context, model, _) { 1068 Consumer<CustomerProvider>(builder: (context, model, _) {
1068 - if (model.pageState != PageState.Success) { 1069 + if (model.pageStateListShow != PageState.Success) {
1069 return ExceptionPage( 1070 return ExceptionPage(
1070 - pageState: model.pageState, 1071 + pageState: model.pageStateListShow,
1071 callback: () { 1072 callback: () {
1072 - model.pageState = PageState.Loading; 1073 + model.pageStateListShow = PageState.Loading;
1073 model.notifyListeners(); 1074 model.notifyListeners();
1074 _getGuestByGid(); 1075 _getGuestByGid();
1075 }, 1076 },
@@ -1084,17 +1085,18 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1084,17 +1085,18 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1084 controller: tabController, 1085 controller: tabController,
1085 physics: NeverScrollableScrollPhysics(), 1086 physics: NeverScrollableScrollPhysics(),
1086 children: <Widget>[ 1087 children: <Widget>[
1087 - ContactListPage(  
1088 - contacts: model.userHistorysShow, 1088 + MyContactListPage(
  1089 + contacts: model.selectCustomer,
1089 provider: customerProvider, 1090 provider: customerProvider,
1090 - fromPage: widget.fromPage), 1091 + fromPage: FromPage.FromPageShowCutomerList),
1091 Consumer<CustomerProvider>( 1092 Consumer<CustomerProvider>(
1092 builder: (context, model, _) { 1093 builder: (context, model, _) {
1093 - if (model.pageStateHuoyue != PageState.Success) { 1094 + if (model.pageStateListShow !=
  1095 + PageState.Success) {
1094 return ExceptionPage( 1096 return ExceptionPage(
1095 - pageState: model.pageStateHuoyue, 1097 + pageState: model.pageStateListShow,
1096 callback: () { 1098 callback: () {
1097 - model.pageStateHuoyue = PageState.Loading; 1099 + model.pageStateListShow = PageState.Loading;
1098 model.notifyListeners(); 1100 model.notifyListeners();
1099 _getGuestByGid(); 1101 _getGuestByGid();
1100 }, 1102 },
@@ -1103,10 +1105,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1103,10 +1105,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1103 showMsg: "加载中,请稍后...", 1105 showMsg: "加载中,请稍后...",
1104 ); 1106 );
1105 } else { 1107 } else {
1106 - return ContactListPage( 1108 + return MyContactListPage(
1107 contacts: model.userHistorysShowHuoyue, 1109 contacts: model.userHistorysShowHuoyue,
1108 provider: customerProvider, 1110 provider: customerProvider,
1109 - fromPage: widget.fromPage); 1111 + fromPage: FromPage.FromPageShowCutomerList);
1110 } 1112 }
1111 }), 1113 }),
1112 Consumer<CustomerProvider>( 1114 Consumer<CustomerProvider>(
@@ -1125,10 +1127,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1125,10 +1127,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1125 showMsg: "加载中,请稍后...", 1127 showMsg: "加载中,请稍后...",
1126 ); 1128 );
1127 } else { 1129 } else {
1128 - return ContactListPage( 1130 + return MyContactListPage(
1129 contacts: model.userHistorysShowChenshui, 1131 contacts: model.userHistorysShowChenshui,
1130 provider: customerProvider, 1132 provider: customerProvider,
1131 - fromPage: widget.fromPage); 1133 + fromPage: FromPage.FromPageShowCutomerList);
1132 } 1134 }
1133 }), 1135 }),
1134 Consumer<CustomerProvider>( 1136 Consumer<CustomerProvider>(
@@ -1146,10 +1148,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1146,10 +1148,10 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1146 showMsg: "加载中,请稍后...", 1148 showMsg: "加载中,请稍后...",
1147 ); 1149 );
1148 } else { 1150 } else {
1149 - return ContactListPage( 1151 + return MyContactListPage(
1150 contacts: model.userHistorysShowLiushi, 1152 contacts: model.userHistorysShowLiushi,
1151 provider: customerProvider, 1153 provider: customerProvider,
1152 - fromPage: widget.fromPage); 1154 + fromPage: FromPage.FromPageShowCutomerList);
1153 } 1155 }
1154 }), 1156 }),
1155 // ContactListPage( 1157 // ContactListPage(
@@ -1161,9 +1163,9 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1161,9 +1163,9 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1161 // provider: customerProvider, 1163 // provider: customerProvider,
1162 // fromPage: widget.fromPage), 1164 // fromPage: widget.fromPage),
1163 ])), 1165 ])),
1164 - customerProvider.pageState == PageState.Success  
1165 - ? _selectContantWidget()  
1166 - : SizedBox(), 1166 + // customerProvider.pageState == PageState.Success
  1167 + // ? _selectContantWidget()
  1168 + // : SizedBox(),
1167 ]); 1169 ]);
1168 } 1170 }
1169 })), 1171 })),
  1 +import 'package:azlistview/azlistview.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/customer_by_seller_model.dart';
  6 +// import 'package:one_key/models/customer_list_model.dart';
  7 +
  8 +import 'package:one_key/provider/customer_provider.dart';
  9 +import 'package:one_key/res/colors.dart';
  10 +import 'package:one_key/route/navigator_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/v_empty_view.dart';
  14 +
  15 +class ContactListPage extends StatefulWidget {
  16 + final List<CustomerBySellerSunModel> contacts;
  17 + final CustomerProvider provider;
  18 + final FromPage fromPage;
  19 +
  20 + const ContactListPage({Key key, this.contacts, this.provider, this.fromPage})
  21 + : super(key: key);
  22 + @override
  23 + State<StatefulWidget> createState() {
  24 + return new _ContactListPageState();
  25 + }
  26 +}
  27 +
  28 +class _ContactListPageState extends State<ContactListPage> {
  29 + // List<contan> _contacts = [];
  30 + double susItemHeight = ScreenUtil().setWidth(10);
  31 +
  32 + @override
  33 + void initState() {
  34 + super.initState();
  35 + widget.provider.handleList(widget.contacts);
  36 + }
  37 +
  38 + // void loadData() async {
  39 + // //加载联系人列表
  40 + // rootBundle.loadString('assets/data/contacts.json').then((value) {
  41 + // List list = json.decode(value);
  42 + // list.forEach((v) {
  43 + // _contacts.add(ContactInfo.fromJson(v));
  44 + // });
  45 + // _handleList(_contacts);
  46 + // });
  47 + // }
  48 +
  49 + // Widget _buildHeader() {
  50 + // return Container(
  51 + // padding: EdgeInsets.all(20),
  52 + // alignment: Alignment.center,
  53 + // child: Column(
  54 + // mainAxisAlignment: MainAxisAlignment.center,
  55 + // children: <Widget>[
  56 + // ClipOval(
  57 + // child: Image.asset(
  58 + // "./assets/images/avatar.png",
  59 + // width: 80.0,
  60 + // )),
  61 + // Padding(
  62 + // padding: const EdgeInsets.all(8.0),
  63 + // child: Text(
  64 + // "远行",
  65 + // textScaleFactor: 1.2,
  66 + // ),
  67 + // ),
  68 + // Text("+86 182-286-44678"),
  69 + // ],
  70 + // ),
  71 + // );
  72 + // }
  73 +
  74 + Widget _buildSusWidget(String susTag) {
  75 + return Container(
  76 + padding: EdgeInsets.symmetric(
  77 + horizontal: ScreenUtil().setWidth(20),
  78 + vertical: ScreenUtil().setWidth(10)),
  79 + // height: susItemHeight,
  80 + // margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
  81 + width: double.infinity,
  82 + color: Color.fromRGBO(239, 239, 239, 1),
  83 + alignment: Alignment.centerLeft,
  84 + child: Text(
  85 + '$susTag',
  86 + style: TextStyle(fontSize: ScreenUtil().setWidth(28)),
  87 + ),
  88 + );
  89 + }
  90 +
  91 + Widget _buildListItem(CustomerBySellerSunModel model, int index) {
  92 + String susTag = model.getSuspensionTag();
  93 +
  94 + return Column(
  95 + children: <Widget>[
  96 + Offstage(
  97 + offstage: model.isShowSuspension != true,
  98 + child: _buildSusWidget(susTag),
  99 + ),
  100 + model.isShowSuspension ? VEmptyView(20) : SizedBox(),
  101 + Container(
  102 + padding: EdgeInsets.only(
  103 + left: ScreenUtil().setWidth(30),
  104 + right: ScreenUtil().setWidth(30),
  105 + bottom: ScreenUtil().setWidth(30),
  106 + top: model.isShowSuspension ? 0 : ScreenUtil().setWidth(30)),
  107 + decoration: BoxDecoration(
  108 + border: Border(
  109 + bottom: BorderSide(
  110 + color: Color.fromRGBO(244, 244, 244, 1),
  111 + width: ScreenUtil().setWidth(2)))),
  112 + child: Row(
  113 + children: [
  114 + InkWell(
  115 + onTap: () {
  116 + List<CustomerBySellerSunModel> data =
  117 + widget.provider.customerBySellerList;
  118 + data[index].select = !data[index].select;
  119 + if (data[index].select) {
  120 + widget.provider.addData(index);
  121 + } else {
  122 + widget.provider.cancelData(index);
  123 + }
  124 + widget.provider.getCheckValue();
  125 + },
  126 + child: Stack(
  127 + alignment: Alignment.bottomCenter,
  128 + clipBehavior: Clip.none,
  129 + children: [
  130 + Stack(
  131 + alignment: Alignment.centerLeft,
  132 + clipBehavior: Clip.none,
  133 + children: [
  134 + CircleAvatar(
  135 + radius: ScreenUtil().setWidth(60),
  136 + backgroundColor: Color.fromRGBO(239, 239, 239, 1),
  137 + child: Text(
  138 + model.rnameStr != ''
  139 + ? model.rnameStr.substring(0, 1)
  140 + : '',
  141 + style: TextStyle(
  142 + color: Color.fromRGBO(206, 206, 206, 1),
  143 + fontSize: ScreenUtil().setSp(42)),
  144 + ),
  145 + ),
  146 + Positioned(
  147 + left: ScreenUtil().setWidth(-18),
  148 + child: Image.asset(
  149 + Utils.getImgPath(
  150 + model.select ? 'select' : 'unselect'),
  151 + width: ScreenUtil().setWidth(36),
  152 + ))
  153 + ]),
  154 + Positioned(
  155 + bottom: ScreenUtil().setWidth(-20),
  156 + child: Container(
  157 + padding: EdgeInsets.symmetric(
  158 + horizontal: ScreenUtil().setWidth(10),
  159 + vertical: ScreenUtil().setWidth(2),
  160 + ),
  161 + decoration: BoxDecoration(
  162 + color: model.attr != null && model.attr != ''
  163 + ? model.attr == '沉睡'
  164 + ? Color.fromRGBO(223, 33, 81, 1)
  165 + : model.attr == '活跃'
  166 + ? Color.fromRGBO(81, 170, 94, 1)
  167 + : model.attr == '流失'
  168 + ? Color.fromRGBO(
  169 + 109, 101, 248, 1)
  170 + : Color.fromRGBO(
  171 + 239, 143, 49, 1)
  172 + : Colors.transparent,
  173 + borderRadius: BorderRadius.circular(
  174 + ScreenUtil().setWidth(10),
  175 + ),
  176 + ),
  177 + child: Text(
  178 + model.attr == null || model.attr == ''
  179 + ? ''
  180 + : model.attr,
  181 + style: TextStyle(
  182 + color: MyColours.color_ffffff,
  183 + fontSize: ScreenUtil().setSp(28)))))
  184 + ],
  185 + )),
  186 + HEmptyView(20),
  187 + Expanded(
  188 + child: Column(
  189 + crossAxisAlignment: CrossAxisAlignment.start,
  190 + children: [
  191 + Row(
  192 + crossAxisAlignment: CrossAxisAlignment.end,
  193 + children: [
  194 + model.rnameStr != null && model.rnameStr != ''
  195 + ? Row(
  196 + crossAxisAlignment: CrossAxisAlignment.end,
  197 + children: [
  198 + Container(
  199 + constraints: BoxConstraints(
  200 + maxWidth: ScreenUtil().setWidth(200)),
  201 + child: Text(
  202 + model.rnameStr,
  203 + overflow: TextOverflow.ellipsis,
  204 + style: TextStyle(
  205 + color: MyColours.color_333333,
  206 + fontSize: ScreenUtil().setSp(36),
  207 + fontWeight: FontWeight.bold),
  208 + )),
  209 + HEmptyView(10),
  210 + Padding(
  211 + padding: EdgeInsets.only(
  212 + bottom: ScreenUtil().setWidth(4)),
  213 + child: Text(
  214 + model.sexStr != ''
  215 + ? '[${model.sexStr}]'
  216 + : '',
  217 + style: TextStyle(
  218 + color: MyColours.color_333333,
  219 + fontSize: ScreenUtil().setSp(22),
  220 + ),
  221 + )),
  222 + HEmptyView(10),
  223 + ],
  224 + )
  225 + : SizedBox(),
  226 + // model.label != null
  227 + // ? Container(
  228 + // padding: EdgeInsets.only(
  229 + // bottom: ScreenUtil().setWidth(4)),
  230 + // constraints: BoxConstraints(
  231 + // maxWidth: ScreenUtil().setWidth(150)),
  232 + // child: Text(
  233 + // model.label,
  234 + // overflow: TextOverflow.ellipsis,
  235 + // style: TextStyle(
  236 + // color: Color.fromRGBO(193, 194, 63, 1),
  237 + // fontSize: ScreenUtil().setSp(22),
  238 + // ),
  239 + // ))
  240 + // : SizedBox()
  241 + ],
  242 + ),
  243 + VEmptyView(10),
  244 + Row(
  245 + // crossAxisAlignment: CrossAxisAlignment.end,
  246 + children: [
  247 + Text(
  248 + Utils.formatFromYmd(model.ddate),
  249 + style: TextStyle(
  250 + color: Color.fromRGBO(208, 31, 37, 1),
  251 + fontSize: ScreenUtil().setSp(24),
  252 + fontWeight: FontWeight.bold),
  253 + ),
  254 + HEmptyView(10),
  255 + Text(
  256 + model.ddateSolt != null ? model.ddateSolt : '',
  257 + style: TextStyle(
  258 + color: Color.fromRGBO(208, 31, 37, 1),
  259 + fontSize: ScreenUtil().setSp(24),
  260 + ),
  261 + ),
  262 + model.monthCount == '0' || model.monthCount == null
  263 + ? SizedBox()
  264 + : Padding(
  265 + padding: EdgeInsets.only(
  266 + left: ScreenUtil().setWidth(10)),
  267 + child: Text(
  268 + '30天内${model.monthCount}单',
  269 + style: TextStyle(
  270 + color: MyColours.color_199095,
  271 + fontSize: ScreenUtil().setSp(24),
  272 + ),
  273 + ),
  274 + ),
  275 + HEmptyView(10),
  276 + Text(
  277 + '累计${model.leiji}单',
  278 + style: TextStyle(
  279 + color: MyColours.color_199095,
  280 + fontSize: ScreenUtil().setSp(24),
  281 + ),
  282 + )
  283 + ],
  284 + ),
  285 + model.nickName == null
  286 + ? SizedBox()
  287 + : Container(
  288 + padding: EdgeInsets.only(
  289 + left: ScreenUtil().setWidth(12),
  290 + right: ScreenUtil().setWidth(12),
  291 + top: ScreenUtil().setWidth(10),
  292 + ),
  293 + decoration: BoxDecoration(
  294 + border: Border.all(
  295 + color: MyColours.color_199095,
  296 + width: ScreenUtil().setWidth(2)),
  297 + borderRadius: BorderRadius.circular(
  298 + ScreenUtil().setWidth(10))),
  299 + child: Text(
  300 + '${model.nickName}经理',
  301 + style: TextStyle(
  302 + fontSize: ScreenUtil().setSp(24),
  303 + color: MyColours.color_333333),
  304 + ),
  305 + )
  306 + ],
  307 + ))
  308 + ],
  309 + ),
  310 + )
  311 + // ListTile(
  312 + // leading: ,
  313 + // title: Text(model.rname),
  314 + // onTap: () {
  315 + // print("OnItemClick: $model");
  316 + // Navigator.pop(context, model);
  317 + // },
  318 + // )
  319 + ],
  320 + );
  321 + }
  322 +
  323 + Decoration getIndexBarDecoration(Color color) {
  324 + return BoxDecoration(
  325 + color: color,
  326 + borderRadius: BorderRadius.circular(20.0),
  327 + border: Border.all(color: color, width: .5));
  328 + }
  329 +
  330 + @override
  331 + Widget build(BuildContext context) {
  332 + return AzListView(
  333 + data: widget.contacts,
  334 + itemCount: widget.contacts.length,
  335 + itemBuilder: (BuildContext context, int index) {
  336 + // if (index == 0) return _buildHeader();
  337 + CustomerBySellerSunModel model = widget.contacts[index];
  338 + return InkWell(
  339 + onTap: () {
  340 + NavigatorUtil.goCustomerDetailPage(context, model, widget.fromPage);
  341 + },
  342 + child: _buildListItem(model, index),
  343 + );
  344 + },
  345 + physics: BouncingScrollPhysics(),
  346 + indexBarData: SuspensionUtil.getTagIndexList(widget.contacts),
  347 + indexHintBuilder: (context, hint) {
  348 + return Container(
  349 + alignment: Alignment.center,
  350 + width: ScreenUtil().setWidth(120),
  351 + height: ScreenUtil().setWidth(120),
  352 + decoration: BoxDecoration(
  353 + color: Color.fromRGBO(239, 239, 239, 1),
  354 + shape: BoxShape.circle,
  355 + ),
  356 + child:
  357 + Text(hint, style: TextStyle(color: Colors.white, fontSize: 30.0)),
  358 + );
  359 + },
  360 + indexBarMargin: EdgeInsets.all(10),
  361 + indexBarOptions: IndexBarOptions(
  362 + needRebuild: true,
  363 + textStyle: TextStyle(
  364 + fontSize: ScreenUtil().setSp(24), color: MyColours.color_199095),
  365 + decoration: getIndexBarDecoration(Colors.transparent),
  366 + downDecoration: getIndexBarDecoration(Colors.transparent),
  367 + ),
  368 + );
  369 + }
  370 +}
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/constant/state.dart';
  4 +import 'package:one_key/models/customer_by_seller_model.dart';
4 import 'package:one_key/models/customer_list_model.dart'; 5 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/guest_info_model.dart';
6 import 'package:one_key/models/user_history_entity.dart'; 7 import 'package:one_key/models/user_history_entity.dart';
@@ -18,7 +19,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -18,7 +19,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
18 import 'package:provider/provider.dart'; 19 import 'package:provider/provider.dart';
19 20
20 class CustomerDetailPage extends StatefulWidget { 21 class CustomerDetailPage extends StatefulWidget {
21 - final CustomerListSunModel userHistoryEntity; 22 + final CustomerBySellerSunModel userHistoryEntity;
22 final FromPage fromPage; 23 final FromPage fromPage;
23 24
24 CustomerDetailPage({Key key, this.userHistoryEntity, this.fromPage}) 25 CustomerDetailPage({Key key, this.userHistoryEntity, this.fromPage})
@@ -52,7 +53,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -52,7 +53,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
52 53
53 _getGuestInfo() async { 54 _getGuestInfo() async {
54 Map<String, String> params = { 55 Map<String, String> params = {
55 - "id": widget.userHistoryEntity.id, 56 + // "id": widget.userHistoryEntity.id,
56 'phone': widget.userHistoryEntity.phone 57 'phone': widget.userHistoryEntity.phone
57 }; 58 };
58 await customerProvider.getGuestInfo(context, params); 59 await customerProvider.getGuestInfo(context, params);
@@ -140,27 +141,26 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -140,27 +141,26 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
140 ], 141 ],
141 ), 142 ),
142 Container( 143 Container(
143 - padding: EdgeInsets.only(  
144 - top: ScreenUtil().setWidth(40),  
145 - left: ScreenUtil().setWidth(10),  
146 - right: ScreenUtil().setWidth(10)),  
147 - decoration: BoxDecoration(  
148 - border: Border.all(  
149 - color: MyColours.color_199095,  
150 - width: ScreenUtil().setWidth(2)),  
151 - borderRadius:  
152 - BorderRadius.circular(ScreenUtil().setWidth(10))),  
153 - child: Text(  
154 - // widget.userHistoryEntity.rnameStr == ''  
155 - // ? '未指派经理'  
156 - // : widget.userHistoryEntity.rnameStr,  
157 - 'xxx经理',  
158 - style: TextStyle(  
159 - color: MyColours.color_333333,  
160 - fontSize: ScreenUtil().setSp(26)),  
161 - ),  
162 - )  
163 - 144 + padding: EdgeInsets.only(
  145 + top: ScreenUtil().setWidth(40),
  146 + left: ScreenUtil().setWidth(10),
  147 + right: ScreenUtil().setWidth(10)),
  148 + decoration: BoxDecoration(
  149 + border: Border.all(
  150 + color: MyColours.color_199095,
  151 + width: ScreenUtil().setWidth(2)),
  152 + borderRadius:
  153 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  154 + child: Text(
  155 + // widget.userHistoryEntity.rnameStr == ''
  156 + // ? '未指派经理'
  157 + // : widget.userHistoryEntity.rnameStr,
  158 + 'xxx经理',
  159 + style: TextStyle(
  160 + color: MyColours.color_333333,
  161 + fontSize: ScreenUtil().setSp(26)),
  162 + ),
  163 + )
164 ], 164 ],
165 ), 165 ),
166 HEmptyView(30), 166 HEmptyView(30),
@@ -501,11 +501,11 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -501,11 +501,11 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
501 fontSize: 26, 501 fontSize: 26,
502 isBold: false, 502 isBold: false,
503 onPressed: () { 503 onPressed: () {
504 - NavigatorUtil.goFestivalEditPage(  
505 - context,  
506 - customerProvider.guestInfoSunModel.guest,  
507 - widget.userHistoryEntity.id,  
508 - widget.userHistoryEntity.phone); 504 + // NavigatorUtil.goFestivalEditPage(
  505 + // context,
  506 + // customerProvider.guestInfoSunModel.guest,
  507 + // widget.userHistoryEntity.id,
  508 + // widget.userHistoryEntity.phone);
509 }, 509 },
510 ), 510 ),
511 ], 511 ],
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
5 5
6 -import 'package:one_key/pages/my/customer_type/contant_list_page.dart'; 6 +import 'package:one_key/pages/my/customer_type/store_customer/contant_list_page.dart';
7 import 'package:one_key/provider/customer_making_provider.dart'; 7 import 'package:one_key/provider/customer_making_provider.dart';
8 8
9 import 'package:one_key/provider/customer_provider.dart'; 9 import 'package:one_key/provider/customer_provider.dart';
@@ -55,9 +55,12 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -55,9 +55,12 @@ class _CustomerListPageState extends State<CustomerListPage>
55 tabController = TabController(length: 4, vsync: this); 55 tabController = TabController(length: 4, vsync: this);
56 tabController.addListener(() { 56 tabController.addListener(() {
57 if (tabController.index == tabController.animation.value) { 57 if (tabController.index == tabController.animation.value) {
  58 + if (customerProvider.index == tabController.index) {
  59 + return;
  60 + }
58 print(tabController.index); 61 print(tabController.index);
59 customerProvider.index = tabController.index; 62 customerProvider.index = tabController.index;
60 - customerProvider.searchData(customerProvider.controller.text); 63 + _getContantData();
61 } 64 }
62 }); 65 });
63 WidgetsBinding.instance.addPostFrameCallback((_) async { 66 WidgetsBinding.instance.addPostFrameCallback((_) async {
@@ -74,12 +77,31 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -74,12 +77,31 @@ class _CustomerListPageState extends State<CustomerListPage>
74 super.dispose(); 77 super.dispose();
75 } 78 }
76 79
77 - _getContantData() async { 80 + _getContantData({bool showLoading = true}) async {
  81 + if (showLoading) {
  82 + customerProvider.pageState = PageState.Loading;
  83 + }
  84 + customerProvider.notifyListeners();
78 Map<String, String> params = { 85 Map<String, String> params = {
79 - "uid": Provider.of<UserModel>(context, listen: false).user.openid, 86 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
80 }; 87 };
81 - await customerProvider.getCustomerList(context, params);  
82 - // await customerProvider.searchData(customerProvider.controller.text); 88 + if (customerProvider.index != 0 && customerProvider.index != null) {
  89 + params['active'] = '${customerProvider.index}'; //1 活跃 2 沉睡 3 流失
  90 + }
  91 + if (customerProvider.controller.text.trim().length > 0) {
  92 + params['keyword'] = customerProvider.controller.text; //搜索手机号/姓名
  93 + }
  94 + //
  95 + //
  96 + // params['uid'] 经理ID
  97 + // params['labelid'] 标签ID
  98 + // params['stime'] 起始天数,例: 60
  99 + // params['etime'] 截止天数,例: 120
  100 + // params['reserve_date'] XX天内,例:30
  101 + // params['reserve_num'] 时间内预定次数
  102 + // params['reserve_sort'] 1 等于 2 小于 3 大于
  103 +
  104 + await customerProvider.getCustomerBySeller(context, params);
83 } 105 }
84 106
85 // ///选中的联系人widget 107 // ///选中的联系人widget
@@ -1047,6 +1069,33 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1047,6 +1069,33 @@ class _CustomerListPageState extends State<CustomerListPage>
1047 return items; 1069 return items;
1048 } 1070 }
1049 1071
  1072 + List<Widget> _returnListWidget() {
  1073 + List<Widget> list = [];
  1074 + for (int i = 0; i < 4; i++) {
  1075 + list.add(Consumer<CustomerProvider>(builder: (context, model, _) {
  1076 + if (model.pageState != PageState.Success) {
  1077 + return ExceptionPage(
  1078 + pageState: model.pageState,
  1079 + callback: () {
  1080 + model.pageState = PageState.Loading;
  1081 + model.notifyListeners();
  1082 + _getContantData();
  1083 + },
  1084 + emptyMsg: "暂时没有客户哦",
  1085 + emptyImg: "empty_search",
  1086 + showMsg: "加载中,请稍后...",
  1087 + );
  1088 + } else {
  1089 + return ContactListPage(
  1090 + contacts: model.customerBySellerList,
  1091 + provider: customerProvider,
  1092 + fromPage: widget.fromPage);
  1093 + }
  1094 + }));
  1095 + }
  1096 + return list;
  1097 + }
  1098 +
1050 @override 1099 @override
1051 Widget build(BuildContext context) { 1100 Widget build(BuildContext context) {
1052 customerProvider = Provider.of<CustomerProvider>(context, listen: true); 1101 customerProvider = Provider.of<CustomerProvider>(context, listen: true);
@@ -1070,110 +1119,16 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1070,110 +1119,16 @@ class _CustomerListPageState extends State<CustomerListPage>
1070 body: SafeArea( 1119 body: SafeArea(
1071 child: Column(children: [ 1120 child: Column(children: [
1072 _searchWidget(), _menuWidget(), 1121 _searchWidget(), _menuWidget(),
1073 - Expanded(child:  
1074 - Consumer<CustomerProvider>(builder: (context, model, _) {  
1075 - if (model.pageState != PageState.Success) {  
1076 - return ExceptionPage(  
1077 - pageState: model.pageState,  
1078 - callback: () {  
1079 - model.pageState = PageState.Loading;  
1080 - model.notifyListeners();  
1081 - _getContantData();  
1082 - },  
1083 - emptyMsg: "暂时没有客户哦",  
1084 - emptyImg: "empty_search",  
1085 - showMsg: "加载中,请稍后...",  
1086 - );  
1087 - } else {  
1088 - return Column(children: [  
1089 - Expanded(  
1090 - child: TabBarView(  
1091 - controller: tabController,  
1092 - physics: NeverScrollableScrollPhysics(),  
1093 - children: <Widget>[  
1094 - ContactListPage(  
1095 - contacts: model.userHistorysShow,  
1096 - provider: customerProvider,  
1097 - fromPage: widget.fromPage),  
1098 - Consumer<CustomerProvider>(  
1099 - builder: (context, model, _) {  
1100 - if (model.pageStateHuoyue != PageState.Success) {  
1101 - return ExceptionPage(  
1102 - pageState: model.pageStateHuoyue,  
1103 - callback: () {  
1104 - model.pageStateHuoyue = PageState.Loading;  
1105 - model.notifyListeners();  
1106 - _getContantData();  
1107 - },  
1108 - emptyMsg: "暂时没有客户哦",  
1109 - emptyImg: "empty_search",  
1110 - showMsg: "加载中,请稍后...",  
1111 - );  
1112 - } else {  
1113 - return ContactListPage(  
1114 - contacts: model.userHistorysShowHuoyue,  
1115 - provider: customerProvider,  
1116 - fromPage: widget.fromPage);  
1117 - }  
1118 - }),  
1119 - Consumer<CustomerProvider>(  
1120 - builder: (context, model, _) {  
1121 - if (model.pageStateChenshui !=  
1122 - PageState.Success) {  
1123 - return ExceptionPage(  
1124 - pageState: model.pageStateChenshui,  
1125 - callback: () {  
1126 - model.pageStateChenshui = PageState.Loading;  
1127 - model.notifyListeners();  
1128 - _getContantData();  
1129 - },  
1130 - emptyMsg: "暂时没有客户哦",  
1131 - emptyImg: "empty_search",  
1132 - showMsg: "加载中,请稍后...",  
1133 - );  
1134 - } else {  
1135 - return ContactListPage(  
1136 - contacts: model.userHistorysShowChenshui,  
1137 - provider: customerProvider,  
1138 - fromPage: widget.fromPage);  
1139 - }  
1140 - }),  
1141 - Consumer<CustomerProvider>(  
1142 - builder: (context, model, _) {  
1143 - if (model.pageStateLiushi != PageState.Success) {  
1144 - return ExceptionPage(  
1145 - pageState: model.pageStateLiushi,  
1146 - callback: () {  
1147 - model.pageStateLiushi = PageState.Loading;  
1148 - model.notifyListeners();  
1149 - _getContantData();  
1150 - },  
1151 - emptyMsg: "暂时没有客户哦",  
1152 - emptyImg: "empty_search",  
1153 - showMsg: "加载中,请稍后...",  
1154 - );  
1155 - } else {  
1156 - return ContactListPage(  
1157 - contacts: model.userHistorysShowLiushi,  
1158 - provider: customerProvider,  
1159 - fromPage: widget.fromPage);  
1160 - }  
1161 - }),  
1162 - // ContactListPage(  
1163 - // contacts: model.userHistorysShowChenshui,  
1164 - // provider: customerProvider,  
1165 - // fromPage: widget.fromPage),  
1166 - // ContactListPage(  
1167 - // contacts: model.userHistorysShowLiushi,  
1168 - // provider: customerProvider,  
1169 - // fromPage: widget.fromPage),  
1170 - ])),  
1171 - customerProvider.pageState == PageState.Success  
1172 - ? _selectContantWidget()  
1173 - : SizedBox(),  
1174 - ]);  
1175 - }  
1176 - })), 1122 +
  1123 + Expanded(
  1124 + child: TabBarView(
  1125 + controller: tabController,
  1126 + physics: NeverScrollableScrollPhysics(),
  1127 + children: _returnListWidget())),
  1128 + customerProvider.pageState == PageState.Success
  1129 + ? _selectContantWidget()
  1130 + : SizedBox(),
  1131 +
1177 // _searchWidget(), 1132 // _searchWidget(),
1178 // Positioned( 1133 // Positioned(
1179 // top: 0, 1134 // top: 0,
@@ -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/coupon_model.dart'; 7 import 'package:one_key/models/coupon_model.dart';
  8 +import 'package:one_key/models/customer_by_seller_model.dart';
8 import 'package:one_key/models/customer_label_model.dart'; 9 import 'package:one_key/models/customer_label_model.dart';
9 import 'package:one_key/models/customer_list_model.dart'; 10 import 'package:one_key/models/customer_list_model.dart';
10 import 'package:one_key/models/guest_info_model.dart'; 11 import 'package:one_key/models/guest_info_model.dart';
@@ -66,6 +67,10 @@ class CustomerProvider extends ChangeNotifier { @@ -66,6 +67,10 @@ class CustomerProvider extends ChangeNotifier {
66 67
67 MarketingByUidsSunModel myRecordData; //我的营销记录数据(包含详情) 68 MarketingByUidsSunModel myRecordData; //我的营销记录数据(包含详情)
68 69
  70 + PageState pageStateListShow = PageState.Loading;
  71 +
  72 + List<CustomerBySellerSunModel> customerBySellerList; //全店客情列表
  73 +
69 ///客户经理获取所创建活动列表(选择优惠券) 74 ///客户经理获取所创建活动列表(选择优惠券)
70 Future<List<CouponSunModel>> getCustomerSelectActivityNew( 75 Future<List<CouponSunModel>> getCustomerSelectActivityNew(
71 BuildContext context, Map<String, String> params, 76 BuildContext context, Map<String, String> params,
@@ -189,17 +194,17 @@ class CustomerProvider extends ChangeNotifier { @@ -189,17 +194,17 @@ class CustomerProvider extends ChangeNotifier {
189 .catchError((error) { 194 .catchError((error) {
190 print(error.toString()); 195 print(error.toString());
191 if (error is MyError) { 196 if (error is MyError) {
192 - // switch (error.type) {  
193 - // case 1:  
194 - // pageState = PageState.ConnectivityError;  
195 - // break;  
196 - // case 2:  
197 - // pageState = PageState.ConnectivityTimeOut;  
198 - // break;  
199 - // default:  
200 - // pageState = PageState.ConnectivityError;  
201 - // break;  
202 - // } 197 + switch (error.type) {
  198 + case 1:
  199 + pageStateListShow = PageState.ConnectivityError;
  200 + break;
  201 + case 2:
  202 + pageStateListShow = PageState.ConnectivityTimeOut;
  203 + break;
  204 + default:
  205 + pageStateListShow = PageState.ConnectivityError;
  206 + break;
  207 + }
203 } 208 }
204 notifyListeners(); 209 notifyListeners();
205 }); 210 });
@@ -209,7 +214,7 @@ class CustomerProvider extends ChangeNotifier { @@ -209,7 +214,7 @@ class CustomerProvider extends ChangeNotifier {
209 return CustomerListSunModel.fromJson(value); 214 return CustomerListSunModel.fromJson(value);
210 }).toList(); 215 }).toList();
211 if (user.length == 0) { 216 if (user.length == 0) {
212 - pageState = PageState.Empty; 217 + pageStateListShow = PageState.Empty;
213 } else { 218 } else {
214 for (int i = 0; i < user.length; i++) { 219 for (int i = 0; i < user.length; i++) {
215 CustomerListSunModel item = user[i]; 220 CustomerListSunModel item = user[i];
@@ -246,9 +251,15 @@ class CustomerProvider extends ChangeNotifier { @@ -246,9 +251,15 @@ class CustomerProvider extends ChangeNotifier {
246 } 251 }
247 tempLabel = tempLabel.toSet().toList(); 252 tempLabel = tempLabel.toSet().toList();
248 labels = Utils.listToStringEnglish(tempLabel); 253 labels = Utils.listToStringEnglish(tempLabel);
  254 + pageStateListShow = PageState.Success;
249 } 255 }
250 - notifyListeners(); 256 + } else {
  257 + if (baseResp != null) {
  258 + Utils.showToast(baseResp.msg ?? "");
  259 + }
  260 + pageStateGuestInfo = PageState.ConnectivityTimeOut;
251 } 261 }
  262 + notifyListeners();
252 } 263 }
253 264
254 // 获取客户详情 265 // 获取客户详情
@@ -694,12 +705,13 @@ class CustomerProvider extends ChangeNotifier { @@ -694,12 +705,13 @@ class CustomerProvider extends ChangeNotifier {
694 // } 705 // }
695 } 706 }
696 707
697 - handleList(userHistorysShow, needRefresh: true); 708 + myHandleList(userHistorysShow, needRefresh: true);
698 } 709 }
699 } 710 }
700 711
701 //实时更新右边数据 ABCDEFGHIGK.... 712 //实时更新右边数据 ABCDEFGHIGK....
702 - handleList(List<CustomerListSunModel> list, {bool needRefresh = false}) { 713 +
  714 + myHandleList(List<CustomerListSunModel> list, {bool needRefresh = false}) {
703 if (list == null || list.isEmpty) return; 715 if (list == null || list.isEmpty) return;
704 for (int i = 0, length = list.length; i < length; i++) { 716 for (int i = 0, length = list.length; i < length; i++) {
705 String pinyin = ''; 717 String pinyin = '';
@@ -821,7 +833,13 @@ class CustomerProvider extends ChangeNotifier { @@ -821,7 +833,13 @@ class CustomerProvider extends ChangeNotifier {
821 return myRecordData; 833 return myRecordData;
822 } 834 }
823 835
824 - /** 商家客情 */ 836 + /**
  837 + *
  838 + *
  839 + * 商家客情
  840 + *
  841 + *
  842 + * */
825 843
826 ///全店客情首页 844 ///全店客情首页
827 Future<StoreCustomerHomeSunModel> getSellerGuestManage(BuildContext context, 845 Future<StoreCustomerHomeSunModel> getSellerGuestManage(BuildContext context,
@@ -879,6 +897,128 @@ class CustomerProvider extends ChangeNotifier { @@ -879,6 +897,128 @@ class CustomerProvider extends ChangeNotifier {
879 return storeSunmodel; 897 return storeSunmodel;
880 } 898 }
881 899
  900 + //获取商家客户列表
  901 + getCustomerBySeller(BuildContext context, Map<String, String> params) async {
  902 + BaseResp<List> baseResp = await DioUtil()
  903 + .request<List>(context, Method.get, HttpUrl.get_customer_by_seller,
  904 + data: params, showLoading: false)
  905 + .catchError((error) {
  906 + print(error.toString());
  907 + if (error is MyError) {
  908 + switch (error.type) {
  909 + case 1:
  910 + pageState = PageState.ConnectivityError;
  911 + break;
  912 + case 2:
  913 + pageState = PageState.ConnectivityTimeOut;
  914 + break;
  915 + default:
  916 + pageState = PageState.ConnectivityError;
  917 + break;
  918 + }
  919 + }
  920 + notifyListeners();
  921 + });
  922 + if (baseResp != null && baseResp.code == Constant.status_success) {
  923 + customerBySellerList =
  924 + CustomerBySellerModel.fromJson(baseResp.responseData).data;
  925 + if (customerBySellerList.length == 0) {
  926 + pageState = PageState.Empty;
  927 + } else {
  928 + pageState = PageState.Success;
  929 + for (int i = 0; i < customerBySellerList.length; i++) {
  930 + CustomerBySellerSunModel item = customerBySellerList[i];
  931 + // item.pinyinFirst = '';
  932 + // item.pinyinList = [];
  933 + // item.pinyinList = [];
  934 + if (item.rname != null) {
  935 + item.pinyin =
  936 + PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
  937 + // List<String> pinyinList =
  938 + // PinyinHelper.getPinyin(item.rname).split(' ');
  939 +
  940 + // String pinyinAll = ''; //组装全拼组合
  941 + // for (int j = 0; j < pinyinList.length; j++) {
  942 + // String letter = pinyinList[j];
  943 + // pinyinAll += pinyinList[j];
  944 + // item.pinyinList.add(pinyinAll);
  945 + // if (letter.length > 0) {
  946 + // item.pinyinFirst += pinyinList[j].substring(0, 1);
  947 + // } else {
  948 + // item.pinyinFirst += '';
  949 + // }
  950 + // }
  951 + }
  952 +
  953 + customerBySellerList[i] = item;
  954 + }
  955 + // userHistorysShow = userHistorys; //全部客户列表信息
  956 + // userHistorysShowHuoyue = [];
  957 + // userHistorysShowChenshui = [];
  958 + // userHistorysShowLiushi = [];
  959 + // for (CustomerListSunModel item in userHistorysShow) {
  960 + // if (item.attr == '活跃') {
  961 + // userHistorysShowHuoyue.add(item);
  962 + // } else if (item.attr == '沉睡') {
  963 + // userHistorysShowChenshui.add(item);
  964 + // } else if (item.attr == '流失') {
  965 + // userHistorysShowLiushi.add(item);
  966 + // }
  967 + // }
  968 + // if (userHistorysShowHuoyue.length > 0) {
  969 + // pageStateHuoyue = PageState.Success;
  970 + // } else {
  971 + // pageStateHuoyue = PageState.Empty;
  972 + // }
  973 + // if (userHistorysShowChenshui.length > 0) {
  974 + // pageStateChenshui = PageState.Success;
  975 + // } else {
  976 + // pageStateChenshui = PageState.Empty;
  977 + // }
  978 + // if (userHistorysShowLiushi.length > 0) {
  979 + // pageStateLiushi = PageState.Success;
  980 + // } else {
  981 + // pageStateLiushi = PageState.Empty;
  982 + // }
  983 +
  984 + handleList(customerBySellerList, needRefresh: true);
  985 + }
  986 + notifyListeners();
  987 + }
  988 + }
  989 +
  990 + //实时更新右边数据 ABCDEFGHIGK....
  991 + handleList(List<CustomerBySellerSunModel> list, {bool needRefresh = false}) {
  992 + if (list == null || list.isEmpty) return;
  993 + for (int i = 0, length = list.length; i < length; i++) {
  994 + String pinyin = '';
  995 + String tag = '';
  996 +
  997 + if (list[i].pinyin == null || list[i].pinyin == '') {
  998 + // list[i].pinyin = pinyin;
  999 + } else {
  1000 + tag = list[i].pinyin.substring(0, 1).toUpperCase();
  1001 + }
  1002 +
  1003 + if (RegExp("[A-Z]").hasMatch(tag)) {
  1004 + list[i].tagIndex = tag;
  1005 + } else {
  1006 + list[i].tagIndex = "#";
  1007 + }
  1008 + }
  1009 + // A-Z sort.
  1010 + SuspensionUtil.sortListBySuspensionTag(list);
  1011 +
  1012 + // show sus tag.
  1013 + SuspensionUtil.setShowSuspensionStatus(list);
  1014 +
  1015 + // add header.
  1016 + // _contacts.insert(0, UserHistoryEntity(name: 'header', tagIndex: '↑'));
  1017 + if (needRefresh) {
  1018 + notifyListeners();
  1019 + }
  1020 + }
  1021 +
882 //商家修改客情配置 1022 //商家修改客情配置
883 Future<bool> setSellerGuest(BuildContext context, Map<String, String> params, 1023 Future<bool> setSellerGuest(BuildContext context, Map<String, String> params,
884 {bool showLoading = false}) async { 1024 {bool showLoading = false}) async {
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
3 import 'package:one_key/constant/state.dart'; 3 import 'package:one_key/constant/state.dart';
4 import 'package:one_key/models/cookbook_model.dart'; 4 import 'package:one_key/models/cookbook_model.dart';
5 import 'package:one_key/models/coupon_model.dart'; 5 import 'package:one_key/models/coupon_model.dart';
  6 +import 'package:one_key/models/customer_by_seller_model.dart';
6 import 'package:one_key/models/customer_list_model.dart'; 7 import 'package:one_key/models/customer_list_model.dart';
7 import 'package:one_key/models/guest_info_model.dart'; 8 import 'package:one_key/models/guest_info_model.dart';
8 import 'package:one_key/models/integral_model.dart'; 9 import 'package:one_key/models/integral_model.dart';
@@ -596,7 +597,7 @@ class NavigatorUtil { @@ -596,7 +597,7 @@ class NavigatorUtil {
596 /// 客户详情 597 /// 客户详情
597 static Future<dynamic> goCustomerDetailPage( 598 static Future<dynamic> goCustomerDetailPage(
598 BuildContext context, 599 BuildContext context,
599 - CustomerListSunModel userHistoryEntity, 600 + CustomerBySellerSunModel userHistoryEntity,
600 FromPage fromPage, { 601 FromPage fromPage, {
601 replace = false, 602 replace = false,
602 }) { 603 }) {
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
5 import 'package:one_key/constant/state.dart'; 5 import 'package:one_key/constant/state.dart';
6 import 'package:one_key/models/cookbook_model.dart'; 6 import 'package:one_key/models/cookbook_model.dart';
7 import 'package:one_key/models/coupon_model.dart'; 7 import 'package:one_key/models/coupon_model.dart';
  8 +import 'package:one_key/models/customer_by_seller_model.dart';
8 import 'package:one_key/models/customer_list_model.dart'; 9 import 'package:one_key/models/customer_list_model.dart';
9 import 'package:one_key/models/guest_info_model.dart'; 10 import 'package:one_key/models/guest_info_model.dart';
10 import 'package:one_key/models/integral_model.dart'; 11 import 'package:one_key/models/integral_model.dart';
@@ -1027,9 +1028,10 @@ var myMakeMarkingPageOnlyShowHandle = new Handler( @@ -1027,9 +1028,10 @@ var myMakeMarkingPageOnlyShowHandle = new Handler(
1027 var customerDetailPageHandle = new Handler( 1028 var customerDetailPageHandle = new Handler(
1028 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1029 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1029 // String idstr = params["idstr"].first; 1030 // String idstr = params["idstr"].first;
1030 - CustomerListSunModel userHistoryEntity = CustomerListSunModel.fromJson(  
1031 - json.decode(FluroConvertUtils.fluroCnParamsDecode(  
1032 - params["userHistoryEntity"].first))); 1031 + CustomerBySellerSunModel userHistoryEntity =
  1032 + CustomerBySellerSunModel.fromJson(json.decode(
  1033 + FluroConvertUtils.fluroCnParamsDecode(
  1034 + params["userHistoryEntity"].first)));
1033 FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>( 1035 FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>(
1034 FromPage.values, params["fromPage"].first); 1036 FromPage.values, params["fromPage"].first);
1035 print(fromPage); 1037 print(fromPage);