generated from Leo_Ding/web-template
权益订单,积分模块
This commit is contained in:
parent
e07bc237d8
commit
bb808aec09
14
src/apis/modules/points.js
Normal file
14
src/apis/modules/points.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/balances', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/balances/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/balances', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/balances/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/balances/${id}`)
|
||||
14
src/apis/modules/productOrders.js
Normal file
14
src/apis/modules/productOrders.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/product-orders', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/product-orders/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/product-orders', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/product-orders/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/product-orders/${id}`)
|
||||
@ -7,13 +7,21 @@ const customersEnum = new EnumManager([
|
||||
{value: 'closer', name: '意向客户'},
|
||||
{value: 'visitor', name: '游客'},
|
||||
]);
|
||||
// 创建枚举管理器实例
|
||||
// 创建区域
|
||||
const areaEnum = new EnumManager([
|
||||
{value: 1, name: '南通'},
|
||||
{value: 2, name: '盐城'}
|
||||
]);
|
||||
|
||||
// 创建权益类型
|
||||
const rightEnum = new EnumManager([
|
||||
{value: 'success', name: '已使用'},
|
||||
{value: 'checking', name: '确认中'},
|
||||
{value: 'checked', name: '待使用'},
|
||||
]);
|
||||
export {
|
||||
customersEnum,areaEnum
|
||||
customersEnum,areaEnum,rightEnum
|
||||
|
||||
}
|
||||
// // 获取整个数组
|
||||
// console.log(roleEnum.getAll());
|
||||
|
||||
@ -61,4 +61,6 @@ export default {
|
||||
rejectOrder: '确定驳回订单',
|
||||
paddOrder: '过期订单',
|
||||
erCodeList: '二维码列表',
|
||||
order:"权益订单",
|
||||
points:'积分列表'
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import userManagement from './userManagement'
|
||||
import integral from './integral'
|
||||
import regional from './regional'
|
||||
import announcement from './announcement'
|
||||
import order from './order'
|
||||
|
||||
export default [
|
||||
...home,
|
||||
@ -30,4 +31,5 @@ export default [
|
||||
...integral,
|
||||
...regional,
|
||||
...announcement,
|
||||
...order
|
||||
]
|
||||
|
||||
@ -26,9 +26,9 @@ export default [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'integraList',
|
||||
name: 'integraList',
|
||||
component: 'integral/integraList/index.vue',
|
||||
path: 'integralList',
|
||||
name: 'integralList',
|
||||
component: 'integral/integralList/index.vue',
|
||||
meta: {
|
||||
title: '积分列表',
|
||||
isMenu: true,
|
||||
@ -36,6 +36,17 @@ export default [
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'integral/points',
|
||||
name: 'points',
|
||||
component: 'integral/points/index.vue',
|
||||
meta: {
|
||||
title: '积分列表2',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
17
src/router/routes/order.js
Normal file
17
src/router/routes/order.js
Normal file
@ -0,0 +1,17 @@
|
||||
import { TableOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
export default [
|
||||
{
|
||||
path: 'order/index',
|
||||
name: 'order',
|
||||
component: 'order/index.vue',
|
||||
meta: {
|
||||
icon: TableOutlined,
|
||||
title: '订单列表',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
}
|
||||
|
||||
},
|
||||
]
|
||||
@ -1,37 +1,24 @@
|
||||
<template>
|
||||
<x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter }">
|
||||
<a-form
|
||||
:model="searchFormData"
|
||||
layout="inline">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label="$t('pages.system.announcement.form.name')"
|
||||
name="title">
|
||||
<a-input
|
||||
:placeholder="$t('pages.system.role.form.code.placeholder')"
|
||||
<a-form-item :label="$t('pages.system.announcement.form.name')" name="title">
|
||||
<a-input :placeholder="$t('pages.system.role.form.code.placeholder')"
|
||||
v-model:value="searchFormData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label="'状态'"
|
||||
name="status">
|
||||
<a-input
|
||||
:placeholder="'请输入状态'"
|
||||
v-model:value="searchFormData.status"></a-input>
|
||||
<a-form-item :label="'状态'" name="status">
|
||||
<a-input :placeholder="'请输入状态'" v-model:value="searchFormData.status"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="6">
|
||||
<a-form-item
|
||||
:label="'地区'"
|
||||
name="areaId">
|
||||
<a-input
|
||||
:placeholder="'请输入地区'"
|
||||
v-model:value="searchFormData.areaId"></a-input>
|
||||
<a-form-item :label="'地区'" name="areaId">
|
||||
<a-input :placeholder="'请输入地区'" v-model:value="searchFormData.areaId"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
@ -43,21 +30,14 @@
|
||||
<question-circle-outlined class="ml-4-1 color-placeholder" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<a-input
|
||||
:placeholder="$t('pages.system.role.form.code.placeholder')"
|
||||
v-model:value="searchFormData.code"></a-input>
|
||||
<a-input :placeholder="$t('pages.system.role.form.code.placeholder')" v-model:value="searchFormData.code"></a-input>
|
||||
</a-form-item>
|
||||
</a-col> -->
|
||||
|
||||
<a-col
|
||||
class="align-right"
|
||||
:span="6">
|
||||
<a-col class="align-right" :span="6">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button
|
||||
ghost
|
||||
type="primary"
|
||||
@click="handleSearch">
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
@ -66,41 +46,27 @@
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
<a-row
|
||||
:gutter="8"
|
||||
:wrap="false">
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button
|
||||
v-action="'add'"
|
||||
type="primary"
|
||||
@click="$refs.addDialogRef.handleCreate()">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.addDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
{{ $t('pages.system.announcement.add') }}
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="listData"
|
||||
:loading="loading"
|
||||
:pagination="paginationState"
|
||||
:scroll="{ x: 1000 }"
|
||||
@change="onTableChange">
|
||||
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered="true" :pagination="paginationState"
|
||||
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'statusType' === column.key">
|
||||
<!--状态-->
|
||||
<a-tag
|
||||
v-if="statusTypeEnum.is('enabled', record.status)"
|
||||
color="processing">
|
||||
<a-tag v-if="statusTypeEnum.is('enabled', record.status)" color="processing">
|
||||
{{ statusTypeEnum.getDesc(record.status) }}
|
||||
</a-tag>
|
||||
<!--状态-->
|
||||
<a-tag
|
||||
v-if="statusTypeEnum.is('disabled', record.status)"
|
||||
color="processing">
|
||||
<a-tag v-if="statusTypeEnum.is('disabled', record.status)" color="processing">
|
||||
{{ statusTypeEnum.getDesc(record.status) }}
|
||||
</a-tag>
|
||||
</template>
|
||||
@ -129,9 +95,7 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<add-dialog
|
||||
ref="addDialogRef"
|
||||
@ok="onOk"></add-dialog>
|
||||
<add-dialog ref="addDialogRef" @ok="onOk"></add-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
166
src/views/integral/points/index.vue
Normal file
166
src/views/integral/points/index.vue
Normal file
@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="客户姓名" name="customerName">
|
||||
<a-input placeholder="请输入姓名" v-model:value="searchFormData.customerName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-left" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 800 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<a-tag v-if="record.status === 'success'" color="#87d068">已使用</a-tag>
|
||||
<a-tag v-if="record.status === 'checking'" color="#2db7f5">确认中</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'" color="#108ee9">待使用</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import dayjs from 'dayjs'
|
||||
import { usePagination } from '@/hooks'
|
||||
// import { rightEnum} from "@/enums/useEnum"
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
defineOptions({
|
||||
name: 'points',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '客户姓名', dataIndex: 'customerName', align: 'center',width:120 },
|
||||
{ title: '变动前积分', dataIndex: 'before', align: 'center',width:100 },
|
||||
{ title: '变动后积分', dataIndex: 'before', align: 'center',width:100 },
|
||||
{ title: '变动积分', dataIndex: 'change', align: 'center',width:100 },
|
||||
{ title: '变动原因', dataIndex: 'reason', key: 'introduce',align: 'center' },
|
||||
// { title: t('button.action'), key: 'action', width: 60, align: 'center' },
|
||||
]
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.points
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.points.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
170
src/views/order/index.vue
Normal file
170
src/views/order/index.vue
Normal file
@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="客户姓名" name="customerName">
|
||||
<a-input placeholder="请输入姓名" v-model:value="searchFormData.customerName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- <a-col v-bind="colSpan">
|
||||
<a-form-item label="权益" name="projectName">
|
||||
<a-input placeholder="请输入权益" v-model:value="searchFormData.projectName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col> -->
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option v-for="item of rightEnum.getAll()" :value="item.value">{{ item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 800 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<a-tag v-if="record.status === 'success'" color="#87d068">已使用</a-tag>
|
||||
<a-tag v-if="record.status === 'checking'" color="#2db7f5">确认中</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'" color="#108ee9">待使用</a-tag>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import dayjs from 'dayjs'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { rightEnum} from "@/enums/useEnum"
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
defineOptions({
|
||||
name: 'order',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '客户姓名', dataIndex: 'customerName', align: 'center' },
|
||||
{ title: '权益', dataIndex: 'productName', align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', key: 'introduce',width:120, align: 'center' },
|
||||
// { title: t('button.action'), key: 'action', width: 60, align: 'center' },
|
||||
]
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrders
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrders.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
Loading…
x
Reference in New Issue
Block a user