admin_new P0/P1 全量补齐合并 (5项差距 + CRUD真API + 询价/看板真数据) #3
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
import { ref, onMounted, reactive, computed } from 'vue'
|
import { ref, onMounted, reactive, computed } 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'
|
||||||
@ -129,26 +129,33 @@ function onEdit(row: Category) {
|
|||||||
}
|
}
|
||||||
function onSubmitEdit() {
|
function onSubmitEdit() {
|
||||||
if (!editForm.name.trim()) { ElMessage.warning('请填写分类名'); return }
|
if (!editForm.name.trim()) { ElMessage.warning('请填写分类名'); return }
|
||||||
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
|
const ep = editMode.value === 'add' ? '/other/category/save' : '/other/category/update'
|
||||||
|
httpPost(ep, { ...editForm, type: 2 }).then(() => {
|
||||||
|
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
|
||||||
editVisible.value = false
|
editVisible.value = false
|
||||||
load()
|
load()
|
||||||
|
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
|
||||||
}
|
}
|
||||||
function onDelete(row: Category) {
|
function onDelete(row: Category) {
|
||||||
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该分类下有子分类, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(() => {
|
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该分类下有子分类, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(async () => {
|
||||||
ElMessage.success('已删除 (mock)')
|
try { await httpPost('/other/category/delete', { id: row.id }); ElMessage.success('已删除'); load() }
|
||||||
load()
|
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
function onMove(row: Category, dir: 1 | 2) {
|
function onMove(row: Category, dir: 1 | 2) {
|
||||||
ElMessage.success(`${dir === 1 ? '上移' : '下移'}成功 (mock)`)
|
httpPost('/other/category/moveCategory', { id: row.id, moveType: dir }).then(() => {
|
||||||
|
ElMessage.success(`${dir === 1 ? '上移' : '下移'}成功`)
|
||||||
load()
|
load()
|
||||||
|
}).catch((e: any) => { ElMessage.error(e?.msg || '操作失败') })
|
||||||
}
|
}
|
||||||
function onSelectionChange(rows: Category[]) { selection.value = rows }
|
function onSelectionChange(rows: Category[]) { selection.value = rows }
|
||||||
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 {
|
||||||
load()
|
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() }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -294,23 +294,23 @@ async function onDelete(row: Good) {
|
|||||||
|
|
||||||
function onBatchCheck() {
|
function onBatchCheck() {
|
||||||
if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return }
|
if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return }
|
||||||
ElMessageBox.confirm(`确认批量通过 ${selection.value.length} 个商品?`, '提示', { type: 'success' }).then(() => {
|
ElMessageBox.confirm(`确认批量通过 ${selection.value.length} 个商品?`, '提示', { type: 'success' }).then(async () => {
|
||||||
ElMessage.success('批量审核通过 (mock)')
|
try { for (const s of selection.value) { await httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 2, checkOpinion: '批量审核通过' }) } ElMessage.success(`批量审核通过 ${selection.value.length} 个`); load() }
|
||||||
load()
|
catch (e: any) { ElMessage.error(e?.msg || '批量审核失败'); load() }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
function onBatchReject() { if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return } batchRejectDialogVisible.value = true }
|
function onBatchReject() { if (selection.value.length === 0) { ElMessage.warning('请先选择商品'); return } batchRejectDialogVisible.value = true }
|
||||||
function onSubmitBatchReject() {
|
function onSubmitBatchReject() {
|
||||||
if (!batchRejectForm.reason.trim()) { ElMessage.warning('请填写驳回原因'); return }
|
if (!batchRejectForm.reason.trim()) { ElMessage.warning('请填写驳回原因'); return }
|
||||||
ElMessage.success(`已驳回 ${selection.value.length} 个商品 (mock)`)
|
Promise.all(selection.value.map(s => httpPost('/supplier/good/checkGood', { id: s.id, checkStatus: 3, checkOpinion: batchRejectForm.reason }))).then(() => {
|
||||||
batchRejectDialogVisible.value = false
|
ElMessage.success(`已驳回 ${selection.value.length} 个商品`); batchRejectDialogVisible.value = false; load()
|
||||||
load()
|
}).catch((e: any) => ElMessage.error(e?.msg || '批量驳回失败'))
|
||||||
}
|
}
|
||||||
function onBatchOnShelf() {
|
function onBatchOnShelf() {
|
||||||
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 { for (const s of selection.value) { await httpPost('/supplier/good/goodOnShelf', { id: s.id, onShelf: 0 }) } ElMessage.success(`批量下架 ${selection.value.length} 个`); load() }
|
||||||
load()
|
catch (e: any) { ElMessage.error(e?.msg || '批量下架失败'); load() }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
function onShowBatchCategoryDialog() {
|
function onShowBatchCategoryDialog() {
|
||||||
@ -318,19 +318,19 @@ function onShowBatchCategoryDialog() {
|
|||||||
batchCategoryDialogVisible.value = true
|
batchCategoryDialogVisible.value = true
|
||||||
}
|
}
|
||||||
function onSubmitBatchCategory() {
|
function onSubmitBatchCategory() {
|
||||||
ElMessage.success(`已修改 ${selection.value.length} 个商品分类 (mock)`)
|
Promise.all(selection.value.map(s => httpPost('/supplier/good/updateSupplierGood', { id: s.id, firstCategoryId: categoryForm.firstCategoryId }))).then(() => {
|
||||||
batchCategoryDialogVisible.value = false
|
ElMessage.success(`已修改 ${selection.value.length} 个商品分类`); batchCategoryDialogVisible.value = false; load()
|
||||||
load()
|
}).catch((e: any) => ElMessage.error(e?.msg || '批量改分类失败'))
|
||||||
}
|
}
|
||||||
function onDeleteBatch() {
|
function onDeleteBatch() {
|
||||||
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 { for (const s of selection.value) { await httpPost('/supplier/good/deleteSupplierGood', { id: s.id }) } ElMessage.success('批量删除成功'); load() }
|
||||||
load()
|
catch (e: any) { ElMessage.error(e?.msg || '批量删除失败'); load() }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
function onExport() { ElMessage.success('导出商品 (mock)') }
|
function onExport() { ElMessage.info('导出功能开发中') }
|
||||||
function onAdd() { ElMessage.info('新增商品 (mock)') }
|
function onAdd() { ElMessage.info('新增商品请前往供应商端') }
|
||||||
|
|
||||||
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
|
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
import { ref, onMounted, reactive, computed } from 'vue'
|
import { ref, onMounted, reactive, computed } 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 ListTabs from '@/components/ListTabs/ListTabs.vue'
|
import ListTabs from '@/components/ListTabs/ListTabs.vue'
|
||||||
@ -191,21 +191,64 @@ function onStatusTab(v: string) { filters.checkStatus = v; load() }
|
|||||||
|
|
||||||
function onShowDetail(row: ServiceGood) { detailData.value = row; detailVisible.value = true }
|
function onShowDetail(row: ServiceGood) { detailData.value = row; detailVisible.value = true }
|
||||||
function onShowCheck(row: ServiceGood) { checkData.value = row; checkDialogVisible.value = true }
|
function onShowCheck(row: ServiceGood) { checkData.value = row; checkDialogVisible.value = true }
|
||||||
function onSubmitCheck() { if (!checkForm.checkOpinion.trim()) { ElMessage.warning('请填写审核意见'); return } ElMessage.success('审核成功 (mock)'); checkDialogVisible.value = false; load() }
|
function onSubmitCheck() {
|
||||||
function onOnShelf(row: ServiceGood) { ElMessageBox.confirm(`确认${row.onShelf === 1 ? '下架' : '上架'}?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('操作成功 (mock)'); load() }).catch(() => {}) }
|
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 onShowCategory(row: ServiceGood) { categoryData.value = row; categoryDialogVisible.value = true }
|
function onShowCategory(row: ServiceGood) { categoryData.value = row; categoryDialogVisible.value = true }
|
||||||
function onSubmitCategory() { ElMessage.success('分类已修改 (mock)'); categoryDialogVisible.value = false; load() }
|
function onSubmitCategory() {
|
||||||
function onDelete(row: ServiceGood) { ElMessageBox.confirm(`确认删除「${row.title}」?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('已删除 (mock)'); load() }).catch(() => {}) }
|
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 onBatchCheck() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessage.success(`批量审核通过 ${selection.value.length} 个 (mock)`); load() }
|
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 onBatchReject() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchRejectDialogVisible.value = true }
|
function onBatchReject() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchRejectDialogVisible.value = true }
|
||||||
function onSubmitBatchReject() { ElMessage.success(`批量驳回 ${selection.value.length} 个 (mock)`); batchRejectDialogVisible.value = false; load() }
|
function onSubmitBatchReject() {
|
||||||
function onBatchOnShelf() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessage.success(`批量上下架 ${selection.value.length} 个 (mock)`); load() }
|
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 onShowBatchCategory() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchCategoryDialogVisible.value = true }
|
function onShowBatchCategory() { if (!selection.value.length) return ElMessage.warning('请先选择'); batchCategoryDialogVisible.value = true }
|
||||||
function onSubmitBatchCategory() { ElMessage.success(`批量改分类 ${selection.value.length} 个 (mock)`); batchCategoryDialogVisible.value = false; load() }
|
function onSubmitBatchCategory() {
|
||||||
function onDeleteBatch() { if (!selection.value.length) return ElMessage.warning('请先选择'); ElMessageBox.confirm(`确认批量删除 ${selection.value.length} 个?`, '提示', { type: 'warning' }).then(() => { ElMessage.success('批量删除成功 (mock)'); load() }).catch(() => {}) }
|
Promise.all(selection.value.map(s => httpPost('/supplier/good/updateSupplierGood', { id: s.id }))).then(() => {
|
||||||
function onExport() { ElMessage.success('导出服务商品 (mock)') }
|
ElMessage.success(`批量改分类 ${selection.value.length} 个`); batchCategoryDialogVisible.value = false; load()
|
||||||
function onAdd() { ElMessage.info('新增服务商品 (mock)') }
|
}).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('新增服务商品请前往供应商端') }
|
||||||
|
|
||||||
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
|
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -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 TableActions from '@/components/TableActions/TableActions.vue'
|
import TableActions from '@/components/TableActions/TableActions.vue'
|
||||||
|
|
||||||
@ -97,14 +97,17 @@ function onEdit(row: Region) {
|
|||||||
}
|
}
|
||||||
function onSubmitEdit() {
|
function onSubmitEdit() {
|
||||||
if (!editForm.name.trim()) { ElMessage.warning('请填写名称'); return }
|
if (!editForm.name.trim()) { ElMessage.warning('请填写名称'); return }
|
||||||
ElMessage.success(editMode.value === 'add' ? '新增成功 (mock)' : '修改成功 (mock)')
|
const ep = editMode.value === 'add' ? '/sys/region' : '/sys/region'
|
||||||
editVisible.value = false
|
const method = editMode.value === 'add' ? 'POST' : 'PUT'
|
||||||
load()
|
httpPost(ep, { ...editForm, _method: method }).then(() => {
|
||||||
|
ElMessage.success(editMode.value === 'add' ? '新增成功' : '修改成功')
|
||||||
|
editVisible.value = false; load()
|
||||||
|
}).catch((e: any) => ElMessage.error(e?.msg || '操作失败'))
|
||||||
}
|
}
|
||||||
function onDelete(row: Region) {
|
function onDelete(row: Region) {
|
||||||
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该节点下有子节点, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(() => {
|
ElMessageBox.confirm(`确认删除「${row.name}」? ${row.children?.length ? '该节点下有子节点, 将一起删除!' : ''}`, '提示', { type: 'warning' }).then(async () => {
|
||||||
ElMessage.success('已删除 (mock)')
|
try { await httpPost('/sys/region/' + row.id, { _method: 'DELETE' }); ElMessage.success('已删除'); load() }
|
||||||
load()
|
catch (e: any) { ElMessage.error(e?.msg || '删除失败') }
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user