njzscloud-dispose-web/src/pages/order/constants.ts

168 lines
3.3 KiB
TypeScript

import { createEnum } from '@/common/utils/enums.ts'
import type { ColorSchemeType } from '@/common/utils/color-schemes.ts'
const orderCategoryList = [
{
val: 'HuiShouYuYue',
txt: '回收预约单',
},
{
val: 'XiaoShouYuYue',
txt: '销售预约单',
},
{
val: 'DuanBoRu',
txt: '短驳入',
},
{
val: 'DuanBoChu',
txt: '短驳出',
},
] as const
export type OrderCategoryType = typeof orderCategory[number]['val']
export const orderCategory = createEnum(orderCategoryList)
const orderStatusList = [
{
val: 'YiYuYue',
txt: '已预约',
},
{
val: 'JinXingZhong',
txt: '进行中',
},
{
val: 'YiWanCheng',
txt: '已完成',
},
{
val: 'YiQuXiao',
txt: '已取消',
},
] as const
export const orderStatus = createEnum(orderStatusList)
const transStatusList = [
{
val: 'DaiPaiDan',
txt: '待派单',
},
{
val: 'DaiJieDan',
txt: '待接单',
},
{
val: 'YiJieDan',
txt: '已接单',
},
{
val: 'YunShuZhong',
txt: '运输中',
},
{
val: 'YiJinChang',
txt: '已进场',
},
{
val: 'YiChuChang',
txt: '已出场',
},
{
val: 'YiWanCheng',
txt: '已完成',
},
{
val: 'YiQuXiao',
txt: '已取消',
},
] as const
export const transStatus = createEnum(transStatusList)
export const transStatusColor: {
cs: (data?: any, defaultColorScheme?: ColorSchemeType | '') => ColorSchemeType | ''
} & {
[key in typeof transStatusList[number]['val']]: ColorSchemeType
} = {
DaiPaiDan: 'primary',
DaiJieDan: 'warning',
YiJieDan: 'dth',
YunShuZhong: 'success',
YiJinChang: 'ycz',
YiChuChang: 'sch',
YiWanCheng: 'danger',
YiQuXiao: 'info',
cs(data?: any, defaultColorScheme: ColorSchemeType | '' = '') {
if (data) {
return this[data as typeof transStatusList[number]['val']]
}
return defaultColorScheme
},
}
const checkStatusList = [
{
val: 'Wu',
txt: '无需勘料',
},
{
val: 'YiKanLiao',
txt: '已勘料',
},
{
val: 'WeiKanLiao',
txt: '未勘料',
},
] as const
export const checkStatus = createEnum(checkStatusList)
export const checkStatusColor: {
cs: (data?: any, defaultColorScheme?: ColorSchemeType | '') => ColorSchemeType | ''
} & {
[key in typeof checkStatusList[number]['val']]: ColorSchemeType
} = {
Wu: 'info',
YiKanLiao: 'success',
WeiKanLiao: 'warning',
cs(data?: any, defaultColorScheme: ColorSchemeType | '' = '') {
if (data) {
return this[data as typeof checkStatusList[number]['val']]
}
return defaultColorScheme
},
}
const paymentStatusList = [
{
val: 'MianFei',
txt: '免费',
},
{
val: 'WeiZhiFu',
txt: '未支付',
},
{
val: 'YiZhiFu',
txt: '已支付',
},
{
val: 'YiTuiKuan',
txt: '已退款',
},
] as const
export const paymentStatus = createEnum(paymentStatusList)
export const paymentStatusColor: {
cs: (data?: any, defaultColorScheme?: ColorSchemeType | '') => ColorSchemeType | ''
} & {
[key in typeof paymentStatusList[number]['val']]: ColorSchemeType
} = {
MianFei: 'primary',
WeiZhiFu: 'warning',
YiZhiFu: 'success',
YiTuiKuan: 'dth',
cs(data?: any, defaultColorScheme: ColorSchemeType | '' = '') {
if (data) {
return this[data as typeof paymentStatusList[number]['val']]
}
return defaultColorScheme
},
}