feat 分账组联调和平台配置优化

This commit is contained in:
DaxPay
2024-10-08 17:41:50 +08:00
parent ede980b42c
commit 3ebb1a2f5b
33 changed files with 316 additions and 219 deletions

View File

@@ -21,7 +21,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -13,7 +13,7 @@
<div class="h-70vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
keep-source
:data="records"

View File

@@ -28,7 +28,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -26,7 +26,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -26,7 +26,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -21,7 +21,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -18,12 +18,8 @@ export function update(data: PlatformConfig) {
export interface PlatformConfig extends BaseEntity {
// 网关服务地址
gatewayServiceUrl?: string
// 网关移动端是否为嵌入式
mobileEmbedded?: boolean
// 网关移动端地址
gatewayMobileUrl?: string
// 网关PC端是否为嵌入式
pcEmbedded?: boolean
// 网关PC端地址
gatewayPcUrl?: string
}

View File

@@ -12,19 +12,11 @@
:wrapperCol="{ span: 18 }"
:validate-trigger="['blur', 'change']"
>
<a-form-item label="网关地址" name="gatewayServiceUrl">
<a-form-item label="网关服务地址" name="gatewayServiceUrl">
<a-input
:disabled="!edit"
v-model:value="form.gatewayServiceUrl"
placeholder="请输入网关地址"
/>
</a-form-item>
<a-form-item label="网关H5端部署方式" name="mobileEmbedded">
<a-switch
:disabled="!edit"
checked-children="嵌入"
un-checked-children="独立"
v-model:checked="form.mobileEmbedded"
placeholder="请输入网关服务地址"
/>
</a-form-item>
<a-form-item label="网关H5端地址" name="gatewayMobileUrl">
@@ -34,14 +26,6 @@
placeholder="请输入网关H5端地址"
/>
</a-form-item>
<a-form-item label="网关PC端部署方式" name="pcEmbedded">
<a-switch
:disabled="!edit"
checked-children="嵌入"
un-checked-children="独立"
v-model:checked="form.pcEmbedded"
/>
</a-form-item>
<a-form-item label="网关PC端地址" name="gatewayPcUrl">
<a-input
:disabled="!edit"
@@ -72,10 +56,7 @@
const { createMessage } = useMessage()
const confirmLoading = ref(false)
const formRef = ref<FormInstance>()
const form = ref<PlatformConfig>({
mobileEmbedded: false,
pcEmbedded: false,
})
const form = ref<PlatformConfig>({})
const edit = ref<boolean>(false)
const rules = {} as Record<string, Rule[]>

View File

@@ -1,12 +1,12 @@
import { defHttp } from '@/utils/http/axios'
import { PageResult, Result } from '#/axios'
import { BaseEntity } from '#/web'
import { BaseEntity, MchEntity } from "#/web";
/**
* 分页查询
*/
export function page(params) {
return defHttp.get<Result<PageResult<AllocationGroup>>>({
return defHttp.get<Result<PageResult<AllocGroup>>>({
url: '/allocation/group/page',
params,
})
@@ -16,7 +16,7 @@ export function page(params) {
* 查询详情
*/
export function get(id) {
return defHttp.get<Result<AllocationGroup>>({
return defHttp.get<Result<AllocGroup>>({
url: '/allocation/group/findById',
params: { id },
})
@@ -26,7 +26,7 @@ export function get(id) {
* 查询分账接收方信息
*/
export function getReceivers(groupId) {
return defHttp.get<Result<AllocationGroupReceiver[]>>({
return defHttp.get<Result<AllocGroupReceiver[]>>({
url: '/allocation/group/findReceiversByGroups',
params: { groupId },
})
@@ -35,8 +35,8 @@ export function getReceivers(groupId) {
/**
* 创建
*/
export function add(data: AllocationGroup) {
return defHttp.post<Result<AllocationGroup>>({
export function add(data: AllocGroup) {
return defHttp.post<Result<AllocGroup>>({
url: '/allocation/group/create',
data,
})
@@ -45,8 +45,8 @@ export function add(data: AllocationGroup) {
/**
* 修改
*/
export function update(data: AllocationGroup) {
return defHttp.post<Result<AllocationGroup>>({
export function update(data: AllocGroup) {
return defHttp.post<Result<AllocGroup>>({
url: '/allocation/group/update',
data,
})
@@ -105,10 +105,10 @@ export function updateRate(receiverId, rate: number) {
/**
* 编码是否存在
*/
export function existsByNo(receiverNo) {
export function existsByNo(groupNo, appId) {
return defHttp.get<Result<boolean>>({
url: '/allocation/group/existsByGroupNo',
params: { receiverNo },
params: { groupNo, appId },
})
}
@@ -135,7 +135,7 @@ export function cancelDefaultGroup(id) {
/**
* 分账组
*/
export interface AllocationGroup extends BaseEntity {
export interface AllocGroup extends MchEntity {
/**
* 分账组编号
*/
@@ -152,6 +152,10 @@ export interface AllocationGroup extends BaseEntity {
* 总分账比例
*/
totalRate?: number
/**
* 是否为默认分账组
*/
defaultGroup?: boolean
/**
* 分账组描述
*/
@@ -161,15 +165,11 @@ export interface AllocationGroup extends BaseEntity {
/**
* 分账组接收方信息
*/
export interface AllocationGroupReceiver extends BaseEntity {
export interface AllocGroupReceiver extends BaseEntity {
/**
* 分账接收方ID
*/
receiverId?: string
/**
* 默认分账组
*/
defaultGroup?: boolean
/**
* 分账比例
*/

View File

@@ -1,34 +1,48 @@
<template>
<basic-drawer forceRender v-bind="$attrs" title="分账组配置" width="60%" :visible="visible" @close="visible = false">
<basic-drawer
forceRender
v-bind="$attrs"
title="接收方配置"
width="60%"
:open="visible"
@close="visible = false"
>
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
<template #buttons>
<a-space>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">添加分账方</a-button>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add"
>添加分账方</a-button
>
</a-space>
</template>
</vxe-toolbar>
<vxe-table
keep-source
row-id="id"
key-field="id"
ref="xTable"
:data="records"
:loading="loading"
:edit-config="{ trigger: 'click', mode: 'cell' }"
@edit-closed="editClosedEvent"
@edit-activated="editActivatedEvent"
>
<vxe-column type="seq" width="60" />
<vxe-column field="receiverType" title="接收方类型" :min-width="100">
<template #default="{ row }">
<a-tag>{{ dictConvert('AllocReceiverType', row.receiverType) }}</a-tag>
<a-tag>{{ dictConvert('alloc_receiver_type', row.receiverType) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="receiverAccount" title="接收方账号" :min-width="230" />
<vxe-column field="receiverName" title="接收方姓名" :min-width="100" />
<vxe-column field="rate" width="150" title="分账比例" :edit-render="{}" :min-width="100">
<template #default="{ row }"> {{ row.rate / 100.0 }}% </template>
<template #default="{ row }"> {{ row.rate }}% </template>
<template #edit="{ row }">
<a-input-number v-model:value="row.rate" :min="0" :max="100" :precision="2" placeholder="请输入分账比例(%)" />
<a-input-number
v-model:value="row.rate"
:min="0"
:max="100"
:precision="2"
placeholder="请输入分账比例(%)"
/>
</template>
</vxe-column>
<vxe-column fixed="right" width="60" :showOverflow="false" title="操作">
@@ -39,35 +53,42 @@
</template>
</vxe-column>
</vxe-table>
<allocation-group-select ref="allocationGroupSelect" @ok="selectReceiver" />
<AllocationGroupSelect ref="allocationGroupSelect" @ok="selectReceiver" />
</basic-drawer>
</template>
<script setup lang="ts">
import { nextTick } from 'vue'
import { nextTick, ref } from 'vue'
import useTablePage from '@/hooks/bootx/useTablePage'
import VXETable, { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { useMessage } from '@/hooks/web/useMessage'
import BasicDrawer from '@/components/Drawer/src/BasicDrawer.vue'
import { useDict } from '@/hooks/bootx/useDict'
import { AllocationGroup, AllocationGroupReceiver, bindReceivers, getReceivers, unbindReceiver, updateRate } from './AllocationGroup.api'
import {
AllocGroup,
AllocGroupReceiver,
bindReceivers,
getReceivers,
unbindReceiver,
updateRate,
} from './AllocationGroup.api'
import AllocationGroupSelect from './AllocationGroupSelect.vue'
import ALink from '@/components/Link/Link.vue'
// 使用hooks
const { resetQueryParams, model, loading } = useTablePage(queryPage)
const { createConfirm, notification, createMessage } = useMessage()
const { dictDropDown, dictConvert } = useDict()
const { loading } = useTablePage(queryPage)
const { createConfirm, createMessage } = useMessage()
const { dictConvert } = useDict()
let visible = ref(false)
let group = ref<AllocationGroup>({})
let records = ref<AllocationGroupReceiver[]>([])
let group = ref<AllocGroup>({})
let records = ref<AllocGroupReceiver[]>([])
const xTable = ref<VxeTableInstance>()
const xToolbar = ref<VxeToolbarInstance>()
const allocationGroupSelect = ref<any>()
nextTick(() => {
xTable?.connect(xToolbar as VxeToolbarInstance)
xTable.value?.connect(xToolbar.value as VxeToolbarInstance)
})
/**
@@ -75,8 +96,8 @@
* @param record
*/
function init(record) {
visible = true
group = record
visible.value = true
group.value = record
queryPage()
}
@@ -85,8 +106,8 @@
*/
function queryPage() {
loading.value = true
getReceivers(group.id).then(({ data }) => {
records = data
getReceivers(group.value.id).then(({ data }) => {
records.value = data
loading.value = false
})
}
@@ -95,10 +116,11 @@
* 选择分账方弹窗
*/
function add() {
const receiverIds = records.map((item) => {
const receiverIds = records.value.map((item) => {
return item.receiverId
})
allocationGroupSelect.init(receiverIds, group.channel)
const { channel, appId } = group.value
allocationGroupSelect.value.init(receiverIds, channel, appId)
}
/**
@@ -109,7 +131,7 @@
return { receiverId: id, rate: 0 }
})
const param = {
groupId: group.id,
groupId: group.value.id,
receivers,
}
bindReceivers(param).then(() => {
@@ -134,20 +156,12 @@
})
}
/**
* 实时修改触发,
*/
function editActivatedEvent({ row }) {
row.rate = row.rate / 100
}
/**
* 实时修改回调
*/
function editClosedEvent({ row, column }) {
row.rate = Math.round(row.rate * 100)
// 判断单元格值是否被修改
if (xTable?.isUpdateByRow(row, column.field)) {
if (xTable.value?.isUpdateByRow(row, column.field)) {
createConfirm({
iconType: 'warning',
title: '确定修改该分账比例吗?',
@@ -155,14 +169,14 @@
updateRate(row.id, row.rate)
.then(() => {
createMessage.success('修改成功')
xTable.reloadRow(row, null, column.field)
xTable.value?.reloadRow(row, null, column.field)
})
.catch(() => {
xTable?.revertData(row)
xTable.value?.revertData(row)
})
},
onCancel: () => {
xTable?.revertData(row)
xTable.value?.revertData(row)
},
})
}

View File

@@ -22,10 +22,11 @@
<a-input v-model:value="form.id" :disabled="showable" />
</a-form-item>
<a-form-item label="分账组编号" name="groupNo">
<a-input v-model:value="form.groupNo" :disabled="!addable" placeholder="请输入分账组编号" />
</a-form-item>
<a-form-item label="分账组名称" name="name">
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入分账组名称" />
<a-input
v-model:value="form.groupNo"
:disabled="!addable"
placeholder="请输入分账组编号"
/>
</a-form-item>
<a-form-item label="所属通道" name="channel">
<a-select
@@ -36,7 +37,10 @@
placeholder="请选择所属通道"
/>
</a-form-item>
<a-form-item label="默认分账组" name="defaultGroup">
<a-form-item label="分账组名称" name="name">
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入分账组名称" />
</a-form-item>
<a-form-item label="默认分账组" name="defaultGroup" v-if="!addable">
<a-tag color="green" v-if="form.defaultGroup"></a-tag>
<a-tag v-else></a-tag>
</a-form-item>
@@ -48,7 +52,14 @@
<template #footer>
<a-space>
<a-button key="cancel" @click="handleCancel">取消</a-button>
<a-button v-if="!showable" key="forward" :loading="confirmLoading" type="primary" @click="handleOk">保存</a-button>
<a-button
v-if="!showable"
key="forward"
:loading="confirmLoading"
type="primary"
@click="handleOk"
>保存</a-button
>
</a-space>
</template>
</basic-modal>
@@ -56,12 +67,11 @@
<script setup lang="ts">
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { computed, nextTick } from 'vue'
import { computed, nextTick, ref } from 'vue'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { get, add, update, AllocationGroup, existsByNo } from './AllocationGroup.api'
import { get, add, update, AllocGroup, existsByNo } from './AllocationGroup.api'
import { FormEditType } from '@/enums/formTypeEnum'
import { BasicModal } from '@/components/Modal'
import { useDict } from '@/hooks/bootx/useDict'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { findChannels } from '../receiver/AllocationReceiver.api'
@@ -78,11 +88,10 @@
showable,
formEditType,
} = useFormEdit()
const { dictConvert, dictDropDown } = useDict()
// 表单
const formRef = ref<FormInstance>()
let form = ref<AllocationGroup>({})
let form = ref<AllocGroup>({})
let payChannelList = ref<LabeledValue[]>([])
// 校验
@@ -101,10 +110,11 @@
/**
* 入口
*/
function init(record, editType: FormEditType) {
function init(record, editType: FormEditType, appId) {
initFormEditType(editType)
resetForm()
initData()
form.value.appId = appId
getInfo(record, editType)
}
@@ -112,33 +122,31 @@
* 初始化数据
*/
async function initData() {
findChannels().then(({ data }) => (payChannelList = data))
findChannels().then(({ data }) => (payChannelList.value = data))
}
/**
* 获取信息
*/
async function getInfo(record: AllocationGroup, editType: FormEditType) {
async function getInfo(record: AllocGroup, editType: FormEditType) {
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
confirmLoading.value = true
await get(record.id).then(({ data }) => (form = data))
confirmLoading.value = false
} else {
confirmLoading.value = false
await get(record.id).then(({ data }) => (form.value = data))
}
confirmLoading.value = false
}
/**
* 保存
*/
function handleOk() {
formRef?.validate().then(async () => {
formRef.value?.validate().then(async () => {
confirmLoading.value = true
try {
if (formEditType.value === FormEditType.Add) {
await add(form)
await add(form.value)
} else if (formEditType.value === FormEditType.Edit) {
await update(form)
await update(form.value)
}
emits('ok')
} catch (error) {
@@ -152,8 +160,8 @@
* 校验编码重复
*/
async function validateCode() {
const { groupNo } = form
const res = await existsByNo(groupNo)
const { groupNo, appId } = form.value
const res = await existsByNo(groupNo, appId)
return res.data ? Promise.reject('该分账组编号已经存在') : Promise.resolve()
}
@@ -162,7 +170,7 @@
*/
function resetForm() {
nextTick(() => {
formRef?.resetFields()
formRef.value?.resetFields()
})
}
defineExpose({

View File

@@ -1,18 +1,34 @@
<template>
<div>
<basic-drawer
showFooter
v-bind="$attrs"
width="70%"
title="分账组配置"
:mask-closable="true"
:open="visible"
@close="visible = false"
>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" :default-item-count="3" @query="queryPage" @reset="resetQueryParams" />
<b-query
:query-params="model.queryParam"
:fields="fields"
:default-item-count="3"
@query="queryPage"
@reset="resetQueryParams"
/>
</div>
<div class="m-3 p-3 bg-white">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
<template #buttons>
<a-space>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add"
>新建</a-button
>
</a-space>
</template>
</vxe-toolbar>
<vxe-table
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"
@@ -26,15 +42,15 @@
</template>
</vxe-column>
<vxe-column field="name" title="分组名称" :min-width="160" />
<vxe-column field="channel" title="所属通道" :min-width="100">
<vxe-column field="channel" title="所属通道" :min-width="120" align="center">
<template #default="{ row }">
<a-tag>{{ dictConvert('PayChannel', row.channel) }}</a-tag>
<a-tag>{{ dictConvert('channel', row.channel) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="totalRate" title="分账比例" :min-width="100">
<template #default="{ row }"> {{ row.totalRate / 100.0 }}% </template>
<vxe-column field="totalRate" title="分账比例" align="center" :min-width="100">
<template #default="{ row }"> {{ row.totalRate }}% </template>
</vxe-column>
<vxe-column field="defaultGroup" title="默认分" :min-width="100">
<vxe-column field="defaultGroup" title="默认分账组" align="center" :min-width="100">
<template #default="{ row }">
<a-tag color="green" v-if="row.defaultGroup"></a-tag>
<a-tag v-else></a-tag>
@@ -46,7 +62,7 @@
<a-link danger @click="config(row)">接收方配置</a-link>
<a-divider type="vertical" />
<a-dropdown>
<a> 更多 <icon icon="ant-design:down-outlined" :size="12" /></a>
<a> 更多 <icon icon="ant-design:down-outlined" :size="12" /> </a>
<template #overlay>
<a-menu>
<a-menu-item v-if="!row.defaultGroup">
@@ -76,13 +92,13 @@
@page-change="handleTableChange"
/>
</div>
<allocation-group-edit ref="allocationGroupEdit" @ok="queryPage" />
<allocation-group-config ref="allocationGroupConfig" />
</div>
<AllocationGroupEdit ref="allocationGroupEdit" @ok="queryPage" />
<AllocationGroupConfig ref="allocationGroupConfig" />
</basic-drawer>
</template>
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { cancelDefaultGroup, del, page, setDefaultGroup } from './AllocationGroup.api'
import useTablePage from '@/hooks/bootx/useTablePage'
import { VxeTable, VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
@@ -90,79 +106,106 @@
import { useDict } from '@/hooks/bootx/useDict'
import ALink from '@/components/Link/Link.vue'
import BQuery from '@/components/Bootx/Query/BQuery.vue'
import Icon from '@/components/Icon/Icon.vue'
import { LIST, QueryField, STRING } from '@/components/Bootx/Query/Query'
import { LabeledValue } from 'ant-design-vue/lib/select'
import AllocationGroupEdit from './AllocationGroupEdit.vue'
import AllocationGroupConfig from './AllocationGroupConfig.vue'
import { FormEditType } from '@/enums/formTypeEnum'
import { findChannels } from '../receiver/AllocationReceiver.api'
import AllocationGroupConfig from './AllocationGroupConfig.vue'
import { BasicDrawer } from '@/components/Drawer'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, sortChange, sortParam, pages, model, loading } =
useTablePage(queryPage)
const {
handleTableChange,
pageQueryResHandel,
resetQueryParams,
pagination,
sortChange,
sortParam,
pages,
model,
loading,
} = useTablePage(queryPage)
const { createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
const appId = ref('')
const allocationGroupEdit = ref<any>()
const allocationGroupConfig = ref<any>()
const xTable = ref<VxeTableInstance>()
const xToolbar = ref<VxeToolbarInstance>()
const visible = ref(false)
let payChannelList = ref<LabeledValue[]>([])
const fields = computed(() => {
return [
{ field: 'groupNo', type: STRING, name: '分账组编号', placeholder: '请输入分账组编号' },
{ field: 'name', type: STRING, name: '分账组名称', placeholder: '请输入分账组名称' },
{ field: 'channel', type: LIST, name: '分账通道', placeholder: '请选择分账通道', selectList: payChannelList },
{
field: 'channel',
type: LIST,
name: '分账通道',
placeholder: '请选择分账通道',
selectList: payChannelList.value,
},
] as QueryField[]
})
onMounted(() => {
vxeBind()
initData()
queryPage()
})
/**
* 绑定
*/
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
xTable.value?.connect(xToolbar.value as VxeToolbarInstance)
}
/**
* 入口
*/
function init(mchAppId) {
appId.value = mchAppId
visible.value = true
queryPage()
}
/**
* 初始化数据
*/
async function initData() {
findChannels().then(({ data }) => (payChannelList = data))
findChannels().then(({ data }) => (payChannelList.value = data))
}
/**
* 新建
*/
function add() {
allocationGroupEdit.init(null, FormEditType.Add)
allocationGroupEdit.value.init(null, FormEditType.Add, appId)
}
/**
* 修改
*/
function edit(record) {
allocationGroupEdit.init(record, FormEditType.Edit)
allocationGroupEdit.value.init(record, FormEditType.Edit)
}
/**
* 查看
*/
function show(record) {
allocationGroupEdit.init(record, FormEditType.Show)
allocationGroupEdit.value.init(record, FormEditType.Show)
}
/**
* 配置页
*/
function config(record) {
allocationGroupConfig.init(record)
allocationGroupConfig.value.init(record)
}
/**
@@ -172,6 +215,7 @@
loading.value = true
page({
...model.queryParam,
appId: appId.value,
...pages,
...sortParam,
}).then(({ data }) => {
@@ -190,7 +234,7 @@
content: '是否确认删除该条数据?',
onOk: () => {
loading.value = true
del(record.id).then(({ data }) => {
del(record.id).then(() => {
createMessage.success('删除成功')
queryPage()
})
@@ -208,7 +252,7 @@
content: '是否确认设为默认分账组?',
onOk: () => {
loading.value = true
setDefaultGroup(record.id).then(({ data }) => {
setDefaultGroup(record.id).then(() => {
createMessage.success('设置成功')
queryPage()
})
@@ -226,13 +270,14 @@
content: '是否取消当前的默认分账组?',
onOk: () => {
loading.value = true
cancelDefaultGroup(record.id).then(({ data }) => {
cancelDefaultGroup(record.id).then(() => {
createMessage.success('取消成功')
queryPage()
})
},
})
}
defineExpose({ init })
</script>
<style scoped lang="less"></style>

View File

@@ -10,28 +10,39 @@
>
<vxe-toolbar>
<template #buttons>
<b-query :query-params="queryParam" :fields="fields" :default-item-md="8" @query="queryPage" @reset="() => (queryParam = {})" />
<b-query
:query-params="model.queryParam"
:fields="fields"
:default-item-md="8"
@query="queryPage"
@reset="() => (model.queryParam = {})"
/>
</template>
</vxe-toolbar>
<vxe-table row-id="id" ref="xTable" :height="350" :checkbox-config="checkboxConfig" :loading="loading" :data="pagination.records">
<vxe-table
key-field="id"
ref="xTable"
:checkbox-config="checkboxConfig"
:loading="loading"
:data="pagination.records"
>
<vxe-column type="checkbox" width="50" />
<vxe-column field="receiverNo" title="接收方编号" :min-width="160" />
<vxe-column field="receiverType" title="分账接收方类型" :min-width="100">
<template #default="{ row }">
<a-tag>{{ dictConvert('AllocReceiverType', row.receiverType) }}</a-tag>
<a-tag>{{ dictConvert('alloc_receiver_type', row.receiverType) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="receiverAccount" title="接收方账号" :min-width="160" />
<vxe-column field="receiverName" title="接收方姓名" :min-width="100" />
<vxe-column field="relationType" title="分账关系" :min-width="100">
<template #default="{ row }">
<a-tag>{{ dictConvert('AllocRelationType', row.relationType) }}</a-tag>
<a-tag>{{ dictConvert('alloc_relation_type', row.relationType) }}</a-tag>
</template>
</vxe-column>
</vxe-table>
<vxe-pager
border
row-id="id"
size="medium"
:height="350"
:loading="loading"
@@ -54,27 +65,34 @@
import useTablePage from '@/hooks/bootx/useTablePage'
import { page } from '../receiver/AllocationReceiver.api'
import { useDict } from '@/hooks/bootx/useDict'
import { computed } from 'vue'
import { computed, ref } from 'vue'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { useMessage } from '@/hooks/web/useMessage'
const { handleTableChange, pageQueryResHandel, pagination, pages, model, loading } = useTablePage(queryPage)
const { handleTableChange, pageQueryResHandel, pagination, model, pages, loading } =
useTablePage(queryPage)
const { dictConvert, dictDropDown } = useDict()
const { notification, createMessage, createConfirm } = useMessage()
const { createMessage } = useMessage()
const emits = defineEmits(['ok'])
let visible = ref(false)
let selectIds = ref<string[]>([])
let currentChannel = ref<string>('')
let queryParam = ref<any>({})
let relationTypeList = ref<LabeledValue[]>([])
const visible = ref(false)
const selectIds = ref<string[]>([])
const currentChannel = ref<string>('')
const currentAppId = ref<string>('')
const relationTypeList = ref<LabeledValue[]>([])
const xTable = ref<any>()
const fields = computed(() => {
return [
{ field: 'receiverNo', type: STRING, name: '接收方编号', placeholder: '请输入接收方编号' },
{ field: 'relationType', type: LIST, name: '分账关系', placeholder: '请选择分账关系', selectList: relationTypeList },
{
field: 'relationType',
type: LIST,
name: '分账关系',
placeholder: '请选择分账关系',
selectList: relationTypeList.value,
},
] as QueryField[]
})
const checkboxConfig = {
@@ -87,12 +105,13 @@
* @param receiverIds 已经选中的用户id集合
* @param channel 通道
*/
async function init(receiverIds, channel) {
visible = true
selectIds = receiverIds
currentChannel = channel
relationTypeList = await dictDropDown('AllocationRelationType')
queryPage()
async function init(receiverIds, channel, appId) {
visible.value = true
selectIds.value = receiverIds
currentChannel.value = channel
currentAppId.value = appId
relationTypeList.value = await dictDropDown('alloc_relation_type')
queryPage().then()
}
/**
* 查询
@@ -100,9 +119,10 @@
function queryPage() {
loading.value = true
page({
...queryParam,
...model.queryParam,
...pages,
channel: currentChannel,
appId: currentAppId.value,
channel: currentChannel.value,
}).then(({ data }) => {
pageQueryResHandel(data)
})
@@ -116,9 +136,9 @@
*/
function checkboxCallback() {
// 非本页选中的
const reserveUsers = xTable.getCheckboxReserveRecords()
const reserveUsers = xTable.value.getCheckboxReserveRecords()
// 本页选中的
const checkObjs = xTable.getCheckboxRecords()
const checkObjs = xTable.value.getCheckboxRecords()
const objs = reserveUsers.concat(checkObjs)
const ids = objs.map((res) => res.id)
if (!ids.length) {
@@ -127,28 +147,21 @@
}
emits('ok', ids)
visible = false
visible.value = false
}
/**
* 关闭
*/
function handleCancel() {
visible = false
visible.value = false
}
/**
* 禁止选中的行 复选
*/
function banCheckbox({ row }) {
return !selectIds.includes(row.id)
return !selectIds.value.includes(row.id)
}
defineExpose({ init })
</script>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'BUserSelectModal',
})
</script>
<style scoped></style>

View File

@@ -62,7 +62,7 @@
placeholder="请选择分账关系类型"
/>
</a-form-item>
<a-form-item v-if="form.relationType === 'CUSTOM'" label="接收者关系名称" name="relationName">
<a-form-item v-if="form.relationType === 'custom'" label="接收者关系名称" name="relationName">
<a-input v-model:value="form.relationName" :disabled="!addable" placeholder="请输入接收者关系名称" />
</a-form-item>
</a-form>
@@ -128,7 +128,7 @@
receiverType: [{ required: true, message: '请选择分账接收方类型' }],
receiverAccount: [{ required: true, message: '请输入接收方账号' }],
relationType: [{ required: true, message: '请选择分账关系类型' }],
relationName: [{ required: form.value.relationType === 'CUSTOM', message: '请输入类型关系名称' }],
relationName: [{ required: form.value.relationType === 'custom', message: '请输入类型关系名称' }],
} as Record<string, Rule[]>
})
@@ -150,7 +150,7 @@
*/
async function initData() {
findChannels().then(({ data }) => (payChannelList.value = data))
relationTypeList.value = await dictDropDown('AllocRelationType')
relationTypeList.value = await dictDropDown('alloc_relation_type')
}
/**
@@ -164,7 +164,9 @@
rawForm.value = { ...form.value }
})
confirmLoading.value = false
findReceiverTypeByChannel(form.value.channel).then(({ data }) => (receiverTypeList.value = data))
findReceiverTypeByChannel(form.value.channel).then(
({ data }) => (receiverTypeList.value = data),
)
} else {
confirmLoading.value = false
}

View File

@@ -3,24 +3,32 @@
showFooter
v-bind="$attrs"
width="70%"
title="收银配置"
title="接收方配置"
:mask-closable="true"
:open="visible"
@close="visible = false"
>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" :default-item-count="3" @query="queryPage" @reset="resetQueryParams" />
<b-query
:query-params="model.queryParam"
:fields="fields"
:default-item-count="3"
@query="queryPage"
@reset="resetQueryParams"
/>
</div>
<div class="m-3 p-3 bg-white">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
<template #buttons>
<a-space>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add">新建</a-button>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="add"
>新建</a-button
>
</a-space>
</template>
</vxe-toolbar>
<vxe-table
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"
@@ -33,21 +41,21 @@
<a-link @click="show(row)">{{ row.receiverNo }}</a-link>
</template>
</vxe-column>
<vxe-column field="channel" title="所属通道" :min-width="100">
<vxe-column field="channel" title="所属通道" :min-width="120" align="center">
<template #default="{ row }">
<a-tag>{{ dictConvert('PayChannel', row.channel) }}</a-tag>
<a-tag>{{ dictConvert('channel', row.channel) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="receiverType" title="接收方类型" :min-width="100">
<vxe-column field="receiverType" title="接收方类型" :min-width="100" align="center">
<template #default="{ row }">
<a-tag>{{ dictConvert('AllocReceiverType', row.receiverType) }}</a-tag>
<a-tag>{{ dictConvert('alloc_receiver_type', row.receiverType) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="receiverAccount" title="接收方账号" :min-width="230" />
<vxe-column field="receiverName" title="接收方姓名" :min-width="160" />
<vxe-column field="relationType" title="分账关系" :min-width="100">
<vxe-column field="relationType" title="分账关系" :min-width="100" align="center">
<template #default="{ row }">
<a-tag>{{ dictConvert('AllocRelationType', row.relationType) }}</a-tag>
<a-tag>{{ dictConvert('alloc_relation_type', row.relationType) }}</a-tag>
</template>
</vxe-column>
<vxe-column fixed="right" min-width="100" :showOverflow="false" title="操作">
@@ -72,8 +80,8 @@
</template>
<script setup lang="ts">
import {computed, onMounted, ref} from 'vue'
import {AllocReceiver, del, findChannels, page} from './AllocationReceiver.api'
import { computed, onMounted, ref } from 'vue'
import { AllocReceiver, del, findChannels, page } from './AllocationReceiver.api'
import useTablePage from '@/hooks/bootx/useTablePage'
import { VxeTable, VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { useMessage } from '@/hooks/web/useMessage'
@@ -84,11 +92,20 @@ import {AllocReceiver, del, findChannels, page} from './AllocationReceiver.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
import AllocationReceiverEdit from './AllocationReceiverEdit.vue'
import { FormEditType } from '@/enums/formTypeEnum'
import {BasicDrawer} from "@/components/Drawer";
import { BasicDrawer } from '@/components/Drawer'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, sortChange, sortParam, pages, model, loading } =
useTablePage(queryPage)
const {
handleTableChange,
pageQueryResHandel,
resetQueryParams,
pagination,
sortChange,
sortParam,
pages,
model,
loading,
} = useTablePage(queryPage)
const { createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDown } = useDict()
@@ -100,12 +117,32 @@ import {BasicDrawer} from "@/components/Drawer";
let payChannelList = ref<LabeledValue[]>([])
let relationTypeList = ref<LabeledValue[]>([])
let receiverTypeList = ref<LabeledValue[]>([])
const fields = computed(() => {
return [
{ field: 'receiverNo', type: STRING, name: '接收方编号', placeholder: '请输入接收方编号' },
{ field: 'channel', type: LIST, name: '分账通道', placeholder: '请选择分账通道', selectList: payChannelList },
{ field: 'relationType', type: LIST, name: '分账关系', placeholder: '请选择分账关系', selectList: relationTypeList },
{
field: 'channel',
type: LIST,
name: '分账通道',
placeholder: '请选择分账通道',
selectList: payChannelList,
},
{
field: 'allocReceiverType',
type: LIST,
name: '接收方类型',
placeholder: '请选择接收方类型',
selectList: receiverTypeList,
},
{
field: 'relationType',
type: LIST,
name: '分账关系',
placeholder: '请选择分账关系',
selectList: relationTypeList,
},
] as QueryField[]
})
onMounted(() => {
@@ -113,7 +150,7 @@ import {BasicDrawer} from "@/components/Drawer";
initData()
})
function init(mchAppId: string){
function init(mchAppId: string) {
visible.value = true
appId.value = mchAppId
queryPage()
@@ -131,14 +168,15 @@ import {BasicDrawer} from "@/components/Drawer";
*/
async function initData() {
findChannels().then(({ data }) => (payChannelList.value = data))
relationTypeList.value = await dictDropDown('allocation_relation_type')
relationTypeList.value = await dictDropDown('alloc_relation_type')
receiverTypeList.value = await dictDropDown('alloc_receiver_type')
}
/**
* 新建
*/
function add() {
allocationReceiverEdit.value.init(null, FormEditType.Add,appId)
allocationReceiverEdit.value.init(null, FormEditType.Add, appId)
}
/**
@@ -181,7 +219,7 @@ import {BasicDrawer} from "@/components/Drawer";
},
})
}
defineExpose({init})
defineExpose({ init })
</script>
<style scoped lang="less"></style>

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -46,14 +46,14 @@
</vxe-column>
<vxe-column field="notifyUrl" title="通知地址" :min-width="220" />
<vxe-column field="createTime" title="创建时间" :min-width="120" />
<vxe-column fixed="right" :width="200" :showOverflow="false" title="操作">
<vxe-column fixed="right" :width="220" :showOverflow="false" title="操作">
<template #default="{ row }">
<a-link @click="edit(row)">编辑</a-link>
<a-divider type="vertical" />
<a-link @click="showChannelSetup(row)">通道配置</a-link>
<a-divider type="vertical" />
<a-dropdown>
<a> 更多 <Icon icon="ant-design:down-outlined" :size="12" /> </a>
<a style="color:red"> 其他配置 <Icon icon="ant-design:down-outlined" :size="12" /> </a>
<template #overlay>
<a-menu>
<a-menu-item>
@@ -75,7 +75,7 @@
<a-link @click="showAllocGroup(row)">分账组</a-link>
</a-menu-item>
<a-menu-item>
<a-link danger @click="remove(row)">删除</a-link>
<a-link danger @click="remove(row)">删除应用</a-link>
</a-menu-item>
</a-menu>
</template>
@@ -97,8 +97,8 @@
<ChannelCashierConfigList ref="channelCashierConfigList" />
<ChannelCashierQrCode ref="channelCashierQrCode" />
<MerchantNotifyConfigList ref="merchantNotifyConfigList" />
<AllocationReceiverList ref="allocationReceiverList"/>
<!-- <AllocationGroupList ref="allocationGroupList"/>-->
<AllocationReceiverList ref="allocationReceiverList" />
<AllocationGroupList ref="allocationGroupList" />
</div>
</div>
</template>
@@ -120,8 +120,8 @@
import Icon from '@/components/Icon/Icon.vue'
import ChannelCashierConfigList from '@/views/daxpay/common/merchant/cashier/ChannelCashierConfigList.vue'
import ChannelCashierQrCode from '@/views/daxpay/common/merchant/cashier/ChannelCashierQrCode.vue'
import AllocationReceiverList from "@/views/daxpay/common/allocation/receiver/AllocationReceiverList.vue";
// import AllocationGroupList from "@/views/daxpay/common/allocation/group/AllocationGroupList.vue"
import AllocationReceiverList from '@/views/daxpay/common/allocation/receiver/AllocationReceiverList.vue'
import AllocationGroupList from '@/views/daxpay/common/allocation/group/AllocationGroupList.vue'
// 使用hooks
const {

View File

@@ -10,7 +10,7 @@
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<div class="h-75vh">
<vxe-table
row-id="id"
key-field="id"
height="auto"
ref="xTable"
:data="pagination.records"

View File

@@ -12,7 +12,7 @@
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<div class="h-65vh">
<vxe-table
row-id="id"
key-field="id"
height="auto"
ref="xTable"
:data="pagination.records"

View File

@@ -10,7 +10,7 @@
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<div class="h-75vh">
<vxe-table
row-id="id"
key-field="id"
ref="xTable"
height="auto"
:data="pagination.records"

View File

@@ -12,7 +12,7 @@
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<div class="h-65vh">
<vxe-table
row-id="id"
key-field="id"
ref="xTable"
height="auto"
:data="pagination.records"

View File

@@ -17,7 +17,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:cell-style="cellStyle"
:data="pagination.records"

View File

@@ -20,7 +20,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:cell-style="cellStyle"
:sort-config="{ remote: true, trigger: 'cell' }"

View File

@@ -20,7 +20,7 @@
<div class="h-64vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:cell-style="cellStyle"
:sort-config="{ remote: true, trigger: 'cell' }"

View File

@@ -13,7 +13,7 @@
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<div class="h-65vh">
<vxe-table
row-id="id"
key-field="id"
height="auto"
align="center"
ref="xTable"

View File

@@ -21,7 +21,7 @@
</vxe-toolbar>
<div class="h-65vh">
<vxe-table
row-id="id"
key-field="id"
ref="xTable"
height="auto"
align="center"

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:cell-style="cellStyle"
:data="pagination.records"

View File

@@ -13,7 +13,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -24,7 +24,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"

View File

@@ -14,7 +14,7 @@
<div class="h-65vh">
<vxe-table
height="auto"
row-id="id"
key-field="id"
ref="xTable"
:data="pagination.records"
:loading="loading"