feat 储值卡和钱包管理, 优化支付相关记录详情的信息查看

This commit is contained in:
xxm
2022-12-01 23:50:41 +08:00
parent 9d1488b324
commit e4a62d7301
11 changed files with 878 additions and 52 deletions

View File

@@ -182,7 +182,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'BUserSelectModal',
name: 'BRoleSelectModal',
})
</script>
<style scoped></style>

View File

@@ -10,49 +10,49 @@
>
<a-spin :spinning="confirmLoading">
<a-descriptions title="" :column="{ md: 2, sm: 1, xs: 1 }">
<a-descriptions-item label="用户id">
{{ form.userId }}
</a-descriptions-item>
<a-descriptions-item label="标题">
{{ form.title }}
</a-descriptions-item>
<a-descriptions-item label="业务id">
{{ form.businessId }}
</a-descriptions-item>
<a-descriptions-item label="金额">
{{ form.amount }}
</a-descriptions-item>
<a-descriptions-item label="可退余额">
{{ form.refundableBalance }}
</a-descriptions-item>
<a-descriptions-item label="支付状态">
{{ dictConvert('PayStatus', form.payStatus) }}
</a-descriptions-item>
<a-descriptions-item label="是否是异步支付">
{{ form.asyncPayMode ? '是' : '否' }}
</a-descriptions-item>
<a-descriptions-item label="异步支付方式">
{{ dictConvert('PayChannel', form.asyncPayChannel) }}
</a-descriptions-item>
<a-descriptions-item label="支付信息">
<a-tag v-for="o in form.payChannelInfo" :key="o.payChannel">{{ dictConvert('PayChannel', o.payChannel) }}: {{ o.amount }}</a-tag>
</a-descriptions-item>
<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="客户IP">
{{ form.clientIp }}
</a-descriptions-item>
<a-descriptions-item label="描述">
{{ form.description }}
</a-descriptions-item>
<a-descriptions-item label="错误码">
{{ form.errorCode }}
</a-descriptions-item>
<a-descriptions-item label="错误信息">
{{ form.errorMsg }}
</a-descriptions-item>
</a-descriptions>
<a-descriptions-item label="用户id">
{{ form.userId }}
</a-descriptions-item>
<a-descriptions-item label="标题">
{{ form.title }}
</a-descriptions-item>
<a-descriptions-item label="业务id">
{{ form.businessId }}
</a-descriptions-item>
<a-descriptions-item label="金额">
{{ form.amount }}
</a-descriptions-item>
<a-descriptions-item label="可退余额">
{{ form.refundableBalance }}
</a-descriptions-item>
<a-descriptions-item label="支付状态">
{{ dictConvert('PayStatus', form.payStatus) }}
</a-descriptions-item>
<a-descriptions-item label="是否是异步支付">
{{ form.asyncPayMode ? '是' : '否' }}
</a-descriptions-item>
<a-descriptions-item label="异步支付方式">
{{ dictConvert('PayChannel', form.asyncPayChannel) }}
</a-descriptions-item>
<a-descriptions-item label="支付信息">
<a-tag v-for="o in form.payChannelInfo" :key="o.payChannel">{{ dictConvert('PayChannel', o.payChannel) }}: {{ o.amount }}</a-tag>
</a-descriptions-item>
<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="客户IP">
{{ form.clientIp }}
</a-descriptions-item>
<a-descriptions-item label="描述">
{{ form.description }}
</a-descriptions-item>
<a-descriptions-item label="错误码">
{{ form.errorCode }}
</a-descriptions-item>
<a-descriptions-item label="错误信息">
{{ form.errorMsg }}
</a-descriptions-item>
</a-descriptions>
</a-spin>
<template #footer>
<a-space>
@@ -69,7 +69,7 @@
import { FormInstance } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicModal } from '/@/components/Modal'
import { useDict } from "/@/hooks/bootx/useDict";
import { useDict } from '/@/hooks/bootx/useDict'
const {
initFormEditType,
handleCancel,

View File

@@ -8,7 +8,7 @@
:mask-closable="showable"
@cancel="handleCancel"
>
<a-descriptions title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions bordered title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="付款记录ID">
{{ form.paymentId }}
</a-descriptions-item>

View File

@@ -0,0 +1,114 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<Voucher>>>({
url: '/voucher/page',
params,
})
}
/**
* 查询全部
*/
export function findAll() {
return defHttp.get<Result<Voucher[]>>({
url: '/voucher/findAll',
})
}
/**
* 获取单条
*/
export function get(id) {
return defHttp.get<Result<Voucher>>({
url: '/voucher/findById',
params: { id },
})
}
/**
* 添加
*/
export function add(obj: Voucher) {
return defHttp.post({
url: '/voucher/add',
data: obj,
})
}
/**
* 更新
*/
export function update(obj: Voucher) {
return defHttp.post({
url: '/voucher/update',
data: obj,
})
}
/**
* 删除
*/
export function del(id) {
return defHttp.delete({
url: '/voucher/delete',
params: { id },
})
}
/**
* 锁定
*/
export function lock(id) {
return defHttp.post({
url: '/voucher/lock',
params: { id },
})
}
/**
* 解锁
*/
export function unlock(id) {
return defHttp.post({
url: '/voucher/unlock',
params: { id },
})
}
/**
* 批量生成储值卡
*/
export function generationBatch(obj) {
return defHttp.post({
url: '/voucher/generationBatch',
data: obj,
})
}
/**
* 储值卡
*/
export interface Voucher extends BaseEntity {
// 卡号
cardNo?: string
// 批次号
batchNo?: string
// 面值
faceValue?: number
// 余额
balance?: number
// 是否长期有效
enduring?: boolean
// 开始时间
startTime?: string
// 结束时间
endTime?: string
// 状态
status?: number
}

View File

@@ -0,0 +1,130 @@
<template>
<basic-modal
title="储值卡生成"
v-bind="$attrs"
:loading="confirmLoading"
:width="modalWidth"
: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="faceValue">
<a-input-number
:precision="2"
:max="9999999"
:min="0.01"
v-model:value="form.faceValue"
placeholder="输入储值卡面值"
style="width: 100%"
/>
</a-form-item>
<a-form-item label="数量" name="count">
<a-input-number
:precision="0"
:max="100"
:min="1"
v-model:value="form.count"
placeholder="输入生成储值卡的数量"
style="width: 100%"
/>
</a-form-item>
<a-form-item label="有效期" name="enduring">
<a-switch checkedChildren="长期" unCheckedChildren="期限" v-model:value="form.enduring" />
</a-form-item>
<a-form-item label="有效期" name="enduring" v-if="!form.enduring">
<a-range-picker valueFormat="YYYY-MM-DD" @change="changeTime" />
</a-form-item>
<a-form-item label="默认状态" name="status">
<a-radio-group v-model:value="form.status">
<a-radio :value="1">启用</a-radio>
<a-radio :value="2">停用</a-radio>
</a-radio-group>
</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>
</template>
<script lang="ts" setup>
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { useMessage } from '/@/hooks/web/useMessage'
import { $ref } from 'vue/macros'
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'
const { handleCancel, labelCol, wrapperCol, modalWidth, title, confirmLoading, visible, editable, showable, formEditType } = useFormEdit()
const { createMessage } = useMessage()
// 表单
const formRef = $ref<FormInstance>()
const form = $ref({
count: 1,
faceValue: 1,
dataTime: null,
enduring: true,
startTime: null,
endTime: null,
status: 1,
})
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 emits = defineEmits(['ok'])
function init() {
visible.value = true
confirmLoading.value = true
resetForm()
}
// 时间范围变动
function changeTime (_, times) {
form.startTime = times[0] + ' 00:00:00' as any
form.endTime = times[1] + ' 23:59:59' as any
}
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
form.dataTime = null
if (form.enduring) {
form.startTime = null
form.endTime = null
}
await generationBatch(form)
visible.value = false
emits('ok')
})
}
// 重置表单
function resetForm() {
nextTick(() => {
formRef?.resetFields()
})
}
defineExpose({ init })
</script>
<style scoped></style>

View File

@@ -0,0 +1,74 @@
<template>
<basic-modal
title="查看"
v-bind="$attrs"
:loading="confirmLoading"
:width="modalWidth"
:visible="visible"
:mask-closable="false"
@cancel="handleCancel"
>
<a-descriptions bordered title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="卡号">
{{ form.cardNo }}
</a-descriptions-item>
<a-descriptions-item label="生成批次号">
{{ form.batchNo }}
</a-descriptions-item>
<a-descriptions-item label="面值">
{{ form.faceValue }}
</a-descriptions-item>
<a-descriptions-item label="余额">
{{ form.balance }}
</a-descriptions-item>
<a-descriptions-item label="有效期">
{{ form.enduring ? '长期' : '期限' }}
</a-descriptions-item>
<a-descriptions-item label="开始时间">
{{ form.startTime }}
</a-descriptions-item>
<a-descriptions-item label="结束时间">
{{ form.endTime }}
</a-descriptions-item>
</a-descriptions>
<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, Voucher } from './Voucher.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import BasicModal from '/@/components/Modal/src/BasicModal.vue'
const { handleCancel, modalWidth, confirmLoading, visible } = useFormEdit()
// 表单
const formRef = $ref<FormInstance>()
let form = $ref<Voucher>({
id: null,
cardNo: '',
batchNo: '',
faceValue: 0,
balance: 0,
enduring: true,
startTime: '',
endTime: '',
status: 0,
})
// 入口
function init(id) {
confirmLoading.value = true
visible.value = true
get(id).then(({ data }) => {
form = data
confirmLoading.value = false
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,149 @@
<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="{ query: queryPage }">
<template #buttons>
<a-space>
<a-button type="primary" pre-icon="ant-design:plus-outlined" @click="generationBatch">生成储值卡</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="cardNo" title="卡号" />
<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>
</template>
</vxe-column>
<vxe-column field="status" title="状态">
<template #default="{ row }">
{{ dictConvert('VoucherStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="createTime" title="创建时间" />
<vxe-column fixed="right" width="120" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
<a-link @click="show(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 danger v-if="row.status === 1" @click="lockConfirm(row.id, true)">停用</a-link>
<a-link v-if="row.status === 2" @click="lockConfirm(row.id, false)">启用</a-link>
</a-menu-item>
<!-- <a-menu-item>-->
<!-- <a-link>金额变动</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"
/>
<voucher-info ref="voucherInfo" />
<voucher-generation ref="voucherGeneration" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { del, 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'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
// 查询条件
const fields = [
{ field: 'cardNo', type: STRING, name: '卡号', placeholder: '请输入储值卡卡号' },
{ field: 'batchNo', type: STRING, name: '批次号', placeholder: '请输入批次号' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const voucherInfo = $ref<any>()
const voucherGeneration = $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)
})
}
// 查看
function show(record) {
voucherInfo.init(record.id)
}
// 批量生成
function generationBatch() {
voucherGeneration.init()
}
/**
* 启用/停用 储值卡
* @param voucherId 储值卡id
* @param type true 锁定, false 解锁
*/
function lockConfirm(voucherId, type) {
createConfirm({
iconType: 'warning',
title: '警告',
content: type ? '是否停用该储值卡' : '是否启用该储值卡',
onOk: async () => {
if (type) {
await lock(voucherId)
} else {
await unlock(voucherId)
}
createMessage.success(type ? '停用该储值卡成功' : '启用该储值卡成功')
queryPage()
},
})
}
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,126 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<Wallet>>>({
url: '/wallet/page',
params,
})
}
/**
* 查询全部
*/
export function findAll() {
return defHttp.get<Result<Wallet[]>>({
url: '/wallet/findAll',
})
}
/**
* 获取单条
*/
export function get(id) {
return defHttp.get<Result<Wallet>>({
url: '/wallet/findById',
params: { id },
})
}
/**
* 添加
*/
export function add(obj: Wallet) {
return defHttp.post({
url: '/wallet/add',
data: obj,
})
}
/**
* 更新
*/
export function update(obj: Wallet) {
return defHttp.post({
url: '/wallet/update',
data: obj,
})
}
/**
* 删除
*/
export function del(id) {
return defHttp.delete({
url: '/wallet/delete',
params: { id },
})
}
/**
* 获取钱包详情
*/
export function getWalletInfo(walletId) {
return defHttp.get<Result<Wallet>>({
url: '/wallet/getWalletInfo',
params: { walletId },
})
}
/**
* 批量开通钱包
*/
export function createWalletBatch(obj) {
return defHttp.post({
url: '/wallet/createWalletBatch',
data: obj,
})
}
/**
* 锁定钱包
*/
export function lock(walletId) {
return defHttp.post({
url: '/wallet/lock',
params: { walletId },
})
}
/**
* 解锁钱包
*/
export function unlock(walletId) {
return defHttp.post({
url: '/wallet/unlock',
params: { walletId },
})
}
/**
* 钱包余额变动
*/
export function changerBalance(obj) {
return defHttp.post({
url: '/wallet/changerBalance',
data: obj,
})
}
/**
* 钱包
*/
export interface Wallet extends BaseEntity {
// 关联用户id
userId?: string
// 关联用户名称
userName?: string
// 余额
balance?: number
// 状态
status?: number
}

View File

@@ -0,0 +1,75 @@
<template>
<basic-modal
v-bind="$attrs"
:loading="confirmLoading"
:title="title"
:width="modalWidth"
:visible="visible"
@cancel="handleCancel"
>
<a-descriptions bordered title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="钱包ID">
{{ form.id }}
</a-descriptions-item>
<a-descriptions-item label="账号ID">
{{ form.userId }}
</a-descriptions-item>
<a-descriptions-item label="用户名称">
{{ form.userName }}
</a-descriptions-item>
<a-descriptions-item label="钱包余额">
{{ form.balance }}
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ dictConvert('WalletStatus', form.status) }}
</a-descriptions-item>
</a-descriptions>
<template #footer>
<a-button key="cancel" @click="handleCancel">取消</a-button>
</template>
</basic-modal>
</template>
<script lang="ts" setup>
import { nextTick, reactive } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, getWalletInfo, update, Wallet } from "./Wallet.api";
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicModal } from '/@/components/Modal'
import { useDict } from '/@/hooks/bootx/useDict'
const {
initFormEditType,
handleCancel,
modalWidth,
title,
confirmLoading,
visible,
} = useFormEdit()
const { dictConvert } = useDict()
// 表单
const formRef = $ref<FormInstance>()
let form = $ref<Wallet>({
id: null,
userId: '',
balance: 0,
status: 0,
userName: '',
})
// 入口
function init(id) {
visible.value = true
confirmLoading.value = true
getWalletInfo(id).then(({ data }) => {
form = data
confirmLoading.value = false
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,158 @@
<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="{ query: queryPage }">
<template #buttons>
<a-space>
<a-button type="primary" pre-icon="ant-design:usergroup-add" @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="userId" title="用户ID" />
<vxe-column field="id" title="钱包ID" />
<vxe-column field="balance" title="余额" />
<vxe-column field="payStatus" title="状态">
<template #default="{ row }">
{{ dictConvert('WalletStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="createTime" title="创建时间" />
<vxe-column fixed="right" width="120" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
<a-link @click="show(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 @click="showLog(row.id)">钱包日志</a-link>
</a-menu-item>
<a-menu-item>
<a-link danger v-if="row.status === 1" @click="lockConfirm(row.id, true)">锁定钱包</a-link>
<a-link v-if="row.status === 2" @click="lockConfirm(row.id, false)">解锁钱包</a-link>
</a-menu-item>
<a-menu-item>
<a-link @click="recharge(row.id)">金额变动</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"
/>
<wallet-info ref="walletInfo" />
<b-user-select-modal ref="userSelectModal" multiple @ok="createBatchWallet" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { createWalletBatch, del, lock, page, unlock } from './Wallet.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import WalletInfo from './WalletInfo.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 BUserSelectModal from "/@/components/Bootx/UserSelectModal/BUserSelectModal.vue";
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
// 查询条件
const fields = [
{ field: 'walletId', type: STRING, name: '钱包ID', placeholder: '请输入钱包ID' },
{ field: 'userId', type: STRING, name: '用户ID', placeholder: '请输入用户ID' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const walletInfo = $ref<any>()
const userSelectModal = $ref<any>()
const walletLogList = $ref<any>()
const walletChanger = $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)
})
}
// 开通钱包
function add() {
userSelectModal.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)
}
/**
* 锁定/解锁 钱包
* @param walletId 钱包id
* @param type true 锁定, false 解锁
*/
function lockConfirm(walletId, type) {
createConfirm({
iconType: 'warning',
title: '警告',
content: type ? '是否锁定该钱包' : '是否解锁该钱包',
onOk: async () => {
if (type) {
await lock(walletId)
} else {
await unlock(walletId)
}
createMessage.success(type ? '锁定钱包成功' : '解锁该钱包成功')
queryPage()
},
})
}
</script>
<style lang="less" scoped></style>

View File

@@ -63,22 +63,22 @@
return unref(statusMapRef).get(unref(getStatus)) as MapValue
})
const backLoginI18n = t('sys.exception.backLogin')
const backHomeI18n = t('sys.exception.backHome')
const backLoginI18n = '返回登录'
const backHomeI18n = '返回首页'
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_ACCESS, {
title: '403',
status: `${ExceptionEnum.PAGE_NOT_ACCESS}`,
subTitle: t('sys.exception.subTitle403'),
btnText: props.full ? backLoginI18n : backHomeI18n,
subTitle: '抱歉,您无权访问此页面。',
btnText: props.full ? '返回登录' : '返回首页',
handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
})
unref(statusMapRef).set(ExceptionEnum.PAGE_NOT_FOUND, {
title: '404',
status: `${ExceptionEnum.PAGE_NOT_FOUND}`,
subTitle: t('sys.exception.subTitle404'),
btnText: props.full ? backLoginI18n : backHomeI18n,
subTitle: '抱歉,您访问的页面不存在。',
btnText: props.full ? '返回登录' : '返回首页',
handler: () => (props.full ? go(PageEnum.BASE_LOGIN) : go()),
})