InvoiceCreate.vue
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<BasicModal
v-bind="$attrs"
@register="register"
title="Invoice创建"
width="500px"
:bodyStyle="{ height: '300px' }"
@ok="handleOk"
>
<div>
<div style="font-size: 15px">Invoice编号</div>
<a-textarea v-model:value="Input1" placeholder="请输入" auto-size />
<div style="margin: 16px 0"></div>
<div>报关单(请上传PDF格式)</div
><a-space direction="vertical" style="width: 100%" size="large">
<a-upload
v-model:file-list="fileList"
:beforeUpload="beforeUpload"
list-type="picture"
:max-count="1"
:action="uploadUrl"
@change="handleChange"
>
<a-button> 上传报关单 </a-button>
</a-upload>
</a-space>
<div style="font-size: 15px">最后汇款日期</div>
<a-textarea v-model:value="Input2" auto-size disabled /></div
></BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '@/components/Modal';
import { computed, ref } from 'vue';
import type { UploadProps } from 'ant-design-vue';
import { getRefundDate, getInvoice, createInvoice } from '@/api/project/invoice';
const fileList = ref<UploadProps['fileList']>([]);
const Input1 = ref('');
const Input2 = ref();
const uploadUrl = ref('http://47.104.8.35:18000/api/localStorage/upload_file_oss?name=');
const bgUrl = ref();
const orderIds = ref();
const [register, { closeModal }] = useModalInner(async (data) => {
const ids = data.data;
const res = await getRefundDate({ orderIds: ids });
Input2.value = res;
orderIds.value = data.data;
});
// const title = ref('');
async function handleOk() {
await createInvoice({
invoiceNo: Input1.value,
bgUrl: bgUrl.value,
backRefundDate: Input2.value,
orderIds: orderIds.value,
});
closeModal();
}
function handleChange(info) {
if (info.file.status == 'done') {
bgUrl.value = info.file.response.data.fileUrl;
}
}
function beforeUpload(info) {
uploadUrl.value += info.name;
}
</script>