| | |
| | | <template> |
| | | <view class="invoice-detail"> |
| | | <view class="account-view"> |
| | | <!-- 使用通用页面头部组件 --> |
| | | <PageHeader title="发票详情" @back="goBack" /> |
| | | |
| | |
| | | :beforeRead="beforeReadPdf" |
| | | > |
| | | <u-button class="upload-btn" type="primary"> |
| | | <u-icon name="plus" size="14" /> |
| | | 上传文件 |
| | | </u-button> |
| | | </u-upload> |
| | |
| | | |
| | | import { ref, onMounted } from 'vue' |
| | | import dayjs from 'dayjs' |
| | | import { formatDateToYMD } from '@/utils/ruoyi' |
| | | import useUserStore from '@/store/modules/user' |
| | | import { getToken } from '@/utils/auth' |
| | | import { invoiceLedgerProductInfo, invoiceLedgerSaveOrUpdate } from '@/api/salesManagement/invoiceLedger.js' |
| | |
| | | return num.toFixed(2) |
| | | } |
| | | |
| | | const onInvoiceDateConfirm = ({ selectedValues }) => { |
| | | form.value.invoiceDate = selectedValues.join('-') |
| | | currentInvoiceDate.value = selectedValues |
| | | showInvoiceDatePicker.value = false |
| | | // 日期确认事件 |
| | | const onInvoiceDateConfirm = (e) => { |
| | | form.value.invoiceDate = formatDateToYMD(e.value) |
| | | currentInvoiceDate.value = formatDateToYMD(e.value) |
| | | showInvoiceDatePicker.value = false; |
| | | } |
| | | |
| | | // 上传前校验(兼容 Vant Uploader 的 file/fileList 结构) |
| | |
| | | |
| | | const uploadSingleFile = async (fileObj) => { |
| | | return new Promise((resolve, reject) => { |
| | | showLoadingToast({ message: '正在上传...' }) |
| | | showLoadingToast('正在上传...') |
| | | const baseUrl = config.baseUrl + '/invoiceLedger/uploadFile' |
| | | |
| | | const filePath = fileObj?.url || fileObj?.tempFilePath || fileObj?.file?.path |
| | |
| | | |
| | | const loadDetail = async (id) => { |
| | | try { |
| | | showLoadingToast({ message: '加载中...' }) |
| | | showLoadingToast('加载中...') |
| | | const res = await invoiceLedgerProductInfo({ id }) |
| | | const data = res?.data || res |
| | | form.value = { ...data } |
| | |
| | | if (!form.value.invoiceNo) { showToast('请输入发票号'); return } |
| | | if (!form.value.invoiceTotal) { showToast('请输入发票金额'); return } |
| | | if (!form.value.invoiceDate) { showToast('请选择开票日期'); return } |
| | | showLoadingToast({ message: '提交中...' }) |
| | | showLoadingToast('提交中...') |
| | | form.value.fileList = fileList.value |
| | | await invoiceLedgerSaveOrUpdate(form.value) |
| | | closeToast() |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .account-detail { |
| | | @import '@/static/scss/form-common.scss'; |
| | | .account-view { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | padding-bottom: 5rem; |
| | | } |
| | | |
| | | .info-section { |
| | | background: #fff; |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .info-grid { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | padding: 16px; |
| | | } |
| | | |
| | | .info-item { |
| | | display: flex; |
| | | width: 100%; |
| | | margin-bottom: 12px; |
| | | |
| | | &:last-child { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .info-label { |
| | | font-size: 14px; |
| | | color: #999; |
| | | min-width: 100px; |
| | | } |
| | | |
| | | .info-value { |
| | | font-size: 14px; |
| | | color: #333; |
| | | flex: 1; |
| | | } |
| | | |
| | | .info-value.highlight { |
| | | color: #2979ff; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .info-value.medium { |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | .uploaded-list { padding: 8px 16px 0 16px; } |
| | | .uploaded-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f5f5f5; } |
| | | .file-name { font-size: 12px; color: #333; margin-right: 8px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| | | .tip-text { padding: 4px 16px 0 16px; font-size: 12px; color: #888; } |
| | | .footer-btns { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; display: flex; justify-content: space-around; align-items: center; padding: 0.75rem 0; box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05); z-index: 1000; } |
| | | .cancel-btn { font-weight: 400; font-size: 1rem; color: #FFFFFF; width: 6.375rem; background: #C7C9CC; box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; } |
| | | .save-btn { font-weight: 400; font-size: 1rem; color: #FFFFFF; width: 14rem; background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%); box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; } |
| | | .footer-btns { |
| | | position: fixed; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background: #fff; |
| | | display: flex; |
| | | justify-content: space-around; |
| | | align-items: center; |
| | | padding: 0.75rem 0; |
| | | box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05); |
| | | z-index: 1000; |
| | | } |
| | | .cancel-btn { |
| | | font-weight: 400; |
| | | font-size: 1rem; |
| | | color: #FFFFFF; |
| | | width: 6.375rem; |
| | | background: #C7C9CC; |
| | | box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); |
| | | border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; |
| | | } |
| | | .save-btn { |
| | | font-weight: 400; |
| | | font-size: 1rem; |
| | | color: #FFFFFF; |
| | | width: 14rem; |
| | | background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%); |
| | | box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); |
| | | border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; |
| | | } |
| | | </style> |
| | | |