Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
YunaiV 2023-09-24 12:10:14 +08:00
commit ce78336fca
9 changed files with 478 additions and 46 deletions

View File

@ -0,0 +1,39 @@
import request from '@/config/axios'
export interface BrokerageWithdrawVO {
id: number
userId: number
price: number
feePrice: number
totalPrice: number
type: number
name: string
accountNo: string
bankName: string
bankAddress: string
accountQrCodeUrl: string
status: number
auditReason: string
auditTime: Date
remark: string
}
// 查询佣金提现列表
export const getBrokerageWithdrawPage = async (params: any) => {
return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
}
// 查询佣金提现详情
export const getBrokerageWithdraw = async (id: number) => {
return await request.get({ url: `/trade/brokerage-withdraw/get?id=` + id })
}
// 佣金提现 - 通过申请
export const approveBrokerageWithdraw = async (id: number) => {
return await request.put({ url: `/trade/brokerage-withdraw/approve?id=` + id })
}
// 审核佣金提现 - 驳回申请
export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => {
return await request.put({ url: `/trade/brokerage-withdraw/reject`, data })
}

View File

@ -299,23 +299,6 @@ export const BrokerageEnabledConditionEnum = {
name: '指定分销'
}
}
/**
*
*/
export const BrokerageUserTypeEnum = {
ALL: {
type: 0,
name: '全部'
},
FIRST: {
type: 1,
name: '一级推广人'
},
SECOND: {
type: 2,
name: '二级推广人'
}
}
/**
*
*/
@ -329,3 +312,49 @@ export const BrokerageRecordBizTypeEnum = {
name: '提现申请'
}
}
/**
*
*/
export const BrokerageWithdrawStatusEnum = {
AUDITING: {
status: 0,
name: '审核中'
},
AUDIT_SUCCESS: {
status: 10,
name: '审核通过'
},
AUDIT_FAIL: {
status: 20,
name: '审核不通过'
},
WITHDRAW_SUCCESS: {
status: 11,
name: '提现成功'
},
WITHDRAW_FAIL: {
status: 21,
name: '提现失败'
}
}
/**
*
*/
export const BrokerageWithdrawTypeEnum = {
WALLET: {
type: 1,
name: '钱包'
},
BANK: {
type: 2,
name: '银行卡'
},
WECHAT: {
type: 3,
name: '微信'
},
ALIPAY: {
type: 4,
name: '支付宝'
}
}

View File

@ -168,9 +168,10 @@ export enum DICT_TYPE {
BROKERAGE_ENABLED_CONDITION = 'brokerage_enabled_condition', // 分佣模式
BROKERAGE_BIND_MODE = 'brokerage_bind_mode', // 分销关系绑定模式
BROKERAGE_BANK_NAME = 'brokerage_bank_name', // 佣金提现银行
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金冻结时间
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金提现类型
BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型
BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态
BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态
// ========== MALL - 营销模块 ==========
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型

View File

@ -9,15 +9,11 @@
:inline="true"
label-width="85px"
>
<el-form-item label="用户类型" prop="userType">
<el-radio-group v-model="queryParams.userType" @change="handleQuery">
<el-radio-button
v-for="item in BrokerageUserTypeEnum"
:key="item.type"
:label="item.type"
>
{{ item.name }}
</el-radio-button>
<el-form-item label="用户类型" prop="level">
<el-radio-group v-model="queryParams.level" @change="handleQuery">
<el-radio-button checked>全部</el-radio-button>
<el-radio-button label="1">一级推广人</el-radio-button>
<el-radio-button label="2">二级推广人</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="状态" prop="status">
@ -98,7 +94,7 @@
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import * as BrokerageRecordApi from '@/api/mall/trade/brokerage/record'
import { BrokerageRecordBizTypeEnum, BrokerageUserTypeEnum } from '@/utils/constants'
import { BrokerageRecordBizTypeEnum } from '@/utils/constants'
import { fenToYuanFormat } from '@/utils/formatter'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -115,14 +111,15 @@ const queryParams = reactive({
pageSize: 10,
userId: null,
bizType: BrokerageRecordBizTypeEnum.ORDER.type,
userType: BrokerageUserTypeEnum.ALL.type,
createTime: []
level: '',
createTime: [],
status: null
})
const queryFormRef = ref() //
/** 打开弹窗 */
const dialogVisible = ref(false) //
const open = async (userId: number) => {
const open = async (userId: any) => {
dialogVisible.value = true
queryParams.userId = userId
resetQuery()

View File

@ -9,15 +9,11 @@
:inline="true"
label-width="85px"
>
<el-form-item label="用户类型" prop="userType">
<el-radio-group v-model="queryParams.userType" @change="handleQuery">
<el-radio-button
v-for="item in BrokerageUserTypeEnum"
:key="item.type"
:label="item.type"
>
{{ item.name }}
</el-radio-button>
<el-form-item label="用户类型" prop="level">
<el-radio-group v-model="queryParams.level" @change="handleQuery">
<el-radio-button checked>全部</el-radio-button>
<el-radio-button label="1">一级推广人</el-radio-button>
<el-radio-button label="2">二级推广人</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="绑定时间" prop="bindUserTime">
@ -88,7 +84,6 @@
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import * as BrokerageUserApi from '@/api/mall/trade/brokerage/user'
import { BrokerageUserTypeEnum } from '@/utils/constants'
/** 推广人列表 */
defineOptions({ name: 'BrokerageUserListDialog' })
@ -102,14 +97,14 @@ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
bindUserId: null,
userType: BrokerageUserTypeEnum.ALL.type,
level: '',
bindUserTime: []
})
const queryFormRef = ref() //
/** 打开弹窗 */
const dialogVisible = ref(false) //
const open = async (bindUserId: number) => {
const open = async (bindUserId: any) => {
dialogVisible.value = true
queryParams.bindUserId = bindUserId
resetQuery()

View File

@ -0,0 +1,73 @@
<template>
<Dialog title="审核" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="驳回原因" prop="auditReason">
<el-input v-model="formData.auditReason" type="textarea" placeholder="请输入驳回原因" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formData = ref({
id: undefined,
auditReason: undefined
})
const formRules = reactive({
auditReason: [{ required: true, message: '驳回原因不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (id: number) => {
dialogVisible.value = true
resetForm()
formData.value.id = id
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formData.value as unknown as BrokerageWithdrawApi.BrokerageWithdrawVO
await BrokerageWithdrawApi.rejectBrokerageWithdraw(data)
message.success('驳回成功')
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
auditReason: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,264 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="用户编号" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="提现类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择提现类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="账号" prop="accountNo">
<el-input
v-model="queryParams.accountNo"
placeholder="请输入账号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="提现银行" prop="bankName">
<el-select
v-model="queryParams.bankName"
placeholder="请选择提现银行"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.BROKERAGE_BANK_NAME)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</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="left" prop="id" min-width="60px" />
<el-table-column label="用户信息" align="left" min-width="120px">
<template #default="scope">
<div>编号{{ scope.row.userId }}</div>
<div>昵称{{ scope.row.userNickname }}</div>
</template>
</el-table-column>
<el-table-column label="提现金额" align="left" prop="price" min-width="80px">
<template #default="scope">
<div> {{ fenToYuan(scope.row.price) }}</div>
<div>手续费{{ fenToYuan(scope.row.feePrice) }}</div>
</template>
</el-table-column>
<el-table-column label="提现方式" align="left" prop="type" min-width="120px">
<template #default="scope">
<div v-if="scope.row.type === BrokerageWithdrawTypeEnum.WALLET.type"> 余额 </div>
<div v-else>
{{ getDictLabel(DICT_TYPE.BROKERAGE_WITHDRAW_TYPE, scope.row.type) }}账号
{{ scope.row.accountNo }}
</div>
<template v-if="scope.row.type === BrokerageWithdrawTypeEnum.BANK.type">
<div>真实姓名{{ scope.row.name }}</div>
<div>
银行名称
<dict-tag :type="DICT_TYPE.BROKERAGE_BANK_NAME" :value="scope.row.bankName" />
</div>
<div>开户地址{{ scope.row.bankAddress }}</div>
</template>
</template>
</el-table-column>
<el-table-column label="收款码" align="left" prop="accountQrCodeUrl" width="70px">
<template #default="scope">
<el-image
:src="scope.row.accountQrCodeUrl"
class="w-40px h-40px"
:preview-src-list="[scope.row.accountQrCodeUrl]"
preview-teleported
/>
</template>
</el-table-column>
<el-table-column
label="申请时间"
align="left"
prop="createTime"
:formatter="dateFormatter"
width="170px"
/>
<el-table-column label="备注" align="left" prop="remark" />
<el-table-column label="状态" align="left" prop="status" min-width="120px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.BROKERAGE_WITHDRAW_STATUS" :value="scope.row.status" />
<div v-if="scope.row.auditTime" class="text-xs">
时间{{ formatDate(scope.row.auditTime) }}
</div>
<div v-if="scope.row.auditReason" class="text-xs">
原因{{ scope.row.auditReason }}
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="left" width="110px" fixed="right">
<template #default="scope">
<template v-if="scope.row.status === BrokerageWithdrawStatusEnum.AUDITING.status">
<el-button
link
type="primary"
@click="handleApprove(scope.row.id)"
v-hasPermi="['trade:brokerage-withdraw:audit']"
>
通过
</el-button>
<el-button
link
type="danger"
@click="openForm(scope.row.id)"
v-hasPermi="['trade:brokerage-withdraw:audit']"
>
驳回
</el-button>
</template>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BrokerageWithdrawRejectForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getDictLabel, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { dateFormatter, formatDate } from '@/utils/formatTime'
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
import BrokerageWithdrawRejectForm from './BrokerageWithdrawRejectForm.vue'
import { BrokerageWithdrawStatusEnum, BrokerageWithdrawTypeEnum } from '@/utils/constants'
import { fenToYuanFormat } from '@/utils/formatter'
import { fenToYuan } from '@/utils'
defineOptions({ name: 'BrokerageWithdraw' })
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
userId: null,
type: null,
name: null,
accountNo: null,
bankName: null,
status: null,
auditReason: null,
auditTime: [],
remark: null,
createTime: []
})
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await BrokerageWithdrawApi.getBrokerageWithdrawPage(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 formRef = ref()
const openForm = (id: number) => {
formRef.value.open(id)
}
/** 审核通过 */
const handleApprove = async (id: number) => {
try {
loading.value = true
await message.confirm('确定要审核通过吗?')
await BrokerageWithdrawApi.approveBrokerageWithdraw(id)
await message.success(t('common.success'))
await getList()
} finally {
loading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

View File

@ -12,6 +12,20 @@
</el-form-item>
<el-tabs>
<el-tab-pane label="配送">
<el-form-item label="启用包邮" prop="deliveryExpressFreeEnabled">
<el-switch v-model="formData.deliveryExpressFreeEnabled" style="user-select: none" />
<el-text class="w-full" size="small" type="info"> 商城是否启用全场包邮 </el-text>
</el-form-item>
<el-form-item label="满额包邮" prop="deliveryExpressFreePrice">
<el-input-number
v-model="formData.deliveryExpressFreePrice"
placeholder="请输入满额包邮"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info"> 商城商品满多少金额即可包邮 </el-text>
</el-form-item>
</el-tab-pane>
<el-tab-pane label="分销">
<el-form-item label="分佣启用" prop="brokerageEnabled">
<el-switch v-model="formData.brokerageEnabled" style="user-select: none" />
@ -61,6 +75,7 @@
<el-input-number
v-model="formData.brokerageFirstPercent"
placeholder="请输入一级返佣比例"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info">
订单交易成功后给推广人返佣的百分比
@ -70,6 +85,7 @@
<el-input-number
v-model="formData.brokerageSecondPercent"
placeholder="请输入二级返佣比例"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info">
订单交易成功后给推广人的推荐人返佣的百分比
@ -79,6 +95,7 @@
<el-input-number
v-model="formData.brokerageFrozenDays"
placeholder="请输入佣金冻结天数"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info">
防止用户退款佣金被提现了所以需要设置佣金冻结时间单位
@ -87,12 +104,23 @@
<el-form-item label="提现最低金额" prop="brokerageWithdrawMinPrice">
<el-input-number
v-model="formData.brokerageWithdrawMinPrice"
placeholder="请输入用户提现最低金额"
placeholder="请输入提现最低金额"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info">
用户提现最低金额限制单位
</el-text>
</el-form-item>
<el-form-item label="提现手续费" prop="brokerageWithdrawFeePercent">
<el-input-number
v-model="formData.brokerageWithdrawFeePercent"
placeholder="请输入提现手续费"
class="!w-xs"
/>
<el-text class="w-full" size="small" type="info">
提现手续费百分比范围0-1000为无提现手续费设置10即收取10%手续费提现100元到账90元10元手续费
</el-text>
</el-form-item>
<el-form-item label="提现方式" prop="brokerageWithdrawType">
<el-checkbox-group v-model="formData.brokerageWithdrawType">
<el-checkbox
@ -138,6 +166,9 @@ const message = useMessage() // 消息弹窗
const formLoading = ref(false) // 12
const formRef = ref()
const formData = ref({
id: null,
deliveryExpressFreeEnabled: true,
deliveryExpressFreePrice: 0,
brokerageEnabled: true,
brokerageEnabledCondition: BrokerageEnabledConditionEnum.ALL.condition,
brokerageBindMode: BrokerageBindModeEnum.ANYTIME.mode,
@ -145,11 +176,13 @@ const formData = ref({
brokerageFirstPercent: 0,
brokerageSecondPercent: 0,
brokerageWithdrawMinPrice: 0,
brokerageWithdrawFeePercent: 0,
brokerageBankNames: [],
brokerageFrozenDays: 0,
brokerageWithdrawType: []
})
const formRules = reactive({
deliveryExpressFreePrice: [{ required: true, message: '满额包邮不能为空', trigger: 'blur' }],
brokerageEnabledCondition: [{ required: true, message: '分佣模式不能为空', trigger: 'blur' }],
brokerageBindMode: [{ required: true, message: '分销关系绑定模式不能为空', trigger: 'blur' }],
brokerageFirstPercent: [{ required: true, message: '一级返佣比例不能为空', trigger: 'blur' }],
@ -157,6 +190,7 @@ const formRules = reactive({
brokerageWithdrawMinPrice: [
{ required: true, message: '用户提现最低金额不能为空', trigger: 'blur' }
],
brokerageWithdrawFeePercent: [{ required: true, message: '提现手续费不能为空', trigger: 'blur' }],
brokerageBankNames: [{ required: true, message: '提现银行不能为空', trigger: 'blur' }],
brokerageFrozenDays: [{ required: true, message: '佣金冻结时间不能为空', trigger: 'blur' }],
brokerageWithdrawType: [

View File

@ -245,9 +245,9 @@ const { params } = useRoute() // 查询参数
const getDetail = async () => {
const id = params.orderId as unknown as number
if (id) {
const res = (await TradeOrderApi.getOrder(66666)) as TradeOrderApi.OrderVO
const res = (await TradeOrderApi.getOrder(id)) as TradeOrderApi.OrderVO
//
if (res == null) {
if (res === null) {
message.error('交易订单不存在')
close()
}