Compare commits
No commits in common. "d5fe4c5d3e7d5bf178396131d99bd13436baca5b" and "027ff5192b3db5fa495d94785bb71b5c3df633e2" have entirely different histories.
d5fe4c5d3e
...
027ff5192b
@ -273,12 +273,12 @@ const badges = ref<Record<string, string>>({})
|
||||
|
||||
async function loadBadges() {
|
||||
try {
|
||||
const data = await fetch('/supplier/inquiry/page?page=1&limit=1', {
|
||||
const data = await fetch('/sys/openapi/inquiry/list?page=1&limit=1', {
|
||||
headers: { Authorization: `Bearer ${userStore.token}` },
|
||||
credentials: 'omit'
|
||||
}).then(r => r.json()).catch(() => null)
|
||||
if (data?.code === 0) {
|
||||
const total = data.data?.total ?? data.total ?? 0
|
||||
const total = data.total ?? data.data?.length ?? 0
|
||||
badges.value['询价管理'] = String(total)
|
||||
}
|
||||
} catch {}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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(async () => {
|
||||
try { await httpPost('/other/feedback/delete', { id: row.id }); ElMessage.success('已删除'); load() }
|
||||
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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,17 +72,14 @@ 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 }
|
||||
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 || '操作失败') })
|
||||
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
|
||||
editVisible.value = false
|
||||
load()
|
||||
}
|
||||
function onDelete(row: Help) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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,17 +85,14 @@ 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 }
|
||||
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 || '操作失败') })
|
||||
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
|
||||
editVisible.value = false
|
||||
load()
|
||||
}
|
||||
function onDelete(row: Lunbo) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -89,9 +89,8 @@ const FALLBACK_STATUS = [
|
||||
*/
|
||||
async function loadRecentInquiries(): Promise<Inquiry[]> {
|
||||
try {
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 5 })
|
||||
const data = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
if (!data.length) throw new Error('inquiry list empty')
|
||||
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 5 })
|
||||
if (!Array.isArray(data)) throw new Error('inquiry list not array')
|
||||
return data.slice(0, 5).map((it: any) => {
|
||||
const s = it.apprStatus === 0 ? 'pending'
|
||||
: it.apprStatus === 1 ? 'quoting'
|
||||
@ -128,14 +127,13 @@ async function loadRecentInquiries(): Promise<Inquiry[]> {
|
||||
*/
|
||||
async function loadStats(): Promise<Stat[]> {
|
||||
try {
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 500 })
|
||||
const data = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
if (!data.length) throw new Error('inquiry list empty')
|
||||
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 500 })
|
||||
if (!Array.isArray(data)) throw new Error('inquiry list not array')
|
||||
|
||||
const total = Number(resp?.total || data.length)
|
||||
const pending = data.filter((it: any) => it.apprStatus === 0 || it.status === 0).length
|
||||
const quoting = data.filter((it: any) => it.apprStatus === 1 || it.status === 1).length
|
||||
const done = data.filter((it: any) => it.apprStatus === 2 || it.status === 2).length
|
||||
const total = data.length
|
||||
const pending = data.filter((it: any) => it.apprStatus === 0).length
|
||||
const quoting = data.filter((it: any) => it.apprStatus === 1).length
|
||||
const done = data.filter((it: any) => it.apprStatus === 2).length
|
||||
|
||||
return [
|
||||
{ label: '询价总数', value: String(total), delta: '', trend: 'up', icon: 'ChatDotRound' },
|
||||
@ -223,8 +221,8 @@ onMounted(async () => {
|
||||
// 拉一次全量算图表 + 较昨日
|
||||
let allInquiries: any[] = []
|
||||
try {
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 500 })
|
||||
allInquiries = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
allInquiries = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 500 })
|
||||
if (!Array.isArray(allInquiries)) allInquiries = []
|
||||
} catch { allInquiries = [] }
|
||||
|
||||
const isLive = allInquiries.length > 0
|
||||
|
||||
@ -96,34 +96,11 @@ const inquiryId = computed(() => String(route.params.id || ''))
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const resp: any = await httpGet('/supplier/inquiry/getById', { 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 }
|
||||
}
|
||||
await new Promise(r => setTimeout(r, 200))
|
||||
detail.value = { ...FALLBACK, id: inquiryId.value }
|
||||
} catch {
|
||||
detail.value = { ...FALLBACK, id: inquiryId.value }
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
} finally { loading.value = false }
|
||||
}
|
||||
|
||||
function fmtDate(s: any): string {
|
||||
|
||||
@ -74,13 +74,12 @@ async function load() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
||||
const data = await httpGet<any>('/sys/openapi/inquiry/list', {
|
||||
page: page.value,
|
||||
limit: limit.value,
|
||||
...(filters.value.status ? { status: filters.value.status } : {})
|
||||
})
|
||||
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
|
||||
const arr = Array.isArray(data) ? data : []
|
||||
list.value = arr.map((it: any) => ({
|
||||
id: String(it.id ?? ''),
|
||||
customer: it.inquiryEnterpriseName || it.customer || it.customerName || '--',
|
||||
@ -90,6 +89,7 @@ async function load() {
|
||||
time: it.publishDate || it.createDate || it.time,
|
||||
raw: it
|
||||
}))
|
||||
total.value = arr.length + (page.value - 1) * limit.value
|
||||
// 各状态计数 (基于当前页结果)
|
||||
stats.all = list.value.length
|
||||
list.value.forEach(r => { stats[r.status] = (stats[r.status] || 0) + 1 })
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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(async () => {
|
||||
try { await httpPost('/other/groupbuy/update', { id: row.id, status: newStatus }); ElMessage.success(`${newStatus === 1 ? '启用' : '停用'}成功`); load() }
|
||||
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
|
||||
ElMessageBox.confirm(`确认${newStatus === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success(`${newStatus === 1 ? '启用' : '停用'}成功 (mock)`)
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onDelete(row: Groupbuy) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onBatchDelete() {
|
||||
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的活动'); return }
|
||||
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 || '批量删除失败') }
|
||||
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已批量删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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(async () => {
|
||||
try { await httpPost('/other/seckill/updateSeckill', { id: row.id, status: newStatus }); ElMessage.success(`${newStatus === 0 ? '启用' : '停用'}成功`); load() }
|
||||
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
|
||||
ElMessageBox.confirm(`确认${newStatus === 0 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success(`${newStatus === 0 ? '启用' : '停用'}成功 (mock)`)
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onDelete(row: Seckill) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onBatchDelete() {
|
||||
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的活动'); return }
|
||||
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 || '批量删除失败') }
|
||||
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个活动?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已批量删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
*/
|
||||
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'
|
||||
@ -85,18 +84,15 @@ 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 }
|
||||
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 || '操作失败') })
|
||||
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
|
||||
editVisible.value = false
|
||||
load()
|
||||
}
|
||||
function onShowRichText(content: string) { richTextContent.value = content; richTextVisible.value = true }
|
||||
function onDelete(row: TextConfig) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.code}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { httpGet, httpPost } from '@/utils/request'
|
||||
import { httpGet } 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(async () => {
|
||||
try { await httpPost('/supplier/coupon/updateCoupon', { id: row.id, onShelf: next }); ElMessage.success(`${next === 1 ? '启用' : '停用'}成功`); load() }
|
||||
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
|
||||
ElMessageBox.confirm(`确认${next === 1 ? '启用' : '停用'}「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success(`${next === 1 ? '启用' : '停用'}成功 (mock)`)
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onDelete(row: Coupon) {
|
||||
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 || '删除失败') }
|
||||
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onBatchDelete() {
|
||||
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的券'); return }
|
||||
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 || '批量删除失败') }
|
||||
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 张券?`, '提示', { type: 'warning' }).then(() => {
|
||||
ElMessage.success('已批量删除 (mock)')
|
||||
load()
|
||||
}).catch(() => {})
|
||||
}
|
||||
function onShowRecords(row: Coupon) {
|
||||
|
||||
@ -100,14 +100,13 @@ export const useInquiryStore = defineStore('inquiry', () => {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
||||
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', {
|
||||
page: page.value,
|
||||
limit: limit.value,
|
||||
...(statusFilter.value ? { status: statusFilter.value } : {})
|
||||
})
|
||||
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
list.value = arr.map(normalizeInquiry)
|
||||
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
|
||||
list.value = (Array.isArray(data) ? data : []).map(normalizeInquiry)
|
||||
total.value = list.value.length + (page.value - 1) * limit.value // 简化 total(后端不返)
|
||||
isLive.value = true
|
||||
lastFetchedAt.value = Date.now()
|
||||
} catch (e: any) {
|
||||
@ -124,7 +123,7 @@ export const useInquiryStore = defineStore('inquiry', () => {
|
||||
*/
|
||||
async function fetchOne(id: string): Promise<Inquiry | null> {
|
||||
try {
|
||||
const data = await httpGet<any>('/supplier/inquiry/getById', { id })
|
||||
const data = await httpGet<any>(`/sys/openapi/inquiry/${id}`)
|
||||
return data ? normalizeInquiry(data) : null
|
||||
} catch {
|
||||
return null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user