新增办公类线上会员礼遇

This commit is contained in:
Leo_Ding 2025-09-10 15:40:37 +08:00
parent 16fb5d9cdf
commit 5bd6fd0c6a
7 changed files with 417 additions and 2 deletions

View File

@ -31,6 +31,7 @@ const equiteEnum = new EnumManager([
{value:11,name:'aiya'}, {value:11,name:'aiya'},
{value:12,name:'yllvs'}, {value:12,name:'yllvs'},
{value:15,name:'birth'}, {value:15,name:'birth'},
{value:43,name:'bglxshyly'},
{value:16,name:'ycjztg'}, {value:16,name:'ycjztg'},
{value:17,name:'ycqwsc'}, {value:17,name:'ycqwsc'},
@ -41,6 +42,7 @@ const equiteEnum = new EnumManager([
{value:23,name:'ycyllvs'}, {value:23,name:'ycyllvs'},
{value:24,name:'ycparentchild'}, {value:24,name:'ycparentchild'},
{value:28,name:'ycbirth'}, {value:28,name:'ycbirth'},
{value:53,name:'ycbglxshyly'},
// {value:4,name:'life'}, // {value:4,name:'life'},
// {value:5,name:'lvyou'}, // {value:5,name:'lvyou'},
// {value:6,name:'caizhai'}, // {value:6,name:'caizhai'},

View File

@ -100,5 +100,7 @@ export default {
activityOrder:'活动报名列表', activityOrder:'活动报名列表',
banner:'首页轮播图', banner:'首页轮播图',
equiteMgt:'权益兑换', equiteMgt:'权益兑换',
equiteType:'权益兑换类型' equiteType:'权益兑换类型',
bglxshyly:'办公类线上会员礼遇',
ycbglxshyly:'办公类线上会员礼遇'
} }

View File

@ -146,6 +146,17 @@ export default [
permission: '*', permission: '*',
}, },
}, },
{
path: 'bglxshyly',
name: 'bglxshyly',
component: 'equite/bglxshyly/index.vue',
meta: {
title: '办公类线上会员礼遇',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
], ],
}, },
] ]

View File

@ -105,6 +105,17 @@ export default [
keepAlive: true, keepAlive: true,
permission: '*', permission: '*',
}, },
},
{
path: 'ycbglxshyly',
name: 'ycbglxshyly',
component: 'ycequite/ycbglxshyly/index.vue',
meta: {
title: '办公类线上会员礼遇',
isMenu: true,
keepAlive: true,
permission: '*',
},
}, },
], ],
}, },

View File

@ -0,0 +1,194 @@
<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="name">
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></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 value="enabled">启用</a-select-option>
<a-select-option value="disabled">停用</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: 1000 }" @change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'createdAt'">
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
</template>
<template v-if="column.dataIndex === 'expireAt'">
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
</template>
<template v-if="'action' === column.key">
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
<a-tooltip>
<template #title>核销</template>
<edit-outlined /> </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 { config } from '@/config'
import { usePagination } from '@/hooks'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import { equiteEnum } from "@/enums/useEnum"
import { commonColumns } from "@/utils/commonColumns"
defineOptions({
name: 'bglxshyly',
})
const { t } = useI18n() // t
const columns = commonColumns
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.productOrder
.getProjectList({
pageSize,
current: current,
channel: 'product',
productId: equiteEnum.getValue('bglxshyly'),
...searchFormData.value,
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
hideLoading()
}
}
/**核销 */
const checkHandler = (record) => {
Modal.confirm({
title: '即将核销是否继续',
content: t('button.confirm'),
okText: t('button.confirm'),
onOk:async () => {
const params = {
...record,
status: 'success'
}
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
// throw new Error()
})
if (config('http.code.success') === success) {
// resolve()
message.success('核销成功')
await getPageList()
}
},
})
}
/**
* 删除
*/
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.productOrder.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>

View File

@ -213,7 +213,7 @@ async function handleEdit(record = {}) {
hideSpining() hideSpining()
formData.value = { ...data } formData.value = { ...data }
formData.value.expireAt = data?.expireAt ? dayjs(data?.expireAt) : '' formData.value.expireAt = data?.expireAt ? dayjs(data?.expireAt) : ''
editorContent.value = decryptString(data.details) editorContent.value = data.details ? decryptString(data.details) : ''
// editorContent.value = data.details // editorContent.value = data.details
if (data.cover && data.cover.length > 0) { if (data.cover && data.cover.length > 0) {
formData.value.fileList = [data.cover].map(item => config('http.apiBasic') + item) formData.value.fileList = [data.cover].map(item => config('http.apiBasic') + item)
@ -275,6 +275,7 @@ function handleOk() {
}) })
break break
case 'edit': case 'edit':
console.log(params)
result = await apis.equiteMgt.updateItem(formData.value.id, params).catch(() => { result = await apis.equiteMgt.updateItem(formData.value.id, params).catch(() => {
throw new Error(error) throw new Error(error)
}) })

View File

@ -0,0 +1,194 @@
<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="name">
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></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 value="enabled">启用</a-select-option>
<a-select-option value="disabled">停用</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: 1000 }" @change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'createdAt'">
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
</template>
<template v-if="column.dataIndex === 'expireAt'">
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
</template>
<template v-if="'action' === column.key">
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
<a-tooltip>
<template #title>核销</template>
<edit-outlined /> </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 { config } from '@/config'
import { usePagination } from '@/hooks'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import { equiteEnum } from "@/enums/useEnum"
import { commonColumns } from "@/utils/commonColumns"
defineOptions({
name: 'ycbglxshyly',
})
const { t } = useI18n() // t
const columns = commonColumns
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.productOrder
.getProjectList({
pageSize,
current: current,
channel: 'product',
productId: equiteEnum.getValue('ycbglxshyly'),
...searchFormData.value,
})
.catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
hideLoading()
}
}
/**核销 */
const checkHandler = (record) => {
Modal.confirm({
title: '即将核销是否继续',
content: t('button.confirm'),
okText: t('button.confirm'),
onOk:async () => {
const params = {
...record,
status: 'success'
}
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
// throw new Error()
})
if (config('http.code.success') === success) {
// resolve()
message.success('核销成功')
await getPageList()
}
},
})
}
/**
* 删除
*/
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.productOrder.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>