Skip to content

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_canceled

Nguồn ticket

Tickets.tsx định nghĩa 8 nguồn ticket:

SourceÝ nghĩa nghiệp vụ
ticket_source_1Tạo từ page, cộng đồng, thị trường, hotline, ADS, HQ Sale
ticket_source_2Tạo từ Telesales / CSKH
ticket_source_3Tạo từ kết quả của ticket trước đó
ticket_source_4Tạ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_5Tạo từ lịch hẹn tư vấn
ticket_source_6Tạo từ đánh giá công việc
ticket_source_7Tạo từ nhãn liên hệ sai số
ticket_source_8Khá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ợ:

FilterMô tả
missedLọc is_missed = true
status / statusesLọc theo 1 hoặc nhiều status
keywordsTìm trong field keywords; hỗ trợ mode number-sequence
assigneesLọc assignee_id
curatorsLọc in_charge_id
branchIdsLọc branch_id
ticketResultLọc result_id
ticketSourcesLọc source_id
customerLabelsLọc qua search_customer.customer_label_id
due_date / timeLabelLọc theo khoảng ngày hết hạn
customer_idDrill-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-001Nếu không phải Admin/BOD, filter thêm belong_to = role target hiện tại.
BR-CRM-002Nếu user thuộc AssignedTicketRoles, filter thêm target_id = mapTicketTarget(role).
BR-CRM-003Leader được vào assignment page; staff không được.
BR-CRM-004Customer detail trong CRM redirect mặc định về tab crm_note.
BR-CRM-005Ticket 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
      -> complaint

Quy tắc nghiệp vụ

#Rule
BR-CRM-006CRM customer workspace reuse component từ user/ecommerce/affiliate nhưng vẫn áp permission CRM.
BR-CRM-007KnowledgeBaseInfo tự động khóa filter type theo role nếu user là CustomerServiceLeader hoặc TelesalesLeader.
BR-CRM-008Assignment chỉ dành cho leader và IT; route detail/update dùng cặp branch_id + user_id.
BR-CRM-009Ticket multiple create là luồng tạo nhiều ticket cùng lúc từ cùng ticket root / input.

Ticket results và target

ItemGiá trị tiêu biểu
Targetstelesales, customer_service
Result liên quan callcall_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ú
1useTicketBuilder.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.
2Customer 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.
3Source tooltip descriptions nằm ở FE code thay vì master data/backend metadata.
4CRM 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.