admin_new P0/P1 全量补齐合并 (5项差距 + CRUD真API + 询价/看板真数据) #3
@ -273,12 +273,12 @@ const badges = ref<Record<string, string>>({})
|
||||
|
||||
async function loadBadges() {
|
||||
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}` },
|
||||
credentials: 'omit'
|
||||
}).then(r => r.json()).catch(() => null)
|
||||
if (data?.code === 0) {
|
||||
const total = data.total ?? data.data?.length ?? 0
|
||||
const total = data.data?.total ?? data.total ?? 0
|
||||
badges.value['询价管理'] = String(total)
|
||||
}
|
||||
} catch {}
|
||||
|
||||
@ -89,8 +89,9 @@ const FALLBACK_STATUS = [
|
||||
*/
|
||||
async function loadRecentInquiries(): Promise<Inquiry[]> {
|
||||
try {
|
||||
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 5 })
|
||||
if (!Array.isArray(data)) throw new Error('inquiry list not array')
|
||||
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')
|
||||
return data.slice(0, 5).map((it: any) => {
|
||||
const s = it.apprStatus === 0 ? 'pending'
|
||||
: it.apprStatus === 1 ? 'quoting'
|
||||
@ -127,13 +128,14 @@ async function loadRecentInquiries(): Promise<Inquiry[]> {
|
||||
*/
|
||||
async function loadStats(): Promise<Stat[]> {
|
||||
try {
|
||||
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 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 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
|
||||
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
|
||||
|
||||
return [
|
||||
{ label: '询价总数', value: String(total), delta: '', trend: 'up', icon: 'ChatDotRound' },
|
||||
@ -221,8 +223,8 @@ onMounted(async () => {
|
||||
// 拉一次全量算图表 + 较昨日
|
||||
let allInquiries: any[] = []
|
||||
try {
|
||||
allInquiries = await httpGet<any[]>('/sys/openapi/inquiry/list', { page: 1, limit: 500 })
|
||||
if (!Array.isArray(allInquiries)) allInquiries = []
|
||||
const resp = await httpGet<any>('/supplier/inquiry/page', { page: 1, limit: 500 })
|
||||
allInquiries = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||
} catch { allInquiries = [] }
|
||||
|
||||
const isLive = allInquiries.length > 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user