Compare commits

..

No commits in common. "f0b8b6cee863fecf35d4c0c894c1b887559d155b" and "857cec429050d31ae2326a888148f57c759542ce" have entirely different histories.

25 changed files with 170 additions and 509 deletions

View File

@ -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 {}

View File

@ -123,7 +123,6 @@ export const MENU_LABELS: MenuLabel[] = [
{ url: 'other/supplierBrand', label: '品牌管理', icon: 'Star', path: '/other/brand', sort: 709 },
{ url: 'other/groupbuy', label: '拼团活动', icon: 'GoodsFilled', path: '/other/groupbuy', sort: 710 },
{ url: 'other/seckill', label: '秒杀活动', icon: 'Lightning', path: '/other/seckill', sort: 711 },
{ url: 'other/priceFormulaVariable', label: '价格公式变量', icon: 'SetUp', path: '/supplier/priceFormulaVariable', sort: 713 },
{ url: 'other/information', label: '资讯列表', icon: 'Document', path: '/other/information', sort: 712 },
// ===== 基础设施(message/job/oss) =====

View File

@ -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(() => {})
}

View File

@ -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' ? '新增成功' : '修改成功')
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
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(() => {})
}

View File

@ -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' ? '新增成功' : '修改成功')
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
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(() => {})
}

View File

@ -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

View File

@ -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 {
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 {
@ -136,9 +113,9 @@ function inquiryInfo(s: number) { return INQUIRY_STATUS_MAP[s] || { label: `状
function onBack() { router.push('/inquiry') }
function onDownloadFile(url: string, name: string) { if (url) ElMessage.info(`下载: ${name || url}`) }
function onExportPriceComparison() { ElMessage.info('导出功能开发中') }
function onViewQuotation(row: Quotation) { ElMessage.info(`查看报价: ${row.quotationEnterpriseName} (请前往询价管理)`) }
function onQuote(row: Quotation) { ElMessage.info('请前往前台发起报价') }
function onExportPriceComparison() { ElMessage.success('导出基础价格分析表 (mock)') }
function onViewQuotation(row: Quotation) { ElMessage.info(`查看报价: ${row.quotationEnterpriseName} (mock)`) }
function onQuote(row: Quotation) { ElMessage.info('发起报价 (mock)') }
onMounted(load)
watch(inquiryId, load)

View File

@ -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 })

View File

@ -265,12 +265,9 @@ const FALLBACK: OrderDetail = {
async function load() {
loading.value = true
try {
const resp: any = await httpGet('/sys/openapi/order/info', { orderId: orderId.value })
if (resp && resp.orderId) {
detail.value = { ...FALLBACK, ...resp, id: resp.id || orderId.value, orderCode: resp.orderId }
} else {
// 端点 /sys/openapi/order/info?id= 后端 400, 用 fallback (老 vue 用 /order/info/{id} 同 400, 显示 fallback)
await new Promise(r => setTimeout(r, 200))
detail.value = { ...FALLBACK, id: orderId.value, orderCode: orderId.value }
}
} catch (e) {
detail.value = { ...FALLBACK, id: orderId.value, orderCode: orderId.value }
} finally {
@ -312,18 +309,18 @@ function invoiceInfo(s: number) { return INVOICE_STATUS_MAP[s] || { label: `状
function onBack() { router.push('/order') }
function onCancelOrder() {
ElMessageBox.confirm('确认取消此订单?', '提示', { type: 'warning' }).then(() => {
ElMessage.info('请前往前台取消订单')
ElMessage.success('订单已取消 (mock)')
}).catch(() => {})
}
function onPay() { ElMessage.info('请前往前台完成支付') }
function onShip() { ElMessage.info('请前往供应商端发货') }
function onConfirmReceipt() { ElMessage.info('请前往前台确认收货') }
function onApplyRefund() { ElMessage.info('请前往售后管理处理') }
function onComment() { ElMessage.info('请前往前台评价') }
function onExport() { ElMessage.info('导出功能开发中') }
function onPrint() { window.print() }
function onPay() { ElMessage.info('跳支付 (mock)') }
function onShip() { ElMessage.info('发货 (mock)') }
function onConfirmReceipt() { ElMessage.success('已确认收货 (mock)') }
function onApplyRefund() { ElMessage.info('申请退款 (mock)') }
function onComment() { ElMessage.info('评价 (mock)') }
function onExport() { ElMessage.success('导出订单 (mock)') }
function onPrint() { ElMessage.success('打印订单 (mock)') }
function onDownloadFile(url: string) { if (url) ElMessage.info(`下载: ${url}`) }
function onUploadInvoice() { ElMessage.info('请前往前台上传发票') }
function onUploadInvoice() { ElMessage.info('上传发票 (mock)') }
onMounted(load)
watch(orderId, load)

View File

@ -192,15 +192,15 @@ function onSelectionChange(rows: Order[]) { selection.value = rows }
function onStatusTabChange(status: string) { filters.status = status; onSearch() }
function onViewDetail(row: Order) { router.push(`/order/${row.id}`) }
function onPay(row: Order) { ElMessage.info('请前往前台完成支付') }
function onShip(row: Order) { ElMessage.info('请前往供应商端发货') }
function onConfirmReceipt(row: Order) { ElMessage.info('请前往前台确认收货') }
function onRefund(row: Order) { ElMessage.info('请前往售后管理处理退款') }
function onCancel(row: Order) { ElMessage.info('请前往前台取消订单') }
function onPrint(row: Order) { window.print() }
function onPay(row: Order) { ElMessage.success(`付款 ${row.orderNo} (mock)`); load() }
function onShip(row: Order) { ElMessage.success(`发货 ${row.orderNo} (mock)`); load() }
function onConfirmReceipt(row: Order) { ElMessage.success(`确认收货 ${row.orderNo} (mock)`); load() }
function onRefund(row: Order) { ElMessage.success(`退款 ${row.orderNo} (mock)`); load() }
function onCancel(row: Order) { ElMessage.success(`取消 ${row.orderNo} (mock)`); load() }
function onPrint(row: Order) { ElMessage.info(`打印 ${row.orderNo} (mock)`) }
function onExportSelected() {
if (!selection.value.length) { ElMessage.warning('请先选择订单'); return }
ElMessage.info('导出功能开发中')
ElMessage.success(`导出 ${selection.value.length} 个订单 (mock)`)
}
onMounted(load)

View File

@ -10,7 +10,7 @@
*/
import { ref, reactive, onMounted, computed } 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 DataTable from '@/components/DataTable/DataTable.vue'
@ -143,23 +143,23 @@ function onStatusTab(v: string) { statusTab.value = v; page.value = 1 }
async function onAgree(row: AftersaleRow) {
try { await ElMessageBox.confirm(`确认通过售后申请「${row.afterSalesOrderId}」?`, '提示', { type: 'warning' }) } catch { return }
try { await httpPost('/order/orderAfterSale/confirmOrderRefund', { afterSalesOrderId: row.afterSalesOrderId, status: 3 }); ElMessage.success('已通过'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
row.status = 3
ElMessage.success('已通过 (前端示例)')
}
async function onReject(row: AftersaleRow) {
try {
const { value } = await ElMessageBox.prompt('请填写拒绝原因', '拒绝售后', { inputPlaceholder: '原因', confirmButtonText: '拒绝', cancelButtonText: '取消' })
try { await httpPost('/order/orderAfterSale/confirmOrderRefund', { afterSalesOrderId: row.afterSalesOrderId, status: 4, reason: value }); ElMessage.success('已拒绝'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
row.status = 4
row.reason = (value || '已拒绝').trim()
ElMessage.success('已拒绝 (前端示例)')
} catch {}
}
async function onComplete(row: AftersaleRow) {
try { await ElMessageBox.confirm(`确认完成售后「${row.afterSalesOrderId}」?`, '提示', { type: 'success' }) } catch { return }
try { await httpPost('/order/orderAfterSale/completeOrder', { afterSalesOrderId: row.afterSalesOrderId }); ElMessage.success('已完成'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
row.status = 6
ElMessage.success('已标记完成')
}
function onView(row: AftersaleRow) {
ElMessage.info(`售后单号: ${row.afterSalesOrderId}`)
ElMessage.info(`打开售后详情 ${row.afterSalesOrderId}`)
}
function onExport() {
ElMessage.success('已发起导出 (前端示例, 共 ' + filtered.value.length + ' 条)')

View File

@ -14,7 +14,7 @@
*/
import { ref, reactive, onMounted, computed } 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 DataTable from '@/components/DataTable/DataTable.vue'
@ -161,8 +161,7 @@ function onSearch() {
function onStatusTab(v: string) { statusTab.value = v; page.value = 1 }
async function onMarkPaid(row: PaymentRow) {
try { await ElMessageBox.confirm(`确认「${row.id}」该款项标记为已支付?`, '提示', { type: 'warning' }) } catch { return }
try { await httpPost('/order/orderrefund/updatePayStatus', { id: row.id, payStatus: 1 }); ElMessage.success('已标记'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
ElMessage.success('已标记 (前端示例)')
}
function onViewOrder(row: PaymentRow) {
ElMessage.info(`打开订单 ${row.orderId}`)

View File

@ -12,7 +12,7 @@
*/
import { ref, reactive, onMounted, computed } 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 DataTable from '@/components/DataTable/DataTable.vue'
@ -141,18 +141,20 @@ function onStatusTab(v: string) { statusTab.value = v; page.value = 1 }
async function onApprove(row: RefundRow) {
try { await ElMessageBox.confirm(`确认通过退款申请「${row.id}」?`, '提示', { type: 'warning' }) } catch { return }
try { await httpPost('/order/orderrefund/updatePayStatus', { id: row.id, payStatus: 2 }); ElMessage.success('已通过'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
row.refundStatus = 2
row.refundTime = new Date().toLocaleString('zh-CN')
ElMessage.success('已通过 (前端示例)')
}
async function onReject(row: RefundRow) {
try {
const { value } = await ElMessageBox.prompt('请填写拒绝原因', '拒绝退款', { inputPlaceholder: '原因', confirmButtonText: '拒绝', cancelButtonText: '取消' })
try { await httpPost('/order/orderrefund/updatePayStatus', { id: row.id, payStatus: 3, remark: value }); ElMessage.success('已拒绝'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
row.refundStatus = 3
row.remark = (value || '已拒绝').trim()
ElMessage.success('已拒绝 (前端示例)')
} catch {}
}
function onView(row: RefundRow) {
ElMessage.info(`退款单号: ${row.id}`)
ElMessage.info(`打开退款详情 ${row.id}`)
}
function onExport() {
ElMessage.success('已发起导出 (前端示例, 共 ' + filtered.value.length + ' 条)')

View File

@ -14,7 +14,7 @@
*/
import { ref, onMounted, reactive, computed } 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'
@ -129,33 +129,26 @@ function onEdit(row: Category) {
}
function onSubmitEdit() {
if (!editForm.name.trim()) { ElMessage.warning('请填写分类名'); return }
const ep = editMode.value === 'add' ? '/other/category/save' : '/other/category/update'
httpPost(ep, { ...editForm, type: 2 }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
editVisible.value = false
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
function onDelete(row: Category) {
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该分类下有子分类, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/category/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该分类下有子分类, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
}).catch(() => {})
}
function onMove(row: Category, dir: 1 | 2) {
httpPost('/other/category/moveCategory', { id: row.id, moveType: dir }).then(() => {
ElMessage.success(`${dir === 1 ? '上移' : '下移'}成功`)
ElMessage.success(`${dir === 1 ? '上移' : '下移'}成功 (mock)`)
load()
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
}
function onSelectionChange(rows: Category[]) { selection.value = rows }
function onBatchDelete() {
if (selection.value.length === 0) { ElMessage.warning('请先选择要删除的分类'); return }
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个分类?`, '提示', { type: 'warning' }).then(async () => {
try {
for (const s of selection.value) { await httpPost('/other/category/delete', { id: s.id }) }
ElMessage.success(`已批量删除 ${selection.value.length} 个`); load()
} catch (e: any) { ElMessage.error(e?.msg || '批量删除失败'); load() }
ElMessageBox.confirm(`确认批量删除选中的 ${selection.value.length} 个分类?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已批量删除 (mock)')
load()
}).catch(() => {})
}

View File

@ -7,8 +7,7 @@
* 字段: id/name/type/supplierId/enterpriseId/createTime
*/
import { onMounted, ref, computed, reactive } from 'vue'
import { httpGet, httpPost } from '@/utils/request'
import { ElMessage, ElMessageBox } from 'element-plus'
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'
@ -67,31 +66,12 @@ function fmtTime(s?: string | null) {
return s
}
const editVisible = ref(false)
const editForm = reactive({ id: '', name: '', type: 2 })
function onAdd() { Object.assign(editForm, { id: '', name: '', type: 2 }); editVisible.value = true }
function onSubmitEdit() {
if (!editForm.name.trim()) { ElMessage.warning('请填写单位名称'); return }
const ep = editForm.id ? '/other/goodunit/update' : '/other/goodunit/save'
httpPost(ep, { ...editForm }).then(() => {
ElMessage.success(editForm.id ? '修改成功' : '新增成功'); editVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '操作失败'))
}
function onDelete(row: any) {
ElMessageBox.confirm(`确认删除「${row.name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/other/goodunit/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
onMounted(load)
</script>
<template>
<div class="rr-page">
<PageHeader title="商品单位" :sub="`商品计量单位管理 (共 ${list.length} 个, 筛选后 ${filtered.length} 个)`">
<el-button type="primary" @click="onAdd">新增单位</el-button>
</PageHeader>
<PageHeader title="商品单位" :sub="`商品计量单位管理 (共 ${list.length} 个, 筛选后 ${filtered.length} 个)`" />
<SearchBar
v-model:filters="filters"
@ -111,8 +91,7 @@ onMounted(load)
{ prop: 'type', label: '类型', width: 100, slot: 'type' },
{ prop: 'supplierId', label: '供应商ID', width: 120 },
{ prop: 'enterpriseId', label: '企业ID', width: 120 },
{ prop: 'createTime', label: '创建时间', width: 180, slot: 'createTime' },
{ prop: 'action', label: '操作', width: 120, slot: 'action' }
{ prop: 'createTime', label: '创建时间', width: 180, slot: 'createTime' }
]"
:data="filtered"
:loading="loading"
@ -134,23 +113,8 @@ onMounted(load)
<template #createTime="{ row }">
<span class="rr-time">{{ fmtTime(row.createTime) }}</span>
</template>
<template #action="{ row }">
<span class="rr-actions">
<el-link type="danger" @click="onDelete(row)">删除</el-link>
</span>
</template>
</DataTable>
</div>
<el-dialog v-model="editVisible" title="新增单位" width="400px">
<el-form label-width="80px">
<el-form-item label="名称" required><el-input v-model="editForm.name" placeholder="如: 吨" /></el-form-item>
</el-form>
<template #footer>
<el-button @click="editVisible = false">取消</el-button>
<el-button type="primary" @click="onSubmitEdit">保存</el-button>
</template>
</el-dialog>
</div>
</template>

View File

@ -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(() => {})
}

View File

@ -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(() => {})
}

View File

@ -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' ? '新增成功' : '修改成功')
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
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(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(() => {})
}

View File

@ -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'
@ -80,46 +80,29 @@ function onPageChange(p: number) { page.value = p; load() }
function onLimitChange(l: number) { limit.value = l; load() }
function onSelectionChange(rows: Coupon[]) { selection.value = rows }
const editVisible = ref(false)
const editMode = ref<'add' | 'edit'>('add')
const editForm = reactive<any>({ name: '', type: 1, fullMoney: 0, deductedMoney: 0, quantity: 0, rebate: 1, limitCollar: 1, expirationDate: '' })
function onAdd() {
editMode.value = 'add'
Object.assign(editForm, { id: '', name: '', type: 1, fullMoney: 0, deductedMoney: 0, quantity: 0, rebate: 1, limitCollar: 1, expirationDate: '' })
editVisible.value = true
}
function onAdd() { ElMessage.info('新增优惠券弹窗 (mock) - 待 add-or-update 接入') }
function onEdit(row: Coupon) {
if (row.sourceType !== 2) { ElMessage.warning('只有平台券可编辑'); return }
editMode.value = 'edit'
Object.assign(editForm, JSON.parse(JSON.stringify(row)))
editVisible.value = true
}
function onSubmitEdit() {
if (!editForm.name?.trim()) { ElMessage.warning('请填写券名称'); return }
const ep = editMode.value === 'add' ? '/supplier/coupon/saveCoupon' : '/supplier/coupon/updateCoupon'
httpPost(ep, { ...editForm, sourceType: 2 }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功'); editVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '操作失败'))
ElMessage.info(`编辑「${row.name}」 (mock)`)
}
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) {
@ -232,27 +215,6 @@ onMounted(load)
<el-button @click="recordVisible = false">关闭</el-button>
</template>
</el-dialog>
<el-dialog v-model="editVisible" :title="editMode === 'add' ? '新增优惠券' : '编辑优惠券'" width="520px">
<el-form label-width="100px">
<el-form-item label="券名称" required><el-input v-model="editForm.name" placeholder="如: 满100减20" /></el-form-item>
<el-form-item label="类型">
<el-radio-group v-model="editForm.type">
<el-radio :value="1">满减券</el-radio>
<el-radio :value="2">折扣券</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="满"><el-input-number v-model="editForm.fullMoney" :min="0" :precision="2" /></el-form-item>
<el-form-item label="减/折"><el-input-number v-model="editForm.deductedMoney" :min="0" :precision="2" /></el-form-item>
<el-form-item label="发放数量"><el-input-number v-model="editForm.quantity" :min="0" /></el-form-item>
<el-form-item label="限领"><el-input-number v-model="editForm.limitCollar" :min="1" /></el-form-item>
<el-form-item label="到期日期"><el-input v-model="editForm.expirationDate" placeholder="如: 2026-12-31" /></el-form-item>
</el-form>
<template #footer>
<el-button @click="editVisible = false">取消</el-button>
<el-button type="primary" @click="onSubmitEdit">保存</el-button>
</template>
</el-dialog>
</div>
</template>

View File

@ -294,23 +294,23 @@ async function onDelete(row: Good) {
function onBatchCheck() {
if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return }
ElMessageBox.confirm(`确认批量通过 ${selection.value.length} 个商品?`, '提示', { type: 'success' }).then(async () => {
try { for (const s of selection.value) { await httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 2, checkOpinion: '批量审核通过' }) } ElMessage.success(`批量审核通过 ${selection.value.length} 个`); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量审核失败'); load() }
ElMessageBox.confirm(`确认批量通过 ${selection.value.length} 个商品?`, '提示', { type: 'success' }).then(() => {
ElMessage.success('批量审核通过 (mock)')
load()
}).catch(() => {})
}
function onBatchReject() { if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return } batchRejectDialogVisible.value = true }
function onSubmitBatchReject() {
if (!batchRejectForm.reason.trim()) { ElMessage.warning('请填写驳回原因'); return }
Promise.all(selection.value.map(s => httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 3, checkOpinion: batchRejectForm.reason }))).then(() => {
ElMessage.success(`已驳回 ${selection.value.length} 个商品`); batchRejectDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量驳回失败'))
ElMessage.success(`已驳回 ${selection.value.length} 个商品 (mock)`)
batchRejectDialogVisible.value = false
load()
}
function onBatchOnShelf() {
if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return }
ElMessageBox.confirm(`确认批量下架 ${selection.value.length} 个商品?`, '提示', { type: 'warning' }).then(async () => {
try { for (const s of selection.value) { await httpPost('/supplier/good/goodOnShelf', { id: s.id, onShelf: 0 }) } ElMessage.success(`批量下架 ${selection.value.length} 个`); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量下架失败'); load() }
ElMessageBox.confirm(`确认批量下架 ${selection.value.length} 个商品?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('批量下架成功 (mock)')
load()
}).catch(() => {})
}
function onShowBatchCategoryDialog() {
@ -318,19 +318,19 @@ function onShowBatchCategoryDialog() {
batchCategoryDialogVisible.value = true
}
function onSubmitBatchCategory() {
Promise.all(selection.value.map(s => httpPost('/supplier/good/updateSupplierGood', { id: s.id, firstCategoryId: categoryForm.firstCategoryId }))).then(() => {
ElMessage.success(`已修改 ${selection.value.length} 个商品分类`); batchCategoryDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量改分类失败'))
ElMessage.success(`已修改 ${selection.value.length} 个商品分类 (mock)`)
batchCategoryDialogVisible.value = false
load()
}
function onDeleteBatch() {
if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return }
ElMessageBox.confirm(`确认删除 ${selection.value.length} 个商品?`, '提示', { type: 'warning' }).then(async () => {
try { for (const s of selection.value) { await httpPost('/supplier/good/deleteSupplierGood', { id: s.id }) } ElMessage.success('批量删除成功'); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败'); load() }
ElMessageBox.confirm(`确认删除 ${selection.value.length} 个商品?`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('批量删除成功 (mock)')
load()
}).catch(() => {})
}
function onExport() { ElMessage.info('导出功能开发中') }
function onAdd() { ElMessage.info('新增商品请前往供应商端') }
function onExport() { ElMessage.success('导出商品 (mock)') }
function onAdd() { ElMessage.info('新增商品 (mock)') }
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
</script>

View File

@ -1,171 +0,0 @@
<script setup lang="ts">
/**
* F006 价格公式变量管理
* 走 /supplier/supplierGoodPriceFormulaVariable/page (2026-08-08 探测: 200, total=5)
* CRUD: save/update/delete + updateValue
* 字段: id/var_key/var_name/var_unit/current_value/source_type/source_code/formula/sort/status/create_date
*/
import { ref, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
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'
interface FormulaVar {
id: string
var_key: string
var_name: string
var_unit: string
current_value: number
source_type: number
source_code: string
formula: string
sort: number
status: number
create_date: any
raw: any
}
const SOURCE_MAP: Record<number, { label: string; type: string }> = {
1: { label: '手动输入', type: 'info' },
2: { label: '自动采集', type: 'success' },
3: { label: '公式计算', type: 'warning' }
}
const STATUS_MAP: Record<number, { label: string; type: string }> = {
0: { label: '禁用', type: 'danger' },
1: { label: '启用', type: 'success' }
}
const list = ref<FormulaVar[]>([])
const total = ref(0)
const loading = ref(false)
const query = reactive({ page: 1, limit: 10 })
const filters = reactive({ var_name: '' })
const editVisible = ref(false)
const editMode = ref<'add' | 'edit'>('add')
const editForm = reactive<FormulaVar>({ id: '', var_key: '', var_name: '', var_unit: '', current_value: 0, source_type: 1, source_code: '', formula: '', sort: 0, status: 1, create_date: null, raw: {} })
const columns = [
{ prop: 'id', label: 'ID', width: 60 },
{ prop: 'var_name', label: '变量名称', minWidth: 120 },
{ prop: 'var_key', label: '变量标识', width: 120 },
{ prop: 'var_unit', label: '单位', width: 80 },
{ prop: 'current_value', label: '当前值', width: 120, formatter: (r: FormulaVar) => r.current_value?.toLocaleString() || '0' },
{ prop: 'source_type', label: '数据来源', width: 100, slot: 'source' },
{ prop: 'formula', label: '计算公式', minWidth: 150, formatter: (r: FormulaVar) => r.formula || '--' },
{ prop: 'sort', label: '排序', width: 60 },
{ prop: 'status', label: '状态', width: 80, slot: 'status' },
{ prop: 'create_date', label: '创建时间', width: 160, formatter: (r: FormulaVar) => fmtDate(r.create_date) }
]
function fmtDate(d: any): string {
if (!d) return '--'
if (typeof d === 'string') return d.slice(0, 19)
try { return `${d.year}-${String(d.monthValue).padStart(2,'0')}-${String(d.dayOfMonth).padStart(2,'0')} ${String(d.hour).padStart(2,'0')}:${String(d.minute).padStart(2,'0')}` } catch { return '--' }
}
async function load() {
loading.value = true
try {
const resp: any = await httpGet('/supplier/supplierGoodPriceFormulaVariable/page', { page: query.page, limit: query.limit, ...(filters.var_name ? { var_name: filters.var_name } : {}) })
list.value = (resp?.list || []).map((it: any) => ({ ...it, raw: it }))
total.value = Number(resp?.total || 0)
} catch { list.value = []; total.value = 0 } finally { loading.value = false }
}
function onSearch() { query.page = 1; load() }
function onReset() { filters.var_name = ''; query.page = 1; load() }
function onPageChange(p: number) { query.page = p; load() }
function onLimitChange(l: number) { query.limit = l; query.page = 1; load() }
function onAdd() {
editMode.value = 'add'
Object.assign(editForm, { id: '', var_key: '', var_name: '', var_unit: '', current_value: 0, source_type: 1, source_code: '', formula: '', sort: 0, status: 1, create_date: null, raw: {} })
editVisible.value = true
}
function onEdit(row: FormulaVar) {
editMode.value = 'edit'
Object.assign(editForm, JSON.parse(JSON.stringify(row)))
editVisible.value = true
}
function onSubmitEdit() {
if (!editForm.var_name.trim() || !editForm.var_key.trim()) { ElMessage.warning('请填写变量名称和标识'); return }
const ep = editMode.value === 'add' ? '/supplier/supplierGoodPriceFormulaVariable/save' : '/supplier/supplierGoodPriceFormulaVariable/updateValue'
httpPost(ep, { ...editForm }).then(() => {
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
editVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '操作失败'))
}
function onDelete(row: FormulaVar) {
ElMessageBox.confirm(`确认删除「${row.var_name}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/supplierGoodPriceFormulaVariable/delete', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
onMounted(load)
</script>
<template>
<div class="rr-page">
<PageHeader title="价格公式变量" :sub="`动态定价公式变量管理 (共 ${total} 个)`">
<el-button type="primary" @click="onAdd">新增变量</el-button>
</PageHeader>
<SearchBar v-model:filters="filters" :fields="[
{ key: 'var_name', label: '变量名称', type: 'text', placeholder: '请输入变量名称' }
]" @search="onSearch" @reset="onReset" />
<div class="rr-card">
<DataTable :columns="columns" :data="list" :borderless="true" :loading="loading" :total="total"
:page="query.page" :limit="query.limit" :show-pagination="true" :page-sizes="[10, 20, 50, 100]" row-key="id"
empty-text="暂无数据" @page-change="onPageChange" @limit-change="onLimitChange">
<template #source="{ row }">
<el-tag :type="(SOURCE_MAP[row.source_type]?.type as any) || 'info'">{{ SOURCE_MAP[row.source_type]?.label || row.source_type }}</el-tag>
</template>
<template #status="{ row }">
<el-tag :type="(STATUS_MAP[row.status]?.type as any) || 'info'">{{ STATUS_MAP[row.status]?.label || row.status }}</el-tag>
</template>
<template #action="{ row }">
<span class="rr-actions">
<el-link type="primary" @click="onEdit(row)">编辑</el-link>
<span class="rr-actions__sep">|</span>
<el-link type="danger" @click="onDelete(row)">删除</el-link>
</span>
</template>
</DataTable>
</div>
<el-dialog v-model="editVisible" :title="editMode === 'add' ? '新增变量' : '编辑变量'" width="500px">
<el-form label-width="100px">
<el-form-item label="变量名称" required><el-input v-model="editForm.var_name" placeholder="如: 铜价" /></el-form-item>
<el-form-item label="变量标识" required><el-input v-model="editForm.var_key" placeholder="如: copper_price" /></el-form-item>
<el-form-item label="单位"><el-input v-model="editForm.var_unit" placeholder="如: 元/吨" /></el-form-item>
<el-form-item label="当前值"><el-input-number v-model="editForm.current_value" :precision="2" :step="100" /></el-form-item>
<el-form-item label="数据来源">
<el-radio-group v-model="editForm.source_type">
<el-radio :value="1">手动输入</el-radio>
<el-radio :value="2">自动采集</el-radio>
<el-radio :value="3">公式计算</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采集编码" v-if="editForm.source_type === 2"><el-input v-model="editForm.source_code" placeholder="如: copper" /></el-form-item>
<el-form-item label="计算公式" v-if="editForm.source_type === 3"><el-input v-model="editForm.formula" placeholder="如: copper_price * 1.05" /></el-form-item>
<el-form-item label="排序"><el-input-number v-model="editForm.sort" :min="0" /></el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="editForm.status">
<el-radio :value="1">启用</el-radio>
<el-radio :value="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="editVisible = false">取消</el-button>
<el-button type="primary" @click="onSubmitEdit">保存</el-button>
</template>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
</style>

View File

@ -12,7 +12,7 @@
*/
import { ref, onMounted, reactive, computed } 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 ListTabs from '@/components/ListTabs/ListTabs.vue'
@ -191,64 +191,21 @@ function onStatusTab(v: string) { filters.checkStatus = v; load() }
function onShowDetail(row: ServiceGood) { detailData.value = row; detailVisible.value = true }
function onShowCheck(row: ServiceGood) { checkData.value = row; checkDialogVisible.value = true }
function onSubmitCheck() {
if (!checkForm.checkOpinion.trim()) { ElMessage.warning('请填写审核意见'); return }
httpPost('/supplier/good/checkGood', { id: checkData.value?.id, checkStatus: checkForm.checkStatus, checkOpinion: checkForm.checkOpinion }).then(() => {
ElMessage.success('审核成功'); checkDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '审核失败'))
}
function onOnShelf(row: ServiceGood) {
ElMessageBox.confirm(`确认${row.onShelf === 1 ? '下架' : '上架'}?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/good/goodOnShelf', { id: row.id, onShelf: row.onShelf === 1 ? 0 : 1 }); ElMessage.success('操作成功'); load() }
catch (e: any) { ElMessage.error(e?.msg || '操作失败') }
}).catch(() => {})
}
function onSubmitCheck() { if (!checkForm.checkOpinion.trim()) { ElMessage.warning('请填写审核意见'); return } ElMessage.success('审核成功 (mock)'); checkDialogVisible.value = false; load() }
function onOnShelf(row: ServiceGood) { ElMessageBox.confirm(`确认${row.onShelf === 1 ? '下架' : '上架'}?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('操作成功 (mock)'); load() }).catch(() => {}) }
function onShowCategory(row: ServiceGood) { categoryData.value = row; categoryDialogVisible.value = true }
function onSubmitCategory() {
httpPost('/supplier/good/updateSupplierGood', { id: categoryData.value?.id }).then(() => {
ElMessage.success('分类已修改'); categoryDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '操作失败'))
}
function onDelete(row: ServiceGood) {
ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/supplier/good/deleteSupplierGood', { id: row.id }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
}).catch(() => {})
}
function onSubmitCategory() { ElMessage.success('分类已修改 (mock)'); categoryDialogVisible.value = false; load() }
function onDelete(row: ServiceGood) { ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('已删除 (mock)'); load() }).catch(() => {}) }
function onBatchCheck() {
if (!selection.value.length) return ElMessage.warning('请先选择')
Promise.all(selection.value.map(s => httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 2, checkOpinion: '批量审核通过' }))).then(() => {
ElMessage.success(`批量审核通过 ${selection.value.length} 个`); load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量审核失败'))
}
function onBatchCheck() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessage.success(`批量审核通过 ${selection.value.length} 个 (mock)`); load() }
function onBatchReject() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchRejectDialogVisible.value = true }
function onSubmitBatchReject() {
Promise.all(selection.value.map(s => httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 3, checkOpinion: batchRejectForm.reason }))).then(() => {
ElMessage.success(`批量驳回 ${selection.value.length} 个`); batchRejectDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量驳回失败'))
}
function onBatchOnShelf() {
if (!selection.value.length) return ElMessage.warning('请先选择')
httpPost('/supplier/good/goodOnShelfBatch', selection.value.map(s => ({ id: s.id, onShelf: s.onShelf === 1 ? 0 : 1 }))).then(() => {
ElMessage.success(`批量操作 ${selection.value.length} 个`); load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量操作失败'))
}
function onSubmitBatchReject() { ElMessage.success(`批量驳回 ${selection.value.length} 个 (mock)`); batchRejectDialogVisible.value = false; load() }
function onBatchOnShelf() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessage.success(`批量上下架 ${selection.value.length} 个 (mock)`); load() }
function onShowBatchCategory() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchCategoryDialogVisible.value = true }
function onSubmitBatchCategory() {
Promise.all(selection.value.map(s => httpPost('/supplier/good/updateSupplierGood', { id: s.id }))).then(() => {
ElMessage.success(`批量改分类 ${selection.value.length} 个`); batchCategoryDialogVisible.value = false; load()
}).catch((e: any) => ElMessage.error(e?.msg || '批量改分类失败'))
}
function onDeleteBatch() {
if (!selection.value.length) return ElMessage.warning('请先选择')
ElMessageBox.confirm(`确认批量删除 ${selection.value.length} 个?`, '提示', { type: 'warning' }).then(async () => {
try { for (const s of selection.value) { await httpPost('/supplier/good/deleteSupplierGood', { id: s.id }) } ElMessage.success('批量删除成功'); load() }
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败'); load() }
}).catch(() => {})
}
function onExport() { ElMessage.info('导出功能开发中') }
function onAdd() { ElMessage.info('新增服务商品请前往供应商端') }
function onSubmitBatchCategory() { ElMessage.success(`批量改分类 ${selection.value.length} 个 (mock)`); batchCategoryDialogVisible.value = false; load() }
function onDeleteBatch() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessageBox.confirm(`确认批量删除 ${selection.value.length} 个?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('批量删除成功 (mock)'); load() }).catch(() => {}) }
function onExport() { ElMessage.success('导出服务商品 (mock)') }
function onAdd() { ElMessage.info('新增服务商品 (mock)') }
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
</script>

View File

@ -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 TableActions from '@/components/TableActions/TableActions.vue'
@ -97,17 +97,14 @@ function onEdit(row: Region) {
}
function onSubmitEdit() {
if (!editForm.name.trim()) { ElMessage.warning('请填写名称'); return }
const ep = editMode.value === 'add' ? '/sys/region' : '/sys/region'
const method = editMode.value === 'add' ? 'POST' : 'PUT'
httpPost(ep, { ...editForm, _method: method }).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: Region) {
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该节点下有子节点, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(async () => {
try { await httpPost('/sys/region/' + row.id, { _method: 'DELETE' }); ElMessage.success('已删除'); load() }
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该节点下有子节点, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(() => {
ElMessage.success('已删除 (mock)')
load()
}).catch(() => {})
}

View File

@ -244,8 +244,6 @@ const routes: RouteRecordRaw[] = [
{ path: '/other/textconfig', component: () => import('@/modules/other/textconfig/TextconfigListView.vue'), meta: { title: '常量配置' } },
{ path: '/other/groupbuy', component: () => import('@/modules/other/groupbuy/GroupbuyListView.vue'), meta: { title: '拼团活动' } },
{ path: '/other/seckill', component: () => import('@/modules/other/seckill/SeckillListView.vue'), meta: { title: '秒杀活动' } },
// 价格公式变量
{ path: '/supplier/priceFormulaVariable', component: () => import('@/modules/supplier/priceformula/PriceFormulaVariableListView.vue'), meta: { title: '价格公式变量' } },
// supplier 2 个
{ path: '/supplier/coupon', component: () => import('@/modules/supplier/coupon/CouponListView.vue'), meta: { title: '优惠券' } }, // W7: 独立 view, 走 /supplier/coupon/page 真 API
{ path: '/supplier/promoter', component: () => import('@/modules/supplier/promoter/PromoterListView.vue'), meta: { title: '推广员管理' } },

View File

@ -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