feat(custom): i

This commit is contained in:
2023-09-08 10:29:31 +08:00
parent 3b3cb7ba34
commit 363270378a
60 changed files with 1234 additions and 1342 deletions

View File

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

View File

@@ -0,0 +1,80 @@
<template>
<!-- <div> -->
<CommonPage show-footer :title="$route.title">
<n-data-table
:loading="loading"
:columns="columns"
:data="data"
:pagination="pagination"
:bordered="false"
remote
/>
</CommonPage>
<!-- </div> -->
</template>
<script setup>
import api from './api'
const loading = ref(false)
const columns = ref([
{
title: 'ID',
key: 'ID',
align: 'center',
},
{
title: '商品名称',
key: 'goods_name',
align: 'center',
},
{
title: '用户名称',
key: 'user_name',
align: 'center',
},
{
title: '获取积分',
key: 'number',
align: 'center',
},
])
const data = ref([])
const pagination = ref({
page: 1,
pageSize: 10,
itemCount: 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.getList({
pageNum: pagination.value.page,
pageSize: pagination.value.pageSize,
})
console.log(res)
data.value = res.data.data || []
pagination.value.itemCount = res.data.total
} catch (error) {
$message.error(error.msg)
}
loading.value = false
}
</script>
<style lang="scss" scoped></style>