|  |  |  | 
|---|
|  |  |  | :width="700" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ProForm :model="form" ref="dialogForm" label-width="120px"> | 
|---|
|  |  |  | <ProFormItemV2 label="钱包通道:" prop="access" :check-rules="[{ message: '请选择钱包通道' }]"> | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | v-model="form.access" | 
|---|
|  |  |  | :valueEnum="EnumEnterpriseWalletAccessTextOnlyAlipay" | 
|---|
|  |  |  | placeholder="请选择钱包通道" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </ProFormSelect> | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 | 
|---|
|  |  |  | label="充值金额:" | 
|---|
|  |  |  | prop="amount" | 
|---|
|  |  |  | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </ProDialog> | 
|---|
|  |  |  | <!-- <AlipayWalletRecharge v-bind="dialogAlipayWalletProps" /> --> | 
|---|
|  |  |  | <AlipayWalletRecharge v-bind="dialogAlipayWalletProps" /> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script setup lang="ts"> | 
|---|
|  |  |  | 
|---|
|  |  |  | ProFormItemV2, | 
|---|
|  |  |  | ProFormTextArea, | 
|---|
|  |  |  | useFormDialog, | 
|---|
|  |  |  | ProFormSelect, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import * as enterpriseWalletServices from '@/services/api/enterpriseWallet'; | 
|---|
|  |  |  | import AlipayWalletRecharge from './AlipayWalletRecharge.vue'; | 
|---|
|  |  |  | import { EnumEnterpriseWalletAccessTextOnlyAlipay } from '@/constants'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'RechargeEnterpriseWalletDialog', | 
|---|
|  |  |  | 
|---|
|  |  |  | title?: string; | 
|---|
|  |  |  | amount: number; | 
|---|
|  |  |  | remark: string; | 
|---|
|  |  |  | access: EnumEnterpriseWalletAccess; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const visible = defineModel({ type: Boolean }); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const dialogForm = ref<FormInstance>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // const { dialogProps: dialogAlipayWalletProps, handleAdd: handleAlipayWalletAdd } = useFormDialog({ | 
|---|
|  |  |  | //   onConfirm: rechargeEnterpriseWallet, | 
|---|
|  |  |  | //   defaultFormParams: { | 
|---|
|  |  |  | //     alipayUrl: '', | 
|---|
|  |  |  | //   }, | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | const { dialogProps: dialogAlipayWalletProps, handleAdd: handleAlipayWalletAdd } = useFormDialog({ | 
|---|
|  |  |  | defaultFormParams: { | 
|---|
|  |  |  | alipayUrl: '', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // async function rechargeEnterpriseWallet() { | 
|---|
|  |  |  | //   try { | 
|---|
|  |  |  | //     let params: API.RechargeEnterpriseWalletCommand = { | 
|---|
|  |  |  | //       access: EnumEnterpriseWalletAccess.Alipay, | 
|---|
|  |  |  | //       amount: form.value.amount, | 
|---|
|  |  |  | //       remark: form.value.remark, | 
|---|
|  |  |  | //     }; | 
|---|
|  |  |  | //     let res = await enterpriseWalletServices.rechargeEnterpriseWallet(params); | 
|---|
|  |  |  | //     if (res) { | 
|---|
|  |  |  | //       handleAlipayWalletAdd({ | 
|---|
|  |  |  | //         alipayUrl: res.payUrl, | 
|---|
|  |  |  | //       }); | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | //   } catch (error) {} | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | async function rechargeEnterpriseWallet() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.RechargeEnterpriseWalletCommand = { | 
|---|
|  |  |  | access: form.value.access, | 
|---|
|  |  |  | amount: form.value.amount, | 
|---|
|  |  |  | remark: form.value.remark, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await enterpriseWalletServices.rechargeEnterpriseWallet(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | handleAlipayWalletAdd({ | 
|---|
|  |  |  | alipayUrl: res.payUrl, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function onDialogClose() { | 
|---|
|  |  |  | if (!dialogForm.value) return; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!dialogForm.value) return; | 
|---|
|  |  |  | dialogForm.value.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | rechargeEnterpriseWallet(); | 
|---|
|  |  |  | emit('onConfirm'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return; | 
|---|