trade: 分销用户管理

This commit is contained in:
owen 2023-09-08 10:59:06 +08:00
parent 1e2120806d
commit 34ce7f7ec5
2 changed files with 269 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import request from '@/config/axios'
export interface BrokerageUserVO {
id: number
brokerageUserId: number
brokerageBindTime: Date
brokerageEnabled: boolean
brokerageTime: Date
brokeragePrice: number
frozenBrokeragePrice: number
}
// 查询分销用户列表
export const getBrokerageUserPage = async (params: any) => {
return await request.get({ url: `/trade/brokerage-user/page`, params })
}
// 查询分销用户详情
export const getBrokerageUser = async (id: number) => {
return await request.get({ url: `/trade/brokerage-user/get?id=` + id })
}

View File

@ -0,0 +1,248 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="85px"
>
<el-form-item label="推广员编号" prop="brokerageUserId">
<el-input
v-model="queryParams.brokerageUserId"
placeholder="请输入推广员编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="推广资格" prop="brokerageEnabled">
<el-select
v-model="queryParams.brokerageEnabled"
class="!w-240px"
clearable
placeholder="请选择推广资格"
>
<el-option label="有" :value="true" />
<el-option label="无" :value="false" />
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="用户编号" align="center" prop="id" min-width="80px" />
<el-table-column label="头像" align="center" prop="avatar" width="70px">
<template #default="scope">
<el-avatar :src="scope.row.avatar" />
</template>
</el-table-column>
<el-table-column label="昵称" align="center" prop="nickname" min-width="80px" />
<el-table-column
label="推广用户数量(一级)"
align="center"
prop="brokerageUserCount"
min-width="110px"
/>
<el-table-column
label="推广订单数量"
align="center"
prop="brokerageOrderCount"
min-width="110px"
/>
<el-table-column
label="推广订单金额"
align="center"
prop="brokerageOrderPrice"
min-width="110px"
/>
<el-table-column label="已提现金额" align="center" prop="withdrawPrice" min-width="100px" />
<el-table-column label="已提现次数" align="center" prop="withdrawCount" min-width="100px" />
<el-table-column label="未提现金额" align="center" prop="brokeragePrice" min-width="100px" />
<el-table-column
label="冻结中佣金"
align="center"
prop="frozenBrokeragePrice"
min-width="100px"
/>
<el-table-column label="推广资格" align="center" prop="brokerageEnabled" min-width="80px">
<template #default="scope">
<el-switch
v-model="scope.row.brokerageEnabled"
active-text="有"
inactive-text="无"
inline-prompt
:disabled="!checkPermi(['trade:brokerage-user:update-brokerage-user'])"
@change="handleBrokerageEnabledChange(scope.row.id, !scope.row.brokerageEnabled)"
/>
</template>
</el-table-column>
<el-table-column
label="成为推广员时间"
align="center"
prop="brokerageTime"
:formatter="dateFormatter"
width="170px"
/>
<el-table-column label="上级推广员编号" align="center" prop="brokerageUserId" width="150px" />
<el-table-column
label="推广员绑定时间"
align="center"
prop="brokerageBindTime"
:formatter="dateFormatter"
width="170px"
/>
<el-table-column label="操作" align="center" width="150px" fixed="right">
<template #default="scope">
<el-dropdown
@command="(command) => handleCommand(command, scope.row)"
v-hasPermi="[
'trade:brokerage-user:user-query',
'trade:brokerage-user:order-query',
'trade:brokerage-user:update-brokerage-user',
'trade:brokerage-user:clear-brokerage-user'
]"
>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
command="openBrokerageUserTable"
v-if="checkPermi(['trade:brokerage-user:user-query'])"
>
推广人
</el-dropdown-item>
<el-dropdown-item
command="openBrokerageOrderTable"
v-if="checkPermi(['trade:brokerage-user:order-query'])"
>
推广订单
</el-dropdown-item>
<el-dropdown-item
command="openUpdateBindUser"
v-if="checkPermi(['trade:brokerage-user:update-brokerage-user'])"
>
修改上级推广人
</el-dropdown-item>
<el-dropdown-item
command="openClearBindUser"
v-if="checkPermi(['trade:brokerage-user:clear-brokerage-user'])"
>
清除上级推广人
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import * as BrokerageUserApi from '@/api/mall/trade/brokerage/user'
import { checkPermi } from '@/utils/permission'
defineOptions({ name: 'TradeBrokerageUser' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
brokerageUserId: null,
brokerageEnabled: null,
createTime: []
})
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await BrokerageUserApi.getBrokerageUserPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
const handleCommand = (command: string, row: BrokerageUserApi.BrokerageUserVO) => {
switch (command) {
case 'openBrokerageUserTable':
openBrokerageUserTable(row.id)
break
case 'openBrokerageOrderTable':
openBrokerageOrderTable(row.id)
break
case 'openUpdateBindUser':
openUpdateBindUser(row.id)
break
case 'openClearBindUser':
openClearBindUser(row.id)
break
}
}
/** 打开推广人列表 */
const openBrokerageUserTable = (id: number) => {}
/** 打开推广订单列表 */
const openBrokerageOrderTable = (id: number) => {}
/** 打开表单:修改上级推广人 */
const openUpdateBindUser = (id: number) => {}
/** 打开表单:清除上级推广人 */
const openClearBindUser = (id: number) => {}
/** 推广资格 开通/关闭 */
const handleBrokerageEnabledChange = (id: number, enabled: boolean) => {}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>