mirror of
https://gitee.com/bootx/dax-pay-ui
synced 2026-08-13 15:55:43 +08:00
feat 分账订单
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { defHttp } from '/@/utils/http/axios'
|
||||
import { PageResult, Result } from '/#/axios'
|
||||
import { BaseEntity } from '/#/web'
|
||||
import { LabeledValue } from 'ant-design-vue/lib/select'
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
|
||||
@@ -52,14 +52,7 @@
|
||||
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 { AllocationGroup, AllocationGroupReceiver, bindReceivers, getReceivers, unbindReceiver, updateRate } from './AllocationGroup.api'
|
||||
import AllocationGroupSelect from '/@/views/payment/allocation/group/AllocationGroupSelect.vue'
|
||||
|
||||
// 使用hooks
|
||||
@@ -120,7 +113,7 @@
|
||||
groupId: group.id,
|
||||
receivers,
|
||||
}
|
||||
console.log()
|
||||
createMessage.success('添加中...')
|
||||
bindReceivers(param).then(() => {
|
||||
createMessage.success('添加成功')
|
||||
queryPage()
|
||||
@@ -147,7 +140,7 @@
|
||||
* 实时修改触发,
|
||||
*/
|
||||
function editActivatedEvent({ row }) {
|
||||
row.rate =row.rate / 100
|
||||
row.rate = row.rate / 100
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,17 +149,19 @@
|
||||
function editClosedEvent({ row, column }) {
|
||||
row.rate = Math.round(row.rate * 100)
|
||||
// 判断单元格值是否被修改
|
||||
if (xTable?.isUpdateByRow(row, column.field)){
|
||||
if (xTable?.isUpdateByRow(row, column.field)) {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确定修改该分账比例吗?',
|
||||
onOk: () => {
|
||||
updateRate(row.id, row.rate ).then(() => {
|
||||
createMessage.success('修改成功')
|
||||
xTable.reloadRow(row, null, column.field)
|
||||
}).catch(() => {
|
||||
xTable?.revertData(row)
|
||||
})
|
||||
updateRate(row.id, row.rate)
|
||||
.then(() => {
|
||||
createMessage.success('修改成功')
|
||||
xTable.reloadRow(row, null, column.field)
|
||||
})
|
||||
.catch(() => {
|
||||
xTable?.revertData(row)
|
||||
})
|
||||
},
|
||||
onCancel: () => {
|
||||
xTable?.revertData(row)
|
||||
|
||||
103
src/views/payment/order/allocation/AllocationOrder.api.ts
Normal file
103
src/views/payment/order/allocation/AllocationOrder.api.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import { defHttp } from '/@/utils/http/axios'
|
||||
import { PageResult, Result } from '/#/axios'
|
||||
import { BaseEntity } from '/#/web'
|
||||
import { LabeledValue } from 'ant-design-vue/lib/select'
|
||||
|
||||
/**
|
||||
* 获取可以分账的通道
|
||||
*/
|
||||
export function findChannels() {
|
||||
return defHttp.get<Result<LabeledValue[]>>({
|
||||
url: '/allocation/order/findChannels',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
export function page(params) {
|
||||
return defHttp.get<Result<PageResult<AllocationOrder>>>({
|
||||
url: '/allocation/order/page',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
export function get(id: string) {
|
||||
return defHttp.get<Result<AllocationOrder>>({
|
||||
url: '/allocation/order/findById',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细列表
|
||||
*/
|
||||
export function detailList(orderId: string) {
|
||||
return defHttp.get<Result<AllocationOrderDetail[]>>({
|
||||
url: '/allocation/order/detail/findAll',
|
||||
params: { orderId },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细详情
|
||||
*/
|
||||
export function detail(id: string) {
|
||||
return defHttp.get<Result<AllocationOrderDetail>>({
|
||||
url: '/allocation/order/detail/findById',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账订单
|
||||
*/
|
||||
export interface AllocationOrder extends BaseEntity {
|
||||
// 支付订单ID
|
||||
paymentId?: string
|
||||
// 支付标题
|
||||
title?: string
|
||||
// 网关支付订单号
|
||||
gatewayPayOrderNo?: string
|
||||
// 网关分账单号
|
||||
gatewayAllocationNo?: string
|
||||
// 分账单号
|
||||
allocationNo?: string
|
||||
// 外部请求号
|
||||
outReqNo?: string
|
||||
// 所属通道
|
||||
channel?: string
|
||||
// 总分账金额
|
||||
amount?: number
|
||||
// 分账描述
|
||||
description?: string
|
||||
// 状态
|
||||
status?: string
|
||||
// 错误原因
|
||||
errorMsg?: string
|
||||
// 完成时间
|
||||
finishTime?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账订单明细
|
||||
*/
|
||||
export interface AllocationOrderDetail extends BaseEntity {
|
||||
// 分账订单ID
|
||||
orderId?: string
|
||||
// 分账明细单号
|
||||
receiverId?: string
|
||||
// 分账明细状态
|
||||
rate?: number
|
||||
// 分账明细状态
|
||||
amount?: number
|
||||
// 分账接收方类型
|
||||
receiverType?: string
|
||||
// 接收方账号
|
||||
receiverAccount?: string
|
||||
// 接收方姓名
|
||||
receiverName?: string
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
11
src/views/payment/order/allocation/AllocationOrderInfo.vue
Normal file
11
src/views/payment/order/allocation/AllocationOrderInfo.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
136
src/views/payment/order/allocation/AllocationOrderList.vue
Normal file
136
src/views/payment/order/allocation/AllocationOrderList.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<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" />
|
||||
</div>
|
||||
<div class="m-3 p-3 bg-white">
|
||||
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
|
||||
<vxe-table
|
||||
row-id="id"
|
||||
ref="xTable"
|
||||
:data="pagination.records"
|
||||
:loading="loading"
|
||||
:sort-config="{ remote: true, trigger: 'cell' }"
|
||||
@sort-change="sortChange"
|
||||
>
|
||||
<vxe-column type="seq" title="序号" width="60" />
|
||||
<vxe-column field="title" title="订单标题" />
|
||||
<vxe-column field="paymentId" title="支付订单ID" />
|
||||
<vxe-column field="channel" title="所属通道">
|
||||
<template #default="{ row }">
|
||||
<a-tag>{{ dictConvert('PayChannel', row.channel) }}</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="allocationNo" title="分账单号" />
|
||||
<vxe-column field="amount" title="总分账金额">
|
||||
<template #default="{ row }"> {{ row.amount / 100.0 }}元 </template>
|
||||
</vxe-column>
|
||||
<vxe-column field="description" title="分账描述" />
|
||||
<vxe-column field="status" title="状态">
|
||||
<template #default="{ row }">
|
||||
<a-tag>{{ dictConvert('AllocationStatus', row.status) }}</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="errorMsg" title="错误原因" />
|
||||
<vxe-column field="finishTime" title="完成时间" />
|
||||
<vxe-column fixed="right" width="230" :showOverflow="false" title="操作">
|
||||
<template #default="{ row }">
|
||||
<a-link @click="show(row)">查看</a-link>
|
||||
<a-divider type="vertical" />
|
||||
<a-link danger @click="showDetail(row)">接收方配置</a-link>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<vxe-pager
|
||||
size="medium"
|
||||
:loading="loading"
|
||||
:current-page="pagination.current"
|
||||
:page-size="pagination.size"
|
||||
:total="pagination.total"
|
||||
@page-change="handleTableChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { $ref } from 'vue/macros'
|
||||
import { page, findChannels } from './AllocationOrder.api'
|
||||
import useTablePage from '/@/hooks/bootx/useTablePage'
|
||||
import { VxeTable, VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { useDict } from '/@/hooks/bootx/useDict'
|
||||
import ALink from '/@/components/Link/Link.vue'
|
||||
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
|
||||
import { LIST, QueryField, STRING } from '/@/components/Bootx/Query/Query'
|
||||
import { LabeledValue } from 'ant-design-vue/lib/select'
|
||||
import { FormEditType } from '/@/enums/formTypeEnum'
|
||||
|
||||
// 使用hooks
|
||||
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, sortChange, sortParam, pages, model, loading } =
|
||||
useTablePage(queryPage)
|
||||
const { notification, createMessage, createConfirm } = useMessage()
|
||||
const { dictConvert, dictDropDown } = useDict()
|
||||
|
||||
const xTable = $ref<VxeTableInstance>()
|
||||
const xToolbar = $ref<VxeToolbarInstance>()
|
||||
const allocationOrderDetailList = $ref<any>()
|
||||
const allocationOrderInfo = $ref<any>()
|
||||
|
||||
let payChannelList = $ref<LabeledValue[]>([])
|
||||
|
||||
const fields = computed(() => {
|
||||
return [
|
||||
{ field: 'name', type: STRING, name: '分账组名称', placeholder: '请输入分账组名称' },
|
||||
{ field: 'channel', type: LIST, name: '分账通道', placeholder: '请选择分账通道', selectList: payChannelList },
|
||||
] as QueryField[]
|
||||
})
|
||||
onMounted(() => {
|
||||
vxeBind()
|
||||
initData()
|
||||
queryPage()
|
||||
})
|
||||
|
||||
/**
|
||||
* 绑定
|
||||
*/
|
||||
function vxeBind() {
|
||||
xTable?.connect(xToolbar as VxeToolbarInstance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
async function initData() {
|
||||
findChannels().then(({ data }) => (payChannelList = data))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
function show(record) {
|
||||
allocationOrderInfo.init(record, FormEditType.Show)
|
||||
}
|
||||
|
||||
function showDetail(record) {
|
||||
allocationOrderDetailList.init(record)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
function queryPage() {
|
||||
loading.value = true
|
||||
page({
|
||||
...model.queryParam,
|
||||
...pages,
|
||||
...sortParam,
|
||||
}).then(({ data }) => {
|
||||
pageQueryResHandel(data)
|
||||
})
|
||||
return Promise.resolve()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
Reference in New Issue
Block a user