9 Commits

Author SHA1 Message Date
xxm1995
290c817ea3 fix 切换应用APP的时候选择的旧数据不删除 2023-07-28 16:48:45 +08:00
xxm1995
29dfa2fe4e feat 多卡支付 2023-07-28 10:48:01 +08:00
xxm1995
952607de91 feat 结算台适配多商户 2023-07-26 17:30:58 +08:00
xxm
fb57620d61 feat 钱包个人开通支持多商户和多应用 2023-07-25 23:04:03 +08:00
xxm1995
9e4e509814 feat 钱包和储值卡适配多商户 2023-07-25 20:28:39 +08:00
xxm
74de6b10f2 feat 商户钱包配置 2023-07-24 23:27:19 +08:00
xxm1995
7839919a99 perf 表结构调整, 储值卡日志 2023-07-24 17:26:22 +08:00
xxm1995
1bbb5aced8 perf 网关同步记录优化 2023-07-17 14:04:25 +08:00
xxm1995
c218677366 perf 详情显示优化 2023-07-14 17:08:29 +08:00
43 changed files with 1347 additions and 1075 deletions

14
_doc/Task.md Normal file
View File

@@ -0,0 +1,14 @@
1.0.1
- x 钱包配置
- x 储值卡日志信息
- x 钱包支持多商户和多应用
- x 钱包批量开通适配
- x 个人自助开通适配
- x 储值卡支持多商户和多应用
- x 生成储值卡适配
- x 使用适配 结算台
- x 结算台支持多商户
- x 简单结算台
- x 组合支付结算台
- x 储值卡多卡支付
- x 支付

View File

@@ -1,6 +1,6 @@
{
"name": "dax-pay-ui",
"version": "1.3",
"version": "1.0.0",
"author": {
"name": "xxm"
},

View File

@@ -70,7 +70,10 @@
multiple?: boolean
// 宽度
width?: number | string
// 数据源
/**
* 数据源
* 返回的格式需要为 Result<PageResult<T>>
*/
dataSource?: Function
}
const props = withDefaults(defineProps<Props>(), {
@@ -88,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

@@ -3,6 +3,12 @@
<a-spin :spinning="loading">
<div>
<a-form ref="formRef" :model="form" :rules="rules" :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="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" @change="getWallet" />
</a-form-item>
<a-form-item label="异步支付方式" name="payChannel">
<a-radio-group v-model:value="form.payChannel" :default-value="1" button-style="solid">
<a-radio-button v-for="o in payChannel" :value="o.code" :key="o.code"> {{ o.label }} </a-radio-button>
@@ -19,16 +25,41 @@
<a-input v-model:value="form.title" />
</a-form-item>
<a-form-item label="微信/支付宝金额" name="asyncAmount">
<a-input-number placeholder="请输入金额" :precision="2" v-model:value="form.asyncAmount" />
</a-form-item>
<a-form-item label="钱包支付" name="walletAmount">
<a-input-number placeholder="请输入金额" :precision="2" v-model:value="form.walletAmount" />
<template #help>
<span>钱包余额{{ wallet.balance }}</span>
</template>
<a-input-number placeholder="请输入金额" :precision="2" :min="0" v-model:value="form.asyncAmount" />
</a-form-item>
<a-form-item label="现金支付" name="cashAmount">
<a-input-number placeholder="请输入金额" :precision="2" v-model:value="form.cashAmount" />
<a-input-number placeholder="请输入金额" :precision="2" :min="0" v-model:value="form.cashAmount" />
</a-form-item>
<a-form-item label="钱包支付" name="walletAmount">
<a-input-number
placeholder="请输入金额"
:disabled="!wallet"
:precision="2"
:max="wallet?.balance"
:min="0"
v-model:value="form.walletAmount"
/>
<template #help>
<span v-if="wallet">钱包余额{{ wallet.balance }}</span>
<span v-else>用户钱包不存在或者未开通</span>
</template>
</a-form-item>
<a-form-item label="储值卡卡号" name="voucherNo">
<a-input v-model:value="form.voucherNo" @blur="getVoucher" placeholder="请输入储值卡号" />
<template #help>
<span v-if="voucher">储值卡面值{{ voucher.faceValue }} 余额{{ voucher.balance }}</span>
<span v-else>{{ voucherWarn }}</span>
</template>
</a-form-item>
<a-form-item label="储值卡支付" name="voucherAmount">
<a-input-number
placeholder="请输入金额"
:disabled="!voucher"
:max="voucher?.balance"
:min="0"
:precision="2"
v-model:value="form.voucherAmount"
/>
</a-form-item>
</a-form>
</div>
@@ -44,7 +75,7 @@
<script lang="ts" setup>
import { $ref } from 'vue/macros'
import { combinationPay, findStatusByBusinessId } from '/@/views/demo/payment/cashier/Cashier.api'
import { Voucher } from '/@/views/modules/payment/voucher/Voucher.api'
import { getAndJudgeVoucher, Voucher } from '/@/views/modules/payment/channel/voucher/list/Voucher.api'
import { useMessage } from '/@/hooks/web/useMessage'
import { FormInstance } from 'ant-design-vue/lib/form'
import { useIntervalFn } from '@vueuse/core'
@@ -54,7 +85,10 @@
import { payWayEnum } from '/@/enums/payment/payWayEnum'
import { findByParamKey } from '/@/api/common/Parameter'
import { PayStatus } from '/@/enums/payment/PayStatus'
import { findByUser as findWalletByUser, Wallet } from '/@/views/modules/payment/wallet/Wallet.api'
import { findByUser as findWalletByUser, Wallet } from '/@/views/modules/payment/channel/wallet/Wallet.api'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
const { createMessage } = useMessage()
@@ -73,26 +107,33 @@
]
let loading = $ref(false)
let visible = $ref(false)
let voucher = $ref<Voucher>({})
let wallet = $ref<Wallet>({ balance: 0 })
let voucher = $ref<Voucher>()
let wallet = $ref<Wallet>()
let form = $ref({
payChannel: payChannelEnum.ALI,
payWay: payWayEnum.QRCODE,
businessId: '',
title: '测试支付订单',
asyncAmount: null,
walletAmount: null,
cashAmount: null,
asyncAmount: 0,
walletAmount: 0,
voucherAmount: 0,
cashAmount: 0,
voucherNo: null,
mchCode: '',
mchAppCode: '',
})
const rules = {
mchCode: [{ required: true, message: '请选择商户' }],
mchAppCode: [{ required: true, message: '请选择商户对应的应用' }],
payChannel: [{ required: true, message: '支付通道不可为空' }],
businessId: [{ required: true, message: '业务ID不可为空' }],
title: [{ required: true, message: '金额不可=不可为空' }],
payWay: [{ required: true, message: '支付方式不可为空' }],
}
let voucherWarn = $ref('')
// 商户和应用下拉列表
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
// 检查支付状态
const { pause, resume } = useIntervalFn(
() => {
@@ -117,26 +158,70 @@
})
/**
* 初始化钱包信息
* 商户应用下拉列表
*/
function initWallet() {
// 获取钱包
findWalletByUser().then((res) => {
wallet = res.data
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 获取钱包信息
*/
function getWallet() {
// 获取钱包
findWalletByUser({
mchCode: form.mchCode,
mchAppCode: form.mchAppCode,
}).then((res) => {
if (res.data) {
wallet = res.data
} else {
wallet = null as any
form.walletAmount = 0
}
})
}
/**
* 获取储值卡信息
*/
function getVoucher() {
if (form.voucherNo) {
getAndJudgeVoucher({ cardNo: form.voucherNo }).then(({ data }) => {
// 储值卡是否属于当前商户
if (data.mchCode !== form.mchCode || data.mchAppCode !== form.mchAppCode) {
voucher = null as any
voucherWarn = '储值卡当前商户无法使用'
form.voucherAmount = 0
} else {
voucher = data
}
})
}
}
/**
* 初始化数据
*/
async function init() {
genOrderNo()
initWallet()
// 获取商户和应用编码
form.mchCode = (await findByParamKey('CashierMchCode')).data
form.mchAppCode = (await findByParamKey('CashierMchAppCode')).data
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
// 初始化应用下拉列表
mchAppChange()
getWallet()
}
// 生成订单号
/**
* 生成订单号
*/
function genOrderNo() {
form.businessId = 'P' + new Date().getTime()
}
@@ -172,7 +257,7 @@
resume()
} else {
genOrderNo()
initWallet()
getWallet()
createMessage.success('支付成功')
}
})
@@ -185,7 +270,7 @@
cashierQrCode.handleClose()
loading = false
genOrderNo()
initWallet()
getWallet()
pause()
}
</script>

View File

@@ -3,6 +3,12 @@
<a-spin :spinning="loading">
<div>
<a-form ref="formRef" :model="form" :rules="rules" :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="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" @change="getWallet" />
</a-form-item>
<a-form-item label="支付方式" name="payChannel">
<a-radio-group v-model:value="form.payChannel" button-style="solid">
<a-radio-button v-for="o in payChannel" :value="o.code" :key="o.code"> {{ o.name }} </a-radio-button>
@@ -21,13 +27,15 @@
<a-form-item label="金额" name="amount">
<a-input-number :precision="2" :min="0.01" v-model:value="form.amount" placeholder="请输入金额" />
<template v-if="form.payChannel === payChannelEnum.WALLET" #help>
<span>钱包余额{{ wallet.balance }}</span>
<span v-if="wallet">钱包余额{{ wallet.balance }}</span>
<span v-else></span>
</template>
</a-form-item>
<a-form-item label="储值卡" name="voucherNo" v-if="form.payChannel === payChannelEnum.VOUCHER">
<a-input v-model:value="form.voucherNo" @blur="getVoucher" placeholder="请输入储值卡号" />
<template #help>
<span>储值卡面值{{ voucher.faceValue }} 余额{{ voucher.balance }}</span>
<span v-if="voucher">储值卡面值{{ voucher.faceValue }} 余额{{ voucher.balance }}</span>
<span v-else></span>
</template>
</a-form-item>
</a-form>
@@ -48,13 +56,16 @@
import { FormInstance } from 'ant-design-vue/lib/form'
import { useIntervalFn } from '@vueuse/core'
import { useMessage } from '/@/hooks/web/useMessage'
import { getAndJudgeVoucher, Voucher } from '/@/views/modules/payment/voucher/Voucher.api'
import { getAndJudgeVoucher, Voucher } from '/@/views/modules/payment/channel/voucher/list/Voucher.api'
import CashierQrCode from './CashierQrCode.vue'
import { payChannelEnum } from '/@/enums/payment/payChannelEnum'
import { findByParamKey } from '/@/api/common/Parameter'
import { payWayEnum } from '/@/enums/payment/payWayEnum'
import { PayStatus } from '/@/enums/payment/PayStatus'
import { findByUser as findWalletByUser, Wallet } from '/@/views/modules/payment/wallet/Wallet.api'
import { findByUser as findWalletByUser, Wallet } from '/@/views/modules/payment/channel/wallet/Wallet.api'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
const { createMessage } = useMessage()
@@ -71,33 +82,36 @@
const payChannel = [
{ code: payChannelEnum.ALI, name: '支付宝' },
{ code: payChannelEnum.WECHAT, name: '微信' },
// { code: 3, name: '云闪付' },
{ code: payChannelEnum.WALLET, name: '钱包' },
{ code: payChannelEnum.VOUCHER, name: '储值卡' },
]
let loading = $ref(false)
let visible = $ref(false)
let wallet = $ref<Wallet>({ balance: 0 })
let voucher = $ref<Voucher>({})
let wallet = $ref<Wallet>()
let voucher = $ref<Voucher>()
let form = $ref({
payChannel: payChannelEnum.ALI,
payWay: payWayEnum.QRCODE,
businessId: '',
voucherNo: '',
title: '测试支付订单',
// 二维码支付方式
amount: 0.01,
mchCode: '',
mchAppCode: '',
})
const rules = {
payChannel: [{ required: true, message: '不可为空' }],
businessId: [{ required: true, message: '不可为空' }],
title: [{ required: true, message: '不可为空' }],
payWay: [{ required: true, message: '不可为空' }],
amount: [{ required: true, message: '不可为空' }],
voucherNo: [{ required: true, message: '不可为空' }],
mchCode: [{ required: true, message: '请选择商户' }],
mchAppCode: [{ required: true, message: '请选择商户对应的应用' }],
payChannel: [{ required: true, message: '支付通道不可为空' }],
businessId: [{ required: true, message: '业务不可为空' }],
title: [{ required: true, message: '标题不可为空' }],
payWay: [{ required: true, message: '支付方式不可为空' }],
amount: [{ required: true, message: '金额不可为空' }],
voucherNo: [{ required: true, message: '储值卡号不可为空' }],
}
// 商户和应用下拉列表
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
// 检查支付状态
const { pause, resume } = useIntervalFn(
@@ -117,7 +131,9 @@
1000 * 3,
{ immediate: false },
)
/**
* 页面加载钩子
*/
onMounted(() => {
initData()
})
@@ -128,23 +144,64 @@
async function initData() {
// 生成订单号
genOrderNo()
// 初始化钱包信息
initWallet()
// 获取商户和应用编码
form.mchCode = (await findByParamKey('CashierMchCode')).data
form.mchAppCode = (await findByParamKey('CashierMchAppCode')).data
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
// 初始化应用下拉列表
mchAppChange()
// 初始化钱包信息
getWallet()
}
/**
* 初始化钱包信息
* 商户应用下拉列表
*/
function initWallet() {
// 获取钱包
findWalletByUser().then((res) => {
wallet = res.data
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 获取钱包信息
*/
function getWallet() {
// 获取钱包
findWalletByUser({
mchCode: form.mchCode,
mchAppCode: form.mchAppCode,
}).then((res) => {
if (res.data) {
wallet = res.data
} else {
wallet = null as any
createMessage.warn('用户钱包不存在或者未开通')
}
})
}
/**
* 获取储值卡信息
*/
function getVoucher() {
if (form.voucherNo) {
getAndJudgeVoucher({ cardNo: form.voucherNo }).then(({ data }) => {
// 储值卡是否属于当前商户
if (data.mchCode !== form.mchCode || data.mchAppCode !== form.mchAppCode) {
voucher = null as any
createMessage.warn('储值卡当前商户无法使用')
} else {
voucher = data
}
})
}
}
/**
* 生成订单号
*/
@@ -171,23 +228,13 @@
resume()
} else {
createMessage.success('支付成功')
initWallet()
getWallet()
genOrderNo()
getVoucher()
pause()
}
})
}
/**
* 获取储值卡信息
*/
function getVoucher() {
if (form.voucherNo) {
getAndJudgeVoucher(form.voucherNo).then(({ data }) => {
voucher = data
})
}
}
/**
* 关闭扫码弹窗

View File

@@ -0,0 +1,240 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<a-form ref="formRef" :model="form" :rules="rules" v-bind="formItemLayout">
<a-form-item label="商户号" name="mchCode">
<a-select
style="width: 60%"
allow-clear
:options="mchList"
v-model:value="form.mchCode"
placeholder="请选择商户"
@change="mchAppChange"
/>
</a-form-item>
<a-form-item label="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select style="width: 60%" allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" />
</a-form-item>
<a-form-item label="订单编号" name="businessId">
<a-input style="width: 60%" v-model:value="form.businessId" placeholder="请输入订单编号">
<template #addonAfter>
<a-button type="link" size="small" @click="genOrderNo"> 生成订单号 </a-button>
</template>
</a-input>
</a-form-item>
<a-form-item label="订单名称" name="title">
<a-input style="width: 60%" v-model:value="form.title" placeholder="请输入金额" />
</a-form-item>
<a-form-item label="金额" name="amount">
<a-input-number style="width: 60% !important" :precision="2" :min="0.01" v-model:value="form.amount" placeholder="请输入金额" />
</a-form-item>
<a-form-item
v-for="(o, i) in form.vouchers"
:key="o.key"
v-bind="formItemLayout"
:label="'储值卡 ' + (i + 1)"
:name="['vouchers', i, 'value']"
:rules="{ required: true, message: '储值卡号必填' }"
>
<a-input v-model:value="o.value" style="width: 60%; margin-right: 8px" placeholder="请填入储值卡号" @blur="getVoucher(o)" />
<template #help>
<span v-if="o.voucher">储值卡面值{{ o.voucher.faceValue }} 余额{{ o.voucher.balance }}</span>
<span v-else></span>
</template>
<MinusCircleOutlined
v-if="form.vouchers.length > 1"
class="dynamic-delete-button"
:disabled="form.vouchers.length === 1"
@click="removeVoucher(o)"
/>
</a-form-item>
<a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: 60%" @click="addVoucher">
<PlusOutlined />
添加新储值卡
</a-button>
</a-form-item>
</a-form>
<div style="display: flex; justify-content: center">
<a-button type="primary" @click="pay"> 发起支付 </a-button>
</div>
</a-spin>
</a-card>
</template>
<script setup lang="ts">
import { $ref } from 'vue/macros'
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
import { onMounted, reactive } from 'vue'
import { FormInstance } from 'ant-design-vue/lib/form'
import { getAndJudgeVoucher, Voucher } from '/@/views/modules/payment/channel/voucher/list/Voucher.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { payChannelEnum } from '/@/enums/payment/payChannelEnum'
import { payWayEnum } from '/@/enums/payment/payWayEnum'
import { findByParamKey } from '/@/api/common/Parameter'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { singlePay } from '/@/views/demo/payment/cashier/Cashier.api'
import { useMessage } from '/@/hooks/web/useMessage'
const { createMessage } = useMessage()
const formItemLayoutWithOutLabel = {
wrapperCol: {
xs: { span: 24, offset: 0 },
sm: { span: 20, offset: 4 },
},
}
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
}
/**
* 动态表单项
*/
interface Item {
value: string
key: number
voucher?: Voucher
voucherMsg?: string
}
const rules = {
mchCode: [{ required: true, message: '请选择商户' }],
mchAppCode: [{ required: true, message: '请选择商户对应的应用' }],
businessId: [{ required: true, message: '业务不可为空' }],
title: [{ required: true, message: '标题不可为空' }],
amount: [{ required: true, message: '金额不可为空' }],
}
let loading = $ref(false)
const formRef = $ref<FormInstance>()
// 商户和应用下拉列表
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
const form = reactive({
payChannel: payChannelEnum.VOUCHER,
payWay: payWayEnum.NORMAL,
title: '测试多卡支付订单',
businessId: '',
amount: 0.01,
mchCode: '',
mchAppCode: '',
// 储值卡
vouchers: [
{
value: '',
key: Date.now(),
},
],
})
/**
* 页面加载钩子
*/
onMounted(() => {
initData()
})
/**
* 初始化数据
*/
async function initData() {
// 生成订单号
genOrderNo()
// 获取商户和应用编码
form.mchCode = (await findByParamKey('CashierMchCode')).data
form.mchAppCode = (await findByParamKey('CashierMchAppCode')).data
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
// 初始化应用下拉列表
mchAppChange()
}
/**
* 生成订单号
*/
function genOrderNo() {
form.businessId = 'P' + new Date().getTime()
}
/**
* 商户应用下拉列表
*/
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 添加表单项
*/
function addVoucher() {
form.vouchers.push({
value: '',
key: Date.now(),
})
}
/**
* 减少表单项
*/
function removeVoucher(item: Item) {
let index = form.vouchers.indexOf(item)
if (index !== -1) {
form.vouchers.splice(index, 1)
}
}
/**
* 支付
*/
function pay() {
formRef?.validate().then(async () => {
loading = true
const voucherNoList = form.vouchers.map((o) => o.value)
const vForm = {
payChannel: payChannelEnum.VOUCHER,
payWay: payWayEnum.NORMAL,
mchCode: form.mchCode,
mchAppCode: form.mchAppCode,
businessId: form.businessId,
title: form.title,
amount: form.amount,
voucherNoList: voucherNoList,
}
await singlePay(vForm).finally(() => (loading = false))
createMessage.success('支付成功')
genOrderNo()
loading = false
})
}
/**
* 获取储值卡信息
*/
function getVoucher(item: Item) {
console.log(item)
getAndJudgeVoucher({ cardNo: item.value }).then(({ data }) => {
// 储值卡是否属于当前商户
if (data.mchCode !== form.mchCode || data.mchAppCode !== form.mchAppCode) {
item.voucher = null as any
createMessage.warn('储值卡当前商户无法使用')
} else {
item.voucher = data
}
})
}
</script>
<style scoped lang="less"></style>

View File

@@ -1,6 +1,6 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
import { BaseEntity, KeyValue } from "/#/web";
/**
* 分页
@@ -21,6 +21,16 @@ export function findAll() {
})
}
/**
* 下拉列表, 通过商户Code
*/
export function dropdown(mchCode) {
return defHttp.get<Result<KeyValue[]>>({
url: '/mch/app/dropdown',
params: { mchCode },
})
}
/**
* 关联支付配置列表
*/

View File

@@ -62,7 +62,6 @@
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
import { dropdown } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdownTranslate } from '/@/utils/dataUtil'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { useDict } from '/@/hooks/bootx/useDict'
const {
@@ -121,7 +120,7 @@
}
// 列表
dropdown().then(({ data }) => {
mchList = dropdownTranslate(data, 'value', 'key')
mchList = data
})
}

View File

@@ -63,7 +63,7 @@
import { del, page } from './MchApplication.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import MchApplicationEdit from './MchApplicationEdit.vue'
import MchAppPayConfigList from './mchAppPayConfigList.vue'
import MchAppPayConfigList from './config/MchAppPayConfigList.vue'
import { VxeTableInstance, VxeToolbarInstance, VxeTable, VxeColumn, VxePager, VxeToolbar } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'

View File

@@ -1,18 +1,22 @@
<template>
<mch-app-alipay-config-edit ref="alipay" @ok="ok" />
<mch-app-wechat-pay-config-edit ref="wechat" @ok="ok" />
<mch-app-wallet-config-edit ref="wallet" @ok="ok" />
</template>
<script setup lang="ts">
import { $ref } from 'vue/macros'
import { MchAppPayConfigResult } from './MchApplication.api'
import { MchAppPayConfigResult } from '../MchApplication.api'
import MchAppAlipayConfigEdit from '/@/views/modules/payment/channel/alipay/MchAppAlipayConfigEdit.vue'
import MchAppWechatPayConfigEdit from '/@/views/modules/payment/channel/wechat/MchAppWechatPayConfigEdit.vue'
import MchAppWalletConfigEdit from '/@/views/modules/payment/channel/wallet/config/MchAppWalletConfigEdit.vue'
import { useMessage } from '/@/hooks/web/useMessage'
import { payChannelEnum } from '/@/enums/payment/payChannelEnum'
const { createMessage } = useMessage()
let alipay = $ref<any>()
let wechat = $ref<any>()
let wallet = $ref<any>()
//
const emits = defineEmits(['ok'])
/**
@@ -20,14 +24,18 @@
*/
function show(record: MchAppPayConfigResult) {
switch (record.channelCode) {
case 'ali_pay': {
case payChannelEnum.ALI: {
alipay.init(record)
break
}
case 'wechat_pay': {
case payChannelEnum.WECHAT: {
wechat.init(record)
break
}
case payChannelEnum.WALLET: {
wallet.init(record)
break
}
default: {
createMessage.info('暂未支持, 请期待...')
}

View File

@@ -41,7 +41,7 @@
<script setup lang="ts">
import { BasicDrawer } from '/@/components/Drawer'
import { $ref } from 'vue/macros'
import { findAllConfig, MchApplication, MchAppPayConfigResult } from './MchApplication.api'
import { findAllConfig, MchApplication, MchAppPayConfigResult } from '../MchApplication.api'
import { getFilePreviewUrlPrefix } from '/@/api/common/FileUpload'
import MchAppPayConfigEdit from './MchAppPayConfigEdit.vue'
@@ -53,6 +53,7 @@
const mchAppPayConfigEdit = $ref<any>()
// base64
const fallbackImg =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=='
/**

View File

@@ -1,226 +0,0 @@
<template>
<basic-drawer
showFooter
v-bind="$attrs"
:title="title"
:width="modalWidth"
:visible="visible"
:maskClosable="false"
@close="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="AppId" name="appId">
<a-input v-model:value="form.appId" :disabled="showable" placeholder="请输入支付宝商户AppId" />
</a-form-item>
<a-form-item label="异步通知URL" name="notifyUrl">
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入异步通知URL" />
</a-form-item>
<a-form-item label="同步通知URL" name="returnUrl">
<a-input v-model:value="form.returnUrl" :disabled="showable" placeholder="请输入同步通知URL" />
</a-form-item>
<a-form-item label="支付网关URL" name="serverUrl">
<a-input v-model:value="form.serverUrl" :disabled="showable" placeholder="请输入支付网关URL" />
</a-form-item>
<a-form-item label="默认支付超时配置(分钟)" name="expireTime">
<a-input-number
:min="1"
:max="12000"
:step="1"
:disabled="showable"
placeholder="请输入超时配置"
v-model:value="form.expireTime"
/>
</a-form-item>
<a-form-item label="支持支付方式" name="payWayList">
<a-select
allowClear
mode="multiple"
v-model:value="form.payWayList"
:disabled="showable"
:options="payWayList"
style="width: 100%"
placeholder="选择支付方式"
/>
</a-form-item>
<a-form-item label="沙箱环境" name="sandbox">
<a-switch checked-children="" un-checked-children="" v-model:checked="form.sandbox" :disabled="showable" />
</a-form-item>
<a-form-item v-show="showable" label="是否启用" name="activity">
<a-tag>{{ form.activity ? '启用' : '未启用' }}</a-tag>
</a-form-item>
<a-form-item label="认证方式" name="authType">
<a-select allowClear :disabled="showable" v-model:value="form.authType" style="width: 100%" placeholder="选择认证方式">
<a-select-option :key="1">公钥模式</a-select-option>
<a-select-option :key="2">证书模式</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="签名类型" name="signType">
<a-select allowClear :disabled="showable" v-model:value="form.signType" style="width: 100%" placeholder="选择签名类型">
<a-select-option key="RSA2">RSA2秘钥</a-select-option>
</a-select>
</a-form-item>
<a-form-item v-show="form.authType === 1" label="支付宝公钥" name="alipayPublicKey">
<a-textarea v-model:value="form.alipayPublicKey" :disabled="showable" placeholder="请输入支付宝公钥" />
</a-form-item>
<a-form-item v-show="form.authType === 2" label="应用公钥证书" name="appCert">
<a-textarea v-model:value="form.appCert" :disabled="showable" placeholder="请输入应用公钥证书内容" />
</a-form-item>
<a-form-item v-show="form.authType === 2" label="支付宝公钥证书" name="alipayCert">
<a-textarea v-model:value="form.alipayCert" :disabled="showable" placeholder="请输入支付宝公钥证书内容" />
</a-form-item>
<a-form-item v-show="form.authType === 2" label="支付宝CA根证书" name="alipayRootCert">
<a-textarea v-model:value="form.alipayRootCert" :disabled="showable" placeholder="请输入支付宝CA根证书" />
</a-form-item>
<a-form-item label="应用私钥" name="privateKey">
<a-textarea v-model:value="form.privateKey" :disabled="showable" placeholder="请输入应用私钥" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
</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-drawer>
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, update, AlipayConfig, findPayWayList } from './AlipayConfig.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
import { KeyValue } from '/#/web'
const {
initFormEditType,
handleCancel,
search,
diffForm,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
editable,
showable,
formEditType,
} = useFormEdit()
// 表单
const formRef = $ref<FormInstance>()
let payWayList = $ref<KeyValue[]>([])
let form = $ref({
name: '',
appId: '',
notifyUrl: '',
returnUrl: '',
serverUrl: '',
authType: 1,
signType: 'RSA2',
alipayPublicKey: '',
appCert: '',
alipayCert: '',
alipayRootCert: '',
privateKey: '',
expireTime: 15,
payWayList: [],
sandbox: false,
remark: '',
} as AlipayConfig)
let rawForm
// 校验
const rules = computed(() => {
return {
name: [{ required: true, message: '请输入配置名称' }],
appId: [{ required: true, message: '请输入AppId' }],
notifyUrl: [{ required: true, message: '请输入异步通知页面地址' }],
returnUrl: [{ required: true, message: '请输入同步通知页面地址' }],
serverUrl: [{ required: true, message: '请输入请求网关地址' }],
authType: [{ required: true, message: '请选择认证方式' }],
signType: [{ required: true, message: '请选择加密类型' }],
alipayPublicKey: [{ required: form.authType === 1, message: '请输入支付宝公钥' }],
appCert: [{ required: form.authType === 2, message: '请输入应用证书' }],
alipayCert: [{ required: form.authType === 2, message: '请输入支付宝证书' }],
alipayRootCert: [{ required: form.authType === 2, message: '请输入支付宝CA根证书' }],
privateKey: [{ required: true, message: '请输入支付私钥' }],
sandbox: [{ required: true, message: '请选择是否为沙箱环境' }],
expireTime: [{ required: true, message: '请输入默认超时配置' }],
payWayList: [{ required: true, message: '请选择支持的支付类型' }],
} as Record<string, Rule[]>
})
// 事件
const emits = defineEmits(['ok'])
// 入口
function init(id, editType: FormEditType) {
findPayWayList().then(({ data }) => {
payWayList = data
})
initFormEditType(editType)
resetForm()
getInfo(id, editType)
}
// 获取信息
function getInfo(id, editType: FormEditType) {
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
confirmLoading.value = true
get(id).then(({ data }) => {
rawForm = { ...data }
form = data
confirmLoading.value = false
})
} else {
confirmLoading.value = false
}
}
// 保存
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await add(form)
} else if (formEditType.value === FormEditType.Edit) {
await update({
...form,
...diffForm(rawForm, form, 'appId', 'alipayPublicKey', 'appCert', 'alipayCert', 'alipayRootCert', 'privateKey'),
})
}
confirmLoading.value = false
handleCancel()
emits('ok')
})
}
// 重置表单
function resetForm() {
nextTick(() => {
formRef?.resetFields()
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -1,174 +0,0 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @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-space>
</template>
</vxe-toolbar>
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" width="60" />
<vxe-column field="name" title="名称" />
<vxe-column field="appId" title="商户appId" />
<vxe-column field="authType" title="认证方式">
<template #default="{ row }">
<a-tag v-show="row.authType === 1">公钥</a-tag>
<a-tag v-show="row.authType === 2">证书</a-tag>
</template>
</vxe-column>
<vxe-column field="signType" title="签名类型" />
<vxe-column field="sandbox" title="沙箱">
<template #default="{ row }">
<a-tag v-if="row.sandbox"></a-tag>
<a-tag v-else></a-tag>
</template>
</vxe-column>
<vxe-column field="activity" title="活动状态">
<template #default="{ row }">
<a-tag color="green" v-if="row.activity">启用</a-tag>
<a-tag color="red" v-else>未启用</a-tag>
</template>
</vxe-column>
<vxe-column fixed="right" width="180" :showOverflow="false" title="操作">
<template #default="{ row }">
<a-link @click="show(row)">查看</a-link>
<a-divider type="vertical" />
<a-link @click="edit(row)">编辑</a-link>
<a-divider type="vertical" />
<a-dropdown>
<a> 更多 <icon icon="ant-design:down-outlined" :size="12" /></a>
<template #overlay>
<a-menu>
<a-menu-item>
<a-link v-if="!row.activity" @click="setup(row)">启用</a-link>
<a-link v-else danger @click="clear(row)">停用</a-link>
</a-menu-item>
<a-menu-item>
<a-link @click="remove(row)" style="color: red">删除</a-link>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</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"
/>
<alipay-config-edit ref="alipayConfigEdit" @ok="queryPage" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { clearActivity, del, page, setUpActivity } from './AlipayConfig.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import AlipayConfigEdit from './AlipayConfigEdit.vue'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField } from '/@/components/Bootx/Query/Query'
import ALink from '/@/components/Link/Link.vue'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
// 查询条件
const fields = [
{ field: 'name', type: 'string', name: '名称', placeholder: '请输入名称' },
{ field: 'appId', type: 'string', name: 'AppId', placeholder: '请输入AppId' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const alipayConfigEdit = $ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
// 分页查询
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
// 新增
function add() {
alipayConfigEdit.init(null, FormEditType.Add)
}
// 编辑
function edit(record) {
alipayConfigEdit.init(record.id, FormEditType.Edit)
}
// 查看
function show(record) {
alipayConfigEdit.init(record.id, FormEditType.Show)
}
// 删除
function remove(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否删除该数据',
onOk: () => {
del(record.id).then(() => {
createMessage.success('删除成功')
queryPage()
})
},
})
}
function setup(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否启用此配置',
onOk: () => {
loading.value = true
setUpActivity(record.id).then(() => {
queryPage()
})
},
})
}
function clear(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否停用此配置',
onOk: () => {
loading.value = true
clearActivity(record.id).then(() => {
queryPage()
})
},
})
}
</script>
<style lang="less" scoped></style>

View File

@@ -160,7 +160,6 @@
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
import { MchAppPayConfigResult } from '/@/views/modules/payment/app/MchApplication.api'
import { dropdownTranslate } from '/@/utils/dataUtil'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { useUpload } from '/@/hooks/bootx/useUpload'
import { useMessage } from '/@/hooks/web/useMessage'
@@ -232,7 +231,7 @@
// 入口
function init(record: MchAppPayConfigResult) {
findPayWayList().then(({ data }) => {
payWayList = dropdownTranslate(data, 'value', 'key')
payWayList = data
})
editType = record.configId ? FormEditType.Edit : FormEditType.Add
initFormEditType(editType)

View File

@@ -64,10 +64,10 @@ export function del(id) {
/**
*
*/
export function getAndJudgeVoucher(cardNo) {
export function getAndJudgeVoucher(params) {
return defHttp.get<Result<Voucher>>({
url: '/voucher/getAndJudgeVoucher',
params: { cardNo },
params: params,
})
}
@@ -109,6 +109,10 @@ export interface Voucher extends BaseEntity {
cardNo?: string
// 批次号
batchNo?: string
// 商户编码
mchCode: string
// 商户App编码
mchAppCode: string
// 面值
faceValue?: number
// 余额

View File

@@ -17,6 +17,12 @@
: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="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" />
</a-form-item>
<a-form-item label="面值" name="faceValue">
<a-input-number
:precision="2"
@@ -64,15 +70,24 @@
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { computed, nextTick } from 'vue'
import BasicModal from '/@/components/Modal/src/BasicModal.vue'
import { generationBatch } from '/@/views/modules/payment/voucher/Voucher.api'
import { generationBatch } from './Voucher.api'
import { VoucherEnum } from '/@/enums/payment/voucherEnum'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { LabeledValue } from 'ant-design-vue/lib/select'
const { handleCancel, labelCol, wrapperCol, modalWidth, title, confirmLoading, visible, editable, showable, formEditType } = useFormEdit()
const { createMessage } = useMessage()
//
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
//
const formRef = $ref<FormInstance>()
const form = $ref({
mchCode: undefined,
mchAppCode: undefined,
count: 1,
faceValue: 1,
dataTime: null,
@@ -82,25 +97,44 @@
status: VoucherEnum.STATUS_NORMAL,
})
const rules = computed<Record<string, Rule[]>>(() => {
return {
count: [{ required: true, message: '请输入要生成的数量' }],
faceValue: [{ required: true, message: '请输入储值卡的面值' }],
enduring: [{ required: true, message: '请选择储值卡有效期类型' }],
dataTime: [{ required: form.enduring, message: '请选择有效时间范围' }],
status: [{ required: true, message: '请选择默认状态' }],
}
})
const rules = {
mchCode: [{ required: true, message: '请选择商户' }],
mchAppCode: [{ required: true, message: '请选择商户对应的应用' }],
count: [{ required: true, message: '请输入要生成的数量' }],
faceValue: [{ required: true, message: '请输入储值卡的面值' }],
enduring: [{ required: true, message: '请选择储值卡有效期类型' }],
dataTime: [{ required: form.enduring, message: '请选择有效时间范围' }],
status: [{ required: true, message: '请选择默认状态' }],
} as Record<string, Rule[]>
const emits = defineEmits(['ok'])
/**
* 初始化
*/
function init() {
visible.value = true
resetForm()
//
mchDrop().then(({ data }) => {
mchList = data
})
confirmLoading.value = false
}
//
/**
* 商户应用下拉列表
*/
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 时间范围变动
*/
function changeTime(_, times) {
form.startTime = (times[0] + ' 00:00:00') as any
form.endTime = (times[1] + ' 23:59:59') as any

View File

@@ -15,6 +15,12 @@
<a-descriptions-item label="生成批次号">
{{ form.batchNo }}
</a-descriptions-item>
<a-descriptions-item label="商户号">
{{ form.mchCode }}
</a-descriptions-item>
<a-descriptions-item label="应用号">
{{ form.mchAppCode }}
</a-descriptions-item>
<a-descriptions-item label="面值">
{{ form.faceValue }}
</a-descriptions-item>
@@ -27,10 +33,10 @@
<a-descriptions-item label="状态">
{{ form.status === VoucherEnum.STATUS_NORMAL ? '正常' : '停用' }}
</a-descriptions-item>
<a-descriptions-item label="开始时间">
<a-descriptions-item label="有效期(开始时间)">
{{ form.startTime }}
</a-descriptions-item>
<a-descriptions-item label="结束时间">
<a-descriptions-item label="有效期(结束时间)">
{{ form.endTime }}
</a-descriptions-item>
</a-descriptions>
@@ -46,7 +52,7 @@
import { get, Voucher } from './Voucher.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import BasicModal from '/@/components/Modal/src/BasicModal.vue'
import { VoucherEnum } from "../../../../enums/payment/voucherEnum";
import { VoucherEnum } from '/@/enums/payment/voucherEnum'
const { handleCancel, modalWidth, confirmLoading, visible } = useFormEdit()
//
const formRef = $ref<FormInstance>()

View File

@@ -17,8 +17,6 @@
<vxe-column field="batchNo" title="生成批次号" />
<vxe-column field="faceValue" title="面值" />
<vxe-column field="balance" title="余额" />
<vxe-column field="startTime" title="开始时间" />
<vxe-column field="endTime" title="结束时间" />
<vxe-column field="enduring" title="长期有效">
<template #default="{ row }">
<a-tag>{{ row.enduring ? '长期' : '期限' }}</a-tag>
@@ -29,6 +27,8 @@
{{ dictConvert('VoucherStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="mchCode" title="商户号" />
<vxe-column field="mchAppCode" title="应用号" />
<vxe-column field="createTime" title="创建时间" />
<vxe-column fixed="right" width="120" :showOverflow="false" title="操作">
<template #default="{ row }">
@@ -41,7 +41,7 @@
<template #overlay>
<a-menu>
<a-menu-item>
<a-link @click="showLogs(row.id)">日志</a-link>
<a-link @click="showLogs(row)">日志</a-link>
</a-menu-item>
<a-menu-item>
<a-link danger v-if="row.status === 'normal'" @click="lockConfirm(row.id, true)">停用</a-link>
@@ -63,6 +63,7 @@
/>
<voucher-info ref="voucherInfo" />
<voucher-generation ref="voucherGeneration" @ok="queryPage" />
<voucher-log-list ref="voucherLogList" />
</div>
</div>
</template>
@@ -70,15 +71,16 @@
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { del, lock, page, unlock } from './Voucher.api'
import { lock, page, unlock } from './Voucher.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import VoucherInfo from './VoucherInfo.vue'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
import VoucherGeneration from '/@/views/modules/payment/voucher/VoucherGeneration.vue'
import VoucherInfo from './VoucherInfo.vue'
import VoucherLogList from '../log/VoucherLogList.vue'
import VoucherGeneration from './VoucherGeneration.vue'
// 使hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
@@ -89,22 +91,31 @@
const fields = [
{ field: 'cardNo', type: STRING, name: '卡号', placeholder: '请输入储值卡卡号' },
{ field: 'batchNo', type: STRING, name: '批次号', placeholder: '请输入批次号' },
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入应用编码' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const voucherInfo = $ref<any>()
const voucherGeneration = $ref<any>()
const voucherLogList = $ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
/**
* 绑定
*/
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
//
/**
* 分页查询
*/
function queryPage() {
loading.value = true
page({
@@ -115,15 +126,27 @@
})
return Promise.resolve()
}
//
/**
* 查看
*/
function show(record) {
voucherInfo.init(record.id)
}
//
/**
* 批量生成
*/
function generationBatch() {
voucherGeneration.init()
}
/**
* 查看日志
*/
function showLogs(record) {
voucherLogList.init(record.id)
}
/**
* 启用/停用 储值卡
* @param voucherId 储值卡id
@@ -141,7 +164,7 @@
await unlock(voucherId)
}
createMessage.success(type ? '停用该储值卡成功' : '启用该储值卡成功')
queryPage()
await queryPage()
},
})
}

View File

@@ -1,19 +1,14 @@
<template>
<basic-drawer forceRender showFooter v-bind="$attrs" title="钱包日志列表" width="60%" :visible="visible" @close="visible = false">
<basic-drawer forceRender showFooter v-bind="$attrs" title="储值卡日志" width="60%" :visible="visible" @close="visible = false">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" title="序号" width="60" />
<vxe-column field="type" title="类型">
<template #default="{ row }">
{{ dictConvert('WalletLogType', row.type) }}
{{ dictConvert('VoucherLogType', row.type) }}
</template>
</vxe-column>
<vxe-column field="amount" title="金额" />
<vxe-column field="operationSource" title="操作类型">
<template #default="{ row }">
{{ dictConvert('WalletLogOperation', row.operationSource) }}
</template>
</vxe-column>
<vxe-column field="createTime" title="操作时间" />
<vxe-column field="remark" title="备注" />
<template #footer>
@@ -37,9 +32,9 @@
import { useMessage } from '/@/hooks/web/useMessage'
import { useDict } from '/@/hooks/bootx/useDict'
import { QueryField } from '/@/components/Bootx/Query/Query'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { VxeTableInstance, VxeToolbarInstance, VxeTable, VxeColumn, VxePager, VxeToolbar } from 'vxe-table'
import { nextTick } from 'vue'
import { pageByVoucherId } from "/@/views/modules/payment/voucher/VoucherLog.api";
import { pageByVoucherId } from './VoucherLog.api'
// 使hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
@@ -49,7 +44,7 @@
//
const fields = [] as QueryField[]
let visible = $ref(false)
let walletId = $ref<string>()
let voucherId = $ref<string>()
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
@@ -58,21 +53,32 @@
xTable?.connect(xToolbar as VxeToolbarInstance)
})
/**
* 初始化
*/
function init(id) {
visible = true
walletId = id
voucherId = id
queryPage()
}
//
/**
* 分页查询
*/
function queryPage() {
pageByVoucherId({
...model.queryParam,
...pages,
walletId,
voucherId,
}).then(({ data }) => {
pageQueryResHandel(data)
})
}
/**
* 关闭
*/
function handleCancel() {
visible = false
}
defineExpose({ init })
</script>

View File

@@ -1,3 +1,4 @@
// @ts-nocheck
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
@@ -84,10 +85,11 @@ export function getWalletInfo(walletId) {
/**
*
*/
export function createWalletBatch(obj) {
export function createWalletBatch(params, data) {
return defHttp.post({
url: '/wallet/admin/createWalletBatch',
data: obj,
params: params,
data: data,
})
}
@@ -124,18 +126,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

@@ -0,0 +1,120 @@
<template>
<basic-drawer showFooter v-bind="$attrs" width="60%" :title="title" :visible="visible" :maskClosable="false" @close="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="defaultBalance">
<a-input-number :disabled="showable" placeholder="请输入默认余额" v-model:value="form.defaultBalance" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
</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-drawer>
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, update, WalletConfig } from './WalletConfig.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
import { MchAppPayConfigResult } from '/@/views/modules/payment/app/MchApplication.api'
import { useMessage } from '/@/hooks/web/useMessage'
const {
initFormEditType,
handleCancel,
search,
diffForm,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
editable,
showable,
formEditType,
} = useFormEdit()
const { createMessage } = useMessage()
const formRef = $ref<FormInstance>()
let editType = $ref<FormEditType>()
let form = $ref({
defaultBalance: 0,
remark: '',
} as WalletConfig)
// 校验
const rules = {
defaultBalance: [{ required: true, message: '请输入默认余额' }],
} as Record<string, Rule[]>
// 事件
const emits = defineEmits(['ok'])
// 入口
function init(record: MchAppPayConfigResult) {
editType = record.configId ? FormEditType.Edit : FormEditType.Add
initFormEditType(editType)
resetForm()
form.mchCode = record.mchCode
form.mchAppCode = record.mchAppCode
getInfo(record.configId, editType)
}
// 获取信息
function getInfo(id, editType: FormEditType) {
if ([FormEditType.Edit].includes(editType)) {
confirmLoading.value = true
get(id).then(({ data }) => {
form = data
confirmLoading.value = false
})
} else {
confirmLoading.value = false
}
}
// 保存
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await add(form)
} else if (formEditType.value === FormEditType.Edit) {
await update(form)
}
confirmLoading.value = false
handleCancel()
emits('ok')
})
}
// 重置表单
function resetForm() {
nextTick(() => {
formRef?.resetFields()
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,47 @@
import { defHttp } from '/@/utils/http/axios'
import { Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 获取单条
*/
export function get(id: string) {
return defHttp.get<Result<WalletConfig>>({
url: '/alipay/findById',
params: { id },
})
}
/**
* 添加
*/
export function add(obj: WalletConfig) {
return defHttp.post({
url: '/alipay/add',
data: obj,
})
}
/**
* 更新
*/
export function update(obj: WalletConfig) {
return defHttp.post({
url: '/alipay/update',
data: obj,
})
}
/**
* 支付宝配置
*/
export interface WalletConfig extends BaseEntity {
// 商户编码
mchCode?: string
// 商户应用编码
mchAppCode?: string
// 默认余额
defaultBalance?: number
// 备注
remark?: string
}

View File

@@ -40,7 +40,7 @@
import { $ref } from 'vue/macros'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { nextTick } from 'vue'
import { changerBalance } from '/@/views/modules/payment/wallet/Wallet.api'
import { changerBalance } from '/@/views/modules/payment/channel/wallet/Wallet.api'
import BasicModal from '/@/components/Modal/src/BasicModal.vue'
const { handleCancel, labelCol, wrapperCol, modalWidth, title, confirmLoading, visible, editable, showable, formEditType } = useFormEdit()

View File

@@ -0,0 +1,134 @@
<template>
<basic-modal
v-bind="$attrs"
title="开通钱包"
:width="modalWidth"
:loading="confirmLoading"
:visible="visible"
:mask-closable="false"
@cancel="handleCancel"
>
<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="mchCode">
<a-select allow-clear :options="mchList" v-model:value="form.mchCode" placeholder="请选择商户" @change="mchAppChange" />
</a-form-item>
<a-form-item label="应用号" name="mchAppCode" v-show="form.mchCode">
<a-select allow-clear :options="mchAppList" v-model:value="form.mchAppCode" placeholder="请选择商户应用" />
</a-form-item>
</a-form>
<template #footer>
<a-button key="cancel" @click="handleCancel">取消</a-button>
<a-button key="forward" :loading="confirmLoading" type="primary" @click="handleOk">下一步</a-button>
</template>
</basic-modal>
<b-user-select-modal ref="userSelectModal" multiple :data-source="userPageByNotWallet" @ok="createBatchWallet" />
</template>
<script setup lang="ts">
import { createWalletBatch, pageByNotWallet, Wallet } from '/@/views/modules/payment/channel/wallet/Wallet.api'
import BUserSelectModal from '/@/components/Bootx/UserSelectModal/BUserSelectModal.vue'
import { BasicModal } from '/@/components/Modal'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { $ref } from 'vue/macros'
import { LabeledValue } from 'ant-design-vue/lib/select'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { dropdown as mchDrop } from '/@/views/modules/payment/merchant/MerchantInfo.api'
import { dropdown as mchAppDrop } from '/@/views/modules/payment/app/MchApplication.api'
import { PageResult, Result } from '/#/axios'
import { nextTick } from 'vue'
import { useMessage } from '/@/hooks/web/useMessage'
const { handleCancel, labelCol, wrapperCol, modalWidth, title, confirmLoading, visible, editable, showable, formEditType } = useFormEdit()
const { createMessage } = useMessage()
// 商户和应用下拉列表
let mchList = $ref<LabeledValue[]>()
let mchAppList = $ref<LabeledValue[]>()
const userSelectModal = $ref<any>()
// 表单
const formRef = $ref<FormInstance>()
const form = $ref({
mchCode: undefined,
mchAppCode: undefined,
})
const rules = {
mchCode: [{ required: true, message: '请选择商户' }],
mchAppCode: [{ required: true, message: '请选择商户对应的应用' }],
} as Record<string, Rule[]>
const emits = defineEmits(['ok'])
/**
* 初始化
*/
function init() {
visible.value = true
resetForm()
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
confirmLoading.value = false
}
/**
* 商户应用下拉列表
*/
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 待开通的用户列表
*/
async function userPageByNotWallet(param): Promise<Result<PageResult<Wallet>>> {
return await pageByNotWallet({ ...param, ...form })
}
/**
* 下一步
*/
function handleOk() {
formRef?.validate().then(async () => {
visible.value = false
userSelectModal.init()
})
}
/**
* 获取选中的用户并进行创建
*/
function createBatchWallet(userIds: string[]) {
createMessage.success('批量开通钱包中')
createWalletBatch({ mchCode: form.mchCode, mchAppCode: form.mchAppCode }, userIds)
.then(() => emits('ok'))
}
/**
* 重置表单
*/
function resetForm() {
mchAppList = undefined
nextTick(() => {
formRef?.resetFields()
})
}
defineExpose({ init })
</script>
<style scoped lang="less"></style>

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 }">
@@ -14,7 +14,6 @@
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" width="60" />
<vxe-column field="userId" title="用户ID" />
<vxe-column field="id" title="钱包ID" />
<vxe-column field="balance" title="余额" />
<vxe-column field="freezeBalance" title="冻结额度" />
<vxe-column field="payStatus" title="状态">
@@ -22,6 +21,8 @@
{{ dictConvert('WalletStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="mchCode" title="商户号" />
<vxe-column field="mchAppCode" title="应用号" />
<vxe-column field="createTime" title="创建时间" />
<vxe-column fixed="right" width="120" :showOverflow="false" title="操作">
<template #default="{ row }">
@@ -60,7 +61,7 @@
<wallet-info ref="walletInfo" />
<wallet-changer ref="walletChanger" @ok="queryPage" />
<wallet-log-list ref="walletLogList" />
<b-user-select-modal ref="userSelectModal" multiple :data-source="pageByNotWallet" @ok="createBatchWallet" />
<wallet-create ref="walletCreate" multiple :data-source="pageByNotWallet" @ok="queryPage" />
</div>
</div>
</template>
@@ -68,7 +69,7 @@
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { createWalletBatch, del, lock, page, pageByNotWallet, unlock } from '../Wallet.api'
import { lock, page, pageByNotWallet, unlock } from '../Wallet.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import WalletInfo from './WalletInfo.vue'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
@@ -77,15 +78,19 @@
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
import BUserSelectModal from '/@/components/Bootx/UserSelectModal/BUserSelectModal.vue'
import WalletLogList from './WalletLogList.vue'
import WalletLogList from '../log/WalletLogList.vue'
import WalletChanger from './WalletChanger.vue'
import { WalletEnum } from '/@/enums/payment/walletEnum'
import WalletCreate from './WalletCreate.vue'
// 使hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
//
const fields = [
{ 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[]
@@ -93,7 +98,7 @@
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const walletInfo = $ref<any>()
const userSelectModal = $ref<any>()
const walletCreate = $ref<any>()
const walletLogList = $ref<any>()
const walletChanger = $ref<any>()
@@ -116,25 +121,27 @@
})
return Promise.resolve()
}
//
/**
* 开通钱包
*/
function add() {
userSelectModal.init()
walletCreate.init()
}
//
/**
* 查看
*/
function show(record) {
walletInfo.init(record.id)
}
//
function createBatchWallet(userIds: string[]) {
loading.value = true
createMessage.success('批量开通钱包中')
createWalletBatch(userIds).then(() => queryPage())
}
//
/**
* 钱包日志
*/
function showLog(walletId) {
walletLogList.init(walletId)
}
//
/**
* 调整余额
*/
function recharge(walletId) {
walletChanger.init(walletId)
}

View File

@@ -39,7 +39,7 @@
import { $ref } from 'vue/macros'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { nextTick } from 'vue'
import { pageByWalletId } from '/@/views/modules/payment/wallet/WalletLog.api'
import { pageByWalletId } from '/@/views/modules/payment/channel/wallet/WalletLog.api'
import { useDict } from '/@/hooks/bootx/useDict'
// 使hooks
@@ -64,6 +64,9 @@
walletId = id
queryPage()
}
function handleCancel() {
visible = false
}
//
function queryPage() {
pageByWalletId({

View File

@@ -0,0 +1,123 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<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="应用号" 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>
</a-spin>
</a-card>
</template>
<script setup lang="ts">
import { $ref } from 'vue/macros'
import { createWallet, findByUser, Wallet } from '../Wallet.api'
import { useMessage } from '/@/hooks/web/useMessage'
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()
const labelCol = {
sm: { span: 7 },
}
const wrapperCol = {
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(() => {
init()
})
/**
* 初始化信息
*/
function init() {
// 商户下拉列表
mchDrop().then(({ data }) => {
mchList = data
})
}
/**
* 商户应用下拉列表
*/
function mchAppChange() {
mchAppDrop(form.mchCode).then(({ data }) => {
form.mchAppCode = ''
mchAppList = data
})
}
/**
* 初始化钱包信息
*/
async function getWallet() {
const { data } = await findByUser(form)
wallet = data
loading = false
}
/**
* 开通钱包
*/
async function createMyWallet() {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否开通我的钱包',
onOk: async () => {
await createWallet(form)
createMessage.success('钱包开通中...')
await getWallet()
},
})
}
</script>
<style scoped lang="less">
.vben-basic-title {
font-size: 14px;
}
</style>

View File

@@ -113,7 +113,6 @@
import { useUpload } from '/@/hooks/bootx/useUpload'
import { useMessage } from '/@/hooks/web/useMessage'
import { MchAppPayConfigResult } from '/@/views/modules/payment/app/MchApplication.api'
import { dropdownTranslate } from '/@/utils/dataUtil'
import { LabeledValue } from 'ant-design-vue/lib/select'
import BasicTitle from '/@/components/Basic/src/BasicTitle.vue'
@@ -181,7 +180,7 @@
// 入口
function init(record: MchAppPayConfigResult) {
findPayWayList().then(({ data }) => {
payWayList = dropdownTranslate(data, 'value', 'key')
payWayList = data
})
editType = record.configId ? FormEditType.Edit : FormEditType.Add
initFormEditType(editType)

View File

@@ -1,257 +0,0 @@
<template>
<basic-drawer
showFooter
v-bind="$attrs"
:title="title"
:width="modalWidth"
:visible="visible"
:maskClosable="false"
@close="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="mchId">
<a-input v-model:value="form.mchId" :disabled="showable" placeholder="请输入商户号" />
</a-form-item>
<a-form-item label="应用编号" name="appId">
<a-input v-model:value="form.appId" :disabled="showable" placeholder="请输入微信应用AppId" />
</a-form-item>
<a-form-item label="AppSecret" name="appSecret">
<a-input v-model:value="form.appSecret" :disabled="showable" placeholder="APPID对应的接口密码用于获取接口调用凭证时使用" />
</a-form-item>
<a-form-item label="超时配置" name="expireTime">
<a-input-number :min="1" :max="12000" :step="1" :disabled="showable" v-model:value="form.expireTime" />
</a-form-item>
<a-form-item label="支持支付方式" name="payWayList">
<a-select
allowClear
mode="multiple"
:disabled="showable"
:options="payWayList"
v-model:value="form.payWayList"
style="width: 100%"
placeholder="选择支付方式"
/>
</a-form-item>
<a-form-item label="是否沙箱环境" name="sandbox">
<a-switch checked-children="" un-checked-children="" v-model:checked="form.sandbox" :disabled="showable" />
</a-form-item>
<a-form-item label="是否启用" v-show="showable" name="activity">
<a-tag>{{ form.activity ? '启用' : '未启用' }}</a-tag>
</a-form-item>
<a-form-item label="p12证书" name="p12">
<a-upload
v-if="!form.p12"
:disabled="showable"
name="file"
:multiple="false"
:action="uploadAction"
:headers="tokenHeader"
:showUploadList="false"
@change="handleChange"
>
<a-button type="primary" preIcon="carbon:cloud-upload"> p12证书上传 </a-button>
</a-upload>
<a-input v-else v-model:value="form.p12" disabled>
<template #addonAfter v-if="!showable">
<a-tooltip>
<template #title> 删除上传的证书文件 </template>
<icon @click="form.p12 = null" icon="ant-design:close-circle-outlined" :size="20" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
<a-form-item label="APIv2密钥" name="apiKeyV2">
<a-textarea :disabled="showable" v-model:value="form.apiKeyV2" placeholder="请输入APIv2密钥" />
</a-form-item>
<a-form-item label="APIv3密钥" name="apiKeyV3">
<a-textarea :disabled="showable" v-model:value="form.apiKeyV3" placeholder="请输入APIv3密钥" />
</a-form-item>
<a-form-item label="证书(cert.pem)" name="certPem">
<a-textarea :disabled="showable" v-model:value="form.certPem" placeholder="请填入证书内容" />
</a-form-item>
<a-form-item label="私钥(key.pem)" name="keyPem">
<a-input v-model:value="form.keyPem" :disabled="showable" placeholder="请填入私钥内容" />
</a-form-item>
<a-form-item label="异步通知UR" name="notifyUrl">
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入服务器异步通知页面路径" />
</a-form-item>
<a-form-item label="同步通知URL" name="returnUrl">
<a-input v-model:value="form.returnUrl" :disabled="showable" placeholder="请输入页面跳转同步通知页面路径" />
</a-form-item>
<a-form-item label="应用域名" name="domain">
<a-input v-model:value="form.domain" :disabled="showable" placeholder="请输入应用域名,回调中会使用此参数" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
</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-drawer>
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, update, findPayWayList, WechatPayConfig } from './WechatPayConfig.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
import { KeyValue } from '/#/web'
import Icon from '/@/components/Icon/src/Icon.vue'
import { useUpload } from '/@/hooks/bootx/useUpload'
import { useMessage } from '/@/hooks/web/useMessage'
const {
initFormEditType,
handleCancel,
search,
diffForm,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
editable,
showable,
formEditType,
} = useFormEdit()
const { tokenHeader, uploadAction } = useUpload('/file/upload')
const { createMessage } = useMessage()
// 表单
const formRef = $ref<FormInstance>()
let rawForm
let form = $ref({
id: null,
name: '',
mchId: '',
appId: '',
appSecret: '',
apiVersion: 'api_v2',
p12: null,
apiKeyV2: '',
apiKeyV3: '',
keyPem: '',
certPem: '',
domain: '',
notifyUrl: '',
returnUrl: '',
expireTime: 15,
payWayList: [],
sandbox: false,
remark: '',
} as WechatPayConfig)
// 校验
const rules = computed(() => {
return {
name: [{ required: true, message: '请输入配置名称' }],
mchId: [{ required: true, message: '请输入商户号' }],
appId: [{ required: true, message: '请输入应用编号' }],
notifyUrl: [{ required: true, message: '请输入异步通知页面地址' }],
returnUrl: [{ required: true, message: '请输入同步通知页面地址' }],
domain: [{ required: true, message: '请输入请求应用域名' }],
// apiVersion: [ { required: true, message: '请选择API版本' } ],
apiKeyV2: [{ required: form.apiVersion === 'api_v2', message: '请输入V2秘钥' }],
apiKeyV3: [{ required: form.apiVersion === 'api_v3', message: '请输入V3秘钥' }],
// keyPem: [ { required: true, message: '请填入私钥内容' } ],
// certPem: [ { required: true, message: '请填入证书内容' } ],
sandbox: [{ required: true, message: '请选择是否为沙箱环境' }],
expireTime: [{ required: true, message: '请输入默认超时配置' }],
payWayList: [{ required: true, message: '请选择支持的支付类型' }],
} as Record<string, Rule[]>
})
let payWayList = $ref<KeyValue[]>([])
// 事件
const emits = defineEmits(['ok'])
// 入口
function init(id, editType: FormEditType) {
findPayWayList().then(({ data }) => {
payWayList = data
console.log(payWayList)
})
initFormEditType(editType)
resetForm()
getInfo(id, editType)
}
// 获取信息
function getInfo(id, editType: FormEditType) {
if ([FormEditType.Edit, FormEditType.Show].includes(editType)) {
confirmLoading.value = true
get(id).then(({ data }) => {
rawForm = { ...data }
form = data
confirmLoading.value = false
})
} else {
confirmLoading.value = false
}
}
// 保存
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await add(form)
} else if (formEditType.value === FormEditType.Edit) {
await update({ ...form, ...diffForm(rawForm, form, 'mchId', 'appId', 'appSecret', 'apiKeyV2', 'apiKeyV3', 'keyPem', 'certPem') })
}
confirmLoading.value = false
handleCancel()
emits('ok')
})
}
// 重置表单
function resetForm() {
nextTick(() => {
formRef?.resetFields()
})
}
/**
* 文件上传
*/
function handleChange(info) {
// 上传完毕
if (info.file.status === 'done') {
const res = info.file.response
if (!res.code) {
form.p12 = res.data.id
createMessage.success(`${info.file.name} 上传成功!`)
} else {
createMessage.error(`${res.msg}`)
}
} else if (info.file.status === 'error') {
createMessage.error('上传失败')
}
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -1,177 +0,0 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @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-space>
</template>
</vxe-toolbar>
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" width="60" />
<vxe-column field="name" title="名称" />
<vxe-column field="mchId" title="商户号" />
<vxe-column field="appId" title="应用编号" />
<!-- <vxe-column field="apiVersion" title="API版本" >-->
<!-- <template v-slot="{row}">-->
<!-- {{ dictConvert('wechatApiVersion',row.apiVersion) }}-->
<!-- </template>-->
<!-- </vxe-column>-->
<vxe-column field="sandbox" title="沙箱">
<template #default="{ row }">
<a-tag v-if="row.sandbox"></a-tag>
<a-tag v-else></a-tag>
</template>
</vxe-column>
<vxe-column field="activity" title="活动状态">
<template #default="{ row }">
<a-tag color="green" v-if="row.activity">启用</a-tag>
<a-tag color="red" v-else>未启用</a-tag>
</template>
</vxe-column>
<vxe-column field="createTime" title="创建时间" />
<vxe-column fixed="right" width="180" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
<a-link @click="show(row)">查看</a-link>
</span>
<a-divider type="vertical" />
<span>
<a-link @click="edit(row)">编辑</a-link>
</span>
<a-divider type="vertical" />
<a-dropdown>
<a> 更多 <icon icon="ant-design:down-outlined" :size="12" /></a>
<template #overlay>
<a-menu>
<a-menu-item>
<a-link v-if="!row.activity" @click="setup(row)">启用</a-link>
<a-link v-else danger @click="clear(row)">停用</a-link>
</a-menu-item>
<a-menu-item>
<a-link danger @click="remove(row)">删除</a-link>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</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"
/>
<wechat-pay-config-edit ref="wechatPayConfigEdit" @ok="queryPage" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { $ref } from 'vue/macros'
import { del, page, clearActivity, setUpActivity } from './WechatPayConfig.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import WechatPayConfigEdit from './WechatPayConfigEdit.vue'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
// 查询条件
const fields = [
{ field: 'name', type: STRING, name: '名称', placeholder: '请输入名称' },
{ field: 'appId', type: STRING, name: 'AppId', placeholder: '请输入AppId' },
{ field: 'mchId', type: STRING, name: '商户号', placeholder: '请输入商户号' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const wechatPayConfigEdit = $ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
// 分页查询
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
// 新增
function add() {
wechatPayConfigEdit.init(null, FormEditType.Add)
}
// 编辑
function edit(record) {
wechatPayConfigEdit.init(record.id, FormEditType.Edit)
}
// 查看
function show(record) {
wechatPayConfigEdit.init(record.id, FormEditType.Show)
}
// 删除
function remove(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否删除该数据',
onOk: () => {
del(record.id).then(() => {
createMessage.success('删除成功')
queryPage()
})
},
})
}
function setup(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否启用此配置',
onOk: () => {
loading.value = true
setUpActivity(record.id).then(() => {
queryPage()
})
},
})
}
function clear(record) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否停用此配置',
onOk: () => {
loading.value = true
clearActivity(record.id).then(() => {
queryPage()
})
},
})
}
</script>
<style lang="less" scoped></style>

View File

@@ -10,19 +10,25 @@
>
<a-spin :spinning="confirmLoading">
<a-descriptions title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="业务id">
<a-descriptions-item label="支付记录id">
{{ form.paymentId }}
</a-descriptions-item>
<a-descriptions-item label="支付通道">
{{ dictConvert('PayChannel', form.payChannel) }}
</a-descriptions-item>
<a-descriptions-item label="商户编码">
{{ dictConvert('PayChannel', form.mchCode) }}
</a-descriptions-item>
<a-descriptions-item label="商户应用编码">
{{ dictConvert('PayChannel', form.mchAppCode) }}
</a-descriptions-item>
<a-descriptions-item label="通知消息">
<json-preview :data="JSON.parse(form.notifyInfo || '{}')" />
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ dictConvert('PayNotifyProcess', form.status) }}
{{ dictConvert('PayNotifyStatus', form.status) }}
</a-descriptions-item>
<a-descriptions-item label="提示消息">
<a-descriptions-item label="提示消息" v-if="form.msg">
{{ form.msg }}
</a-descriptions-item>
<a-descriptions-item label="通知时间">
@@ -73,7 +79,7 @@
notifyTime: '',
})
// 入口
function init(id, editType: FormEditType) {
function init(id) {
visible.value = true
confirmLoading.value = true
get(id).then(({ data }) => {

View File

@@ -15,7 +15,7 @@
</vxe-column>
<vxe-column field="status" title="处理状态">
<template #default="{ row }">
{{ dictConvert('PayNotifyProcess', row.status) }}
{{ dictConvert('PayNotifyStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="msg" title="提示信息" />
@@ -56,7 +56,7 @@
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDownNumber } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
@@ -66,17 +66,19 @@
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDownNumber('AsyncPayChannel'),
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择消息处理状态',
selectList: dictDropDownNumber('PayNotifyProcess'),
selectList: dictDropDown('PayNotifyStatus'),
},
] as QueryField[]
console.log(fields)
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const payNotifyRecordInfo = $ref<any>()

View File

@@ -113,7 +113,7 @@
const { handleTableChange, pageQueryResHandel, resetQuery, resetQueryParams, pagination, pages, model, loading, superQueryFlag } =
useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDownNumber } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
@@ -121,22 +121,22 @@
{ field: 'businessId', type: STRING, name: '业务ID', placeholder: '请输入业务ID' },
{ field: 'title', type: STRING, name: '标题', placeholder: '请输入标题' },
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入应用编码' },
] as QueryField[]
// 超级查询条件
const queryFields = [
{ field: 'id', name: '支付ID', type: STRING },
{ field: 'businessId', name: '业务ID', type: STRING },
{ field: 'mchCode', type: STRING, name: '商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码' },
{ field: 'userId', name: '用户ID', type: STRING },
{ field: 'title', name: '标题', type: STRING },
{ field: 'amount', name: '金额', type: NUMBER, precision: 2 },
{ field: 'errorCode', name: '错误码', type: STRING },
{ field: 'asyncPayMode', name: '异步支付', type: BOOLEAN },
{ field: 'asyncPayChannel', name: '异步支付方式', type: LIST, selectList: dictDropDownNumber('PayChannel') },
{ field: 'asyncPayChannel', name: '异步支付方式', type: LIST, selectList: dictDropDown('PayChannel') },
{ field: 'payTime', name: '支付时间', type: DATE_TIME },
{ field: 'payStatus', name: '支付状态', type: LIST, selectList: dictDropDownNumber('PayStatus') },
{ field: 'payStatus', name: '支付状态', type: LIST, selectList: dictDropDown('PayStatus') },
] as QueryField[]
let superQueryParam = $ref<QueryParam[]>([])

View File

@@ -31,7 +31,7 @@
{{ form.refundTime }}
</a-descriptions-item>
<a-descriptions-item label="退款状态">
<a-tag>{{ dictConvert('PayRefundProcess', form.refundStatus) }}</a-tag>
<a-tag>{{ dictConvert('PayRefundStatus', form.refundStatus) }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="退款终端ip">
{{ form.clientIp }}
@@ -39,10 +39,10 @@
<a-descriptions-item label="退款信息">
<a-tag v-for="o in form.refundableInfo" :key="o.payChannel">{{ dictConvert('PayChannel', o.payChannel) }}: {{ o.amount }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="错误码">
<a-descriptions-item v-if="form.errorCode" label="错误码">
{{ form.errorCode }}
</a-descriptions-item>
<a-descriptions-item label="错误信息">
<a-descriptions-item v-if="form.errorMsg" label="错误信息">
{{ form.errorMsg }}
</a-descriptions-item>
</a-descriptions>

View File

@@ -21,7 +21,7 @@
<vxe-column field="refundTime" title="退款时间" />
<vxe-column field="refundStatus" title="状态">
<template #default="{ row }">
<a-tag>{{ dictConvert('PayRefundProcess', row.refundStatus) }}</a-tag>
<a-tag>{{ dictConvert('PayRefundStatus', row.refundStatus) }}</a-tag>
</template>
</vxe-column>
<vxe-column fixed="right" width="60" :showOverflow="false" title="操作">
@@ -56,22 +56,36 @@
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { LIST, QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
import PaymentInfo from '/@/views/modules/payment/order/payment/PaymentInfo.vue'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
{ field: 'paymentId', type: STRING, name: '支付单号', placeholder: '请输入支付单号' },
{
field: 'payChannel',
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择处理状态',
selectList: dictDropDown('PayRefundStatus'),
},
{ field: 'businessId', type: STRING, name: '业务ID', placeholder: '请输入业务ID' },
{ field: 'title', type: STRING, name: '标题', placeholder: '请输入标题' },
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用编码', placeholder: '请输入应用编码' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()

View File

@@ -0,0 +1,44 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<SyncRecord>>>({
url: '/pay/sync/page',
params,
})
}
/**
* 获取单条
*/
export function get(id) {
return defHttp.get<Result<SyncRecord>>({
url: '/pay/sync/findById',
params: { id },
})
}
/**
* 支付同步记录
*/
export interface SyncRecord extends BaseEntity {
// 支付记录id
paymentId?: string
// 商户编码
mchCode?: string
// 商户应用编码
mchAppCode?: string
// 支付通道
payChannel?: string
// 通知消息
syncInfo?: string
// 同步状态
status?: string
// 同步时间
syncTime?: string
}

View File

@@ -0,0 +1,88 @@
<template>
<basic-modal
title="查看"
:loading="confirmLoading"
:width="modalWidth"
:visible="visible"
:mask-closable="showable"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-descriptions title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="支付记录id">
{{ form.paymentId }}
</a-descriptions-item>
<a-descriptions-item label="支付通道">
{{ dictConvert('PayChannel', form.payChannel) }}
</a-descriptions-item>
<a-descriptions-item label="商户编码">
{{ form.mchCode }}
</a-descriptions-item>
<a-descriptions-item label="应用编码">
{{ form.mchAppCode }}
</a-descriptions-item>
<a-descriptions-item label="通知消息">
<json-preview :data="JSON.parse(form.syncInfo || '{}')" />
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ dictConvert('PaySyncStatus', form.status) }}
</a-descriptions-item>
<a-descriptions-item label="错误消息" v-show="form.msg">
{{ form.msg }}
</a-descriptions-item>
<a-descriptions-item label="同步时间">
{{ form.syncTime }}
</a-descriptions-item>
</a-descriptions>
</a-spin>
<template #footer>
<a-button key="cancel" @click="handleCancel">取消</a-button>
</template>
</basic-modal>
</template>
<script lang="ts" setup>
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { get, SyncRecord } from './SyncRecord.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { BasicModal } from '/@/components/Modal'
import JsonPreview from '/@/components/CodeEditor/src/json-preview/JsonPreview.vue'
import { useDict } from '/@/hooks/bootx/useDict'
const {
initFormEditType,
handleCancel,
search,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
editable,
showable,
formEditType,
} = useFormEdit()
// 表单
const formRef = $ref<FormInstance>()
let form = $ref<SyncRecord>({})
const { dictConvert } = useDict()
/**
* 入口 获取信息
*/
function init(id) {
visible.value = true
console.log(123)
confirmLoading.value = true
get(id).then(({ data }) => {
form = data
confirmLoading.value = false
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,121 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @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">
<vxe-column type="seq" width="60" />
<vxe-column field="paymentId" title="支付记录id" />
<vxe-column field="payChannel" title="支付通道">
<template #default="{ row }">
{{ dictConvert('PayChannel', row.payChannel) }}
</template>
</vxe-column>
<vxe-column field="status" title="处理状态">
<template #default="{ row }">
{{ dictConvert('PaySyncStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="msg" title="提示信息" />
<vxe-column field="syncTime" title="同步时间" />
<vxe-column fixed="right" width="50" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
<a-link @click="show(row)">查看</a-link>
</span>
</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"
/>
<sync-record-info ref="syncRecordInfo" @ok="queryPage" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { page } from './SyncRecord.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import SyncRecordInfo from './SyncRecordInfo.vue'
import { VxeTableInstance, VxeToolbarInstance, VxeTable, VxeColumn, VxePager, VxeToolbar } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { LIST, QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
{ field: 'paymentId', type: STRING, name: '支付单号', placeholder: '请输入支付单号' },
{
field: 'payChannel',
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择处理状态',
selectList: dictDropDown('PaySyncStatus'),
},
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用号编码', placeholder: '请输入商户编码' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const syncRecordInfo = $ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
/**
* 初始化绑定
*/
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
/**
* 分页查询
*/
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
/**
* 查看
*/
function show(record) {
syncRecordInfo.init(record.id)
}
</script>
<style lang="less" scoped></style>

View File

@@ -1,85 +0,0 @@
<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) }}
</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>
</a-form>
</div>
<div v-else>
<a-button type="primary" @click="createMyWallet">开通钱包</a-button>
</div>
</a-spin>
</a-card>
</template>
<script setup lang="ts">
import { $ref } from 'vue/macros'
import { createWallet, findByUser, Wallet } from '../Wallet.api'
import { useMessage } from '/@/hooks/web/useMessage'
import BasicTitle from '/@/components/Basic/src/BasicTitle.vue'
import { onMounted } from 'vue'
import { useDict } from '/@/hooks/bootx/useDict'
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
const labelCol = {
sm: { span: 7 },
}
const wrapperCol = {
sm: { span: 13 },
}
let loading = $ref(false)
let wallet = $ref<Wallet>()
onMounted(() => {
initWallet()
})
/**
* 初始化钱包信息
*/
async function initWallet() {
loading = true
const { data } = await findByUser()
wallet = data
loading = false
}
/**
* 开通钱包
*/
async function createMyWallet() {
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否开通我的钱包',
onOk: async () => {
await createWallet()
createMessage.success('钱包开通中...')
await initWallet()
},
})
}
</script>
<style scoped lang="less">
.vben-basic-title {
font-size: 14px;
}
</style>

View File

@@ -28,7 +28,7 @@
<a-switch checked-children="启用" un-checked-children="停用" v-model:checked="form.enable" :disabled="showable" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
<a-textarea :rows="3" v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
</a-form-item>
</a-form>
<template #footer>