|
...
|
...
|
@@ -5,6 +5,7 @@ import 'dart:typed_data'; |
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:call_log/call_log.dart';
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:easy_contact_picker/easy_contact_picker.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
...
|
...
|
@@ -48,6 +49,7 @@ import 'dart:ui' as ui; |
|
|
|
import '../../app.dart';
|
|
|
|
|
|
|
|
import '../../models/sms_info.dart';
|
|
|
|
import '../../models/user_history_entity.dart';
|
|
|
|
import '../../provider/SmsModel.dart';
|
|
|
|
import '../../provider/customer_provider.dart';
|
|
|
|
import '../../provider/marketing_center_provider.dart';
|
|
...
|
...
|
@@ -584,7 +586,13 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
// _homeEnterModel
|
|
|
|
// .userHistorys[index].rname +
|
|
|
|
// _nameSuffix();
|
|
|
|
_addNameSuffix(_baseIndoProvider.userHistorys[index].rname, sexStr);
|
|
|
|
|
|
|
|
if (_baseIndoProvider.userHistorys[index].rname != null &&
|
|
|
|
_baseIndoProvider.userHistorys[index].rname.trim().length > 0) {
|
|
|
|
_addNameSuffix(
|
|
|
|
_baseIndoProvider.userHistorys[index].rname, sexStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
nameStr = _baseIndoProvider.userHistorys[index].rname;
|
|
|
|
_phoneNode.unfocus();
|
|
|
|
_baseIndoProvider.userHistorys.clear();
|
|
...
|
...
|
@@ -1041,6 +1049,21 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
customController.text.trim().length == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((nameStr == null || nameStr.trim().length == 0) &&
|
|
|
|
_baseIndoProvider.phoneController.text.replaceAll(' ', '').length > 0 &&
|
|
|
|
oldName == null) {
|
|
|
|
Utils.showToast('请输入顾客姓名!');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((nameStr != null && nameStr.trim().length > 0) &&
|
|
|
|
_baseIndoProvider.phoneController.text.replaceAll(' ', '').length ==
|
|
|
|
0 &&
|
|
|
|
oldPhone == null) {
|
|
|
|
Utils.showToast('请输入顾客电话!');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String phone;
|
|
|
|
String name;
|
|
|
|
String sex;
|
|
...
|
...
|
@@ -2109,20 +2132,47 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
TextInputType.numberWithOptions(decimal: true),
|
|
|
|
)),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () async {
|
|
|
|
_openAddressBook();
|
|
|
|
// var result = await CallLogUtil.getCallLog();
|
|
|
|
// print(result);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(74) * 2,
|
|
|
|
// color: Colors.red,
|
|
|
|
width: ScreenUtil().setWidth(64) * 2,
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Text('一键录入',
|
|
|
|
child: Text('电话簿',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (Platform.isAndroid)
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(20),
|
|
|
|
MyDivider(1.0, ScreenUtil().setWidth(40)),
|
|
|
|
HEmptyView(20),
|
|
|
|
InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
_getCallLog();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
// color: Colors.red,
|
|
|
|
// width: ScreenUtil().setWidth(64) * 2,
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text('通话记录',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Stack(
|
|
...
|
...
|
@@ -2524,14 +2574,20 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
sexStr = _baseIndoProvider
|
|
|
|
.userHistorys[index].sexStr;
|
|
|
|
UserHistoryEntity userHistoryEntity =
|
|
|
|
_baseIndoProvider
|
|
|
|
.userHistorys[index];
|
|
|
|
if (userHistoryEntity.sex == null ||
|
|
|
|
userHistoryEntity.sex == '') {
|
|
|
|
userHistoryEntity.sex = '1';
|
|
|
|
}
|
|
|
|
sexStr = userHistoryEntity.sexStr;
|
|
|
|
|
|
|
|
sexSelectIndex =
|
|
|
|
sexList.indexOf(sexStr);
|
|
|
|
|
|
|
|
_getIsMemberByPhone(_baseIndoProvider
|
|
|
|
.userHistorys[index].phone);
|
|
|
|
_getIsMemberByPhone(
|
|
|
|
userHistoryEntity.phone);
|
|
|
|
needHistory = true;
|
|
|
|
_showConfirmWidget(
|
|
|
|
needHistory: true, index: index);
|
|
...
|
...
|
@@ -3560,7 +3616,7 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
width: ScreenUtil().setWidth(84) * 3,
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Text('一键录入',
|
|
|
|
child: Text('电话簿',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
...
|
...
|
@@ -3855,6 +3911,27 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_getCallLog() async {
|
|
|
|
Iterable<CallLogEntry> result = await CallLog.query();
|
|
|
|
_baseIndoProvider.userHistorys = [];
|
|
|
|
|
|
|
|
List<CallLogEntry> object = Utils.removeDuplicates(result.toList());
|
|
|
|
|
|
|
|
print(object);
|
|
|
|
object.forEach((element) {
|
|
|
|
UserHistoryEntity userHistoryEntity =
|
|
|
|
UserHistoryEntity(null, null, '', '', '', '', '', null);
|
|
|
|
userHistoryEntity.rname = element.name ?? '';
|
|
|
|
userHistoryEntity.phone = element.number ?? '';
|
|
|
|
_baseIndoProvider.userHistorys.add(userHistoryEntity);
|
|
|
|
});
|
|
|
|
if (object.length > 0) {
|
|
|
|
//有记录
|
|
|
|
showPhoneHistory = true;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_openAddressBook() async {
|
|
|
|
if (!(await checkContactPermission())) {
|
|
|
|
PermissionStatus permissionStatus = await contactPermissionStatus();
|
...
|
...
|
|