feat(custom): i

This commit is contained in:
2023-09-06 03:48:46 +08:00
parent 3b3cb7ba34
commit a9707c6d94
51 changed files with 2273 additions and 87 deletions

View File

@@ -0,0 +1,5 @@
import { request } from '@/utils'
export default {
getOrder: (data) => request.post('/order', data),
}

View File

@@ -0,0 +1,103 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
/>
</CommonPage>
</template>
<script setup>
import api from './api'
const loading = ref(false)
const columns = ref([
{
title: '订单号',
align: 'center',
key: 'oid',
},
{
title: '用户',
align: 'center',
key: 'user_name',
},
{
title: '商品名称',
align: 'center',
key: 'goods_name',
},
{
title: '商品价格',
align: 'center',
key: 'number',
},
{
title: '订单状态',
align: 'center',
slot: 'status',
render(row) {
switch (row.status) {
case 0:
return h('span', '待付款')
case 1:
return h('span', '待使用')
case 2:
return h('span', '已完成')
case 3:
return h('span', '已过期')
}
},
},
{
title: '操作',
align: 'center',
slot: 'action',
render(row) {
console.log(row)
},
},
])
const data = ref([])
const pagination = ref({
current: 1,
pageSize: 10,
total: 0,
onChange: (page) => {
pagination.value.page = page
getList()
},
onUpdatePageSize: (pageSize) => {
pagination.value.pageSize = pageSize
pagination.value.page = 1
getList()
},
})
onMounted(() => {
getList()
})
const getList = async () => {
loading.value = true
try {
const res = await api.getOrder({
pageNum: pagination.value.current,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data || []
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,5 @@
import { request } from '@/utils'
export default {
getPoint: (data) => request.post('/point/order', data),
}

View File

@@ -0,0 +1,103 @@
<template>
<CommonPage show-footer :title="$route.title">
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
/>
</CommonPage>
</template>
<script setup>
import api from './api'
const loading = ref(false)
const columns = ref([
{
title: '订单号',
align: 'center',
key: 'oid',
},
{
title: '用户',
align: 'center',
key: 'user_name',
},
{
title: '商品名称',
align: 'center',
key: 'goods_name',
},
{
title: '商品价格',
align: 'center',
key: 'number',
},
{
title: '订单状态',
align: 'center',
slot: 'status',
render(row) {
switch (row.status) {
case 0:
return h('span', '待付款')
case 1:
return h('span', '待使用')
case 2:
return h('span', '已完成')
case 3:
return h('span', '已过期')
}
},
},
{
title: '操作',
align: 'center',
slot: 'action',
render(row) {
console.log(row)
},
},
])
const data = ref([])
const pagination = ref({
current: 1,
pageSize: 10,
total: 0,
onChange: (page) => {
pagination.value.page = page
getList()
},
onUpdatePageSize: (pageSize) => {
pagination.value.pageSize = pageSize
pagination.value.page = 1
getList()
},
})
onMounted(() => {
getList()
})
const getList = async () => {
loading.value = true
try {
const res = await api.getPoint({
pageNum: pagination.value.current,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data || []
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
</script>
<style lang="scss" scoped></style>

30
src/views/order/route.js Normal file
View File

@@ -0,0 +1,30 @@
const Layout = () => import('@/layout/index.vue')
export default {
name: '订单管理',
path: '/order',
component: Layout,
redirect: '/order_list',
children: [
{
name: 'Orderlist',
path: 'order_list',
component: () => import('./index/index.vue'),
meta: {
title: '活动订单',
icon: 'mdi:account-multiple',
order: 10,
},
},
{
name: 'Pointlist',
path: 'point_list',
component: () => import('./point/index.vue'),
meta: {
title: '积分订单',
icon: 'mdi:account-multiple',
order: 10,
},
},
],
}