trade: 分销业务后台功能:清除推广员、修改推广资格

This commit is contained in:
owen 2023-09-09 14:38:46 +08:00
parent 0e2ea39591
commit 7ea3571356
2 changed files with 70 additions and 13 deletions

View File

@ -8,6 +8,8 @@ export interface BrokerageUserVO {
brokerageTime: Date brokerageTime: Date
price: number price: number
frozenPrice: number frozenPrice: number
nickname: string
} }
// 查询分销用户列表 // 查询分销用户列表
@ -19,3 +21,18 @@ export const getBrokerageUserPage = async (params: any) => {
export const getBrokerageUser = async (id: number) => { export const getBrokerageUser = async (id: number) => {
return await request.get({ url: `/trade/brokerage-user/get?id=` + id }) return await request.get({ url: `/trade/brokerage-user/get?id=` + id })
} }
// 修改推广员
export const updateBindUser = async (data: any) => {
return await request.put({ url: `/trade/brokerage-user/update-bind-user`, data })
}
// 清除推广员
export const clearBindUser = async (data: any) => {
return await request.put({ url: `/trade/brokerage-user/clear-bind-user`, data })
}
// 修改推广资格
export const updateBrokerageEnabled = async (data: any) => {
return await request.put({ url: `/trade/brokerage-user/update-brokerage-enable`, data })
}

View File

@ -104,8 +104,8 @@
active-text="有" active-text="有"
inactive-text="无" inactive-text="无"
inline-prompt inline-prompt
:disabled="!checkPermi(['trade:brokerage-user:update-brokerage-user'])" :disabled="!checkPermi(['trade:brokerage-user:update-bind-user'])"
@change="handleBrokerageEnabledChange(scope.row.id, !scope.row.brokerageEnabled)" @change="handleBrokerageEnabledChange(scope.row)"
/> />
</template> </template>
</el-table-column> </el-table-column>
@ -131,10 +131,14 @@
v-hasPermi="[ v-hasPermi="[
'trade:brokerage-user:user-query', 'trade:brokerage-user:user-query',
'trade:brokerage-user:order-query', 'trade:brokerage-user:order-query',
'trade:brokerage-user:update-brokerage-user', 'trade:brokerage-user:update-bind-user',
'trade:brokerage-user:clear-brokerage-user' 'trade:brokerage-user:clear-bind-user'
]" ]"
> >
<el-button link type="primary">
<Icon icon="ep:d-arrow-right" />
更多
</el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item <el-dropdown-item
@ -151,13 +155,15 @@
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="openUpdateBindUser" command="openUpdateBindUser"
v-if="checkPermi(['trade:brokerage-user:update-brokerage-user'])" v-if="checkPermi(['trade:brokerage-user:update-bind-user'])"
> >
修改上级推广人 修改上级推广人
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="openClearBindUser" command="handleClearBindUser"
v-if="checkPermi(['trade:brokerage-user:clear-brokerage-user'])" v-if="
scope.row.bindUserId && checkPermi(['trade:brokerage-user:clear-bind-user'])
"
> >
清除上级推广人 清除上级推广人
</el-dropdown-item> </el-dropdown-item>
@ -186,7 +192,6 @@ import { fenToYuanFormat } from '@/utils/formatter'
defineOptions({ name: 'TradeBrokerageUser' }) defineOptions({ name: 'TradeBrokerageUser' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) // const loading = ref(true) //
const total = ref(0) // const total = ref(0) //
@ -235,8 +240,8 @@ const handleCommand = (command: string, row: BrokerageUserApi.BrokerageUserVO) =
case 'openUpdateBindUser': case 'openUpdateBindUser':
openUpdateBindUser(row.id) openUpdateBindUser(row.id)
break break
case 'openClearBindUser': case 'handleClearBindUser':
openClearBindUser(row.id) handleClearBindUser(row)
break break
} }
} }
@ -249,12 +254,47 @@ const openBrokerageOrderTable = (id: number) => {}
/** 打开表单:修改上级推广人 */ /** 打开表单:修改上级推广人 */
const openUpdateBindUser = (id: number) => {} const openUpdateBindUser = (id: number) => {}
/** 修改上级推广人 */
const handleUpdateBindUser = async (row: BrokerageUserApi.BrokerageUserVO) => {
try {
//
await message.confirm(`确认要修改"${row.nickname}"的上级推广人吗?`)
//
await BrokerageUserApi.updateBindUser({ id: row.id })
//
await getList()
} catch {}
}
/** 打开表单:清除上级推广人 */ /** 清除上级推广人 */
const openClearBindUser = (id: number) => {} const handleClearBindUser = async (row: BrokerageUserApi.BrokerageUserVO) => {
try {
//
await message.confirm(`确认要清除"${row.nickname}"的上级推广人吗?`)
//
await BrokerageUserApi.clearBindUser({ id: row.id })
message.success('清除成功')
//
await getList()
} catch {}
}
/** 推广资格 开通/关闭 */ /** 推广资格 开通/关闭 */
const handleBrokerageEnabledChange = (id: number, enabled: boolean) => {} const handleBrokerageEnabledChange = async (row: BrokerageUserApi.BrokerageUserVO) => {
try {
//
const text = row.brokerageEnabled ? '开通' : '关闭'
await message.confirm(`确认要${text}"${row.nickname}"的推广资格吗?`)
//
await BrokerageUserApi.updateBrokerageEnabled({ id: row.id, enabled: row.brokerageEnabled })
message.success(text + '成功')
//
await getList()
} catch {
//
row.brokerageEnabled = !row.brokerageEnabled
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {