252 lines
7.3 KiB
TypeScript
252 lines
7.3 KiB
TypeScript
/**
|
|
* Mock 订单数据
|
|
*/
|
|
|
|
import type { Order, OrderFlow, OrderStatus } from '@/types'
|
|
|
|
// 模拟订单列表
|
|
export const mockOrders: Order[] = [
|
|
{
|
|
id: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
tenantId: 1001,
|
|
customerId: 10001,
|
|
customerName: '游戏玩家001',
|
|
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
customerPhone: '138****8001',
|
|
serviceId: 1,
|
|
serviceName: '王者荣耀段位提升 - 黄金到钻石',
|
|
serviceCover: 'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
|
|
price: 199,
|
|
actualPrice: 199,
|
|
status: 4, // 进行中
|
|
selectedPlayerId: 1,
|
|
selectedPlayerName: '代练小王',
|
|
playerId: 1,
|
|
playerName: '代练小王',
|
|
playerAvatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
playerPhone: '137****7001',
|
|
dispatchTime: '2025-12-29 15:30:00',
|
|
dispatchBy: 10002,
|
|
gameInfo: {
|
|
gameId: 'wzry',
|
|
gameName: '王者荣耀',
|
|
server: 'QQ区',
|
|
account: 'test_account_001',
|
|
remark: '请使用射手位置上分'
|
|
},
|
|
contactInfo: {
|
|
qq: '123456789',
|
|
wechat: 'wx123456'
|
|
},
|
|
remark: '希望快点完成,谢谢',
|
|
payType: 'wechat',
|
|
payTime: '2025-12-29 15:00:00',
|
|
acceptTime: '2025-12-29 15:35:00',
|
|
startTime: '2025-12-29 16:00:00',
|
|
createTime: '2025-12-29 14:50:00',
|
|
updateTime: '2025-12-30 09:00:00'
|
|
},
|
|
{
|
|
id: 2,
|
|
orderNo: 'ORDER202512300002',
|
|
tenantId: 1001,
|
|
customerId: 10001,
|
|
customerName: '游戏玩家001',
|
|
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
serviceId: 2,
|
|
serviceName: '王者荣耀巅峰赛陪玩',
|
|
serviceCover: 'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
|
|
price: 50,
|
|
actualPrice: 50,
|
|
status: 1, // 待派单
|
|
payType: 'wechat',
|
|
payTime: '2025-12-30 09:15:00',
|
|
remark: '希望能语音沟通',
|
|
createTime: '2025-12-30 09:10:00',
|
|
updateTime: '2025-12-30 09:15:00'
|
|
},
|
|
{
|
|
id: 3,
|
|
orderNo: 'ORDER202512280001',
|
|
tenantId: 1001,
|
|
customerId: 10001,
|
|
customerName: '游戏玩家001',
|
|
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
serviceId: 3,
|
|
serviceName: 'LOL段位提升 - 黄金到铂金',
|
|
serviceCover: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
|
|
price: 299,
|
|
actualPrice: 299,
|
|
status: 6, // 已完成
|
|
playerId: 3,
|
|
playerName: '代练小张',
|
|
playerAvatar: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
dispatchTime: '2025-12-25 10:00:00',
|
|
payType: 'wechat',
|
|
payTime: '2025-12-25 09:50:00',
|
|
acceptTime: '2025-12-25 10:10:00',
|
|
startTime: '2025-12-25 10:30:00',
|
|
finishTime: '2025-12-28 18:00:00',
|
|
confirmTime: '2025-12-28 19:00:00',
|
|
createTime: '2025-12-25 09:45:00',
|
|
updateTime: '2025-12-28 19:00:00'
|
|
},
|
|
{
|
|
id: 4,
|
|
orderNo: 'ORDER202512290001',
|
|
tenantId: 1001,
|
|
customerId: 10001,
|
|
customerName: '游戏玩家001',
|
|
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
serviceId: 4,
|
|
serviceName: '和平精英段位提升',
|
|
serviceCover: 'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
|
|
price: 188,
|
|
actualPrice: 188,
|
|
status: 2, // 已派单
|
|
playerId: 4,
|
|
playerName: '代练小刘',
|
|
playerAvatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
dispatchTime: '2025-12-29 20:00:00',
|
|
payType: 'wechat',
|
|
payTime: '2025-12-29 19:50:00',
|
|
createTime: '2025-12-29 19:45:00',
|
|
updateTime: '2025-12-29 20:00:00'
|
|
},
|
|
{
|
|
id: 5,
|
|
orderNo: 'ORDER202512270001',
|
|
tenantId: 1001,
|
|
customerId: 10001,
|
|
customerName: '游戏玩家001',
|
|
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
serviceId: 5,
|
|
serviceName: '原神深渊满星代打',
|
|
serviceCover: 'https://img2.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=600',
|
|
price: 99,
|
|
actualPrice: 99,
|
|
status: 7, // 已评价
|
|
playerId: 2,
|
|
playerName: '代练小李',
|
|
playerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
|
dispatchTime: '2025-12-26 14:00:00',
|
|
payType: 'wechat',
|
|
payTime: '2025-12-26 13:50:00',
|
|
acceptTime: '2025-12-26 14:10:00',
|
|
startTime: '2025-12-26 14:30:00',
|
|
finishTime: '2025-12-27 15:30:00',
|
|
confirmTime: '2025-12-27 16:00:00',
|
|
createTime: '2025-12-26 13:45:00',
|
|
updateTime: '2025-12-27 17:00:00'
|
|
}
|
|
]
|
|
|
|
// 模拟订单流转记录
|
|
export const mockOrderFlows: OrderFlow[] = [
|
|
{
|
|
id: 1,
|
|
orderId: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
toStatus: 0,
|
|
operatorType: 'customer',
|
|
remark: '创建订单',
|
|
createTime: '2025-12-29 14:50:00'
|
|
},
|
|
{
|
|
id: 2,
|
|
orderId: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
fromStatus: 0,
|
|
toStatus: 1,
|
|
operatorType: 'customer',
|
|
remark: '支付成功',
|
|
createTime: '2025-12-29 15:00:00'
|
|
},
|
|
{
|
|
id: 3,
|
|
orderId: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
fromStatus: 1,
|
|
toStatus: 2,
|
|
operatorType: 'merchant',
|
|
operatorName: '星辰工作室',
|
|
remark: '商家派单给代练:代练小王',
|
|
createTime: '2025-12-29 15:30:00'
|
|
},
|
|
{
|
|
id: 4,
|
|
orderId: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
fromStatus: 2,
|
|
toStatus: 3,
|
|
operatorType: 'player',
|
|
operatorName: '代练小王',
|
|
remark: '代练已接单',
|
|
createTime: '2025-12-29 15:35:00'
|
|
},
|
|
{
|
|
id: 5,
|
|
orderId: 1,
|
|
orderNo: 'ORDER202512300001',
|
|
fromStatus: 3,
|
|
toStatus: 4,
|
|
operatorType: 'player',
|
|
operatorName: '代练小王',
|
|
remark: '开始提供服务',
|
|
createTime: '2025-12-29 16:00:00'
|
|
}
|
|
]
|
|
|
|
// 获取订单列表
|
|
export function getOrderList(params?: {
|
|
status?: OrderStatus
|
|
customerId?: number
|
|
playerId?: number
|
|
tenantId?: number
|
|
}): Order[] {
|
|
let list = [...mockOrders]
|
|
|
|
if (params?.status !== undefined) {
|
|
list = list.filter(o => o.status === params.status)
|
|
}
|
|
|
|
if (params?.customerId) {
|
|
list = list.filter(o => o.customerId === params.customerId)
|
|
}
|
|
|
|
if (params?.playerId) {
|
|
list = list.filter(o => o.playerId === params.playerId)
|
|
}
|
|
|
|
if (params?.tenantId) {
|
|
list = list.filter(o => o.tenantId === params.tenantId)
|
|
}
|
|
|
|
// 按创建时间倒序
|
|
list.sort((a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime())
|
|
|
|
return list
|
|
}
|
|
|
|
// 获取订单详情
|
|
export function getOrderDetail(id: number): Order | undefined {
|
|
return mockOrders.find(o => o.id === id)
|
|
}
|
|
|
|
// 获取订单流转记录
|
|
export function getOrderFlows(orderId: number): OrderFlow[] {
|
|
return mockOrderFlows.filter(f => f.orderId === orderId)
|
|
}
|
|
|
|
// 更新订单状态
|
|
export function updateOrderStatus(orderId: number, status: OrderStatus): boolean {
|
|
const order = mockOrders.find(o => o.id === orderId)
|
|
if (order) {
|
|
order.status = status
|
|
order.updateTime = new Date().toISOString().replace('T', ' ').substring(0, 19)
|
|
return true
|
|
}
|
|
return false
|
|
}
|