Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-pc-cloud
This commit is contained in:
commit
30716afea5
36 files changed
+1758
-260
No files matched your search
@@ -109,7 +109,11 @@
|
||||
label="操作"
|
||||
fixed="right"
|
||||
width="250"
|
||||
v-auths="['wallet_walletManage_edit', 'wallet_walletTransaction_update_balance']"
|
||||
v-auths="[
|
||||
'wallet_walletManage_edit',
|
||||
'wallet_walletTransaction_update_balance',
|
||||
'wallet_walletRuleTransaction_transfer_accounts',
|
||||
]"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-start">
|
||||
@@ -134,7 +138,7 @@
|
||||
icon="SwitchFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
v-auth="'wallet_walletRuleTransaction_transfer'"
|
||||
@click="doTransferAccounts(row)"
|
||||
>
|
||||
转账
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog title="转账" v-model="visible" width="60%" :close-on-click-modal="false" draggable>
|
||||
<div>
|
||||
<el-alert title="错误" type="error">
|
||||
<el-alert v-if="errorMsg && errorMsg != ' '" title="错误" type="error">
|
||||
<span>{{ errorMsg }}</span>
|
||||
<span>请配置</span>
|
||||
</el-alert>
|
||||
@@ -14,18 +14,46 @@
|
||||
<span>{{ userConfigDetail.userMobile }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" border title="钱包">
|
||||
<el-descriptions :column="2" border title="转账前">
|
||||
<el-descriptions-item :rowspan="1" label="源钱包: ">
|
||||
<span class="color-primary">{{ walletDetail.walletTypeName }}</span>
|
||||
<span class="color-primary">{{ userConfigDetail.sourceWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="源余额: ">
|
||||
<span class="color-success">{{ displayPrice(walletDetail.balance) }}</span>
|
||||
<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">{{ walletDetail.username }}</span>
|
||||
<span class="color-primary">{{ userConfigDetail.targetWalletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标余额: ">
|
||||
<span class="color-success">{{ walletDetail.username }}</span>
|
||||
<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="2" 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>
|
||||
@@ -33,7 +61,7 @@
|
||||
<span>用户</span>
|
||||
<span class="color-primary">{{ walletDetail.username }}</span>
|
||||
<span>将</span>
|
||||
<el-input-number :disabled="errorMsg" class="mx-1" style="width: 200px" :min="1" :max="200" v-model="form.balance" placeholder="" />
|
||||
<el-input-number class="mx-1" style="width: 200px" :min="1" :max="5000" v-model="form.balance" placeholder="" />
|
||||
<span>元从</span>
|
||||
<span class="color-primary">{{ walletDetail.walletTypeName }}</span>
|
||||
<span>转到</span>
|
||||
@@ -61,7 +89,7 @@
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletApi from "/@/api/wallet/wallet-manage"
|
||||
import * as walletRuleJoin from "/@/api/wallet/wallet-rule-join"
|
||||
import * as walletTransactionApi from "/@/api/wallet/wallet-transaction"
|
||||
import * as walletRuleTransactionApi from "/@/api/wallet/wallet-rule-transaction"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { convertToInteger } from "/@/utils/convert"
|
||||
const emit = defineEmits(["refresh"])
|
||||
@@ -83,7 +111,7 @@ const walletDetail = reactive<any>({})
|
||||
|
||||
const userConfigDetail = reactive<any>({})
|
||||
|
||||
const errorMsg = ref<string>("")
|
||||
const errorMsg = ref<string>(" ")
|
||||
|
||||
/** 变动后的余额 */
|
||||
const balanceResult = computed(() => displayPrice(convertToInteger(form.balance) + convertToInteger(form.changeBalance) * form.changeType))
|
||||
@@ -108,28 +136,19 @@ const openDialog = (userId: string, id: string) => {
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
if (form.changeBalance <= 0) {
|
||||
useMessage().error("变动余额不能为零")
|
||||
return
|
||||
}
|
||||
if (convertToInteger(balanceResult.value) < 0) {
|
||||
useMessage().error("变动后的余额不能小于 0")
|
||||
if (form.balance <= 0) {
|
||||
useMessage().error("转账余额不能为0")
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
const pa = {
|
||||
...form,
|
||||
userId: form.id,
|
||||
walletId: form.walletId,
|
||||
balance: form.changeBalance * 100,
|
||||
userId: userConfigDetail.userId,
|
||||
sourceWalletTypeId: userConfigDetail.sourceWalletTypeId,
|
||||
targetWalletTypeId: userConfigDetail.targetWalletTypeId,
|
||||
balance: Math.abs(form.balance * 100),
|
||||
}
|
||||
if (pa.changeType == -1) {
|
||||
pa.balance = -1 * pa.balance
|
||||
}
|
||||
await walletTransactionApi.updateBalance(pa)
|
||||
await walletRuleTransactionApi.transferAccounts(pa)
|
||||
useMessage().success("操作成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
@@ -168,7 +187,8 @@ const getUserConfig = async (userId: any, sourceWalletId: any, targetWalletId: a
|
||||
try {
|
||||
const { data } = await walletRuleJoin.userConfig(_pa)
|
||||
if (!data) return
|
||||
Object.assign(data, userConfigDetail)
|
||||
Object.assign(userConfigDetail, data)
|
||||
errorMsg.value = ""
|
||||
} catch (e: any) {
|
||||
errorMsg.value = e.msg
|
||||
useMessage().error(e.msg)
|
||||
@@ -187,7 +207,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-label {
|
||||
width: 100px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-content {
|
||||
|
||||
@@ -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" v-auths="['wallet_walletRuleTransaction_refund']">
|
||||
<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)"
|
||||
v-auth="'wallet_walletRuleTransaction_refund'"
|
||||
@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)
|
||||
|
||||
@@ -1,130 +1,130 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="套餐名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入套餐名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="套餐名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入套餐名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="支付金额" prop="payPrice">
|
||||
<el-input-number v-model="form.payPrice" :min="0" :precision="2" :step="0.01" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="支付金额" prop="payPrice">
|
||||
<el-input-number v-model="form.payPrice" :min="0" :precision="2" :step="0.01" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="赠送金额" prop="bonusPrice">
|
||||
<el-input-number v-model="form.bonusPrice" :min="0" :precision="2" :step="0.01" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="赠送金额" prop="bonusPrice">
|
||||
<el-input-number v-model="form.bonusPrice" :min="0" :precision="2" :step="0.01" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="是否启用" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="v in yes_no_type" :key="v.value" :label="v.value">
|
||||
{{ v.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="是否启用" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="v in yes_no_type" :key="v.value" :label="v.value">
|
||||
{{ v.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletRechargePackageDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/wallet-recharge-package";
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/wallet-recharge-package"
|
||||
import { rule } from "/@/utils/validate"
|
||||
import { storePrice } from "/@/utils/formatMoney"
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义查询字典
|
||||
const { yes_no_type } = useDict('yes_no_type');
|
||||
const { yes_no_type } = useDict("yes_no_type")
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
payPrice: '',
|
||||
bonusPrice: '',
|
||||
status: "1",
|
||||
});
|
||||
id: "",
|
||||
name: "",
|
||||
payPrice: "",
|
||||
bonusPrice: "",
|
||||
status: "1",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [{ required: true, message: '套餐名不能为空', trigger: 'blur' }],
|
||||
payPrice: [{ required: true, message: '支付金额不能为空', trigger: 'blur' }],
|
||||
bonusPrice: [{ required: true, message: '赠送金额不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||
name: [{ required: true, message: "套餐名不能为空", trigger: "blur" }],
|
||||
payPrice: [{ required: true, message: "支付金额不能为空", trigger: "blur" }],
|
||||
bonusPrice: [{ required: true, message: "赠送金额不能为空", trigger: "blur" }],
|
||||
status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 获取walletRechargePackage信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRechargePackageData(id)
|
||||
}
|
||||
};
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
// 获取walletRechargePackage信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRechargePackageData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
const pa = {
|
||||
...form,
|
||||
payPrice: storePrice(form.payPrice),
|
||||
bonusPrice: storePrice(form.bonusPrice),
|
||||
}
|
||||
form.id ? await putObj(pa) : await addObj(pa);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const pa = {
|
||||
...form,
|
||||
payPrice: storePrice(form.payPrice),
|
||||
bonusPrice: storePrice(form.bonusPrice),
|
||||
}
|
||||
form.id ? await putObj(pa) : await addObj(pa)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletRechargePackageData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
Reference in new issue
Block a user