Commit 4873126ec73c458f974a5924e96b91d686a07cc0

Authored by wdn127929
1 parent 53c89b34

经理客情

@@ -32,8 +32,10 @@ typedef ClickCallState = void Function(StateSetter state); @@ -32,8 +32,10 @@ typedef ClickCallState = void Function(StateSetter state);
32 32
33 class MyCustomerListPage extends StatefulWidget { 33 class MyCustomerListPage extends StatefulWidget {
34 final FromPage fromPage; 34 final FromPage fromPage;
  35 + final String index;
35 36
36 - const MyCustomerListPage({Key key, this.fromPage}) : super(key: key); 37 + const MyCustomerListPage({Key key, this.fromPage, this.index})
  38 + : super(key: key);
37 @override 39 @override
38 _MyCustomerListPageState createState() => _MyCustomerListPageState(); 40 _MyCustomerListPageState createState() => _MyCustomerListPageState();
39 } 41 }
@@ -57,6 +59,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -57,6 +59,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
57 // timeTilte = ['大于', '等于', '小于']; 59 // timeTilte = ['大于', '等于', '小于'];
58 super.initState(); 60 super.initState();
59 tabController = TabController(length: 4, vsync: this); 61 tabController = TabController(length: 4, vsync: this);
  62 + tabController.index = int.parse(widget.index);
  63 +
60 tabController.addListener(() { 64 tabController.addListener(() {
61 if (tabController.index == tabController.animation.value) { 65 if (tabController.index == tabController.animation.value) {
62 if (customerProvider.index == tabController.index) { 66 if (customerProvider.index == tabController.index) {
@@ -72,12 +76,18 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -72,12 +76,18 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
72 item.select = true; 76 item.select = true;
73 } 77 }
74 } 78 }
  79 + } else if (customerProvider.index == 0) {
  80 + customerProvider.hydSelAll = true;
  81 + for (FilterBtnModel item in customerProvider.filterHydList) {
  82 + item.select = true;
  83 + }
75 } 84 }
76 _getContantData(); 85 _getContantData();
77 } 86 }
78 }); 87 });
79 WidgetsBinding.instance.addPostFrameCallback((_) async { 88 WidgetsBinding.instance.addPostFrameCallback((_) async {
80 bool first = true; 89 bool first = true;
  90 + customerProvider.index = tabController.index;
81 if (widget.fromPage == FromPage.FromPageMakeRecord) { 91 if (widget.fromPage == FromPage.FromPageMakeRecord) {
82 customerProvider.selectCustomer = customerMakingProvider.selectCustomer; 92 customerProvider.selectCustomer = customerMakingProvider.selectCustomer;
83 customerProvider.labels = customerMakingProvider.labels; 93 customerProvider.labels = customerMakingProvider.labels;
@@ -1293,7 +1303,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1293,7 +1303,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1293 controller: tabController, 1303 controller: tabController,
1294 physics: NeverScrollableScrollPhysics(), 1304 physics: NeverScrollableScrollPhysics(),
1295 children: _returnListWidget())), 1305 children: _returnListWidget())),
1296 - customerProvider.pageState == PageState.Success 1306 + customerProvider.pageState == PageState.Success &&
  1307 + customerProvider.selectCustomer.length > 0
1297 ? _selectContantWidget() 1308 ? _selectContantWidget()
1298 : SizedBox(), 1309 : SizedBox(),
1299 // _searchWidget(), 1310 // _searchWidget(),
@@ -101,7 +101,19 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -101,7 +101,19 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
101 ), 101 ),
102 VEmptyView(20), 102 VEmptyView(20),
103 RoundButton( 103 RoundButton(
104 - onPressed: () async {}, 104 + onPressed: () async {
  105 + String index = '0';
  106 + if (btnTitle == '活跃客户') {
  107 + index = '1';
  108 + } else if (btnTitle == '沉睡客户') {
  109 + index = '2';
  110 + } else if (btnTitle == '流失客户') {
  111 + index = '3';
  112 + }
  113 + NavigatorUtil.goMyCustomerListPage(
  114 + context, FromPage.FromPageMyCustomer,
  115 + index: index);
  116 + },
105 text: btnTitle, 117 text: btnTitle,
106 fontSize: 24, 118 fontSize: 24,
107 isBold: false, 119 isBold: false,
@@ -315,6 +327,9 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -315,6 +327,9 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
315 fontSize: 26, 327 fontSize: 26,
316 isBold: false, 328 isBold: false,
317 onPressed: () { 329 onPressed: () {
  330 + // NavigatorUtil
  331 + // .goMyMakeMarkingPageOnlyShow(
  332 + // context, widget.sellerList);
318 // NavigatorUtil.goEnterStoreEnvironmentPage(context); 333 // NavigatorUtil.goEnterStoreEnvironmentPage(context);
319 }, 334 },
320 ), 335 ),
@@ -384,7 +399,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -384,7 +399,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
384 fontSize: 26, 399 fontSize: 26,
385 isBold: false, 400 isBold: false,
386 onPressed: () { 401 onPressed: () {
387 - // NavigatorUtil.goEnterStoreEnvironmentPage(context); 402 + // NavigatorUtil.goMyMakeMarkingPage(
  403 + // context,
  404 + // selfList: widget.selfList,
  405 + // fromPage: FromPage
  406 + // .FromPageMakeRecordDetail);
388 }, 407 },
389 ), 408 ),
390 ], 409 ],
@@ -441,7 +460,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -441,7 +460,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
441 fontSize: 26, 460 fontSize: 26,
442 isBold: false, 461 isBold: false,
443 onPressed: () { 462 onPressed: () {
444 - // NavigatorUtil.goEnterStoreEnvironmentPage(context); 463 + // NavigatorUtil.goMyMakeMarkingPage(
  464 + // context,
  465 + // selfList: widget.selfList,
  466 + // fromPage: FromPage
  467 + // .FromPageMakeRecordDetail);
445 }, 468 },
446 ), 469 ),
447 ], 470 ],
@@ -14,6 +14,7 @@ import 'package:one_key/provider/user_model.dart'; @@ -14,6 +14,7 @@ import 'package:one_key/provider/user_model.dart';
14 import 'package:one_key/res/colors.dart'; 14 import 'package:one_key/res/colors.dart';
15 import 'package:one_key/route/navigator_util.dart'; 15 import 'package:one_key/route/navigator_util.dart';
16 import 'package:one_key/utils/dialog_util.dart'; 16 import 'package:one_key/utils/dialog_util.dart';
  17 +import 'package:one_key/utils/event_bus.dart';
17 import 'package:one_key/utils/utils.dart'; 18 import 'package:one_key/utils/utils.dart';
18 import 'package:one_key/widgets/h_empty_view.dart'; 19 import 'package:one_key/widgets/h_empty_view.dart';
19 import 'package:one_key/widgets/round_button.dart'; 20 import 'package:one_key/widgets/round_button.dart';
@@ -172,6 +173,9 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { @@ -172,6 +173,9 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
172 '${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}'; 173 '${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}';
173 } 174 }
174 await customerProvider.createMarketing(context, params, showLoading: true); 175 await customerProvider.createMarketing(context, params, showLoading: true);
  176 + if (widget.fromPage == FromPage.FromPageMakeRecordDetail) {
  177 + bus.emit('refresh_my_records_page');
  178 + }
175 _goSms(); 179 _goSms();
176 } 180 }
177 181
@@ -215,9 +219,10 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { @@ -215,9 +219,10 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
215 // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () { 219 // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
216 // print('取消发送'); 220 // print('取消发送');
217 // }, rCallback: () async { 221 // }, rCallback: () async {
  222 + String message = customerMakingProvider.controller.text;
218 if (Platform.isIOS) { 223 if (Platform.isIOS) {
219 // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345']; 224 // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
220 - String message = customerMakingProvider.controller.text; 225 +
221 try { 226 try {
222 String _result = await sendSMS(message: message, recipients: iosPhone); 227 String _result = await sendSMS(message: message, recipients: iosPhone);
223 print(_result); 228 print(_result);
@@ -227,7 +232,6 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { @@ -227,7 +232,6 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
227 } else { 232 } else {
228 print('确定发送'); 233 print('确定发送');
229 // String phoneNumber = "18161963378;18729572142"; 234 // String phoneNumber = "18161963378;18729572142";
230 - String message = "test";  
231 235
232 // await Sendsms.onGetPermission(); 236 // await Sendsms.onGetPermission();
233 237
@@ -64,22 +64,24 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> { @@ -64,22 +64,24 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
64 } 64 }
65 }); 65 });
66 WidgetsBinding.instance.addPostFrameCallback((_) async { 66 WidgetsBinding.instance.addPostFrameCallback((_) async {
67 - for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {  
68 - gid += '${item.id},';  
69 - if (Platform.isIOS) {  
70 - iosPhone.add(item.phone);  
71 - } else {  
72 - andriodPhone += "${item.phone};";  
73 - }  
74 - }  
75 - if (gid.endsWith(',')) {  
76 - gid = gid.substring(0, gid.length - 1);  
77 - }  
78 - if (!Platform.isIOS && andriodPhone.endsWith(';')) {  
79 - andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);  
80 - } 67 + // print(widget.sellerList.guestCount);
  68 + // for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
  69 + // gid += '${item.id},';
  70 + // if (Platform.isIOS) {
  71 + // iosPhone.add(item.phone);
  72 + // } else {
  73 + // andriodPhone += "${item.phone};";
  74 + // }
  75 + // }
  76 + // if (gid.endsWith(',')) {
  77 + // gid = gid.substring(0, gid.length - 1);
  78 + // }
  79 + // if (!Platform.isIOS && andriodPhone.endsWith(';')) {
  80 + // andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
  81 + // }
81 customerMakingProvider.controller.text = widget.sellerList.content; 82 customerMakingProvider.controller.text = widget.sellerList.content;
82 _couponNetworkData(isShowLoading: false); 83 _couponNetworkData(isShowLoading: false);
  84 + _getGuestByGid();
83 }); 85 });
84 } 86 }
85 87
@@ -92,6 +94,56 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> { @@ -92,6 +94,56 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
92 // 94 //
93 } 95 }
94 96
  97 + _getPhoneAndGid() {
  98 + andriodPhone = '';
  99 + iosPhone = [];
  100 + for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
  101 + // gid += '${item.id},';
  102 + if (Platform.isIOS) {
  103 + iosPhone.add(item.phone);
  104 + } else {
  105 + andriodPhone += "${item.phone};";
  106 + }
  107 + }
  108 + // if (gid.endsWith(',')) {
  109 + // gid = gid.substring(0, gid.length - 1);
  110 + // }
  111 + if (!Platform.isIOS && andriodPhone.endsWith(';')) {
  112 + andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
  113 + }
  114 + }
  115 +
  116 + ///客户经理营销中的用户列表
  117 + _getGuestByGid({bool isShowLoading = true}) async {
  118 + // customerMakingProvider.couponSelectIndex = 0;
  119 + Map<String, String> params = {
  120 + "gid": widget.sellerList.gid,
  121 + };
  122 + await customerProvider.getGuestByGid(
  123 + context,
  124 + params,
  125 + );
  126 + print('''object''');
  127 + gid = widget.sellerList.gid;
  128 + // customerMakingProvider.labels = customerProvider.labels;
  129 + customerMakingProvider.selectCustomer = customerProvider.selectCustomer;
  130 + _getPhoneAndGid();
  131 + // customerMakingProvider.fromPage = widget.fromPage;
  132 + if (widget.sellerList.aid != null) {
  133 + //之前绑定过优惠
  134 + customerMakingProvider.isUse = true;
  135 + for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  136 + if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
  137 + customerMakingProvider.youhui =
  138 + customerProvider.couponListSelect[i].aname;
  139 + customerMakingProvider.couponSelectIndex = i;
  140 + }
  141 + }
  142 + }
  143 + customerMakingProvider.isUpdate = true;
  144 + setState(() {});
  145 + }
  146 +
95 ///消费券 147 ///消费券
96 _couponNetworkData({bool isShowLoading = true}) async { 148 _couponNetworkData({bool isShowLoading = true}) async {
97 // customerMakingProvider.couponSelectIndex = 0; 149 // customerMakingProvider.couponSelectIndex = 0;
@@ -172,9 +224,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> { @@ -172,9 +224,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
172 // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () { 224 // title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
173 // print('取消发送'); 225 // print('取消发送');
174 // }, rCallback: () async { 226 // }, rCallback: () async {
  227 + String message = customerMakingProvider.controller.text;
175 if (Platform.isIOS) { 228 if (Platform.isIOS) {
176 // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345']; 229 // List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
177 - String message = "test"; 230 +
178 try { 231 try {
179 String _result = await sendSMS(message: message, recipients: iosPhone); 232 String _result = await sendSMS(message: message, recipients: iosPhone);
180 print(_result); 233 print(_result);
@@ -184,7 +237,6 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> { @@ -184,7 +237,6 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
184 } else { 237 } else {
185 print('确定发送'); 238 print('确定发送');
186 // String phoneNumber = "18161963378;18729572142"; 239 // String phoneNumber = "18161963378;18729572142";
187 - String message = "test";  
188 240
189 // await Sendsms.onGetPermission(); 241 // await Sendsms.onGetPermission();
190 242
@@ -454,7 +506,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> { @@ -454,7 +506,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
454 InkWell( 506 InkWell(
455 onTap: () { 507 onTap: () {
456 needClear = false; 508 needClear = false;
457 - Navigator.pop(context); 509 + NavigatorUtil.goShowCustomerListPage(
  510 + context,
  511 + FromPage.FromPageMakeRecordDetail,
  512 + widget.sellerList.gid);
458 // NavigatorUtil.goMarketingRecordsDetailPage(context); 513 // NavigatorUtil.goMarketingRecordsDetailPage(context);
459 }, 514 },
460 child: Text('仅查看', 515 child: Text('仅查看',
@@ -178,7 +178,7 @@ class _MyMarketingRecordsDetailPageState @@ -178,7 +178,7 @@ class _MyMarketingRecordsDetailPageState
178 onTap: () { 178 onTap: () {
179 NavigatorUtil.goShowCustomerListPage( 179 NavigatorUtil.goShowCustomerListPage(
180 context, 180 context,
181 - FromPage.FromPageStoreCustomer, 181 + FromPage.FromPageMakeRecordDetail,
182 widget.selfList.gid); 182 widget.selfList.gid);
183 // NavigatorUtil.goMyMarketingRecordsDetailPage(context); 183 // NavigatorUtil.goMyMarketingRecordsDetailPage(context);
184 }, 184 },
@@ -7,6 +7,7 @@ import 'package:one_key/provider/customer_provider.dart'; @@ -7,6 +7,7 @@ import 'package:one_key/provider/customer_provider.dart';
7 import 'package:one_key/provider/user_model.dart'; 7 import 'package:one_key/provider/user_model.dart';
8 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
9 import 'package:one_key/route/navigator_util.dart'; 9 import 'package:one_key/route/navigator_util.dart';
  10 +import 'package:one_key/utils/event_bus.dart';
10 import 'package:one_key/utils/utils.dart'; 11 import 'package:one_key/utils/utils.dart';
11 import 'package:one_key/widgets/h_empty_view.dart'; 12 import 'package:one_key/widgets/h_empty_view.dart';
12 import 'package:one_key/widgets/page_exception.dart'; 13 import 'package:one_key/widgets/page_exception.dart';
@@ -31,10 +32,14 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> { @@ -31,10 +32,14 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> {
31 WidgetsBinding.instance.addPostFrameCallback((_) async { 32 WidgetsBinding.instance.addPostFrameCallback((_) async {
32 _getMarketingByUid(); 33 _getMarketingByUid();
33 }); 34 });
  35 + bus.on("refresh_my_records_page", (arg) {
  36 + _getMarketingByUid();
  37 + });
34 } 38 }
35 39
36 @override 40 @override
37 void dispose() { 41 void dispose() {
  42 + bus.off('refresh_my_records_page');
38 super.dispose(); 43 super.dispose();
39 } 44 }
40 45
@@ -650,9 +650,9 @@ class NavigatorUtil { @@ -650,9 +650,9 @@ class NavigatorUtil {
650 /// 我的客情列表 650 /// 我的客情列表
651 static Future<dynamic> goMyCustomerListPage( 651 static Future<dynamic> goMyCustomerListPage(
652 BuildContext context, FromPage fromPage, 652 BuildContext context, FromPage fromPage,
653 - {replace = false, bool needBtn = false}) { 653 + {replace = false, bool needBtn = false, String index = '0'}) {
654 return _navigateTo(context, 654 return _navigateTo(context,
655 - "${Routes.my_customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}", 655 + "${Routes.my_customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}&index=${index}",
656 replace: replace); 656 replace: replace);
657 } 657 }
658 658
@@ -898,9 +898,10 @@ var myCustomerListPageHandle = new Handler( @@ -898,9 +898,10 @@ var myCustomerListPageHandle = new Handler(
898 FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>( 898 FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>(
899 FromPage.values, params["fromPage"].first); 899 FromPage.values, params["fromPage"].first);
900 print(fromPage); 900 print(fromPage);
  901 + String index = params["index"].first;
901 return ChangeNotifierProvider<CustomerProvider>( 902 return ChangeNotifierProvider<CustomerProvider>(
902 create: (_) => CustomerProvider(), 903 create: (_) => CustomerProvider(),
903 - child: MyCustomerListPage(fromPage: fromPage)); 904 + child: MyCustomerListPage(fromPage: fromPage,index:index));
904 }); 905 });
905 906
906 ///客情设置 907 ///客情设置