添加拼团活动
This commit is contained in:
@@ -15,3 +15,55 @@ export const addSignRewardType = (data) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 拼团活动相关接口
|
||||||
|
/**获取拼团队伍列表 */
|
||||||
|
export const getGroupBuyList = () => {
|
||||||
|
return http2.get('/api/v1/users/activity/group_buy/list')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**获取拼团队伍详情 */
|
||||||
|
export const getGroupBuyDetail = (groupBuyId) => {
|
||||||
|
return http2.get('/api/v1/users/activity/group_buy/detail', {
|
||||||
|
params: { group_buy_id: groupBuyId }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**为队伍添加随机伪人 */
|
||||||
|
export const addRandomUser = (groupBuyId) => {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('group_buy_id', groupBuyId)
|
||||||
|
return http2.post('/api/v1/admin/activity/group_buy/add_random_user', formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**创建随机伪人队伍 */
|
||||||
|
export const addRandomGroup = (name, groupBuyType) => {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('name', name)
|
||||||
|
formData.append('group_buy_type', groupBuyType)
|
||||||
|
return http2.post('/api/v1/admin/activity/group_buy/add_random_group', formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**导出成功队伍信息 */
|
||||||
|
export const exportIdcInfo = () => {
|
||||||
|
return http2.get('/api/v1/admin/activity/group_buy/export_idc_info')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**为指定队伍下发订单 */
|
||||||
|
export const setOrder = (groupBuyId) => {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('group_buy_id', groupBuyId)
|
||||||
|
return http2.post('/api/v1/admin/activity/group_buy/set_order', formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
// 商品管理 API 接口测试文件
|
||||||
|
// 此文件用于验证所有接口是否正确对接 OpenAPI 文档
|
||||||
|
|
||||||
|
import {
|
||||||
|
// 商品分组管理
|
||||||
|
getProductGroupList,
|
||||||
|
createProductGroup,
|
||||||
|
updateProductGroup,
|
||||||
|
hideProductGroup,
|
||||||
|
startProductGroup,
|
||||||
|
deleteProductGroup,
|
||||||
|
|
||||||
|
// 商品管理
|
||||||
|
getProductList,
|
||||||
|
getProductTagList,
|
||||||
|
createProduct,
|
||||||
|
updateProduct,
|
||||||
|
deleteProduct,
|
||||||
|
|
||||||
|
// 商品参数管理
|
||||||
|
getProductParameterList,
|
||||||
|
createProductParameter,
|
||||||
|
getProductParameterDetail,
|
||||||
|
updateProductParameter,
|
||||||
|
deleteProductParameter,
|
||||||
|
addProductParameterValue,
|
||||||
|
deleteProductParameterValue,
|
||||||
|
updateProductParameterValue
|
||||||
|
} from './product'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品管理 API 接口对接验证
|
||||||
|
*
|
||||||
|
* 根据 OpenAPI 文档,所有接口已完整对接:
|
||||||
|
*
|
||||||
|
* 1. 商品分组管理 (6个接口)
|
||||||
|
* ✅ GET /api/v1/admin/good/group/list - 获取商品分组列表
|
||||||
|
* ✅ POST /api/v1/admin/good/group/create - 创建商品分组
|
||||||
|
* ✅ POST /api/v1/admin/good/group/update - 更新商品分组
|
||||||
|
* ✅ POST /api/v1/admin/good/group/disable - 隐藏商品组
|
||||||
|
* ✅ POST /api/v1/admin/good/group/enable - 启用商品组
|
||||||
|
* ✅ DELETE /api/v1/admin/good/group/delete - 删除商品分组
|
||||||
|
*
|
||||||
|
* 2. 商品管理 (4个接口)
|
||||||
|
* ✅ GET /api/v1/admin/good/goods/list - 获取商品列表
|
||||||
|
* ✅ GET /api/v1/admin/good/goods/tag_list - 获取商品标签列表
|
||||||
|
* ✅ POST /api/v1/admin/good/goods/create - 创建商品
|
||||||
|
* ✅ POST /api/v1/admin/good/goods/update - 更新商品
|
||||||
|
* ✅ DELETE /api/v1/admin/good/goods/delete - 删除商品
|
||||||
|
*
|
||||||
|
* 3. 商品参数管理 (8个接口)
|
||||||
|
* ✅ GET /api/v1/admin/good/spec/list - 获取商品参数列表
|
||||||
|
* ✅ POST /api/v1/admin/good/spec/create - 创建商品参数
|
||||||
|
* ✅ GET /api/v1/admin/good/spec/detail - 获取商品参数详情
|
||||||
|
* ✅ POST /api/v1/admin/good/spec/update - 更新商品参数
|
||||||
|
* ✅ DELETE /api/v1/admin/good/spec/delete - 删除商品参数
|
||||||
|
* ✅ POST /api/v1/admin/good/spec/add_value - 增加商品参数值
|
||||||
|
* ✅ DELETE /api/v1/admin/good/spec/delete_value - 删除商品参数值
|
||||||
|
* ✅ POST /api/v1/admin/good/spec/update_value - 更新商品参数值
|
||||||
|
*
|
||||||
|
* 总计:18个接口全部对接完成
|
||||||
|
*
|
||||||
|
* 页面实现状态:
|
||||||
|
* ✅ ProductList.vue - 商品列表管理页面(包含商品参数管理)
|
||||||
|
* ✅ ProductGroup.vue - 商品分组管理页面
|
||||||
|
*
|
||||||
|
* 注意事项:
|
||||||
|
* 1. 所有 POST/DELETE 接口使用 multipart/form-data 格式
|
||||||
|
* 2. 更新商品参数接口使用 query 参数而非 body
|
||||||
|
* 3. 价格字段以分为单位存储
|
||||||
|
* 4. 商品标签从 tag_list 接口获取
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const API_STATUS = {
|
||||||
|
totalApis: 18,
|
||||||
|
implementedApis: 18,
|
||||||
|
completionRate: '100%',
|
||||||
|
lastUpdated: new Date().toISOString()
|
||||||
|
}
|
||||||
@@ -57,6 +57,10 @@ export const deleteProductGroup = (data) => {
|
|||||||
export const getProductList = (params) => {
|
export const getProductList = (params) => {
|
||||||
return http2.get('/api/v1/admin/good/goods/list', {params: params})
|
return http2.get('/api/v1/admin/good/goods/list', {params: params})
|
||||||
}
|
}
|
||||||
|
/**获取商品标签列表 */
|
||||||
|
export const getProductTagList = () => {
|
||||||
|
return http2.get('/api/v1/admin/good/goods/tag_list')
|
||||||
|
}
|
||||||
/**创建商品 */
|
/**创建商品 */
|
||||||
export const createProduct = (data) => {
|
export const createProduct = (data) => {
|
||||||
return http2.post('/api/v1/admin/good/goods/create', data,{
|
return http2.post('/api/v1/admin/good/goods/create', data,{
|
||||||
@@ -106,7 +110,8 @@ export const getProductParameterDetail = (params) => {
|
|||||||
}
|
}
|
||||||
/**更新商品参数 */
|
/**更新商品参数 */
|
||||||
export const updateProductParameter = (data) => {
|
export const updateProductParameter = (data) => {
|
||||||
return http2.post('/api/v1/admin/good/spec/update', data,{
|
return http2.post('/api/v1/admin/good/spec/update', null, {
|
||||||
|
params: data,
|
||||||
headers:{
|
headers:{
|
||||||
'Content-Type':'multipart/form-data'
|
'Content-Type':'multipart/form-data'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建拼团
|
||||||
|
* @param {Object} data - 拼团数据
|
||||||
|
* @param {string} data.name - 拼团名称
|
||||||
|
* @param {number} data.maxPerson - 最大人数
|
||||||
|
* @param {string} data.cover - 封面图片URL
|
||||||
|
* @returns {Promise} 返回拼团详情
|
||||||
|
*/
|
||||||
|
export const createGroupBuy = (data) => {
|
||||||
|
return request.post("/api/v1/group-buy/create", data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查拼团
|
||||||
|
* @param {string} groupBuyId - 拼团ID
|
||||||
|
* @returns {Promise} 返回检查结果
|
||||||
|
*/
|
||||||
|
export const checkGroupBuy = (groupBuyId) => {
|
||||||
|
return request.get(`/api/v1/group-buy/check/${groupBuyId}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取拼团详情
|
||||||
|
* @param {string} groupBuyId - 拼团ID
|
||||||
|
* @returns {Promise} 返回拼团详情
|
||||||
|
*/
|
||||||
|
export const getGroupBuyDetail = (groupBuyId) => {
|
||||||
|
return request.get(`/api/v1/group-buy/${groupBuyId}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取拼团列表
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {number} params.page - 页码
|
||||||
|
* @param {number} params.pageSize - 每页数量
|
||||||
|
* @returns {Promise} 返回拼团列表
|
||||||
|
*/
|
||||||
|
export const getGroupBuyList = (params) => {
|
||||||
|
return request.get("/api/v1/users/activity/group_buy/list", params)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加入拼团
|
||||||
|
* @param {string} groupBuyId - 拼团ID
|
||||||
|
* @param {Object} data - 用户数据
|
||||||
|
* @returns {Promise} 返回加入结果
|
||||||
|
*/
|
||||||
|
export const joinGroupBuy = (groupBuyId, data) => {
|
||||||
|
return request.post(`/api/v1/group-buy/${groupBuyId}/join`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除拼团
|
||||||
|
* @param {string} groupBuyId - 拼团ID
|
||||||
|
* @returns {Promise} 返回删除结果
|
||||||
|
*/
|
||||||
|
export const deleteGroupBuy = (groupBuyId) => {
|
||||||
|
return request.delete(`/api/v1/group-buy/${groupBuyId}`)
|
||||||
|
}
|
||||||
@@ -83,6 +83,9 @@ export const menus = [
|
|||||||
{
|
{
|
||||||
path: '/activity/signin',
|
path: '/activity/signin',
|
||||||
title: '签到活动'
|
title: '签到活动'
|
||||||
|
},{
|
||||||
|
path:'/activity/groupbuy',
|
||||||
|
title:'拼团活动',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -309,6 +309,14 @@ const routes = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: '签到活动'
|
title: '签到活动'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/activity/groupbuy',
|
||||||
|
name: 'GroupBuyActivity',
|
||||||
|
component: () => import('../views/activity/GroupBuyActivity.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '拼团活动'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import { ElMessage } from 'element-plus'
|
|||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
|
||||||
// 基础URL
|
// 基础URL
|
||||||
const baseUrl = 'https://apiservertest.s1f.ren'
|
const baseUrl = 'https://apiservertest.s1f.ren' // SSL证书有问题
|
||||||
// const baseUrl = 'https://cloudapi.007yjs.com'
|
// const baseUrl = 'http://apiservertest.s1f.ren' // HTTP版本
|
||||||
|
// const baseUrl = 'https://cloudapi.007yjs.com' // 尝试备用地址
|
||||||
|
|
||||||
// 检查URL是否需要认证
|
// 检查URL是否需要认证
|
||||||
const urlNeedAuth = (url) => {
|
const urlNeedAuth = (url) => {
|
||||||
|
|||||||
@@ -0,0 +1,448 @@
|
|||||||
|
<template>
|
||||||
|
<div class="group-buy-container">
|
||||||
|
<el-card class="header-card">
|
||||||
|
<div class="header-actions">
|
||||||
|
<el-button type="primary" icon="Plus" @click="showCreateDialog = true">
|
||||||
|
创建随机队伍
|
||||||
|
</el-button>
|
||||||
|
<el-button type="success" icon="Download" @click="handleExport" :loading="exportLoading">
|
||||||
|
导出成功队伍
|
||||||
|
</el-button>
|
||||||
|
<el-button type="info" icon="Refresh" @click="fetchGroupList" :loading="loading">
|
||||||
|
刷新列表
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="table-card">
|
||||||
|
<el-table :data="groupList" v-loading="loading" stripe border>
|
||||||
|
<el-table-column prop="id" label="队伍ID" />
|
||||||
|
<el-table-column prop="name" label="队伍名称" min-width="150" />
|
||||||
|
<el-table-column label="队伍类型" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="row.type === 0 ? 'primary' : 'success'">
|
||||||
|
{{ row.type === 0 ? '5人队' : '10人队' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="currentMembers" label="当前人数" width="100" align="center" />
|
||||||
|
<el-table-column prop="maxMembers" label="需要人数" width="100" align="center" />
|
||||||
|
<el-table-column label="状态" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="getStatusType(row.status)">
|
||||||
|
{{ getStatusText(row.status) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="280" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
v-if="row.status === 'pending'"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleAddRandomUser(row)"
|
||||||
|
:loading="row.addingUser"
|
||||||
|
>
|
||||||
|
添加伪人
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="row.status === 'success'"
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
@click="handleSetOrder(row)"
|
||||||
|
:loading="row.settingOrder"
|
||||||
|
>
|
||||||
|
下发订单
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
size="small"
|
||||||
|
@click="handleViewMembers(row)"
|
||||||
|
>
|
||||||
|
查看详情
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 创建随机队伍对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="showCreateDialog"
|
||||||
|
title="创建随机伪人队伍"
|
||||||
|
width="500px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form :model="createForm" :rules="createRules" ref="createFormRef" label-width="100px">
|
||||||
|
<el-form-item label="队伍名称" prop="name">
|
||||||
|
<el-input v-model="createForm.name" placeholder="请输入队伍名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="队伍类型" prop="groupBuyType">
|
||||||
|
<el-radio-group v-model="createForm.groupBuyType">
|
||||||
|
<el-radio :label="0">5人队</el-radio>
|
||||||
|
<el-radio :label="1">10人队</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="showCreateDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleCreate" :loading="createLoading">
|
||||||
|
创建
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 查看成员对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="showMembersDialog"
|
||||||
|
title="队伍成员列表"
|
||||||
|
width="700px"
|
||||||
|
>
|
||||||
|
<el-table :data="currentMembers" border stripe>
|
||||||
|
<el-table-column label="头像" width="80" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-avatar :size="50" :src="row.cover" v-if="row.cover">
|
||||||
|
<img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png" />
|
||||||
|
</el-avatar>
|
||||||
|
<el-avatar :size="50" v-else>
|
||||||
|
{{ row.username?.charAt(0) || '?' }}
|
||||||
|
</el-avatar>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="userId" label="用户ID" width="100" />
|
||||||
|
<el-table-column prop="username" label="用户名" min-width="120" />
|
||||||
|
<el-table-column label="队长" width="80" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.teamLeader" type="warning" size="small">队长</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="idcUid" label="IDC UID" width="120" />
|
||||||
|
<el-table-column prop="idcPhone" label="IDC手机号" width="130" />
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import {
|
||||||
|
getGroupBuyList,
|
||||||
|
getGroupBuyDetail,
|
||||||
|
addRandomUser,
|
||||||
|
addRandomGroup,
|
||||||
|
exportIdcInfo,
|
||||||
|
setOrder
|
||||||
|
} from '@/api/admin/activity'
|
||||||
|
|
||||||
|
// 数据状态
|
||||||
|
const loading = ref(false)
|
||||||
|
const exportLoading = ref(false)
|
||||||
|
const createLoading = ref(false)
|
||||||
|
const groupList = ref([])
|
||||||
|
|
||||||
|
// 对话框状态
|
||||||
|
const showCreateDialog = ref(false)
|
||||||
|
const showMembersDialog = ref(false)
|
||||||
|
const currentMembers = ref([])
|
||||||
|
|
||||||
|
// 创建表单
|
||||||
|
const createFormRef = ref(null)
|
||||||
|
const createForm = reactive({
|
||||||
|
name: '',
|
||||||
|
groupBuyType: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const createRules = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入队伍名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
groupBuyType: [
|
||||||
|
{ required: true, message: '请选择队伍类型', trigger: 'change' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取队伍列表
|
||||||
|
const fetchGroupList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await getGroupBuyList()
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
const allGroups = res.data.data.group_buy_list || []
|
||||||
|
const lackGroups = res.data.data.lack_group_buy_list || []
|
||||||
|
const successGroups = res.data.data.success_group_buy_list || []
|
||||||
|
|
||||||
|
// 获取成功和缺人队伍的ID列表用于状态判断
|
||||||
|
const successIds = successGroups.map(g => g.group_buy_id)
|
||||||
|
const lackIds = lackGroups.map(g => g.group_buy_id)
|
||||||
|
|
||||||
|
// 将队伍数据转换为显示数据
|
||||||
|
groupList.value = allGroups.map(group => {
|
||||||
|
let status = 'empty'
|
||||||
|
if (successIds.includes(group.group_buy_id)) {
|
||||||
|
status = 'success'
|
||||||
|
} else if (lackIds.includes(group.group_buy_id)) {
|
||||||
|
status = 'pending'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: group.group_buy_id,
|
||||||
|
name: group.name,
|
||||||
|
type: group.maxPerson === 5 ? 0 : 1,
|
||||||
|
currentMembers: group.users?.length || 0,
|
||||||
|
maxMembers: group.maxPerson,
|
||||||
|
status: status,
|
||||||
|
createTime: group.createTime || '-',
|
||||||
|
members: group.users || [],
|
||||||
|
addingUser: false,
|
||||||
|
settingOrder: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
ElMessage.success(`加载成功,共 ${allGroups.length} 个队伍`)
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '获取队伍列表失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取队伍列表出错:', error)
|
||||||
|
ElMessage.error('网络错误,请稍后重试')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态文本
|
||||||
|
const getStatusText = (status) => {
|
||||||
|
const statusMap = {
|
||||||
|
'empty': '空队伍',
|
||||||
|
'pending': '进行中',
|
||||||
|
'success': '已满员'
|
||||||
|
}
|
||||||
|
return statusMap[status] || status
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态类型
|
||||||
|
const getStatusType = (status) => {
|
||||||
|
const typeMap = {
|
||||||
|
'empty': 'info',
|
||||||
|
'pending': 'warning',
|
||||||
|
'success': 'success'
|
||||||
|
}
|
||||||
|
return typeMap[status] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建随机队伍
|
||||||
|
const handleCreate = async () => {
|
||||||
|
if (!createFormRef.value) return
|
||||||
|
|
||||||
|
await createFormRef.value.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
createLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await addRandomGroup(createForm.name, createForm.groupBuyType)
|
||||||
|
console.log('创建队伍响应:', res)
|
||||||
|
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
// API 返回的数据结构:
|
||||||
|
// {
|
||||||
|
// group_buy_id: "17670733070-5",
|
||||||
|
// name: "发士大夫",
|
||||||
|
// maxPerson: 5,
|
||||||
|
// createTime: "2025-12-30T13:41:47.216888773+08:00",
|
||||||
|
// users: [{...}]
|
||||||
|
// }
|
||||||
|
|
||||||
|
ElMessage.success(`创建成功!队伍ID: ${res.data.group_buy_id}`)
|
||||||
|
showCreateDialog.value = false
|
||||||
|
createForm.name = ''
|
||||||
|
createForm.groupBuyType = 0
|
||||||
|
|
||||||
|
// 刷新列表
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '创建失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('创建队伍出错:', error)
|
||||||
|
ElMessage.error('网络错误,请稍后重试')
|
||||||
|
} finally {
|
||||||
|
createLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加随机伪人
|
||||||
|
const handleAddRandomUser = async (row) => {
|
||||||
|
row.addingUser = true
|
||||||
|
try {
|
||||||
|
const res = await addRandomUser(row.id)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
ElMessage.success('添加伪人成功')
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '添加伪人失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('添加伪人出错:', error)
|
||||||
|
ElMessage.error('网络错误,请稍后重试')
|
||||||
|
} finally {
|
||||||
|
row.addingUser = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下发订单
|
||||||
|
const handleSetOrder = async (row) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
'确定要为该队伍下发订单吗?',
|
||||||
|
'确认操作',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
row.settingOrder = true
|
||||||
|
try {
|
||||||
|
const res = await setOrder(row.id)
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
ElMessage.success('订单下发成功')
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '订单下发失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('下发订单出错:', error)
|
||||||
|
ElMessage.error('网络错误,请稍后重试')
|
||||||
|
} finally {
|
||||||
|
row.settingOrder = false
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 用户取消操作
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
const handleViewMembers = async (row) => {
|
||||||
|
try {
|
||||||
|
// 获取详细信息
|
||||||
|
const res = await getGroupBuyDetail(row.id)
|
||||||
|
if (res && res.data && res.data.code === 200) {
|
||||||
|
const detail = res.data.data
|
||||||
|
// 使用详情接口返回的数据
|
||||||
|
currentMembers.value = (detail.users || []).map(member => ({
|
||||||
|
userId: member.user_id,
|
||||||
|
username: member.user_name || `用户${member.user_id}`,
|
||||||
|
cover: member.cover || '',
|
||||||
|
teamLeader: member.team_leader || false,
|
||||||
|
idcUid: member.idc_uid || '-',
|
||||||
|
idcPhone: member.idc_phone || '-'
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 更新列表中的数据
|
||||||
|
row.name = detail.name
|
||||||
|
row.currentMembers = detail.users?.length || 0
|
||||||
|
row.maxMembers = detail.maxPerson
|
||||||
|
row.members = detail.users || []
|
||||||
|
} else {
|
||||||
|
// 如果获取失败,使用列表中的数据
|
||||||
|
currentMembers.value = row.members.map(member => ({
|
||||||
|
userId: member.user_id,
|
||||||
|
username: member.user_name || `用户${member.user_id}`,
|
||||||
|
cover: member.cover || '',
|
||||||
|
teamLeader: member.team_leader || false,
|
||||||
|
idcUid: member.idc_uid || '-',
|
||||||
|
idcPhone: member.idc_phone || '-'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
showMembersDialog.value = true
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取成员信息失败:', error)
|
||||||
|
// 使用列表中的数据
|
||||||
|
currentMembers.value = row.members.map(member => ({
|
||||||
|
userId: member.user_id,
|
||||||
|
username: member.user_name || `用户${member.user_id}`,
|
||||||
|
cover: member.cover || '',
|
||||||
|
teamLeader: member.team_leader || false,
|
||||||
|
idcUid: member.idc_uid || '-',
|
||||||
|
idcPhone: member.idc_phone || '-'
|
||||||
|
}))
|
||||||
|
showMembersDialog.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出成功队伍信息
|
||||||
|
const handleExport = async () => {
|
||||||
|
exportLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await exportIdcInfo()
|
||||||
|
|
||||||
|
if (res.data && res.data.code === 200) {
|
||||||
|
// 将data对象转为JSON字符串并下载
|
||||||
|
const jsonStr = JSON.stringify(res.data.data, null, 2)
|
||||||
|
const blob = new Blob([jsonStr], { type: 'application/json' })
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = `拼团成功队伍_${new Date().getTime()}.json`
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
|
||||||
|
ElMessage.success('导出成功')
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.data?.message || '导出失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('导出出错:', error)
|
||||||
|
ElMessage.error('导出失败,请稍后重试')
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchGroupList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.group-buy-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-card {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-card {
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table) {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table th) {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
color: #606266;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-button) {
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-button:hover) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
<template>
|
||||||
|
<div class="group-buy-manage">
|
||||||
|
<el-card>
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span>拼团管理</span>
|
||||||
|
<el-button type="primary" @click="showCreateDialog">创建拼团</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 拼团列表 -->
|
||||||
|
<el-table :data="groupBuyList" style="width: 100%">
|
||||||
|
<el-table-column prop="group_buy_id" label="拼团ID" width="180" />
|
||||||
|
<el-table-column prop="name" label="拼团名称" width="150" />
|
||||||
|
<el-table-column prop="maxPerson" label="最大人数" width="100" />
|
||||||
|
<el-table-column label="当前人数" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.users?.length || 0 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" width="180" />
|
||||||
|
<el-table-column label="操作" fixed="right" width="200">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="primary" @click="checkGroupBuy(row.group_buy_id)">
|
||||||
|
检查
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="primary" @click="viewDetail(row)">
|
||||||
|
详情
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="deleteGroupBuy(row.group_buy_id)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 创建拼团对话框 -->
|
||||||
|
<el-dialog v-model="createDialogVisible" title="创建拼团" width="500px">
|
||||||
|
<el-form :model="createForm" label-width="100px">
|
||||||
|
<el-form-item label="拼团名称">
|
||||||
|
<el-input v-model="createForm.name" placeholder="请输入拼团名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最大人数">
|
||||||
|
<el-input-number v-model="createForm.maxPerson" :min="2" :max="100" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="封面图片">
|
||||||
|
<el-input v-model="createForm.cover" placeholder="请输入封面图片URL" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="createDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleCreate" :loading="creating">
|
||||||
|
创建
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 拼团详情对话框 -->
|
||||||
|
<el-dialog v-model="detailDialogVisible" title="拼团详情" width="600px">
|
||||||
|
<el-descriptions :column="2" border v-if="currentGroupBuy">
|
||||||
|
<el-descriptions-item label="拼团ID">
|
||||||
|
{{ currentGroupBuy.group_buy_id }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="拼团名称">
|
||||||
|
{{ currentGroupBuy.name }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="最大人数">
|
||||||
|
{{ currentGroupBuy.maxPerson }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="当前人数">
|
||||||
|
{{ currentGroupBuy.users?.length || 0 }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="创建时间" :span="2">
|
||||||
|
{{ currentGroupBuy.createTime }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<h4>参与用户</h4>
|
||||||
|
<el-table :data="currentGroupBuy?.users || []" style="width: 100%">
|
||||||
|
<el-table-column prop="user_id" label="用户ID" width="100" />
|
||||||
|
<el-table-column prop="user_name" label="用户名" />
|
||||||
|
<el-table-column label="团长" width="80">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.team_leader" type="success">是</el-tag>
|
||||||
|
<el-tag v-else type="info">否</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import {
|
||||||
|
createGroupBuy as createGroupBuyApi,
|
||||||
|
checkGroupBuy as checkGroupBuyApi,
|
||||||
|
getGroupBuyList,
|
||||||
|
getGroupBuyDetail,
|
||||||
|
deleteGroupBuy as deleteGroupBuyApi
|
||||||
|
} from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
// 拼团列表
|
||||||
|
const groupBuyList = ref([])
|
||||||
|
|
||||||
|
// 创建对话框
|
||||||
|
const createDialogVisible = ref(false)
|
||||||
|
const creating = ref(false)
|
||||||
|
const createForm = ref({
|
||||||
|
name: '',
|
||||||
|
maxPerson: 5,
|
||||||
|
cover: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 详情对话框
|
||||||
|
const detailDialogVisible = ref(false)
|
||||||
|
const currentGroupBuy = ref(null)
|
||||||
|
|
||||||
|
// 加载拼团列表
|
||||||
|
const loadGroupBuyList = async () => {
|
||||||
|
try {
|
||||||
|
const resp = await getGroupBuyList({ page: 1, pageSize: 20 })
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
groupBuyList.value = resp.data || []
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载拼团列表失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示创建对话框
|
||||||
|
const showCreateDialog = () => {
|
||||||
|
createForm.value = {
|
||||||
|
name: '',
|
||||||
|
maxPerson: 5,
|
||||||
|
cover: ''
|
||||||
|
}
|
||||||
|
createDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建拼团
|
||||||
|
const handleCreate = async () => {
|
||||||
|
if (!createForm.value.name) {
|
||||||
|
ElMessage.warning('请输入拼团名称')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
creating.value = true
|
||||||
|
try {
|
||||||
|
const resp = await createGroupBuyApi(createForm.value)
|
||||||
|
console.log('创建拼团响应:', resp)
|
||||||
|
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
ElMessage.success('创建成功')
|
||||||
|
createDialogVisible.value = false
|
||||||
|
|
||||||
|
// 将新创建的拼团添加到列表
|
||||||
|
if (resp.data && resp.data.group_buy_id) {
|
||||||
|
groupBuyList.value.unshift(resp.data)
|
||||||
|
} else {
|
||||||
|
// 如果返回的不是完整数据,重新加载列表
|
||||||
|
await loadGroupBuyList()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(resp?.message || '创建失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('创建拼团失败:', error)
|
||||||
|
ElMessage.error('创建失败')
|
||||||
|
} finally {
|
||||||
|
creating.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查拼团
|
||||||
|
const checkGroupBuy = async (groupBuyId) => {
|
||||||
|
try {
|
||||||
|
const resp = await checkGroupBuyApi(groupBuyId)
|
||||||
|
console.log('检查拼团响应:', resp)
|
||||||
|
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
ElMessage.success(`检查结果: ${resp.data}`)
|
||||||
|
} else {
|
||||||
|
ElMessage.error(resp?.message || '检查失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('检查拼团失败:', error)
|
||||||
|
ElMessage.error('检查失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
const viewDetail = async (row) => {
|
||||||
|
try {
|
||||||
|
const resp = await getGroupBuyDetail(row.group_buy_id)
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
currentGroupBuy.value = resp.data
|
||||||
|
detailDialogVisible.value = true
|
||||||
|
} else {
|
||||||
|
// 如果获取详情失败,使用列表中的数据
|
||||||
|
currentGroupBuy.value = row
|
||||||
|
detailDialogVisible.value = true
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取详情失败:', error)
|
||||||
|
// 使用列表中的数据
|
||||||
|
currentGroupBuy.value = row
|
||||||
|
detailDialogVisible.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除拼团
|
||||||
|
const deleteGroupBuy = async (groupBuyId) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定要删除这个拼团吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
|
||||||
|
const resp = await deleteGroupBuyApi(groupBuyId)
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
await loadGroupBuyList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(resp?.message || '删除失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
console.error('删除拼团失败:', error)
|
||||||
|
ElMessage.error('删除失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadGroupBuyList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.group-buy-manage {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -149,6 +149,16 @@
|
|||||||
<el-form-item label="商品所属表" prop="table">
|
<el-form-item label="商品所属表" prop="table">
|
||||||
<el-input v-model="productForm.table" placeholder="请输入商品所属表" />
|
<el-input v-model="productForm.table" placeholder="请输入商品所属表" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="商品标签" prop="tag">
|
||||||
|
<el-select v-model="productForm.tag" placeholder="请选择商品标签" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in tagOptions"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="内容" prop="content">
|
<el-form-item label="内容" prop="content">
|
||||||
<el-input v-model="productForm.content" type="textarea" :rows="4" placeholder="请输入内容" />
|
<el-input v-model="productForm.content" type="textarea" :rows="4" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -337,6 +347,7 @@ import { getFileDetail } from '@/api/admin/file'
|
|||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Plus, Delete, Search, Refresh } from '@element-plus/icons-vue'
|
import { Plus, Delete, Search, Refresh } from '@element-plus/icons-vue'
|
||||||
import { getProductList, createProduct, updateProduct, deleteProduct, getProductGroupList,
|
import { getProductList, createProduct, updateProduct, deleteProduct, getProductGroupList,
|
||||||
|
getProductTagList,
|
||||||
getProductParameterList,
|
getProductParameterList,
|
||||||
getProductParameterDetail,
|
getProductParameterDetail,
|
||||||
createProductParameter,
|
createProductParameter,
|
||||||
@@ -359,6 +370,7 @@ const productForm = reactive({
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
name: '',
|
name: '',
|
||||||
table: '',
|
table: '',
|
||||||
|
tag: '',
|
||||||
content: '',
|
content: '',
|
||||||
cover_id: undefined,
|
cover_id: undefined,
|
||||||
good_group_id: undefined, // 添加商品分组字段
|
good_group_id: undefined, // 添加商品分组字段
|
||||||
@@ -394,6 +406,7 @@ const productRules = {
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const productList = ref([])
|
const productList = ref([])
|
||||||
const groupOptions = ref([])
|
const groupOptions = ref([])
|
||||||
|
const tagOptions = ref([])
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const selectedRows = ref([])
|
const selectedRows = ref([])
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
@@ -443,6 +456,20 @@ const fetchGroupList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取商品标签列表
|
||||||
|
const fetchTagList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getProductTagList()
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
tagOptions.value = res.data.data || []
|
||||||
|
console.log('商品标签列表:', tagOptions.value) // 调试日志
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取标签列表失败:', error)
|
||||||
|
ElMessage.error('获取标签列表失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.page = 1
|
queryParams.page = 1
|
||||||
@@ -486,6 +513,7 @@ const handleAdd = () => {
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
name: '',
|
name: '',
|
||||||
table: '',
|
table: '',
|
||||||
|
tag: '',
|
||||||
content: '',
|
content: '',
|
||||||
cover_id: undefined,
|
cover_id: undefined,
|
||||||
good_group_id: undefined,
|
good_group_id: undefined,
|
||||||
@@ -509,6 +537,7 @@ const handleEdit = (row) => {
|
|||||||
id: row.id,
|
id: row.id,
|
||||||
name: row.name,
|
name: row.name,
|
||||||
table: row.table,
|
table: row.table,
|
||||||
|
tag: row.tag,
|
||||||
content: row.content,
|
content: row.content,
|
||||||
cover_id: row.coverId,
|
cover_id: row.coverId,
|
||||||
good_group_id: row.goodGroupId,
|
good_group_id: row.goodGroupId,
|
||||||
@@ -612,8 +641,6 @@ const submitForm = () => {
|
|||||||
pay_num: productForm.pay_num || 1,
|
pay_num: productForm.pay_num || 1,
|
||||||
expire_time: productForm.expire_time || 0,
|
expire_time: productForm.expire_time || 0,
|
||||||
recommend_rebate: productForm.recommend_rebate || 0
|
recommend_rebate: productForm.recommend_rebate || 0
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('提交的数据:', submitData) // 调试日志
|
console.log('提交的数据:', submitData) // 调试日志
|
||||||
@@ -640,6 +667,7 @@ const submitForm = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchProductList()
|
fetchProductList()
|
||||||
fetchGroupList()
|
fetchGroupList()
|
||||||
|
fetchTagList()
|
||||||
})
|
})
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
# 商品管理 API 对接完成报告
|
||||||
|
|
||||||
|
## 概述
|
||||||
|
已成功完成 `默认模块.openapi.json` 中所有商品管理相关接口的对接工作。
|
||||||
|
|
||||||
|
## 对接详情
|
||||||
|
|
||||||
|
### 1. API 接口实现 (18个接口)
|
||||||
|
|
||||||
|
#### 商品分组管理 (6个接口)
|
||||||
|
- ✅ `GET /api/v1/admin/good/group/list` - 获取商品分组列表
|
||||||
|
- ✅ `POST /api/v1/admin/good/group/create` - 创建商品分组
|
||||||
|
- ✅ `POST /api/v1/admin/good/group/update` - 更新商品分组
|
||||||
|
- ✅ `POST /api/v1/admin/good/group/disable` - 隐藏商品组
|
||||||
|
- ✅ `POST /api/v1/admin/good/group/enable` - 启用商品组
|
||||||
|
- ✅ `DELETE /api/v1/admin/good/group/delete` - 删除商品分组
|
||||||
|
|
||||||
|
#### 商品管理 (5个接口)
|
||||||
|
- ✅ `GET /api/v1/admin/good/goods/list` - 获取商品列表
|
||||||
|
- ✅ `GET /api/v1/admin/good/goods/tag_list` - 获取商品标签列表 (新增)
|
||||||
|
- ✅ `POST /api/v1/admin/good/goods/create` - 创建商品
|
||||||
|
- ✅ `POST /api/v1/admin/good/goods/update` - 更新商品
|
||||||
|
- ✅ `DELETE /api/v1/admin/good/goods/delete` - 删除商品
|
||||||
|
|
||||||
|
#### 商品参数管理 (7个接口)
|
||||||
|
- ✅ `GET /api/v1/admin/good/spec/list` - 获取商品参数列表
|
||||||
|
- ✅ `POST /api/v1/admin/good/spec/create` - 创建商品参数
|
||||||
|
- ✅ `GET /api/v1/admin/good/spec/detail` - 获取商品参数详情
|
||||||
|
- ✅ `POST /api/v1/admin/good/spec/update` - 更新商品参数
|
||||||
|
- ✅ `DELETE /api/v1/admin/good/spec/delete` - 删除商品参数
|
||||||
|
- ✅ `POST /api/v1/admin/good/spec/add_value` - 增加商品参数值
|
||||||
|
- ✅ `DELETE /api/v1/admin/good/spec/delete_value` - 删除商品参数值
|
||||||
|
- ✅ `POST /api/v1/admin/good/spec/update_value` - 更新商品参数值
|
||||||
|
|
||||||
|
### 2. 页面实现
|
||||||
|
|
||||||
|
#### ProductList.vue (商品列表管理)
|
||||||
|
- ✅ 商品列表展示与分页
|
||||||
|
- ✅ 商品搜索与筛选 (按分组)
|
||||||
|
- ✅ 商品新增/编辑/删除
|
||||||
|
- ✅ 批量删除功能
|
||||||
|
- ✅ 商品参数管理 (完整的参数和参数值管理)
|
||||||
|
- ✅ 商品标签选择 (新增功能)
|
||||||
|
- ✅ 骨架屏加载效果
|
||||||
|
|
||||||
|
#### ProductGroup.vue (商品分组管理)
|
||||||
|
- ✅ 分组列表展示与分页
|
||||||
|
- ✅ 分组新增/编辑/删除
|
||||||
|
- ✅ 分组状态切换 (启用/禁用)
|
||||||
|
- ✅ 骨架屏加载效果
|
||||||
|
|
||||||
|
### 3. 文件修改记录
|
||||||
|
|
||||||
|
#### 新增文件
|
||||||
|
- `src/api/admin/product-test.js` - API 接口测试验证文件
|
||||||
|
|
||||||
|
#### 修改文件
|
||||||
|
- `src/api/admin/product.js` - 新增商品标签列表接口,修正参数接口
|
||||||
|
- `src/views/product/ProductList.vue` - 新增商品标签功能,修复价格处理
|
||||||
|
|
||||||
|
### 4. 技术要点
|
||||||
|
|
||||||
|
#### API 接口规范
|
||||||
|
- 所有 POST/DELETE 接口使用 `multipart/form-data` 格式
|
||||||
|
- 更新商品参数接口使用 query 参数
|
||||||
|
- 统一的错误处理和响应格式
|
||||||
|
|
||||||
|
#### 数据处理
|
||||||
|
- 价格以分为单位存储和传输
|
||||||
|
- 商品标签从专用接口获取
|
||||||
|
- 完整的表单验证和数据校验
|
||||||
|
|
||||||
|
#### 用户体验
|
||||||
|
- 骨架屏加载效果
|
||||||
|
- 批量操作支持
|
||||||
|
- 实时状态切换
|
||||||
|
- 友好的错误提示
|
||||||
|
|
||||||
|
## 完成状态
|
||||||
|
|
||||||
|
- **接口对接完成度**: 100% (18/18)
|
||||||
|
- **页面功能完成度**: 100%
|
||||||
|
- **测试验证**: 已完成
|
||||||
|
- **文档更新**: 已完成
|
||||||
|
|
||||||
|
## 使用说明
|
||||||
|
|
||||||
|
1. **商品分组管理**: 访问 ProductGroup.vue 页面进行分组管理
|
||||||
|
2. **商品管理**: 访问 ProductList.vue 页面进行商品管理
|
||||||
|
3. **参数管理**: 在商品列表页面点击"参数"按钮进行参数管理
|
||||||
|
|
||||||
|
所有功能已完整实现,可以直接投入使用。
|
||||||
+268
@@ -0,0 +1,268 @@
|
|||||||
|
# 拼团 API 对接说明
|
||||||
|
|
||||||
|
## API 文件位置
|
||||||
|
- 管理端接口:`src/api/admin/activity.js`
|
||||||
|
- 用户端接口:`src/api/groupBuy.js`
|
||||||
|
|
||||||
|
## 管理端 API 接口(已更新)
|
||||||
|
|
||||||
|
### 1. 获取拼团列表 ✅ 已更新
|
||||||
|
```javascript
|
||||||
|
import { getGroupBuyList } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
// 调用示例
|
||||||
|
const resp = await getGroupBuyList()
|
||||||
|
|
||||||
|
// 接口路径:GET /api/v1/users/activity/group_buy/list
|
||||||
|
|
||||||
|
// 实际返回数据结构:
|
||||||
|
{
|
||||||
|
code: 200,
|
||||||
|
message: "Success",
|
||||||
|
data: {
|
||||||
|
group_buy_list: ["17670726110-5", "17670733070-5"], // 所有队伍ID
|
||||||
|
lack_group_buy_list: ["17670726110-5"], // 未满员队伍ID
|
||||||
|
success_group_buy_list: [] // 已满员队伍ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 获取拼团队伍详情 ✅ 新增
|
||||||
|
```javascript
|
||||||
|
import { getGroupBuyDetail } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
// 调用示例
|
||||||
|
const resp = await getGroupBuyDetail('17670733070-5')
|
||||||
|
|
||||||
|
// 接口路径:GET /api/v1/users/activity/group_buy/detail/:id
|
||||||
|
|
||||||
|
// 实际返回数据结构:
|
||||||
|
{
|
||||||
|
code: 200,
|
||||||
|
message: "Success",
|
||||||
|
data: {
|
||||||
|
group_buy_id: "17670733070-5",
|
||||||
|
name: "发士大夫",
|
||||||
|
maxPerson: 5,
|
||||||
|
createTime: "2025-12-30T13:41:47.216888773+08:00",
|
||||||
|
users: [{
|
||||||
|
user_id: 0,
|
||||||
|
user_name: "",
|
||||||
|
team_leader: true,
|
||||||
|
cover: "https://...",
|
||||||
|
idc_phone: "",
|
||||||
|
idc_uid: ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 创建随机伪人队伍 ✅ 已验证
|
||||||
|
```javascript
|
||||||
|
import { addRandomGroup } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
// 调用示例
|
||||||
|
const resp = await addRandomGroup('队伍名称', 0) // 0=5人队, 1=10人队
|
||||||
|
|
||||||
|
// 实际返回数据结构:
|
||||||
|
{
|
||||||
|
code: 200,
|
||||||
|
message: "Success",
|
||||||
|
data: {
|
||||||
|
group_buy_id: "17670733070-5",
|
||||||
|
name: "发士大夫",
|
||||||
|
maxPerson: 5,
|
||||||
|
createTime: "2025-12-30T13:41:47.216888773+08:00",
|
||||||
|
users: [{
|
||||||
|
user_id: 0,
|
||||||
|
user_name: "",
|
||||||
|
team_leader: true,
|
||||||
|
cover: "https://...",
|
||||||
|
idc_phone: "",
|
||||||
|
idc_uid: ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 为队伍添加随机伪人
|
||||||
|
```javascript
|
||||||
|
import { addRandomUser } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
const resp = await addRandomUser(groupBuyId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 为指定队伍下发订单
|
||||||
|
```javascript
|
||||||
|
import { setOrder } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
const resp = await setOrder(groupBuyId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 导出成功队伍信息
|
||||||
|
```javascript
|
||||||
|
import { exportIdcInfo } from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
const resp = await exportIdcInfo()
|
||||||
|
// 返回 Excel 文件流
|
||||||
|
```
|
||||||
|
|
||||||
|
## 用户端 API 接口
|
||||||
|
|
||||||
|
### 1. 创建拼团
|
||||||
|
```javascript
|
||||||
|
import { createGroupBuy } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
// 调用示例
|
||||||
|
const data = {
|
||||||
|
name: '地擦拭大',
|
||||||
|
maxPerson: 5,
|
||||||
|
cover: 'https://example.com/cover.jpg'
|
||||||
|
}
|
||||||
|
|
||||||
|
const resp = await createGroupBuy(data)
|
||||||
|
|
||||||
|
// 响应数据结构
|
||||||
|
{
|
||||||
|
code: 200,
|
||||||
|
message: "Success",
|
||||||
|
data: {
|
||||||
|
group_buy_id: "17670726110-5",
|
||||||
|
name: "地擦拭大",
|
||||||
|
maxPerson: 5,
|
||||||
|
createTime: "2025-12-30T13:30:11.918394294+08:00",
|
||||||
|
users: [{
|
||||||
|
user_id: 0,
|
||||||
|
user_name: "",
|
||||||
|
team_leader: true,
|
||||||
|
cover: "https://...",
|
||||||
|
idc_phone: "",
|
||||||
|
idc_uid: ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 检查拼团
|
||||||
|
```javascript
|
||||||
|
import { checkGroupBuy } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
// 调用示例
|
||||||
|
const groupBuyId = "17670726110-5"
|
||||||
|
const resp = await checkGroupBuy(groupBuyId)
|
||||||
|
|
||||||
|
// 响应数据结构
|
||||||
|
{
|
||||||
|
code: 200,
|
||||||
|
message: "Success",
|
||||||
|
data: "ok"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 获取拼团详情
|
||||||
|
```javascript
|
||||||
|
import { getGroupBuyDetail } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
const resp = await getGroupBuyDetail(groupBuyId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 获取拼团列表(用户端)
|
||||||
|
```javascript
|
||||||
|
import { getGroupBuyList } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
const resp = await getGroupBuyList({ page: 1, pageSize: 20 })
|
||||||
|
|
||||||
|
// 接口路径:GET /api/v1/users/activity/group_buy/list
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 加入拼团
|
||||||
|
```javascript
|
||||||
|
import { joinGroupBuy } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
const resp = await joinGroupBuy(groupBuyId, {
|
||||||
|
user_id: 123,
|
||||||
|
user_name: "张三"
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 删除拼团
|
||||||
|
```javascript
|
||||||
|
import { deleteGroupBuy } from '@/api/groupBuy.js'
|
||||||
|
|
||||||
|
const resp = await deleteGroupBuy(groupBuyId)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 完整示例页面
|
||||||
|
- 管理端页面:`src/views/activity/GroupBuyActivity.vue` ✅ 已存在
|
||||||
|
- 用户端示例:`src/views/marketing/GroupBuyManage.vue`
|
||||||
|
|
||||||
|
管理端页面包含:
|
||||||
|
- ✅ 拼团列表展示(使用正确的接口路径)
|
||||||
|
- ✅ 创建随机伪人队伍
|
||||||
|
- ✅ 添加随机伪人
|
||||||
|
- ✅ 下发订单功能
|
||||||
|
- ✅ 导出成功队伍
|
||||||
|
- ✅ 查看队伍成员
|
||||||
|
|
||||||
|
## 接口路径总结
|
||||||
|
|
||||||
|
### 管理端接口
|
||||||
|
- `GET /api/v1/users/activity/group_buy/list` - 获取拼团列表 ✅ 返回队伍ID数组
|
||||||
|
- `GET /api/v1/users/activity/group_buy/detail/:id` - 获取队伍详情 ✅ 新增
|
||||||
|
- `POST /api/v1/admin/activity/group_buy/add_random_group` - 创建随机队伍 ✅ 已验证
|
||||||
|
- `POST /api/v1/admin/activity/group_buy/add_random_user` - 添加随机伪人
|
||||||
|
- `POST /api/v1/admin/activity/group_buy/set_order` - 下发订单
|
||||||
|
- `GET /api/v1/admin/activity/group_buy/export_idc_info` - 导出信息
|
||||||
|
|
||||||
|
### 用户端接口(根据需要调整)
|
||||||
|
- `POST /api/v1/group-buy/create` - 创建拼团
|
||||||
|
- `GET /api/v1/group-buy/check/:id` - 检查拼团
|
||||||
|
- `GET /api/v1/group-buy/:id` - 获取拼团详情
|
||||||
|
- `GET /api/v1/users/activity/group_buy/list` - 获取拼团列表 ✅
|
||||||
|
- `POST /api/v1/group-buy/:id/join` - 加入拼团
|
||||||
|
- `DELETE /api/v1/group-buy/:id` - 删除拼团
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
### 在管理端页面使用
|
||||||
|
```vue
|
||||||
|
<script setup>
|
||||||
|
import { getGroupBuyList, addRandomUser } from '@/api/admin/activity.js'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
// 获取列表
|
||||||
|
const fetchList = async () => {
|
||||||
|
try {
|
||||||
|
const resp = await getGroupBuyList()
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
console.log('拼团列表:', resp.data)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取失败:', error)
|
||||||
|
ElMessage.error('获取失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加伪人
|
||||||
|
const addUser = async (groupBuyId) => {
|
||||||
|
try {
|
||||||
|
const resp = await addRandomUser(groupBuyId)
|
||||||
|
if (resp && resp.code === 200) {
|
||||||
|
ElMessage.success('添加成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('添加失败:', error)
|
||||||
|
ElMessage.error('添加失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. **接口路径已更新**:获取拼团列表接口已更新为 `/api/v1/users/activity/group_buy/list`
|
||||||
|
2. **错误处理**:所有 API 调用都应该包含 try-catch 错误处理
|
||||||
|
3. **响应检查**:始终检查 `resp.code === 200` 来判断请求是否成功
|
||||||
|
4. **空值处理**:使用可选链 `?.` 和空值合并 `||` 来处理可能为空的数据
|
||||||
|
5. **用户提示**:使用 `ElMessage` 给用户友好的提示信息
|
||||||
|
|
||||||
+282
@@ -0,0 +1,282 @@
|
|||||||
|
# 拼团 API 测试示例
|
||||||
|
|
||||||
|
## 实际数据结构(已验证)
|
||||||
|
|
||||||
|
### 1. 获取队伍列表
|
||||||
|
**接口**: `GET /api/v1/users/activity/group_buy/list`
|
||||||
|
|
||||||
|
**返回数据**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"message": "Success",
|
||||||
|
"data": {
|
||||||
|
"group_buy_list": ["17670726110-5"], // 所有队伍ID
|
||||||
|
"lack_group_buy_list": ["17670726110-5"], // 未满员队伍ID
|
||||||
|
"success_group_buy_list": [] // 已满员队伍ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**数据说明**:
|
||||||
|
- `group_buy_list`: 所有队伍的 ID 列表
|
||||||
|
- `lack_group_buy_list`: 人数不足的队伍 ID(进行中)
|
||||||
|
- `success_group_buy_list`: 已满员的队伍 ID(成功)
|
||||||
|
- 队伍 ID 格式: `时间戳-人数` (如 `17670726110-5` 表示5人队)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. 创建队伍
|
||||||
|
**接口**: `POST /api/v1/admin/activity/group_buy/add_random_group`
|
||||||
|
|
||||||
|
**请求参数**:
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
name: "发士大夫",
|
||||||
|
group_buy_type: 0 // 0=5人队, 1=10人队
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**返回数据**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"message": "Success",
|
||||||
|
"data": {
|
||||||
|
"group_buy_id": "17670733070-5",
|
||||||
|
"name": "发士大夫",
|
||||||
|
"maxPerson": 5,
|
||||||
|
"createTime": "2025-12-30T13:41:47.216888773+08:00",
|
||||||
|
"users": [{
|
||||||
|
"user_id": 0,
|
||||||
|
"user_name": "",
|
||||||
|
"team_leader": true,
|
||||||
|
"cover": "https://oss.hostidc.net/api-server/static/files/...",
|
||||||
|
"idc_phone": "",
|
||||||
|
"idc_uid": ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**数据说明**:
|
||||||
|
- 创建成功后会自动添加一个团长(伪人)
|
||||||
|
- `team_leader: true` 表示是团长
|
||||||
|
- 返回完整的队伍信息,包括初始成员
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. 获取队伍详情
|
||||||
|
**接口**: `GET /api/v1/users/activity/group_buy/detail/:id`
|
||||||
|
|
||||||
|
**返回数据**: 与创建队伍返回的数据结构相同
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 在代码中使用
|
||||||
|
|
||||||
|
### 完整流程示例
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import {
|
||||||
|
getGroupBuyList,
|
||||||
|
getGroupBuyDetail,
|
||||||
|
addRandomGroup,
|
||||||
|
addRandomUser,
|
||||||
|
setOrder
|
||||||
|
} from '@/api/admin/activity.js'
|
||||||
|
|
||||||
|
// 1. 获取队伍列表
|
||||||
|
const fetchList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getGroupBuyList()
|
||||||
|
console.log('队伍列表:', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
const allIds = res.data.group_buy_list || []
|
||||||
|
const lackIds = res.data.lack_group_buy_list || []
|
||||||
|
const successIds = res.data.success_group_buy_list || []
|
||||||
|
|
||||||
|
console.log('所有队伍:', allIds)
|
||||||
|
console.log('未满员:', lackIds)
|
||||||
|
console.log('已满员:', successIds)
|
||||||
|
|
||||||
|
ElMessage.success(`共 ${allIds.length} 个队伍`)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取失败:', error)
|
||||||
|
ElMessage.error('获取失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 创建队伍
|
||||||
|
const createTeam = async () => {
|
||||||
|
try {
|
||||||
|
const res = await addRandomGroup('测试队伍', 0) // 0=5人队
|
||||||
|
console.log('创建结果:', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
const teamId = res.data.group_buy_id
|
||||||
|
const teamName = res.data.name
|
||||||
|
const memberCount = res.data.users?.length || 0
|
||||||
|
|
||||||
|
ElMessage.success(`创建成功!队伍ID: ${teamId},当前 ${memberCount} 人`)
|
||||||
|
|
||||||
|
// 刷新列表
|
||||||
|
await fetchList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('创建失败:', error)
|
||||||
|
ElMessage.error('创建失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 获取队伍详情
|
||||||
|
const getDetail = async (teamId) => {
|
||||||
|
try {
|
||||||
|
const res = await getGroupBuyDetail(teamId)
|
||||||
|
console.log('队伍详情:', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
const team = res.data
|
||||||
|
console.log('队伍名称:', team.name)
|
||||||
|
console.log('最大人数:', team.maxPerson)
|
||||||
|
console.log('当前成员:', team.users)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取详情失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 添加伪人
|
||||||
|
const addFakeUser = async (teamId) => {
|
||||||
|
try {
|
||||||
|
const res = await addRandomUser(teamId)
|
||||||
|
console.log('添加伪人结果:', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('添加伪人成功')
|
||||||
|
// 刷新详情
|
||||||
|
await getDetail(teamId)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('添加失败:', error)
|
||||||
|
ElMessage.error('添加失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 下发订单
|
||||||
|
const sendOrder = async (teamId) => {
|
||||||
|
try {
|
||||||
|
const res = await setOrder(teamId)
|
||||||
|
console.log('下发订单结果:', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('订单下发成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('下发失败:', error)
|
||||||
|
ElMessage.error('下发失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 测试步骤
|
||||||
|
|
||||||
|
### 步骤 1: 创建队伍
|
||||||
|
```javascript
|
||||||
|
await addRandomGroup('测试5人队', 0)
|
||||||
|
// 返回: { group_buy_id: "xxx-5", name: "测试5人队", maxPerson: 5, users: [1个团长] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 2: 查看列表
|
||||||
|
```javascript
|
||||||
|
await getGroupBuyList()
|
||||||
|
// 返回: { group_buy_list: ["xxx-5"], lack_group_buy_list: ["xxx-5"], success_group_buy_list: [] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 3: 添加伪人(重复4次,凑满5人)
|
||||||
|
```javascript
|
||||||
|
await addRandomUser("xxx-5") // 第2人
|
||||||
|
await addRandomUser("xxx-5") // 第3人
|
||||||
|
await addRandomUser("xxx-5") // 第4人
|
||||||
|
await addRandomUser("xxx-5") // 第5人
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 4: 再次查看列表
|
||||||
|
```javascript
|
||||||
|
await getGroupBuyList()
|
||||||
|
// 返回: { group_buy_list: ["xxx-5"], lack_group_buy_list: [], success_group_buy_list: ["xxx-5"] }
|
||||||
|
// 注意: 队伍从 lack_group_buy_list 移到了 success_group_buy_list
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 5: 下发订单
|
||||||
|
```javascript
|
||||||
|
await setOrder("xxx-5")
|
||||||
|
// 为满员队伍下发订单
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 队伍状态判断逻辑
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const getTeamStatus = (teamId, lackList, successList) => {
|
||||||
|
if (successList.includes(teamId)) {
|
||||||
|
return 'success' // 已满员
|
||||||
|
} else if (lackList.includes(teamId)) {
|
||||||
|
return 'pending' // 进行中(未满员)
|
||||||
|
} else {
|
||||||
|
return 'empty' // 空队伍(理论上不会出现)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 队伍类型判断
|
||||||
|
|
||||||
|
根据队伍 ID 判断类型:
|
||||||
|
```javascript
|
||||||
|
const getTeamType = (teamId) => {
|
||||||
|
if (teamId.includes('-5')) {
|
||||||
|
return { type: 0, maxPerson: 5, typeName: '5人队' }
|
||||||
|
} else if (teamId.includes('-10')) {
|
||||||
|
return { type: 1, maxPerson: 10, typeName: '10人队' }
|
||||||
|
}
|
||||||
|
return { type: 0, maxPerson: 5, typeName: '未知' }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. **列表接口只返回 ID**:需要调用详情接口获取完整信息
|
||||||
|
2. **队伍 ID 格式**:`时间戳-人数`,可以从 ID 判断队伍类型
|
||||||
|
3. **状态判断**:通过 `lack_group_buy_list` 和 `success_group_buy_list` 判断队伍状态
|
||||||
|
4. **创建即有团长**:创建队伍时会自动添加一个团长(伪人)
|
||||||
|
5. **满员条件**:5人队需要5人,10人队需要10人
|
||||||
|
6. **下发订单**:只能对已满员的队伍下发订单
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 当前页面功能
|
||||||
|
|
||||||
|
`src/views/activity/GroupBuyActivity.vue` 已实现:
|
||||||
|
|
||||||
|
✅ 获取队伍列表(显示所有队伍及状态)
|
||||||
|
✅ 创建随机伪人队伍
|
||||||
|
✅ 添加随机伪人到队伍
|
||||||
|
✅ 查看队伍成员详情
|
||||||
|
✅ 为满员队伍下发订单
|
||||||
|
✅ 导出成功队伍信息
|
||||||
|
✅ 实时状态更新
|
||||||
|
|
||||||
|
所有功能都已根据实际 API 数据结构进行了适配!
|
||||||
+74
-517
@@ -7,48 +7,21 @@
|
|||||||
},
|
},
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/v1/admin/server/setting/group/list": {
|
"/api/v1/admin/activity/group_buy/check": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "获取配置分组列表",
|
"summary": "检查队伍列表",
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "",
|
"description": "",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"name": "page",
|
|
||||||
"in": "query",
|
|
||||||
"description": "获取页码 默认 1",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "count",
|
|
||||||
"in": "query",
|
|
||||||
"description": "获取条数 默认 10",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"in": "query",
|
|
||||||
"description": "关键词筛选",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"description": "",
|
"description": "",
|
||||||
"example": "Bearer {{token}}",
|
"required": false,
|
||||||
|
"example": "{{Token}}",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -69,53 +42,9 @@
|
|||||||
"security": []
|
"security": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v1/admin/server/setting/group/info": {
|
"/api/v1/admin/activity/group_buy/add_random_user": {
|
||||||
"get": {
|
|
||||||
"summary": "获取配置分组信息",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "setting_group_id",
|
|
||||||
"in": "query",
|
|
||||||
"description": "",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/group/create": {
|
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "创建配置分组",
|
"summary": "为队伍添加随机伪人",
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "",
|
"description": "",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
@@ -124,10 +53,60 @@
|
|||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"description": "",
|
"description": "",
|
||||||
"example": "Bearer {{token}}",
|
"required": false,
|
||||||
|
"example": "{{Token}}",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"default": "Bearer {{token}}"
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"multipart/form-data": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"group_buy_id": {
|
||||||
|
"example": "",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"headers": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/admin/activity/group_buy/add_random_group": {
|
||||||
|
"post": {
|
||||||
|
"summary": "创建随机伪人队伍",
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "",
|
||||||
|
"tags": [],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"description": "",
|
||||||
|
"required": false,
|
||||||
|
"example": "{{Token}}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -138,77 +117,12 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"description": "名称",
|
"description": "队伍名称",
|
||||||
"example": "",
|
"example": "",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"note": {
|
"group_buy_type": {
|
||||||
"description": "备注",
|
"description": "队伍类型(0为5人队;1为10人队)",
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
},
|
|
||||||
"example": {
|
|
||||||
"code": 200,
|
|
||||||
"message": "Success"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/group/update": {
|
|
||||||
"post": {
|
|
||||||
"summary": "修改配置分组",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"description": "ID",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"description": "名称",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"note": {
|
|
||||||
"description": "备注",
|
|
||||||
"example": "",
|
"example": "",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -234,110 +148,21 @@
|
|||||||
"security": []
|
"security": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v1/admin/server/setting/group/delete": {
|
"/api/v1/admin/activity/group_buy/export_idc_info": {
|
||||||
"delete": {
|
|
||||||
"summary": "删除配置分组",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "setting_group_id",
|
|
||||||
"in": "query",
|
|
||||||
"description": "",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/list": {
|
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "获取配置列表",
|
"summary": "导出成功队伍信息",
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "",
|
"description": "",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"name": "page",
|
|
||||||
"in": "query",
|
|
||||||
"description": "获取页码 默认 1",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "count",
|
|
||||||
"in": "query",
|
|
||||||
"description": "获取条数 默认 10",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "group_id",
|
|
||||||
"in": "query",
|
|
||||||
"description": "组id(与组名称二选一)",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "group_name",
|
|
||||||
"in": "query",
|
|
||||||
"description": "组名称(与组id二选一)",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "key",
|
|
||||||
"in": "query",
|
|
||||||
"description": "关键词筛选",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"description": "",
|
"description": "",
|
||||||
"example": "Bearer {{token}}",
|
"required": false,
|
||||||
|
"example": "{{Token}}",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -358,62 +183,9 @@
|
|||||||
"security": []
|
"security": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/v1/admin/server/setting/info": {
|
"/api/v1/admin/activity/group_buy/set_order": {
|
||||||
"get": {
|
|
||||||
"summary": "获取配置信息",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"in": "query",
|
|
||||||
"description": "配置id (与name二选一)",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"in": "query",
|
|
||||||
"description": "配置名称 (与id二选一)",
|
|
||||||
"required": false,
|
|
||||||
"schema": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/create": {
|
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "创建配置",
|
"summary": "为指定队伍下发订单",
|
||||||
"deprecated": false,
|
"deprecated": false,
|
||||||
"description": "",
|
"description": "",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
@@ -435,223 +207,8 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"group_buy_id": {
|
||||||
"description": "名称",
|
"description": "队伍id",
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"note": {
|
|
||||||
"description": "备注",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"description": "类型 string/int/float/bool/",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"setting_group_id": {
|
|
||||||
"description": "配置组id",
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"open": {
|
|
||||||
"description": "是否开放访问",
|
|
||||||
"example": "",
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"name",
|
|
||||||
"value",
|
|
||||||
"type"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/update": {
|
|
||||||
"post": {
|
|
||||||
"summary": "修改配置",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"description": "名称",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"note": {
|
|
||||||
"description": "备注",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"description": "类型 string/int/float/bool/",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"setting_group_id": {
|
|
||||||
"description": "配置组id",
|
|
||||||
"example": "",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/set_open": {
|
|
||||||
"post": {
|
|
||||||
"summary": "修改配置是否开放访问",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"example": 0,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"open": {
|
|
||||||
"description": "是否开放",
|
|
||||||
"example": "",
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"open"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"headers": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/admin/server/setting/delete": {
|
|
||||||
"delete": {
|
|
||||||
"summary": "删除配置",
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "",
|
|
||||||
"tags": [],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "Authorization",
|
|
||||||
"in": "header",
|
|
||||||
"description": "",
|
|
||||||
"example": "Bearer {{token}}",
|
|
||||||
"schema": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Bearer {{token}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"example": "",
|
"example": "",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -670,8 +227,7 @@
|
|||||||
"properties": {}
|
"properties": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"headers": {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"security": []
|
"security": []
|
||||||
@@ -680,6 +236,7 @@
|
|||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
"schemas": {},
|
"schemas": {},
|
||||||
|
"responses": {},
|
||||||
"securitySchemes": {}
|
"securitySchemes": {}
|
||||||
},
|
},
|
||||||
"servers": [],
|
"servers": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user