!237 分销业务从 member 模块 转移到 trade模块
Merge pull request !237 from 疯狂的世界/brokerage
This commit is contained in:
commit
1719debd11
11
src/api/mall/trade/brokerage/record/index.ts
Normal file
11
src/api/mall/trade/brokerage/record/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// 查询佣金记录列表
|
||||||
|
export const getBrokerageRecordPage = async (params: any) => {
|
||||||
|
return await request.get({ url: `/trade/brokerage-record/page`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询佣金记录详情
|
||||||
|
export const getBrokerageRecord = async (id: number) => {
|
||||||
|
return await request.get({ url: `/trade/brokerage-record/get?id=` + id })
|
||||||
|
}
|
21
src/api/mall/trade/brokerage/user/index.ts
Normal file
21
src/api/mall/trade/brokerage/user/index.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface BrokerageUserVO {
|
||||||
|
id: number
|
||||||
|
bindUserId: number
|
||||||
|
bindUserTime: Date
|
||||||
|
brokerageEnabled: boolean
|
||||||
|
brokerageTime: Date
|
||||||
|
price: number
|
||||||
|
frozenPrice: 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 })
|
||||||
|
}
|
24
src/api/mall/trade/config/index.ts
Normal file
24
src/api/mall/trade/config/index.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface ConfigVO {
|
||||||
|
brokerageEnabled: boolean
|
||||||
|
brokerageEnabledCondition: number
|
||||||
|
brokerageBindMode: number
|
||||||
|
brokeragePostUrls: string
|
||||||
|
brokerageFirstPercent: number
|
||||||
|
brokerageSecondPercent: number
|
||||||
|
brokerageWithdrawMinPrice: number
|
||||||
|
brokerageBankNames: string
|
||||||
|
brokerageFrozenDays: number
|
||||||
|
brokerageWithdrawType: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询交易中心配置详情
|
||||||
|
export const getTradeConfig = async () => {
|
||||||
|
return await request.get({ url: `/trade/config/get` })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存交易中心配置
|
||||||
|
export const saveTradeConfig = async (data: ConfigVO) => {
|
||||||
|
return await request.put({ url: `/trade/config/save`, data })
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
import request from '@/config/axios'
|
|
||||||
|
|
||||||
// 查询佣金记录列表
|
|
||||||
export const getMemberBrokerageRecordPage = async (params: any) => {
|
|
||||||
return await request.get({ url: `/member/member-brokerage-record/page`, params })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询佣金记录详情
|
|
||||||
export const getMemberBrokerageRecord = async (id: number) => {
|
|
||||||
return await request.get({ url: `/member/member-brokerage-record/get?id=` + id })
|
|
||||||
}
|
|
@ -6,16 +6,6 @@ export interface ConfigVO {
|
|||||||
tradeDeductUnitPrice: number
|
tradeDeductUnitPrice: number
|
||||||
tradeDeductMaxPrice: number
|
tradeDeductMaxPrice: number
|
||||||
tradeGivePoint: number
|
tradeGivePoint: number
|
||||||
brokerageEnabled: boolean
|
|
||||||
brokerageEnabledCondition: number
|
|
||||||
brokerageBindMode: number
|
|
||||||
brokeragePostUrls: string[]
|
|
||||||
brokerageFirstPercent: number
|
|
||||||
brokerageSecondPercent: number
|
|
||||||
brokerageWithdrawMinPrice: number
|
|
||||||
brokerageBankNames: number[]
|
|
||||||
brokerageFrozenDays: number
|
|
||||||
brokerageWithdrawType: number[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询积分设置详情
|
// 查询积分设置详情
|
||||||
|
@ -107,9 +107,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as MemberBrokerageRecordApi from '@/api/member/brokerage/record'
|
import * as BrokerageRecordApi from '@/api/mall/trade/brokerage/record'
|
||||||
|
|
||||||
defineOptions({ name: 'MemberBrokerageRecord' })
|
defineOptions({ name: 'TradeBrokerageRecord' })
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
@ -129,7 +129,7 @@ const queryFormRef = ref() // 搜索的表单
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await MemberBrokerageRecordApi.getMemberBrokerageRecordPage(queryParams)
|
const data = await BrokerageRecordApi.getBrokerageRecordPage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
248
src/views/mall/trade/brokerage/user/index.vue
Normal file
248
src/views/mall/trade/brokerage/user/index.vue
Normal 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="bindUserId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.bindUserId"
|
||||||
|
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="price" min-width="100px" />
|
||||||
|
<el-table-column
|
||||||
|
label="冻结中佣金"
|
||||||
|
align="center"
|
||||||
|
prop="frozenPrice"
|
||||||
|
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="bindUserId" width="150px" />
|
||||||
|
<el-table-column
|
||||||
|
label="推广员绑定时间"
|
||||||
|
align="center"
|
||||||
|
prop="bindUserTime"
|
||||||
|
: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,
|
||||||
|
bindUserId: 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>
|
209
src/views/mall/trade/config/index.vue
Normal file
209
src/views/mall/trade/config/index.vue
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="120px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="hideId" v-show="false">
|
||||||
|
<el-input v-model="formData.id" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-tabs>
|
||||||
|
<el-tab-pane label="分销">
|
||||||
|
<el-form-item label="分佣启用" prop="brokerageEnabled">
|
||||||
|
<el-switch v-model="formData.brokerageEnabled" style="user-select: none" />
|
||||||
|
<el-text class="w-full" size="small" type="info"> 商城是否开启分销模式 </el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分佣模式" prop="brokerageEnabledCondition">
|
||||||
|
<el-radio-group v-model="formData.brokerageEnabledCondition">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_ENABLED_CONDITION)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
人人分销:每个用户都可以成为推广员
|
||||||
|
</el-text>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
指定分销:仅可在后台手动设置推广员
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分销关系绑定" prop="brokerageBindMode">
|
||||||
|
<el-radio-group v-model="formData.brokerageBindMode">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_BIND_MODE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
没有推广人:只要用户没有推广人,随时都可以绑定推广关系
|
||||||
|
</el-text>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
新用户:只有新用户注册时或首次进入系统时才可以绑定推广关系
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分销海报图">
|
||||||
|
<UploadImgs v-model="formData.brokeragePostUrls" width="75px" height="125px" />
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
个人中心分销海报图片,建议尺寸600x1000
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="一级返佣比例" prop="brokerageFirstPercent">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.brokerageFirstPercent"
|
||||||
|
placeholder="请输入一级返佣比例"
|
||||||
|
/>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
订单交易成功后给推广人返佣的百分比
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="二级返佣比例" prop="brokerageSecondPercent">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.brokerageSecondPercent"
|
||||||
|
placeholder="请输入二级返佣比例"
|
||||||
|
/>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
订单交易成功后给推广人的推荐人返佣的百分比
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="佣金冻结天数" prop="brokerageFrozenDays">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.brokerageFrozenDays"
|
||||||
|
placeholder="请输入佣金冻结天数"
|
||||||
|
/>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
防止用户退款,佣金被提现了,所以需要设置佣金冻结时间,单位:天
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="提现最低金额" prop="brokerageWithdrawMinPrice">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.brokerageWithdrawMinPrice"
|
||||||
|
placeholder="请输入用户提现最低金额"
|
||||||
|
/>
|
||||||
|
<el-text class="w-full" size="small" type="info">
|
||||||
|
用户提现最低金额限制,单位:元
|
||||||
|
</el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="提现方式" prop="brokerageWithdrawType">
|
||||||
|
<el-checkbox-group v-model="formData.brokerageWithdrawType">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>
|
||||||
|
{{ dict.label }}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
<el-text class="w-full" size="small" type="info"> 商城开通提现的付款方式 </el-text>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="提现银行" prop="brokerageBankNames">
|
||||||
|
<el-select v-model="formData.brokerageBankNames" placeholder="请选择提现银行" multiple>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_BANK_NAME)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-text class="w-full" size="small" type="info"> 商城开通提现的银行列表 </el-text>
|
||||||
|
</el-form-item>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submitForm" :loading="formLoading"> 保存 </el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import * as ConfigApi from '@/api/mall/trade/config'
|
||||||
|
import { BrokerageBindModeEnum, BrokerageEnabledConditionEnum } from '@/utils/constants'
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
|
||||||
|
defineOptions({ name: 'TradeConfig' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formRef = ref()
|
||||||
|
const formData = ref({
|
||||||
|
brokerageEnabled: true,
|
||||||
|
brokerageEnabledCondition: BrokerageEnabledConditionEnum.ALL.condition,
|
||||||
|
brokerageBindMode: BrokerageBindModeEnum.ANYTIME.mode,
|
||||||
|
brokeragePostUrls: [],
|
||||||
|
brokerageFirstPercent: 0,
|
||||||
|
brokerageSecondPercent: 0,
|
||||||
|
brokerageWithdrawMinPrice: 0,
|
||||||
|
brokerageBankNames: [],
|
||||||
|
brokerageFrozenDays: 0,
|
||||||
|
brokerageWithdrawType: []
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
brokerageEnabledCondition: [{ required: true, message: '分佣模式不能为空', trigger: 'blur' }],
|
||||||
|
brokerageBindMode: [{ required: true, message: '分销关系绑定模式不能为空', trigger: 'blur' }],
|
||||||
|
brokerageFirstPercent: [{ required: true, message: '一级返佣比例不能为空', trigger: 'blur' }],
|
||||||
|
brokerageSecondPercent: [{ required: true, message: '二级返佣比例不能为空', trigger: 'blur' }],
|
||||||
|
brokerageWithdrawMinPrice: [
|
||||||
|
{ required: true, message: '用户提现最低金额不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
brokerageBankNames: [{ required: true, message: '提现银行不能为空', trigger: 'blur' }],
|
||||||
|
brokerageFrozenDays: [{ required: true, message: '佣金冻结时间不能为空', trigger: 'blur' }],
|
||||||
|
brokerageWithdrawType: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '提现方式不能为空',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const submitForm = async () => {
|
||||||
|
if (formLoading.value) return
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as ConfigApi.ConfigVO
|
||||||
|
data.brokeragePostUrls = formData.value.brokeragePostUrls.map((item: any) => {
|
||||||
|
return item?.url ? item.url : item
|
||||||
|
})
|
||||||
|
await ConfigApi.saveTradeConfig(data)
|
||||||
|
message.success('保存成功')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询交易中心配置 */
|
||||||
|
const getConfig = async () => {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = await ConfigApi.getTradeConfig()
|
||||||
|
if (data != null) {
|
||||||
|
data.brokeragePostUrls = data.brokeragePostUrls.map((url) => ({ url }))
|
||||||
|
formData.value = data
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getConfig()
|
||||||
|
})
|
||||||
|
</script>
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<el-tabs>
|
<el-tabs>
|
||||||
<el-tab-pane label="积分">
|
<el-tab-pane label="积分">
|
||||||
<el-form-item label="积分抵扣" prop="tradeDeductEnable" class="item-bottom">
|
<el-form-item label="积分抵扣" prop="tradeDeductEnable">
|
||||||
<el-switch v-model="formData.tradeDeductEnable" style="user-select: none" />
|
<el-switch v-model="formData.tradeDeductEnable" style="user-select: none" />
|
||||||
<el-text class="w-full" size="small" type="info">下单积分是否抵用订单金额</el-text>
|
<el-text class="w-full" size="small" type="info">下单积分是否抵用订单金额</el-text>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -46,111 +46,6 @@
|
|||||||
</el-text>
|
</el-text>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="分销">
|
|
||||||
<el-form-item label="分佣启用" prop="brokerageEnabled">
|
|
||||||
<el-switch v-model="formData.brokerageEnabled" style="user-select: none" />
|
|
||||||
<el-text class="w-full" size="small" type="info"> 商城是否开启分销模式 </el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分佣模式" prop="brokerageEnabledCondition">
|
|
||||||
<el-radio-group v-model="formData.brokerageEnabledCondition">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_ENABLED_CONDITION)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>
|
|
||||||
{{ dict.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
人人分销:每个用户都可以成为推广员
|
|
||||||
</el-text>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
指定分销:仅可在后台手动设置推广员
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分销关系绑定" prop="brokerageBindMode">
|
|
||||||
<el-radio-group v-model="formData.brokerageBindMode">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_BIND_MODE)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>
|
|
||||||
{{ dict.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
没有推广人:只要用户没有推广人,随时都可以绑定推广关系
|
|
||||||
</el-text>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
新用户:只有新用户注册时或首次进入系统时才可以绑定推广关系
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分销海报图">
|
|
||||||
<UploadImgs v-model="formData.brokeragePostUrls" width="75px" height="125px" />
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
个人中心分销海报图片,建议尺寸600x1000
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="一级返佣比例" prop="brokerageFirstPercent">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.brokerageFirstPercent"
|
|
||||||
placeholder="请输入一级返佣比例"
|
|
||||||
/>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
订单交易成功后给推广人返佣的百分比
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="二级返佣比例" prop="brokerageSecondPercent">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.brokerageSecondPercent"
|
|
||||||
placeholder="请输入二级返佣比例"
|
|
||||||
/>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
订单交易成功后给推广人的推荐人返佣的百分比
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="佣金冻结天数" prop="brokerageFrozenDays">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.brokerageFrozenDays"
|
|
||||||
placeholder="请输入佣金冻结天数"
|
|
||||||
/>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
防止用户退款,佣金被提现了,所以需要设置佣金冻结时间,单位:天
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="提现最低金额" prop="brokerageWithdrawMinPrice">
|
|
||||||
<el-input-number
|
|
||||||
v-model="formData.brokerageWithdrawMinPrice"
|
|
||||||
placeholder="请输入用户提现最低金额"
|
|
||||||
/>
|
|
||||||
<el-text class="w-full" size="small" type="info">
|
|
||||||
用户提现最低金额限制,单位:元
|
|
||||||
</el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="提现方式" prop="brokerageWithdrawType">
|
|
||||||
<el-checkbox-group v-model="formData.brokerageWithdrawType">
|
|
||||||
<el-checkbox
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_TYPE)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>
|
|
||||||
{{ dict.label }}
|
|
||||||
</el-checkbox>
|
|
||||||
</el-checkbox-group>
|
|
||||||
<el-text class="w-full" size="small" type="info"> 商城开通提现的付款方式 </el-text>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="提现银行" prop="brokerageBankNames">
|
|
||||||
<el-select v-model="formData.brokerageBankNames" placeholder="请选择提现银行" multiple>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_BANK_NAME)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
<el-text class="w-full" size="small" type="info"> 商城开通提现的银行列表 </el-text>
|
|
||||||
</el-form-item>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@ -161,8 +56,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import * as ConfigApi from '@/api/member/point/config'
|
import * as ConfigApi from '@/api/member/point/config'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
||||||
import { BrokerageBindModeEnum, BrokerageEnabledConditionEnum } from '@/utils/constants'
|
|
||||||
|
|
||||||
defineOptions({ name: 'MemberPointConfig' })
|
defineOptions({ name: 'MemberPointConfig' })
|
||||||
|
|
||||||
@ -176,17 +69,7 @@ const formData = ref({
|
|||||||
tradeDeductEnable: true,
|
tradeDeductEnable: true,
|
||||||
tradeDeductUnitPrice: 0,
|
tradeDeductUnitPrice: 0,
|
||||||
tradeDeductMaxPrice: 0,
|
tradeDeductMaxPrice: 0,
|
||||||
tradeGivePoint: 0,
|
tradeGivePoint: 0
|
||||||
brokerageEnabled: true,
|
|
||||||
brokerageEnabledCondition: BrokerageEnabledConditionEnum.ALL.condition,
|
|
||||||
brokerageBindMode: BrokerageBindModeEnum.ANYTIME.mode,
|
|
||||||
brokeragePostUrls: [],
|
|
||||||
brokerageFirstPercent: 0,
|
|
||||||
brokerageSecondPercent: 0,
|
|
||||||
brokerageWithdrawMinPrice: 0,
|
|
||||||
brokerageBankNames: [],
|
|
||||||
brokerageFrozenDays: 0,
|
|
||||||
brokerageWithdrawType: []
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 创建一个计算属性,用于将 tradeDeductUnitPrice 显示为带两位小数的形式
|
// 创建一个计算属性,用于将 tradeDeductUnitPrice 显示为带两位小数的形式
|
||||||
@ -210,9 +93,6 @@ const onSubmit = async () => {
|
|||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = formData.value as unknown as ConfigApi.ConfigVO
|
const data = formData.value as unknown as ConfigApi.ConfigVO
|
||||||
data.brokeragePostUrls = formData.value.brokeragePostUrls.map((item: any) => {
|
|
||||||
return item?.url ? item.url : item
|
|
||||||
})
|
|
||||||
await ConfigApi.saveConfig(data)
|
await ConfigApi.saveConfig(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
@ -228,7 +108,6 @@ const getConfig = async () => {
|
|||||||
if (data === null) {
|
if (data === null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data.brokeragePostUrls = data.brokeragePostUrls.map((url) => ({ url }))
|
|
||||||
formData.value = data
|
formData.value = data
|
||||||
} finally {
|
} finally {
|
||||||
}
|
}
|
||||||
@ -238,9 +117,3 @@ onMounted(() => {
|
|||||||
getConfig()
|
getConfig()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.item-bottom {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user