会员部分
This commit is contained in:
parent
6c361bc067
commit
0c7c2d89b2
@ -12,6 +12,8 @@ export interface PersonVO {
|
|||||||
familyid: string // 家庭组号
|
familyid: string // 家庭组号
|
||||||
familyrelation: number // 家庭关系:1-主号,2-兄弟,3-父亲,4-母亲,5-子女,6-其他
|
familyrelation: number // 家庭关系:1-主号,2-兄弟,3-父亲,4-母亲,5-子女,6-其他
|
||||||
isvip: number // 是否会员:0-否,1-是
|
isvip: number // 是否会员:0-否,1-是
|
||||||
|
vipstarttime: string // VIP开通时间
|
||||||
|
vipendtime: string // VIP到期时间
|
||||||
idcard: string // 身份证号
|
idcard: string // 身份证号
|
||||||
createtime: string // 创建时间
|
createtime: string // 创建时间
|
||||||
updatetime: string // 更新时间
|
updatetime: string // 更新时间
|
||||||
|
@ -41,21 +41,27 @@
|
|||||||
<el-table
|
<el-table
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="memberList"
|
:data="memberList"
|
||||||
:show-overflow-tooltip="true"
|
|
||||||
>
|
>
|
||||||
<el-table-column label="姓名" align="center" prop="name" />
|
<el-table-column label="编号" align="center" prop="id" width="100"/>
|
||||||
<el-table-column label="手机号" align="center" prop="phone" />
|
<el-table-column label="姓名" align="center" prop="name" width="100"/>
|
||||||
<el-table-column label="VIP状态" align="center" prop="vipStatus" >
|
<el-table-column label="手机号" align="center" prop="phone" width="200"/>
|
||||||
|
<el-table-column label="VIP状态" align="center" prop="isvip" width="100" >
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="scope.row.vipStatus ? 'success' : 'info'">
|
<el-tag :type="scope.row.isvip === 1 ? 'success' : 'info'">
|
||||||
{{ scope.row.vipStatus ? '已开通' : '未开通' }}
|
{{ scope.row.isvip === 1 ? '已开通' : '未开通' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="地址" align="center" prop="address" />
|
<el-table-column label="地址" align="center" prop="address" />
|
||||||
<el-table-column label="到期时间" align="center" prop="vipExpireDate" >
|
<el-table-column label="剩余天数" align="center" prop="vipendtime" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.vipStatus" class="text-primary">{{ scope.row.vipExpireDate }}</span>
|
<span v-if="scope.row.isvip === 1" class="text-primary">{{ calculateRemainingDays(scope.row.vipendtime, scope.row.vipstarttime) }}</span>
|
||||||
|
<span v-else class="text-gray-400">-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="到期时间" align="center" prop="vipendtime" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.isvip === 1" class="text-primary">{{ formatDate(scope.row.vipendtime) }}</span>
|
||||||
<span v-else class="text-gray-400">-</span>
|
<span v-else class="text-gray-400">-</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -63,7 +69,7 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex items-center justify-center">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!scope.row.vipStatus"
|
v-if="scope.row.isvip === 0"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@ -71,24 +77,24 @@
|
|||||||
>
|
>
|
||||||
<Icon icon="ep:video-play" />开通会员
|
<Icon icon="ep:video-play" />开通会员
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<template v-else>
|
||||||
v-else
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleRecharge(scope.row)"
|
@click="handleRecharge(scope.row)"
|
||||||
>
|
>
|
||||||
<Icon icon="ep:refresh" />续费
|
<Icon icon="ep:refresh" />续费
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.vipStatus"
|
type="danger"
|
||||||
type="danger"
|
link
|
||||||
link
|
size="small"
|
||||||
size="small"
|
@click="handleCancel(scope.row)"
|
||||||
@click="handleCancel(scope.row)"
|
>
|
||||||
>
|
<Icon icon="ep:close" />取消会员
|
||||||
<Icon icon="ep:close" />取消会员
|
</el-button>
|
||||||
</el-button>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -122,19 +128,18 @@
|
|||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import RechargeDialog from './components/RechargeDialog.vue'
|
import RechargeDialog from './components/RechargeDialog.vue'
|
||||||
import PasswordVerifyDialog from './components/PasswordVerifyDialog.vue'
|
import { PersonApi } from '@/api/person'
|
||||||
|
import { getUserProfile } from '@/api/system/user/profile'
|
||||||
|
|
||||||
// 会员列表数据
|
// 会员列表数据
|
||||||
const memberList = ref([])
|
const memberList = ref([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
|
const userProfile = ref()
|
||||||
// 查询参数
|
// 查询参数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
name: undefined,
|
|
||||||
vipStatus: undefined
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const queryFormRef = ref()
|
const queryFormRef = ref()
|
||||||
@ -146,52 +151,61 @@ const passwordVerifyVisible = ref(false)
|
|||||||
// 当前选中的会员
|
// 当前选中的会员
|
||||||
const currentMember = ref(null)
|
const currentMember = ref(null)
|
||||||
|
|
||||||
// 模拟测试数据
|
// 计算剩余天数
|
||||||
const mockMembers = [
|
const calculateRemainingDays = (endTime, startTime) => {
|
||||||
{
|
if (!endTime || !startTime) return '-'
|
||||||
id: 1,
|
const end = new Date(endTime)
|
||||||
name: '张三',
|
const start = new Date(startTime)
|
||||||
phone: '13800138000',
|
const now = new Date()
|
||||||
vipStatus: true,
|
|
||||||
vipExpireDate: '2024-12-31'
|
// 计算总天数
|
||||||
},
|
const totalDays = Math.ceil((end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24))
|
||||||
{
|
// 计算剩余天数
|
||||||
id: 2,
|
const remainingDays = Math.ceil((end.getTime() - now.getTime()) / (1000 * 60 * 60 * 24))
|
||||||
name: '李四',
|
|
||||||
phone: '13800138001',
|
return remainingDays > 0 ? `${remainingDays}天` : '已过期'
|
||||||
vipStatus: false,
|
}
|
||||||
vipExpireDate: ''
|
|
||||||
},
|
// 格式化日期
|
||||||
{
|
const formatDate = (date) => {
|
||||||
id: 3,
|
if (!date) return '-'
|
||||||
name: '王五',
|
return new Date(date).toLocaleDateString('zh-CN', {
|
||||||
phone: '13800138002',
|
year: 'numeric',
|
||||||
vipStatus: true,
|
month: '2-digit',
|
||||||
vipExpireDate: '2024-06-30'
|
day: '2-digit',
|
||||||
}
|
hour: '2-digit',
|
||||||
]
|
minute: '2-digit'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取会员列表
|
// 获取会员列表
|
||||||
const getList = () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
setTimeout(() => {
|
try {
|
||||||
// 模拟搜索过滤
|
//首先获取用户信息
|
||||||
let filteredList = [...mockMembers]
|
userProfile.value = await getUserProfile()
|
||||||
if (queryParams.name) {
|
const res = await PersonApi.getPersonPage({
|
||||||
filteredList = filteredList.filter(m => m.name.includes(queryParams.name))
|
pageNo: queryParams.pageNo,
|
||||||
|
pageSize: queryParams.pageSize,
|
||||||
|
orgid: userProfile.value.dept.id
|
||||||
|
})
|
||||||
|
// 检查返回的数据结构
|
||||||
|
if (res) {
|
||||||
|
memberList.value = res.list
|
||||||
|
total.value = res.total
|
||||||
|
console.log(memberList.value)
|
||||||
|
} else {
|
||||||
|
memberList.value = []
|
||||||
|
total.value = 0
|
||||||
}
|
}
|
||||||
if (queryParams.vipStatus !== undefined) {
|
} catch (error) {
|
||||||
filteredList = filteredList.filter(m => m.vipStatus === queryParams.vipStatus)
|
console.error('获取会员列表失败:', error)
|
||||||
}
|
ElMessage.error('获取会员列表失败')
|
||||||
|
memberList.value = []
|
||||||
// 模拟分页
|
total.value = 0
|
||||||
const start = (queryParams.pageNo - 1) * queryParams.pageSize
|
} finally {
|
||||||
const end = start + queryParams.pageSize
|
|
||||||
memberList.value = filteredList.slice(start, end)
|
|
||||||
total.value = filteredList.length
|
|
||||||
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 500)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索按钮操作
|
// 搜索按钮操作
|
||||||
|
Loading…
Reference in New Issue
Block a user