fix: 全面修复项目问题
后端修复: - 验证码存储与校验机制 - 订单创建事务+库存扣减 - GetStats字段名错误 - VerifyEmail改为POST - 供应商更新字段白名单 - 文件删除安全检查 - 抽奖安全随机数 - 用户管理CRUD - 订单取消/确认收货 - 工单回复 - Toggle返回新数据 - 移除死代码 前端修复: - 404兜底路由 - 401软跳转 - API层统一 - 面包屑补充banners - 国际化完善 - 购物车并行删除 - 退出清理购物车 - 供应商Dashboard数据 - 工单详情页 - 订单取消/确认收货
This commit is contained in:
@@ -15,9 +15,11 @@
|
||||
<el-table-column label="创建时间" width="180">
|
||||
<template #default="{ row }">{{ formatDate(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.edit')" width="120">
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click="$router.push(`/orders/${row.id}`)">查看</el-button>
|
||||
<el-button v-if="row.status === 'pending_payment' || row.status === 'pending_confirm'" link type="warning" size="small" @click="cancelOrder(row.id)">取消</el-button>
|
||||
<el-button v-if="row.status === 'shipped'" link type="success" size="small" @click="confirmReceipt(row.id)">确认收货</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -27,6 +29,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { orderApi } from '../../api'
|
||||
import BackNav from '../../components/BackNav.vue'
|
||||
|
||||
@@ -54,10 +57,34 @@ function formatDate(date: string) {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}`
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const res: any = await orderApi.list()
|
||||
orders.value = res.data || []
|
||||
})
|
||||
async function fetchOrders() {
|
||||
try {
|
||||
const res: any = await orderApi.list()
|
||||
orders.value = res.data || []
|
||||
} catch {
|
||||
ElMessage.error('获取订单失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelOrder(id: number) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要取消该订单吗?', '提示', { type: 'warning' })
|
||||
await orderApi.cancel(id)
|
||||
ElMessage.success('订单已取消')
|
||||
fetchOrders()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function confirmReceipt(id: number) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认已收到商品?', '提示', { type: 'info' })
|
||||
await orderApi.confirmReceipt(id)
|
||||
ElMessage.success('已确认收货')
|
||||
fetchOrders()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
onMounted(fetchOrders)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user