feate:对接删除队伍接口
This commit is contained in:
@@ -174,3 +174,29 @@ export const exportGroupBuyIdcInfo = () => {
|
|||||||
export const setGroupBuyOrder = (groupBuyId) => {
|
export const setGroupBuyOrder = (groupBuyId) => {
|
||||||
return request.post("/api/v1/admin/activity/group_buy/set_order", { group_buy_id: groupBuyId })
|
return request.post("/api/v1/admin/activity/group_buy/set_order", { group_buy_id: groupBuyId })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定队伍
|
||||||
|
* @param {string} groupBuyId - 队伍ID
|
||||||
|
* @returns {Promise} 返回删除结果
|
||||||
|
*/
|
||||||
|
export const removeGroupBuy = (groupBuyId) => {
|
||||||
|
return request.delete("/api/v1/admin/activity/group_buy/remove", { params: { group_buy_id: groupBuyId } })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除所有队伍
|
||||||
|
* @returns {Promise} 返回清除结果
|
||||||
|
*/
|
||||||
|
export const clearAllGroupBuy = () => {
|
||||||
|
return request.delete("/api/v1/admin/activity/group_buy/clear")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除指定用户的所有队伍
|
||||||
|
* @param {string} userId - 用户ID
|
||||||
|
* @returns {Promise} 返回清除结果
|
||||||
|
*/
|
||||||
|
export const clearUserGroupBuy = (userId) => {
|
||||||
|
return request.delete("/api/v1/admin/activity/group_buy/user_clear", { params: { user_id: userId } })
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
<el-button type="info" icon="Refresh" @click="fetchGroupList" :loading="loading">
|
<el-button type="info" icon="Refresh" @click="fetchGroupList" :loading="loading">
|
||||||
刷新列表
|
刷新列表
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="danger" @click="handleClearAll">
|
||||||
|
清除所有队伍
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
@@ -61,6 +64,13 @@
|
|||||||
>
|
>
|
||||||
查看详情
|
查看详情
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="handleRemoveGroup(row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -138,7 +148,7 @@ import {
|
|||||||
exportIdcInfo,
|
exportIdcInfo,
|
||||||
setOrder
|
setOrder
|
||||||
} from '@/api/admin/activity'
|
} from '@/api/admin/activity'
|
||||||
import { getGroupBuyTypeList,getGroupBuyTypeTags } from '@/api/groupBuy'
|
import { getGroupBuyTypeList, getGroupBuyTypeTags, removeGroupBuy, clearAllGroupBuy, clearUserGroupBuy } from '@/api/groupBuy'
|
||||||
|
|
||||||
// 数据状态
|
// 数据状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -451,6 +461,48 @@ const handleExport = async () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchGroupList()
|
fetchGroupList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 删除指定队伍
|
||||||
|
const handleRemoveGroup = async (row) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定要删除该队伍吗?', '确认删除', { type: 'warning' })
|
||||||
|
const res = await removeGroupBuy(row.id)
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '删除失败')
|
||||||
|
}
|
||||||
|
} catch { /* 取消 */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除所有队伍
|
||||||
|
const handleClearAll = async () => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定要清除所有队伍吗?此操作不可恢复!', '危险操作', { type: 'error', confirmButtonText: '确定清除' })
|
||||||
|
const res = await clearAllGroupBuy()
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('已清除所有队伍')
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '清除失败')
|
||||||
|
}
|
||||||
|
} catch { /* 取消 */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除指定用户的所有队伍
|
||||||
|
const handleClearUserGroups = async (userId) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(`确定要清除用户 ${userId} 的所有队伍吗?`, '确认操作', { type: 'warning' })
|
||||||
|
const res = await clearUserGroupBuy(userId)
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('清除成功')
|
||||||
|
fetchGroupList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.message || '清除失败')
|
||||||
|
}
|
||||||
|
} catch { /* 取消 */ }
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -69,37 +69,18 @@
|
|||||||
<el-form-item label="过期时间" prop="expireTime">
|
<el-form-item label="过期时间" prop="expireTime">
|
||||||
<el-date-picker v-model="form.expireTime" type="datetime" placeholder="选择过期时间" style="width: 100%" />
|
<el-date-picker v-model="form.expireTime" type="datetime" placeholder="选择过期时间" style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注字段" prop="noteFields">
|
<el-form-item label="备注字段">
|
||||||
<div class="note-fields-container">
|
<div class="note-fields-container">
|
||||||
<el-button type="primary" size="small" @click="addNoteField" style="margin-bottom: 10px">+ 添加字段</el-button>
|
<el-button type="primary" size="small" @click="addNoteField" style="margin-bottom: 10px">+ 添加字段</el-button>
|
||||||
<el-table :data="form.noteFields" border size="small" v-if="form.noteFields.length">
|
<el-table :data="form.noteFields" border size="small" v-if="form.noteFields.length">
|
||||||
<el-table-column label="字段Key" width="120">
|
<el-table-column label="名称" min-width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input v-model="row.key" placeholder="key" size="small" />
|
<el-input v-model="row.label" placeholder="如:内存" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="显示名称" width="120">
|
<el-table-column label="默认值" min-width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input v-model="row.label" placeholder="名称" size="small" />
|
<el-input v-model="row.defaultValue" placeholder="如:20GB" size="small" />
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="默认值" width="100">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.defaultValue" placeholder="默认值" size="small" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="输入类型" width="100">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-select v-model="row.type" size="small">
|
|
||||||
<el-option label="文本" value="text" />
|
|
||||||
<el-option label="数字" value="number" />
|
|
||||||
<el-option label="选择" value="select" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="必填" width="60" align="center">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-checkbox v-model="row.required" />
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="60" align="center">
|
<el-table-column label="操作" width="60" align="center">
|
||||||
@@ -149,7 +130,7 @@ const rules = {
|
|||||||
|
|
||||||
// 添加备注字段
|
// 添加备注字段
|
||||||
const addNoteField = () => {
|
const addNoteField = () => {
|
||||||
form.noteFields.push({ key: '', label: '', defaultValue: '', type: 'text', required: false })
|
form.noteFields.push({ label: '', defaultValue: '' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除备注字段
|
// 删除备注字段
|
||||||
@@ -223,7 +204,7 @@ const handleSubmit = async () => {
|
|||||||
if (!valid) return
|
if (!valid) return
|
||||||
submitLoading.value = true
|
submitLoading.value = true
|
||||||
try {
|
try {
|
||||||
const noteJson = JSON.stringify(form.noteFields.filter(f => f.key))
|
const noteJson = JSON.stringify(form.noteFields.filter(f => f.label))
|
||||||
const data = {
|
const data = {
|
||||||
name: form.name,
|
name: form.name,
|
||||||
price: String(form.price),
|
price: String(form.price),
|
||||||
|
|||||||
@@ -562,6 +562,127 @@
|
|||||||
},
|
},
|
||||||
"security": []
|
"security": []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/admin/activity/group_buy/remove": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "删除指定队伍",
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "",
|
||||||
|
"tags": [],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "group_buy_id",
|
||||||
|
"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/activity/group_buy/clear": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "清除所有队伍",
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "",
|
||||||
|
"tags": [],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"description": "",
|
||||||
|
"example": "Bearer {{token}}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "Bearer {{token}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/admin/activity/group_buy/user_clear": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "清除指定用户的所有队伍",
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "",
|
||||||
|
"tags": [],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "user_id",
|
||||||
|
"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": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
|
|||||||
Reference in New Issue
Block a user