/**
 * Mock数据 - 订单管理
 */

// 订单状态枚举
export enum OrderStatus {
  PENDING = 0,      // 待支付
  PAID = 1,         // 已支付
  COMPLETED = 2,    // 已完成
  CANCELLED = 3,    // 已取消
  REFUNDING = 4,    // 退款中
  REFUNDED = 5      // 已退款
}

// 订单状态文字映射
export const OrderStatusText: Record<number, string> = {
  [OrderStatus.PENDING]: '待支付',
  [OrderStatus.PAID]: '已支付',
  [OrderStatus.COMPLETED]: '已完成',
  [OrderStatus.CANCELLED]: '已取消',
  [OrderStatus.REFUNDING]: '退款中',
  [OrderStatus.REFUNDED]: '已退款'
};

// 订单状态颜色映射
export const OrderStatusColor: Record<number, string> = {
  [OrderStatus.PENDING]: '#faad14',
  [OrderStatus.PAID]: '#1890ff',
  [OrderStatus.COMPLETED]: '#52c41a',
  [OrderStatus.CANCELLED]: '#999999',
  [OrderStatus.REFUNDING]: '#ff4d4f',
  [OrderStatus.REFUNDED]: '#999999'
};

// 订单列表Mock数据
export const mockOrderList = [
  {
    id: 1,
    orderNo: 'ORD202602150001',
    shopName: '万达广场店',
    deviceId: 'DEV001',
    deviceName: '1号柜机',
    userId: 1001,
    userName: '张三',
    userPhone: '13800138001',
    totalAmount: 2560,
    payAmount: 2560,
    status: OrderStatus.COMPLETED,
    items: [
      { productName: '可口可乐', quantity: 2, price: 350 },
      { productName: '薯片', quantity: 1, price: 680 },
      { productName: '矿泉水', quantity: 3, price: 200 }
    ],
    createdAt: '2026-02-15 14:30:25',
    paidAt: '2026-02-15 14:30:45'
  },
  {
    id: 2,
    orderNo: 'ORD202602150002',
    shopName: '人民广场店',
    deviceId: 'DEV002',
    deviceName: '2号柜机',
    userId: 1002,
    userName: '李四',
    userPhone: '13800138002',
    totalAmount: 1880,
    payAmount: 1880,
    status: OrderStatus.REFUNDING,
    items: [
      { productName: '巧克力', quantity: 1, price: 980 },
      { productName: '饼干', quantity: 2, price: 450 }
    ],
    createdAt: '2026-02-15 13:20:15',
    paidAt: '2026-02-15 13:20:35'
  },
  {
    id: 3,
    orderNo: 'ORD202602150003',
    shopName: '火车站店',
    deviceId: 'DEV003',
    deviceName: '3号柜机',
    userId: 1003,
    userName: '王五',
    userPhone: '13800138003',
    totalAmount: 3200,
    payAmount: 3200,
    status: OrderStatus.COMPLETED,
    items: [
      { productName: '方便面', quantity: 2, price: 580 },
      { productName: '火腿肠', quantity: 3, price: 350 },
      { productName: '饮料', quantity: 2, price: 300 }
    ],
    createdAt: '2026-02-15 12:15:30',
    paidAt: '2026-02-15 12:15:50'
  },
  {
    id: 4,
    orderNo: 'ORD202602150004',
    shopName: '万达广场店',
    deviceId: 'DEV001',
    deviceName: '1号柜机',
    userId: 1004,
    userName: '赵六',
    userPhone: '13800138004',
    totalAmount: 1560,
    payAmount: 0,
    status: OrderStatus.PENDING,
    items: [
      { productName: '矿泉水', quantity: 2, price: 200 },
      { productName: '面包', quantity: 1, price: 580 },
      { productName: '牛奶', quantity: 2, price: 390 }
    ],
    createdAt: '2026-02-15 11:45:00',
    paidAt: null
  },
  {
    id: 5,
    orderNo: 'ORD202602150005',
    shopName: '人民广场店',
    deviceId: 'DEV002',
    deviceName: '2号柜机',
    userId: 1005,
    userName: '钱七',
    userPhone: '13800138005',
    totalAmount: 980,
    payAmount: 980,
    status: OrderStatus.REFUNDED,
    items: [
      { productName: '口香糖', quantity: 2, price: 150 },
      { productName: '瓜子', quantity: 1, price: 680 }
    ],
    createdAt: '2026-02-15 10:30:20',
    paidAt: '2026-02-15 10:30:40'
  }
];

// 订单详情Mock数据
export const mockOrderDetail = {
  id: 1,
  orderNo: 'ORD202602150001',
  shopId: 1,
  shopName: '万达广场店',
  shopAddress: '北京市朝阳区建国路93号万达广场B1层',
  deviceId: 'DEV001',
  deviceName: '1号柜机',
  userId: 1001,
  userName: '张三',
  userPhone: '13800138001',
  totalAmount: 2560,
  payAmount: 2560,
  discountAmount: 0,
  status: OrderStatus.COMPLETED,
  items: [
    { 
      productId: 101,
      productName: '可口可乐', 
      productImage: '',
      quantity: 2, 
      price: 350,
      amount: 700
    },
    { 
      productId: 102,
      productName: '薯片', 
      productImage: '',
      quantity: 1, 
      price: 680,
      amount: 680
    },
    { 
      productId: 103,
      productName: '矿泉水', 
      productImage: '',
      quantity: 3, 
      price: 200,
      amount: 600
    }
  ],
  paymentMethod: '微信支付',
  paymentNo: 'WX20260215143045123456',
  createdAt: '2026-02-15 14:30:25',
  paidAt: '2026-02-15 14:30:45',
  completedAt: '2026-02-15 14:31:00'
};
