Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.5 #3

Merged
merged 14 commits into from
Apr 18, 2024
Next Next commit
feat 更新项目logo, 分账接收方肯开发
  • Loading branch information
xxm1995 committed Apr 2, 2024
commit 87019e97a9b8658551bb4c8fa8df220a3aaa0ff0
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
VITE_PORT=3100

# spa-title
VITE_GLOB_APP_TITLE=dax-pay
VITE_GLOB_APP_TITLE=支付网关管理端

# spa shortname
VITE_GLOB_APP_SHORT_NAME=dax_pay
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Dax-Pay-UI


## ❗使用须知

`DaxPay`是一款基于`Apache License 2.0`协议分发的开源软件,受中华人民共和国相关法律法规的保护和限制,可以在符合[《用户授权使用协议》](用户授权使用协议.txt)和
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</style>
<div class="app-loading">
<div class="app-loading-wrap">
<img src="/resource/img/logo.png" class="app-loading-logo" alt="Logo" />
<img src="/resource/img/logo-dark.png" class="app-loading-logo" alt="Logo" />
<div class="app-loading-dots">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/resource/img/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/resource/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions src/views/payment/allocation/group/AllocationGroup.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
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 page(params) {
return defHttp.get<Result<PageResult<AllocationGroup>>>({
url: '/allocation/group/page',
params,
})
}

/**
* 查询详情
*/
export function get(id) {
return defHttp.get<Result<AllocationGroup>>({
url: '/allocation/group/findById',
params: { id },
})
}

/**
* 查询分账接收方信息
*/
export function getReceivers(groupId) {
return defHttp.get<Result<LabeledValue[]>>({
url: '/allocation/group/findReceiversByGroups',
params: { groupId },
})
}

/**
* 创建
*/
export function add(data: AllocationGroup) {
return defHttp.post<Result<AllocationGroup>>({
url: '/allocation/group/create',
data,
})
}

/**
* 修改
*/
export function update(data: AllocationGroup) {
return defHttp.post<Result<AllocationGroup>>({
url: '/allocation/group/update',
data,
})
}

/**
* 删除
*/
export function del(id) {
return defHttp.post<Result>({
url: '/allocation/group/delete',
params: { id },
})
}

/**
* 批量绑定接收者
*/
export function bindReceivers(data: { groupId: string; receiverIds: string[] }) {
return defHttp.post<Result>({
url: '/allocation/group/bindReceivers',
data,
})
}

/**
* 批量取消绑定接收者
*/
export function unbindReceivers(data: { groupId: string; receiverIds: string[] }) {
return defHttp.post<Result>({
url: '/allocation/group/unbindReceivers',
data,
})
}

/**
* 取消绑定接收者
*/
export function unbindReceiver(data: { groupId: string; receiverId: string }) {
return defHttp.post<Result>({
url: '/allocation/group/unbindReceiver',
data,
})
}

/**
* 修改分账比例
*/
export function updateRate(receiverId: string, rate: number) {
return defHttp.post<Result>({
url: '/allocation/group/updateRate',
params: { receiverId, rate},
})
}

/**
* 分账组
*/
export interface AllocationGroup extends BaseEntity {
/**
* 分账组名称
*/
name?: string
/**
* 通道
*/
channel?: string
/**
* 总分账比例
*/
totalRate?: number
/**
* 分账组描述
*/
remark?: string
}
161 changes: 161 additions & 0 deletions src/views/payment/allocation/group/AllocationGroupEdit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<template>
<basic-modal
v-bind="$attrs"
:loading="confirmLoading"
:width="modalWidth"
:title="title"
:visible="visible"
:mask-closable="showable"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-form
class="small-from-item"
ref="formRef"
:model="form"
:rules="rules"
:validate-trigger="['blur', 'change']"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="主键" name="id" :hidden="true">
<a-input v-model:value="form.id" :disabled="showable" />
</a-form-item>
<a-form-item label="分账组名称" name="name">
<a-input v-model:value="form.name" :disabled="showable" placeholder="请输入分账组名称" />
</a-form-item>
<a-form-item label="所属通道" name="channel">
<a-select
style="width: 100%"
v-model:value="form.channel"
:disabled="!addable"
:options="payChannelList"
placeholder="请选择所属通道"
/>
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea :disabled="showable" placeholder="请输入备注" v-model:value="form.remark" />
</a-form-item>
</a-form>
</a-spin>
<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-space>
</template>
</basic-modal>
</template>

<script setup lang="ts">
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { useValidate } from '/@/hooks/bootx/useValidate'
import { useMessage } from '/@/hooks/web/useMessage'
import { computed, nextTick } from 'vue'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { get, add, update, AllocationGroup } 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'

const {
initFormEditType,
handleCancel,
search,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
addable,
editable,
showable,
formEditType,
} = useFormEdit()
const { existsByServer } = useValidate()
const { createMessage } = useMessage()
const { dictConvert, dictDropDown } = useDict()

// 表单
const formRef = $ref<FormInstance>()
let form = $ref<AllocationGroup>({})
let payChannelList = $ref<LabeledValue[]>([])

// 校验
const rules = computed(() => {
return {
name: [{ required: true, message: '请输入账号别名' }],
channel: [{ required: true, message: '请选择所属通道' }],
} as Record<string, Rule[]>
})

const emits = defineEmits(['ok'])

/**
* 入口
*/
function init(record, editType: FormEditType) {
initFormEditType(editType)
resetForm()
initData()
getInfo(record, editType)
}

/**
* 初始化数据
*/
async function initData() {
findChannels().then(({ data }) => (payChannelList = data))
}

/**
* 获取信息
*/
async function getInfo(record: AllocationGroup, editType: FormEditType) {
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
form = record
confirmLoading.value = true
await get(record.id).then(({ data }) => (form = data))
confirmLoading.value = false
} else {
confirmLoading.value = false
}
}

/**
* 保存
*/
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
try {
if (formEditType.value === FormEditType.Add) {
await add(form)
} else if (formEditType.value === FormEditType.Edit) {
await update(form)
}
emits('ok')
} catch (error) {
confirmLoading.value = false
}
handleCancel()
})
}

/**
* 重置表单
*/
function resetForm() {
nextTick(() => {
formRef?.resetFields()
})
}
defineExpose({
init,
})
</script>

<style scoped lang="less"></style>
Loading