Commit 097c175797865dad6e356dda63e852e7d381605d

Authored by wdn127929
1 parent 889a13b3

部分接口

  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'customer_label_model.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class CustomerLabelModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + List<CustomerLabelSunModel> data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + CustomerLabelModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory CustomerLabelModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$CustomerLabelModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$CustomerLabelModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class CustomerLabelSunModel extends Object {
  30 + @JsonKey(name: 'id')
  31 + String id;
  32 +
  33 + @JsonKey(name: 'sellerid')
  34 + String sellerid;
  35 +
  36 + @JsonKey(name: 'label')
  37 + String label;
  38 +
  39 + @JsonKey(name: 'cdate')
  40 + String cdate;
  41 +
  42 + CustomerLabelSunModel(
  43 + this.id,
  44 + this.sellerid,
  45 + this.label,
  46 + this.cdate,
  47 + );
  48 +
  49 + factory CustomerLabelSunModel.fromJson(Map<String, dynamic> srcJson) =>
  50 + _$CustomerLabelSunModelFromJson(srcJson);
  51 +
  52 + Map<String, dynamic> toJson() => _$CustomerLabelSunModelToJson(this);
  53 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'customer_label_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +CustomerLabelModel _$CustomerLabelModelFromJson(Map<String, dynamic> json) {
  10 + return CustomerLabelModel(
  11 + json['ret'] as int,
  12 + (json['data'] as List)
  13 + ?.map((e) => e == null
  14 + ? null
  15 + : CustomerLabelSunModel.fromJson(e as Map<String, dynamic>))
  16 + ?.toList(),
  17 + json['msg'] as String,
  18 + );
  19 +}
  20 +
  21 +Map<String, dynamic> _$CustomerLabelModelToJson(CustomerLabelModel instance) =>
  22 + <String, dynamic>{
  23 + 'ret': instance.ret,
  24 + 'data': instance.data,
  25 + 'msg': instance.msg,
  26 + };
  27 +
  28 +CustomerLabelSunModel _$CustomerLabelSunModelFromJson(
  29 + Map<String, dynamic> json) {
  30 + return CustomerLabelSunModel(
  31 + json['id'] as String,
  32 + json['sellerid'] as String,
  33 + json['label'] as String,
  34 + json['cdate'] as String,
  35 + );
  36 +}
  37 +
  38 +Map<String, dynamic> _$CustomerLabelSunModelToJson(
  39 + CustomerLabelSunModel instance) =>
  40 + <String, dynamic>{
  41 + 'id': instance.id,
  42 + 'sellerid': instance.sellerid,
  43 + 'label': instance.label,
  44 + 'cdate': instance.cdate,
  45 + };
@@ -194,5 +194,11 @@ class HttpUrl { @@ -194,5 +194,11 @@ class HttpUrl {
194 "?service=App.GuestManage.GetMarketingById"; // 商家营销详情 194 "?service=App.GuestManage.GetMarketingById"; // 商家营销详情
195 static const String set_guest_info_cday = 195 static const String set_guest_info_cday =
196 "?service=App.GuestManage.SetGuestCday"; // 设置客户纪念日 196 "?service=App.GuestManage.SetGuestCday"; // 设置客户纪念日
  197 + static const String seller_guest_get =
  198 + "?service=App.GuestManage.SellerGuestGet"; // 获取商家客情设置
  199 + static const String get_label_by_sellerid =
  200 + "?service=App.GuestManage.GetLabelBySellerid"; // 获取商家标签
  201 + static const String set_label_by_sellerid =
  202 + "?service=App.GuestManage.SetLabelBySellerid"; // 商家修改标签
197 203
198 } 204 }
@@ -193,6 +193,7 @@ class _ContactListPageState extends State<ContactListPage> { @@ -193,6 +193,7 @@ class _ContactListPageState extends State<ContactListPage> {
193 children: [ 193 children: [
194 model.rnameStr != null && model.rnameStr != '' 194 model.rnameStr != null && model.rnameStr != ''
195 ? Row( 195 ? Row(
  196 + crossAxisAlignment: CrossAxisAlignment.end,
196 children: [ 197 children: [
197 Container( 198 Container(
198 constraints: BoxConstraints( 199 constraints: BoxConstraints(
@@ -206,19 +207,26 @@ class _ContactListPageState extends State<ContactListPage> { @@ -206,19 +207,26 @@ class _ContactListPageState extends State<ContactListPage> {
206 fontWeight: FontWeight.bold), 207 fontWeight: FontWeight.bold),
207 )), 208 )),
208 HEmptyView(10), 209 HEmptyView(10),
209 - Text(  
210 - model.sexStr != '' ? '[${model.sexStr}]' : '',  
211 - style: TextStyle(  
212 - color: MyColours.color_333333,  
213 - fontSize: ScreenUtil().setSp(22),  
214 - ),  
215 - ), 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 + )),
216 HEmptyView(10), 222 HEmptyView(10),
217 ], 223 ],
218 ) 224 )
219 : SizedBox(), 225 : SizedBox(),
220 model.label != null 226 model.label != null
221 ? Container( 227 ? Container(
  228 + padding: EdgeInsets.only(
  229 + bottom: ScreenUtil().setWidth(4)),
222 constraints: BoxConstraints( 230 constraints: BoxConstraints(
223 maxWidth: ScreenUtil().setWidth(150)), 231 maxWidth: ScreenUtil().setWidth(150)),
224 child: Text( 232 child: Text(
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_label_model.dart';
4 import 'package:one_key/models/guest_info_model.dart'; 5 import 'package:one_key/models/guest_info_model.dart';
5 import 'package:one_key/provider/customer_provider.dart'; 6 import 'package:one_key/provider/customer_provider.dart';
  7 +import 'package:one_key/provider/user_model.dart';
6 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
7 import 'package:one_key/utils/dialog_util.dart'; 9 import 'package:one_key/utils/dialog_util.dart';
8 import 'package:one_key/utils/event_bus.dart'; 10 import 'package:one_key/utils/event_bus.dart';
@@ -43,6 +45,7 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> { @@ -43,6 +45,7 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
43 45
44 CustomerProvider customerProvider; 46 CustomerProvider customerProvider;
45 String labelShow = ''; 47 String labelShow = '';
  48 + ScrollController scrollController = ScrollController();
46 @override 49 @override
47 void initState() { 50 void initState() {
48 super.initState(); 51 super.initState();
@@ -80,9 +83,28 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> { @@ -80,9 +83,28 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
80 fwController.text = widget.guest.serve ?? ''; 83 fwController.text = widget.guest.serve ?? '';
81 labelShow = widget.guest.label ?? ''; 84 labelShow = widget.guest.label ?? '';
82 setState(() {}); 85 setState(() {});
  86 + _getLabelBySellerid();
  87 + // scrollController.jumpTo(scrollController.position.minScrollExtent);
83 }); 88 });
84 } 89 }
85 90
  91 + ///获取商家标签
  92 + _getLabelBySellerid() async {
  93 + Map<String, String> params = {
  94 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  95 + };
  96 + List<CustomerLabelSunModel> modelLabel =
  97 + await customerProvider.getLabelBySellerid(context, params);
  98 +
  99 + if (modelLabel.length > 0) {
  100 + for (int i = 0; i < customerProvider.labelList.length; i++) {
  101 + if (labelShow == customerProvider.labelList[i].label) {
  102 + customerProvider.labelSelIndex = i;
  103 + }
  104 + }
  105 + }
  106 + }
  107 +
86 _setGuestInfo() async { 108 _setGuestInfo() async {
87 if (nameStr.trim().length == 0) { 109 if (nameStr.trim().length == 0) {
88 Utils.showToast('请填写客户姓名'); 110 Utils.showToast('请填写客户姓名');
@@ -115,7 +137,7 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> { @@ -115,7 +137,7 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
115 params['position'] = positionController.text; 137 params['position'] = positionController.text;
116 } 138 }
117 if (labelShow != '') { 139 if (labelShow != '') {
118 - // params['label'] = 140 + params['label'] = labelShow;
119 } 141 }
120 if (jkController.text.trim().length > 0) { 142 if (jkController.text.trim().length > 0) {
121 params['taboos'] = jkController.text; 143 params['taboos'] = jkController.text;
@@ -365,251 +387,260 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> { @@ -365,251 +387,260 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
365 child: Padding( 387 child: Padding(
366 padding: EdgeInsets.symmetric( 388 padding: EdgeInsets.symmetric(
367 horizontal: ScreenUtil().setWidth(50)), 389 horizontal: ScreenUtil().setWidth(50)),
368 - child: SingleChildScrollView(  
369 - child: Column(  
370 - children: [  
371 - // VEmptyView(30),  
372 - Container(  
373 - // height: ScreenUtil().setWidth(60),  
374 - padding: EdgeInsets.symmetric(  
375 - vertical: ScreenUtil().setWidth(10)),  
376 - decoration: BoxDecoration(  
377 - border: Border(  
378 - bottom: BorderSide(  
379 - width: ScreenUtil().setWidth(2),  
380 - color:  
381 - Color.fromRGBO(220, 220, 220, 1)))),  
382 - child: Row(  
383 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
384 - crossAxisAlignment: CrossAxisAlignment.center,  
385 - children: [  
386 - Container(  
387 - // color: Colors.red,  
388 - width: ScreenUtil().setWidth(150),  
389 - height: ScreenUtil().setWidth(35),  
390 - child: Text(  
391 - '姓名',  
392 - style: TextStyle(  
393 - fontSize: ScreenUtil().setSp(28),  
394 - color: MyColours.color_333333),  
395 - ), 390 + child: ListView(
  391 + controller: scrollController,
  392 + children: [
  393 + // VEmptyView(30),
  394 + Container(
  395 + // height: ScreenUtil().setWidth(60),
  396 + padding: EdgeInsets.symmetric(
  397 + vertical: ScreenUtil().setWidth(10)),
  398 + decoration: BoxDecoration(
  399 + border: Border(
  400 + bottom: BorderSide(
  401 + width: ScreenUtil().setWidth(2),
  402 + color:
  403 + Color.fromRGBO(220, 220, 220, 1)))),
  404 + child: Row(
  405 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  406 + crossAxisAlignment: CrossAxisAlignment.center,
  407 + children: [
  408 + Container(
  409 + // color: Colors.red,
  410 + width: ScreenUtil().setWidth(150),
  411 + height: ScreenUtil().setWidth(35),
  412 + child: Text(
  413 + '姓名',
  414 + style: TextStyle(
  415 + fontSize: ScreenUtil().setSp(28),
  416 + color: MyColours.color_333333),
396 ), 417 ),
397 - Expanded(  
398 - child: TextField(  
399 - maxLines: 1, 418 + ),
  419 + Expanded(
  420 + child: TextField(
  421 + maxLines: 1,
400 422
401 - //输入文本的样式  
402 - style: TextStyle(  
403 - fontSize: ScreenUtil().setSp(30),  
404 - color: MyColours.color_353535),  
405 - controller: nameController,  
406 - focusNode: nameFocus,  
407 - // textAlignVertical: TextAlignVertical.top,  
408 - decoration: InputDecoration(  
409 - hintText: "填写姓名",  
410 - hintStyle: TextStyle(  
411 - color: MyColours.color_999999,  
412 - fontSize: ScreenUtil().setSp(30),  
413 - ),  
414 - // contentPadding:  
415 - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),  
416 - contentPadding: EdgeInsets.zero,  
417 - border: OutlineInputBorder(  
418 - borderSide: BorderSide.none), 423 + //输入文本的样式
  424 + style: TextStyle(
  425 + fontSize: ScreenUtil().setSp(30),
  426 + color: MyColours.color_353535),
  427 + controller: nameController,
  428 + focusNode: nameFocus,
  429 + // textAlignVertical: TextAlignVertical.top,
  430 + decoration: InputDecoration(
  431 + hintText: "填写姓名",
  432 + hintStyle: TextStyle(
  433 + color: MyColours.color_999999,
  434 + fontSize: ScreenUtil().setSp(30),
419 ), 435 ),
420 - onChanged: (value) {  
421 - print('ggg');  
422 -  
423 - if (value.endsWith('先生') ||  
424 - value.endsWith('女士') ||  
425 - value.endsWith('公司')) {  
426 - nameStr = value.substring(  
427 - 0, value.length - 2);  
428 - } else {  
429 - nameStr = value;  
430 - }  
431 - },  
432 - onEditingComplete: () {  
433 - print('fff');  
434 - nameFocus.unfocus();  
435 - // _homeEnterModel.nameController.text =  
436 - // nameStr + _nameSuffix();  
437 - _addNameSuffix(nameStr, _nameSuffix());  
438 - },  
439 - keyboardType: TextInputType.text, 436 + // contentPadding:
  437 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  438 + contentPadding: EdgeInsets.zero,
  439 + border: OutlineInputBorder(
  440 + borderSide: BorderSide.none),
440 ), 441 ),
  442 + onChanged: (value) {
  443 + print('ggg');
  444 +
  445 + if (value.endsWith('先生') ||
  446 + value.endsWith('女士') ||
  447 + value.endsWith('公司')) {
  448 + nameStr =
  449 + value.substring(0, value.length - 2);
  450 + } else {
  451 + nameStr = value;
  452 + }
  453 + },
  454 + onEditingComplete: () {
  455 + print('fff');
  456 + nameFocus.unfocus();
  457 + // _homeEnterModel.nameController.text =
  458 + // nameStr + _nameSuffix();
  459 + _addNameSuffix(nameStr, _nameSuffix());
  460 + },
  461 + keyboardType: TextInputType.text,
441 ), 462 ),
442 - // HEmptyView(40),  
443 - Row(  
444 - children: sexList.map((value) {  
445 - return _callButton(  
446 - onPress: () {  
447 - for (var item in sexList) {  
448 - item['select'] = false;  
449 - if (item['title'] == value['title']) {  
450 - item['select'] = true;  
451 - // _homeEnterModel.nameController.text =  
452 - // nameStr + item['title'];  
453 - if (nameStr != null &&  
454 - nameStr != '') {  
455 - _addNameSuffix(  
456 - nameStr, item['title']);  
457 - } 463 + ),
  464 + // HEmptyView(40),
  465 + Row(
  466 + children: sexList.map((value) {
  467 + return _callButton(
  468 + onPress: () {
  469 + for (var item in sexList) {
  470 + item['select'] = false;
  471 + if (item['title'] == value['title']) {
  472 + item['select'] = true;
  473 + // _homeEnterModel.nameController.text =
  474 + // nameStr + item['title'];
  475 + if (nameStr != null &&
  476 + nameStr != '') {
  477 + _addNameSuffix(
  478 + nameStr, item['title']);
458 } 479 }
459 } 480 }
460 - setState(() {});  
461 - },  
462 - content: value['title'],  
463 - hasLeftBorder: value['hasLeftBorder'],  
464 - isSelect: value['select']);  
465 - }).toList()),  
466 - ],  
467 - ), 481 + }
  482 + setState(() {});
  483 + },
  484 + content: value['title'],
  485 + hasLeftBorder: value['hasLeftBorder'],
  486 + isSelect: value['select']);
  487 + }).toList()),
  488 + ],
468 ), 489 ),
469 - _textfieldWidget(  
470 - '电话', '填写电话', phoneController, phoneFocus),  
471 - _textfieldWidget(  
472 - '工作单位', '填写工作单位', adressController, adressFocus),  
473 - _textfieldWidget('部门', '填写部门', departmentController,  
474 - departmentFocus),  
475 - _textfieldWidget(  
476 - '职位', '填写职位', positionController, positionFocus),  
477 - InkWell(  
478 - onTap: () {  
479 - FocusScope.of(context)  
480 - .requestFocus(FocusNode()); //隐藏键盘  
481 - // DialogUtil.showSelectCusmanDialog(  
482 - // context, couponList, (value) {  
483 - // if (value != null) {  
484 - // setState(() {  
485 - // couponSelectIndex = value.first;  
486 - // });  
487 - // }  
488 - // },  
489 - // selecteds: couponSelectIndex == null  
490 - // ? []  
491 - // : [couponSelectIndex])  
492 - // .then((value) {}); 490 + ),
  491 + _textfieldWidget(
  492 + '电话', '填写电话', phoneController, phoneFocus),
  493 + _textfieldWidget(
  494 + '工作单位', '填写工作单位', adressController, adressFocus),
  495 + _textfieldWidget('部门', '填写部门', departmentController,
  496 + departmentFocus),
  497 + _textfieldWidget(
  498 + '职位', '填写职位', positionController, positionFocus),
  499 + InkWell(
  500 + onTap: () {
  501 + FocusScope.of(context)
  502 + .requestFocus(FocusNode()); //隐藏键盘
  503 + DialogUtil.showSelectCusmanDialog(
  504 + context,
  505 + customerProvider.labelList.map((item) {
  506 + return item.label;
  507 + }).toList(), (value) {
  508 + if (value != null) {
  509 + setState(() {
  510 + customerProvider.labelSelIndex =
  511 + value.first;
  512 + labelShow = customerProvider
  513 + .labelList[
  514 + customerProvider.labelSelIndex]
  515 + .label;
  516 + });
  517 + }
493 }, 518 },
494 - child: Container(  
495 - // height: ScreenUtil().setWidth(60),  
496 - padding: EdgeInsets.symmetric(  
497 - vertical: ScreenUtil().setWidth(50)),  
498 - decoration: BoxDecoration(  
499 - border: Border(  
500 - bottom: BorderSide(  
501 - width: ScreenUtil().setWidth(2),  
502 - color: Color.fromRGBO(  
503 - 220, 220, 220, 1)))),  
504 - child: Row(  
505 - mainAxisAlignment:  
506 - MainAxisAlignment.spaceBetween,  
507 - crossAxisAlignment: CrossAxisAlignment.center,  
508 - children: [  
509 - Container(  
510 - // color: Colors.red,  
511 - width: ScreenUtil().setWidth(150),  
512 - height: ScreenUtil().setWidth(35), 519 + selecteds:
  520 + customerProvider.labelSelIndex == null
  521 + ? []
  522 + : [
  523 + customerProvider.labelSelIndex
  524 + ])
  525 + .then((value) {});
  526 + },
  527 + child: Container(
  528 + // height: ScreenUtil().setWidth(60),
  529 + padding: EdgeInsets.symmetric(
  530 + vertical: ScreenUtil().setWidth(50)),
  531 + decoration: BoxDecoration(
  532 + border: Border(
  533 + bottom: BorderSide(
  534 + width: ScreenUtil().setWidth(2),
  535 + color: Color.fromRGBO(
  536 + 220, 220, 220, 1)))),
  537 + child: Row(
  538 + mainAxisAlignment:
  539 + MainAxisAlignment.spaceBetween,
  540 + crossAxisAlignment: CrossAxisAlignment.center,
  541 + children: [
  542 + Container(
  543 + // color: Colors.red,
  544 + width: ScreenUtil().setWidth(150),
  545 + height: ScreenUtil().setWidth(35),
  546 + child: Text(
  547 + '自定义标签',
  548 + style: TextStyle(
  549 + fontSize: ScreenUtil().setSp(28),
  550 + color: MyColours.color_333333),
  551 + ),
  552 + ),
  553 + Expanded(
513 child: Text( 554 child: Text(
514 - '自定义标签',  
515 - style: TextStyle(  
516 - fontSize: ScreenUtil().setSp(28),  
517 - color: MyColours.color_333333),  
518 - ), 555 + labelShow,
  556 + overflow: TextOverflow.ellipsis,
  557 + style: TextStyle(
  558 + color: Color.fromRGBO(193, 194, 63, 1),
  559 + fontSize: ScreenUtil().setSp(28),
519 ), 560 ),
520 - Expanded( 561 + )),
  562 + HEmptyView(10),
  563 + Image.asset(
  564 + Utils.getImgPath(showLabel
  565 + ? 'c_arrow_up'
  566 + : 'c_arrow_down'),
  567 + width: ScreenUtil().setWidth(24),
  568 + // height: ScreenUtil().setWidth(10),
  569 + )
  570 + ],
  571 + ),
  572 + )),
  573 + widget.fromPage == FromPage.FromPageMyCustomer
  574 + ? SizedBox()
  575 + : InkWell(
  576 + onTap: () {
  577 + // DialogUtil.showSelectCusmanDialog(
  578 + // context, couponList, (value) {
  579 + // if (value != null) {
  580 + // setState(() {
  581 + // couponSelectIndex = value.first;
  582 + // });
  583 + // }
  584 + // },
  585 + // selecteds: couponSelectIndex == null
  586 + // ? []
  587 + // : [couponSelectIndex])
  588 + // .then((value) {});
  589 + },
  590 + child: Container(
  591 + // height: ScreenUtil().setWidth(60),
  592 + padding: EdgeInsets.symmetric(
  593 + vertical: ScreenUtil().setWidth(50)),
  594 + decoration: BoxDecoration(
  595 + border: Border(
  596 + bottom: BorderSide(
  597 + width: ScreenUtil().setWidth(2),
  598 + color: Color.fromRGBO(
  599 + 220, 220, 220, 1)))),
  600 + child: Row(
  601 + mainAxisAlignment:
  602 + MainAxisAlignment.spaceBetween,
  603 + crossAxisAlignment:
  604 + CrossAxisAlignment.center,
  605 + children: [
  606 + Container(
  607 + // color: Colors.red,
  608 + width: ScreenUtil().setWidth(150),
  609 + height: ScreenUtil().setWidth(35),
521 child: Text( 610 child: Text(
522 - labelShow,  
523 - overflow: TextOverflow.ellipsis,  
524 - style: TextStyle(  
525 - color: Color.fromRGBO(193, 194, 63, 1),  
526 - fontSize: ScreenUtil().setSp(28), 611 + '客户经理',
  612 + style: TextStyle(
  613 + fontSize: ScreenUtil().setSp(28),
  614 + color: MyColours.color_333333),
  615 + ),
527 ), 616 ),
528 - )),  
529 - HEmptyView(10),  
530 - Image.asset(  
531 - Utils.getImgPath(showLabel  
532 - ? 'c_arrow_up'  
533 - : 'c_arrow_down'),  
534 - width: ScreenUtil().setWidth(24),  
535 - // height: ScreenUtil().setWidth(10),  
536 - )  
537 - ],  
538 - ),  
539 - )),  
540 - widget.fromPage == FromPage.FromPageMyCustomer  
541 - ? SizedBox()  
542 - : InkWell(  
543 - onTap: () {  
544 - // DialogUtil.showSelectCusmanDialog(  
545 - // context, couponList, (value) {  
546 - // if (value != null) {  
547 - // setState(() {  
548 - // couponSelectIndex = value.first;  
549 - // });  
550 - // }  
551 - // },  
552 - // selecteds: couponSelectIndex == null  
553 - // ? []  
554 - // : [couponSelectIndex])  
555 - // .then((value) {});  
556 - },  
557 - child: Container(  
558 - // height: ScreenUtil().setWidth(60),  
559 - padding: EdgeInsets.symmetric(  
560 - vertical: ScreenUtil().setWidth(50)),  
561 - decoration: BoxDecoration(  
562 - border: Border(  
563 - bottom: BorderSide(  
564 - width: ScreenUtil().setWidth(2),  
565 - color: Color.fromRGBO(  
566 - 220, 220, 220, 1)))),  
567 - child: Row(  
568 - mainAxisAlignment:  
569 - MainAxisAlignment.spaceBetween,  
570 - crossAxisAlignment:  
571 - CrossAxisAlignment.center,  
572 - children: [  
573 - Container(  
574 - // color: Colors.red,  
575 - width: ScreenUtil().setWidth(150),  
576 - height: ScreenUtil().setWidth(35), 617 + Expanded(
577 child: Text( 618 child: Text(
578 - '客户经理',  
579 - style: TextStyle(  
580 - fontSize:  
581 - ScreenUtil().setSp(28),  
582 - color: MyColours.color_333333),  
583 - ), 619 + 'xxxj',
  620 + overflow: TextOverflow.ellipsis,
  621 + style: TextStyle(
  622 + color: MyColours.color_333333,
  623 + fontSize: ScreenUtil().setSp(28),
584 ), 624 ),
585 - Expanded(  
586 - child: Text(  
587 - 'xxxj',  
588 - overflow: TextOverflow.ellipsis,  
589 - style: TextStyle(  
590 - color: MyColours.color_333333,  
591 - fontSize: ScreenUtil().setSp(28),  
592 - ),  
593 - )),  
594 - HEmptyView(10),  
595 - Image.asset(  
596 - Utils.getImgPath(showLabel  
597 - ? 'c_arrow_up'  
598 - : 'c_arrow_down'),  
599 - width: ScreenUtil().setWidth(24),  
600 - // height: ScreenUtil().setWidth(10),  
601 - )  
602 - ],  
603 - ),  
604 - )),  
605 - VEmptyView(60),  
606 - _textMulLine('忌口', '输入忌口的东西', jkController),  
607 - VEmptyView(30),  
608 - _textMulLine('喜好', '输入喜好', xhController),  
609 - VEmptyView(30),  
610 - _textMulLine('服务', '输入服务', fwController),  
611 - ],  
612 - ), 625 + )),
  626 + HEmptyView(10),
  627 + Image.asset(
  628 + Utils.getImgPath(showLabel
  629 + ? 'c_arrow_up'
  630 + : 'c_arrow_down'),
  631 + width: ScreenUtil().setWidth(24),
  632 + // height: ScreenUtil().setWidth(10),
  633 + )
  634 + ],
  635 + ),
  636 + )),
  637 + VEmptyView(60),
  638 + _textMulLine('忌口', '输入忌口的东西', jkController),
  639 + VEmptyView(30),
  640 + _textMulLine('喜好', '输入喜好', xhController),
  641 + VEmptyView(30),
  642 + _textMulLine('服务', '输入服务', fwController),
  643 + ],
613 ))), 644 ))),
614 RoundButton( 645 RoundButton(
615 text: '保存', 646 text: '保存',
@@ -172,6 +172,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -172,6 +172,7 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
172 crossAxisAlignment: CrossAxisAlignment.end, 172 crossAxisAlignment: CrossAxisAlignment.end,
173 children: [ 173 children: [
174 Container( 174 Container(
  175 + height: ScreenUtil().setWidth(80),
175 constraints: 176 constraints:
176 BoxConstraints(maxWidth: ScreenUtil().setWidth(260)), 177 BoxConstraints(maxWidth: ScreenUtil().setWidth(260)),
177 child: Text( 178 child: Text(
@@ -182,15 +183,20 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> { @@ -182,15 +183,20 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
182 fontSize: ScreenUtil().setSp(64)), 183 fontSize: ScreenUtil().setSp(64)),
183 )), 184 )),
184 HEmptyView(10), 185 HEmptyView(10),
185 - Text(  
186 - customerProvider.guestInfoSunModel.guest.sexStr != ''  
187 - ? '[${customerProvider.guestInfoSunModel.guest.sexStr}]'  
188 - : '',  
189 - style: TextStyle(  
190 - color: MyColours.color_333333,  
191 - fontSize: ScreenUtil().setSp(22),  
192 - ),  
193 - ), 186 + Container(
  187 + height: ScreenUtil().setWidth(80),
  188 + padding:
  189 + EdgeInsets.only(bottom: ScreenUtil().setWidth(8)),
  190 + alignment: Alignment.bottomLeft,
  191 + child: Text(
  192 + customerProvider.guestInfoSunModel.guest.sexStr != ''
  193 + ? '[${customerProvider.guestInfoSunModel.guest.sexStr}]'
  194 + : '',
  195 + style: TextStyle(
  196 + color: MyColours.color_333333,
  197 + fontSize: ScreenUtil().setSp(22),
  198 + ),
  199 + )),
194 ], 200 ],
195 ), 201 ),
196 customerProvider.guestInfoSunModel.guest.label != null 202 customerProvider.guestInfoSunModel.guest.label != null
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/customer_label_model.dart';
3 import 'package:one_key/provider/customer_provider.dart'; 4 import 'package:one_key/provider/customer_provider.dart';
4 import 'package:one_key/provider/user_model.dart'; 5 import 'package:one_key/provider/user_model.dart';
5 import 'package:one_key/res/colors.dart'; 6 import 'package:one_key/res/colors.dart';
@@ -17,13 +18,15 @@ class CustomerSettingPage extends StatefulWidget { @@ -17,13 +18,15 @@ class CustomerSettingPage extends StatefulWidget {
17 } 18 }
18 19
19 class _CustomerSettingPageState extends State<CustomerSettingPage> { 20 class _CustomerSettingPageState extends State<CustomerSettingPage> {
20 - bool swichState = true; 21 + bool swichState = false;
21 CustomerProvider customerProvider; 22 CustomerProvider customerProvider;
22 23
23 @override 24 @override
24 void initState() { 25 void initState() {
25 WidgetsBinding.instance.addPostFrameCallback((_) async { 26 WidgetsBinding.instance.addPostFrameCallback((_) async {
26 // _getContantData(); 27 // _getContantData();
  28 + _sellerGuestGet();
  29 + _getLabelBySellerid();
27 }); 30 });
28 } 31 }
29 32
@@ -34,9 +37,30 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { @@ -34,9 +37,30 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> {
34 'is_additional': swichState ? "1" : "0" 37 'is_additional': swichState ? "1" : "0"
35 }; 38 };
36 bool success = await customerProvider.setSellerGuest(context, params); 39 bool success = await customerProvider.setSellerGuest(context, params);
  40 + if (success) {}
  41 + }
  42 +
  43 + ///获取客情配置
  44 + _sellerGuestGet() async {
  45 + Map<String, String> params = {
  46 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  47 + };
  48 + bool success = await customerProvider.getSellerGuest(context, params);
  49 +
37 if (success) { 50 if (success) {
38 - 51 + swichState = true;
  52 + } else {
  53 + swichState = false;
39 } 54 }
  55 + setState(() {});
  56 + }
  57 +
  58 + ///获取商家标签
  59 + _getLabelBySellerid() async {
  60 + Map<String, String> params = {
  61 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  62 + };
  63 + await customerProvider.getLabelBySellerid(context, params);
40 } 64 }
41 65
42 ///商家创建商家标签 66 ///商家创建商家标签
@@ -52,30 +76,45 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { @@ -52,30 +76,45 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> {
52 Utils.showToast('标签添加成功'); 76 Utils.showToast('标签添加成功');
53 //调用获取标签接口 77 //调用获取标签接口
54 // 。。。。。。 78 // 。。。。。。
  79 + _getLabelBySellerid();
  80 + }
  81 + }
  82 +
  83 + ///商家修改标签
  84 + _setLabelBySellerid(String id, String name) async {
  85 + Map<String, String> params = {"id": id, 'label': name};
  86 + bool success = await customerProvider.setLabelBySellerid(context, params);
  87 + if (success) {
  88 + //刷新当前标签列表
  89 + Utils.showToast('标签修改成功');
  90 + //调用获取标签接口
  91 + // 。。。。。。
  92 + _getLabelBySellerid();
55 } 93 }
56 } 94 }
57 95
58 //构建标签 96 //构建标签
59 - List<Widget> _buildLabelItem(List<String> data) { 97 + List<Widget> _buildLabelItem(List<CustomerLabelSunModel> data) {
60 List<Widget> items = []; 98 List<Widget> items = [];
61 99
62 - for (String item in data) { 100 + for (CustomerLabelSunModel item in data) {
63 items.add(InkWell( 101 items.add(InkWell(
64 onTap: () { 102 onTap: () {
65 DialogUtil.textfeildAlertDialog(context, 103 DialogUtil.textfeildAlertDialog(context,
66 title: '自定义标签名称', 104 title: '自定义标签名称',
67 hintText: '例:高频客户', 105 hintText: '例:高频客户',
68 - text: item, 106 + text: item.label,
69 lenghtLimit: false, 107 lenghtLimit: false,
70 toast: '请输入标签名称', rCallback: (name) { 108 toast: '请输入标签名称', rCallback: (name) {
71 print(name); 109 print(name);
  110 + _setLabelBySellerid(item.id, name);
72 // _addCookbookClass(name, showLoading: true); 111 // _addCookbookClass(name, showLoading: true);
73 }); 112 });
74 }, 113 },
75 child: Container( 114 child: Container(
76 height: ScreenUtil().setWidth(40), 115 height: ScreenUtil().setWidth(40),
77 child: Text( 116 child: Text(
78 - item, 117 + item.label,
79 style: TextStyle( 118 style: TextStyle(
80 color: Color.fromRGBO(193, 194, 63, 1), 119 color: Color.fromRGBO(193, 194, 63, 1),
81 fontSize: ScreenUtil().setSp(26), 120 fontSize: ScreenUtil().setSp(26),
@@ -166,14 +205,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { @@ -166,14 +205,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> {
166 Wrap( 205 Wrap(
167 spacing: ScreenUtil().setWidth(20), 206 spacing: ScreenUtil().setWidth(20),
168 runSpacing: ScreenUtil().setWidth(10), 207 runSpacing: ScreenUtil().setWidth(10),
169 - children: _buildLabelItem([  
170 - '低频高消费',  
171 - 'fdsfsdf',  
172 - 'dfsdfsf',  
173 - 'ff',  
174 - 'ff',  
175 - 'sfsuhfsuhfiuhfuaihuf'  
176 - ])), 208 + children: _buildLabelItem(customerProvider.labelList)),
177 ], 209 ],
178 )), 210 )),
179 ), 211 ),
@@ -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_label_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/guest_manage_model.dart'; 11 import 'package:one_key/models/guest_manage_model.dart';
@@ -53,6 +54,9 @@ class CustomerProvider extends ChangeNotifier { @@ -53,6 +54,9 @@ class CustomerProvider extends ChangeNotifier {
53 List<MarketingBySellerSunModel> marketingBySellerSunModel; 54 List<MarketingBySellerSunModel> marketingBySellerSunModel;
54 55
55 MarketingByIdSunModel marketingByIdSunModel; 56 MarketingByIdSunModel marketingByIdSunModel;
  57 + List<CustomerLabelSunModel> labelList = []; //标签数据
  58 +
  59 + int labelSelIndex;
56 60
57 ///客户经理获取所创建活动列表(选择优惠券) 61 ///客户经理获取所创建活动列表(选择优惠券)
58 Future<List<CouponSunModel>> getCustomerSelectActivityNew( 62 Future<List<CouponSunModel>> getCustomerSelectActivityNew(
@@ -732,6 +736,32 @@ class CustomerProvider extends ChangeNotifier { @@ -732,6 +736,32 @@ class CustomerProvider extends ChangeNotifier {
732 } 736 }
733 } 737 }
734 738
  739 + //获取商家客情设置
  740 + Future<bool> getSellerGuest(BuildContext context, Map<String, String> params,
  741 + {bool showLoading = false}) async {
  742 + BaseResp<dynamic> baseResp = await DioUtil()
  743 + .request<dynamic>(context, Method.get, HttpUrl.seller_guest_get,
  744 + data: params, showLoading: showLoading)
  745 + .catchError((error) {
  746 + print(error.toString());
  747 + if (error is MyError) {}
  748 + notifyListeners();
  749 + });
  750 + if (baseResp != null && baseResp.code == Constant.status_success) {
  751 + // guestReserveSunModel =
  752 + // GuestReserveModel.fromJson(baseResp.responseData).data;
  753 + if (baseResp.responseData['data']['is_additional'] == '1') {
  754 + return true;
  755 + }
  756 + return false;
  757 + } else {
  758 + if (baseResp != null) {
  759 + Utils.showToast(baseResp.msg ?? "");
  760 + }
  761 + return false;
  762 + }
  763 + }
  764 +
735 // 商家创建商家标签 765 // 商家创建商家标签
736 Future<bool> createLabelBySellerid( 766 Future<bool> createLabelBySellerid(
737 BuildContext context, Map<String, String> params, 767 BuildContext context, Map<String, String> params,
@@ -760,6 +790,58 @@ class CustomerProvider extends ChangeNotifier { @@ -760,6 +790,58 @@ class CustomerProvider extends ChangeNotifier {
760 } 790 }
761 } 791 }
762 792
  793 + // 商家修改标签
  794 + Future<bool> setLabelBySellerid(
  795 + BuildContext context, Map<String, String> params,
  796 + {bool showLoading = false}) async {
  797 + BaseResp<dynamic> baseResp = await DioUtil()
  798 + .request<dynamic>(context, Method.get, HttpUrl.set_label_by_sellerid,
  799 + data: params, showLoading: showLoading)
  800 + .catchError((error) {
  801 + print(error.toString());
  802 + if (error is MyError) {}
  803 + notifyListeners();
  804 + });
  805 + if (baseResp != null && baseResp.code == Constant.status_success) {
  806 + // guestReserveSunModel =
  807 + // GuestReserveModel.fromJson(baseResp.responseData).data;
  808 + if (baseResp.responseData['data'] != null &&
  809 + baseResp.responseData['data'] == 1) {
  810 + return true;
  811 + }
  812 + return false;
  813 + } else {
  814 + if (baseResp != null) {
  815 + Utils.showToast(baseResp.msg ?? "");
  816 + }
  817 + return false;
  818 + }
  819 + }
  820 +
  821 + // 商家获取商家标签
  822 + Future<List<CustomerLabelSunModel>> getLabelBySellerid(
  823 + BuildContext context, Map<String, String> params,
  824 + {bool showLoading = false}) async {
  825 + BaseResp<dynamic> baseResp = await DioUtil()
  826 + .request<dynamic>(context, Method.get, HttpUrl.get_label_by_sellerid,
  827 + data: params, showLoading: showLoading)
  828 + .catchError((error) {
  829 + print(error.toString());
  830 + if (error is MyError) {}
  831 + notifyListeners();
  832 + });
  833 + if (baseResp != null && baseResp.code == Constant.status_success) {
  834 + labelList = CustomerLabelModel.fromJson(baseResp.responseData).data;
  835 + } else {
  836 + if (baseResp != null) {
  837 + Utils.showToast(baseResp.msg ?? "");
  838 + }
  839 + }
  840 +
  841 + notifyListeners();
  842 + return labelList;
  843 + }
  844 +
763 // 商家创建营销 845 // 商家创建营销
764 createMarketingBySeller(BuildContext context, Map<String, String> params, 846 createMarketingBySeller(BuildContext context, Map<String, String> params,
765 {bool showLoading = false}) async { 847 {bool showLoading = false}) async {