|
...
|
...
|
@@ -990,8 +990,13 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
notifyListeners();
|
|
|
|
});
|
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {
|
|
|
|
pageStateMarketingRecordMy = PageState.Success;
|
|
|
|
myRecordData = MarketingByUidModel.fromJson(baseResp.responseData).data;
|
|
|
|
if (myRecordData.selfList.length == 0 &&
|
|
|
|
myRecordData.sellerList.length == 0) {
|
|
|
|
pageStateMarketingRecordMy = PageState.Empty;
|
|
|
|
} else {
|
|
|
|
pageStateMarketingRecordMy = PageState.Success;
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
} else {
|
|
|
|
if (baseResp != null) {
|
|
...
|
...
|
@@ -1067,6 +1072,67 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
return storeSunmodel;
|
|
|
|
}
|
|
|
|
|
|
|
|
//商家营销中的用户列表
|
|
|
|
getSellerGuestByGid(BuildContext context, Map<String, String> params) async {
|
|
|
|
BaseResp<List> baseResp = await DioUtil()
|
|
|
|
.request<List>(context, Method.get, HttpUrl.get_guest_by_gid,
|
|
|
|
data: params, showLoading: false)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
if (error is MyError) {
|
|
|
|
switch (error.type) {
|
|
|
|
case 1:
|
|
|
|
pageStateListShow = PageState.ConnectivityError;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pageStateListShow = PageState.ConnectivityTimeOut;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pageStateListShow = PageState.ConnectivityError;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {
|
|
|
|
List<CustomerBySellerSunModel> user =
|
|
|
|
baseResp.data.map<CustomerBySellerSunModel>((value) {
|
|
|
|
return CustomerBySellerSunModel.fromJson(value);
|
|
|
|
}).toList();
|
|
|
|
if (user.length == 0) {
|
|
|
|
pageStateListShow = PageState.Empty;
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < user.length; i++) {
|
|
|
|
CustomerBySellerSunModel item = user[i];
|
|
|
|
item.select = true;
|
|
|
|
if (item.rname != null) {
|
|
|
|
item.pinyin =
|
|
|
|
PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
user[i] = item;
|
|
|
|
}
|
|
|
|
selectCustomerSeller = user; //全部客户列表信息
|
|
|
|
List<String> tempLabel = [];
|
|
|
|
for (CustomerBySellerSunModel item in selectCustomerSeller) {
|
|
|
|
if (item.select && item.attr != null) {
|
|
|
|
tempLabel.add(item.attr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tempLabel = tempLabel.toSet().toList();
|
|
|
|
labels = Utils.listToStringEnglish(tempLabel);
|
|
|
|
pageStateListShow = PageState.Success;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (baseResp != null) {
|
|
|
|
Utils.showToast(baseResp.msg ?? "");
|
|
|
|
}
|
|
|
|
pageStateGuestInfo = PageState.ConnectivityTimeOut;
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
//全选按钮执行“全选”
|
|
|
|
addAll() async {
|
|
|
|
//把数据状态全部改成true,即选中状态
|
|
...
|
...
|
@@ -1115,7 +1181,7 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
addData(int index) {
|
|
|
|
// userHistorys[index].select = true;
|
|
|
|
selectCustomerSeller.add(customerBySellerList[index]);
|
|
|
|
labelsValueMy();
|
|
|
|
labelsValue();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -1124,7 +1190,7 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
userHistorys[index].select = false;
|
|
|
|
selectCustomerSeller.removeWhere(
|
|
|
|
(element) => element.gid == customerBySellerList[index].gid);
|
|
|
|
labelsValueMy();
|
|
|
|
labelsValue();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -1170,6 +1236,33 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
pageState = PageState.Empty;
|
|
|
|
} else {
|
|
|
|
pageState = PageState.Success;
|
|
|
|
List<String> idList = [];
|
|
|
|
for (int i = 0; i < customerBySellerList.length; i++) {
|
|
|
|
CustomerBySellerSunModel item = customerBySellerList[i];
|
|
|
|
idList.add(item.gid);
|
|
|
|
for (CustomerBySellerSunModel value in selectCustomerSeller) {
|
|
|
|
if (value.gid == item.gid) {
|
|
|
|
item.select = true; //原来选中的继续保持选中
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item.rname != null) {
|
|
|
|
item.pinyin =
|
|
|
|
PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
customerBySellerList[i] = item;
|
|
|
|
}
|
|
|
|
// 把选中的列表,剔除掉现在结果里没有的
|
|
|
|
List<CustomerBySellerSunModel> temp = [];
|
|
|
|
for (CustomerBySellerSunModel value in selectCustomerSeller) {
|
|
|
|
if (idList.contains(value.gid)) {
|
|
|
|
temp.add(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
selectCustomerSeller = temp; //把选中的列表,剔除掉现在结果里没有的
|
|
|
|
getCheckValue();
|
|
|
|
//对于以前有选中的数据,接口请求后,继续赋值
|
|
|
|
|
|
|
|
for (int i = 0; i < customerBySellerList.length; i++) {
|
|
|
|
CustomerBySellerSunModel item = customerBySellerList[i];
|
|
|
|
// item.pinyinFirst = '';
|
|
...
|
...
|
@@ -1196,34 +1289,6 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
|
|
|
|
customerBySellerList[i] = item;
|
|
|
|
}
|
|
|
|
// userHistorysShow = userHistorys; //全部客户列表信息
|
|
|
|
// userHistorysShowHuoyue = [];
|
|
|
|
// userHistorysShowChenshui = [];
|
|
|
|
// userHistorysShowLiushi = [];
|
|
|
|
// for (CustomerListSunModel item in userHistorysShow) {
|
|
|
|
// if (item.attr == '活跃') {
|
|
|
|
// userHistorysShowHuoyue.add(item);
|
|
|
|
// } else if (item.attr == '沉睡') {
|
|
|
|
// userHistorysShowChenshui.add(item);
|
|
|
|
// } else if (item.attr == '流失') {
|
|
|
|
// userHistorysShowLiushi.add(item);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (userHistorysShowHuoyue.length > 0) {
|
|
|
|
// pageStateHuoyue = PageState.Success;
|
|
|
|
// } else {
|
|
|
|
// pageStateHuoyue = PageState.Empty;
|
|
|
|
// }
|
|
|
|
// if (userHistorysShowChenshui.length > 0) {
|
|
|
|
// pageStateChenshui = PageState.Success;
|
|
|
|
// } else {
|
|
|
|
// pageStateChenshui = PageState.Empty;
|
|
|
|
// }
|
|
|
|
// if (userHistorysShowLiushi.length > 0) {
|
|
|
|
// pageStateLiushi = PageState.Success;
|
|
|
|
// } else {
|
|
|
|
// pageStateLiushi = PageState.Empty;
|
|
|
|
// }
|
|
|
|
|
|
|
|
handleList(customerBySellerList, needRefresh: true);
|
|
|
|
}
|
|
...
|
...
|
@@ -1440,7 +1505,8 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
}
|
|
|
|
|
|
|
|
// 商家创建营销
|
|
|
|
createMarketingBySeller(BuildContext context, Map<String, String> params,
|
|
|
|
Future<bool> createMarketingBySeller(
|
|
|
|
BuildContext context, Map<String, String> params,
|
|
|
|
{bool showLoading = false}) async {
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(
|
|
...
|
...
|
@@ -1454,13 +1520,17 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {
|
|
|
|
// guestReserveSunModel =
|
|
|
|
// GuestReserveModel.fromJson(baseResp.responseData).data;
|
|
|
|
notifyListeners();
|
|
|
|
if (baseResp.data != null &&
|
|
|
|
baseResp.data['id'] != '' &&
|
|
|
|
baseResp.data['id'] != null) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (baseResp != null) {
|
|
|
|
Utils.showToast(baseResp.msg ?? "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 商家营销列表
|
|
...
|
...
|
@@ -1488,9 +1558,13 @@ class CustomerProvider extends ChangeNotifier { |
|
|
|
notifyListeners();
|
|
|
|
});
|
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {
|
|
|
|
pageStateMarketingRecord = PageState.Success;
|
|
|
|
marketingBySellerSunModel =
|
|
|
|
MarketingBySellerModel.fromJson(baseResp.responseData).data;
|
|
|
|
if (marketingBySellerSunModel.length == 0) {
|
|
|
|
pageStateMarketingRecord = PageState.Empty;
|
|
|
|
} else {
|
|
|
|
pageStateMarketingRecord = PageState.Success;
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
} else {
|
|
|
|
if (baseResp != null) {
|
...
|
...
|
|