2025-09-10
[修改]直营列表
This commit is contained in:
@@ -17,35 +17,14 @@
|
||||
<div class="search-section">
|
||||
<el-card>
|
||||
<el-form :model="searchForm" inline>
|
||||
<el-form-item label="姓名">
|
||||
<el-form-item label="关键字">
|
||||
<el-input
|
||||
v-model="searchForm.name"
|
||||
placeholder="请输入姓名"
|
||||
v-model="searchForm.search"
|
||||
placeholder="请输入姓名、用户名或手机号"
|
||||
clearable
|
||||
style="width: 250px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号">
|
||||
<el-input
|
||||
v-model="searchForm.phone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
style="width: 250px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="等级">
|
||||
<el-select
|
||||
v-model="searchForm.level"
|
||||
placeholder="请选择等级"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
>
|
||||
<el-option label="全部" value=""/>
|
||||
<el-option label="普通" value="normal"/>
|
||||
<el-option label="VIP" value="vip"/>
|
||||
<el-option label="SVIP" value="svip"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">
|
||||
<el-icon>
|
||||
@@ -140,7 +119,7 @@
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column prop="id" label="ID"/>
|
||||
<el-table-column prop="name" label="姓名"/>
|
||||
<el-table-column prop="real_name" label="姓名"/>
|
||||
<el-table-column label="手机号">
|
||||
<template #default="{ row }">
|
||||
{{ maskPhoneNumber(row.phone) }}
|
||||
@@ -148,7 +127,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="beans_count" label="融豆数量">
|
||||
<template #default="{ row }">
|
||||
<span class="beans-amount">{{ row.beans_count }}</span>
|
||||
<span class="beans-amount">{{ Math.abs(row.balance) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="level" label="等级">
|
||||
@@ -191,7 +170,7 @@
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 直营用户 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="isEdit ? '编辑用户' : '添加直营用户'"
|
||||
@@ -234,7 +213,7 @@
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
>
|
||||
<img v-if="userForm.avatar" :src="getImageUrl(userForm.avatar)" class="avatar"/>
|
||||
<img v-if="userForm.avatarReal" :src="getImageUrl(userForm.avatar)" class="avatar"/>
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus/>
|
||||
</el-icon>
|
||||
@@ -249,6 +228,7 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -281,9 +261,7 @@ const directSaleStats = ref({
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
name: '',
|
||||
phone: '',
|
||||
level: ''
|
||||
search: '',
|
||||
})
|
||||
|
||||
// 分页信息
|
||||
@@ -316,14 +294,13 @@ const getDirectSaleList = async () => {
|
||||
const params = {
|
||||
page: pagination.page,
|
||||
size: pagination.size,
|
||||
name: searchForm.name,
|
||||
phone: searchForm.phone,
|
||||
level: searchForm.level
|
||||
search: searchForm.search,
|
||||
}
|
||||
|
||||
const response = await api.directSale.getDirectSales(params)
|
||||
directSaleList.value = response.data.data.direct_sales
|
||||
const response = await api.directSale.listUsers(params)
|
||||
directSaleList.value = response.data.data.users
|
||||
pagination.total = response.data.data.pagination.total
|
||||
directSaleStats.value = response.data.data.pagination // TODO 统计
|
||||
} catch (error) {
|
||||
directSaleList.value = [{
|
||||
id: 1,
|
||||
@@ -366,9 +343,7 @@ const handleSearch = () => {
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchForm.name = ''
|
||||
searchForm.phone = ''
|
||||
searchForm.level = ''
|
||||
searchForm.search = ''
|
||||
pagination.page = 1
|
||||
getDirectSaleList()
|
||||
}
|
||||
@@ -389,13 +364,16 @@ const handleCurrentChange = (page) => {
|
||||
// 处理提现
|
||||
const handleWithdraw = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
await ElMessageBox.prompt(
|
||||
`确定要为用户 ${row.name} 进行提现操作吗?`,
|
||||
'提现确认',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
type: 'warning',
|
||||
inputPattern:
|
||||
/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
|
||||
inputErrorMessage: 'Invalid Email',
|
||||
}
|
||||
)
|
||||
|
||||
@@ -404,7 +382,7 @@ const handleWithdraw = async (row) => {
|
||||
|
||||
// 刷新列表和统计数据
|
||||
getDirectSaleList()
|
||||
getDirectSaleStats()
|
||||
// getDirectSaleStats()
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
console.log(error)
|
||||
@@ -451,7 +429,8 @@ const userForm = reactive({
|
||||
password: '',
|
||||
avatar: '',
|
||||
invite: '',
|
||||
real_name: ''
|
||||
real_name: '',
|
||||
avatarReal: '', // 上传临时查看
|
||||
})
|
||||
const userRules = computed(() => ({
|
||||
password: [
|
||||
@@ -496,7 +475,8 @@ const beforeAvatarUpload = (file) => {
|
||||
// 头像上传成功
|
||||
const handleAvatarSuccess = (response) => {
|
||||
if (response.success) {
|
||||
userForm.avatar = response.data.url
|
||||
userForm.avatar = response.data.path
|
||||
userForm.avatarReal = response.data.url
|
||||
ElMessage.success('头像上传成功')
|
||||
} else {
|
||||
ElMessage.error('头像上传失败')
|
||||
@@ -533,7 +513,8 @@ const resetUserForm = () => {
|
||||
password: '',
|
||||
avatar: '',
|
||||
invite: '',
|
||||
real_name: ''
|
||||
real_name: '',
|
||||
avatarReal: ''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -547,11 +528,11 @@ const handleDialogClose = () => {
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
getDirectSaleList()
|
||||
getDirectSaleStats()
|
||||
// getDirectSaleStats()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
.direct-sale-container {
|
||||
padding: 20px;
|
||||
}
|
||||
@@ -646,6 +627,11 @@ onMounted(() => {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: border-color 0.3s;
|
||||
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-uploader:hover {
|
||||
|
||||
Reference in New Issue
Block a user