Commit fc2df683e8fb8c58d31549892083a0a3b206e33c

Authored by wdn127929
1 parent 4873126e

全店

... ... @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/customer_label_model.dart';
import 'package:one_key/models/filter_btn_model.dart';
import 'package:one_key/pages/my/customer_type/store_customer/contant_list_page.dart';
import 'package:one_key/provider/customer_making_provider.dart';
... ... @@ -25,11 +27,15 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
typedef ClickCallback = void Function(dynamic value);
typedef ClickCall = void Function(FilterBtnModel value);
typedef ClickCallState = void Function(StateSetter state);
class CustomerListPage extends StatefulWidget {
final FromPage fromPage;
final String index;
const CustomerListPage({Key key, this.fromPage}) : super(key: key);
const CustomerListPage({Key key, this.fromPage, this.index})
: super(key: key);
@override
_CustomerListPageState createState() => _CustomerListPageState();
}
... ... @@ -53,6 +59,7 @@ class _CustomerListPageState extends State<CustomerListPage>
// timeTilte = ['大于', '等于', '小于'];
super.initState();
tabController = TabController(length: 4, vsync: this);
tabController.index = int.parse(widget.index);
tabController.addListener(() {
if (tabController.index == tabController.animation.value) {
if (customerProvider.index == tabController.index) {
... ... @@ -60,12 +67,36 @@ class _CustomerListPageState extends State<CustomerListPage>
}
print(tabController.index);
customerProvider.index = tabController.index;
if (customerProvider.index != 0 && customerProvider.index != null) {
//1 活跃 2 沉睡 3 流失
for (FilterBtnModel item in customerProvider.filterHydList) {
item.select = false;
if (item.id == '${customerProvider.index}') {
item.select = true;
}
}
} else if (customerProvider.index == 0) {
customerProvider.hydSelAll = true;
for (FilterBtnModel item in customerProvider.filterHydList) {
item.select = true;
}
}
_getContantData();
}
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
_getContantData();
bool first = true;
customerProvider.index = tabController.index;
if (widget.fromPage == FromPage.FromPageMakeRecord) {
customerProvider.selectCustomerSeller = customerMakingProvider.selectCustomerSeller;
customerProvider.labels = customerMakingProvider.labels;
first = false;
}
customerProvider.initData();
_getContantData(first: first);
_filterLabelList();
});
bus.on("refresh_guest_list", (arg) {
_getContantData();
});
... ... @@ -77,7 +108,22 @@ class _CustomerListPageState extends State<CustomerListPage>
super.dispose();
}
_getContantData({bool showLoading = true}) async {
_filterLabelList() async {
await customerProvider.getLabelBySellerid(context);
if (customerProvider.labelList != null &&
customerProvider.labelList.length > 0) {
customerProvider.filterLabelList = [];
for (CustomerLabelSunModel item in customerProvider.labelList) {
FilterBtnModel model = FilterBtnModel();
model.title = item.label;
model.id = item.id;
model.select = false;
customerProvider.filterLabelList.add(model);
}
}
}
_getContantData({bool showLoading = true, bool first = false}) async {
if (showLoading) {
customerProvider.pageState = PageState.Loading;
}
... ... @@ -85,23 +131,62 @@ class _CustomerListPageState extends State<CustomerListPage>
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
if (customerProvider.index != 0 && customerProvider.index != null) {
params['active'] = '${customerProvider.index}'; //1 活跃 2 沉睡 3 流失
//1 活跃 2 沉睡 3 流失
for (FilterBtnModel item in customerProvider.filterHydList) {
if (item.id == '${customerProvider.index}') {
item.select = true;
}
}
}
String active = '';
for (FilterBtnModel item in customerProvider.filterHydList) {
if (item.select) {
active += '${item.id},';
}
}
if (active.length > 0) {
if (active.endsWith(',')) {
active = active.substring(0, active.length - 1);
}
params['active'] = active;
}
if (customerProvider.controller.text.trim().length > 0) {
params['keyword'] = customerProvider.controller.text; //搜索手机号/姓名
}
String labels = '';
for (FilterBtnModel item in customerProvider.filterLabelList) {
if (item.select) {
labels += '${item.id},';
}
}
if (labels.length > 0) {
if (labels.endsWith(',')) {
labels = labels.substring(0, labels.length - 1);
}
params['labelid'] = labels;
}
//
//
// params['uid'] 经理ID
// params['labelid'] 标签ID
// params['stime'] 起始天数,例: 60
// params['etime'] 截止天数,例: 120
// params['reserve_date'] XX天内,例:30
// params['reserve_num'] 时间内预定次数
// params['reserve_sort'] 1 等于 2 小于 3 大于
if (customerProvider.controllerstime.text.trim().length > 0) {
params['stime'] = customerProvider.controllerstime.text;
}
if (customerProvider.controlleretime.text.trim().length > 0) {
params['etime'] = customerProvider.controlleretime.text;
}
if (customerProvider.controllernum.text.trim().length > 0) {
params['reserve_num'] = customerProvider.controlleretime.text;
params['reserve_sort'] = '${dropValue + 1}';
}
await customerProvider.getCustomerBySeller(context, params);
if (first) {
customerProvider.addAll();
}
}
// ///选中的联系人widget
... ... @@ -127,9 +212,9 @@ class _CustomerListPageState extends State<CustomerListPage>
InkWell(
onTap: () {
if (customerProvider.checkValue) {
// customerProvider.cancelAll();
customerProvider.cancelAll();
} else {
// customerProvider.addAll();
customerProvider.addAll();
}
},
child: Row(
... ... @@ -154,20 +239,29 @@ class _CustomerListPageState extends State<CustomerListPage>
Expanded(
child: InkWell(
onTap: () {
if (customerProvider.selectCustomer == null ||
customerProvider.selectCustomer.length == 0) {
if (customerProvider.selectCustomerSeller == null ||
customerProvider.selectCustomerSeller.length == 0) {
Utils.showToast('请至少选择1名顾客');
return;
}
if (widget.fromPage == FromPage.FromPageHome) {
customerMakingProvider.labels = customerProvider.labels;
customerMakingProvider.selectCustomer =
customerProvider.selectCustomer;
customerMakingProvider.selectCustomerSeller =
customerProvider.selectCustomerSeller;
customerMakingProvider.fromPage = widget.fromPage;
NavigatorUtil.goMakeMarkingPage(context,
fromPage: FromPage.FromPageCustomerList);
} else {
customerMakingProvider.labels = customerProvider.labels;
customerMakingProvider.selectCustomerSeller =
customerProvider.selectCustomerSeller;
customerMakingProvider.fromPage = widget.fromPage;
Navigator.pop(context);
// Map temp = {
// 'labels': customerProvider.labels,
// 'selectCustomerSeller': customerProvider.selectCustomerSeller
// };
// Navigator.of(context).pop(temp);
}
},
child: Container(
... ... @@ -178,7 +272,7 @@ class _CustomerListPageState extends State<CustomerListPage>
BorderRadius.circular(ScreenUtil().setWidth(40)),
color: MyColours.color_199095),
child: Text(
'已选[${customerProvider.labels}]${customerProvider.selectCustomer.length}位顾客,下发营销任务',
'已选[${customerProvider.labels}]${customerProvider.selectCustomerSeller.length}位顾客,下发营销任务',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
... ... @@ -268,10 +362,12 @@ class _CustomerListPageState extends State<CustomerListPage>
// setState(() {});
// _searchSellerLocation();
// customerProvider.searchData(value);
_getContantData(showLoading: false);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
_getContantData(showLoading: false);
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
... ... @@ -298,6 +394,9 @@ class _CustomerListPageState extends State<CustomerListPage>
onTap: () {
WidgetsBinding.instance.addPostFrameCallback(((_) {
customerProvider.controller.clear();
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
_getContantData(showLoading: false);
// customerProvider.searchData('');
}));
},
... ... @@ -377,16 +476,33 @@ class _CustomerListPageState extends State<CustomerListPage>
showFilter = !showFilter;
});
if (showFilter) {
_showFilterDialogFromTop(context, onPressedReset: () {
Navigator.of(context).pop();
setState(() {
showFilter = false;
_showFilterDialogFromTop(context, onPressedReset: (state) {
// Navigator.of(context).pop();
// setState(() {
// showFilter = false;
// });
state(() {
customerProvider.hydSelAll = false;
for (FilterBtnModel item
in customerProvider.filterHydList) {
item.select = false;
}
customerProvider.labelSelAll = false;
for (FilterBtnModel item
in customerProvider.filterLabelList) {
item.select = false;
}
customerProvider.controllerstime.text = '';
customerProvider.controlleretime.text = '';
customerProvider.controllernum.text = '';
dropValue = 0;
});
}, onPressedComplete: () {
Navigator.of(context).pop();
setState(() {
showFilter = false;
});
_getContantData();
}, tapWhiteBack: () {
// Navigator.of(context).pop();
// setState(() {
... ... @@ -424,7 +540,7 @@ class _CustomerListPageState extends State<CustomerListPage>
///筛选弹框
_showFilterDialogFromTop(BuildContext context,
{VoidCallback onPressedReset,
{ClickCallState onPressedReset,
VoidCallback onPressedComplete,
GestureTapCallback tapWhiteBack}) {
showGeneralDialog(
... ... @@ -499,7 +615,7 @@ class _CustomerListPageState extends State<CustomerListPage>
}
///活跃度
Widget _activityWidget() {
Widget _activityWidget(state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -508,9 +624,29 @@ class _CustomerListPageState extends State<CustomerListPage>
children: [
_textWidget('活跃度', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'全选', MyColours.color_199095, FontWeight.normal, 24),
onTap: () {
state(() {
customerProvider.hydSelAll = !customerProvider.hydSelAll;
if (customerProvider.hydSelAll) {
for (FilterBtnModel item
in customerProvider.filterHydList) {
item.select = true;
}
} else {
for (FilterBtnModel item
in customerProvider.filterHydList) {
item.select = false;
}
}
});
},
child: Container(
color: Colors.white,
height: ScreenUtil().setWidth(40),
alignment: Alignment.center,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
child: _textWidget(customerProvider.hydSelAll ? '全不选' : '全选',
MyColours.color_199095, FontWeight.normal, 24)),
)
],
),
... ... @@ -518,24 +654,18 @@ class _CustomerListPageState extends State<CustomerListPage>
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': 'kkkk', 'select': false},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kdsfjsfsdfhjsdfh', 'select': true},
{'title': 'kkkk', 'select': true},
], false)),
children: _buildFilterItem(customerProvider.filterHydList, false,
(FilterBtnModel item) {
state(() {
item.select = !item.select;
});
})),
],
);
}
///自定义标签
Widget _labelWidget() {
Widget _labelWidget(StateSetter state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -544,28 +674,45 @@ class _CustomerListPageState extends State<CustomerListPage>
children: [
_textWidget('自定义标签', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'全选', MyColours.color_199095, FontWeight.normal, 24),
)
onTap: () {
state(() {
customerProvider.labelSelAll =
!customerProvider.labelSelAll;
if (customerProvider.labelSelAll) {
for (FilterBtnModel item
in customerProvider.filterLabelList) {
item.select = true;
}
} else {
for (FilterBtnModel item
in customerProvider.filterLabelList) {
item.select = false;
}
}
});
},
child: Container(
color: Colors.white,
height: ScreenUtil().setWidth(40),
alignment: Alignment.center,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
child: _textWidget(
customerProvider.labelSelAll ? '全不选' : '全选',
MyColours.color_199095,
FontWeight.normal,
24))),
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': 'kkkk', 'select': false},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kdsfjsfsdfhjsdfh', 'select': false},
{'title': 'kkkk', 'select': true},
], true)),
children: _buildFilterItem(customerProvider.filterLabelList, true,
(FilterBtnModel item) {
state(() {
item.select = !item.select;
});
})),
],
);
}
... ... @@ -624,7 +771,7 @@ class _CustomerListPageState extends State<CustomerListPage>
}
///高级筛选
Widget _advancedFilterWidget(state) {
Widget _advancedFilterWidget(StateSetter state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -633,32 +780,54 @@ class _CustomerListPageState extends State<CustomerListPage>
children: [
_textWidget('高级筛选', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'清空', MyColours.color_199095, FontWeight.normal, 24),
)
onTap: () {
customerProvider.controllerstime.text = '';
customerProvider.controlleretime.text = '';
customerProvider.controllernum.text = '';
state(() {
dropValue = 0;
});
},
child: Container(
color: Colors.white,
height: ScreenUtil().setWidth(40),
alignment: Alignment.center,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
child: _textWidget(
'清空', MyColours.color_199095, FontWeight.normal, 24),
))
],
),
VEmptyView(30),
Row(
children: [
Expanded(child: _textFeildWidget()),
Expanded(
child: _textFeildWidget(customerProvider.controllerstime,
customerProvider.stimeFocus)),
HEmptyView(10),
_textWidget('至', MyColours.color_199095, FontWeight.normal, 24),
HEmptyView(10),
Expanded(child: _textFeildWidget()),
Expanded(
child: _textFeildWidget(customerProvider.controlleretime,
customerProvider.etimeFocus)),
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': '7天', 'select': true},
{'title': '30天', 'select': true},
{'title': '60天', 'select': true},
{'title': '120天', 'select': true},
], true, grayBack: true)),
children: _buildFilterItem(customerProvider.filterDayList, true,
(FilterBtnModel item) {
if (customerProvider.stimeFocus.hasFocus) {
customerProvider.controllerstime.text = item.id;
}
if (customerProvider.etimeFocus.hasFocus) {
customerProvider.controlleretime.text = item.id;
}
// state(() {
// item.select = !item.select;
// });
}, grayBack: true)),
VEmptyView(30),
_textWidget('时间内预订次数', MyColours.color_333333, FontWeight.normal, 24),
VEmptyView(30),
... ... @@ -729,6 +898,8 @@ class _CustomerListPageState extends State<CustomerListPage>
),
onChanged: (value) {
print(value);
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
state(() => dropValue = value);
}))),
HEmptyView(20),
... ... @@ -749,7 +920,7 @@ class _CustomerListPageState extends State<CustomerListPage>
color: MyColours.color_ffffff,
child: TextField(
maxLines: 1,
controller: customerProvider.controller,
controller: customerProvider.controllernum,
// focusNode: _focusNode,
// autofocus: true,
... ... @@ -768,7 +939,7 @@ class _CustomerListPageState extends State<CustomerListPage>
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.text,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
onChanged: (value) {
... ... @@ -789,7 +960,7 @@ class _CustomerListPageState extends State<CustomerListPage>
HEmptyView(20),
_textWidget('次预订', MyColours.color_333333, FontWeight.normal, 24),
]),
VEmptyView(30),
VEmptyView(50),
],
);
}
... ... @@ -830,7 +1001,8 @@ class _CustomerListPageState extends State<CustomerListPage>
}
/// 高级筛选输入框
Widget _textFeildWidget() {
Widget _textFeildWidget(
TextEditingController controller, FocusNode focusNode) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
... ... @@ -846,8 +1018,8 @@ class _CustomerListPageState extends State<CustomerListPage>
Expanded(
child: TextField(
maxLines: 1,
controller: customerProvider.controller,
// focusNode: _focusNode,
controller: controller,
focusNode: focusNode,
// autofocus: true,
style: TextStyle(
... ... @@ -855,7 +1027,7 @@ class _CustomerListPageState extends State<CustomerListPage>
fontSize: ScreenUtil().setSp(26)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "xxx",
hintText: "",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(26),
... ... @@ -865,7 +1037,7 @@ class _CustomerListPageState extends State<CustomerListPage>
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.text,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
onChanged: (value) {
... ... @@ -890,7 +1062,7 @@ class _CustomerListPageState extends State<CustomerListPage>
///筛选布局
Widget _filterWidget(
StateSetter state,
VoidCallback onPressedReset,
ClickCallState onPressedReset,
VoidCallback onPressedComplete,
) {
return Container(
... ... @@ -919,33 +1091,34 @@ class _CustomerListPageState extends State<CustomerListPage>
child: Column(
children: [
Expanded(
child: Scrollbar(
isAlwaysShown: true, //设置滚动条常亮
controller: _scrollCrl, //必须设置一个controller
// child: Scrollbar(
// isAlwaysShown: true, //设置滚动条常亮
// controller: _scrollCrl, //必须设置一个controller
///添加进度条
child: SingleChildScrollView(
controller: _scrollCrl,
// primary: true,
// reverse: true,
// physics: BouncingScrollPhysics(),
// padding: EdgeInsets.only(
// bottom:
// MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(20),
_managerWidget(),
VEmptyView(30),
_activityWidget(),
VEmptyView(30),
_labelWidget(),
VEmptyView(30),
_advancedFilterWidget(state)
],
),
))),
// ///添加进度条
child: SingleChildScrollView(
controller: _scrollCrl,
// primary: true,
// reverse: true,
// physics: BouncingScrollPhysics(),
// padding: EdgeInsets.only(
// bottom:
// MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(20),
// _managerWidget(),
// VEmptyView(30),
_activityWidget(state),
VEmptyView(30),
_labelWidget(state),
VEmptyView(30),
_advancedFilterWidget(state)
],
),
)),
// ),
Row(
children: [
Container(
... ... @@ -972,7 +1145,9 @@ class _CustomerListPageState extends State<CustomerListPage>
flex: 1,
child: Material(
child: InkWell(
onTap: onPressedReset,
onTap: () {
onPressedReset(state);
},
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
... ... @@ -1028,44 +1203,51 @@ class _CustomerListPageState extends State<CustomerListPage>
}
//构建筛选按钮
List<Widget> _buildFilterItem(List<Map> data, bool round,
List<Widget> _buildFilterItem(
List<FilterBtnModel> data, bool round, ClickCall onTap,
{bool grayBack = false}) {
List<Widget> items = [];
for (Map item in data) {
items.add(Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item['select']
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item['select']
? MyColours.color_199095
: round
? Color.fromRGBO(155, 155, 155, 1)
: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(round ? 30 : 10))),
child: _textWidget(
item['title'],
grayBack
? MyColours.color_333333
: item['select']
? MyColours.color_ffffff
: round
? MyColours.color_333333
: MyColours.color_199095,
FontWeight.normal,
24)));
if (data != null && data.length > 0) {
for (FilterBtnModel item in data) {
items.add(InkWell(
onTap: () {
onTap(item);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item.select
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item.select
? MyColours.color_199095
: round
? Color.fromRGBO(155, 155, 155, 1)
: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(round ? 30 : 10))),
child: _textWidget(
item.title,
grayBack
? MyColours.color_333333
: item.select
? MyColours.color_ffffff
: round
? MyColours.color_333333
: MyColours.color_199095,
FontWeight.normal,
24))));
}
}
return items;
}
... ... @@ -1125,7 +1307,8 @@ class _CustomerListPageState extends State<CustomerListPage>
controller: tabController,
physics: NeverScrollableScrollPhysics(),
children: _returnListWidget())),
customerProvider.pageState == PageState.Success
customerProvider.pageState == PageState.Success &&
customerProvider.selectCustomerSeller.length > 0
? _selectContantWidget()
: SizedBox(),
... ...
... ... @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:flutter_sms/flutter_sms.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/customer_by_seller_model.dart';
import 'package:one_key/models/customer_list_model.dart';
import 'package:one_key/models/marketing_by_id_model.dart';
import 'package:one_key/pages/coupon/coupon_page.dart';
... ... @@ -68,7 +69,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
}
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
for (CustomerBySellerSunModel item in customerMakingProvider.selectCustomerSeller) {
gid += '${item.id},';
if (Platform.isIOS) {
iosPhone.add(item.phone);
... ... @@ -110,7 +111,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
);
print('''object''');
customerMakingProvider.labels = customerProvider.labels;
customerMakingProvider.selectCustomer = customerProvider.selectCustomer;
customerMakingProvider.selectCustomerSeller = customerProvider.selectCustomerSeller;
// customerMakingProvider.fromPage = widget.fromPage;
customerMakingProvider.controller.text =
widget.marketingByIdSunModel.content;
... ... @@ -375,7 +376,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
fontSize: ScreenUtil().setSp(26))),
)),
Text(
'共 ${customerMakingProvider.controller.text.length} 字 ${customerMakingProvider.selectCustomer.length} 条短信',
'共 ${customerMakingProvider.controller.text.length} 字 ${customerMakingProvider.selectCustomerSeller.length} 条短信',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26))),
... ... @@ -595,7 +596,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
children: [
Expanded(
child: Text(
'已选[${customerMakingProvider.labels}]${customerMakingProvider.selectCustomer.length}位顾客',
'已选[${customerMakingProvider.labels}]${customerMakingProvider.selectCustomerSeller.length}位顾客',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(32)),
... ...
... ... @@ -100,7 +100,18 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> {
),
VEmptyView(20),
RoundButton(
onPressed: () async {},
onPressed: () async {
String index = '0';
if (btnTitle == '活跃客户') {
index = '1';
} else if (btnTitle == '沉睡客户') {
index = '2';
} else if (btnTitle == '流失客户') {
index = '3';
}
NavigatorUtil.goCustomerListPage(
context, FromPage.FromPageHome,index:index);
},
text: btnTitle,
fontSize: 24,
isBold: false,
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/customer_by_seller_model.dart';
import 'package:one_key/models/customer_list_model.dart';
class CustomerMakingProvider extends ChangeNotifier {
... ... @@ -13,6 +14,7 @@ class CustomerMakingProvider extends ChangeNotifier {
bool isUpdate = true; //客户经理不可修改短信内容
bool isDate = true; //最晚完成期限
String edate = '';
List<CustomerBySellerSunModel> selectCustomerSeller = [];
clearData() {
labels = '';
... ... @@ -25,5 +27,6 @@ class CustomerMakingProvider extends ChangeNotifier {
isUpdate = true; //客户经理不可修改短信内容
isDate = true; //最晚完成期限
edate = '';
selectCustomerSeller = [];
}
}
... ...
... ... @@ -53,7 +53,8 @@ class CustomerProvider extends ChangeNotifier {
GuestInfoSunModel guestInfoSunModel;
GuestReserveSunModel guestReserveSunModel;
List<CustomerListSunModel> selectCustomer = [];
List<CustomerListSunModel> selectCustomer = []; //我的客情选中
List<CustomerBySellerSunModel> selectCustomerSeller = []; //商家客情选中
int index = 0;
bool checkValue = true;
String labels = '';
... ... @@ -1051,6 +1052,80 @@ class CustomerProvider extends ChangeNotifier {
return storeSunmodel;
}
//全选按钮执行“全选”
addAll() async {
//把数据状态全部改成true,即选中状态
selectCustomerSeller = [];
for (var i = 0; i < customerBySellerList.length; i++) {
customerBySellerList[i].select = true;
selectCustomerSeller.add(customerBySellerList[i]);
}
checkValue = true;
labelsValue();
notifyListeners();
}
labelsValue() {
List<String> tempLabel = [];
for (CustomerBySellerSunModel item in customerBySellerList) {
if (item.select && item.attr != null) {
tempLabel.add(item.attr);
}
}
tempLabel = tempLabel.toSet().toList();
labels = Utils.listToStringEnglish(tempLabel);
}
///清除选择
// clearSelect() {
// // selectCustomer = [];
// // labelsValue();
// // couponsShow = [];
// }
//全选按钮执行“全不选”
cancelAll() async {
selectCustomerSeller = [];
//把数据状态全部改成false,即不选中状态
for (var i = 0; i < customerBySellerList.length; i++) {
customerBySellerList[i].select = false;
}
checkValue = false;
labels = '';
notifyListeners();
}
//选中
addData(int index) {
// userHistorys[index].select = true;
selectCustomerSeller.add(customerBySellerList[index]);
labelsValueMy();
notifyListeners();
}
//未选中
cancelData(int index) {
// userHistorys[index].select = false;
selectCustomerSeller
.removeWhere((element) => element.id == customerBySellerList[index].id);
labelsValueMy();
notifyListeners();
}
//获取全选按钮的状态 true or false
getCheckValue() {
bool temp = customerBySellerList.any((value) {
return value.select == false;
});
if (temp == true) {
checkValue = false;
} else {
checkValue = true;
}
notifyListeners();
}
//获取商家客户列表
getCustomerBySeller(BuildContext context, Map<String, String> params) async {
BaseResp<List> baseResp = await DioUtil()
... ...
... ... @@ -542,9 +542,9 @@ class NavigatorUtil {
/// 客情列表
static Future<dynamic> goCustomerListPage(
BuildContext context, FromPage fromPage,
{replace = false, bool needBtn = false}) {
{replace = false, bool needBtn = false, String index = '0'}) {
return _navigateTo(context,
"${Routes.customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}",
"${Routes.customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}&index=$index",
replace: replace);
}
... ...
... ... @@ -875,9 +875,10 @@ var customerListPageHandle = new Handler(
FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>(
FromPage.values, params["fromPage"].first);
print(fromPage);
String index = params["index"].first;
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: CustomerListPage(fromPage: fromPage));
child: CustomerListPage(fromPage: fromPage,index:index));
});
///仅供展示的客情列表
... ... @@ -887,6 +888,7 @@ var showCustomerListPageHandle = new Handler(
FromPage.values, params["fromPage"].first);
print(fromPage);
String gid = params["gid"].first;
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: ShowCustomerListPage(fromPage: fromPage, gid: gid));
... ... @@ -901,7 +903,7 @@ var myCustomerListPageHandle = new Handler(
String index = params["index"].first;
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: MyCustomerListPage(fromPage: fromPage,index:index));
child: MyCustomerListPage(fromPage: fromPage, index: index));
});
///客情设置
... ...