Compare commits

..

4 Commits

12 changed files with 112 additions and 76 deletions

View File

@ -273,12 +273,12 @@ const badges = ref<Record<string, string>>({})
async function loadBadges() { async function loadBadges() {
try { try {
const data = await fetch('/sys/openapi/inquiry/list?page=1&limit=1', { const data = await fetch('/supplier/inquiry/page?page=1&limit=1', {
headers: { Authorization: `Bearer ${userStore.token}` }, headers: { Authorization: `Bearer ${userStore.token}` },
credentials: 'omit' credentials: 'omit'
}).then(r => r.json()).catch(() => null) }).then(r => r.json()).catch(() => null)
if (data?.code === 0) { if (data?.code === 0) {
const total = data.total ?? data.data?.length ?? 0 const total = data.data?.total ?? data.total ?? 0
badges.value['询价管理'] = String(total) badges.value['询价管理'] = String(total)
} }
} catch {} } catch {}

View File

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

View File

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

View File

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

View File

@ -89,8 +89,9 @@ const FALLBACK_STATUS = [
*/ */
async function loadRecentInquiries(): Promise<Inquiry[]> { async function loadRecentInquiries(): Promise<Inquiry[]> {
try { try {
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 5 }) const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 5 })
if (!Array.isArray(data)) throw new Error('inquiry list not array') const data = Array.isArray(resp) ? resp : (resp?.list || [])
if (!data.length) throw new Error('inquiry list empty')
return data.slice(0, 5).map((it: any) => { return data.slice(0, 5).map((it: any) => {
const s = it.apprStatus === 0 ? 'pending' const s = it.apprStatus === 0 ? 'pending'
: it.apprStatus === 1 ? 'quoting' : it.apprStatus === 1 ? 'quoting'
@ -127,13 +128,14 @@ async function loadRecentInquiries(): Promise<Inquiry[]> {
*/ */
async function loadStats(): Promise<Stat[]> { async function loadStats(): Promise<Stat[]> {
try { try {
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 500 }) const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 500 })
if (!Array.isArray(data)) throw new Error('inquiry list not array') const data = Array.isArray(resp) ? resp : (resp?.list || [])
if (!data.length) throw new Error('inquiry list empty')
const total = data.length const total = Number(resp?.total || data.length)
const pending = data.filter((it: any) => it.apprStatus === 0).length const pending = data.filter((it: any) => it.apprStatus === 0 || it.status === 0).length
const quoting = data.filter((it: any) => it.apprStatus === 1).length const quoting = data.filter((it: any) => it.apprStatus === 1 || it.status === 1).length
const done = data.filter((it: any) => it.apprStatus === 2).length const done = data.filter((it: any) => it.apprStatus === 2 || it.status === 2).length
return [ return [
{ label: '询价总数', value: String(total), delta: '', trend: 'up', icon: 'ChatDotRound' }, { label: '询价总数', value: String(total), delta: '', trend: 'up', icon: 'ChatDotRound' },
@ -221,8 +223,8 @@ onMounted(async () => {
// 拉一次全量算图表 + 较昨日 // 拉一次全量算图表 + 较昨日
let allInquiries: any[] = [] let allInquiries: any[] = []
try { try {
allInquiries = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 500 }) const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 500 })
if (!Array.isArray(allInquiries)) allInquiries = [] allInquiries = Array.isArray(resp) ? resp : (resp?.list || [])
} catch { allInquiries = [] } } catch { allInquiries = [] }
const isLive = allInquiries.length > 0 const isLive = allInquiries.length > 0

View File

@ -96,11 +96,34 @@ const inquiryId = computed(() => String(route.params.id || ''))
async function load() { async function load() {
loading.value = true loading.value = true
try { try {
await new Promise(r => setTimeout(r, 200)) const resp: any = await httpGet('/supplier/inquiry/getById', { id: inquiryId.value })
detail.value = { ...FALLBACK, id: inquiryId.value } if (resp && resp.id) {
detail.value = {
...FALLBACK,
...resp,
id: String(resp.id || inquiryId.value),
title: resp.title || FALLBACK.title,
productName: resp.productName || resp.product || FALLBACK.productName,
productBrand: resp.brand || resp.productBrand || FALLBACK.productBrand,
specification: resp.specification || resp.spec || FALLBACK.specification,
unit: resp.unit || FALLBACK.unit,
quantity: resp.purchaseQuantity || resp.quantity || FALLBACK.quantity,
shippingAddress: resp.shippingAddress || resp.address || FALLBACK.shippingAddress,
deliveryDate: resp.deliveryDate || FALLBACK.deliveryDate,
priceValidDate: resp.priceValidDate || FALLBACK.priceValidDate,
enterpriseName: resp.inquiryEnterpriseName || resp.enterpriseName || FALLBACK.enterpriseName,
fileList: resp.fileList || FALLBACK.fileList,
quotationList: resp.quotationList || FALLBACK.quotationList,
raw: resp,
}
} else {
detail.value = { ...FALLBACK, id: inquiryId.value }
}
} catch { } catch {
detail.value = { ...FALLBACK, id: inquiryId.value } detail.value = { ...FALLBACK, id: inquiryId.value }
} finally { loading.value = false } } finally {
loading.value = false
}
} }
function fmtDate(s: any): string { function fmtDate(s: any): string {

View File

@ -74,12 +74,13 @@ async function load() {
loading.value = true loading.value = true
error.value = null error.value = null
try { try {
const data = await httpGet<any>('/sys/openapi/inquiry/list', { const resp = await httpGet<any>('/supplier/inquiry/page', {
page: page.value, page: page.value,
limit: limit.value, limit: limit.value,
...(filters.value.status ? { status: filters.value.status } : {}) ...(filters.value.status ? { status: filters.value.status } : {})
}) })
const arr = Array.isArray(data) ? data : [] const arr = Array.isArray(resp) ? resp : (resp?.list || [])
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
list.value = arr.map((it: any) => ({ list.value = arr.map((it: any) => ({
id: String(it.id ?? ''), id: String(it.id ?? ''),
customer: it.inquiryEnterpriseName || it.customer || it.customerName || '--', customer: it.inquiryEnterpriseName || it.customer || it.customerName || '--',
@ -89,7 +90,6 @@ async function load() {
time: it.publishDate || it.createDate || it.time, time: it.publishDate || it.createDate || it.time,
raw: it raw: it
})) }))
total.value = arr.length + (page.value - 1) * limit.value
// 各状态计数 (基于当前页结果) // 各状态计数 (基于当前页结果)
stats.all = list.value.length stats.all = list.value.length
list.value.forEach(r => { stats[r.status] = (stats[r.status] || 0) + 1 }) list.value.forEach(r => { stats[r.status] = (stats[r.status] || 0) + 1 })

View File

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

View File

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

View File

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

View File

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

View File

@ -100,13 +100,14 @@ export const useInquiryStore = defineStore('inquiry', () => {
loading.value = true loading.value = true
error.value = null error.value = null
try { try {
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { const resp = await httpGet<any>('/supplier/inquiry/page', {
page: page.value, page: page.value,
limit: limit.value, limit: limit.value,
...(statusFilter.value ? { status: statusFilter.value } : {}) ...(statusFilter.value ? { status: statusFilter.value } : {})
}) })
list.value = (Array.isArray(data) ? data : []).map(normalizeInquiry) const arr = Array.isArray(resp) ? resp : (resp?.list || [])
total.value = list.value.length + (page.value - 1) * limit.value // 简化 total(后端不返) list.value = arr.map(normalizeInquiry)
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
isLive.value = true isLive.value = true
lastFetchedAt.value = Date.now() lastFetchedAt.value = Date.now()
} catch (e: any) { } catch (e: any) {
@ -123,7 +124,7 @@ export const useInquiryStore = defineStore('inquiry', () => {
*/ */
async function fetchOne(id: string): Promise<Inquiry | null> { async function fetchOne(id: string): Promise<Inquiry | null> {
try { try {
const data = await httpGet<any>(`/sys/openapi/inquiry/${id}`) const data = await httpGet<any>('/supplier/inquiry/getById', { id })
return data ? normalizeInquiry(data) : null return data ? normalizeInquiry(data) : null
} catch { } catch {
return null return null