Commit 2402df49cbef8a1a20a128604261e03ecbd8b410

Authored by wdn127929
1 parent fc2df683

推送消息处理

... ... @@ -61,6 +61,12 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean {
@JsonKey(name: 'nick_name')
String nickName;
@JsonKey(name: 'gid')
String gid;
@JsonKey(name: 'label')
String label;
bool select = true;
String pinyin;
... ... @@ -98,7 +104,9 @@ class CustomerBySellerSunModel extends Object with ISuspensionBean {
this.ddate,
this.ddateSolt,
this.uid,
this.nickName);
this.nickName,
this.gid,
this.label);
factory CustomerBySellerSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CustomerBySellerSunModelFromJson(srcJson);
... ...
... ... @@ -41,6 +41,8 @@ CustomerBySellerSunModel _$CustomerBySellerSunModelFromJson(
json['ddate_solt'] as String,
json['uid'] as String,
json['nick_name'] as String,
json['gid'] as String,
json['label'] as String,
);
}
... ... @@ -57,5 +59,7 @@ Map<String, dynamic> _$CustomerBySellerSunModelToJson(
'ddate': instance.ddate,
'ddate_solt': instance.ddateSolt,
'uid': instance.uid,
'nick_name': instance.nickName
'nick_name': instance.nickName,
'gid': instance.gid,
'label': instance.label,
};
... ...
import 'package:json_annotation/json_annotation.dart';
import 'package:json_annotation/json_annotation.dart';
part 'guest_manage_model.g.dart';
@JsonSerializable()
... ... @@ -118,13 +116,13 @@ class Drain extends Object {
@JsonSerializable()
class Tips extends Object {
@JsonKey(name: 'task')
List<List<String>> task;
List<Task> task;
@JsonKey(name: 'recover')
List<String> recover;
List<dynamic> recover;
@JsonKey(name: 'awaken')
List<String> awaken;
List<dynamic> awaken;
Tips(
this.task,
... ... @@ -137,3 +135,64 @@ class Tips extends Object {
Map<String, dynamic> toJson() => _$TipsToJson(this);
}
@JsonSerializable()
class Task extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'sellerid')
String sellerid;
@JsonKey(name: 'create_user')
String createUser;
@JsonKey(name: 'uid')
String uid;
@JsonKey(name: 'aid')
String aid;
@JsonKey(name: 'gid')
String gid;
@JsonKey(name: 'content')
String content;
@JsonKey(name: 'is_update')
String isUpdate;
@JsonKey(name: 'finished_status')
String finishedStatus;
@JsonKey(name: 'edate')
String edate;
@JsonKey(name: 'cdate')
String cdate;
@JsonKey(name: 'remaining_time')
int remainingTime;
String aidStr;
Task(
this.id,
this.sellerid,
this.createUser,
this.uid,
this.aid,
this.gid,
this.content,
this.isUpdate,
this.finishedStatus,
this.edate,
this.cdate,
this.remainingTime
);
factory Task.fromJson(Map<String, dynamic> srcJson) =>
_$TaskFromJson(srcJson);
Map<String, dynamic> toJson() => _$TaskToJson(this);
}
... ...
... ... @@ -90,10 +90,11 @@ Map<String, dynamic> _$DrainToJson(Drain instance) => <String, dynamic>{
Tips _$TipsFromJson(Map<String, dynamic> json) {
return Tips(
(json['task'] as List)
?.map((e) => (e as List)?.map((e) => e as String)?.toList())
?.map(
(e) => e == null ? null : Task.fromJson(e as Map<String, dynamic>))
?.toList(),
(json['recover'] as List)?.map((e) => e as String)?.toList(),
(json['awaken'] as List)?.map((e) => e as String)?.toList(),
json['recover'] as List,
json['awaken'] as List,
);
}
... ... @@ -102,3 +103,35 @@ Map<String, dynamic> _$TipsToJson(Tips instance) => <String, dynamic>{
'recover': instance.recover,
'awaken': instance.awaken,
};
Task _$TaskFromJson(Map<String, dynamic> json) {
return Task(
json['id'] as String,
json['sellerid'] as String,
json['create_user'] as String,
json['uid'] as String,
json['aid'] as String,
json['gid'] as String,
json['content'] as String,
json['is_update'] as String,
json['finished_status'] as String,
json['edate'] as String,
json['cdate'] as String,
json['remaining_time'] as int,
);
}
Map<String, dynamic> _$TaskToJson(Task instance) => <String, dynamic>{
'id': instance.id,
'sellerid': instance.sellerid,
'create_user': instance.createUser,
'uid': instance.uid,
'aid': instance.aid,
'gid': instance.gid,
'content': instance.content,
'is_update': instance.isUpdate,
'finished_status': instance.finishedStatus,
'edate': instance.edate,
'cdate': instance.cdate,
'remaining_time': instance.remainingTime
};
... ...
... ... @@ -129,9 +129,12 @@ class SellerList extends Object {
String cdate;
String get cdateStr {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
if (cdate != null) {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
int.parse(cdate.toString()) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
}
return '';
}
String get guestCount {
... ...
import 'package:json_annotation/json_annotation.dart';
part 'pull_marketing_by_uid_model.g.dart';
@JsonSerializable()
class PullMarketingByUidModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
List<PullMarketingByUidSunModel> data;
@JsonKey(name: 'msg')
String msg;
PullMarketingByUidModel(
this.ret,
this.data,
this.msg,
);
factory PullMarketingByUidModel.fromJson(Map<String, dynamic> srcJson) =>
_$PullMarketingByUidModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$PullMarketingByUidModelToJson(this);
}
@JsonSerializable()
class PullMarketingByUidSunModel extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'mid')
String mid;
@JsonKey(name: 'uid')
String uid;
@JsonKey(name: 'token')
String token;
@JsonKey(name: 'content')
String content;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'is_pull')
String isPull;
@JsonKey(name: 'cdate')
String cdate;
PullMarketingByUidSunModel(
this.id,
this.mid,
this.uid,
this.token,
this.content,
this.status,
this.isPull,
this.cdate,
);
factory PullMarketingByUidSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$PullMarketingByUidSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$PullMarketingByUidSunModelToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'pull_marketing_by_uid_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
PullMarketingByUidModel _$PullMarketingByUidModelFromJson(
Map<String, dynamic> json) {
return PullMarketingByUidModel(
json['ret'] as int,
(json['data'] as List)
?.map((e) => e == null
? null
: PullMarketingByUidSunModel.fromJson(e as Map<String, dynamic>))
?.toList(),
json['msg'] as String,
);
}
Map<String, dynamic> _$PullMarketingByUidModelToJson(
PullMarketingByUidModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg,
};
PullMarketingByUidSunModel _$PullMarketingByUidSunModelFromJson(
Map<String, dynamic> json) {
return PullMarketingByUidSunModel(
json['id'] as String,
json['mid'] as String,
json['uid'] as String,
json['token'] as String,
json['content'] as String,
json['status'] as String,
json['is_pull'] as String,
json['cdate'] as String,
);
}
Map<String, dynamic> _$PullMarketingByUidSunModelToJson(
PullMarketingByUidSunModel instance) =>
<String, dynamic>{
'id': instance.id,
'mid': instance.mid,
'uid': instance.uid,
'token': instance.token,
'content': instance.content,
'status': instance.status,
'is_pull': instance.isPull,
'cdate': instance.cdate,
};
... ...
import 'package:json_annotation/json_annotation.dart';
part 'store_customer_home_model.g.dart';
import 'package:json_annotation/json_annotation.dart';
part 'store_customer_home_model.g.dart';
@JsonSerializable()
class StoreCustomerHomeModel extends Object {
class StoreCustomerHomeModel extends Object {
@JsonKey(name: 'ret')
int ret;
... ... @@ -15,18 +13,20 @@ part 'store_customer_home_model.g.dart';
@JsonKey(name: 'msg')
String msg;
StoreCustomerHomeModel(this.ret,this.data,this.msg,);
StoreCustomerHomeModel(
this.ret,
this.data,
this.msg,
);
factory StoreCustomerHomeModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeModelFromJson(srcJson);
factory StoreCustomerHomeModel.fromJson(Map<String, dynamic> srcJson) =>
_$StoreCustomerHomeModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$StoreCustomerHomeModelToJson(this);
}
@JsonSerializable()
class StoreCustomerHomeSunModel extends Object {
class StoreCustomerHomeSunModel extends Object {
@JsonKey(name: 'myCustomer')
int myCustomer;
... ... @@ -45,84 +45,93 @@ part 'store_customer_home_model.g.dart';
@JsonKey(name: 'distribution')
int distribution;
StoreCustomerHomeSunModel(this.myCustomer,this.active,this.sleep,this.drain,this.sellerUser,this.distribution,);
StoreCustomerHomeSunModel(
this.myCustomer,
this.active,
this.sleep,
this.drain,
this.sellerUser,
this.distribution,
);
factory StoreCustomerHomeSunModel.fromJson(Map<String, dynamic> srcJson) => _$StoreCustomerHomeSunModelFromJson(srcJson);
factory StoreCustomerHomeSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$StoreCustomerHomeSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$StoreCustomerHomeSunModelToJson(this);
}
@JsonSerializable()
class Active extends Object {
class Active extends Object {
@JsonKey(name: 'count')
int count;
@JsonKey(name: 'scale')
double scale;
Active(this.count,this.scale,);
Active(
this.count,
this.scale,
);
factory Active.fromJson(Map<String, dynamic> srcJson) => _$ActiveFromJson(srcJson);
factory Active.fromJson(Map<String, dynamic> srcJson) =>
_$ActiveFromJson(srcJson);
Map<String, dynamic> toJson() => _$ActiveToJson(this);
}
@JsonSerializable()
class Sleep extends Object {
class Sleep extends Object {
@JsonKey(name: 'count')
int count;
@JsonKey(name: 'scale')
double scale;
Sleep(this.count,this.scale,);
Sleep(
this.count,
this.scale,
);
factory Sleep.fromJson(Map<String, dynamic> srcJson) => _$SleepFromJson(srcJson);
factory Sleep.fromJson(Map<String, dynamic> srcJson) =>
_$SleepFromJson(srcJson);
Map<String, dynamic> toJson() => _$SleepToJson(this);
}
@JsonSerializable()
class Drain extends Object {
class Drain extends Object {
@JsonKey(name: 'count')
int count;
@JsonKey(name: 'scale')
double scale;
Drain(this.count,this.scale,);
Drain(
this.count,
this.scale,
);
factory Drain.fromJson(Map<String, dynamic> srcJson) => _$DrainFromJson(srcJson);
factory Drain.fromJson(Map<String, dynamic> srcJson) =>
_$DrainFromJson(srcJson);
Map<String, dynamic> toJson() => _$DrainToJson(this);
}
@JsonSerializable()
class SellerUser extends Object {
class SellerUser extends Object {
@JsonKey(name: 'count')
String count;
@JsonKey(name: 'nick_name')
String nickName;
SellerUser(this.count,this.nickName,);
@JsonKey(name: 'uid')
String uid;
factory SellerUser.fromJson(Map<String, dynamic> srcJson) => _$SellerUserFromJson(srcJson);
SellerUser(this.count, this.nickName, this.uid);
Map<String, dynamic> toJson() => _$SellerUserToJson(this);
factory SellerUser.fromJson(Map<String, dynamic> srcJson) =>
_$SellerUserFromJson(srcJson);
Map<String, dynamic> toJson() => _$SellerUserToJson(this);
}
... ...
... ... @@ -98,6 +98,7 @@ SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
return SellerUser(
json['count'] as String,
json['nick_name'] as String,
json['uid'] as String,
);
}
... ... @@ -105,4 +106,5 @@ Map<String, dynamic> _$SellerUserToJson(SellerUser instance) =>
<String, dynamic>{
'count': instance.count,
'nick_name': instance.nickName,
'uid': instance.uid
};
... ...
... ... @@ -210,5 +210,9 @@ class HttpUrl {
"?service=App.GuestManage.GetMarketingByUid"; // 客户经理营销列表
static const String get_customer_by_seller =
"?service=App.GuestManage.GetCustomerBySeller"; // 全店客户列表
static const String pull_marketing_by_uid =
"?service=App.GuestManage.PullMarketingByUid"; // 获取推送失败的营销消息
static const String set_pull_marketing_by_id =
"?service=App.GuestManage.SetPullMarketingByid"; // 修改拉取后消息的状态
}
... ...
... ... @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_update/azhon_app_update.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/pull_marketing_by_uid_model.dart';
import 'package:one_key/pages/message/message_page.dart';
import 'package:one_key/pages/my/my_page.dart';
... ... @@ -52,6 +53,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
int numPush = 0; //推送消息个数
Timer timer;
Timer timerSeller;
int xgCount = 1; //注册信鸽次数,最多5次
... ... @@ -64,13 +66,15 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// TODO: implement initState
super.initState();
LogUtil.v("home_initState");
AzhonAppUpdate.listener(
// () {
// needUpdate = false;
// // print(map['type']);
// }
);
// () {
// needUpdate = false;
// // print(map['type']);
// }
);
WidgetsBinding.instance.addObserver(this);
_currIndex = widget.initialIndex;
_pageController = PageController(initialPage: _currIndex);
pages
... ... @@ -101,6 +105,33 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
));
WidgetsBinding.instance.addPostFrameCallback((_) {
initPlatformState();
List<PullMarketingByUidSunModel> data =
Provider.of<UserModel>(context, listen: false)
.pullMarketingByUidSunModel;
if (data != null && data.length > 0) {
Future.delayed(Duration(seconds: 300), () {
DialogUtil.cupertinoAlertDialog(context,
title: "全店任务",
content: "管理员发布了新的任务,请立即查看并完成任务",
lTitle: "稍后提醒",
rTitle: "立即查看", lCallback: () {
print("稍后提醒");
// 30分钟后重新弹窗
_startTimerSeller();
}, rCallback: () {
_endTimerSeller();
if (data.length == 1) {
//进入营销详情
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
context, data[0].mid,
fromNotify: true);
} else {
//进入我的客情首页
NavigatorUtil.goMyCustomerPage(context);
}
});
});
}
if (widget.initialIndex == 0) return;
_getIntent();
Future.delayed(Duration(milliseconds: 30000), () {
... ... @@ -118,6 +149,42 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
});
}
_endTimerSeller() {
if (timerSeller != null) {
timerSeller.cancel();
}
}
_startTimerSeller() {
_endTimerSeller();
timerSeller = Timer.periodic(Duration(minutes: 30), (_) {
_endTimerSeller();
List<PullMarketingByUidSunModel> data =
Provider.of<UserModel>(context, listen: false)
.pullMarketingByUidSunModel;
DialogUtil.cupertinoAlertDialog(context,
title: "全店任务",
content: "管理员发布了新的任务,请立即查看并完成任务",
lTitle: "稍后提醒",
rTitle: "立即查看", lCallback: () {
print("稍后提醒");
// 30分钟后重新弹窗
_startTimerSeller();
}, rCallback: () {
_endTimerSeller();
if (data.length == 1) {
//进入营销详情
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
context, data[0].mid,
fromNotify: true);
} else {
//进入我的客情首页
NavigatorUtil.goMyCustomerPage(context);
}
});
});
}
//获取点击通知栏的自定义参数
_getIntent() async {
_clearBadge(() {});
... ... @@ -129,6 +196,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
LogUtil.v(param.toString());
if (notifyParam != null && notifyParam.isNotEmpty) {
switch (notifyParam["messageType"]) {
case "Marketing":
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
context, notifyParam['mid'],
fromNotify: true);
break;
case "10":
NavigatorUtil.goHandleOnlinePage(
context, notifyParam["rid"], notifyParam['mid'],
... ... @@ -228,6 +300,25 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
print("flutter onReceiveNotificationResponse $msg");
numPush++;
_addBadge();
Uri u = Uri.parse(msg['activity']);
String messageType = u.queryParameters['messageType'];
if (messageType == "Marketing") {
String mid = u.queryParameters['mid'];
DialogUtil.cupertinoAlertDialog(context,
title: "全店任务",
content: "管理员发布了新的任务,请立即查看并完成任务",
lTitle: "稍后提醒",
rTitle: "立即查看", lCallback: () {
print("稍后提醒");
// 30分钟后重新弹窗
_startTimerSeller();
}, rCallback: () {
_endTimerSeller();
//进入营销详情
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context, mid,
fromNotify: true);
});
}
},
onReceiveMessage: (Map<String, dynamic> msg) async {
print("flutter onReceiveMessage $msg");
... ... @@ -251,10 +342,16 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
print("flutter xgPushDidClearAllIdentifiers: $msg");
},
xgPushClickAction: (Map<String, dynamic> msg) async {
print(msg);
_clearBadge(() {});
if (Platform.isIOS && msg != null && msg['custom'] != null) {
Map custom = json.decode(msg['custom'].toString());
switch (custom["messageType"].toString()) {
case "Marketing":
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
context, custom['mid'],
fromNotify: true);
break;
case "10":
NavigatorUtil.goHandleOnlinePage(
context, custom["rid"].toString(), custom['mid'].toString(),
... ... @@ -322,6 +419,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
}
},
);
registerPush();
}
... ... @@ -762,6 +860,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
if (timer != null) {
timer.cancel();
}
if (timerSeller != null) {
timerSeller.cancel();
}
WidgetsBinding.instance.removeObserver(this);
}
}
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
... ... @@ -32,7 +34,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_getGuestManageData();
_couponNetworkData();
_getMarketingByUid();
});
... ... @@ -55,6 +58,28 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
// setState(() {});
}
///消费券
_couponNetworkData({bool isShowLoading = true}) async {
// customerMakingProvider.couponSelectIndex = 0;
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
};
await customerProvider.getCustomerSelectActivityNew(context, params,
isShowLoading: isShowLoading);
//此人已经新建好券
// if (customerProvider.couponListSelect.length > 0) {
// for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
// if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
// aidStr = customerProvider.couponListSelect[i].aname;
// }
// }
// customerProvider.notifyListeners();
// } else {
// //没有新建的优惠券
// }
_getGuestManageData();
}
_getMarketingByUid() async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid
... ... @@ -253,65 +278,73 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
controller: _controller,
shrinkWrap: true,
cacheExtent: ScreenUtil().setWidth(0),
itemCount:
customerProvider.guestSunmodel.tips.task.length,
itemCount: customerProvider.guestSunmodel.tips.task ==
null
? 0
: customerProvider.guestSunmodel.tips.task.length,
itemBuilder: (BuildContext context, int index) {
// locationState = state;
List<String> data =
Task data =
customerProvider.guestSunmodel.tips.task[index];
return Column(
children: [
VEmptyView(10),
Stack(children: [
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(30)),
child: Row(
children: [
Image.asset(
Utils.getImgPath('warning'),
width: ScreenUtil().setWidth(42),
),
HEmptyView(15),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${data[0]}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(32)),
),
VEmptyView(8),
Text(
'${data[1]}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(24)),
),
VEmptyView(8),
Text(
'${data[2]}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(26)),
)
],
)),
HEmptyView(20),
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(30)),
child: Row(
children: [
Image.asset(
Utils.getImgPath('warning'),
width: ScreenUtil().setWidth(42),
),
HEmptyView(15),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'店内任务:${data.content}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
),
data.aid != null && data.aidStr != null
? Padding(
padding: EdgeInsets.only(
top: ScreenUtil()
.setWidth(8)),
child: Text(
'优惠内容:${data.aidStr}',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(24)),
),
)
: SizedBox(),
VEmptyView(8),
Text(
'创建人:${data.createUser}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
)
],
)),
HEmptyView(20),
Column(children: [
RoundButton(
text: '立即完成',
... ... @@ -327,27 +360,34 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
fontSize: 26,
isBold: false,
onPressed: () {
// NavigatorUtil
// .goMyMakeMarkingPageOnlyShow(
// context, widget.sellerList);
// NavigatorUtil.goEnterStoreEnvironmentPage(context);
SellerList sellerList =
SellerList.fromJson(json
.decode(json.encode(data)));
NavigatorUtil
.goMyMakeMarkingPageOnlyShow(
context, sellerList);
},
),
],
),
data.remainingTime != null
? Padding(
padding: EdgeInsets.only(
top:
ScreenUtil().setWidth(6)),
child: Text(
'${data.remainingTime}天内',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(
215, 30, 40, 1),
fontSize:
ScreenUtil().setSp(26)),
))
: SizedBox()
])
],
),
Positioned(
bottom: ScreenUtil().setWidth(24),
right: ScreenUtil().setWidth(70),
child: Text(
'${data[3]}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(215, 30, 40, 1),
fontSize: ScreenUtil().setSp(26)),
))
])
),
],
);
}),
... ... @@ -356,7 +396,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
shrinkWrap: true,
cacheExtent: ScreenUtil().setWidth(0),
itemCount:
customerProvider.guestSunmodel.tips.recover.length,
customerProvider.guestSunmodel.tips.recover == null
? 0
: customerProvider
.guestSunmodel.tips.recover.length,
itemBuilder: (BuildContext context, int index) {
// locationState = state;
... ... @@ -416,8 +459,10 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
controller: _controller,
shrinkWrap: true,
cacheExtent: ScreenUtil().setWidth(0),
itemCount:
customerProvider.guestSunmodel.tips.recover.length,
itemCount: customerProvider.guestSunmodel.tips.awaken ==
null
? 0
: customerProvider.guestSunmodel.tips.awaken.length,
itemBuilder: (BuildContext context, int index) {
// locationState = state;
... ...
... ... @@ -236,7 +236,8 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> {
// await Sendsms.onGetPermission();
// if (await Sendsms.hasPermission()) {
await Sendsms.onSendSMS(andriodPhone, message);
bool suceess = await Sendsms.onSendSMS(andriodPhone, message);
print(suceess);
}
// }
... ...
... ... @@ -19,8 +19,10 @@ import 'package:provider/provider.dart';
class SellerMyMarketingRecordsDetailPage extends StatefulWidget {
final String idstr;
final SellerList sellerList;
SellerMyMarketingRecordsDetailPage({Key key, this.idstr, this.sellerList})
final bool fromNotify;
SellerMyMarketingRecordsDetailPage(
{Key key, this.idstr, this.fromNotify = false})
: super(key: key);
@override
... ... @@ -32,6 +34,7 @@ class _SellerMyMarketingRecordsDetailPageState
extends State<SellerMyMarketingRecordsDetailPage> {
CustomerProvider customerProvider;
String aidStr = '';
SellerList sellerList;
@override
void initState() {
super.initState();
... ... @@ -40,7 +43,8 @@ class _SellerMyMarketingRecordsDetailPageState
// _getMarketingBySeller();
// }
// _getMarketingById();
_couponNetworkData();
_getMarketingByUid();
// _couponNetworkData();
});
}
... ... @@ -49,6 +53,22 @@ class _SellerMyMarketingRecordsDetailPageState
super.dispose();
}
_getMarketingByUid() async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid
};
await customerProvider.getMarketingByUid(context, params);
for (SellerList item in customerProvider.myRecordData.sellerList) {
if (item.id == widget.idstr) {
setState(() {
sellerList = item;
});
}
}
_couponNetworkData();
// await customerProvider.searchData(customerProvider.controller.text);
}
// _getMarketingById() async {
// Map<String, String> params = {"id": widget.idstr};
// await customerProvider.getMarketingById(context, params);
... ... @@ -69,7 +89,7 @@ class _SellerMyMarketingRecordsDetailPageState
//此人已经新建好券
if (customerProvider.couponListSelect.length > 0) {
for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) {
if (sellerList.aid == customerProvider.couponListSelect[i].id) {
aidStr = customerProvider.couponListSelect[i].aname;
}
}
... ... @@ -120,156 +140,177 @@ class _SellerMyMarketingRecordsDetailPageState
appBar: SystemAppBar(
'营销任务详情',
onTap: () {
Navigator.pop(context);
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
} else {
Navigator.of(context).pop();
}
},
),
body: Padding(
body: WillPopScope(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30),
// vertical: ScreenUtil().setWidth(40)
),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
children: [
RowMultiText(
'创建日期',
widget.sellerList.cdateStr,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'创建人',
widget.sellerList.createUser,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
],
),
widget.sellerList.finishedStatus == '0' ||
widget.sellerList.finishedStatus == '1' ||
widget.sellerList.finishedStatus == '2'
? Positioned(
child: Image.asset(
Utils.getImgPath(widget
.sellerList.finishedStatus ==
'0'
? 'c_state_ing'
: widget.sellerList.finishedStatus == '1'
? 'c_state_done'
: 'c_state_cancel'),
width: ScreenUtil().setWidth(140),
))
: SizedBox()
],
),
RowMultiText(
'完成期限',
widget.sellerList.edate == null
? '无限制'
: widget.sellerList.edate,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'修改短信内容',
widget.sellerList.isUpdate == '1' ? '可修改' : '不可修改',
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'优惠信息',
aidStr,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(25),
bottom: ScreenUtil().setWidth(20)),
child: Text(
'短信内容',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(30)),
)),
Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(25)),
child: Text(
widget.sellerList.content,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30)),
)),
InkWell(
onTap: () {
NavigatorUtil.goShowCustomerListPage(
context,
FromPage.FromPageStoreCustomer,
widget.sellerList.gid);
// NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
},
child: Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(25),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
child: sellerList == null
? SizedBox()
: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
children: [
Text(
'总客户人数',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(30)),
RowMultiText(
'创建日期',
sellerList.cdateStr,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'创建人',
sellerList.createUser,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
],
),
sellerList.finishedStatus == '0' ||
sellerList.finishedStatus == '1' ||
sellerList.finishedStatus == '2'
? Positioned(
child: Image.asset(
Utils.getImgPath(sellerList
.finishedStatus ==
'0'
? 'c_state_ing'
: sellerList.finishedStatus == '1'
? 'c_state_done'
: 'c_state_cancel'),
width: ScreenUtil().setWidth(140),
))
: SizedBox()
],
),
RowMultiText(
'完成期限',
sellerList.edate == null
? '无限制'
: sellerList.edate,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'修改短信内容',
sellerList.isUpdate == '1' ? '可修改' : '不可修改',
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
RowMultiText(
'优惠信息',
aidStr,
textColor: MyColours.color_333333,
bgColor: Color.fromRGBO(246, 248, 250, 1),
),
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(25),
bottom: ScreenUtil().setWidth(20)),
child: Text(
'短信内容',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(30)),
)),
Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(25)),
child: Text(
sellerList.content,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30)),
)),
InkWell(
onTap: () {
NavigatorUtil.goShowCustomerListPage(
context,
FromPage.FromPageStoreCustomer,
sellerList.gid);
// NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
},
child: Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(25),
),
Spacer(),
Text('${widget.sellerList.guestCount}人',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(30))),
HEmptyView(10),
Text('查看',
style: TextStyle(
decoration:
TextDecoration.underline,
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(30))),
]))),
]))),
Column(
children: [
widget.sellerList.finishedStatus == '0'
? RoundButton(
text: '立刻完成',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
textColor: MyColours.color_ffffff,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(80),
fontSize: 26,
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(200)),
isBold: false,
onPressed: () {
NavigatorUtil.goMyMakeMarkingPageOnlyShow(
context, widget.sellerList);
},
)
: SizedBox(),
VEmptyView(30),
],
)
],
)));
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'总客户人数',
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(30)),
),
Spacer(),
Text('${sellerList.guestCount}人',
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(30))),
HEmptyView(10),
Text('查看',
style: TextStyle(
decoration:
TextDecoration.underline,
color: MyColours.color_199095,
fontSize:
ScreenUtil().setSp(30))),
]))),
]))),
Column(
children: [
sellerList.finishedStatus == '0'
? RoundButton(
text: '立刻完成',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
textColor: MyColours.color_ffffff,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(80),
fontSize: 26,
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(200)),
isBold: false,
onPressed: () {
NavigatorUtil.goMyMakeMarkingPageOnlyShow(
context, sellerList);
},
)
: SizedBox(),
VEmptyView(30),
],
)
],
),
),
onWillPop: () async {
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
return true;
}
Navigator.of(context).pop();
return true;
},
));
}
}
... ...
... ... @@ -156,7 +156,7 @@ class _MyMarketingRecordsPageState extends State<MyMarketingRecordsPage> {
onTap: () {
NavigatorUtil
.goSellerMyMarketingRecordsDetailPage(
context, data.id, data);
context, data.id);
},
child: Text('查看详情',
style: TextStyle(
... ...
... ... @@ -111,17 +111,18 @@ class _ContactListPageState extends State<ContactListPage> {
width: ScreenUtil().setWidth(2)))),
child: Row(
children: [
InkWell(
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
List<CustomerBySellerSunModel> data =
widget.provider.customerBySellerList;
data[index].select = !data[index].select;
if (data[index].select) {
// widget.provider.addData(index);
widget.provider.addData(index);
} else {
// widget.provider.cancelData(index);
widget.provider.cancelData(index);
}
// widget.provider.getCheckValue();
widget.provider.getCheckValue();
},
child: Stack(
alignment: Alignment.bottomCenter,
... ... @@ -185,126 +186,138 @@ class _ContactListPageState extends State<ContactListPage> {
)),
HEmptyView(20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
model.rnameStr != null && model.rnameStr != ''
? Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(200)),
child: Text(
model.rnameStr,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
)),
HEmptyView(10),
Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(4)),
child: Text(
model.sexStr != ''
? '[${model.sexStr}]'
: '',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(22),
),
)),
HEmptyView(10),
],
)
: SizedBox(),
// model.label != null
// ? Container(
// padding: EdgeInsets.only(
// bottom: ScreenUtil().setWidth(4)),
// constraints: BoxConstraints(
// maxWidth: ScreenUtil().setWidth(150)),
// child: Text(
// model.label,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: Color.fromRGBO(193, 194, 63, 1),
// fontSize: ScreenUtil().setSp(22),
// ),
// ))
// : SizedBox()
],
),
VEmptyView(10),
Row(
// crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
Utils.formatFromYmd(model.ddate),
style: TextStyle(
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
fontWeight: FontWeight.bold),
),
HEmptyView(10),
Text(
model.ddateSolt != null ? model.ddateSolt : '',
style: TextStyle(
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
),
),
model.monthCount == '0' || model.monthCount == null
? SizedBox()
: Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(10)),
child: Text(
'30天内${model.monthCount}单',
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
model.rnameStr != null && model.rnameStr != ''
? Row(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Container(
constraints: BoxConstraints(
maxWidth:
ScreenUtil().setWidth(200)),
child: Text(
model.rnameStr,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
)),
HEmptyView(10),
Padding(
padding: EdgeInsets.only(
bottom:
ScreenUtil().setWidth(4)),
child: Text(
model.sexStr != ''
? '[${model.sexStr}]'
: '',
style: TextStyle(
color: MyColours.color_333333,
fontSize:
ScreenUtil().setSp(22),
),
)),
HEmptyView(10),
],
)
: SizedBox(),
model.label != null
? Container(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(4)),
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(150)),
child: Text(
model.label,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:
Color.fromRGBO(193, 194, 63, 1),
fontSize: ScreenUtil().setSp(22),
),
))
: SizedBox()
],
),
VEmptyView(10),
Row(
// crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
Utils.formatFromYmd(model.ddate),
style: TextStyle(
color: MyColours.color_199095,
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
fontWeight: FontWeight.bold),
),
HEmptyView(10),
Text(
model.ddateSolt != null ? model.ddateSolt : '',
style: TextStyle(
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
),
),
),
HEmptyView(10),
Text(
'累计${model.leiji}单',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(24),
),
)
],
),
model.nickName == null
? SizedBox()
: Container(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(12),
right: ScreenUtil().setWidth(12),
top: ScreenUtil().setWidth(10),
),
decoration: BoxDecoration(
border: Border.all(
model.monthCount == '0' ||
model.monthCount == null
? SizedBox()
: Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(10)),
child: Text(
'30天内${model.monthCount}单',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(24),
),
),
),
HEmptyView(10),
Text(
'累计${model.leiji}单',
style: TextStyle(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
child: Text(
'${model.nickName}经理',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333),
fontSize: ScreenUtil().setSp(24),
),
)
],
),
)
],
))
model.nickName == null
? SizedBox()
: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(10),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10),
vertical: ScreenUtil().setWidth(4),
),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
child: Text(
'${model.nickName}经理',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333),
),
)
],
)))
],
),
)
... ...
... ... @@ -4,6 +4,7 @@ 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/models/store_customer_home_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';
... ... @@ -87,14 +88,24 @@ class _CustomerListPageState extends State<CustomerListPage>
WidgetsBinding.instance.addPostFrameCallback((_) async {
bool first = true;
customerProvider.index = tabController.index;
if (widget.fromPage == FromPage.FromPageMakeRecord) {
customerProvider.selectCustomerSeller = customerMakingProvider.selectCustomerSeller;
customerProvider.selectCustomerSeller =
customerMakingProvider.selectCustomerSeller;
customerProvider.labels = customerMakingProvider.labels;
first = false;
}
customerProvider.initData();
if (tabController.index == 0) {
customerProvider.hydSelAll = true;
for (FilterBtnModel item in customerProvider.filterHydList) {
item.select = true;
}
}
_getContantData(first: first);
_filterLabelList();
_getSellerGuestManage();
});
bus.on("refresh_guest_list", (arg) {
... ... @@ -108,6 +119,31 @@ class _CustomerListPageState extends State<CustomerListPage>
super.dispose();
}
// _getAuthUserLists() async {
// await customerProvider.getAuthUserLists(context);
// }
///全店客情首页 ----- 获取经理数据
_getSellerGuestManage() async {
StoreCustomerHomeSunModel model =
await customerProvider.getSellerGuestManage(context);
customerProvider.filterManageList = [];
if (model != null &&
model.sellerUser != null &&
model.sellerUser.length > 0) {
for (SellerUser item in model.sellerUser) {
if (item.nickName != null) {
FilterBtnModel model = FilterBtnModel();
model.id = item.uid;
model.title = item.nickName;
model.select = false;
customerProvider.filterManageList.add(model);
}
}
// setState(() {});
}
}
_filterLabelList() async {
await customerProvider.getLabelBySellerid(context);
if (customerProvider.labelList != null &&
... ... @@ -171,6 +207,18 @@ class _CustomerListPageState extends State<CustomerListPage>
//
//
// params['uid'] 经理ID
String uid = '';
for (FilterBtnModel item in customerProvider.filterManageList) {
if (item.select) {
uid += '${item.id},';
}
}
if (uid.length > 0) {
if (uid.endsWith(',')) {
uid = uid.substring(0, uid.length - 1);
}
params['uid'] = uid;
}
if (customerProvider.controllerstime.text.trim().length > 0) {
params['stime'] = customerProvider.controllerstime.text;
... ... @@ -492,6 +540,10 @@ class _CustomerListPageState extends State<CustomerListPage>
in customerProvider.filterLabelList) {
item.select = false;
}
for (FilterBtnModel item
in customerProvider.filterManageList) {
item.select = false;
}
customerProvider.controllerstime.text = '';
customerProvider.controlleretime.text = '';
customerProvider.controllernum.text = '';
... ... @@ -579,7 +631,7 @@ class _CustomerListPageState extends State<CustomerListPage>
}
///客户经理
Widget _managerWidget() {
Widget _managerWidget(state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -588,9 +640,33 @@ 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.manageSelAll =
!customerProvider.manageSelAll;
if (customerProvider.manageSelAll) {
for (FilterBtnModel item
in customerProvider.filterManageList) {
item.select = true;
}
} else {
for (FilterBtnModel item
in customerProvider.filterManageList) {
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.manageSelAll ? '全不选' : '全选',
MyColours.color_199095,
FontWeight.normal,
24)),
)
],
),
... ... @@ -598,18 +674,12 @@ 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.filterManageList, false,
(FilterBtnModel item) {
state(() {
item.select = !item.select;
});
})),
],
);
}
... ... @@ -1108,8 +1178,8 @@ class _CustomerListPageState extends State<CustomerListPage>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(20),
// _managerWidget(),
// VEmptyView(30),
_managerWidget(state),
VEmptyView(30),
_activityWidget(state),
VEmptyView(30),
_labelWidget(state),
... ...
... ... @@ -70,7 +70,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> {
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
for (CustomerBySellerSunModel item in customerMakingProvider.selectCustomerSeller) {
gid += '${item.id},';
gid += '${item.gid},';
if (Platform.isIOS) {
iosPhone.add(item.phone);
} else {
... ...
... ... @@ -109,8 +109,8 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> {
} else if (btnTitle == '流失客户') {
index = '3';
}
NavigatorUtil.goCustomerListPage(
context, FromPage.FromPageHome,index:index);
NavigatorUtil.goCustomerListPage(context, FromPage.FromPageHome,
index: index);
},
text: btnTitle,
fontSize: 24,
... ...
... ... @@ -15,6 +15,7 @@ import 'package:one_key/models/guest_reserve_model.dart';
import 'package:one_key/models/marketing_by_id_model.dart';
import 'package:one_key/models/marketing_by_seller_model.dart';
import 'package:one_key/models/marketing_by_uid_model.dart';
import 'package:one_key/models/personnel_manage_model.dart';
import 'package:one_key/models/store_customer_home_model.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/net/base_resp.dart';
... ... @@ -77,6 +78,8 @@ class CustomerProvider extends ChangeNotifier {
List<FilterBtnModel> filterDayList = []; //高级筛选---天数 7、30、60、120
bool hydSelAll = false;
bool labelSelAll = false;
bool manageSelAll = false;
List<FilterBtnModel> filterManageList = []; //经理
initData() {
filterDayList = [];
... ... @@ -940,6 +943,18 @@ class CustomerProvider extends ChangeNotifier {
}
}
guestSunmodel = GuestManageModel.fromJson(baseResp.responseData).data;
if (guestSunmodel.tips.task != null &&
guestSunmodel.tips.task.length > 0 &&
couponListSelect.length > 0) {
for (Task item in guestSunmodel.tips.task) {
for (CouponSunModel value in couponListSelect) {
if (item.aid == value.id) {
item.aidStr = value.aname;
}
}
}
}
notifyListeners();
} else {
if (isShowLoading) {
... ... @@ -1106,9 +1121,9 @@ class CustomerProvider extends ChangeNotifier {
//未选中
cancelData(int index) {
// userHistorys[index].select = false;
selectCustomerSeller
.removeWhere((element) => element.id == customerBySellerList[index].id);
userHistorys[index].select = false;
selectCustomerSeller.removeWhere(
(element) => element.gid == customerBySellerList[index].gid);
labelsValueMy();
notifyListeners();
}
... ... @@ -1275,6 +1290,47 @@ class CustomerProvider extends ChangeNotifier {
}
}
/// 获取店员列表
getAuthUserLists(BuildContext context, {showLoading = false}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_auth_user_lists,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
Map data = baseResp.data;
Map<String, dynamic> tempData = {};
data.forEach((key, value) {
String keyTemp = key.split('_')[0];
String role_id = key.split('_')[1];
tempData[keyTemp] = {'listdata': value, 'role_id': role_id};
});
baseResp.responseData['data'] = tempData;
PersonnelManageModelData dataMap =
PersonnelManageModel.fromJson(baseResp.responseData).data;
filterManageList = [];
if (dataMap.manager.listdata != null &&
dataMap.manager.listdata.length > 0) {
for (PersonnelManageSunModel item in dataMap.manager.listdata) {
if (item.nickName != null) {
FilterBtnModel model = FilterBtnModel();
model.id = item.id;
model.title = item.nickName;
model.select = false;
filterManageList.add(model);
}
}
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
notifyListeners();
}
//获取商家客情设置
Future<bool> getSellerGuest(BuildContext context, Map<String, String> params,
{bool showLoading = false}) async {
... ...
... ... @@ -3,6 +3,8 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/models/pull_marketing_by_uid_model.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
... ... @@ -13,6 +15,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import '../app.dart';
... ... @@ -21,6 +24,7 @@ class UserModel with ChangeNotifier {
User _user;
String _registrationId; //极光推送registrationId
String _token; //信鸽推送token
List<PullMarketingByUidSunModel> pullMarketingByUidSunModel;
User get user => _user;
... ... @@ -83,6 +87,71 @@ class UserModel with ChangeNotifier {
}
}
// 获取推送失败的营销消息
Future pullMarketingByUid(BuildContext context,
{bool showLoading = false}) async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.pull_marketing_by_uid,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
});
if (baseResp != null && baseResp.code == Constant.status_success) {
pullMarketingByUidSunModel =
PullMarketingByUidModel.fromJson(baseResp.responseData).data;
if (pullMarketingByUidSunModel != null &&
pullMarketingByUidSunModel.length > 0) {
String id = '';
for (PullMarketingByUidSunModel item in pullMarketingByUidSunModel) {
id += '${item.id},';
}
if (id.length > 0) {
if (id.endsWith(',')) {
id = id.substring(0, id.length - 1);
}
}
print(id);
setPullMarketingByid(context, id);
}
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
}
}
// 修改拉取后消息的状态
Future<bool> setPullMarketingByid(BuildContext context, String id,
{bool showLoading = false}) async {
Map<String, String> params = {
"id": id,
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_pull_marketing_by_id,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.responseData['data'] != null &&
baseResp.responseData['data'] == 1) {
return true;
}
return false;
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
///获取商家信息
Future<String> getSellerInfo(BuildContext context, Map<String, String> params,
Map<String, dynamic> userMap) async {
... ... @@ -109,6 +178,7 @@ class UserModel with ChangeNotifier {
await saveUserInfo(User.fromJson(user));
App.sp.setBool("isLogin", true);
App.sp.setString("is_call_tel", seller['is_call_tel'].toString());
pullMarketingByUid(context);
NavigatorUtil.goHomePage(context);
return null;
}
... ...
... ... @@ -676,10 +676,10 @@ class NavigatorUtil {
/// 我的营销记录详情 --- 全店任务
static Future<dynamic> goSellerMyMarketingRecordsDetailPage(
BuildContext context, String idstr, SellerList sellerList,
{replace = false}) {
BuildContext context, String idstr,
{fromNotify = false, replace = false}) {
return _navigateTo(context,
"${Routes.seller_my_marketing_records_detail_page}?idstr=${idstr}&sellerList=${FluroConvertUtils.object2string(sellerList)}",
"${Routes.seller_my_marketing_records_detail_page}?idstr=${idstr}&fromNotify=$fromNotify",
replace: replace);
}
... ...
... ... @@ -876,9 +876,10 @@ var customerListPageHandle = new Handler(
FromPage.values, params["fromPage"].first);
print(fromPage);
String index = params["index"].first;
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: CustomerListPage(fromPage: fromPage,index:index));
child: CustomerListPage(fromPage: fromPage, index: index));
});
///仅供展示的客情列表
... ... @@ -963,12 +964,10 @@ var myMarketingRecordsDetailPageHandle = new Handler(
var sellerMyMarketingRecordsDetailPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
String idstr = params["idstr"].first;
SellerList sellerList = SellerList.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["sellerList"].first)));
return ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: SellerMyMarketingRecordsDetailPage(
idstr: idstr, sellerList: sellerList));
child: SellerMyMarketingRecordsDetailPage(idstr: idstr));
});
///创建营销
... ...