123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521 |
- /**
- * 投诉管理相关常量定义
- * @fileoverview 投诉人类型、投诉类型、投诉状态、回复状态等枚举值和工具函数
- */
- /**
- * 投诉人类型枚举
- * @readonly
- * @enum {number}
- */
- export const COMPLAINANT_TYPE = {
- /** 终端消费者 */
- CONSUMER: 1,
- /** 门店 */
- STORE: 2,
- /** 经销商 */
- DEALER: 3
- }
- /**
- * 投诉类型枚举
- * @readonly
- * @enum {string}
- */
- export const COMPLAINT_TYPE = {
- /** 质量问题 */
- QUALITY: '质量',
- /** 物流问题 */
- LOGISTICS: '物流',
- /** 服务问题 */
- SERVICE: '服务',
- /** 价格问题 */
- PRICE: '价格',
- /** 其他问题 */
- OTHER: '其他'
- }
- /**
- * 投诉状态枚举
- * @readonly
- * @enum {number}
- */
- export const COMPLAINT_STATUS = {
- /** 待处理 */
- PENDING: 0,
- /** 处理中 */
- PROCESSING: 1,
- /** 已回复 */
- REPLIED: 2,
- /** 已关闭 */
- CLOSED: 3,
- /** 已撤销 */
- CANCELLED: 4
- }
- /**
- * 回复状态枚举
- * @readonly
- * @enum {number}
- */
- export const REPLY_STATUS = {
- /** 未回复 */
- NOT_REPLIED: 0,
- /** 已回复 */
- REPLIED: 1
- }
- /**
- * 回复类型枚举
- * @readonly
- * @enum {number}
- */
- export const REPLY_TYPE = {
- /** 系统回复 */
- SYSTEM: 1,
- /** 客户反馈 */
- CUSTOMER: 2,
- /** 申诉 */
- APPEAL: 3
- }
- /**
- * 投诉人类型配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const COMPLAINANT_TYPE_CONFIG = {
- [COMPLAINANT_TYPE.CONSUMER]: {
- label: '终端消费者',
- type: 'primary',
- color: '#409EFF'
- },
- [COMPLAINANT_TYPE.STORE]: {
- label: '门店',
- type: 'success',
- color: '#67C23A'
- },
- [COMPLAINANT_TYPE.DEALER]: {
- label: '经销商',
- type: 'warning',
- color: '#E6A23C'
- }
- }
- /**
- * 投诉类型配置映射
- * @readonly
- * @type {Record<string, {label: string, type: string, color: string}>}
- */
- export const COMPLAINT_TYPE_CONFIG = {
- [COMPLAINT_TYPE.QUALITY]: {
- label: '质量',
- type: 'danger',
- color: '#F56C6C'
- },
- [COMPLAINT_TYPE.LOGISTICS]: {
- label: '物流',
- type: 'warning',
- color: '#E6A23C'
- },
- [COMPLAINT_TYPE.SERVICE]: {
- label: '服务',
- type: 'primary',
- color: '#409EFF'
- },
- [COMPLAINT_TYPE.PRICE]: {
- label: '价格',
- type: 'info',
- color: '#909399'
- },
- [COMPLAINT_TYPE.OTHER]: {
- label: '其他',
- type: 'info',
- color: '#909399'
- }
- }
- /**
- * 投诉状态配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const COMPLAINT_STATUS_CONFIG = {
- [COMPLAINT_STATUS.PENDING]: {
- label: '待处理',
- type: 'warning',
- color: '#E6A23C'
- },
- [COMPLAINT_STATUS.PROCESSING]: {
- label: '处理中',
- type: 'primary',
- color: '#409EFF'
- },
- [COMPLAINT_STATUS.REPLIED]: {
- label: '已回复',
- type: 'success',
- color: '#67C23A'
- },
- [COMPLAINT_STATUS.CLOSED]: {
- label: '已关闭',
- type: 'info',
- color: '#909399'
- },
- [COMPLAINT_STATUS.CANCELLED]: {
- label: '已撤销',
- type: 'danger',
- color: '#F56C6C'
- }
- }
- /**
- * 回复状态配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const REPLY_STATUS_CONFIG = {
- [REPLY_STATUS.NOT_REPLIED]: {
- label: '未回复',
- type: 'info',
- color: '#909399'
- },
- [REPLY_STATUS.REPLIED]: {
- label: '已回复',
- type: 'success',
- color: '#67C23A'
- }
- }
- /**
- * 回复类型配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const REPLY_TYPE_CONFIG = {
- [REPLY_TYPE.SYSTEM]: {
- label: '系统回复',
- type: 'primary',
- color: '#409EFF'
- },
- [REPLY_TYPE.CUSTOMER]: {
- label: '客户反馈',
- type: 'success',
- color: '#67C23A'
- },
- [REPLY_TYPE.APPEAL]: {
- label: '申诉',
- type: 'warning',
- color: '#E6A23C'
- }
- }
- /**
- * 投诉人类型选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const COMPLAINANT_TYPE_OPTIONS = [
- { label: '终端消费者', value: COMPLAINANT_TYPE.CONSUMER },
- { label: '门店', value: COMPLAINANT_TYPE.STORE },
- { label: '经销商', value: COMPLAINANT_TYPE.DEALER }
- ]
- /**
- * 投诉类型选项数据
- * @readonly
- * @type {Array<{label: string, value: string}>}
- */
- export const COMPLAINT_TYPE_OPTIONS = [
- { label: '质量', value: COMPLAINT_TYPE.QUALITY },
- { label: '物流', value: COMPLAINT_TYPE.LOGISTICS },
- { label: '服务', value: COMPLAINT_TYPE.SERVICE },
- { label: '价格', value: COMPLAINT_TYPE.PRICE },
- { label: '其他', value: COMPLAINT_TYPE.OTHER }
- ]
- /**
- * 投诉状态选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const COMPLAINT_STATUS_OPTIONS = [
- { label: '待处理', value: COMPLAINT_STATUS.PENDING },
- { label: '处理中', value: COMPLAINT_STATUS.PROCESSING },
- { label: '已回复', value: COMPLAINT_STATUS.REPLIED },
- { label: '已关闭', value: COMPLAINT_STATUS.CLOSED },
- { label: '已撤销', value: COMPLAINT_STATUS.CANCELLED }
- ]
- /**
- * 回复状态选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const REPLY_STATUS_OPTIONS = [
- { label: '未回复', value: REPLY_STATUS.NOT_REPLIED },
- { label: '已回复', value: REPLY_STATUS.REPLIED }
- ]
- /**
- * 回复类型选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const REPLY_TYPE_OPTIONS = [
- { label: '系统回复', value: REPLY_TYPE.SYSTEM },
- { label: '客户反馈', value: REPLY_TYPE.CUSTOMER },
- { label: '申诉', value: REPLY_TYPE.APPEAL }
- ]
- /**
- * 获取投诉人类型标签
- * @param {number} complainantType - 投诉人类型值
- * @returns {string} 投诉人类型标签
- */
- export function getComplainantTypeLabel(complainantType) {
- const config = COMPLAINANT_TYPE_CONFIG[complainantType]
- return config ? config.label : '未知类型'
- }
- /**
- * 获取投诉人类型Element UI标签类型
- * @param {number} complainantType - 投诉人类型值
- * @returns {string} Element UI标签类型
- */
- export function getComplainantTypeType(complainantType) {
- const config = COMPLAINANT_TYPE_CONFIG[complainantType]
- return config ? config.type : 'info'
- }
- /**
- * 获取投诉人类型颜色
- * @param {number} complainantType - 投诉人类型值
- * @returns {string} 十六进制颜色值
- */
- export function getComplainantTypeColor(complainantType) {
- const config = COMPLAINANT_TYPE_CONFIG[complainantType]
- return config ? config.color : '#909399'
- }
- /**
- * 获取投诉类型标签
- * @param {string} complaintType - 投诉类型值
- * @returns {string} 投诉类型标签
- */
- export function getComplaintTypeLabel(complaintType) {
- const config = COMPLAINT_TYPE_CONFIG[complaintType]
- return config ? config.label : '未知类型'
- }
- /**
- * 获取投诉类型Element UI标签类型
- * @param {string} complaintType - 投诉类型值
- * @returns {string} Element UI标签类型
- */
- export function getComplaintTypeType(complaintType) {
- const config = COMPLAINT_TYPE_CONFIG[complaintType]
- return config ? config.type : 'info'
- }
- /**
- * 获取投诉类型颜色
- * @param {string} complaintType - 投诉类型值
- * @returns {string} 十六进制颜色值
- */
- export function getComplaintTypeColor(complaintType) {
- const config = COMPLAINT_TYPE_CONFIG[complaintType]
- return config ? config.color : '#909399'
- }
- /**
- * 获取投诉状态标签
- * @param {number} status - 投诉状态值
- * @returns {string} 投诉状态标签
- */
- export function getComplaintStatusLabel(status) {
- const config = COMPLAINT_STATUS_CONFIG[status]
- return config ? config.label : '未知状态'
- }
- /**
- * 获取投诉状态Element UI标签类型
- * @param {number} status - 投诉状态值
- * @returns {string} Element UI标签类型
- */
- export function getComplaintStatusType(status) {
- const config = COMPLAINT_STATUS_CONFIG[status]
- return config ? config.type : 'info'
- }
- /**
- * 获取投诉状态颜色
- * @param {number} status - 投诉状态值
- * @returns {string} 十六进制颜色值
- */
- export function getComplaintStatusColor(status) {
- const config = COMPLAINT_STATUS_CONFIG[status]
- return config ? config.color : '#909399'
- }
- /**
- * 获取回复状态标签
- * @param {number} replyStatus - 回复状态值
- * @returns {string} 回复状态标签
- */
- export function getReplyStatusLabel(replyStatus) {
- const config = REPLY_STATUS_CONFIG[replyStatus]
- return config ? config.label : '未知状态'
- }
- /**
- * 获取回复状态Element UI标签类型
- * @param {number} replyStatus - 回复状态值
- * @returns {string} Element UI标签类型
- */
- export function getReplyStatusType(replyStatus) {
- const config = REPLY_STATUS_CONFIG[replyStatus]
- return config ? config.type : 'info'
- }
- /**
- * 获取回复状态颜色
- * @param {number} replyStatus - 回复状态值
- * @returns {string} 十六进制颜色值
- */
- export function getReplyStatusColor(replyStatus) {
- const config = REPLY_STATUS_CONFIG[replyStatus]
- return config ? config.color : '#909399'
- }
- /**
- * 验证投诉人类型是否有效
- * @param {number} complainantType - 投诉人类型值
- * @returns {boolean} 是否为有效投诉人类型
- */
- export function isValidComplainantType(complainantType) {
- return Object.values(COMPLAINANT_TYPE).includes(complainantType)
- }
- /**
- * 验证投诉类型是否有效
- * @param {string} complaintType - 投诉类型值
- * @returns {boolean} 是否为有效投诉类型
- */
- export function isValidComplaintType(complaintType) {
- return Object.values(COMPLAINT_TYPE).includes(complaintType)
- }
- /**
- * 验证投诉状态是否有效
- * @param {number} status - 投诉状态值
- * @returns {boolean} 是否为有效投诉状态
- */
- export function isValidComplaintStatus(status) {
- return Object.values(COMPLAINT_STATUS).includes(status)
- }
- /**
- * 验证回复状态是否有效
- * @param {number} replyStatus - 回复状态值
- * @returns {boolean} 是否为有效回复状态
- */
- export function isValidReplyStatus(replyStatus) {
- return Object.values(REPLY_STATUS).includes(replyStatus)
- }
- /**
- * 获取所有投诉人类型值
- * @returns {Array<number>} 投诉人类型值数组
- */
- export function getAllComplainantTypeValues() {
- return Object.values(COMPLAINANT_TYPE)
- }
- /**
- * 获取所有投诉类型值
- * @returns {Array<string>} 投诉类型值数组
- */
- export function getAllComplaintTypeValues() {
- return Object.values(COMPLAINT_TYPE)
- }
- /**
- * 获取所有投诉状态值
- * @returns {Array<number>} 投诉状态值数组
- */
- export function getAllComplaintStatusValues() {
- return Object.values(COMPLAINT_STATUS)
- }
- /**
- * 获取回复类型标签
- * @param {number} replyType - 回复类型值
- * @returns {string} 回复类型标签
- */
- export function getReplyTypeLabel(replyType) {
- const config = REPLY_TYPE_CONFIG[replyType]
- return config ? config.label : '未知类型'
- }
- /**
- * 获取回复类型Element UI标签类型
- * @param {number} replyType - 回复类型值
- * @returns {string} Element UI标签类型
- */
- export function getReplyTypeType(replyType) {
- const config = REPLY_TYPE_CONFIG[replyType]
- return config ? config.type : 'info'
- }
- /**
- * 获取回复类型颜色
- * @param {number} replyType - 回复类型值
- * @returns {string} 十六进制颜色值
- */
- export function getReplyTypeColor(replyType) {
- const config = REPLY_TYPE_CONFIG[replyType]
- return config ? config.color : '#909399'
- }
- /**
- * 获取所有回复类型值
- * @returns {Array<number>} 回复类型值数组
- */
- export function getAllReplyTypeValues() {
- return Object.values(REPLY_TYPE)
- }
- /**
- * 获取所有回复状态值
- * @returns {Array<number>} 回复状态值数组
- */
- export function getAllReplyStatusValues() {
- return Object.values(REPLY_STATUS)
- }
- /**
- * 判断投诉状态是否可以编辑
- * @param {number} status - 投诉状态值
- * @returns {boolean} 是否可以编辑
- */
- export function isComplaintEditable(status) {
- return status !== COMPLAINT_STATUS.CANCELLED && status !== COMPLAINT_STATUS.CLOSED
- }
- /**
- * 判断投诉状态是否可以处理
- * @param {number} status - 投诉状态值
- * @returns {boolean} 是否可以处理
- */
- export function isComplaintProcessable(status) {
- return status === COMPLAINT_STATUS.PROCESSING
- }
- /**
- * 判断投诉状态是否可以关闭
- * @param {number} status - 投诉状态值
- * @returns {boolean} 是否可以关闭
- */
- export function isComplaintClosable(status) {
- return status !== COMPLAINT_STATUS.CANCELLED && status !== COMPLAINT_STATUS.CLOSED
- }
|