feat 钱包个人开通支持多商户和多应用

This commit is contained in:
xxm
2023-07-25 23:04:03 +08:00
parent 9e4e509814
commit fb57620d61
5 changed files with 72 additions and 33 deletions

View File

@@ -1,9 +1,9 @@
1.0.1
- x 钱包配置
- x 储值卡日志信息
- 钱包支持多商户和多应用
- 钱包批量开通适配
- 个人自助开通适配
- x 钱包支持多商户和多应用
- x 钱包批量开通适配
- x 个人自助开通适配
- 储值卡支持多商户和多应用
- x 生成储值卡适配
- 使用适配

View File

@@ -91,7 +91,7 @@
let selectUserId = $ref<string>()
const xTable = $ref<any>()
const fields = [
{ field: 'name', type: STRING, name: '账号', placeholder: '输入用户名称' },
{ field: 'name', type: STRING, name: '名称', placeholder: '输入用户名称' },
{ field: 'username', type: STRING, name: '账号', placeholder: '输入用户账号' },
]
const checkboxConfig = computed(() => {

View File

@@ -125,18 +125,20 @@ export function changerBalance(obj) {
/**
* 查询用户钱包
*/
export function findByUser() {
export function findByUser(params) {
return defHttp.get<Result<Wallet>>({
url: '/wallet/findByUser',
params: params,
})
}
/**
* 开通钱包
*/
export function createWallet() {
export function createWallet(params) {
return defHttp.post<Result<void>>({
url: '/wallet/createWallet',
params: params,
})
}

View File

@@ -1,7 +1,7 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @query="queryPage" @reset="resetQueryParams" />
<b-query :query-params="model.queryParam" :default-item-count="3" :fields="fields" @query="queryPage" @reset="resetQueryParams" />
</div>
<div class="m-3 p-3 bg-white">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }">
@@ -89,10 +89,10 @@
const { dictConvert } = useDict()
// 查询条件
const fields = [
{ field: 'walletId', type: STRING, name: '钱包ID', placeholder: '请输入钱包ID' },
{ field: 'userId', type: STRING, name: '用户ID', placeholder: '请输入用户ID' },
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入应用编码' },
{ field: 'walletId', type: STRING, name: '钱包ID', placeholder: '请输入钱包ID' },
{ field: 'userId', type: STRING, name: '用户ID', placeholder: '请输入用户ID' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()

View File

@@ -1,28 +1,35 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<div v-if="wallet">
<a-form ref="formRef" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-item label="状态">
{{ dictConvert('WalletStatus', wallet.status) }}
<div>
<a-form :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-item label="商户号" name="mchCode">
<a-select allow-clear :options="mchList" v-model:value="form.mchCode" placeholder="请选择商户" @change="mchAppChange" />
</a-form-item>
<a-form-item label="余额">
{{ wallet.balance }}
</a-form-item>
<a-form-item>
<template #label>
<basic-title
helpMessage="输入网址或以outside://开头会的路径从外部打开页面,请求路径后添加?onlytab=1&__full__参数后只显示显示标签页内容"
>预冻结额度</basic-title
>
</template>
{{ wallet.freezeBalance }}
<a-form-item label="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" @change="getWallet" />
</a-form-item>
<template v-if="wallet">
<a-form-item label="状态">
{{ dictConvert('WalletStatus', wallet.status) }}
</a-form-item>
<a-form-item label="余额">
{{ wallet.balance }}
</a-form-item>
<a-form-item>
<template #label>
<basic-title helpMessage="当前进行支付中, 且支付未完成冻结的金额">预冻结额度</basic-title>
</template>
{{ wallet.freezeBalance }}
</a-form-item>
</template>
<template v-if="form.mchAppCode && !wallet">
<a-form-item label="开通">
<a-button type="primary" @click="createMyWallet">点此开通钱包</a-button>
</a-form-item>
</template>
</a-form>
</div>
<div v-else>
<a-button type="primary" @click="createMyWallet">开通钱包</a-button>
</div>
</a-spin>
</a-card>
</template>
@@ -33,6 +40,9 @@
import BasicTitle from '/@/components/Basic/src/BasicTitle.vue'
import { onMounted } from 'vue'
import { useDict } from '/@/hooks/bootx/useDict'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
@@ -44,19 +54,46 @@
sm: { span: 13 },
}
const form = $ref({
mchCode: undefined,
mchAppCode: undefined,
})
let loading = $ref(false)
let wallet = $ref<Wallet>()
// 商户和应用下拉列表
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
onMounted(() => {
initWallet()
init()
})
/**
* 初始化信息
*/
function init() {
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
}
/**
* 商户应用下拉列表
*/
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
mchAppList = data
})
}
/**
* 初始化钱包信息
*/
async function initWallet() {
loading = true
const { data } = await findByUser()
async function getWallet() {
const { data } = await findByUser(form)
wallet = data
loading = false
}
@@ -70,9 +107,9 @@
title: '警告',
content: '是否开通我的钱包',
onOk: async () => {
await createWallet()
await createWallet(form)
createMessage.success('钱包开通中...')
await initWallet()
await getWallet()
},
})
}