Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
977e3c02e8
18 files changed
+865
-275
No files matched your search
@@ -14,7 +14,7 @@
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标商户" prop="targetMchId">
|
||||
<select-mch v-model="form.targetMchId" :apiParams="{ types: '1' }" />
|
||||
<select-mch v-model="form.targetMchId" autoFirst :apiParams="{ types: '1', notIds: [form.sourceMchId] }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog width="50%" v-model="visible" :close-on-click-modal="false" @closed="dialogClosed" draggable>
|
||||
<el-dialog width="70%" v-model="visible" :close-on-click-modal="false" @closed="dialogClosed" draggable>
|
||||
<div>
|
||||
<el-tabs v-model="form.activeTab" class="demo-tabs">
|
||||
<div v-for="v in data.tabList" :key="v.id">
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
<template>
|
||||
<div class="size-full flex justify-start">
|
||||
<div class="size-full text-start">
|
||||
<span class="color-primary">{{ detail.deptName ? detail.deptName : "???" }}</span>
|
||||
<span>部门的用户将余额从</span>
|
||||
<span class="color-primary">{{ detail.sourceName ? detail.sourceName : "???" }}</span>
|
||||
<span>转到</span>
|
||||
<span class="color-primary">{{ detail.targetName ? detail.targetName : "???" }}</span>
|
||||
<span>百分比为</span>
|
||||
<span class="color-danger">{{ detail.balanceMultiple ? detail.balanceMultiple : "???" }}%</span>
|
||||
<span>,如100元从</span>
|
||||
<span class="color-primary">{{ detail.sourceName ? detail.sourceName : "???" }}</span>
|
||||
<span>转到</span>
|
||||
<span>,如</span>
|
||||
<span class="color-primary">100元</span>
|
||||
<span>总余额可转到</span>
|
||||
<span class="color-primary">{{ detail.targetName ? detail.targetName : "???" }}</span>
|
||||
<span>为{{ (100 * detail.balanceMultiple) / 100 }}元</span>
|
||||
<span class="color-success">{{ detail.targetName ? displayPrice(100 * detail.balanceMultiple) : "???元" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -108,26 +108,38 @@
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
width="200"
|
||||
width="250"
|
||||
v-auths="['wallet_walletManage_edit', 'wallet_walletTransaction_update_balance']"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Money"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)"
|
||||
>充值/扣款</el-button
|
||||
>
|
||||
<div class="flex items-start">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Money"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)"
|
||||
>充值/扣款</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.isRule == 1"
|
||||
icon="SwitchFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="doTransferAccounts(row)"
|
||||
>
|
||||
转账
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -137,12 +149,13 @@
|
||||
</div>
|
||||
<transaction-list ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<change-balance ref="changeBalanceRef" @refresh="getDataList(false)" />
|
||||
<transfer-accounts ref="transferAccountsRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, fetchListJoin, delObjs } from "/@/api/wallet/wallet-manage"
|
||||
import * as walletManage from "/@/api/wallet/wallet-manage"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
@@ -150,22 +163,23 @@ import { displayPrice } from "/@/utils/formatMoney"
|
||||
// 引入组件
|
||||
const TransactionList = defineAsyncComponent(() => import("../components/transaction-list.vue"))
|
||||
const ChangeBalance = defineAsyncComponent(() => import("./change-balance.vue"))
|
||||
const TransferAccounts = defineAsyncComponent(() => import("./transfer-accounts.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const changeBalanceRef = ref()
|
||||
const draggableDepTreeRef = ref()
|
||||
const transferAccountsRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchListJoin,
|
||||
pageList: walletManage.fetchListJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -192,6 +206,12 @@ const exportExcel = () => {
|
||||
)
|
||||
}
|
||||
|
||||
// 转账
|
||||
const doTransferAccounts = (row: any) => {
|
||||
// 检查配置是否正确
|
||||
transferAccountsRef.value.openDialog(row.userId, row.id)
|
||||
}
|
||||
|
||||
const getSummaries = (param: any) => {
|
||||
const { columns, data } = param
|
||||
const totalColumns = ["balance", "totalExpense", "totalRecharge"]
|
||||
@@ -231,7 +251,7 @@ const handleDelete = async (ids: string[]) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
await walletManage.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<el-dialog title="转账" v-model="visible" width="60%" :close-on-click-modal="false" draggable>
|
||||
<div>
|
||||
<el-alert v-if="errorMsg && errorMsg != ' '" title="错误" type="error">
|
||||
<span>{{ errorMsg }}</span>
|
||||
<span>请配置</span>
|
||||
</el-alert>
|
||||
<div v-if="!errorMsg">
|
||||
<el-descriptions :column="2" border title="用户">
|
||||
<el-descriptions-item :rowspan="1" label="用户名: ">
|
||||
<span>{{ userConfigDetail.username }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="手机号: ">
|
||||
<span>{{ userConfigDetail.userMobile }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" border title="转账前">
|
||||
<el-descriptions-item :rowspan="1" label="源钱包: ">
|
||||
<span class="color-primary">{{ userConfigDetail.sourceWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="源钱包余额: ">
|
||||
<span class="color-success">{{ displayPrice(userConfigDetail.sourceWalletBalance) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标钱包: ">
|
||||
<span class="color-primary">{{ userConfigDetail.targetWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标钱包余额: ">
|
||||
<span class="color-success">{{ displayPrice(userConfigDetail.targetWalletBalance) }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" border title="转账后">
|
||||
<el-descriptions-item :rowspan="1" label="源钱包: ">
|
||||
<span class="color-primary">{{ userConfigDetail.sourceWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="源钱包余额: ">
|
||||
<span class="color-success">{{ displayPrice(userConfigDetail.sourceWalletBalance - form.balance * 100) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标钱包: ">
|
||||
<span class="color-primary">{{ userConfigDetail.targetWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标钱包余额: ">
|
||||
<span class="color-success">{{ displayPrice(userConfigDetail.targetWalletBalance + form.balance * 100) }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="3" border title="转账统计">
|
||||
<el-descriptions-item :rowspan="1" label="转账百分比: ">
|
||||
<span class="color-primary">{{ userConfigDetail.balanceMultiple }}%</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="充值总金额: ">
|
||||
<span class="color-primary">{{ displayPrice(userConfigDetail.totalTopUpBalance) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="最大转账金额: ">
|
||||
<span class="color-primary">{{ displayPrice(userConfigDetail.maxTransferBalance) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="已转账金额: "
|
||||
>{{ displayPrice(userConfigDetail.totalTransferBalance) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div class="flex justify-start items-center mt-5">
|
||||
<span>用户</span>
|
||||
<span class="color-primary">{{ walletDetail.username }}</span>
|
||||
<span>将</span>
|
||||
<el-input-number class="mx-1" style="width: 200px" :min="1" :max="200" v-model="form.balance" placeholder="" />
|
||||
<span>元从</span>
|
||||
<span class="color-primary">{{ walletDetail.walletTypeName }}</span>
|
||||
<span>转到</span>
|
||||
<select-wallet-type
|
||||
class="mx-1"
|
||||
:clearable="false"
|
||||
:autoFirst="true"
|
||||
:apiParams="{ notWalletTypeIds: walletDetail.walletTypeId }"
|
||||
style="width: 200px"
|
||||
v-model="form.targetWalletTypeId"
|
||||
@change="selectWalletTypeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="errorMsg || loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="transferAccounts">
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletApi from "/@/api/wallet/wallet-manage"
|
||||
import * as walletRuleJoin from "/@/api/wallet/wallet-rule-join"
|
||||
import * as walletRuleTransactionApi from "/@/api/wallet/wallet-rule-transaction"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { convertToInteger } from "/@/utils/convert"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive<any>({
|
||||
id: undefined,
|
||||
balance: 10,
|
||||
changeType: 1,
|
||||
})
|
||||
|
||||
const walletDetail = reactive<any>({})
|
||||
|
||||
const userConfigDetail = reactive<any>({})
|
||||
|
||||
const errorMsg = ref<string>(" ")
|
||||
|
||||
/** 变动后的余额 */
|
||||
const balanceResult = computed(() => displayPrice(convertToInteger(form.balance) + convertToInteger(form.changeBalance) * form.changeType))
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
changeBalance: [{ required: true, message: "变动余额不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (userId: string, id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletManageData(userId, id)
|
||||
}
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
if (form.balance <= 0) {
|
||||
useMessage().error("转账余额不能为0")
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
const pa = {
|
||||
userId: userConfigDetail.userId,
|
||||
sourceWalletTypeId: userConfigDetail.sourceWalletTypeId,
|
||||
targetWalletTypeId: userConfigDetail.targetWalletTypeId,
|
||||
balance: Math.abs(form.balance * 100),
|
||||
}
|
||||
await walletRuleTransactionApi.transferAccounts(pa)
|
||||
useMessage().success("操作成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletManageData = async (userId: string, id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
try {
|
||||
const { data } = await walletApi.getObjDetails(id)
|
||||
Object.assign(walletDetail, data)
|
||||
getUserConfig(walletDetail.userId, walletDetail.walletTypeId, form.targetWalletTypeId)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const selectWalletTypeChange = (targetWalletTypeId: any) => {
|
||||
getUserConfig(walletDetail.userId, walletDetail.walletTypeId, targetWalletTypeId)
|
||||
}
|
||||
|
||||
// 用户配置
|
||||
const getUserConfig = async (userId: any, sourceWalletId: any, targetWalletId: any) => {
|
||||
if (!userId || !sourceWalletId || !targetWalletId) return
|
||||
const _pa = {
|
||||
userId: userId,
|
||||
sourceWalletTypeId: sourceWalletId,
|
||||
targetWalletTypeId: targetWalletId,
|
||||
}
|
||||
try {
|
||||
const { data } = await walletRuleJoin.userConfig(_pa)
|
||||
if (!data) return
|
||||
Object.assign(userConfigDetail, data)
|
||||
errorMsg.value = ""
|
||||
} catch (e: any) {
|
||||
errorMsg.value = e.msg
|
||||
useMessage().error(e.msg)
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-descriptions) {
|
||||
&:not(:nth-child(1)) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-label {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-content {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.el-descriptions__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
background-color: #409eff;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
|
||||
.el-descriptions-item__container {
|
||||
margin: 0 10px;
|
||||
|
||||
.no-colon {
|
||||
margin: 0;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -16,10 +16,7 @@
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="钱包" prop="walletTypeId">
|
||||
<!-- <select-wallet-type v-model="form.walletTypeId" placeholder="请选择钱包" :disabled="false" /> -->
|
||||
<el-select v-model="form.walletTypeId" :disabled="true">
|
||||
<el-option v-for="item in walletTypeOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<select-wallet-type v-model="form.walletTypeId" placeholder="请选择钱包" :disabled="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -61,7 +58,6 @@ const form = reactive({
|
||||
importTime: "",
|
||||
remark: "",
|
||||
})
|
||||
const walletTypeOptions = ref()
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
@@ -83,10 +79,6 @@ const openDialog = async (id: string) => {
|
||||
form.id = id
|
||||
getwalletRechargeApplyData(id)
|
||||
}
|
||||
|
||||
const res = await getWalletTypeSimple()
|
||||
walletTypeOptions.value = res.data.records
|
||||
form.walletTypeId = res.data.records.find((item: any) => item.uniqueCode == "1").id
|
||||
}
|
||||
|
||||
// 提交
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
:nodeClickable="false"
|
||||
>
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item style="width: 250px" label="用户" prop="userId">
|
||||
<select-user v-model="state.queryForm.userId" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 250px" label="是否退回" prop="isRefund">
|
||||
<dict-select v-model="state.queryForm.isRefund" dict-code="yes_no_type" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 350px" label="转账时间" prop="createTimeList">
|
||||
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 350px" label="退回时间" prop="refundTimeList">
|
||||
<el-date-picker v-model="state.queryForm.refundTimeList" value-format="YYYY-MM-DD" type="daterange" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">
|
||||
@@ -46,29 +58,75 @@
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="80" />
|
||||
<el-table-column label="用户">
|
||||
<el-table-column width="120" prop="username" label="姓名" />
|
||||
<el-table-column width="120" prop="userMobile" label="手机号" />
|
||||
<el-table-column width="120" prop="userDeptName" label="部门" />
|
||||
</el-table-column>
|
||||
<el-table-column label="源钱包">
|
||||
<el-table-column prop="sourceWalletId" label="源钱包" />
|
||||
<el-table-column prop="sourceWalletBalance" label="源钱包余额" />
|
||||
<el-table-column width="100" prop="sourceWalletId" label="源钱包">
|
||||
<template #default="{ row }">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div class="color-primary">{{ row.sourceWalletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.sourceWalletTypeCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100" prop="sourceWalletBalance" label="源钱包余额">
|
||||
<template #default="{ row }">
|
||||
<span class="color-primary">{{ displayPrice(row.sourceWalletBalance) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="目标钱包">
|
||||
<el-table-column prop="sourceWalletId" label="源钱包" />
|
||||
<el-table-column prop="sourceWalletBalance" label="源钱包余额" />
|
||||
<el-table-column width="110" label="源钱包">
|
||||
<template #default="{ row }">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<div class="color-primary">{{ row.targetWalletTypeName }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<dict-tag :options="wallet_type" :value="row.targetWalletTypeCode" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="110" prop="sourceWalletBalance" label="源钱包余额">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ displayPrice(row.targetWalletBalance) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="转换">
|
||||
<el-table-column prop="balance" label="转换金额" />
|
||||
<el-table-column prop="balanceMultiple" label="百分比" />
|
||||
<el-table-column prop="afterBalance" label="转换后的金额" />
|
||||
<el-table-column width="110" prop="balance" label="转换金额">
|
||||
<template #default="{ row }">
|
||||
<span class="color-primary">{{ displayPrice(row.balance) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="110" label="转换后的金额">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ displayPrice(row.afterBalance) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="是否退回" />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-table-column width="100" label="退回">
|
||||
<el-table-column width="100" label="是否退回">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isRefund" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="refundTime" width="170" label="退回时间" />
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" width="170" label="创建时间" />
|
||||
<el-table-column label="操作" fixed="right" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="false"
|
||||
icon="edit-pen"
|
||||
v-if="row.isRefund == '0'"
|
||||
icon="RefreshRight"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletRuleTransaction_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)"
|
||||
@click="doRefund(row)"
|
||||
>
|
||||
退回
|
||||
</el-button>
|
||||
@@ -89,11 +147,12 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as walletRuleTransactionApi from "/@/api/wallet/wallet-rule-transaction"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
@@ -106,7 +165,7 @@ const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: walletRuleTransactionApi.fetchList,
|
||||
pageList: walletRuleTransactionApi.pageJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -117,6 +176,22 @@ const exportExcel = () => {
|
||||
downBlobFile("/wallet/walletRuleTransaction/export", Object.assign(state.queryForm, { ids: selectObjs }), "walletRuleTransaction.xlsx")
|
||||
}
|
||||
|
||||
// 退款
|
||||
const doRefund = async (row: any) => {
|
||||
try {
|
||||
await useMessageBox().confirm(`是否退回用户从${row.sourceWalletTypeName}转到${row.targetWalletTypeName}的${displayPrice(row.balance)}`)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await walletRuleTransactionApi.refund({ id: row.id })
|
||||
getDataList()
|
||||
useMessage().success("退回成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
|
||||
@@ -9,7 +9,16 @@
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标钱包类型" prop="targetWalletTypeId">
|
||||
<select-wallet-type v-model="form.targetWalletTypeId" />
|
||||
<select-wallet-type
|
||||
v-model="form.targetWalletTypeId"
|
||||
:autoFirst="true"
|
||||
:apiParams="{ notWalletTypeIds: form.sourceWalletTypeId }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20" v-if="!form.id">
|
||||
<el-form-item label="目标部门" prop="targetDeptIdList">
|
||||
<tree-multiple-select style="width: 400px" v-model="form.targetDeptIdList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
@@ -17,11 +26,6 @@
|
||||
<el-input-number :min="1" :max="200" v-model="form.balanceMultiple" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-alert title="提示" type="info" :closable="false">
|
||||
<wallet-rule-desc :detail="form" />
|
||||
</el-alert>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -37,8 +41,6 @@
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletRuleJoinApi from "/@/api/wallet/wallet-rule-join"
|
||||
|
||||
const WalletRuleDesc = defineAsyncComponent(() => import("../../components/wallet-rule-desc.vue"))
|
||||
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
@@ -52,6 +54,8 @@ const defaultForm = {
|
||||
id: "",
|
||||
sourceWalletTypeId: "",
|
||||
targetWalletTypeId: "",
|
||||
targetDeptId: "",
|
||||
targetDeptIdList: [],
|
||||
balanceMultiple: 100,
|
||||
status: 0,
|
||||
}
|
||||
@@ -61,21 +65,21 @@ const form = reactive({
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
sourceWalletTypeId: [{ required: true, message: "请选择源钱包类型", trigger: "blur" }],
|
||||
targetWalletTypeId: [{ required: true, message: "请选择目标钱包类型", trigger: "blur" }],
|
||||
balanceMultiple: [{ required: true, message: "请输入钱包转换百分比", trigger: "blur" }],
|
||||
sourceWalletTypeId: [{ required: true, message: "请选择源钱包类型", trigger: "change" }],
|
||||
targetWalletTypeId: [{ required: true, message: "请选择目标钱包类型", trigger: "change" }],
|
||||
targetDeptId: [{ required: true, message: "请选择目标部门", trigger: "change" }],
|
||||
targetDeptIdList: [{ required: true, message: "请选择目标部门", trigger: "change" }],
|
||||
balanceMultiple: [{ required: true, message: "请输入钱包转换百分比", trigger: "change" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string, sourceWalletTypeId: string) => {
|
||||
visible.value = true
|
||||
Object.assign(form, defaultForm)
|
||||
form.sourceWalletTypeId = sourceWalletTypeId
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
Object.assign(form, { ...defaultForm, sourceWalletTypeId: sourceWalletTypeId })
|
||||
})
|
||||
// 获取walletRuleJoin信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRuleJoinData(id)
|
||||
@@ -86,14 +90,11 @@ const openDialog = (id: string, sourceWalletTypeId: string) => {
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = form.id ? await walletRuleJoinApi.putObj(form) : await walletRuleJoinApi.addObj(form)
|
||||
form.id ? await walletRuleJoinApi.putObj(form) : await walletRuleJoinApi.addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
// visible.value = false
|
||||
// 更新
|
||||
await getwalletRuleJoinData(data)
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="钱包规则" width="70%" v-model="visible" append-to-body :close-on-click-modal="false" draggable>
|
||||
<el-dialog title="钱包规则" width="75%" v-model="visible" append-to-body :close-on-click-modal="false" draggable>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="doAdd" v-auth="'dzc_walletRuleMchConfig_add'"> 新 增 </el-button>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120" label="目前钱包类型">
|
||||
<el-table-column min-width="120" label="目标钱包类型">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.targetName }}</div>
|
||||
@@ -36,6 +36,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120" prop="deptName" label="目标部门" show-overflow-tooltip />
|
||||
<el-table-column prop="rulePriceConfigId" min-width="80" label="转换百分比">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ row.balanceMultiple }}%</span>
|
||||
@@ -58,7 +59,7 @@
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'dzc_walletRuleMchConfig_edit'"
|
||||
@click="WalletRuleFormDialogRef.openDialog(row.id, state.queryForm.sourceWalletTypeId)"
|
||||
@click="WalletRuleFormDialogRef.openDialog(row.id, row.sourceWalletTypeId)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'dzc_walletRuleMchConfig_del'" @click="handleDelete([row.id])"
|
||||
|
||||
@@ -49,21 +49,37 @@
|
||||
<dict-tag :options="wallet_type" :value="row.uniqueCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isRule" label="是否启用钱包规则" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
v-model="row.isRule"
|
||||
@change="isRuleChange(row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-auths="['wallet_walletType_edit', 'wallet_walletType_del']" label="操作" width="250">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="WalletRuleTableDialogRef.openDialog(row.id)"
|
||||
>
|
||||
钱包规则
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletType_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletType_del'" @click="handleDelete([row.id])"> 删除 </el-button>
|
||||
<div class="flex items-start">
|
||||
<el-button
|
||||
v-if="row.isRule == 1"
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="WalletRuleTableDialogRef.openDialog(row.id)"
|
||||
>
|
||||
钱包规则
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletType_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletType_del'" @click="handleDelete([row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -78,7 +94,7 @@
|
||||
|
||||
<script setup lang="ts" name="systemWalletType">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/wallet/wallet-type"
|
||||
import * as walletTypeApi from "/@/api/wallet/wallet-type"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
@@ -99,7 +115,7 @@ const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
pageList: walletTypeApi.fetchList,
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -125,6 +141,17 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 修改是否启用钱包规则
|
||||
const isRuleChange = async (row: any) => {
|
||||
try {
|
||||
await walletTypeApi.putObj(row)
|
||||
getDataList()
|
||||
useMessage().success("操作成功")
|
||||
} catch (e) {
|
||||
useMessage().error("操作错误")
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
@@ -134,7 +161,7 @@ const handleDelete = async (ids: string[]) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
await walletTypeApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
|
||||
Reference in new issue
Block a user