完善按钮和详情权限
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m29s

This commit is contained in:
sexygoat
2026-02-28 11:04:32 +08:00
parent 4470a4ef04
commit ce1032c7f9
23 changed files with 984 additions and 760 deletions

View File

@@ -273,6 +273,7 @@
<script setup lang="ts">
import { h } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { OrderService, CardService, DeviceService, PackageManageService } from '@/api/modules'
import { ElMessage, ElMessageBox, ElTag } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
@@ -296,10 +297,12 @@
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
import { formatDateTime } from '@/utils/business/format'
import { RoutesAlias } from '@/router/routesAlias'
defineOptions({ name: 'OrderList' })
const { t } = useI18n()
const router = useRouter()
const { hasAuth } = useAuth()
const loading = ref(false)
@@ -855,16 +858,10 @@
}
// 查看订单详情
const showOrderDetail = async (row: Order) => {
try {
const res = await OrderService.getOrderById(row.id)
if (res.code === 0) {
currentOrder.value = res.data
detailDialogVisible.value = true
}
} catch (error) {
console.error(error)
}
const showOrderDetail = (row: Order) => {
router.push({
path: `${RoutesAlias.OrderList}/detail/${row.id}`
})
}
// 取消订单
@@ -904,10 +901,15 @@
const items: MenuItemType[] = []
items.push({ key: 'detail', label: '详情' })
if (hasAuth('orders:view_detail')) {
items.push({ key: 'detail', label: '详情' })
}
// 只有待支付和已支付的订单可以取消
if (currentRow.value.payment_status === 1 || currentRow.value.payment_status === 2) {
// 只有待支付和已支付的订单可以删除
if (
(currentRow.value.payment_status === 1 || currentRow.value.payment_status === 2) &&
hasAuth('orders:delete')
) {
items.push({ key: 'cancel', label: '删除' })
}