通话记录展示

This commit is contained in:
GYJ
2024-11-23 16:53:30 +08:00
parent a82e726d5f
commit 0f3e728a79
11 changed files with 343 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
import 'package:cashier_reserve/common/base/ui.dart';
import 'package:cashier_reserve/common/base/ui_model.dart';
import 'package:cashier_reserve/common/channel/call_log_model.dart';
import 'package:cashier_reserve/common/print/print.dart';
import 'package:cashier_reserve/home/reserve_view_model.dart';
import '../common/base/provider.dart';
@@ -43,7 +45,7 @@ class ReserveView extends BaseUI {
width: 15,
),
InkWell(
onTap: () {},
onTap: () {},
child: SizedBox(
width: 40,
height: 40,
@@ -84,7 +86,10 @@ class ReserveView extends BaseUI {
width: 40,
height: 40,
child: Center(
child: Text("刷新", style: TextStyle(fontSize: 15, color: Colors.blue),),
child: Text(
"刷新",
style: TextStyle(fontSize: 15, color: Colors.blue),
),
),
),
),
@@ -95,7 +100,156 @@ class ReserveView extends BaseUI {
Widget _buildContentView(BuildContext context, ReserveViewModel provider) {
return Row(
children: [],
children: [
_buildLeftContent(context, provider),
Expanded(child: _buildRightContent(context, provider)),
],
);
}
Widget _buildLeftContent(BuildContext context, ReserveViewModel provider) {
yjPrint("callLogs length: ${provider.callLogs?.length}");
return Column(
children: [
Expanded(
child: SizedBox(
width: 430,
child: ListView.builder(
itemCount: provider.callLogs?.length ?? 0,
itemBuilder: (context, index) {
return _buildCallRecordItem(context, provider.callLogs?[index]);
},
),
)),
Container(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 15),
child: InkWell(
onTap: () {},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: const Color(0xff318AFE),
),
width: 300,
height: 36,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'images/reserve/create.png',
width: 20,
height: 20,
),
const SizedBox(
width: 5,
),
const Text(
"创建订单",
style: TextStyle(color: Colors.white, fontSize: 14),
),
],
),
),
),
)
],
);
}
Widget _buildRightContent(BuildContext context, ReserveViewModel provider) {
return Container();
}
/// _buildCallRecordItem 通话记录item
Widget _buildCallRecordItem(BuildContext context, CallLogModel? model) {
return Container(
padding: const EdgeInsets.fromLTRB(15, 15, 15, 5),
child: Column(
children: [
Row(
children: [
Column(
children: [
Image.asset(
(model?.type ?? 0) == 3
? "images/reserve/phone_fail.png"
: "images/reserve/phone_suc.png",
width: 24,
height: 24,
),
const SizedBox(height: 2),
Text(
model?.time ?? "",
style:
const TextStyle(color: Color(0xff999999), fontSize: 12),
),
],
),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model?.name ?? "未知电话",
style:
const TextStyle(color: Color(0xff333333), fontSize: 14),
),
const SizedBox(height: 5),
Row(
children: [
Text(
model?.number ?? "",
style: const TextStyle(
color: Color(0xff333333), fontSize: 14),
),
const SizedBox(
width: 15,
),
const Text(
"已消费0单",
style:
TextStyle(color: Color(0xff333333), fontSize: 14),
),
const SizedBox(
width: 15,
),
const Text(
"已撤0单",
style:
TextStyle(color: Color(0xff333333), fontSize: 14),
),
],
),
],
),
const Expanded(child: SizedBox()),
InkWell(
onTap: () {},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border:
Border.all(color: const Color(0xff318AFE), width: 1),
),
padding: const EdgeInsets.fromLTRB(20, 7, 20, 7),
child: const Text(
"处理",
style: TextStyle(color: Color(0xff318AFE), fontSize: 14),
),
),
)
],
),
const SizedBox(
height: 10,
),
Container(
height: 1,
color: const Color(0xffededed),
),
],
),
);
}

View File

@@ -1,5 +1,8 @@
import 'package:cashier_reserve/common/base/ui_model.dart';
import 'package:cashier_reserve/common/channel/call_log_model.dart';
import 'package:cashier_reserve/common/channel/channel_manager.dart';
import 'package:cashier_reserve/common/manager/event_manager.dart';
import 'package:cashier_reserve/common/print/print.dart';
class ReserveViewModel extends BaseUIModel {
Map<int, String> weekdayMap = {
@@ -17,10 +20,22 @@ class ReserveViewModel extends BaseUIModel {
1: "",
2: "",
};
List<CallLogModel?>? callLogs = [];
// ReserveViewModel() {
// loadData();
// }
ReserveViewModel() {
EventManager.addListener<GetCallLogEvent>(this, (event) {
if (event.isSuccess) {
if (!event.isSuccess) {
return;
}
callLogs = event.callLogs;
notifyListeners();
}
});
loadCallLog();
}
void loadCallLog() {
ChannelManager.getCallLog("getCallLog");