import Content from '@/sheep/layouts/content.vue';
import { SELECT, CRUD } from '@/sheep/request/crud';

const route = {
  path: 'finance',
  name: 'shop.admin.finance',
  component: Content,
  meta: {
    title: '财务',
  },
  children: [
    {
      path: 'commission',
      name: 'shop.admin.finance.commission',
      component: () => import('@/app/shop/admin/finance/commission/index.vue'),
      meta: {
        title: '佣金管理',
      },
    },
    {
      path: 'recharge',
      name: 'shop.admin.finance.recharge',
      component: () => import('@/app/shop/admin/finance/recharge/index.vue'),
      meta: {
        title: '充值管理',
      },
    },
    {
      path: 'withdraw',
      name: 'shop.admin.finance.withdraw',
      component: () => import('@/app/shop/admin/finance/withdraw/index.vue'),
      meta: {
        title: '提现管理',
      },
    },
  ],
};

const api = {
  // 佣金相关 API
  commission: {
    ...CRUD('shop/admin/finance/commission'),
    select: (params) => SELECT('shop/admin/finance/commission', params),
    settle: (id) => ({
      error: 0,
      msg: '结算成功',
      data: null,
    }),
    batchSettle: (ids) => ({
      error: 0,
      msg: '批量结算成功',
      data: null,
    }),
  },
  
  // 充值相关 API
  recharge: {
    ...CRUD('shop/admin/finance/recharge'),
    select: (params) => SELECT('shop/admin/finance/recharge', params),
    confirm: (id) => ({
      error: 0,
      msg: '确认成功',
      data: null,
    }),
    batchConfirm: (ids) => ({
      error: 0,
      msg: '批量确认成功',
      data: null,
    }),
  },
  
  // 提现相关 API
  withdraw: {
    ...CRUD('shop/admin/finance/withdraw'),
    select: (params) => SELECT('shop/admin/finance/withdraw', params),
    approve: (id) => ({
      error: 0,
      msg: '通过成功',
      data: null,
    }),
    reject: (id, data) => ({
      error: 0,
      msg: '拒绝成功',
      data: null,
    }),
    batchApprove: (ids) => ({
      error: 0,
      msg: '批量通过成功',
      data: null,
    }),
    batchReject: (ids, data) => ({
      error: 0,
      msg: '批量拒绝成功',
      data: null,
    }),
  },
};

export { route, api };
