Commit 4873126ec73c458f974a5924e96b91d686a07cc0

Authored by wdn127929
1 parent 53c89b34

经理客情

... ... @@ -32,8 +32,10 @@ typedef ClickCallState = void Function(StateSetter state);
class MyCustomerListPage extends StatefulWidget {
final FromPage fromPage;
final String index;
const MyCustomerListPage({Key key, this.fromPage}) : super(key: key);
const MyCustomerListPage({Key key, this.fromPage, this.index})
: super(key: key);
@override
_MyCustomerListPageState createState() => _MyCustomerListPageState();
}
... ... @@ -57,6 +59,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// 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) {
... ... @@ -72,12 +76,18 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
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 {
bool first = true;
customerProvider.index = tabController.index;
if (widget.fromPage == FromPage.FromPageMakeRecord) {
customerProvider.selectCustomer = customerMakingProvider.selectCustomer;
customerProvider.labels = customerMakingProvider.labels;
... ... @@ -1293,7 +1303,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
controller: tabController,
physics: NeverScrollableScrollPhysics(),
children: _returnListWidget())),
customerProvider.pageState == PageState.Success
customerProvider.pageState == PageState.Success &&
customerProvider.selectCustomer.length > 0
? _selectContantWidget()
: SizedBox(),
// _searchWidget(),
... ...
... ... @@ -101,7 +101,19 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
),
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.goMyCustomerListPage(
context, FromPage.FromPageMyCustomer,
index: index);
},
text: btnTitle,
fontSize: 24,
isBold: false,
... ... @@ -315,6 +327,9 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
fontSize: 26,
isBold: false,
onPressed: () {
// NavigatorUtil
// .goMyMakeMarkingPageOnlyShow(
// context, widget.sellerList);
// NavigatorUtil.goEnterStoreEnvironmentPage(context);
},
),
... ... @@ -384,7 +399,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
fontSize: 26,
isBold: false,
onPressed: () {
// NavigatorUtil.goEnterStoreEnvironmentPage(context);
// NavigatorUtil.goMyMakeMarkingPage(
// context,
// selfList: widget.selfList,
// fromPage: FromPage
// .FromPageMakeRecordDetail);
},
),
],
... ... @@ -441,7 +460,11 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
fontSize: 26,
isBold: false,
onPressed: () {
// NavigatorUtil.goEnterStoreEnvironmentPage(context);
// NavigatorUtil.goMyMakeMarkingPage(
// context,
// selfList: widget.selfList,
// fromPage: FromPage
// .FromPageMakeRecordDetail);
},
),
],
... ...
... ... @@ -14,6 +14,7 @@ import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
... ... @@ -172,6 +173,9 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
'${customerProvider.couponListSelect[customerMakingProvider.couponSelectIndex].id}';
}
await customerProvider.createMarketing(context, params, showLoading: true);
if (widget.fromPage == FromPage.FromPageMakeRecordDetail) {
bus.emit('refresh_my_records_page');
}
_goSms();
}
... ... @@ -215,9 +219,10 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
// title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
// print('取消发送');
// }, rCallback: () async {
String message = customerMakingProvider.controller.text;
if (Platform.isIOS) {
// List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
String message = customerMakingProvider.controller.text;
try {
String _result = await sendSMS(message: message, recipients: iosPhone);
print(_result);
... ... @@ -227,7 +232,6 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
} else {
print('确定发送');
// String phoneNumber = "18161963378;18729572142";
String message = "test";
// await Sendsms.onGetPermission();
... ...
... ... @@ -64,22 +64,24 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
}
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
gid += '${item.id},';
if (Platform.isIOS) {
iosPhone.add(item.phone);
} else {
andriodPhone += "${item.phone};";
}
}
if (gid.endsWith(',')) {
gid = gid.substring(0, gid.length - 1);
}
if (!Platform.isIOS && andriodPhone.endsWith(';')) {
andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
}
// print(widget.sellerList.guestCount);
// for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
// gid += '${item.id},';
// if (Platform.isIOS) {
// iosPhone.add(item.phone);
// } else {
// andriodPhone += "${item.phone};";
// }
// }
// if (gid.endsWith(',')) {
// gid = gid.substring(0, gid.length - 1);
// }
// if (!Platform.isIOS && andriodPhone.endsWith(';')) {
// andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
// }
customerMakingProvider.controller.text = widget.sellerList.content;
_couponNetworkData(isShowLoading: false);
_getGuestByGid();
});
}
... ... @@ -92,6 +94,56 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
//
}
_getPhoneAndGid() {
andriodPhone = '';
iosPhone = [];
for (CustomerListSunModel item in customerMakingProvider.selectCustomer) {
// gid += '${item.id},';
if (Platform.isIOS) {
iosPhone.add(item.phone);
} else {
andriodPhone += "${item.phone};";
}
}
// if (gid.endsWith(',')) {
// gid = gid.substring(0, gid.length - 1);
// }
if (!Platform.isIOS && andriodPhone.endsWith(';')) {
andriodPhone = andriodPhone.substring(0, andriodPhone.length - 1);
}
}
///客户经理营销中的用户列表
_getGuestByGid({bool isShowLoading = true}) async {
// customerMakingProvider.couponSelectIndex = 0;
Map<String, String> params = {
"gid": widget.sellerList.gid,
};
await customerProvider.getGuestByGid(
context,
params,
);
print('''object''');
gid = widget.sellerList.gid;
// customerMakingProvider.labels = customerProvider.labels;
customerMakingProvider.selectCustomer = customerProvider.selectCustomer;
_getPhoneAndGid();
// customerMakingProvider.fromPage = widget.fromPage;
if (widget.sellerList.aid != null) {
//之前绑定过优惠
customerMakingProvider.isUse = true;
for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
customerMakingProvider.youhui =
customerProvider.couponListSelect[i].aname;
customerMakingProvider.couponSelectIndex = i;
}
}
}
customerMakingProvider.isUpdate = true;
setState(() {});
}
///消费券
_couponNetworkData({bool isShowLoading = true}) async {
// customerMakingProvider.couponSelectIndex = 0;
... ... @@ -172,9 +224,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
// title: '确认发送', content: '是否确定为当前所选顾客发送该优惠券', lCallback: () {
// print('取消发送');
// }, rCallback: () async {
String message = customerMakingProvider.controller.text;
if (Platform.isIOS) {
// List<String> phoneNumber = ['18161963378', '18729572142', '18765432345'];
String message = "test";
try {
String _result = await sendSMS(message: message, recipients: iosPhone);
print(_result);
... ... @@ -184,7 +237,6 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
} else {
print('确定发送');
// String phoneNumber = "18161963378;18729572142";
String message = "test";
// await Sendsms.onGetPermission();
... ... @@ -454,7 +506,10 @@ class _MyMakeMarkingPageOnlyShowState extends State<MyMakeMarkingPageOnlyShow> {
InkWell(
onTap: () {
needClear = false;
Navigator.pop(context);
NavigatorUtil.goShowCustomerListPage(
context,
FromPage.FromPageMakeRecordDetail,
widget.sellerList.gid);
// NavigatorUtil.goMarketingRecordsDetailPage(context);
},
child: Text('仅查看',
... ...
... ... @@ -178,7 +178,7 @@ class _MyMarketingRecordsDetailPageState
onTap: () {
NavigatorUtil.goShowCustomerListPage(
context,
FromPage.FromPageStoreCustomer,
FromPage.FromPageMakeRecordDetail,
widget.selfList.gid);
// NavigatorUtil.goMyMarketingRecordsDetailPage(context);
},
... ...
... ... @@ -7,6 +7,7 @@ import 'package:one_key/provider/customer_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_exception.dart';
... ... @@ -31,10 +32,14 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> {
WidgetsBinding.instance.addPostFrameCallback((_) async {
_getMarketingByUid();
});
bus.on("refresh_my_records_page", (arg) {
_getMarketingByUid();
});
}
@override
void dispose() {
bus.off('refresh_my_records_page');
super.dispose();
}
... ...
... ... @@ -650,9 +650,9 @@ class NavigatorUtil {
/// 我的客情列表
static Future<dynamic> goMyCustomerListPage(
BuildContext context, FromPage fromPage,
{replace = false, bool needBtn = false}) {
{replace = false, bool needBtn = false, String index = '0'}) {
return _navigateTo(context,
"${Routes.my_customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}",
"${Routes.my_customer_list_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}&index=${index}",
replace: replace);
}
... ...
... ... @@ -898,9 +898,10 @@ var myCustomerListPageHandle = 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: MyCustomerListPage(fromPage: fromPage));
child: MyCustomerListPage(fromPage: fromPage,index:index));
});
///客情设置
... ...