admin_new P0/P1 全量补齐合并 (5项差距 + CRUD真API + 询价/看板真数据) #3

Merged
direv merged 9 commits from develop into main 2026-08-08 10:10:03 +08:00
7 changed files with 64 additions and 54 deletions
Showing only changes of commit d0790126b0 - Show all commits

View File

@ -13,7 +13,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import DataTable from '@/components/DataTable/DataTable.vue'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -76,9 +76,9 @@ function onPageChange(p: number) { page.value = p; load() }
function onLimitChange(l: number) { limit.value = l; load() }
function onPreview(row: Feedback) { previewData.value = row; previewVisible.value = true }
function onDelete(row: Feedback) {
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/feedback/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}

View File

@ -12,7 +12,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import DataTable from '@/components/DataTable/DataTable.vue'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -72,14 +72,17 @@ function onAdd() { editMode.value = 'add'; editForm.id = ''; editForm.title = ''
function onEdit(row: Help) { editMode.value = 'edit'; Object.assign(editForm, JSON.parse(JSON.stringify(row))); editVisible.value = true }
function onSubmitEdit() {
if (!editForm.title.trim()) { ElMessage.warning('请填写标题'); return }
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
const ep = editMode.value === 'add' ? '/other/help/save' : '/other/help/update'
httpPost(ep, { ...editForm }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
function onDelete(row: Help) {
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/help/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}

View File

@ -12,7 +12,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import DataTable from '@/components/DataTable/DataTable.vue'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -85,14 +85,17 @@ function onEdit(row: Lunbo) { editMode.value = 'edit'; Object.assign(editForm, J
function onSubmitEdit() {
if (!editForm.title.trim()) { ElMessage.warning('请填写标题'); return }
if (!editForm.image.trim()) { ElMessage.warning('请填写图片URL'); return }
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
const ep = editMode.value === 'add' ? '/other/lunbo/save' : '/other/lunbo/update'
httpPost(ep, { ...editForm }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
function onDelete(row: Lunbo) {
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/lunbo/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}

View File

@ -13,7 +13,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -78,22 +78,22 @@ function onSelectionChange(rows: Groupbuy[]) { selection.value = rows }
function onView(row: Groupbuy) { viewData.value = row; viewVisible.value = true }
function onToggleStatus(row: Groupbuy) {
const newStatus = row.status === 1 ? 2 : 1
ElMessageBox.confirm(`确认${newStatus === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success(`${newStatus === 1 ? '启用' : '停用'}成功 (mock)`)
load()
ElMessageBox.confirm(`确认${newStatus === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/groupbuy/update', { id: row.id, status: newStatus }); ElMessage.success(`${newStatus === 1 ? '启用' : '停用'}成功`); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
}).catch(() => {})
}
function onDelete(row: Groupbuy) {
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/groupbuy/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
function onBatchDelete() {
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的活动'); return }
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已批量删除 (mock)')
load()
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/groupbuy/delete', selection.value.map(s => s.id)); ElMessage.success(`已批量删除 ${selection.value.length} 个`); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败') }
}).catch(() => {})
}

View File

@ -13,7 +13,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -79,22 +79,22 @@ function onSelectionChange(rows: Seckill[]) { selection.value = rows }
function onView(row: Seckill) { viewData.value = row; viewVisible.value = true }
function onToggleStatus(row: Seckill) {
const newStatus = row.status === 0 ? 1 : 0
ElMessageBox.confirm(`确认${newStatus === 0 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success(`${newStatus === 0 ? '启用' : '停用'}成功 (mock)`)
load()
ElMessageBox.confirm(`确认${newStatus === 0 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/seckill/updateSeckill', { id: row.id, status: newStatus }); ElMessage.success(`${newStatus === 0 ? '启用' : '停用'}成功`); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
}).catch(() => {})
}
function onDelete(row: Seckill) {
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/seckill/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
function onBatchDelete() {
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的活动'); return }
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已批量删除 (mock)')
load()
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/seckill/delete', selection.value.map(s => s.id)); ElMessage.success(`已批量删除 ${selection.value.length} 个`); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败') }
}).catch(() => {})
}

View File

@ -15,6 +15,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpPost } from '@/utils/request'
import DataTable from '@/components/DataTable/DataTable.vue'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
@ -84,15 +85,18 @@ function onAdd() { editMode.value = 'add'; Object.assign(editForm, { id: '', cod
function onEdit(row: TextConfig) { editMode.value = 'edit'; Object.assign(editForm, JSON.parse(JSON.stringify(row))); editVisible.value = true }
function onSubmitEdit() {
if (!editForm.code.trim() || !editForm.descr.trim()) { ElMessage.warning('请填写编码和描述'); return }
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
const ep = editMode.value === 'add' ? '/other/textconfig/save' : '/other/textconfig/update'
httpPost(ep, { ...editForm }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
function onShowRichText(content: string) { richTextContent.value = content; richTextVisible.value = true }
function onDelete(row: TextConfig) {
ElMessageBox.confirm(`确认删除「${row.code}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.code}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/textconfig/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}

View File

@ -12,7 +12,7 @@
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
import SearchBar from '@/components/SearchBar/SearchBar.vue'
import TableActions from '@/components/TableActions/TableActions.vue'
@ -87,22 +87,22 @@ function onEdit(row: Coupon) {
}
function onToggleStatus(row: Coupon) {
const next = row.onShelf === 1 ? 0 : 1
ElMessageBox.confirm(`确认${next === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success(`${next === 1 ? '启用' : '停用'}成功 (mock)`)
load()
ElMessageBox.confirm(`确认${next === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/coupon/updateCoupon', { id: row.id, onShelf: next }); ElMessage.success(`${next === 1 ? '启用' : '停用'}成功`); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
}).catch(() => {})
}
function onDelete(row: Coupon) {
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/coupon/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
function onBatchDelete() {
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的券'); return }
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 张券?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已批量删除 (mock)')
load()
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 张券?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/coupon/delete', selection.value.map(s => s.id)); ElMessage.success(`已批量删除 ${selection.value.length} 张`); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败') }
}).catch(() => {})
}
function onShowRecords(row: Coupon) {