/**
 * 订单相关 Mock 数据
 */

// 订单状态配置
export const orderStatusConfig = [
  { type: 'all', name: '全部', num: 0 },
  { type: 'unpaid', name: '待付款', num: 0 },
  { type: 'paid', name: '已付款', num: 0 },
  { type: 'nosend', name: '待发货', num: 0 },
  { type: 'noget', name: '待收货', num: 0 },
  { type: 'completed', name: '已完成', num: 0 },
  { type: 'closed', name: '已关闭', num: 0 },
  { type: 'refunded', name: '已退款', num: 0 },
  { type: 'cancelled', name: '已取消', num: 0 },
];

// 订单类型配置
export const orderTypeConfig = [
  { type: 'normal', name: '普通订单' },
  { type: 'groupon', name: '拼团订单' },
  { type: 'seckill', name: '秒杀订单' },
];

// 订单来源配置
export const orderPlatformConfig = [
  { type: 'wechat', name: '微信小程序' },
  { type: 'h5', name: 'H5商城' },
  { type: 'app', name: 'APP' },
];

// 支付方式配置
export const payTypeConfig = [
  { type: 'wechat', name: '微信支付' },
  { type: 'alipay', name: '支付宝' },
  { type: 'balance', name: '余额支付' },
];

// 活动类型配置
export const activityTypeConfig = [
  { type: 'normal', name: '普通商品' },
  { type: 'groupon', name: '拼团活动' },
  { type: 'seckill', name: '秒杀活动' },
];

// 促销类型配置
export const promoTypesConfig = [
  { type: 'full_reduce', name: '满减' },
  { type: 'full_discount', name: '满折' },
  { type: 'coupon', name: '优惠券' },
];

// 生成订单列表数据
export const generateOrderList = (page = 1, pageSize = 10) => {
  const orders = [];
  const startIndex = (page - 1) * pageSize;

  for (let i = 0; i < pageSize; i++) {
    const index = startIndex + i + 1;
    const orderId = `202505051230${index.toString().padStart(2, '0')}`;

    orders.push({
      id: index,
      order_sn: orderId,
      status: ['unpaid', 'nosend', 'noget', 'completed'][Math.floor(Math.random() * 4)],
      status_text: ['待付款', '待发货', '待收货', '已完成'][Math.floor(Math.random() * 4)],
      user_id: 1000 + index,
      user: {
        id: 1000 + index,
        nickname: `Aamer Khan`,
        avatar:
          'https://mall-oss.trust-will.com/storage/default/20250701/7bf12c56300454532244dec2aff808eb.jpg?x-oss-process=image/resize,w_200,h_200',
        mobile: '138****5678',
      },
      goods_amount: '1,000',
      dispatch_amount: '0',
      pay_fee: '1,000',
      original_pay_fee: '1,000',
      discount_fee: '0',
      coupon_discount_fee: '0',
      create_time: '2025/06/06 12:30:30',
      pay_time: '2025/06/06 12:31:30',
      dispatch_time: null,
      address: {
        id: index,
        consignee: 'Aamer Khan',
        mobile: '138****5678',
        province_name: 'Dhaka',
        city_name: 'Dhaka',
        district_name: 'Dhanmondi',
        address: 'House 123, Road 456, Block A',
      },
      dispatch_type_text: '快递配送',
      pay_types_text: ['微信支付'],
      activity_type: null,
      activity_type_text: '',
      promo_types_text: [],
      btns: ['send', 'detail', 'action'],
      items: [
        {
          id: index,
          goods_id: 100 + index,
          goods_title: 'HOLUN Classic Aviator Polarized Sunglasses, Exclusive Eyewear Brand...',
          goods_image:
            'https://mall-oss.trust-will.com/storage/default/20250701/7bf12c56300454532244dec2aff808eb.jpg?x-oss-process=image/resize,w_200,h_200',
          goods_sku_text: 'Black Grey',
          goods_price: '1,000',
          goods_num: 1,
          pay_fee: '1,000',
          dispatch_status: 0,
          dispatch_status_text: '未发货',
          refund_status: 0,
          refund_status_text: '无退款',
        },
      ],
      ext: {
        promo_infos: [],
        promo_discounts: {
          full_reduce: '0',
          full_discount: '0',
          full_gift: '0',
          free_shipping: '0',
        },
      },
    });
  }

  return orders;
};

// 订单统计数据
export const orderStats = {
  all: 100,
  unpaid: 25,
  nosend: 30,
  noget: 20,
  completed: 20,
  closed: 5,
};

// 订单类型数据
export const orderTypeData = {
  status: orderStatusConfig,
  type: orderTypeConfig,
  platform: orderPlatformConfig,
  pay_type: payTypeConfig,
  activity_type: activityTypeConfig,
  promo_types: promoTypesConfig,
};
