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

const route = {
  path: 'marketing',
  name: 'shop.admin.marketing',
  component: Content,
  meta: {
    title: '营销',
  },
  children: [
    {
      path: 'group',
      name: 'shop.admin.marketing.group',
      component: () => import('./group/index.vue'),
      meta: {
        title: '拼团',
      },
    },
  ],
};

const api = {
  // 拼团相关 API
  group: {
    ...CRUD('mall/flash/activity'),
    getActivityProductIds: (activityId) =>
      request({
        url: `mall/combination/getActivityProductIds`,
        method: 'GET',
        params: { activityId },
      }),
    addActivityProduct: (activityId, data) =>
      request({
        url: `mall/combination/addActivityProduct`,
        method: 'POST',
        data: { ...data, activityId },
      }),
    select: (params) => SELECT('shop/admin/group_buy', params),
  },
};

export { route, api };
