|
|
|
@ -0,0 +1,182 @@
|
|
|
|
|
<template>
|
|
|
|
|
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
|
|
|
|
<el-form
|
|
|
|
|
ref="formRef"
|
|
|
|
|
:model="formData"
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
label-width="100px"
|
|
|
|
|
v-loading="formLoading"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="1;用户 2:车队" prop="bindType">
|
|
|
|
|
<el-select v-model="formData.bindType" placeholder="请选择1;用户 2:车队">
|
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="用户实际到账余额,例如充 100 送 20,则该值是 120" prop="totalPrice">
|
|
|
|
|
<el-input v-model="formData.totalPrice" placeholder="请输入用户实际到账余额,例如充 100 送 20,则该值是 120" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="实际支付金额" prop="payPrice">
|
|
|
|
|
<el-input v-model="formData.payPrice" placeholder="请输入实际支付金额" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="钱包赠送金额" prop="bonusPrice">
|
|
|
|
|
<el-input v-model="formData.bonusPrice" placeholder="请输入钱包赠送金额" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="是否已支付:[0:未支付 1:已经支付过]" prop="payStatus">
|
|
|
|
|
<el-select v-model="formData.payStatus" placeholder="请选择是否已支付:[0:未支付 1:已经支付过]">
|
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="支付订单编号" prop="payOrderId">
|
|
|
|
|
<el-input v-model="formData.payOrderId" placeholder="请输入支付订单编号" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="支付成功的支付渠道" prop="payChannelCode">
|
|
|
|
|
<el-input v-model="formData.payChannelCode" placeholder="请输入支付成功的支付渠道" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="订单支付时间" prop="payTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.payTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
placeholder="选择订单支付时间"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="支付退款单编号" prop="payRefundId">
|
|
|
|
|
<el-input v-model="formData.payRefundId" placeholder="请输入支付退款单编号" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="退款金额,包含赠送金额" prop="refundTotalPrice">
|
|
|
|
|
<el-input v-model="formData.refundTotalPrice" placeholder="请输入退款金额,包含赠送金额" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="退款支付金额" prop="refundPayPrice">
|
|
|
|
|
<el-input v-model="formData.refundPayPrice" placeholder="请输入退款支付金额" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="退款钱包赠送金额" prop="refundBonusPrice">
|
|
|
|
|
<el-input v-model="formData.refundBonusPrice" placeholder="请输入退款钱包赠送金额" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="退款时间" prop="refundTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.refundTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
placeholder="选择退款时间"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="退款状态" prop="refundStatus">
|
|
|
|
|
<el-radio-group v-model="formData.refundStatus">
|
|
|
|
|
<el-radio label="1">请选择字典生成</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { WalletApi } from '@/api/pay/wallet/account'
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
const formData = ref({
|
|
|
|
|
id: undefined,
|
|
|
|
|
walletId: undefined,
|
|
|
|
|
bindType: undefined,
|
|
|
|
|
totalPrice: undefined,
|
|
|
|
|
payPrice: undefined,
|
|
|
|
|
bonusPrice: undefined,
|
|
|
|
|
payStatus: undefined,
|
|
|
|
|
payOrderId: undefined,
|
|
|
|
|
payChannelCode: undefined,
|
|
|
|
|
payTime: undefined,
|
|
|
|
|
payRefundId: undefined,
|
|
|
|
|
refundTotalPrice: undefined,
|
|
|
|
|
refundPayPrice: undefined,
|
|
|
|
|
refundBonusPrice: undefined,
|
|
|
|
|
refundTime: undefined,
|
|
|
|
|
refundStatus: undefined,
|
|
|
|
|
})
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
walletId: [{ required: true, message: '会员钱包 id不能为空', trigger: 'blur' }],
|
|
|
|
|
bindType: [{ required: true, message: '1;用户 2:车队不能为空', trigger: 'change' }],
|
|
|
|
|
totalPrice: [{ required: true, message: '用户实际到账余额,例如充 100 送 20,则该值是 120不能为空', trigger: 'blur' }],
|
|
|
|
|
payPrice: [{ required: true, message: '实际支付金额不能为空', trigger: 'blur' }],
|
|
|
|
|
bonusPrice: [{ required: true, message: '钱包赠送金额不能为空', trigger: 'blur' }],
|
|
|
|
|
payStatus: [{ required: true, message: '是否已支付:[0:未支付 1:已经支付过]不能为空', trigger: 'change' }],
|
|
|
|
|
refundTotalPrice: [{ required: true, message: '退款金额,包含赠送金额不能为空', trigger: 'blur' }],
|
|
|
|
|
refundPayPrice: [{ required: true, message: '退款支付金额不能为空', trigger: 'blur' }],
|
|
|
|
|
refundBonusPrice: [{ required: true, message: '退款钱包赠送金额不能为空', trigger: 'blur' }],
|
|
|
|
|
refundStatus: [{ required: true, message: '退款状态不能为空', trigger: 'blur' }],
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
|
|
const open = async (type: string, id?: number, walletId: number) => {
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
|
|
formType.value = type
|
|
|
|
|
resetForm()
|
|
|
|
|
formData.value.walletId = walletId
|
|
|
|
|
// 修改时,设置数据
|
|
|
|
|
if (id) {
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
formData.value = await WalletApi.getWalletRecharge(id)
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
|
|
|
|
/** 提交表单 */
|
|
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
|
const submitForm = async () => {
|
|
|
|
|
// 校验表单
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
// 提交请求
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = formData.value
|
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
|
await WalletApi.createWalletRecharge(data)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
} else {
|
|
|
|
|
await WalletApi.updateWalletRecharge(data)
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
}
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
// 发送操作成功的事件
|
|
|
|
|
emit('success')
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 重置表单 */
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
formData.value = {
|
|
|
|
|
id: undefined,
|
|
|
|
|
walletId: undefined,
|
|
|
|
|
bindType: undefined,
|
|
|
|
|
totalPrice: undefined,
|
|
|
|
|
payPrice: undefined,
|
|
|
|
|
bonusPrice: undefined,
|
|
|
|
|
payStatus: undefined,
|
|
|
|
|
payOrderId: undefined,
|
|
|
|
|
payChannelCode: undefined,
|
|
|
|
|
payTime: undefined,
|
|
|
|
|
payRefundId: undefined,
|
|
|
|
|
refundTotalPrice: undefined,
|
|
|
|
|
refundPayPrice: undefined,
|
|
|
|
|
refundBonusPrice: undefined,
|
|
|
|
|
refundTime: undefined,
|
|
|
|
|
refundStatus: undefined,
|
|
|
|
|
}
|
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
</script>
|