功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -185,6 +185,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* OrdersView page script.
|
||||
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
|
||||
*/
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { orderApi } from '../../api/order'
|
||||
@@ -198,18 +202,23 @@ import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
|
||||
|
||||
const { isMobile } = useAdminViewport()
|
||||
const orders = ref<any[]>([])
|
||||
/** loading is a reactive state variable used by the template and event handlers. */
|
||||
const loading = ref(false)
|
||||
const currentOrder = ref<any | null>(null)
|
||||
const currentUserType = ref<number | null>(null)
|
||||
/** keyword is a reactive state variable used by the template and event handlers. */
|
||||
const keyword = ref('')
|
||||
const statusFilter = ref<'all' | string>('all')
|
||||
const { hasPermission, loadUserPermissions } = usePermission()
|
||||
|
||||
/** detailVisible is a reactive state variable used by the template and event handlers. */
|
||||
const detailVisible = computed({
|
||||
get: () => !!currentOrder.value,
|
||||
set: value => { if (!value) currentOrder.value = null }
|
||||
})
|
||||
/** canProcessOrders is a reactive state variable used by the template and event handlers. */
|
||||
const canProcessOrders = computed(() => hasPermission('order:process'))
|
||||
/** isArtist is a reactive state variable used by the template and event handlers. */
|
||||
const isArtist = computed(() => currentUserType.value === 3)
|
||||
const statusOptions = [
|
||||
{ label: '全部状态', value: 'all' },
|
||||
@@ -218,6 +227,7 @@ const statusOptions = [
|
||||
{ label: '已取消', value: '3' }
|
||||
]
|
||||
|
||||
/** filteredOrders is a reactive state variable used by the template and event handlers. */
|
||||
const filteredOrders = computed(() => {
|
||||
const keywordValue = keyword.value.trim().toLowerCase()
|
||||
return orders.value.filter(order => {
|
||||
@@ -259,6 +269,7 @@ const itemColumns = [
|
||||
{ title: '总价', key: 'totalPrice', width: 100 }
|
||||
]
|
||||
|
||||
/** statusColor is a local helper used by this page script. */
|
||||
const statusColor = (status: number) => {
|
||||
if (status === 1) return 'orange'
|
||||
if (status === 2) return 'green'
|
||||
@@ -266,6 +277,7 @@ const statusColor = (status: number) => {
|
||||
return 'default'
|
||||
}
|
||||
|
||||
/** resolveCurrentUserType is a local helper used by this page script. */
|
||||
const resolveCurrentUserType = () => {
|
||||
const cached = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
|
||||
if (!cached) {
|
||||
@@ -279,6 +291,7 @@ const resolveCurrentUserType = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** loadOrders is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadOrders = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -290,6 +303,7 @@ const loadOrders = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** process is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const process = async (orderId: IdType, status: number) => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
@@ -305,6 +319,7 @@ const process = async (orderId: IdType, status: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
/** noop is a local helper used by this page script. */
|
||||
const noop = () => {}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
Reference in New Issue
Block a user