Appearance
CRM - Business Rules
Tổng quan
CRM xoay quanh ticket. Mỗi ticket là 1 cơ hội / yêu cầu chăm sóc giống một task có owner, due date, target team, result và history.
Trạng thái ticket
ticket_status_new
-> ticket_status_assigned
-> ticket_status_completed
-> ticket_status_canceledNguồn ticket
Tickets.tsx định nghĩa 8 nguồn ticket:
| Source | Ý nghĩa nghiệp vụ |
|---|---|
ticket_source_1 | Tạo từ page, cộng đồng, thị trường, hotline, ADS, HQ Sale |
ticket_source_2 | Tạo từ Telesales / CSKH |
ticket_source_3 | Tạo từ kết quả của ticket trước đó |
ticket_source_4 | Tạo từ lịch hẹn, công việc dịch vụ hoàn thành, đơn mỹ phẩm hoàn thành, thanh toán thành công, phát sinh đơn |
ticket_source_5 | Tạo từ lịch hẹn tư vấn |
ticket_source_6 | Tạo từ đánh giá công việc |
ticket_source_7 | Tạo từ nhãn liên hệ sai số |
ticket_source_8 | Khách sinh nhật hôm nay và thực thu tối thiểu 1 triệu |
Quy tắc lọc ticket
Builder TicketBuildWhere hỗ trợ:
| Filter | Mô tả |
|---|---|
missed | Lọc is_missed = true |
status / statuses | Lọc theo 1 hoặc nhiều status |
keywords | Tìm trong field keywords; hỗ trợ mode number-sequence |
assignees | Lọc assignee_id |
curators | Lọc in_charge_id |
branchIds | Lọc branch_id |
ticketResult | Lọc result_id |
ticketSources | Lọc source_id |
customerLabels | Lọc qua search_customer.customer_label_id |
due_date / timeLabel | Lọc theo khoảng ngày hết hạn |
customer_id | Drill-down từ customer detail vào ticket của 1 khách |
Role-based scoping
Mục tiêu nghiệp vụ
- Admin/BOD nhìn được rộng hơn.
- Leader nhìn theo team / target.
- Staff nhìn ticket của mình hoặc ticket cho target mình phụ trách.
Rule từ code
| # | Rule |
|---|---|
| BR-CRM-001 | Nếu không phải Admin/BOD, filter thêm belong_to = role target hiện tại. |
| BR-CRM-002 | Nếu user thuộc AssignedTicketRoles, filter thêm target_id = mapTicketTarget(role). |
| BR-CRM-003 | Leader được vào assignment page; staff không được. |
| BR-CRM-004 | Customer detail trong CRM redirect mặc định về tab crm_note. |
| BR-CRM-005 | Ticket detail redirect mặc định về tab ticket_note. |
Customer CRM Workspace
CRM Customer
-> search / new / list / visit
-> customer detail
-> note
-> appreciation
-> order history
-> record
-> activity log
-> ticket manager
-> called / call detail
-> appointment
-> SMS
-> collaborators
-> treatment images
-> payment history
-> reward
-> task
-> complaintQuy tắc nghiệp vụ
| # | Rule |
|---|---|
| BR-CRM-006 | CRM customer workspace reuse component từ user/ecommerce/affiliate nhưng vẫn áp permission CRM. |
| BR-CRM-007 | KnowledgeBaseInfo tự động khóa filter type theo role nếu user là CustomerServiceLeader hoặc TelesalesLeader. |
| BR-CRM-008 | Assignment chỉ dành cho leader và IT; route detail/update dùng cặp branch_id + user_id. |
| BR-CRM-009 | Ticket multiple create là luồng tạo nhiều ticket cùng lúc từ cùng ticket root / input. |
Ticket results và target
| Item | Giá trị tiêu biểu |
|---|---|
| Targets | telesales, customer_service |
| Result liên quan call | call_later, turn_off, not_available_call, missed_call |
| Result nghiệp vụ | wrong_number, wrong_information, hold_potential_appointment, cancel_service, completed, ... |
Rủi ro / Findings
| # | Ghi chú |
|---|---|
| 1 | useTicketBuilder.ts đang gọi _or.concat([...]) mà không gán lại kết quả; ý định filter thêm assignee_id / in_charge_id cho non-leader có thể không có hiệu lực như mong muốn. |
| 2 | Customer workspace trong CRM phụ thuộc mạnh vào cross-module reuse, nên đổi route/tab dễ gây tác động liên module. |
| 3 | Source tooltip descriptions nằm ở FE code thay vì master data/backend metadata. |
| 4 | CRM vừa có call center real-time, vừa có scheduler distribute/remind ticket, nên bug đồng bộ thường nằm ở integration và time-based flow. |