feat:财税-报销单 添加支付操作逻辑
parent
831d6ae746
commit
750cd388b5
@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="支付" width="500px" @register="registerModal">
|
||||
<BasicForm @register="registerForm" />
|
||||
<!--右下角按钮-->
|
||||
<template #footer>
|
||||
<a-button
|
||||
pre-icon="ant-design:close-outlined"
|
||||
type="warning"
|
||||
:loading="loading"
|
||||
ghost
|
||||
style="margin-right: 0.8rem"
|
||||
@click="closeModal"
|
||||
>
|
||||
取消
|
||||
</a-button>
|
||||
<a-button
|
||||
type="success"
|
||||
:loading="loading"
|
||||
pre-icon="ant-design:check-outlined"
|
||||
style="margin-right: 0.8rem"
|
||||
@click="payNowHandle"
|
||||
>
|
||||
立即打款
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { modalFormSchema } from './columns'
|
||||
import { BankPaymentApi } from './api'
|
||||
const { createMessage } = useMessage()
|
||||
const loading = ref(false)
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: modalFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
|
||||
const reimbursementId = ref('')
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
|
||||
reimbursementId.value = data.id
|
||||
})
|
||||
const payNowHandle = async () => {
|
||||
try {
|
||||
const values = await validate()
|
||||
loading.value = true
|
||||
|
||||
setModalProps({ confirmLoading: true, loading: true })
|
||||
const postData = {
|
||||
...values,
|
||||
reimbursementId: reimbursementId.value,
|
||||
}
|
||||
const res = await BankPaymentApi(postData)
|
||||
loading.value = false
|
||||
if (res.succeeded) {
|
||||
createMessage.success(res.message)
|
||||
emit('success')
|
||||
}
|
||||
closeModal()
|
||||
} catch (err) {
|
||||
console.log('err', err)
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false, loading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue