10.17沟通调整

计划收款信息增加复制操作
上传合同调整为:上传合同、上传PI、上传水单(均为必传,且支持多文件操作与下载)
This commit is contained in:
浅念
2025-10-22 11:52:20 +08:00
parent 222d07d483
commit ff0fb83bd0
20 changed files with 2139 additions and 856 deletions
@@ -153,8 +153,8 @@
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
cif_total: '',
cif_total_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
+53 -45
View File
@@ -83,44 +83,19 @@
:close-on-click-modal="false"
>
<OrderDetailContent :orderData="orderDialog.orderData" />
<!-- 合同文件 -->
<div class="boxshadow">
<div class="form-title">
<!-- <span class="border"></span> -->
<span class="title">合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<template #footer>
<div style="display: flex; justify-content: flex-end; gap: 8px">
@@ -138,7 +113,7 @@
>
<div style="max-height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px">
<el-button @click="download">下载</el-button>
<el-button @click="download" v-if="isFinites">下载</el-button>
</div>
<div
v-if="pdf.images.length"
@@ -184,8 +159,10 @@
import ApprovalTimeline from '@/components/custom/ApprovalTimeline.vue'
import type { OrderData } from '@/composables/useOrderDetailDialog'
import { usePdfPreview } from '@/composables/usePdfPreview'
import FilePreview from '@/components/custom/FilePreview.vue'
const timelineDialogVisible = ref(false)
const approvalRecords = ref<any[]>([])
const isFinites = ref(false)
// PDF 预览/打印(公共)
const { pdf, frameRef, openWithResponse, download, print, preparePreview, prepareImages } = usePdfPreview()
defineOptions({ name: 'AdminFinalListPage' })
@@ -248,6 +225,11 @@
}
//打印
const printfn = (row: any) => {
if (row.approval_status == 2) {
isFinites.value = true
} else {
isFinites.value = false
}
manageService
.printStock({ id: row.id })
.then((res) => {
@@ -261,16 +243,42 @@
console.log(err)
})
}
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
const handleView1 = async (row: any) => {
const res = await manageService.checkStock({ id: row.object_id })
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
if (res) {
// 获取订单详情成功
+6 -6
View File
@@ -177,8 +177,8 @@
<ElRow :gutter="12">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
<ElInput v-model="base.cif_total" disabled>
<template #append>{{ base.cif_total_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
@@ -332,8 +332,8 @@
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
cif_total: '',
cif_total_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
@@ -429,8 +429,8 @@
)
ship.latest_arrival = res?.latest_arrival_date || ''
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.cif_total = res?.cif_total_amount?.amount ?? ''
base.cif_total_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
// 计划收款(全部展示)
payments.value = (Array.isArray(res?.account_list) ? res.account_list : []).map((p: any) => ({
+6 -6
View File
@@ -172,8 +172,8 @@
<ElRow :gutter="12">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
<ElInput v-model="base.cif_total" disabled>
<template #append>{{ base.cif_total_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
@@ -327,8 +327,8 @@
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
cif_total: '',
cif_total_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
@@ -421,8 +421,8 @@
)
ship.latest_arrival = res?.latest_arrival_date || ''
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.cif_total = res?.cif_total_amount?.amount ?? ''
base.cif_total_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
// 计划收款(全部展示)
payments.value = (Array.isArray(res?.account_list) ? res.account_list : []).map((p: any) => ({
+162 -63
View File
@@ -68,7 +68,7 @@
type="success"
underline="never"
@click="handleView(scope.row)"
style="margin-right: 8px"
style="margin-right: 8px;color: #333333;"
>
<i class="iconfont-sys">&#xe76c;</i> 查看
</el-link>
@@ -100,7 +100,7 @@
>
<div style="max-height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px;">
<el-button @click="download">下载</el-button>
<el-button @click="download" v-if="isFinites">下载</el-button>
</div>
<div
v-if="pdf.images.length"
@@ -129,44 +129,19 @@
:close-on-click-modal="false"
>
<OrderDetailContent :orderData="orderDialog.orderData" />
<!-- 合同文件 -->
<div class="boxshadow">
<div class="form-title">
<!-- <span class="border"></span> -->
<span class="title">合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<template #footer>
<div style="display: flex; justify-content: flex-end; gap: 8px">
@@ -196,8 +171,10 @@
import OrderDetailContent from '@/components/custom/OrderDetailContent.vue'
import ApprovalTimeline from '@/components/custom/ApprovalTimeline.vue'
import type { OrderData } from '@/composables/useOrderDetailDialog'
import FilePreview from '@/components/custom/FilePreview.vue'
const timelineDialogVisible = ref(false)
const approvalRecords = ref<any[]>([])
const isFinites = ref(false)
defineOptions({ name: 'StockingListAdmin' })
// import { useAuth } from '@/composables/useAuth'
// const { hasAuth } = useAuth()
@@ -260,18 +237,48 @@
getList()
}
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
const handleView = async (row: any) => {
try {
// 获取订单详情数据
const res = await manageService.checkStock({ id: row.id })
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
if (res) {
// 转换数据格式以适配 OrderDetailDialog
const orderData: OrderData = res
@@ -284,21 +291,33 @@
console.error('获取订单详情失败:', error)
ElMessage.error('获取订单详情失败')
}
// router.push({
// path: '/admin/stock/show_admin',
// query: { id: row.id } // 可带客户名等参数
// })
// TODO: 跳转或弹窗查看备货单
}
const handleView1 = async (row: any) => {
const res = await manageService.checkStock({ id: row.object_id })
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
if (res) {
// 获取订单详情成功
const orderData: OrderData = res
@@ -306,12 +325,6 @@
orderDialog.title = '合塑实业-汽车事业部-备货单(客户下定)'
orderDialog.visible = true
}
// router.push({
// path: '/admin/stock/final_show_admin',
// query: { id: row.object_id } // 可带客户名等参数
// })
// router.push('/crmpc/stocking/final_show')
// TODO: 跳转或弹窗查看备货单
}
// 判断是否为图片文件
const isImageFile = (file: { name: string; url: string; file_name: string }) => {
@@ -419,6 +432,11 @@
}
//打印
const printfn = (row: any) => {
if (row.approval_status == 2) {
isFinites.value = true
} else {
isFinites.value = false
}
manageService
.printStock({ id: row.id })
.then((res) => {
@@ -506,5 +524,86 @@
font-size: 48px;
color: #ddd;
}
.files-list {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.file-item {
flex: 0 0 auto;
min-width: 200px;
max-width: 300px;
}
.file-preview {
position: relative;
width: 100%;
max-height: 120px;
border: 1px solid #e4e7ed;
border-radius: 6px;
overflow: hidden;
background: #fafafa;
padding: 10px;
}
.image-preview {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.preview-image {
flex: 1;
max-height: 80px;
object-fit: cover;
cursor: pointer;
transition: transform 0.2s;
}
.preview-image:hover {
transform: scale(1.05);
}
.document-preview {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.file-icon {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.file-icon i {
font-size: 48px;
color: #409eff;
}
.file-info {
padding: 8px;
background: rgba(255, 255, 255, 0.9);
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.file-name {
font-size: 12px;
color: #606266;
text-align: center;
word-break: break-all;
max-width: 100%;
}
</style>
+133 -75
View File
@@ -136,7 +136,7 @@
v-model="item.color_exterior_snapshot"
filterable
placeholder="请选择内容"
@change="(val) => (item.color_exterior_code = (wcolorOptions || []).find((x: any) => x.color_text === val)?.color_code || '')"
@change="(val) => (item.color_exterior_code = (wcolorOptions || []).find((x) => x.color_text === val)?.color_code || '')"
>
<ElOption
v-for="item in wcolorOptions"
@@ -157,7 +157,7 @@
@change="
(val) =>
(item.color_interior_code =
(ncolorOptions || []).find((x: any) => x.color_text === val)?.color_code ||
(ncolorOptions || []).find((x) => x.color_text === val)?.color_code ||
'')
"
>
@@ -171,7 +171,7 @@
<ElInput v-model="item.color_interior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="改装" label-width="85px">
<el-select
v-model="item.modify_ids"
@@ -188,7 +188,7 @@
/>
</el-select>
</ElFormItem>
</ElCol>
</ElCol> -->
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="里程" label-width="85px">
<ElInput v-model="item.mileage" placeholder="请输入里程" />
@@ -264,6 +264,23 @@
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="收款价" label-width="85px" :prop="`items.${idx}.unit_price`" required>
<ElInput v-model="item.unit_price" placeholder="请输入收款价">
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
@@ -300,6 +317,23 @@
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="配件费" label-width="85px">
<ElInput v-model="item.accessory_price" placeholder="请输入配件费">
<template #suffix>
<ElSelect v-model="item.accessory_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.accessory_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="FOB段运费" label-width="85px">
<ElInput v-model="item.fob_transport_fee" placeholder="请输入FOB段运费">
@@ -368,6 +402,23 @@
<ElInput v-model="item.commission_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="挂账" label-width="85px">
<ElInput v-model="item.retention_price" placeholder="请输入挂账">
<template #suffix>
<ElSelect v-model="item.retention_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.retention_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="购置税" label-width="85px">
<ElInput v-model="item.purchase_tax" placeholder="请输入购置税">
@@ -387,24 +438,13 @@
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="预估退税额" label-width="85px">
<ElInput v-model="item.tax_refund" placeholder="请输入预估退税额">
<!-- <template #suffix>
<ElSelect v-model="item.tax_refund_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template> -->
<ElInput
v-model="item.tax_refund"
placeholder="正在计算预估退税额"
@input="handleUserEdit(idx)"
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
<ElInput v-model="item.tax_refund_currency_snapshot" type="hidden" />
@@ -413,10 +453,14 @@
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="成交价" label-width="85px" :prop="`items.${idx}.unit_price`" required>
<ElInput v-model="item.unit_price" placeholder="请输入成交价">
<ElFormItem label="车价" label-width="85px">
<ElInput
v-model="item.car_price"
placeholder="正在计算车价"
@input="handleUserEdit(idx)"
>
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 74px">
<ElSelect v-model="item.car_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -426,7 +470,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
<ElInput v-model="item.car_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="4">
@@ -455,22 +499,17 @@
disabled
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="报关价" label-width="85px">
<ElInput
v-model="item.clearance_price"
<ElInput
v-model="item.clearance_price"
placeholder="正在计算报关价"
:class="Number(item.clearance_price) < 0 ? 'customs-fee-negative' : ''"
@input="handleUserEdit(idx)"
>
<template #suffix>
<ElSelect v-model="item.clearance_price_currency" style="width: 74px">
@@ -522,9 +561,9 @@
<ElRow :gutter="12">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="合计到岸价" label-width="105px">
<ElInput v-model="baseForm.total_cif" placeholder="请输入合计到岸价">
<ElInput v-model="baseForm.cif_total" placeholder="请输入合计到岸价">
<template #suffix>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 74px">
<ElSelect v-model="baseForm.cif_total_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -534,7 +573,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
<ElInput v-model="baseForm.cif_total_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -543,7 +582,7 @@
<template #suffix>
<ElSelect v-model="baseForm.settlement_currency" style="width: 74px">
<ElOption
@change="(val) =>(baseForm.contract_exchange_rate =(currencyOptions || []).find((x: any) => x.currency_code === val)?.exchange_rate || '') "
@change="(val) => (baseForm.contract_exchange_rate = (currencyOptions || []).find((x: any) => x.currency_code === val)?.exchange_rate || '')"
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
@@ -611,7 +650,7 @@
@change="
(val) =>
(baseForm.shipping_method_snapshot =
(transportOptions || []).find((x: any) => x.item_value === val)?.item_label ||
(transportOptions || []).find((x) => x.item_value === val)?.item_label ||
'')
"
>
@@ -633,7 +672,7 @@
@change="
(val) =>
(baseForm.trade_term_snapshot =
(trade_termsOptions || []).find((x: any) => x.id === val)?.item_label || '')
(trade_termsOptions || []).find((x) => x.id === val)?.item_label || '')
"
>
<ElOption
@@ -785,6 +824,14 @@
</ElRow>
<ElRow :gutter="12">
<ElCol :span="24" style="text-align: right">
<ElButton type="success" size="small" @click="copyPaymentItem(idx)">复制</ElButton>
<ElButton
type="primary"
size="small"
@click="addPaymentItem"
v-if="idx === paymentItems.length - 1"
>添加</ElButton
>
<ElButton
type="danger"
size="small"
@@ -792,13 +839,6 @@
:disabled="paymentItems.length === 1"
>删除</ElButton
>
<ElButton
type="primary"
size="small"
@click="addPaymentItem"
v-if="idx === paymentItems.length - 1"
>添加收款信息</ElButton
>
</ElCol>
</ElRow>
</ElForm>
@@ -812,26 +852,44 @@
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<el-upload
class="upload-box"
:action="actionImageUplode"
:headers="uploadHeaders"
:show-file-list="false"
:on-success="handleContractUpload"
:before-upload="beforeContractUpload"
<MultiFileUpload
v-model="contractFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
>
<div class="qrcode-upload-box">
<img v-if="!contractFile" class="avatar" src="@/assets/img/crm/contract.png" />
<div v-else class="file-preview">
<img v-if="isImageFile(contractFile)" :src="contractFile.url" class="preview-image" />
<div v-else class="file-icon">
<i class="el-icon-document"></i>
<span class="file-name">{{ contractFile.name }}</span>
</div>
</div>
</div>
</el-upload>
@change="(files) => (baseForm.contract = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传PI -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传PI</span>
</div>
<MultiFileUpload
v-model="piFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.pi_doc = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传水单 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传水单</span>
</div>
<MultiFileUpload
v-model="waterBillFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.transaction_slip = files.map((f) => f.file_name))"
/>
</div>
<div class="form-card">
<!-- 底部信息 -->
@@ -965,6 +1023,8 @@
import { CrmService } from '@/api/crmApi'
import { useStockingForm } from '@/composables/useStockingForm'
import { onMounted, ref, computed } from 'vue'
import MultiFileUpload from '@/components/core/forms/MultiFileUpload.vue'
import contractIcon from '@/assets/img/crm/contract.png'
defineOptions({ name: 'CrmStockingAdd' }) // 定义组件名称,用于 KeepAlive 缓存控制
@@ -1010,7 +1070,7 @@
{ required: true, message: '请输入二手挂牌价', trigger: 'blur' }
]
rules[`items.${idx}.unit_price`] = [
{ required: true, message: '请输入成交价', trigger: 'blur' }
{ required: true, message: '请输入收款价', trigger: 'blur' }
]
})
return rules
@@ -1039,7 +1099,9 @@
baseForm,
items,
paymentItems,
contractFile,
contractFiles,
piFiles,
waterBillFiles,
customerDialog,
vehicleDialog,
@@ -1058,8 +1120,6 @@
trade_termsOptions,
// 上传相关
actionImageUplode,
uploadHeaders,
// 方法
initializeForm,
@@ -1069,12 +1129,8 @@
validateContractRate,
wrapMoney,
calcProfit,
handleUserEdit,
// 合同文件方法
isImageFile,
beforeContractUpload,
handleContractUpload,
removeContractFile,
// 订单项方法
copyRow,
@@ -1084,6 +1140,7 @@
// 收款项方法
addPaymentItem,
removePaymentItem,
copyPaymentItem,
// 客户选择方法
openCustomerDialog,
@@ -1261,6 +1318,7 @@
word-break: break-all;
padding: 0 8px;
}
:deep(.el-input__suffix .el-select .el-select__wrapper) {
box-shadow: none;
padding: 0px;
+119 -57
View File
@@ -189,7 +189,7 @@
<ElInput v-model="item.color_interior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="改装" label-width="85px">
<el-select
v-model="item.modify_ids"
@@ -211,7 +211,7 @@
/>
</el-select>
</ElFormItem>
</ElCol>
</ElCol> -->
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="里程" label-width="85px">
<ElInput v-model="item.mileage" placeholder="请输入里程" />
@@ -287,6 +287,23 @@
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="收款价" label-width="85px" :prop="'items.' + idx + '.unit_price'" required>
<ElInput v-model="item.unit_price" placeholder="请输入收款价">
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
@@ -323,6 +340,23 @@
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="配件费" label-width="85px">
<ElInput v-model="item.accessory_price" placeholder="请输入配件费">
<template #suffix>
<ElSelect v-model="item.accessory_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.accessory_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="FOB段运费" label-width="85px">
<ElInput v-model="item.fob_transport_fee" placeholder="请输入FOB段运费">
@@ -391,6 +425,23 @@
<ElInput v-model="item.commission_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="挂账" label-width="85px">
<ElInput v-model="item.retention_price" placeholder="请输入挂账">
<template #suffix>
<ElSelect v-model="item.retention_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.retention_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="购置税" label-width="85px">
<ElInput v-model="item.purchase_tax" placeholder="请输入购置税">
@@ -410,24 +461,13 @@
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="预估退税额" label-width="85px">
<ElInput v-model="item.tax_refund" placeholder="请输入预估退税额">
<!-- <template #suffix>
<ElSelect v-model="item.tax_refund_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template> -->
<ElInput
v-model="item.tax_refund"
placeholder="正在计算预估退税额"
@input="handleUserEdit(idx)"
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
<ElInput v-model="item.tax_refund_currency_snapshot" type="hidden" />
@@ -436,10 +476,14 @@
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="成交价" label-width="85px" :prop="'items.' + idx + '.unit_price'" required>
<ElInput v-model="item.unit_price" placeholder="请输入成交价">
<ElFormItem label="车价" label-width="85px">
<ElInput
v-model="item.car_price"
placeholder="正在计算车价"
@input="handleUserEdit(idx)"
>
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElSelect v-model="item.car_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -449,7 +493,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
<ElInput v-model="item.car_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="4">
@@ -478,12 +522,7 @@
disabled
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
</ElFormItem>
@@ -526,9 +565,9 @@
<ElRow :gutter="12">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="合计到岸价" label-width="105px">
<ElInput v-model.number="baseForm.total_cif" placeholder="请输入合计到岸价">
<ElInput v-model.number="baseForm.cif_total" placeholder="请输入合计到岸价">
<template #suffix>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 64px">
<ElSelect v-model="baseForm.cif_total_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -539,7 +578,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
<ElInput v-model="baseForm.cif_total_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -798,35 +837,52 @@
</div>
</div>
<!-- 上传合同 -->
<!-- 上传合同 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<el-upload
class="upload-box"
:action="actionImageUplode"
:headers="uploadHeaders"
:show-file-list="false"
:on-success="handleContractUpload"
:before-upload="beforeContractUpload"
<MultiFileUpload
v-model="contractFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
>
<div class="qrcode-upload-box">
<input type="hidden" v-model="baseForm.contract" />
<img v-if="!contractFile" class="avatar" src="@/assets/img/crm/contract.png" />
<div v-else class="file-preview">
<img v-if="isImageFile(contractFile)" :src="contractFile.url" class="preview-image" />
<div v-else class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
<span class="file-name">{{ contractFile.name }}</span>
</div>
<div class="file-actions">
<el-button type="text" size="small" @click.stop="removeContractFile">删除</el-button>
</div>
</div>
</div>
</el-upload>
@change="(files) => (baseForm.contract = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传PI -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传PI</span>
</div>
<MultiFileUpload
v-model="piFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.pi_doc = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传水单 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传水单</span>
</div>
<MultiFileUpload
v-model="waterBillFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.transaction_slip = files.map((f) => f.file_name))"
/>
</div>
<div class="form-card">
<!-- 底部信息 -->
@@ -960,6 +1016,8 @@
import { useUserStore } from '@/store/modules/user'
import { useStockingForm } from '@/composables/useStockingForm'
import { onMounted, ref, computed } from 'vue'
import MultiFileUpload from '@/components/core/forms/MultiFileUpload.vue'
import contractIcon from '@/assets/img/crm/contract.png'
defineOptions({ name: 'CrmStockingFinalAdd' }) // 定义组件名称,用于 KeepAlive 缓存控制
@@ -1000,7 +1058,7 @@
{ required: true, message: '请输入二手挂牌价', trigger: 'blur' }
]
rules[`items.${idx}.unit_price`] = [
{ required: true, message: '请输入成交价', trigger: 'blur' }
{ required: true, message: '请输入收款价', trigger: 'blur' }
]
})
return rules
@@ -1029,7 +1087,9 @@
baseForm,
items,
paymentItems,
contractFile,
contractFiles,
piFiles,
waterBillFiles,
customerDialog,
vehicleDialog,
// 选项数据
@@ -1056,6 +1116,7 @@
beforeContractUpload,
handleContractUpload,
removeContractFile,
handleUserEdit,
// // 订单项方法
// copyRow,
// addRowAfter,
@@ -1209,6 +1270,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}
.preview-image {
+52 -30
View File
@@ -515,11 +515,11 @@
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="成交价" label-width="95px" :prop="'items.' + idx + '.unit_price'" required>
<ElFormItem label="收款价" label-width="95px" :prop="'items.' + idx + '.unit_price'" required>
<ElInput
:disabled="item._echo_vin === true"
v-model="item.unit_price"
placeholder="请输入成交价"
placeholder="请输入收款价"
>
<template #suffix>
<ElSelect
@@ -622,9 +622,9 @@
<ElRow :gutter="12">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="合计到岸价" label-width="105px">
<ElInput v-model.number="baseForm.total_cif" placeholder="请输入合计到岸价">
<ElInput v-model.number="baseForm.cif_total" placeholder="请输入合计到岸价">
<template #suffix>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 64px">
<ElSelect v-model="baseForm.cif_total_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -634,7 +634,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
<ElInput v-model="baseForm.cif_total_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -898,30 +898,46 @@
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<el-upload
class="upload-box"
:action="actionImageUplode"
:headers="uploadHeaders"
:show-file-list="false"
:on-success="handleContractUpload"
:before-upload="beforeContractUpload"
<MultiFileUpload
v-model="contractFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
>
<div class="qrcode-upload-box">
<input type="hidden" v-model="baseForm.contract"/>
<img v-if="!contractFile" class="avatar" src="@/assets/img/crm/contract.png" />
<div v-else class="file-preview">
<img v-if="isImageFile(contractFile)" :src="contractFile.url" class="preview-image" />
<div v-else class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
<span class="file-name">{{ contractFile.name }}</span>
</div>
<div class="file-actions">
<el-button type="text" size="small" @click.stop="removeContractFile">删除</el-button>
</div>
</div>
</div>
</el-upload>
@change="(files) => (baseForm.contract = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传PI -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传PI</span>
</div>
<MultiFileUpload
v-model="piFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.pi_doc = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传水单 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传水单</span>
</div>
<MultiFileUpload
v-model="waterBillFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.transaction_slip = files.map((f) => f.file_name))"
/>
</div>
<div class="form-card">
<!-- 底部信息 -->
@@ -1047,6 +1063,8 @@
import { useUserStore } from '@/store/modules/user'
import { useStockingForm } from '@/composables/useStockingForm'
import { onMounted, ref, computed } from 'vue'
import MultiFileUpload from '@/components/core/forms/MultiFileUpload.vue'
import contractIcon from '@/assets/img/crm/contract.png'
defineOptions({ name: 'CrmStockingEdit' })
const route = useRoute()
const stocking_id = route.query.id
@@ -1083,7 +1101,7 @@
{ required: true, message: '请输入二手挂牌价', trigger: 'blur' }
]
rules[`items.${idx}.unit_price`] = [
{ required: true, message: '请输入成交价', trigger: 'blur' }
{ required: true, message: '请输入收款价', trigger: 'blur' }
]
})
return rules
@@ -1112,7 +1130,9 @@
baseForm,
items,
paymentItems,
contractFile,
contractFiles,
piFiles,
waterBillFiles,
customerDialog,
vehicleDialog,
// 选项数据
@@ -1141,6 +1161,7 @@
validateContractRate,
wrapMoney,
calcProfit,
handleUserEdit,
// 合同文件方法
isImageFile,
@@ -1306,6 +1327,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}
.preview-image {
+138 -161
View File
@@ -101,44 +101,19 @@
:close-on-click-modal="false"
>
<OrderDetailContent :orderData="orderDialog.orderData" />
<!-- 合同文件 -->
<div class="boxshadow">
<div class="form-title">
<!-- <span class="border"></span> -->
<span class="title">合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<template #footer>
<div style="display: flex; justify-content: flex-end; gap: 8px">
@@ -156,7 +131,7 @@
>
<div style="max-height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px">
<el-button @click="download">下载</el-button>
<el-button @click="download" v-if="isFinites">下载</el-button>
</div>
<div
v-if="pdf.images.length"
@@ -202,7 +177,9 @@
import type { OrderData } from '@/composables/useOrderDetailDialog'
import ApprovalTimeline from '@/components/custom/ApprovalTimeline.vue'
import { manageService } from '@/api/adminApi'
import FilePreview from '@/components/custom/FilePreview.vue'
const timelineDialogVisible = ref(false)
const isFinites = ref(false)
const approvalRecords = ref<any[]>([])
defineOptions({ name: 'CrmFinalList' })
// 订单详情弹窗
@@ -304,6 +281,11 @@
usePdfPreview()
//打印
const printfn = (row: any) => {
if (row.approval_status == 2) {
isFinites.value = true
} else {
isFinites.value = false
}
CrmService.printStock({ id: row.id })
.then((res) => {
openWithResponse(res)
@@ -316,16 +298,46 @@
console.log(err)
})
}
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
const handleView1 = async (row: any) => {
const res = await CrmService.checkStock({ id: row.id })
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
if (res) {
// 获取订单详情成功
const orderData: OrderData = res
@@ -333,122 +345,6 @@
orderDialog.title = '合塑实业-汽车事业部-备货单(客户下定)'
orderDialog.visible = true
}
// router.push({
// path: '/crmpc/stocking/final_show',
// query: { id: row.object_id } // 可带客户名等参数
// })
// router.push('/crmpc/stocking/final_show')
// TODO: 跳转或弹窗查看备货单
}
// const handleView1 = (row: any) => {
// router.push({
// path: '/crmpc/stocking/final_show',
// query: { id: row.id } // 可带客户名等参数
// })
// // TODO: 跳转或弹窗查看备货单
// }
// 判断是否为图片文件
const isImageFile = (file: { name: string; url: string; file_name: string }) => {
// 检查文件名
if (file.name && /\.(jpg|jpeg|png|gif|webp)$/i.test(file.name)) {
return true
}
// 检查file_name字段
if (file.file_name && file.file_name.startsWith('image/')) {
return true
}
// 检查URL中的文件扩展名(去除查询参数)
if (file.url) {
const urlWithoutParams = file.url.split('?')[0] // 移除查询参数
if (/\.(jpg|jpeg|png|gif|webp)$/i.test(urlWithoutParams)) {
return true
}
}
return false
}
// 预览图片
const previewImage = (file: { name: string; url: string; file_name: string }) => {
// 创建图片预览弹窗
const imagePreview = document.createElement('div')
imagePreview.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
cursor: pointer;
`
const image = document.createElement('img')
image.src = file.url
image.alt = file.name
image.style.cssText = `
max-width: 90%;
max-height: 90%;
object-fit: contain;
border-radius: 4px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
`
const closeBtn = document.createElement('div')
closeBtn.innerHTML = '×'
closeBtn.style.cssText = `
position: absolute;
top: 20px;
right: 30px;
color: white;
font-size: 30px;
cursor: pointer;
z-index: 10000;
`
imagePreview.appendChild(image)
imagePreview.appendChild(closeBtn)
document.body.appendChild(imagePreview)
// 点击关闭
const closePreview = () => {
document.body.removeChild(imagePreview)
}
imagePreview.addEventListener('click', closePreview)
closeBtn.addEventListener('click', (e) => {
e.stopPropagation()
closePreview()
})
// ESC键关闭
const handleKeydown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
closePreview()
document.removeEventListener('keydown', handleKeydown)
}
}
document.addEventListener('keydown', handleKeydown)
}
// 下载文件
const downloadFile = (file: { name: string; url: string; file_name: string }) => {
try {
const link = document.createElement('a')
link.href = file.url
link.download = file.name
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch (error) {
console.error('下载失败:', error)
ElMessage.error('下载失败,请稍后重试')
}
}
</script>
@@ -509,4 +405,85 @@
font-size: 48px;
color: #ddd;
}
.files-list {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.file-item {
flex: 0 0 auto;
min-width: 200px;
max-width: 300px;
}
.file-preview {
position: relative;
width: 100%;
max-height: 120px;
border: 1px solid #e4e7ed;
border-radius: 6px;
overflow: hidden;
background: #fafafa;
padding: 10px;
}
.image-preview {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.preview-image {
flex: 1;
max-height: 80px;
object-fit: cover;
cursor: pointer;
transition: transform 0.2s;
}
.preview-image:hover {
transform: scale(1.05);
}
.document-preview {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.file-icon {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.file-icon i {
font-size: 48px;
color: #409eff;
}
.file-info {
padding: 8px;
background: rgba(255, 255, 255, 0.9);
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.file-name {
font-size: 12px;
color: #606266;
text-align: center;
word-break: break-all;
max-width: 100%;
}
</style>
+6 -6
View File
@@ -177,8 +177,8 @@
<ElRow :gutter="12">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
<ElInput v-model="base.cif_total" disabled>
<template #append>{{ base.cif_total_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
@@ -338,8 +338,8 @@
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
cif_total: '',
cif_total_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
@@ -440,8 +440,8 @@
)
ship.latest_arrival = res?.latest_arrival_date || ''
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.cif_total = res?.cif_total_amount?.amount ?? ''
base.cif_total_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
// 计划收款(全部展示)
payments.value = (Array.isArray(res?.account_list) ? res.account_list : []).map((p: any) => ({
+6 -6
View File
@@ -172,8 +172,8 @@
<ElRow :gutter="12">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
<ElInput v-model="base.cif_total" disabled>
<template #append>{{ base.cif_total_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
@@ -333,8 +333,8 @@
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
cif_total: '',
cif_total_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
@@ -427,8 +427,8 @@
)
ship.latest_arrival = res?.latest_arrival_date || ''
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.cif_total = res?.cif_total_amount?.amount ?? ''
base.cif_total_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
// 计划收款(全部展示)
payments.value = (Array.isArray(res?.account_list) ? res.account_list : []).map((p: any) => ({
+123 -61
View File
@@ -188,7 +188,7 @@
<ElInput v-model="item.color_interior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="改装" label-width="95px">
<el-select
v-model="item.modify_ids"
@@ -210,7 +210,7 @@
/>
</el-select>
</ElFormItem>
</ElCol>
</ElCol> -->
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="里程" label-width="95px">
<ElInput v-model="item.mileage" placeholder="请输入里程" />
@@ -286,6 +286,23 @@
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="收款价" label-width="95px" :prop="'items.' + idx + '.unit_price'" required>
<ElInput v-model="item.unit_price" placeholder="请输入收款价">
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -322,6 +339,23 @@
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="配件费" label-width="85px">
<ElInput v-model="item.accessory_price" placeholder="请输入配件费">
<template #suffix>
<ElSelect v-model="item.accessory_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.accessory_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="FOB段运费" label-width="95px">
<ElInput v-model="item.fob_transport_fee" placeholder="请输入FOB段运费">
@@ -390,6 +424,23 @@
<ElInput v-model="item.commission_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="挂账" label-width="85px">
<ElInput v-model="item.retention_price" placeholder="请输入挂账">
<template #suffix>
<ElSelect v-model="item.retention_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.retention_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="购置税" label-width="95px">
<ElInput v-model="item.purchase_tax" placeholder="请输入购置税">
@@ -408,25 +459,14 @@
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="预估退税额" label-width="95px">
<ElInput v-model="item.tax_refund" placeholder="请输入预估退税额">
<!-- <template #suffix>
<ElSelect v-model="item.tax_refund_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
:label="c.currency_name"
:value="c.currency_code"
/>
</ElSelect>
</template> -->
<ElFormItem label="预估退税额" label-width="85px">
<ElInput
v-model="item.tax_refund"
placeholder="正在计算预估退税额"
@input="handleUserEdit(idx)"
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
<ElInput v-model="item.tax_refund_currency_snapshot" type="hidden" />
@@ -434,11 +474,15 @@
</ElCol>
</ElRow>
<ElRow :gutter="12" class="item-row-wrap">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="成交价" label-width="95px" :prop="'items.' + idx + '.unit_price'" required>
<ElInput v-model="item.unit_price" placeholder="请输入成交价">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="车价" label-width="85px">
<ElInput
v-model="item.car_price"
placeholder="正在计算车价"
@input="handleUserEdit(idx)"
>
<template #suffix>
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElSelect v-model="item.car_price_currency" style="width: 74px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -448,7 +492,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
<ElInput v-model="item.car_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<!-- <ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -477,13 +521,7 @@
disabled
>
<template #suffix>
<span style="font-size: 11px">
{{
((currencyOptions || []).find((c: any) => c.currency_code === baseForm.settlement_currency)
?.currency_name) ||
baseForm.settlement_currency
}}
</span>
<span style="font-size: 11px">人民币</span>
</template>
</ElInput>
</ElFormItem>
@@ -543,9 +581,9 @@
<ElRow :gutter="12">
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
<ElFormItem label="合计到岸价" label-width="105px">
<ElInput v-model.number="baseForm.total_cif" placeholder="请输入合计到岸价">
<ElInput v-model.number="baseForm.cif_total" placeholder="请输入合计到岸价">
<template #suffix>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 64px">
<ElSelect v-model="baseForm.cif_total_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -555,7 +593,7 @@
</ElSelect>
</template>
</ElInput>
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
<ElInput v-model="baseForm.cif_total_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
@@ -792,8 +830,9 @@
</ElRow>
<ElRow :gutter="12">
<ElCol :span="24" style="text-align: right;">
<ElButton type="success" size="small" @click="copyPaymentItem(idx)">复制</ElButton>
<ElButton type="primary" size="small" @click="addPaymentItem" v-if="idx === paymentItems.length - 1">添加</ElButton>
<ElButton type="danger" size="small" @click="removePaymentItem(idx)" :disabled="paymentItems.length === 1">删除</ElButton>
<ElButton type="primary" size="small" @click="addPaymentItem" v-if="idx === paymentItems.length - 1">添加收款信息</ElButton>
</ElCol>
</ElRow>
</ElForm>
@@ -807,30 +846,46 @@
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<el-upload
class="upload-box"
:action="actionImageUplode"
:headers="uploadHeaders"
:show-file-list="false"
:on-success="handleContractUpload"
:before-upload="beforeContractUpload"
<MultiFileUpload
v-model="contractFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
>
<div class="qrcode-upload-box">
<input type="hidden" v-model="baseForm.contract"/>
<img v-if="!contractFile" class="avatar" src="@/assets/img/crm/contract.png" />
<div v-else class="file-preview">
<img v-if="isImageFile(contractFile)" :src="contractFile.url" class="preview-image" />
<div v-else class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
<span class="file-name">{{ contractFile.name }}</span>
</div>
<div class="file-actions">
<el-button type="text" size="small" @click.stop="removeContractFile">删除</el-button>
</div>
</div>
</div>
</el-upload>
@change="(files) => (baseForm.contract = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传PI -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传PI</span>
</div>
<MultiFileUpload
v-model="piFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.pi_doc = files.map((f) => f.file_name))"
/>
</div>
<!-- 上传水单 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传水单</span>
</div>
<MultiFileUpload
v-model="waterBillFiles"
upload-text="点击上传"
hint-text="支持多文件上传"
:icon-src="contractIcon"
accept=".jpg,.jpeg,.png,.gif,.pdf,.doc,.docx,.xls,.xlsx,.txt"
@change="(files) => (baseForm.transaction_slip = files.map((f) => f.file_name))"
/>
</div>
<div class="form-card">
<!-- 底部信息 -->
@@ -964,6 +1019,8 @@
import { CrmService } from '@/api/crmApi'
import { useUserStore } from '@/store/modules/user'
import { useStockingForm } from '@/composables/useStockingForm'
import MultiFileUpload from '@/components/core/forms/MultiFileUpload.vue'
import contractIcon from '@/assets/img/crm/contract.png'
import { onMounted, ref, computed } from 'vue'
defineOptions({ name: 'CrmStockingEdit' })
const route = useRoute()
@@ -1004,7 +1061,7 @@
{ required: true, message: '请输入二手挂牌价', trigger: 'blur' }
]
rules[`items.${idx}.unit_price`] = [
{ required: true, message: '请输入成交价', trigger: 'blur' }
{ required: true, message: '请输入收款价', trigger: 'blur' }
]
})
return rules
@@ -1049,7 +1106,9 @@
baseForm,
items,
paymentItems,
contractFile,
contractFiles,
piFiles,
waterBillFiles,
customerDialog,
vehicleDialog,
// 选项数据
@@ -1078,6 +1137,7 @@
validateContractRate,
wrapMoney,
calcProfit,
handleUserEdit,
// 合同文件方法
isImageFile,
@@ -1091,6 +1151,7 @@
removeRow,
// 收款项方法
copyPaymentItem,
addPaymentItem,
removePaymentItem,
@@ -1211,6 +1272,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}
.preview-image {
+81 -189
View File
@@ -88,7 +88,7 @@
type="success"
underline="never"
@click="handleView(scope.row)"
style="margin-right: 8px"
style="margin-right: 8px;color: #333333;"
>
<i class="iconfont-sys">&#xe76c;</i> 查看
</el-link>
@@ -114,15 +114,15 @@
<i class="iconfont-sys">&#xe76c;</i> 查看终版
</el-link>
<el-link
type="warning"
type="danger"
underline="never"
@click="copys(scope.row)"
style="margin-right: 8px"
style="margin-right: 8px;color: #F04800;"
>
<i class="iconfont-sys">&#xe8b7;</i> 复制
</el-link>
<el-link
type="warning"
type="success"
underline="never"
@click="showDialogtimeline(scope.row)"
style="margin-right: 8px"
@@ -131,7 +131,7 @@
</el-link>
<el-link
v-if="scope.row.approval_status == 1"
type="primary"
type="danger"
underline="never"
@click="stockrecallfn(scope.row)"
style="margin-right: 8px"
@@ -173,7 +173,7 @@
>
<div style="max-height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px">
<el-button @click="download">下载</el-button>
<el-button @click="download" v-if="isFinites">下载</el-button>
</div>
<div
v-if="pdf.images.length"
@@ -203,44 +203,19 @@
:close-on-click-modal="false"
>
<OrderDetailContent :orderData="orderDialog.orderData" />
<!-- 合同文件 -->
<div class="boxshadow">
<div class="form-title">
<!-- <span class="border"></span> -->
<span class="title">合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<template #footer>
<div style="display: flex; justify-content: flex-end; gap: 8px">
@@ -268,13 +243,16 @@
<script setup lang="ts">
import { router } from '@/router'
import { CrmService } from '@/api/crmApi'
import { usePdfPreview } from '@/composables/usePdfPreview'
import { ElMessage } from 'element-plus'
import OrderDetailContent from '@/components/custom/OrderDetailContent.vue'
import type { OrderData } from '@/composables/useOrderDetailDialog'
import ApprovalTimeline from '@/components/custom/ApprovalTimeline.vue'
import FilePreview from '@/components/custom/FilePreview.vue'
import { usePdfPreview } from '@/composables/usePdfPreview'
import { manageService } from '@/api/adminApi'
const timelineDialogVisible = ref(false)
const approvalRecords = ref<any[]>([])
const isFinites = ref(false)
// import { useAuth } from '@/composables/useAuth'
// const { hasAuth } = useAuth()
@@ -286,10 +264,6 @@
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
// PDF 预览/打印(公共)
const { pdf, frameRef, openWithResponse, download, preparePreview, prepareImages } =
usePdfPreview()
// 订单详情弹窗
const orderDialog = reactive({
visible: false,
@@ -370,13 +344,29 @@
try {
// 获取订单详情数据
const res = await CrmService.checkStock({ id: row.id })
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
if (res) {
// 转换数据格式以适配 OrderDetailDialog
const orderData: OrderData = res
@@ -390,16 +380,39 @@
ElMessage.error('获取订单详情失败')
}
}
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
const handleView1 = async (row: any) => {
const res = await CrmService.checkStock({ id: row.object_id })
// 处理合同文件
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
contractFiles.value = processFiles(res.contract, '合同')
}
// 处理PI文件
if (res?.pi_doc) {
piFiles.value = processFiles(res.pi_doc, 'PI')
}
// 处理水单文件
if (res?.transaction_slip) {
waterBillFiles.value = processFiles(res.transaction_slip, '水单')
}
if (res) {
// 获取订单详情成功
const orderData: OrderData = res
@@ -407,12 +420,6 @@
orderDialog.title = '合塑实业-汽车事业部-备货单(客户下定)'
orderDialog.visible = true
}
// router.push({
// path: '/crmpc/stocking/final_show',
// query: { id: row.object_id } // 可带客户名等参数
// })
// router.push('/crmpc/stocking/final_show')
// TODO: 跳转或弹窗查看备货单
}
const handleCreateRepair = (row: any) => {
router.push({
@@ -437,8 +444,16 @@
console.log(err)
})
}
// PDF 预览/打印(公共)
const { pdf, frameRef, openWithResponse, download, preparePreview, prepareImages } =
usePdfPreview()
//打印
const printfn = (row: any) => {
if (row.approval_status == 2) {
isFinites.value = true
} else {
isFinites.value = false
}
CrmService.printStock({ id: row.id })
.then((res) => {
openWithResponse(res)
@@ -450,116 +465,6 @@
.catch((err) => {
console.log(err)
})
}
// 判断是否为图片文件
const isImageFile = (file: { name: string; url: string; file_name: string }) => {
// 检查文件名
if (file.name && /\.(jpg|jpeg|png|gif|webp)$/i.test(file.name)) {
return true
}
// 检查file_name字段
if (file.file_name && file.file_name.startsWith('image/')) {
return true
}
// 检查URL中的文件扩展名(去除查询参数)
if (file.url) {
const urlWithoutParams = file.url.split('?')[0] // 移除查询参数
if (/\.(jpg|jpeg|png|gif|webp)$/i.test(urlWithoutParams)) {
return true
}
}
return false
}
// 预览图片
const previewImage = (file: { name: string; url: string; file_name: string }) => {
// 创建图片预览弹窗
const imagePreview = document.createElement('div')
imagePreview.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
cursor: pointer;
`
const image = document.createElement('img')
image.src = file.url
image.alt = file.name
image.style.cssText = `
max-width: 90%;
max-height: 90%;
object-fit: contain;
border-radius: 4px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
`
const closeBtn = document.createElement('div')
closeBtn.innerHTML = '×'
closeBtn.style.cssText = `
position: absolute;
top: 20px;
right: 30px;
color: white;
font-size: 30px;
cursor: pointer;
z-index: 10000;
`
imagePreview.appendChild(image)
imagePreview.appendChild(closeBtn)
document.body.appendChild(imagePreview)
// 点击关闭
const closePreview = () => {
document.body.removeChild(imagePreview)
}
imagePreview.addEventListener('click', closePreview)
closeBtn.addEventListener('click', (e) => {
e.stopPropagation()
closePreview()
})
// ESC键关闭
const handleKeydown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
closePreview()
document.removeEventListener('keydown', handleKeydown)
}
}
document.addEventListener('keydown', handleKeydown)
}
// 下载文件
const downloadFile = (file: { name: string; url: string; file_name: string }) => {
try {
const link = document.createElement('a')
link.href = file.url
link.download = file.name
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
} catch (error) {
console.error('下载失败:', error)
ElMessage.error('下载失败,请稍后重试')
}
}
// 订单详情打印
const handleOrderPrint = (data: OrderData) => {
console.log('打印订单详情:', data)
// 可以在这里添加具体的打印逻辑
window.print()
}
//复制订单
const copys = (row: any) => {
@@ -684,17 +589,4 @@
color: #ff0000;
font-weight: bold;
}
.no-file {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: #999;
font-size: 14px;
}
.no-file i {
font-size: 48px;
color: #ddd;
}
</style>