备货单 审核功能

This commit is contained in:
浅念
2025-09-09 20:53:30 +08:00
parent 079d9babb8
commit 9052bd1027
37 changed files with 4712 additions and 3791 deletions
+17
View File
@@ -14,6 +14,7 @@
import { checkStorageCompatibility } from './utils/storage'
import { mittBus } from '@/utils/sys'
import appLogo from '@/assets/img/common/logox.png'
const router = useRouter()
const userStore = useUserStore()
const { language, accessToken } = storeToRefs(userStore)
@@ -178,6 +179,22 @@
if (userStore.isLogin) {
try {
const data = await UserService.getUserInfo()
const { systemsid } = useUserStore()
// 排除移动端电子签名页,不做签名校验
const currentPath = router.currentRoute.value?.path || ''
const isOnMobileSignature = currentPath.startsWith('/auth/signature/mobile')
if (!isOnMobileSignature && (data.user.sign_img == null || data.user.sign_img == '')) {
ElMessageBox.alert('请前往个人中心完成签名操作!', '提醒', {
confirmButtonText: '确定',
callback: () => {
if (systemsid == '1') {
router.push('/admin/user/user_info')
} else {
router.push('/system/user-center')
}
}
})
}
userStore.setUserInfo(data)
} catch (error) {
console.error('获取用户信息失败', error)
+50
View File
@@ -242,4 +242,54 @@ export class manageService {
params
})
}
//审批记录
static stockapprovalrecord(params: any) {
return request.get<any>({
url: '/admin/approval/records/list',
params
})
}
//审批通过/拒绝
static stockapprovalpass(params: any) {
return request.post<Api.Common.AddResponse>({
url: '/admin/approval/records/action',
params
})
}
//审批记录
static stockapprovallogs(params: any) {
return request.get<any>({
url: '/admin/approval/records/logs',
params
})
}
//备货单
static getStockList(params: Api.Common.PaginatingParams) {
return request.get<Api.Common.CommonListData>({
url: '/admin/stock/order/list',
params
})
}
//添加备货单
static addStock(params: any) {
return request.post<Api.Work.AddResponse>({
url: '/admin/stock/order/store',
params
// showErrorMessage: false // 不显示错误消息
})
}
//详情备货单
static getStockDetail(params: any) {
return request.get<any>({
url: '/admin/stock/order/show',
params
})
}
//打印
static printStock(params: any) {
return request.get<any>({
url: '/admin/stock/order/print',
params
})
}
}
+14
View File
@@ -88,6 +88,13 @@ export class commonService {
params
})
}
//字典项下拉框
static getDictItemSelect(params: any) {
return request.get<any>({
url: '/common/preset/dictItem',
params
})
}
//字典分类下拉框
static getDictTypeSelect() {
return request.get<any>({
@@ -118,4 +125,11 @@ export class commonService {
url: '/common/preset/users'
})
}
//签名 编辑
static signatureEdit(params: any) {
return request.post<any>({
url: '/admin/user/update/sign',
params
})
}
}
+22
View File
@@ -236,4 +236,26 @@ export class CrmService {
params
})
}
//审批记录
static stockapprovalrecord(params: any) {
return request.get<any>({
url: '/crm/approval/records/list',
params
})
}
//审批通过/拒绝
static stockapprovalpass(params: any) {
return request.post<Api.Common.AddResponse>({
url: '/crm/approval/records/action',
params
})
}
//审批记录
static stockapprovallogs(params: any) {
return request.get<any>({
url: '/crm/approval/records/logs',
params
})
}
}
+67 -8
View File
@@ -1,19 +1,42 @@
import { ref, reactive } from 'vue'
export const usePdfPreview = () => {
const state = reactive({ visible: false, url: '', name: '', blobUrl: '' })
const state = reactive({
visible: false,
url: '',
name: '',
blobUrl: '',
images: [] as string[]
})
const frameRef = ref<HTMLIFrameElement | null>(null)
// 动态加载 pdf.js(优先本地依赖,失败回退 CDN)
const loadPdfJs = async (): Promise<any> => {
// 统一使用 CDN,避免本地依赖缺失导致打包时报错
const ensure = (src: string) =>
new Promise<void>((resolve, reject) => {
const s = document.createElement('script')
s.src = src
s.onload = () => resolve()
s.onerror = () => reject(new Error('load script failed'))
document.head.appendChild(s)
})
await ensure('https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js')
await ensure('https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js')
return (window as any).pdfjsLib
}
const open = (url: string, name = '') => {
if (!url) return
state.url = url
state.name = name
state.visible = true
state.images = []
}
const openWithResponse = (res: any) => {
const url = res?.data?.file_url || res?.file_url
const name = res?.data?.file_name || res?.file_name || ''
const url = res?.data?.file_url_full || res?.file_url_full
const name = res?.data?.file_url || res?.file_url || ''
open(url, name)
}
@@ -32,7 +55,7 @@ export const usePdfPreview = () => {
if (!state.url) return
const filename = state.name || inferFilenameFromUrl(state.url)
try {
const resp = await fetch(state.url, { credentials: 'include' })
const resp = await fetch(state.url, { credentials: 'omit' })
const blob = await resp.blob()
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
@@ -42,7 +65,7 @@ export const usePdfPreview = () => {
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
} catch (err) {
} catch {
window.open(state.url, '_blank')
}
}
@@ -51,15 +74,42 @@ export const usePdfPreview = () => {
const preparePreview = async () => {
if (!state.url) return
try {
const resp = await fetch(state.url, { credentials: 'include' })
const resp = await fetch(state.url, { credentials: 'omit' })
const blob = await resp.blob()
state.blobUrl && window.URL.revokeObjectURL(state.blobUrl)
state.blobUrl = window.URL.createObjectURL(blob)
} catch (e) {
} catch {
state.blobUrl = ''
}
}
// 生成图片以便无需浏览器 PDF 插件即可展示
const prepareImages = async () => {
if (!state.url) return
state.images = []
try {
const resp = await fetch(state.url, { credentials: 'omit' })
const arrayBuffer = await resp.arrayBuffer()
const pdfjsLib = await loadPdfJs()
const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise
const images: string[] = []
for (let p = 1; p <= pdf.numPages; p++) {
const page = await pdf.getPage(p)
const viewport = page.getViewport({ scale: 1.5 })
const canvas = document.createElement('canvas')
const context = canvas.getContext('2d')
if (!context) continue
canvas.width = viewport.width
canvas.height = viewport.height
await page.render({ canvasContext: context, viewport }).promise
images.push(canvas.toDataURL('image/png'))
}
state.images = images
} catch {
state.images = []
}
}
const print = () => {
const frame = frameRef.value
if (frame && frame.contentWindow) {
@@ -75,7 +125,16 @@ export const usePdfPreview = () => {
}
}
return { pdf: state, frameRef, open, openWithResponse, download, print, preparePreview }
return {
pdf: state,
frameRef,
open,
openWithResponse,
download,
print,
preparePreview,
prepareImages
}
}
+4 -4
View File
@@ -4,10 +4,10 @@ import { useUserStore } from '@/store/modules/user'
export function useUploadHeaders() {
const userStore = useUserStore()
const uploadHeaders = computed(() => ({
'Fdesk-Language': userStore.language,
'Fdesk-Corp-Abbr': userStore.companyabbr,
'Fdesk-System-Code': 'fdesk',
'Fdesk-Login-Type': userStore.loginType,
'Fdesk-Language': userStore.language || 'zh',
'Fdesk-Corp-Abbr': userStore.companyabbr || 'default',
'Fdesk-System-Code': userStore.systemsabbr || 'fdesk',
'Fdesk-Login-Type': userStore.loginType || 'upwd',
'Fdesk-Auth-Token': 'Bearer ' + userStore.accessToken
}))
return { uploadHeaders }
+51 -17
View File
@@ -59,27 +59,65 @@ async function handleRouteGuard(
// 设置系统主题
setSystemTheme(to)
// 处理登录状态
// 特殊处理电子签名页面 - 优先处理,避免登录检查
if (to.path === '/auth/signature/mobile') {
// 设置认证信息
if (to.query.accessToken || to.query.token) {
const token = (to.query.accessToken as string) || (to.query.token as string)
if (token) {
userStore.setToken(token)
userStore.setLoginStatus(true)
}
}
// 设置其他必要的参数到userStore
if (to.query.companyid && to.query.companyabbr) {
userStore.setCompany(to.query.companyid as string, to.query.companyabbr as string)
}
if (to.query.systemsid && to.query.systemsabbr) {
userStore.setSystems(to.query.systemsid as string, to.query.systemsabbr as string)
}
if (to.query.loginType) {
userStore.setLoginType(to.query.loginType as 'feishu' | 'upwd')
}
if (to.matched.length > 0) {
setWorktab(to)
setPageTitle(to)
next()
return
} else {
// 如果路由没有匹配,直接跳转到404
next(RoutesAlias.Exception404)
return
}
}
// 处理其他页面的登录状态(跳过电子签名页面)
if (to.path !== '/auth/signature/mobile') {
if (!(await handleLoginStatus(to, userStore, next))) {
return
}
}
// 处理动态路由注册
if (!isRouteRegistered.value && userStore.isLogin) {
// 处理动态路由注册(跳过电子签名页面)
if (to.path !== '/auth/signature/mobile' && !isRouteRegistered.value && userStore.isLogin) {
await handleDynamicRoutes(to, router, next)
return
}
// 处理已知的匹配路由
if (to.matched.length > 0) {
// 处理已知的匹配路由(跳过电子签名页面)
if (to.path !== '/auth/signature/mobile' && to.matched.length > 0) {
setWorktab(to)
setPageTitle(to)
next()
return
}
// 尝试刷新路由重新注册
if (userStore.isLogin) {
// 尝试刷新路由重新注册(跳过电子签名页面)
if (to.path !== '/auth/signature/mobile' && userStore.isLogin) {
isRouteRegistered.value = false
await handleDynamicRoutes(to, router, next)
return
@@ -97,6 +135,7 @@ async function handleLoginStatus(
userStore: ReturnType<typeof useUserStore>,
next: NavigationGuardNext
): Promise<boolean> {
// 检查其他页面的登录状态
if (!userStore.isLogin && to.path !== RoutesAlias.Login && !to.meta.noLogin) {
userStore.logOut()
next({
@@ -105,6 +144,7 @@ async function handleLoginStatus(
})
return false
}
return true
}
@@ -200,22 +240,17 @@ async function registerAndStoreMenu(
*/
function handleMenuError(error: unknown): void {
console.error('菜单处理失败:', error)
// 清理所有状态
const userStore = useUserStore()
const menuStore = useMenuStore()
const worktabStore = useWorktabStore()
// 清空菜单和工作台
menuStore.clearMenuList()
worktabStore.clearAll()
// 重置路由注册状态
isRouteRegistered.value = false
// 登出用户
userStore.logOut()
throw error instanceof Error ? error : new Error('获取菜单列表失败,请重新登录')
}
@@ -256,15 +291,16 @@ export function resetRouterState(router: Router): void {
const routesToRemove: string[] = []
router.getRoutes().forEach((route) => {
// 排除静态路由和登录页面
if (route.name &&
if (
route.name &&
route.name !== 'Login' &&
route.name !== 'Exception404' &&
route.name !== 'Exception500' &&
!route.path.startsWith('/exception/')) {
!route.path.startsWith('/exception/')
) {
routesToRemove.push(route.name as string)
}
})
// 移除动态路由
routesToRemove.forEach((routeName) => {
try {
@@ -273,11 +309,9 @@ export function resetRouterState(router: Router): void {
console.warn(`移除路由失败: ${routeName}`, error)
}
})
// 清空菜单数据
const menuStore = useMenuStore()
menuStore.clearMenuList()
// 清空工作台标签页
const worktabStore = useWorktabStore()
worktabStore.clearAll()
+37
View File
@@ -133,5 +133,42 @@ export const asyncRoutes: AppRouteRecord[] = [
title: '审批流程添加',
isHide: true
}
},
{
path: '/crmpc/approval/auth_detil',
name: 'approvalDetil',
component: 'crmpc/approval/auth_detil',
meta: {
title: '审核详情',
isHide: true
}
},
// 管理端备货单相关路由
{
path: '/admin/stock/stocking_list_admin',
name: 'AdminStockingList',
component: 'admin/stock/stocking_list_admin',
meta: {
title: '备货单列表',
isHide: true
}
},
{
path: '/admin/stock/show_admin',
name: 'AdminStockingShow',
component: 'admin/stock/show_admin',
meta: {
title: '备货单详情',
isHide: true
}
},
{
path: '/admin/stock/final_show_admin',
name: 'AdminStockingFinalShow',
component: 'admin/stock/final_show_admin',
meta: {
title: '最终备货单详情',
isHide: true
}
}
]
+11 -5
View File
@@ -130,15 +130,21 @@ function loadComponent(componentPath: string, routeName: string): () => Promise<
}
// 构建可能的路径
const fullPath = `../../views${componentPath}.vue`
const fullPathWithIndex = `../../views${componentPath}/index.vue`
const fullPathNoSlash = `../../views${componentPath}.vue`
const fullPathWithIndexNoSlash = `../../views${componentPath}/index.vue`
const fullPathWithSlash = `../../views/${componentPath}.vue`
const fullPathWithIndexSlash = `../../views/${componentPath}/index.vue`
// 先尝试直接路径,再尝试添加/index的路径
const module = modules[fullPath] || modules[fullPathWithIndex]
// 依次尝试四种可能路径(兼容是否带斜杠的情况)
const module =
modules[fullPathNoSlash] ||
modules[fullPathWithIndexNoSlash] ||
modules[fullPathWithSlash] ||
modules[fullPathWithIndexSlash]
if (!module) {
console.error(
`[路由错误] 未找到组件:${routeName},尝试过的路径: ${fullPath} 和 ${fullPathWithIndex}`
`[路由错误] 未找到组件:${routeName},尝试过的路径: ${fullPathNoSlash}、${fullPathWithIndexNoSlash}、${fullPathWithSlash} 和 ${fullPathWithIndexSlash}`
)
return () =>
Promise.resolve({
+212
View File
@@ -0,0 +1,212 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { LanguageEnum } from '@/enums/appEnum'
import { router } from '@/router'
import { useSettingStore } from './setting'
import { useWorktabStore } from './worktab'
import { AppRouteRecord } from '@/types/router'
import { setPageTitle } from '@/router/utils/utils'
import { resetRouterState } from '@/router/guards/beforeEach'
import { RoutesAlias } from '@/router/routesAlias'
import { UserService } from '@/api/usersApi' // 新增导入
let refreshTimeout: ReturnType<typeof setTimeout> | null = null // 定时器变量
// 用户
export const useUserStore = defineStore(
'userStore',
() => {
const language = ref(LanguageEnum.ZH)
const isLogin = ref(false)
const isLock = ref(false)
const lockPassword = ref('')
const info = ref<Partial<Api.User.UserInfo>>({})
const searchHistory = ref<AppRouteRecord[]>([])
const accessToken = ref('')
const refreshToken = ref('')
const companyid = ref('')
const companyabbr = ref('')
const systemsid = ref('')
const systemsabbr = ref('')
const home_page = ref('')
const loginType = ref<'feishu' | 'upwd'>('upwd')
const tokenExpireAt = ref<number>(0)
const getUserInfo = computed(() => info.value)
const getSettingState = computed(() => useSettingStore().$state)
const getWorktabState = computed(() => useWorktabStore().$state)
const setUserInfo = (newInfo: Api.User.UserInfo) => {
info.value = newInfo
}
const setLoginStatus = (status: boolean) => {
isLogin.value = status
}
const setLanguage = (lang: LanguageEnum) => {
setPageTitle(router.currentRoute.value)
language.value = lang
}
const setLoginType = (type: 'feishu' | 'upwd') => {
loginType.value = type
}
const setSearchHistory = (list: AppRouteRecord[]) => {
searchHistory.value = list
}
const setLockStatus = (status: boolean) => {
isLock.value = status
}
const setLockPassword = (password: string) => {
lockPassword.value = password
}
const setToken = (newAccessToken: string, newRefreshToken?: string, expiresIn?: number) => {
accessToken.value = newAccessToken
if (newRefreshToken) {
refreshToken.value = newRefreshToken
}
if (expiresIn) {
const expireAt = Date.now() + expiresIn * 1000
tokenExpireAt.value = expireAt
localStorage.setItem('token_expire_at', String(expireAt))
// 检查是否需要重新设置定时器
const currentLeftSeconds = Math.floor((expireAt - Date.now()) / 1000)
if (currentLeftSeconds > 0) {
scheduleTokenRefresh(currentLeftSeconds)
}
}
}
const setCompany = (id: string, abbr: string) => {
companyid.value = id
companyabbr.value = abbr
}
const setSystems = (id: string, abbr: string) => {
systemsid.value = id
systemsabbr.value = abbr
}
// 设置首页
const sethome_page = (page: string) => {
home_page.value = page
}
function restoreTokenTimer() {
const expireAt = Number(localStorage.getItem('token_expire_at') || '0')
if (accessToken.value && expireAt > Date.now()) {
const leftSeconds = Math.floor((expireAt - Date.now()) / 1000)
scheduleTokenRefresh(leftSeconds)
}
}
let isScheduled = false
function scheduleTokenRefresh(expiresIn: number) {
if (refreshTimeout) {
clearTimeout(refreshTimeout)
refreshTimeout = null
}
// 提前1分钟刷新
const refreshTime = (expiresIn - 60) * 1000
if (refreshTime > 0) {
if (!isScheduled) {
isScheduled = true
refreshTimeout = setTimeout(() => {
refreshTokenAction().finally(() => {
isScheduled = false // 重置标志位
})
}, refreshTime)
} else {
console.log('scheduleTokenRefresh is already scheduled, skipping...')
}
} else {
console.error('Invalid refreshTime:', refreshTime)
}
}
async function refreshTokenAction() {
try {
const { data } = await UserService.refreshToken({ refresh_token: refreshToken.value })
// 动态计算剩余时间
const currentTime = Date.now()
const expireAt = currentTime + data.expires_in * 1000
const leftSeconds = Math.floor((expireAt - currentTime) / 1000)
setToken(data.access_token, data.refresh_token, leftSeconds)
} catch (e) {
console.error('Token refresh failed:', e)
logOut()
}
}
const logOut = () => {
// 清空所有本地缓存
localStorage.clear()
sessionStorage.clear()
systemsabbr.value = ''
systemsid.value = ''
companyabbr.value = ''
companyid.value = ''
home_page.value = ''
info.value = {}
isLogin.value = false
isLock.value = false
lockPassword.value = ''
accessToken.value = ''
refreshToken.value = ''
if (refreshTimeout) clearTimeout(refreshTimeout) // 清理定时器
// 清理工作台标签页
useWorktabStore().clearAll()
// 清理sessionStorage中的用户信息缓存
sessionStorage.removeItem('lastUserInfo')
sessionStorage.removeItem('iframeRoutes')
// 重置路由状态
resetRouterState(router)
// 跳转到登录页
router.push(RoutesAlias.Login)
}
return {
language,
isLogin,
isLock,
lockPassword,
info,
companyid,
companyabbr,
systemsid,
systemsabbr,
home_page,
searchHistory,
loginType,
accessToken,
refreshToken,
tokenExpireAt,
getUserInfo,
getSettingState,
getWorktabState,
setUserInfo,
setLoginStatus,
setLanguage,
setSearchHistory,
setLockStatus,
setLockPassword,
setToken,
setCompany,
setSystems,
setLoginType,
sethome_page,
logOut,
restoreTokenTimer
}
},
{
persist: {
key: 'user',
storage: localStorage,
afterRestore: (ctx: { store: { restoreTokenTimer: () => void } }) => {
ctx.store.restoreTokenTimer()
}
} as any
}
)
+2 -2
View File
@@ -98,10 +98,10 @@ class StorageCompatibilityManager {
}
/**
* 检查是否在登录页面
* 检查是否在登录页面或电子签名页面
*/
private isOnLoginPage(): boolean {
return location.href.includes(RoutesAlias.Login)
return location.href.includes(RoutesAlias.Login) || location.href.includes('/auth/signature/mobile')
}
/**
+5 -5
View File
@@ -34,17 +34,17 @@
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="名称" prop="name" min-width="120" />
<ElTableColumn label="标识" prop="type" width="120" />
<ElTableColumn label="状态" prop="status" width="100">
<ElTableColumn label="名称" prop="name" />
<ElTableColumn label="标识" prop="type" />
<ElTableColumn label="状态" prop="status">
<template #default="scope">
<ElTag :type="scope.row.is_active ? 'success' : 'info'">
{{ scope.row.is_active ? '启用' : '停用' }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="创建时间" prop="created_at" min-width="160" />
<ElTableColumn fixed="right" label="操作" width="200px">
<ElTableColumn label="创建时间" prop="created_at" />
<ElTableColumn fixed="right" label="操作" width="140px">
<template #default="scope">
<ElRow>
<el-button link @click="showDialog('edit', scope.row)">编辑</el-button>
+672
View File
@@ -0,0 +1,672 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<!-- <div class="toolbar-left">
<ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton>
</div> -->
<div class="toolbar-right">
<el-input
v-model="keyword"
placeholder="请输入客户名称"
clearable
style="width: 260px"
@keyup.enter="getList"
>
<template #suffix>
<el-icon class="clickable" @click="getList"><Search /></el-icon>
</template>
</el-input>
</div>
</div>
<div class="boxshadow">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="审批单名称" prop="flows_name" min-width="140" />
<ElTableColumn label="审批说明" prop="biz_desc" min-width="160" />
<ElTableColumn label="审批结果" prop="action_desc" min-width="160" />
<ElTableColumn label="提交人" prop="initiator_name" min-width="120" />
<ElTableColumn label="审核人" prop="approver_name" min-width="120" />
<ElTableColumn label="状态" prop="status_desc" min-width="120" />
<ElTableColumn label="审批时间" prop="approved_at" min-width="120" />
<ElTableColumn label="创建时间" prop="created_at" min-width="120" />
<ElTableColumn label="操作" fixed="right" min-width="140" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-link
type="primary"
underline="never"
@click="handleView(scope.row)"
style="margin-right: 8px"
>
<i class="iconfont-sys">&#xe76c;</i> 查看审批
</el-link>
<el-link
v-if="scope.row.status == 'pending'"
type="success"
underline="never"
@click="handleCreateRepair(scope.row)"
>
<i class="iconfont-sys">&#xe6bf;</i> 快速审批
</el-link>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
<!-- 快速审批弹出框 -->
<el-dialog
v-model="approvalDialogVisible"
title="合塑实业-汽车事业部-备货单(客户下定)"
width="80%"
:close-on-click-modal="false"
:close-on-press-escape="false"
class="approval-dialog"
>
<div class="approval-content">
<!-- 头部信息 -->
<div class="header">
<div class="sub">
<span class="mr40">备货单编号:{{ header.order_no }}</span>
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<!-- 基础信息 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>基础信息</span>
</div>
<div class="form-grid">
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="阿里订单号/PN号">
<ElInput v-model="base.pn_no" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="日期">
<ElInput v-model="base.date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="清关目的国">
<ElInput v-model="base.close_date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="3">
<ElFormItem label="客户来源">
<ElInput v-model="base.channel" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户名称">
<ElInput v-model="base.customer_name" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户所在国">
<ElInput v-model="base.client_country" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<!-- 订单详情 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>订单详情</span>
</div>
<div class="items-wrap">
<div class="item-row" v-for="(item, idx) in items" :key="idx">
<ElRow :gutter="12">
<ElCol :span="8">
<ElFormItem label="车型" label-width="64px">
<ElInput v-model="item.model" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="颜色/外" label-width="72px">
<ElInput v-model="item.color_out" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="内饰" label-width="52px">
<ElInput v-model="item.color_in" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="改装" label-width="52px">
<ElInput v-model="item.modify" disabled />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="单价" label-width="52px">
<ElInput v-model="item.unit_price" disabled>
<template #append>{{ item.unit_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="总价" label-width="52px">
<ElInput v-model="item.total_price" disabled>
<template #append>{{ item.total_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="改装费" label-width="60px">
<ElInput v-model="item.modify_fee" disabled>
<template #append>{{ item.modify_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="FOB段运费" label-width="84px">
<ElInput v-model="item.fob_fee" disabled>
<template #append>{{ item.fob_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
<template #append>{{ item.helper_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="港杂费" label-width="60px">
<ElInput v-model="item.port_fee" disabled>
<template #append>{{ item.port_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
<template #append>{{ item.profit_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="车架号" label-width="70px">
<ElInput v-model.number="item.vin" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<!-- 审批备注 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>审批</span>
</div>
<ElRow :gutter="12">
<ElCol :span="12">
<ElFormItem label="审批操作:">
<el-select v-model="approvalAction" placeholder="请选择审批操作">
<el-option
v-for="item in getDictItemSelectlist"
:key="item.item_value"
:label="item.item_label"
:value="item.item_value"
/>
</el-select>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="备注:">
<el-input
v-model="approvalNotes"
type="textarea"
:rows="2"
placeholder="请输入备注信息"
class="approval-notes"
/>
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleReject" class="reject-btn">取消</el-button>
<el-button type="primary" @click="handleApprove" class="approve-btn">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { router } from '@/router'
import { manageService } from '@/api/adminApi'
import { useAuth } from '@/composables/useAuth'
import { CrmService } from '@/api/crmApi'
import { commonService } from '@/api/commonApi'
const { hasAuth } = useAuth()
const loading = ref(false)
const keyword = ref('')
const tableRef = ref()
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
// 审批弹出框相关
const approvalDialogVisible = ref(false)
const stockingInfo = ref<any>({})
// 回显视图模型,字段与模板一致
const header = reactive({ order_no: '', salesman: '' })
const base = reactive({
pn_no: '',
date: '',
close_date: '',
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
const approvalNotes = ref('')
const approvalAction = ref('')
onMounted(() => {
getList()
})
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
})
const getList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const params = {
current: currentPage,
size: pageSize,
is_final: 0, // 只获取备货单,非终版
keyword: keyword.value
}
const { records, current, size, total } = await manageService.stockapprovalrecord(params)
tableData.value = records || []
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取列表失败:', error)
} finally {
loading.value = false
}
}
const handleSizeChange = (size: number) => {
pagination.pageSize = size
getList()
}
const handleCurrentChange = (page: number) => {
pagination.currentPage = page
getList()
}
const handleCreate = () => {
// TODO: 跳转到创建备货单页面
router.push('/crmpc/stocking_list/Add')
}
const handleView = (row: any) => {
router.push({
path: '/admin/approval/stocking_auth_detil',
query: { id: row.id, biz_id: row.biz_id, instance_id: row.instance_id, status: row.status } // 可带客户名等参数
})
}
const handleView1 = (row: any) => {
router.push('/crmpc/stocking_list/final_show')
// TODO: 跳转或弹窗查看备货单
}
const toMoneyView = (m: any) => ({
amount: m?.amount ?? '',
currency: m?.currency ?? ''
})
const getDictItemSelectlist = ref<any[]>([])
const getDictItemSelect = async () => {
const res = await commonService.getDictItemSelect({ dict_id: '18' })
getDictItemSelectlist.value = res
}
const instance_id = ref('')
const handleCreateRepair = async (row: any) => {
getDictItemSelect()
instance_id.value = row.instance_id
const res = await CrmService.getStockDetail({ id: row.biz_id })
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
header.salesman =
res?.salesperson_snapshot || res?.salesman || res?.salesman_name || res?.user?.name || ''
// 基础信息
base.pn_no = res?.pi_no || ''
base.date = res?.biz_date || ''
base.close_date = res?.clearance_country_snapshot || ''
base.channel = res?.customer_source_snapshot || res?.customer_source || ''
base.customer_name = res?.customer_snapshot || res?.customer_name || ''
base.client_country = res?.customer_country_snapshot || res?.customer_country || ''
// 订单明细
const list = Array.isArray(res?.veh_list) ? res.veh_list : []
items.value = list.map((it: any) => {
const unit = toMoneyView(it?.unit_price)
const total = toMoneyView(it?.total_price)
const guide = toMoneyView(it?.official_price)
const discount = toMoneyView(it?.discount_price)
const listing = toMoneyView(it?.listing_price)
const reduction = toMoneyView(it?.reduction_price)
const helper = toMoneyView(it?.handling_fee)
const fob = toMoneyView(it?.fob_transport_fee)
const port = toMoneyView(it?.port_misc_fee)
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
vin: it?.vin || '',
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
modify: (Array.isArray(it?.modify_list) ? it.modify_list : [])
.map((m: any) => m?.option_name_snapshot)
.filter(Boolean)
.join('、'),
modify_fee: it?.retrofit_fee?.amount ?? '',
modify_fee_currency: it?.retrofit_fee?.currency ?? '',
fob_fee: fob.amount,
fob_fee_currency: fob.currency,
unit_price: unit.amount,
unit_price_currency: unit.currency,
total_price: total.amount,
total_price_currency: total.currency,
guide_price: guide.amount,
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: listing.amount,
listing_price_currency: listing.currency,
reduction_price: reduction.amount,
reduction_price_currency: reduction.currency,
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
domestic_freight_currency: it?.domestic_freight?.currency ?? '',
port_fee: port.amount,
port_fee_currency: port.currency,
profit: profit.amount,
profit_currency: profit.currency
}
})
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
approvalDialogVisible.value = true
}
// 审批操作
const handleApprove = async () => {
try {
// 这里调用审批API
const { message } = await manageService.stockapprovalpass({
instance_id: instance_id.value,
action: approvalAction.value,
comment: approvalNotes.value
})
ElMessage.success(message)
approvalDialogVisible.value = false
approvalNotes.value = ''
instance_id.value = ''
// 刷新列表
getList()
} catch (error) {
console.error('审批失败:', error)
ElMessage.error('审批失败')
}
}
const handleReject = async () => {
approvalDialogVisible.value = false
approvalNotes.value = ''
}
</script>
<style scoped lang="scss">
.stocking-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.stocking-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 12px 16px;
background: var(--art-main-bg-color);
}
.toolbar-left {
display: flex;
align-items: center;
gap: 8px;
}
.toolbar-right {
display: flex;
align-items: center;
}
.clickable {
cursor: pointer;
}
// 审批弹出框样式
.approval-dialog {
.approval-content {
max-height: 70vh;
overflow-y: auto;
}
.header {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 12px;
color: #333333;
.mr40 { margin-right: 40px; }
}
.info-section {
margin-bottom: 24px;
.section-title {
display: flex;
align-items: center;
margin-bottom: 16px;
.title-bar {
width: 4px;
height: 20px;
background: #409eff;
margin-right: 8px;
border-radius: 2px;
}
span {
font-size: 16px;
font-weight: 600;
color: #303133;
}
}
}
.order-items {
.order-item {
border: 1px solid #e4e7ed;
border-radius: 8px;
padding: 16px;
margin-bottom: 16px;
background: #fafafa;
.item-header {
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #e4e7ed;
.item-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
}
.item-details {
.detail-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 12px;
.detail-item {
display: flex;
flex-direction: column;
label {
margin-bottom: 6px;
font-size: 14px;
font-weight: 500;
color: #606266;
}
}
}
}
}
}
.summary-section {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
background: #f0f9ff;
border-radius: 8px;
margin-bottom: 24px;
.summary-item {
.summary-label {
font-weight: 600;
color: #606266;
margin-right: 8px;
}
.summary-value {
font-size: 18px;
font-weight: 700;
color: #409eff;
}
}
}
.approval-notes {
width: 100%;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
.reject-btn {
border-color: #409eff;
color: #409eff;
background: white;
&:hover {
background: #ecf5ff;
}
}
.approve-btn {
background: #409eff;
border-color: #409eff;
}
}
}
</style>
@@ -8,7 +8,7 @@
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<ElButton type="primary" plain>打印整单</ElButton>
<!-- <ElButton type="primary" plain @click="printCurrent">打印整单</ElButton> -->
</div>
<!-- 基础信息 -->
@@ -105,23 +105,6 @@
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
@@ -136,6 +119,46 @@
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
@@ -266,17 +289,127 @@
</div>
</div>
</div>
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">审批记录</span>
</div>
<div class="approval-timeline">
<div v-for="(rec, idx) in approvalRecords" :key="idx" class="timeline-item">
<div class="left">
<div class="avatar-box">
<span class="initial">{{ rec.name?.slice(0, 1) || '—' }}</span>
<i v-if="rec.approved" class="status-dot iconfont-sys">&#xe621;</i>
<i v-if="rec.rejected" class="status-dot rejected">&#xe83a;</i>
<i v-else-if="rec.pending" class="status-dot pending iconfont-sys">&#xe839;</i>
</div>
</div>
<div class="right">
<div class="row name-role">
<span class="name">{{ rec.name }}</span>
<span class="role">({{ rec.role || rec.type || '审批人' }})</span>
</div>
<div class="row time">{{ rec.time }}</div>
</div>
</div>
<div v-if="!approvalRecords.length" class="empty">暂无审批记录</div>
</div>
</div>
<div class="boxshadow" v-if="status == 'pending'">
<div class="form-title">
<span class="border"></span>
<span class="title">审批</span>
</div>
<div class="">
<ElRow :gutter="12">
<ElCol :span="12">
<ElFormItem label="审批操作:">
<el-select v-model="approvalAction" placeholder="请选择审批操作">
<el-option
v-for="item in getDictItemSelectlist"
:key="item.item_value"
:label="item.item_label"
:value="item.item_value"
/>
</el-select>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="备注:">
<el-input
v-model="approvalNotes"
type="textarea"
:rows="2"
placeholder="请输入备注信息"
class="approval-notes"
/>
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<div class="form-card" v-if="status == 'pending'">
<!-- 底部信息 -->
<div class="submit-wrap">
<ElButton type="primary" size="large" class="submit-btn" @click="handleSubmit"
>提交</ElButton
>
</div>
</div>
<!-- PDF 预览弹窗 -->
<el-dialog
v-model="pdf.visible"
title="打印预览"
width="80%"
top="40px"
:close-on-click-modal="false"
>
<div style="height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px">
<!-- <el-button type="primary" @click="print()">打印</el-button> -->
<el-button @click="download">下载</el-button>
</div>
<iframe
v-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex: 1; width: 100%; border: 1px solid #eee; border-radius: 6px"
/>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { CrmService } from '@/api/crmApi'
import { commonService } from '@/api/commonApi'
import { manageService } from '@/api/adminApi'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { usePdfPreview } from '@/composables/usePdfPreview'
import { router } from '@/router'
const { pdf, frameRef, download } = usePdfPreview()
const route = useRoute()
const stocking_id = route.query.id
// const approval_id = route.query.id
const stocking_id = route.query.biz_id
const instance_id = route.query.instance_id
const status = route.query.status
const stockingInfo = ref<any>({})
const approvalNotes = ref('')
const approvalAction = ref('')
const handleSubmit = async () => {
try {
const { message } = await manageService.stockapprovalpass({
instance_id: instance_id,
action: approvalAction.value,
comment: approvalNotes.value
})
router.push('/admin/approval/stocking_auth')
ElMessage.success(message)
} catch {
ElMessage.error('提交失败')
}
}
// 回显视图模型,字段与模板一致
const header = reactive({ order_no: '', salesman: '' })
const base = reactive({
@@ -300,6 +433,13 @@
latest_arrival: ''
})
const payments = ref<any[]>([])
// 审批记录(先填充假数据展示)
const approvalRecords = ref<any[]>([])
const getDictItemSelectlist = ref<any[]>([])
const getDictItemSelect = async () => {
const res = await commonService.getDictItemSelect({ dict_id: '18' })
getDictItemSelectlist.value = res
}
// 合同文件
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
@@ -315,7 +455,8 @@
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
header.salesman = res?.salesperson_snapshot || res?.salesman || res?.salesman_name || res?.user?.name || ''
header.salesman =
res?.salesperson_snapshot || res?.salesman || res?.salesman_name || res?.user?.name || ''
// 基础信息
base.pn_no = res?.pi_no || ''
base.date = res?.biz_date || ''
@@ -330,12 +471,15 @@
const total = toMoneyView(it?.total_price)
const guide = toMoneyView(it?.official_price)
const discount = toMoneyView(it?.discount_price)
const listing = toMoneyView(it?.listing_price)
const reduction = toMoneyView(it?.reduction_price)
const helper = toMoneyView(it?.handling_fee)
const fob = toMoneyView(it?.fob_transport_fee)
const port = toMoneyView(it?.port_misc_fee)
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
vin: it?.vin || '',
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
@@ -355,6 +499,10 @@
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: listing.amount,
listing_price_currency: listing.currency,
reduction_price: reduction.amount,
reduction_price_currency: reduction.currency,
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
@@ -370,7 +518,8 @@
ship.plan = res?.eta_ship_date || ''
ship.method = res?.shipping_method_snapshot || ''
ship.domestic_port = res?.domestic_port_snapshot || ''
ship.terms = `${res?.trade_term_snapshot || ''} / ${res?.clearance_port_snapshot || ''}`.replace(
ship.terms =
`${res?.trade_term_snapshot || ''} / ${res?.clearance_port_snapshot || ''}`.replace(
/^\s*\/\s*$/,
''
)
@@ -396,6 +545,20 @@
file_name: res.contract
}
}
// 审批记录(兼容多种字段)
const resstockapprovallogs = await manageService.stockapprovallogs({ instance_id: instance_id })
console.log(resstockapprovallogs)
const historyList = resstockapprovallogs
if (historyList.length > 0) {
approvalRecords.value = historyList.map((h: any) => ({
name: h?.initiator_name ? h?.initiator_name : h?.name,
role: h?.index == -1 ? '申请人' : '审批人',
time: h?.finished_at || '',
approved: h?.status === 'approved' || h?.status === 'submitted',
rejected: h?.status === 'rejected',
pending: h?.status != 'approved' && h?.status != 'rejected' && h?.status != 'submitted'
}))
}
}
// 判断是否为图片文件
const isImageFile = (file: { name: string; url: string; file_name: string }) => {
@@ -503,12 +666,15 @@
}
onMounted(() => {
getDictItemSelect()
getdetilfn()
})
</script>
<style scoped lang="scss">
.stocking-show-page { min-height: 100vh; }
.stocking-show-page {
min-height: 100vh;
}
.header {
display: flex;
justify-content: space-between;
@@ -528,13 +694,27 @@
.sub {
color: #333333;
}
.mr40 { margin-right: 40px; }
.mr40 {
margin-right: 40px;
}
}
.form-title {
font-weight: bold;
color: #222;
margin-bottom: 15px;
}
.form-title .title {
margin-left: 6px;
}
.items-wrap {
margin-top: 6px;
}
.item-row {
padding: 8px 0;
}
:deep(.el-input.is-disabled .el-input__inner) {
color: var(--el-text-color-regular);
}
.form-title { font-weight: bold; color: #222; margin-bottom: 15px; }
.form-title .title { margin-left: 6px; }
.items-wrap { margin-top: 6px; }
.item-row { padding: 8px 0; }
:deep(.el-input.is-disabled .el-input__inner) { color: var(--el-text-color-regular); }
.file-preview {
padding: 20px;
@@ -620,6 +800,97 @@
font-size: 48px;
color: #ddd;
}
.submit-wrap {
display: flex;
justify-content: center;
padding: 24px 0 8px;
}
/* 审批记录 时间线 */
.approval-timeline {
padding: 8px 4px 8px 0;
}
.timeline-item {
display: flex;
align-items: flex-start;
gap: 10px;
position: relative;
}
.timeline-item + .timeline-item {
margin-top: 50px;
}
.left {
width: 46px;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.avatar-box {
width: 46px;
height: 46px;
background: #3d7bff;
border-radius: 10px;
color: #fff;
position: relative;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 20px;
}
.status-dot {
position: absolute;
right: -4px;
bottom: -4px;
// width: 14px;
// height: 14px;
font-size: 9px;
padding: 3px 1px;
border-radius: 50%;
background: #22c55e;
border: 2px solid #fff;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.status-dot.pending {
background: #3471ff;
padding: 3px 3px;
}
.status-dot.rejected {
background: #ff0000;
padding: 3px 3px;
}
/* 连接下一个节点的虚线 */
.timeline-item:not(:last-child) .left::after {
content: '';
position: absolute;
top: 52px; /* avatar 46px + 间距 6px */
left: 23px; /* 盒子宽度一半,确保竖线居中 */
width: 0;
height: calc(100% + 16px); /* 加上相邻项之间的间距 */
border-left: 2px dotted #bfbfbf;
}
.right {
flex: 1;
padding-top: 2px;
}
.row.name-role {
color: #222;
}
.name {
font-weight: 600;
}
.role {
color: #666;
margin-left: 4px;
}
.time {
color: #888;
font-size: 12px;
margin-top: 2px;
}
.empty {
color: #999;
padding: 8px 0 4px 4px;
}
</style>
@@ -1,9 +1,9 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<div class="toolbar-left">
<!-- <div class="toolbar-left">
<ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton>
</div>
</div> -->
<div class="toolbar-right">
<el-input
v-model="keyword"
@@ -38,13 +38,20 @@
<ElTableColumn label="客户来源" prop="customer_source_snapshot" min-width="120" />
<ElTableColumn label="业务员" prop="salesperson_snapshot" min-width="100" />
<ElTableColumn label="日期" prop="created_at" min-width="120" />
<ElTableColumn label="补充" prop="remark" min-width="160" />
<ElTableColumn label="状态" prop="status" width="120">
<ElTableColumn label="状态" prop="approval_status">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
<div v-if="scope.row.appro_status">
<div
><span :class="statusClass(scope.row.appro_status.status)">{{ scope.row.appro_status.status_desc ? scope.row.appro_status.status_desc : '' }}</span>
<span v-if="scope.row.appro_status.name != ''"
>【{{ scope.row.appro_status.name }}】</span
>
</div>
</div>
<div v-else></div>
</template>
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="220" align="center">
<ElTableColumn label="操作" fixed="right" min-width="120" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-button link type="primary" @click="handleView1(scope.row)">查看终版</el-button>
@@ -59,7 +66,8 @@
<script setup lang="ts">
import { router } from '@/router'
import { CrmService } from '@/api/crmApi'
// import { CrmService } from '@/api/crmApi'
import { manageService } from '@/api/adminApi'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
@@ -91,7 +99,7 @@
keyword: keyword.value
}
const { records, current, size, total } = await CrmService.getStockList(params)
const { records, current, size, total } = await manageService.getStockList(params)
tableData.value = records || []
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
@@ -100,6 +108,11 @@
loading.value = false
}
}
function statusClass(status: any) {
if (status === 'rejected') return 'status-lost'
if (status === 'approved') return 'status-following'
return 'status-dealed'
}
const handleSizeChange = (size: number) => {
pagination.pageSize = size
@@ -116,7 +129,7 @@
}
const handleView1 = (row: any) => {
router.push({
path: '/crmpc/stocking/final_show',
path: '/admin/stock/final_show_admin',
query: { id: row.id } // 可带客户名等参数
})
// TODO: 跳转或弹窗查看备货单
@@ -146,4 +159,18 @@
align-items: center;
}
.clickable { cursor: pointer; }
.status-following {
color: #00a43f;
font-weight: bold;
}
.status-dealed {
color: #3471ff;
font-weight: bold;
}
.status-lost {
color: #ff0000;
font-weight: bold;
}
</style>
@@ -8,7 +8,7 @@
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<ElButton type="primary" plain>打印整单</ElButton>
<ElButton type="primary" plain @click="printCurrent">打印整单</ElButton>
</div>
<!-- 基础信息 -->
@@ -105,23 +105,6 @@
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
@@ -136,6 +119,46 @@
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
@@ -152,14 +175,14 @@
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
@@ -266,13 +289,35 @@
</div>
</div>
</div>
<!-- PDF 预览弹窗 -->
<el-dialog v-model="pdf.visible" title="打印预览" width="80%" top="40px" :close-on-click-modal="false">
<div style="height: 70vh; display: flex; flex-direction: column; gap: 12px;">
<div style="display:flex; justify-content:flex-end; gap: 8px;">
<!-- <el-button type="primary" @click="print()">打印</el-button> -->
<el-button @click="download">下载</el-button>
</div>
<iframe
v-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex:1; width: 100%; border: 1px solid #eee; border-radius: 6px;"
/>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { CrmService } from '@/api/crmApi'
import { manageService } from '@/api/adminApi'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { usePdfPreview } from '@/composables/usePdfPreview'
const { pdf, frameRef, openWithResponse, download, print, preparePreview } = usePdfPreview()
const printCurrent = async () => {
const res = await manageService.printStock({ id: stocking_id })
openWithResponse(res)
preparePreview()
}
const route = useRoute()
const stocking_id = route.query.id
const stockingInfo = ref<any>({})
@@ -311,7 +356,7 @@
//获取详情并映射到回显模型
const getdetilfn = async () => {
const res = await CrmService.getStockDetail({ id: stocking_id })
const res = await manageService.getStockDetail({ id: stocking_id })
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
@@ -330,12 +375,15 @@
const total = toMoneyView(it?.total_price)
const guide = toMoneyView(it?.official_price)
const discount = toMoneyView(it?.discount_price)
const listing = toMoneyView(it?.listing_price)
const reduction = toMoneyView(it?.reduction_price)
const helper = toMoneyView(it?.handling_fee)
const fob = toMoneyView(it?.fob_transport_fee)
const port = toMoneyView(it?.port_misc_fee)
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
vin: it?.vin || '',
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
@@ -355,6 +403,10 @@
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: listing.amount,
listing_price_currency: listing.currency,
reduction_price: reduction.amount,
reduction_price_currency: reduction.currency,
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
@@ -8,7 +8,7 @@
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<ElButton type="primary" plain>打印整单</ElButton>
<ElButton type="primary" plain @click="printCurrent">打印整单</ElButton>
</div>
<!-- 基础信息 -->
@@ -105,23 +105,6 @@
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
@@ -136,6 +119,46 @@
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
@@ -147,14 +170,14 @@
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
@@ -261,13 +284,35 @@
</div>
</div>
</div>
<!-- PDF 预览弹窗 -->
<el-dialog v-model="pdf.visible" title="打印预览" width="80%" top="40px" :close-on-click-modal="false">
<div style="height: 70vh; display: flex; flex-direction: column; gap: 12px;">
<div style="display:flex; justify-content:flex-end; gap: 8px;">
<!-- <el-button type="primary" @click="print()">打印</el-button> -->
<el-button @click="download">下载</el-button>
</div>
<iframe
v-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex:1; width: 100%; border: 1px solid #eee; border-radius: 6px;"
/>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { CrmService } from '@/api/crmApi'
import { manageService } from '@/api/adminApi'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { usePdfPreview } from '@/composables/usePdfPreview'
const { pdf, frameRef, openWithResponse, download, print, preparePreview } = usePdfPreview()
const printCurrent = async () => {
const res = await manageService.printStock({ id: stocking_id })
openWithResponse(res)
preparePreview()
}
const route = useRoute()
const stocking_id = route.query.id
const stockingInfo = ref<any>({})
@@ -306,7 +351,7 @@
//获取详情并映射到回显模型
const getdetilfn = async () => {
const res = await CrmService.getStockDetail({ id: stocking_id })
const res = await manageService.getStockDetail({ id: stocking_id })
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
@@ -331,6 +376,7 @@
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
modify: (Array.isArray(it?.modify_list) ? it.modify_list : [])
@@ -349,6 +395,10 @@
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: it?.listing_price?.amount ?? '',
listing_price_currency: it?.listing_price?.currency ?? '',
reduction_price: it?.reduction_price?.amount ?? '',
reduction_price_currency: it?.reduction_price?.currency ?? '',
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
@@ -1,9 +1,9 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<div class="toolbar-left">
<!-- <div class="toolbar-left">
<ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton>
</div>
</div> -->
<div class="toolbar-right">
<el-input
v-model="keyword"
@@ -38,46 +38,94 @@
<ElTableColumn label="客户来源" prop="customer_source_snapshot" />
<ElTableColumn label="业务员" prop="salesperson_snapshot" />
<ElTableColumn label="日期" prop="created_at" />
<ElTableColumn label="补充" prop="remark" />
<!-- <ElTableColumn label="状态" prop="status" width="120">
<!-- <ElTableColumn label="补充" prop="remark" /> -->
<ElTableColumn label="状态" prop="approval_status">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
<div v-if="scope.row.appro_status">
<div
><span :class="statusClass(scope.row.appro_status.status)">{{ scope.row.appro_status.status_desc ? scope.row.appro_status.status_desc : '' }}</span>
<span v-if="scope.row.appro_status.name != ''"
>【{{ scope.row.appro_status.name }}】</span
>
</div>
</div>
<div v-else></div>
</template>
</ElTableColumn> -->
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="120" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-button link type="primary" @click="handleView(scope.row)">查看</el-button>
<el-button
v-if="scope.row.is_use == 0"
link
type="primary"
@click="handleCreateRepair(scope.row)"
>创建终版</el-button
<el-link
type="warning"
underline="never"
@click="printfn(scope.row)"
style="margin-right: 8px"
>
<el-button
<i class="iconfont-sys">&#xe782;</i> 打印预览
</el-link>
<el-link
type="success"
underline="never"
@click="handleView(scope.row)"
style="margin-right: 8px"
>
<i class="iconfont-sys">&#xe76c;</i> 查看
</el-link>
<el-link
v-if="scope.row.is_use == 1"
link
type="primary"
type="success"
underline="never"
@click="handleView1(scope.row)"
>查看终版</el-button
>
<i class="iconfont-sys">&#xe76c;</i> 查看终版
</el-link>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
<!-- PDF 预览弹窗 -->
<el-dialog
v-model="pdf.visible"
title="打印预览"
width="80%"
top="40px"
:close-on-click-modal="false"
>
<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>
</div>
<div
v-if="pdf.images.length"
style="overflow: auto; border: 1px solid #eee; border-radius: 6px; padding: 8px"
>
<img
v-for="(img, idx) in pdf.images"
:key="idx"
:src="img"
style="display: block; width: 100%; margin-bottom: 8px; background: #fff"
/>
</div>
<iframe
v-else-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex: 1; width: 100%; border: 1px solid #eee; border-radius: 6px;"
/>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { router } from '@/router'
import { CrmService } from '@/api/crmApi'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
import { manageService } from '@/api/adminApi'
import { usePdfPreview } from '@/composables/usePdfPreview'
// import { useAuth } from '@/composables/useAuth'
// const { hasAuth } = useAuth()
const loading = ref(false)
const keyword = ref('')
@@ -85,10 +133,17 @@
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
// PDF 预览/打印(公共)
const { pdf, frameRef, openWithResponse, download, print, preparePreview, prepareImages } = usePdfPreview()
onMounted(() => {
getList()
})
function statusClass(status: any) {
if (status === 'rejected') return 'status-lost'
if (status === 'approved') return 'status-following'
return 'status-dealed'
}
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
@@ -105,7 +160,7 @@
keyword: keyword.value
}
const { records, current, size, total } = await CrmService.getStockList(params)
const { records, current, size, total } = await manageService.getStockList(params)
tableData.value = records || []
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
@@ -130,14 +185,14 @@
}
const handleView = (row: any) => {
router.push({
path: '/crmpc/stocking/show',
path: '/admin/stock/show_admin',
query: { id: row.id } // 可带客户名等参数
})
// TODO: 跳转或弹窗查看备货单
}
const handleView1 = (row: any) => {
router.push({
path: '/crmpc/stocking/final_show',
path: '/admin/stock/final_show_admin',
query: { id: row.object_id } // 可带客户名等参数
})
// router.push('/crmpc/stocking/final_show')
@@ -150,6 +205,21 @@
})
// TODO: 跳转创建维修保单
}
//打印
const printfn = (row: any) => {
manageService
.printStock({ id: row.id })
.then((res) => {
openWithResponse(res)
// 优先转成图片以适配不带插件的环境
prepareImages()
// 同时保留 blob 预览作为兜底
preparePreview()
})
.catch((err) => {
console.log(err)
})
}
</script>
<style scoped lang="scss">
@@ -175,5 +245,19 @@
align-items: center;
}
.clickable { cursor: pointer; }
.status-following {
color: #00a43f;
font-weight: bold;
}
.status-dealed {
color: #3471ff;
font-weight: bold;
}
.status-lost {
color: #ff0000;
font-weight: bold;
}
</style>
+18 -8
View File
@@ -5,13 +5,21 @@
<ElCol :xs="24" :sm="8" :lg="8">
<div class="dict-type-card">
<div class="card-header">
<ElInput
v-model="typeKeyword"
placeholder="搜索类型名称/编码"
clearable
@keyup.enter="getTypeList"
<ElSelect v-model="category_id" placeholder="请选择字典分类" clearable>
<ElOption
v-for="item in DictTypeSelect"
:key="item.id"
:label="item.item_label"
:value="item.id"
/>
<ElButton style="margin-left: 8px" @click="getTypeList" v-ripple>搜索</ElButton>
</ElSelect>
<el-input
style="margin-left: 8px"
v-model="typeKeyword"
@keyup.enter="getTypeList"
placeholder="请输入关键字"
/>
<ElButton style="margin-left: 8px;min-width: 70px;" @click="getTypeList" v-ripple>搜索</ElButton>
<ElButton
type="primary"
style="margin-left: 8px"
@@ -247,6 +255,7 @@
// 左侧 类型
const typeLoading = ref(false)
const typeKeyword = ref<string>('')
const category_id = ref<string>('')
const typeTableData = ref<any[]>([])
const typePagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
const activeType = ref<any | null>(null)
@@ -273,7 +282,8 @@
const { records, current, size, total } = await systemService.getDictTypeList({
current: currentPage,
size: pageSize,
keyword: typeKeyword.value
keyword: typeKeyword.value,
category_id: category_id.value
})
typeTableData.value = records
Object.assign(typePagination, { currentPage: current, pageSize: size, total })
@@ -301,7 +311,6 @@
}
const showTypeDialog = (type: 'add' | 'edit', row?: any) => {
getDictTypeSelect()
typeDialogVisible.value = true
typeDialogType.value = type
if (type === 'edit' && row) {
@@ -483,6 +492,7 @@
}
onMounted(async () => {
await getDictTypeSelect()
await getTypeList()
})
</script>
+75 -14
View File
@@ -117,16 +117,47 @@
<ElInput v-model="form.email" :disabled="!isEdit" />
</ElFormItem>
<ElFormItem label="签名" prop="signature" class="right-input">
<template v-if="form.signature_pic_full">
<img :src="form.signature_pic_full" class="signature-img" />
<template v-if="form.sign_img">
<img :src="sign_img_url" class="signature-img" />
<el-button
v-if="isEdit"
style="margin-left: 12px"
@click="showReSignQR = !showReSignQR"
>
重新签名
</el-button>
<div
v-if="isEdit && showReSignQR"
class="signature-qrcode"
style="margin-top: 20px;margin-left: 20px;"
>
<qrcode-vue
:value="qrcodeUrl"
:size="120"
level="L"
render-as="svg"
:include-margin="false"
background="#ffffff"
foreground="#111111"
/>
<div class="qrcode-tip">手机扫码重新签名</div>
</div>
</template>
<template v-else>
<div class="signature-qrcode">
<qrcode-vue :value="qrcodeUrl" :size="120" level="M" />
<qrcode-vue
:value="qrcodeUrl"
:size="120"
level="L"
render-as="svg"
:include-margin="false"
background="#ffffff"
foreground="#111111"
/>
<div class="qrcode-tip">手机扫码进行签名</div>
</div>
</template>
<el-button @click="handleSignature" type="primary">签名</el-button>
<!-- <el-button @click="handleSignature" type="primary">签名</el-button> -->
<el-input type="hidden" v-model="form.signature" />
</ElFormItem>
</ElRow>
@@ -242,6 +273,7 @@
}
// const imageUrls = ref(imageUrl)
const imageUrlavatar = ref('')
const sign_img_url = ref('')
// const socialize_pic_full = ref('')
// const countryOptions = ref<any>()
const form = ref<CustomerInfo>({})
@@ -255,16 +287,23 @@
// countryOptions.value = res||[]
// } catch (error) { countryOptions.value = [] }
// }
const { getUserInfo } = useUserStore()
// const { getUserInfo } = useUserStore()
const userInfo = ref<CustomerInfo>({})
const getuserInfo = async () => {
// const data = await CrmService.userget()
userInfo.value = getUserInfo.user
form.value = getUserInfo.user
imageUrlavatar.value = getUserInfo.user.avatar
const data = await UserService.getUserInfo()
userInfo.value = data.user
form.value = data.user
imageUrlavatar.value = data.user.avatar
// socialize_pic_full.value = data.socialize_pic_full
sign_img_url.value = data.user.sign_img_url
// userInfo.value = getUserInfo.user
// form.value = getUserInfo.user
// imageUrlavatar.value = getUserInfo.user.avatar
// sign_img_url.value = getUserInfo.user.sign_img_url
// socialize_pic_full.value = data.socialize_pic_full
}
const isEdit = ref(false)
const showReSignQR = ref(false)
const isEditPwd = ref(false)
const pwdForm = reactive({
password: '',
@@ -293,28 +332,47 @@
await getuserInfo()
})
const qrcodeUrl = computed(() => {
const userStore = useUserStore() as any
const userId = form.value?.id || userInfo.value?.id || ''
const base = location.origin
const token = (useUserStore() as any).accessToken || ''
const params = new URLSearchParams({ userId: String(userId) })
if (token) params.append('token', token)
if (userStore?.accessToken) params.append('accessToken', userStore.accessToken)
if (userStore?.language) params.append('lang', userStore.language)
if (userStore?.companyabbr) params.append('companyabbr', userStore.companyabbr)
if (userStore?.companyid) params.append('companyid', userStore.companyid)
if (userStore?.loginType) params.append('loginType', userStore.loginType)
if (userStore?.systemsabbr) params.append('systemsabbr', userStore.systemsabbr)
if (userStore?.systemsid) params.append('systemsid', userStore.systemsid)
return `${base}/auth/signature/mobile?${params.toString()}`
})
const handleSignature = async () => {
const userStore = useUserStore() as any
const userId = form.value?.id || userInfo.value?.id || ''
const base = location.origin
const token = (useUserStore() as any).accessToken || ''
const params = new URLSearchParams({ userId: String(userId) })
if (token) params.append('token', token)
if (userStore?.accessToken) params.append('accessToken', userStore.accessToken)
if (userStore?.language) params.append('lang', userStore.language)
if (userStore?.companyabbr) params.append('companyabbr', userStore.companyabbr)
if (userStore?.companyid) params.append('companyid', userStore.companyid)
if (userStore?.loginType) params.append('loginType', userStore.loginType)
if (userStore?.systemsabbr) params.append('systemsabbr', userStore.systemsabbr)
if (userStore?.systemsid) params.append('systemsid', userStore.systemsid)
window.location.href = `${base}/auth/signature/mobile?${params.toString()}`
}
const edit = async () => {
if (isEdit.value) {
const res = await UserService.editUserInfo(form.value)
const payload: any = { ...(form.value as any) }
delete payload.sign_img_url
const res = await UserService.editUserInfo(payload)
ElMessage.success(res?.message || '操作成功')
getuserInfo()
}
isEdit.value = !isEdit.value
if (isEdit.value === false) {
showReSignQR.value = false
}
}
const editPwd = async () => {
@@ -561,4 +619,7 @@
}
}
}
.signature-img {
width: 160px;
}
</style>
+2
View File
@@ -28,8 +28,10 @@
<el-option label="停用" :value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getColorList" v-ripple>搜索</el-button>
<el-button @click="resetSearch" v-ripple>重置</el-button>
</el-form-item>
</div>
</div>
<div class="boxshadow">
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="port-page">
<div class="port-toolbar boxshadow">
<div class="toolbar-left">
<ElButton @click="showDialog('add')" v-ripple v-if="hasAuth('port@add')" type="primary">创建备货单</ElButton>
<ElButton @click="showDialog('add')" v-ripple v-if="hasAuth('port@add')" type="primary">创建港口</ElButton>
</div>
<div class="toolbar-right">
<el-input
+132 -19
View File
@@ -5,6 +5,7 @@
<canvas
ref="canvasRef"
class="canvas"
:style="{ pointerEvents: locked ? 'none' : 'auto' }"
@touchstart.prevent="onStart"
@touchmove.prevent="onMove"
@touchend.prevent="onEnd"
@@ -14,35 +15,126 @@
></canvas>
</div>
<div class="toolbar">
<el-button @click="clearCanvas">清空</el-button>
<el-button @click="toggleLandscape">横屏</el-button>
<el-button type="primary" :loading="submitting" @click="saveSignature">保存</el-button>
<el-button :disabled="locked" @click="clearCanvas">清空</el-button>
<el-button :disabled="locked" @click="toggleLandscape">横屏</el-button>
<el-button type="primary" :disabled="locked" :loading="submitting" @click="saveSignature">
保存
</el-button>
</div>
<div class="tip">
{{ locked ? '签名已保存,页面已锁定' : '请在画布上手写签名,然后点击保存' }}
</div>
<div class="tip">请在画布上手写签名,然后点击保存</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { useUploadHeaders } from '@/composables/useUploadHeaders'
import { CrmService } from '@/api/crmApi'
// import { CrmService } from '@/api/crmApi'
import { commonService } from '@/api/commonApi'
import { useUserStore } from '@/store/modules/user'
const route = useRoute()
const userId = route.query.userId as string | undefined
const userStore = useUserStore()
// 优先使用URL传入的token,否则取当前应用内的token
const urlToken = route.query.token as string | undefined
const urlToken =
(route.query.accessToken as string | undefined) || (route.query.token as string | undefined)
// 其他头部信息从URL透传(便于直达页调用接口)
const urlLang = route.query.lang as string | undefined
const urlCorp = (route.query.companyabbr as string | undefined) || userStore.companyabbr
const urlLoginType = route.query.loginType as string | undefined
const urlSys = (route.query.systemsabbr as string | undefined) || userStore.systemsabbr || 'fdesk'
const effectiveToken = urlToken || userStore.accessToken
// 从URL参数获取公司信息并存储到userStore(如果路由守卫没有处理)
const companyid = route.query.companyid as string | undefined
const companyabbr = route.query.companyabbr as string | undefined
if (companyid && companyabbr && (!userStore.companyid || !userStore.companyabbr)) {
userStore.setCompany(companyid, companyabbr)
}
// 从URL参数获取系统信息并存储到userStore(如果路由守卫没有处理)
const systemsabbr = route.query.systemsabbr as string | undefined
const systemsid = route.query.systemsid as string | undefined
if (systemsid && systemsabbr && (!userStore.systemsid || !userStore.systemsabbr)) {
userStore.setSystems(systemsid, systemsabbr)
}
// 从URL参数获取登录类型并存储到userStore(如果路由守卫没有处理)
if (urlLoginType && !userStore.loginType) {
userStore.setLoginType(urlLoginType as 'feishu' | 'upwd')
}
// 从URL参数获取token并存储到userStore(如果路由守卫没有处理)
if (urlToken && !userStore.accessToken) {
userStore.setToken(urlToken)
}
// 调试信息:打印初始化时的userStore状态
// console.log('Signature page initialized:', {
// urlParams: {
// userId,
// urlToken: urlToken ? 'exists' : 'missing',
// urlLang,
// urlCorp,
// urlLoginType,
// urlSys
// },
// userStore: {
// companyabbr: userStore.companyabbr,
// companyid: userStore.companyid,
// systemsabbr: userStore.systemsabbr,
// systemsid: userStore.systemsid,
// language: userStore.language,
// loginType: userStore.loginType,
// accessToken: userStore.accessToken ? 'exists' : 'missing',
// isLogin: userStore.isLogin
// }
// })
const { uploadHeaders } = useUploadHeaders()
// 基于URL参数动态构造上传头,优先使用URL透传值
const dynamicHeaders = computed(() => {
const headers: Record<string, string> = { ...(uploadHeaders.value || {}) }
// 语言设置
if (urlLang) headers['Fdesk-Language'] = urlLang
// 公司标识 - 优先使用URL参数,其次使用userStore,最后使用默认值
const corpAbbr = urlCorp || userStore.companyabbr || 'default'
headers['Fdesk-Corp-Abbr'] = corpAbbr
// 登录类型
if (urlLoginType) headers['Fdesk-Login-Type'] = urlLoginType
// 系统标识
headers['Fdesk-System-Code'] = urlSys
// 认证令牌
if (effectiveToken) headers['Fdesk-Auth-Token'] = 'Bearer ' + effectiveToken
// 调试信息:打印请求头
// console.log('Signature page headers:', headers)
// console.log('URL params:', {
// urlLang,
// urlCorp,
// urlLoginType,
// urlSys,
// effectiveToken
// })
// console.log('Final corp abbr:', corpAbbr)
return headers
})
const canvasRef = ref<HTMLCanvasElement | null>(null)
const ctx = ref<CanvasRenderingContext2D | null>(null)
const drawing = ref(false)
const submitting = ref(false)
const landscape = ref(false)
const locked = ref(false)
const resizeCanvas = () => {
const canvas = canvasRef.value
@@ -94,18 +186,21 @@
}
const onStart = (e: TouchEvent) => {
if (locked.value) return
drawing.value = true
const p = getPoint(e)
ctx.value!.beginPath()
ctx.value!.moveTo(p.x, p.y)
}
const onMove = (e: TouchEvent) => {
if (locked.value) return
if (!drawing.value) return
const p = getPoint(e)
ctx.value!.lineTo(p.x, p.y)
ctx.value!.stroke()
}
const onEnd = () => {
if (locked.value) return
drawing.value = false
}
@@ -114,6 +209,7 @@
const onMouseUp = () => onEnd()
const clearCanvas = () => {
if (locked.value) return
resizeCanvas()
}
@@ -147,12 +243,17 @@
}
}
const isLimitedWebview = () => /MicroMessenger|Lark|Feishu|DingTalk/i.test(navigator.userAgent)
const toggleLandscape = async () => {
landscape.value = !landscape.value
if (landscape.value) {
// 在微信/飞书等内置浏览器中,强制横屏普遍受限,采用 CSS 旋转兜底
if (!isLimitedWebview()) {
await requestFullscreen(document.documentElement)
await lockOrientationLandscape()
}
}
setTimeout(resizeCanvas, 200)
}
@@ -170,30 +271,42 @@
const form = new FormData()
form.append('file', file)
const headers: Record<string, string> = { ...(uploadHeaders.value || {}) }
if (effectiveToken) {
headers['Authorization'] = `Bearer ${effectiveToken}`
}
const headers: Record<string, string> = { ...(dynamicHeaders.value || {}) }
// 兼容后端可能验 Authorization 的情况
if (effectiveToken) headers['Authorization'] = `Bearer ${effectiveToken}`
// 调试信息:打印上传请求详情
// console.log('Upload URL:', uploadUrl)
// console.log('Upload headers:', headers)
// console.log('UserStore state:', {
// systemsabbr: userStore.systemsabbr,
// systemsid: userStore.systemsid,
// companyabbr: userStore.companyabbr,
// companyid: userStore.companyid,
// language: userStore.language,
// loginType: userStore.loginType
// })
const res = await fetch(uploadUrl, {
method: 'POST',
headers,
body: form
})
const json = await res.json()
// console.log('Upload response:', json)
if (json.code !== 200) throw new Error(json.message || '上传失败')
// 将签名保存到个人信息(假设 crmuseredit 接受 signature 和 signature_pic_full 字段)
await CrmService.crmuseredit({
id: userId,
signature: json.data.file_name,
signature_pic_full: json.data.file_url
const res1 = await commonService.signatureEdit({
sign_img: json.data.file_name
})
ElMessage.success('签名已保存')
ElMessage.success(res1?.message || '签名已保存')
locked.value = true
// 完成后可提示返回或自动关闭
setTimeout(() => {
if (window.history.length > 1) window.history.back()
}, 800)
// setTimeout(() => {
// if (window.history.length > 1) window.history.back()
// }, 800)
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
} finally {
+897
View File
@@ -0,0 +1,897 @@
<template>
<div class="stocking-show-page">
<div class="header boxshadow">
<div class="header-left">
<div class="title">合塑实业·汽车事业部-备货单(客户下定)</div>
<div class="sub">
<span class="mr40">备货单编号:{{ header.order_no }}</span>
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<!-- <ElButton type="primary" plain @click="printCurrent">打印整单</ElButton> -->
</div>
<!-- 基础信息 -->
<div class="boxshadow">
<div class="form-title"><span class="border"></span><span class="title">基础信息</span></div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="阿里订单号/PN号">
<ElInput v-model="base.pn_no" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="日期">
<ElInput v-model="base.date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="清关目的国">
<ElInput v-model="base.close_date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="3">
<ElFormItem label="客户来源">
<ElInput v-model="base.channel" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户名称">
<ElInput v-model="base.customer_name" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户所在国">
<ElInput v-model="base.client_country" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
<!-- 订单详情 -->
<div class="boxshadow">
<div class="form-title"><span class="border"></span><span class="title">订单详情</span></div>
<div class="items-wrap">
<div class="item-row" v-for="(item, idx) in items" :key="idx">
<ElRow :gutter="12">
<ElCol :span="8">
<ElFormItem label="车型" label-width="64px">
<ElInput v-model="item.model" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="颜色/外" label-width="72px">
<ElInput v-model="item.color_out" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="内饰" label-width="52px">
<ElInput v-model="item.color_in" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="改装" label-width="52px">
<ElInput v-model="item.modify" disabled />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="单价" label-width="52px">
<ElInput v-model="item.unit_price" disabled>
<template #append>{{ item.unit_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="总价" label-width="52px">
<ElInput v-model="item.total_price" disabled>
<template #append>{{ item.total_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="改装费" label-width="60px">
<ElInput v-model="item.modify_fee" disabled>
<template #append>{{ item.modify_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="FOB段运费" label-width="84px">
<ElInput v-model="item.fob_fee" disabled>
<template #append>{{ item.fob_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
<template #append>{{ item.helper_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="港杂费" label-width="60px">
<ElInput v-model="item.port_fee" disabled>
<template #append>{{ item.port_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
<template #append>{{ item.profit_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="车架号" label-width="70px">
<ElInput v-model.number="item.vin" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<!-- 运输详情 -->
<div class="boxshadow">
<div class="form-title"><span class="border"></span><span class="title">运输详情</span></div>
<ElRow :gutter="12">
<ElCol :span="4"
><ElFormItem label="清关人"><ElInput v-model="ship.customs" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="预计发送日"><ElInput v-model="ship.plan" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="运输方式"><ElInput v-model="ship.method" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="国内收货港"
><ElInput v-model="ship.domestic_port" disabled /></ElFormItem
></ElCol>
<ElCol :span="8"
><ElFormItem label="贸易条款/清关目的港"
><ElInput v-model="ship.terms" disabled /></ElFormItem
></ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="6"
><ElFormItem label="最迟到港时间"
><ElInput v-model="ship.latest_arrival" disabled /></ElFormItem
></ElCol>
</ElRow>
</div>
<!-- 计划收款信息 -->
<div class="boxshadow">
<div class="form-title"
><span class="border"></span><span class="title">计划收款信息</span></div
>
<div v-for="(p, idx) in payments" :key="idx">
<ElRow :gutter="12">
<ElCol :span="4"
><ElFormItem label="汇款国"><ElInput v-model="p.remit_country" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="日期"><ElInput v-model="p.date" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="币种"><ElInput v-model="p.currency" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="账户"><ElInput v-model="p.account" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="汇款人"><ElInput v-model="p.payer" disabled /></ElFormItem
></ElCol>
<ElCol :span="4"
><ElFormItem label="金额"><ElInput v-model="p.amount" disabled /></ElFormItem
></ElCol>
</ElRow>
</div>
</div>
<!-- 上传合同 -->
<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>
</div>
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">审批记录</span>
</div>
<div class="approval-timeline">
<div v-for="(rec, idx) in approvalRecords" :key="idx" class="timeline-item">
<div class="left">
<div class="avatar-box">
<span class="initial">{{ rec.name?.slice(0, 1) || '—' }}</span>
<i v-if="rec.approved" class="status-dot iconfont-sys">&#xe621;</i>
<i v-if="rec.rejected" class="status-dot rejected">&#xe83a;</i>
<i v-else-if="rec.pending" class="status-dot pending iconfont-sys">&#xe839;</i>
</div>
</div>
<div class="right">
<div class="row name-role">
<span class="name">{{ rec.name }}</span>
<span class="role">({{ rec.role || rec.type || '审批人' }})</span>
</div>
<div class="row time">{{ rec.time }}</div>
</div>
</div>
<div v-if="!approvalRecords.length" class="empty">暂无审批记录</div>
</div>
</div>
<div class="boxshadow" v-if="status == 'pending'">
<div class="form-title">
<span class="border"></span>
<span class="title">审批</span>
</div>
<div class="">
<ElRow :gutter="12">
<ElCol :span="12">
<ElFormItem label="审批操作:">
<el-select v-model="approvalAction" placeholder="请选择审批操作">
<el-option
v-for="item in getDictItemSelectlist"
:key="item.item_value"
:label="item.item_label"
:value="item.item_value"
/>
</el-select>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="备注:">
<el-input
v-model="approvalNotes"
type="textarea"
:rows="2"
placeholder="请输入备注信息"
class="approval-notes"
/>
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<div class="form-card" v-if="status == 'pending'">
<!-- 底部信息 -->
<div class="submit-wrap">
<ElButton type="primary" size="large" class="submit-btn" @click="handleSubmit"
>提交</ElButton
>
</div>
</div>
<!-- PDF 预览弹窗 -->
<el-dialog
v-model="pdf.visible"
title="打印预览"
width="80%"
top="40px"
:close-on-click-modal="false"
>
<div style="height: 70vh; display: flex; flex-direction: column; gap: 12px">
<div style="display: flex; justify-content: flex-end; gap: 8px">
<!-- <el-button type="primary" @click="print()">打印</el-button> -->
<el-button @click="download">下载</el-button>
</div>
<iframe
v-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex: 1; width: 100%; border: 1px solid #eee; border-radius: 6px"
/>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { CrmService } from '@/api/crmApi'
import { commonService } from '@/api/commonApi'
// import { manageService } from '@/api/adminApi'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { usePdfPreview } from '@/composables/usePdfPreview'
import { router } from '@/router'
const { pdf, frameRef, download } = usePdfPreview()
const route = useRoute()
// const approval_id = route.query.id
const status = route.query.status
const stocking_id = route.query.biz_id
const instance_id = route.query.instance_id
const stockingInfo = ref<any>({})
const approvalNotes = ref('')
const approvalAction = ref('')
const handleSubmit = async () => {
try {
// 这里调用审批API
const { message } = await CrmService.stockapprovalpass({
instance_id: instance_id,
action: approvalAction.value,
comment: approvalNotes.value
})
router.push('/crmpc/approval/stocking_auth')
ElMessage.success(message)
} catch {
ElMessage.error('提交失败')
}
}
// 回显视图模型,字段与模板一致
const header = reactive({ order_no: '', salesman: '' })
const base = reactive({
pn_no: '',
date: '',
close_date: '',
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
const ship = reactive({
customs: '',
plan: '',
method: '',
domestic_port: '',
terms: '',
latest_arrival: ''
})
const payments = ref<any[]>([])
// 审批记录(先填充假数据展示)
const approvalRecords = ref<any[]>([])
const getDictItemSelectlist = ref<any[]>([])
const getDictItemSelect = async () => {
const res = await commonService.getDictItemSelect({ dict_id: '18' })
getDictItemSelectlist.value = res
}
// 合同文件
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
const toMoneyView = (m: any) => ({
amount: m?.amount ?? '',
currency: m?.currency ?? ''
})
//获取详情并映射到回显模型
const getdetilfn = async () => {
const res = await CrmService.getStockDetail({ id: stocking_id })
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
header.salesman =
res?.salesperson_snapshot || res?.salesman || res?.salesman_name || res?.user?.name || ''
// 基础信息
base.pn_no = res?.pi_no || ''
base.date = res?.biz_date || ''
base.close_date = res?.clearance_country_snapshot || ''
base.channel = res?.customer_source_snapshot || res?.customer_source || ''
base.customer_name = res?.customer_snapshot || res?.customer_name || ''
base.client_country = res?.customer_country_snapshot || res?.customer_country || ''
// 订单明细
const list = Array.isArray(res?.veh_list) ? res.veh_list : []
items.value = list.map((it: any) => {
const unit = toMoneyView(it?.unit_price)
const total = toMoneyView(it?.total_price)
const guide = toMoneyView(it?.official_price)
const discount = toMoneyView(it?.discount_price)
const listing = toMoneyView(it?.listing_price)
const reduction = toMoneyView(it?.reduction_price)
const helper = toMoneyView(it?.handling_fee)
const fob = toMoneyView(it?.fob_transport_fee)
const port = toMoneyView(it?.port_misc_fee)
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
vin: it?.vin || '',
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
modify: (Array.isArray(it?.modify_list) ? it.modify_list : [])
.map((m: any) => m?.option_name_snapshot)
.filter(Boolean)
.join('、'),
modify_fee: it?.retrofit_fee?.amount ?? '',
modify_fee_currency: it?.retrofit_fee?.currency ?? '',
fob_fee: fob.amount,
fob_fee_currency: fob.currency,
unit_price: unit.amount,
unit_price_currency: unit.currency,
total_price: total.amount,
total_price_currency: total.currency,
guide_price: guide.amount,
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: listing.amount,
listing_price_currency: listing.currency,
reduction_price: reduction.amount,
reduction_price_currency: reduction.currency,
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
domestic_freight_currency: it?.domestic_freight?.currency ?? '',
port_fee: port.amount,
port_fee_currency: port.currency,
profit: profit.amount,
profit_currency: profit.currency
}
})
// 运输详情
ship.customs = res?.declarant_name || ''
ship.plan = res?.eta_ship_date || ''
ship.method = res?.shipping_method_snapshot || ''
ship.domestic_port = res?.domestic_port_snapshot || ''
ship.terms =
`${res?.trade_term_snapshot || ''} / ${res?.clearance_port_snapshot || ''}`.replace(
/^\s*\/\s*$/,
''
)
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.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
// 计划收款(全部展示)
payments.value = (Array.isArray(res?.account_list) ? res.account_list : []).map((p: any) => ({
remit_country: p?.remit_country_name_snapshot || '',
date: p?.remit_date || '',
currency: p?.currency_name_snapshot || p?.currency_code || '',
account: p?.account_name_snapshot || '',
payer: p?.remitter_name || '',
amount: p?.amount ?? ''
}))
// 合同文件
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
}
// 审批记录(兼容多种字段)
const resstockapprovallogs = await CrmService.stockapprovallogs({ instance_id: instance_id })
console.log(resstockapprovallogs)
const historyList = resstockapprovallogs
if (historyList.length > 0) {
approvalRecords.value = historyList.map((h: any) => ({
name: h?.initiator_name ? h?.initiator_name : h?.name,
role: h?.index == -1 ? '申请人' : '审批人',
time: h?.finished_at || '',
approved: h?.status === 'approved' || h?.status === 'submitted',
rejected: h?.status === 'rejected',
pending: h?.status != 'approved' && h?.status != 'rejected' && h?.status != 'submitted'
}))
}
}
// 判断是否为图片文件
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('下载失败,请稍后重试')
}
}
onMounted(() => {
getDictItemSelect()
getdetilfn()
})
</script>
<style scoped lang="scss">
.stocking-show-page {
min-height: 100vh;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
margin-bottom: 12px;
color: #333333;
.header-left {
flex: 1;
text-align: center;
}
.title {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
}
.sub {
color: #333333;
}
.mr40 {
margin-right: 40px;
}
}
.form-title {
font-weight: bold;
color: #222;
margin-bottom: 15px;
}
.form-title .title {
margin-left: 6px;
}
.items-wrap {
margin-top: 6px;
}
.item-row {
padding: 8px 0;
}
:deep(.el-input.is-disabled .el-input__inner) {
color: var(--el-text-color-regular);
}
.file-preview {
padding: 20px;
min-height: 120px;
display: flex;
align-items: center;
justify-content: center;
}
.contract-file {
width: 100%;
max-width: 400px;
}
.image-preview {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
.preview-image {
max-width: 200px;
max-height: 200px;
object-fit: contain;
border: 1px solid #e4e7ed;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: transform 0.2s ease;
}
.preview-image:hover {
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.document-preview {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
border: 1px solid #e4e7ed;
border-radius: 8px;
background: #fafafa;
}
.file-icon {
display: flex;
align-items: center;
justify-content: center;
width: 48px;
height: 48px;
background: #409eff;
border-radius: 8px;
color: white;
font-size: 24px;
}
.file-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 8px;
}
.file-name {
font-size: 14px;
color: #333;
word-break: break-all;
}
.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;
}
.submit-wrap {
display: flex;
justify-content: center;
padding: 24px 0 8px;
}
/* 审批记录 时间线 */
.approval-timeline {
padding: 8px 4px 8px 0;
}
.timeline-item {
display: flex;
align-items: flex-start;
gap: 10px;
position: relative;
}
.timeline-item + .timeline-item {
margin-top: 50px;
}
.left {
width: 46px;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.avatar-box {
width: 46px;
height: 46px;
background: #3d7bff;
border-radius: 10px;
color: #fff;
position: relative;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 20px;
}
.status-dot {
position: absolute;
right: -4px;
bottom: -4px;
// width: 14px;
// height: 14px;
font-size: 9px;
padding: 3px 1px;
border-radius: 50%;
background: #22c55e;
border: 2px solid #fff;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.status-dot.pending {
background: #3471ff;
padding: 3px 3px;
}
.status-dot.rejected {
background: #ff0000;
padding: 3px 3px;
}
/* 连接下一个节点的虚线 */
.timeline-item:not(:last-child) .left::after {
content: '';
position: absolute;
top: 52px; /* avatar 46px + 间距 6px */
left: 23px; /* 盒子宽度一半,确保竖线居中 */
width: 0;
height: calc(100% + 16px); /* 加上相邻项之间的间距 */
border-left: 2px dotted #bfbfbf;
}
.right {
flex: 1;
padding-top: 2px;
}
.row.name-role {
color: #222;
}
.name {
font-weight: 600;
}
.role {
color: #666;
margin-left: 4px;
}
.time {
color: #888;
font-size: 12px;
margin-top: 2px;
}
.empty {
color: #999;
padding: 8px 0 4px 4px;
}
</style>
+663
View File
@@ -0,0 +1,663 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<div class="toolbar-left">
<!-- <ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton> -->
</div>
<div class="toolbar-right">
<el-input
v-model="keyword"
placeholder="请输入客户名称"
clearable
style="width: 260px"
@keyup.enter="getList"
>
<template #suffix>
<el-icon class="clickable" @click="getList"><Search /></el-icon>
</template>
</el-input>
</div>
</div>
<div class="boxshadow">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="审批单名称" prop="flows_name" min-width="140" />
<ElTableColumn label="审批说明" prop="biz_desc" min-width="160" />
<ElTableColumn label="审批动作" prop="action_desc" min-width="160" />
<ElTableColumn label="提交人" prop="initiator_name" min-width="120" />
<ElTableColumn label="审核人" prop="approver_name" min-width="120" />
<ElTableColumn label="审批时间" prop="approved_at" min-width="120" />
<ElTableColumn label="状态" prop="status_desc" min-width="120" />
<ElTableColumn label="创建时间" prop="created_at" min-width="120" />
<ElTableColumn label="操作" fixed="right" min-width="140" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-link
type="primary"
underline="never"
@click="handleView(scope.row)"
style="margin-right: 8px"
>
<i class="iconfont-sys">&#xe76c;</i> 查看审批
</el-link>
<el-link
v-if="scope.row.status == 'pending'"
type="success"
underline="never"
@click="handleCreateRepair(scope.row)"
>
<i class="iconfont-sys">&#xe6bf;</i> 快速审批
</el-link>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
<!-- 快速审批弹出框 -->
<el-dialog
v-model="approvalDialogVisible"
title="合塑实业-汽车事业部-备货单(客户下定)"
width="80%"
:close-on-click-modal="false"
:close-on-press-escape="false"
class="approval-dialog"
>
<div class="approval-content">
<!-- 头部信息 -->
<div class="header">
<div class="sub">
<span class="mr40">备货单编号:{{ header.order_no }}</span>
<span>业务员:{{ header.salesman }}</span>
</div>
</div>
<!-- 基础信息 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>基础信息</span>
</div>
<div class="form-grid">
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="阿里订单号/PN号">
<ElInput v-model="base.pn_no" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="日期">
<ElInput v-model="base.date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="清关目的国">
<ElInput v-model="base.close_date" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="3">
<ElFormItem label="客户来源">
<ElInput v-model="base.channel" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户名称">
<ElInput v-model="base.customer_name" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="客户所在国">
<ElInput v-model="base.client_country" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<!-- 订单详情 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>订单详情</span>
</div>
<div class="items-wrap">
<div class="item-row" v-for="(item, idx) in items" :key="idx">
<ElRow :gutter="12">
<ElCol :span="8">
<ElFormItem label="车型" label-width="64px">
<ElInput v-model="item.model" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="颜色/外" label-width="72px">
<ElInput v-model="item.color_out" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="内饰" label-width="52px">
<ElInput v-model="item.color_in" disabled />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="改装" label-width="52px">
<ElInput v-model="item.modify" disabled />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="单价" label-width="52px">
<ElInput v-model="item.unit_price" disabled>
<template #append>{{ item.unit_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="总价" label-width="52px">
<ElInput v-model="item.total_price" disabled>
<template #append>{{ item.total_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="改装费" label-width="60px">
<ElInput v-model="item.modify_fee" disabled>
<template #append>{{ item.modify_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="FOB段运费" label-width="84px">
<ElInput v-model="item.fob_fee" disabled>
<template #append>{{ item.fob_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.helper_fee" disabled>
<template #append>{{ item.helper_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="港杂费" label-width="60px">
<ElInput v-model="item.port_fee" disabled>
<template #append>{{ item.port_fee_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" disabled />
</ElFormItem>
</ElCol>
<template v-if="(item.mileage ?? 0) <= 0">
<ElCol :span="4">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.guide_price" disabled>
<template #append>{{ item.guide_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount" disabled>
<template #append>{{ item.discount_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<template v-else>
<ElCol :span="4">
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" disabled>
<template #append>{{ item.listing_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" disabled>
<template #append>{{ item.reduction_price_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
<template #append>{{ item.profit_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElFormItem label="车架号" label-width="70px">
<ElInput v-model.number="item.vin" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<!-- 审批备注 -->
<div class="info-section">
<div class="section-title">
<div class="title-bar"></div>
<span>审批</span>
</div>
<ElRow :gutter="12">
<ElCol :span="12">
<ElFormItem label="审批操作:">
<el-select v-model="approvalAction" placeholder="请选择审批操作">
<el-option
v-for="item in getDictItemSelectlist"
:key="item.item_value"
:label="item.item_label"
:value="item.item_value"
/>
</el-select>
</ElFormItem>
</ElCol>
<ElCol :span="12">
<ElFormItem label="备注:">
<el-input
v-model="approvalNotes"
type="textarea"
:rows="2"
placeholder="请输入备注信息"
class="approval-notes"
/>
</ElFormItem>
</ElCol>
</ElRow>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleReject" class="reject-btn">取消</el-button>
<el-button type="primary" @click="handleApprove" class="approve-btn">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { router } from '@/router'
// import { manageService } from '@/api/adminApi'
import { useAuth } from '@/composables/useAuth'
import { CrmService } from '@/api/crmApi'
import { commonService } from '@/api/commonApi'
const { hasAuth } = useAuth()
const loading = ref(false)
const keyword = ref('')
const tableRef = ref()
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
// 审批弹出框相关
const approvalDialogVisible = ref(false)
const stockingInfo = ref<any>({})
// 回显视图模型,字段与模板一致
const header = reactive({ order_no: '', salesman: '' })
const base = reactive({
pn_no: '',
date: '',
close_date: '',
channel: '',
customer_name: '',
client_country: '',
total_cif: '',
total_cif_currency: '',
contract_rate: ''
})
const items = ref<any[]>([])
const approvalNotes = ref('')
const approvalAction = ref('')
onMounted(() => {
getList()
})
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
})
const getList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const params = {
current: currentPage,
size: pageSize,
is_final: 0, // 只获取备货单,非终版
keyword: keyword.value
}
const { records, current, size, total } = await CrmService.stockapprovalrecord(params)
tableData.value = records || []
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取列表失败:', error)
} finally {
loading.value = false
}
}
const handleSizeChange = (size: number) => {
pagination.pageSize = size
getList()
}
const handleCurrentChange = (page: number) => {
pagination.currentPage = page
getList()
}
const handleView = (row: any) => {
router.push({
path: '/crmpc/approval/auth_detil',
query: { id: row.id, biz_id: row.biz_id, instance_id: row.instance_id, status: row.status } // 可带客户名等参数
})
}
const toMoneyView = (m: any) => ({
amount: m?.amount ?? '',
currency: m?.currency ?? ''
})
const getDictItemSelectlist = ref<any[]>([])
const getDictItemSelect = async () => {
const res = await commonService.getDictItemSelect({ dict_id: '18' })
getDictItemSelectlist.value = res
}
const instance_id = ref('')
const handleCreateRepair = async (row: any) => {
getDictItemSelect()
instance_id.value = row.instance_id
const res = await CrmService.getStockDetail({ id: row.biz_id })
stockingInfo.value = res
// 头部
header.order_no = res?.order_no || res?.pi_no || ''
header.salesman =
res?.salesperson_snapshot || res?.salesman || res?.salesman_name || res?.user?.name || ''
// 基础信息
base.pn_no = res?.pi_no || ''
base.date = res?.biz_date || ''
base.close_date = res?.clearance_country_snapshot || ''
base.channel = res?.customer_source_snapshot || res?.customer_source || ''
base.customer_name = res?.customer_snapshot || res?.customer_name || ''
base.client_country = res?.customer_country_snapshot || res?.customer_country || ''
// 订单明细
const list = Array.isArray(res?.veh_list) ? res.veh_list : []
items.value = list.map((it: any) => {
const unit = toMoneyView(it?.unit_price)
const total = toMoneyView(it?.total_price)
const guide = toMoneyView(it?.official_price)
const discount = toMoneyView(it?.discount_price)
const listing = toMoneyView(it?.listing_price)
const reduction = toMoneyView(it?.reduction_price)
const helper = toMoneyView(it?.handling_fee)
const fob = toMoneyView(it?.fob_transport_fee)
const port = toMoneyView(it?.port_misc_fee)
const profit = toMoneyView(it?.profit)
return {
model: it?.model_snapshot || '',
mileage: it?.mileage ?? 0,
vin: it?.vin || '',
color_out: it?.color_exterior_snapshot || '',
color_in: it?.color_interior_snapshot || '',
modify: (Array.isArray(it?.modify_list) ? it.modify_list : [])
.map((m: any) => m?.option_name_snapshot)
.filter(Boolean)
.join('、'),
modify_fee: it?.retrofit_fee?.amount ?? '',
modify_fee_currency: it?.retrofit_fee?.currency ?? '',
fob_fee: fob.amount,
fob_fee_currency: fob.currency,
unit_price: unit.amount,
unit_price_currency: unit.currency,
total_price: total.amount,
total_price_currency: total.currency,
guide_price: guide.amount,
guide_price_currency: guide.currency,
discount: discount.amount,
discount_currency: discount.currency,
listing_price: listing.amount,
listing_price_currency: listing.currency,
reduction_price: reduction.amount,
reduction_price_currency: reduction.currency,
helper_fee: helper.amount,
helper_fee_currency: helper.currency,
domestic_freight: it?.domestic_freight?.amount ?? '',
domestic_freight_currency: it?.domestic_freight?.currency ?? '',
port_fee: port.amount,
port_fee_currency: port.currency,
profit: profit.amount,
profit_currency: profit.currency
}
})
// 合计与汇率
base.total_cif = res?.cif_total_amount?.amount ?? ''
base.total_cif_currency = res?.cif_total_amount?.currency || ''
base.contract_rate = res?.contract_exchange_rate || res?.contract_rate || ''
approvalDialogVisible.value = true
}
// 审批操作
const handleApprove = async () => {
try {
// 这里调用审批API
const { message } = await CrmService.stockapprovalpass({
instance_id: instance_id.value,
action: approvalAction.value,
comment: approvalNotes.value
})
ElMessage.success(message)
approvalDialogVisible.value = false
approvalNotes.value = ''
instance_id.value = ''
// 刷新列表
getList()
} catch (error) {
console.error('审批失败:', error)
ElMessage.error('审批失败')
}
}
const handleReject = async () => {
approvalDialogVisible.value = false
approvalNotes.value = ''
}
</script>
<style scoped lang="scss">
.stocking-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.stocking-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 12px 16px;
background: var(--art-main-bg-color);
}
.toolbar-left {
display: flex;
align-items: center;
gap: 8px;
}
.toolbar-right {
display: flex;
align-items: center;
}
.clickable {
cursor: pointer;
}
// 审批弹出框样式
.approval-dialog {
.approval-content {
max-height: 70vh;
overflow-y: auto;
}
.header {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 12px;
color: #333333;
.mr40 { margin-right: 40px; }
}
.info-section {
margin-bottom: 24px;
.section-title {
display: flex;
align-items: center;
margin-bottom: 16px;
.title-bar {
width: 4px;
height: 20px;
background: #409eff;
margin-right: 8px;
border-radius: 2px;
}
span {
font-size: 16px;
font-weight: 600;
color: #303133;
}
}
}
.order-items {
.order-item {
border: 1px solid #e4e7ed;
border-radius: 8px;
padding: 16px;
margin-bottom: 16px;
background: #fafafa;
.item-header {
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #e4e7ed;
.item-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
}
.item-details {
.detail-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 12px;
.detail-item {
display: flex;
flex-direction: column;
label {
margin-bottom: 6px;
font-size: 14px;
font-weight: 500;
color: #606266;
}
}
}
}
}
}
.summary-section {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
background: #f0f9ff;
border-radius: 8px;
margin-bottom: 24px;
.summary-item {
.summary-label {
font-weight: 600;
color: #606266;
margin-right: 8px;
}
.summary-value {
font-size: 18px;
font-weight: 700;
color: #409eff;
}
}
}
.approval-notes {
width: 100%;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
.reject-btn {
border-color: #409eff;
color: #409eff;
background: white;
&:hover {
background: #ecf5ff;
}
}
.approve-btn {
background: #409eff;
border-color: #409eff;
}
}
}
</style>
+735
View File
@@ -0,0 +1,735 @@
<template>
<div class="customer-page">
<!-- 顶部操作栏 -->
<div class="customer-toolbar boxshadow">
<el-button type="primary" @click="goAdd" v-if="hasAuth('crm_customer@add')">
<el-icon><Plus /> </el-icon>
添加
</el-button>
<div class="customer-search-group">
<el-form-item label="关键字:" label-width="70px">
<el-input v-model="searchValue" placeholder="请输入客户名称或电话" />
</el-form-item>
<el-form-item label="国家" label-width="70px">
<el-select v-model="country_id" filterable placeholder="请选择国家">
<el-option
v-for="item in countryOptions"
:key="item.id"
:label="item.cn_addr"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="时间" label-width="70px">
<el-select v-model="selectValue" placeholder="请选择时间" style="width: 120px">
<el-option v-for="v in selectOptions" :key="v.value" :label="v.label" :value="v.value">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<!-- 筛选标签 -->
<div class="customer-tags boxshadow">
<!-- 前3组 -->
<div class="filter-row" v-for="item in visibleTagGroups" :key="item.id">
<span class="filter-label">{{ item.name }}</span>
<div class="filter-tags">
<span
:class="['tag-itemall', { 'tag-active': tagActiveMap[item.id] === '' }]"
@click="handleTagClick(item.id, '')"
>全部</span
>
<span
class="tag-items"
v-for="item1 in item.tags"
:key="item1.id"
@click="handleTagClick(item.id, item1.id)"
>
<span :class="['tag-item', { 'tag-active': tagActiveMap[item.id] === item1.id }]">
{{ item1.name }}
</span>
<el-badge :value="item1.count" :max="99" class="itemtag" type="primary"> </el-badge>
</span>
</div>
</div>
<!-- 更多 -->
<transition name="fade">
<div v-if="showMore">
<div class="filter-row" v-for="item in moreTagGroups" :key="item.id">
<span class="filter-label">{{ item.name }}</span>
<div class="filter-tags">
<span
:class="['tag-itemall', { 'tag-active': tagActiveMap[item.id] === '' }]"
@click="handleTagClick(item.id, '')"
>全部</span
>
<span
class="tag-items"
v-for="item1 in item.tags"
:key="item1.id"
@click="handleTagClick(item.id, item1.id)"
>
<span :class="['tag-item', { 'tag-active': tagActiveMap[item.id] === item1.id }]">
{{ item1.name }}
</span>
<el-badge :value="item1.count" :max="99" class="itemtag" type="primary"> </el-badge>
</span>
</div>
</div>
</div>
</transition>
<div class="filter-more-btn" v-if="moreTagGroups.length">
<el-link underline="never" @click="showMore = !showMore">
{{ showMore ? '收起' : '更多' }}
<i v-if="showMore" class="iconfont-sys"> &#xe864;</i>
<i v-else class="iconfont-sys">&#xe867;</i>
</el-link>
</div>
</div>
<div class="boxshadow">
<!-- Tab切换 -->
<div class="customer-toolbar">
<el-tabs v-model="activeTab" class="customer-tabs" style="flex: 1">
<el-tab-pane label="全部" name=""></el-tab-pane>
<el-tab-pane label="跟进中" name="0"></el-tab-pane>
<el-tab-pane label="已成交" name="1"></el-tab-pane>
<el-tab-pane label="已丢失" name="2"></el-tab-pane>
</el-tabs>
<div>
<el-form-item label="" label-width="70px">
<el-cascader :options="options" clearable v-model="shots" />
<!-- <el-select v-model="selectValue" placeholder="排序方式" style="width: 120px">
<el-option v-for="v in sortList" :key="v.value" :label="v.label" :value="v.value">
</el-option>
</el-select> -->
</el-form-item>
</div>
</div>
<!-- 表格 -->
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
lass="customer-table"
>
<template #default>
<el-table-column
prop="code"
label="编号"
align="center"
width="170px"
show-overflow-tooltip
/>
<el-table-column prop="contacts" label="客户名称" align="center" />
<el-table-column prop="magnitude_txt" label="客户商机" align="center" />
<el-table-column prop="channel_name" label="渠道" align="center" />
<el-table-column prop="country_name" label="国家" align="center" />
<!-- <el-table-column prop="phone" label="电话" align="center" /> -->
<!-- <el-table-column prop="WhatsApp" label="WhatsApp" align="center" /> -->
<!-- <el-table-column prop="email" label="邮箱" align="center" /> -->
<el-table-column prop="follow" label="联系方式" width="240px" show-overflow-tooltip>
<template #default="scope">
<div
>WhatsApp:{{
scope.row.WhatsApp == '' ? ' --' : '【' + scope.row.WhatsApp + ' 】'
}}</div
>
<div>电话:{{ scope.row.phone == '' ? ' --' : '【' + scope.row.phone + ' 】' }}</div>
<div>邮箱:{{ scope.row.email == '' ? ' --' : '【' + scope.row.email + ' 】' }}</div>
</template>
</el-table-column>
<el-table-column prop="grade_txt" label="等级" align="center" />
<!-- <el-table-column prop="follow" label="状态" align="center">
<template #default="scope">
<span :class="statusClass(scope.row.follow)">
{{ scope.row.follow_txt }}
</span>
</template>
</el-table-column> -->
<el-table-column prop="follow_last" label="上次跟进"></el-table-column>
<el-table-column prop="follow_next" label="下次跟进"></el-table-column>
<el-table-column prop="enter_user_name" label="录单人"></el-table-column>
<el-table-column prop="describe" label="备注" align="center" />
<el-table-column prop="created_at" label="创建时间"></el-table-column>
<el-table-column fixed="right" label="操作" width="200px" align="center">
<template #default="scope">
<el-link
type="success"
underline="never"
style="margin-right: 8px"
@click="onDetail(scope.row)"
v-if="hasAuth('crm_customer@show')"
>
<i class="iconfont-sys"> &#xe70f;</i>详情
</el-link>
<el-link
type="primary"
underline="never"
style="margin-right: 8px"
@click="goEdit(scope.row)"
v-if="hasAuth('crm_customer@show')"
>
<i class="iconfont-sys"> &#xe70f;</i>查看
</el-link>
<el-link
type="primary"
underline="never"
style="margin-right: 8px"
@click="goAddFollow(scope.row)"
v-if="hasAuth('crm_customer@follow_add')"
>
<i class="iconfont-sys">&#xe6bf;</i> 跟进
</el-link>
<el-link
type="warning"
underline="never"
@click="reportfn(scope.row)"
style="margin-right: 8px"
>
<i class="iconfont-sys">&#xe701;</i> 标记无效
</el-link>
<el-link
type="danger"
underline="never"
@click="delectfn(scope.row)"
style="margin-right: 8px"
v-if="hasAuth('crm_customer@remove')"
>
<i class="iconfont-sys">&#xe893;</i> 移除
</el-link>
<el-link
type="danger"
underline="never"
@click="crmdelectfn(scope.row)"
v-if="hasAuth('crm_customer@delete')"
>
<i class="iconfont-sys">&#xe6d4;</i> 删除
</el-link>
</template>
</el-table-column>
</template>
</ArtTable>
</div>
</div>
<el-dialog v-model="detailDialogVisible" title="详情">
<div class="detail-info-table">
<div class="row">
<div>客户名称:{{ detailRow.contacts }}</div>
<div>电话:{{ detailRow.phone }}</div>
<div>国家:{{ detailRow.country_name }}</div>
</div>
<div class="row">
<div>渠道:{{ detailRow.channel_name }}</div>
<div>邮箱:{{ detailRow.email }}</div>
<div>WhatsApp:{{ detailRow.WhatsApp }}</div>
</div>
<div class="row">
<div>发布人:{{ detailRow.enter_user_name }}</div>
<div>跟单人:{{ detailRow.user_name }}</div>
<div>录单时间:{{ detailRow.created_at }}</div>
</div>
<div class="row">
<div>
等级:
<span>
{{ detailRow.magnitude_txt }}
</span>
</div>
<div>
状态:<span>{{ detailRow.grade_txt }}</span>
</div>
<div>
跟进状态:<span>{{ detailRow.follow_txt }}</span>
</div>
</div>
<div class="row">
<div>备注:{{ detailRow.describe }}</div>
</div>
</div>
<div v-if="detailRow.desc_collect != '' && detailRow.desc_collect != 'null'" class="dtitle"
>详情内容</div
>
<div
v-if="detailRow.desc_collect != '' && detailRow.desc_collect != 'null'"
v-html="detailRow.desc_collect"
class="detils-content"
></div>
</el-dialog>
<el-dialog v-model="reportDialogVisible" title="标记无效" width="600px">
<el-form :model="reportForm" label-width="80px">
<el-form-item label="描述">
<el-input
v-model="reportForm.desc"
type="textarea"
:rows="4"
placeholder="请输入无效原因或说明"
/>
</el-form-item>
<el-form-item label="附件">
<el-upload
v-model:file-list="reportFileList"
:headers="uploadHeaders"
:action="reportUploadAction"
multiple
:limit="9"
:on-success="handleReportUploadSuccess"
:on-exceed="handleReportExceed"
:on-remove="removeReportFile"
>
<el-button type="primary">上传附件</el-button>
<!-- <template #tip>
<div class="el-upload__tip">支持图片、视频或文件</div>
</template> -->
</el-upload>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="reportDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitReport">确定</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from 'vue'
import { Plus } from '@element-plus/icons-vue'
import { CrmService } from '@/api/crmApi'
import { useAuth } from '@/composables/useAuth'
import { useUploadHeaders } from '@/composables/useUploadHeaders'
const { hasAuth } = useAuth()
const searchValue = ref('')
const selectValue = ref('')
const activeTab = ref('')
const country_id = ref('')
const showMore = ref(false)
const loading = ref(false)
const detailDialogVisible = ref(false)
const detailRow = ref<any>(null)
const reportDialogVisible = ref(false)
const reportForm = reactive({ id: '', desc: '' })
const reportFileList = ref<any[]>([])
const { uploadHeaders } = useUploadHeaders()
const reportUploadAction = `${import.meta.env.VITE_API_URL}/ticket/upload`
const pagination = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
const selectOptions = [
{ label: '全部', value: '' },
{ label: '当天', value: '0' },
{ label: '近三天', value: '1' },
{ label: '近七天', value: '2' }
]
const shots = ref([])
const options = ref<
Array<{
label: string
value: string
children: Array<{ label: string; value: string }>
}>
>([
{ label: '默认排序', value: 'id', children: [] },
{ label: '最后跟进', value: 'follow_last', children: [] },
{ label: '下次跟进', value: 'follow_next', children: [] },
{ label: '标签组', value: 'tag_group', children: [] }
])
const countryOptions = ref<any>()
//国家
const getarea = async () => {
try {
// 这里调用获取品牌列表的接口
const res = await CrmService.getCountry()
countryOptions.value = res||[]
} catch (error) { countryOptions.value = [] }
}
// 获取列表数据
const tagActiveMap = reactive<{ [groupId: string]: string }>({})
//获取标签
type TagGroup = { id: string; name: string; tags: { id: string; name: string; count: number }[] }
const tagGroups = ref<TagGroup[]>([])
const tagGrouplistfn = async () => {
const res = await CrmService.tagGrouplist({ scene: 'customers' })
tagGroups.value = res || []
tagGroups.value.forEach((group) => {
if (group.tags && Array.isArray(group.tags)) {
tagActiveMap[group.id] = ''
}
})
options.value[3].children = tagGroups.value.map((group) => ({
label: group.name,
value: group.id
}))
}
// 计算前3组和更多组
// eslint-disable-next-line vue/valid-define-props
defineProps()
const visibleTagGroups = computed(() => tagGroups.value.slice(0, 3))
const moreTagGroups = computed(() => tagGroups.value.slice(3))
// 表格数据
const tableData = ref<any[]>([])
onMounted(() => {
getarea()
gettableList()
tagGrouplistfn()
})
// tabs 切换联动
watch([activeTab, searchValue, selectValue, country_id, shots], () => {
console.log('tabs 联动' + shots.value)
pagination.currentPage = 1
gettableList()
})
const gettableList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const params: any = {
current: currentPage,
size: pageSize
}
if (searchValue.value) params.keyword = searchValue.value
if (selectValue.value) params.follow_last = selectValue.value
if (country_id.value) params.country_id = country_id.value
if (activeTab.value && activeTab.value !== '') params.follow = activeTab.value
if (shots.value.length > 0) {
params.sort = shots.value[0]
if (shots.value[0] == 'tag_group') {
params.sort_id = shots.value[1]
}
}
// 标签参数,所有选中的标签id组成数组
const selectedTagIds = Object.values(tagActiveMap).filter(Boolean)
if (selectedTagIds.length) {
params.tag_id = selectedTagIds
}
console.log(params)
const { data, current, size, total } = await CrmService.getcustomerList(params)
tableData.value = data.map((item: any) => ({
...item
}))
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取用户列表失败:', error)
} finally {
loading.value = false
}
}
// 处理表格分页变化
const handleSizeChange = (newPageSize: number) => {
pagination.pageSize = newPageSize
gettableList()
}
const handleCurrentChange = (newCurrentPage: number) => {
pagination.currentPage = newCurrentPage
gettableList()
}
function statusClass(status: any) {
if (status === 0) return 'status-following'
if (status === 1) return 'status-dealed'
if (status === 2) return 'status-lost'
return ''
}
const router = useRouter()
function goAdd() {
router.push('/crmpc/customer/add')
}
function goEdit(row: any) {
router.push({
path: '/crmpc/customer/show',
query: { id: row.id }
})
}
function goAddFollow(row: any) {
router.push({
path: '/crmpc/customer/followadd',
query: { id: row.id } // 可带客户名等参数
})
}
// 标签选中状态,key为组id,值为选中的标签id
function handleTagClick(groupId: string, tagId: string) {
// if (tagActiveMap[groupId] === tagId) {
// tagActiveMap[groupId] = '' // 取消选中
// } else {
tagActiveMap[groupId] = tagId // 选中
// }
pagination.currentPage = 1
gettableList()
}
//删除
const delectfn = (row: any) => {
ElMessageBox.confirm('确定要移除此客户到公海吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
const res = await CrmService.getcustomerdelete({ id: row.id })
ElMessage.success(res?.message || '提交成功!')
gettableList()
// 你可以在这里调用接口或做后续处理
})
.catch(() => {
// 用户点击了取消
})
}
const crmdelectfn = (row: any) => {
ElMessageBox.confirm(
'确定要删除此客户吗?删除后无法恢复,若存在疑问可标记为无效用户或操作移除,将客户移除到公海!',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
const res = await CrmService.crmCustomerDelete({ id: row.id, scene: 'force' })
ElMessage.success(res?.message || '提交成功!')
gettableList()
// 你可以在这里调用接口或做后续处理
})
.catch(() => {
// 用户点击了取消
})
}
// 标记无效
const reportfn = (row: any) => {
reportForm.id = row.id
reportForm.desc = ''
reportFileList.value = []
reportDialogVisible.value = true
}
const handleReportUploadSuccess = (_response: any, _file: any, fileList: any[]) => {
reportFileList.value = fileList
}
const handleReportExceed = () => {
ElMessage.warning('最多可上传 9 个附件')
}
const removeReportFile = (_file: any, fileList: any[]) => {
reportFileList.value = fileList
}
const submitReport = async () => {
const attachments = reportFileList.value
.map((f: any) => f?.response?.data?.file_name)
.filter(Boolean)
const res = await CrmService.customerReport({
id: reportForm.id,
remark: reportForm.desc,
img: attachments
})
ElMessage.success(res?.message || '提交成功!')
reportDialogVisible.value = false
gettableList()
}
function processImages(html: string) {
const parser = new DOMParser()
const doc = parser.parseFromString(html, 'text/html')
doc.querySelectorAll('img').forEach((img) => {
img.style.maxWidth = '100%'
img.style.height = 'auto'
})
return doc.body.innerHTML
}
function onDetail(row: any) {
row.desc_collect = processImages(row.desc_collect) // 处理图片
detailRow.value = row
detailDialogVisible.value = true
}
</script>
<style scoped lang="scss">
.detail-info-table {
padding-left: 15px;
.row {
display: flex;
justify-content: flex-start;
margin-bottom: 6px;
> div {
flex: 1;
min-width: 0;
margin-right: 16px;
overflow: hidden;
font-size: 14px;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.dtitle {
line-height: 40px;
color: #333;
font-size: 16px;
font-weight: bold;
padding-left: 15px;
}
.detils-content {
padding-left: 15px;
img {
max-width: 100% !important;
}
}
:deep(.el-badge) {
--el-badge-size: 16px;
}
.itemtag {
margin-top: -16px;
margin-left: -13px;
}
:deep(.el-table__header th) {
background: #f7f9fa !important;
color: #333;
font-weight: bold;
}
:deep(.el-table__empty-block) {
height: 450px !important;
}
:deep(.el-table__body tr.custom-table-row td) {
border-bottom: 1px solid #f7f9fa !important;
border-right: 1px solid #f7f9fa !important;
}
:deep(.el-table__body tr td:last-child) {
border-right: none !important;
}
:deep(.el-table__body tr:last-child td) {
border-bottom: none !important;
}
:deep(.el-table__header-wrapper th) {
border-bottom: 1px solid #f7f9fa !important;
border-right: 1px solid #f7f9fa !important;
}
:deep(.el-table__header-wrapper th:last-child) {
border-right: none !important;
}
:deep(.el-table) {
border: 1px solid #f7f9fa !important;
border-radius: 6px;
}
.customer-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.customer-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 20px 20px;
background: var(--art-main-bg-color);
}
.customer-search-group {
display: flex;
gap: 12px;
}
.customer-tags {
background: var(--art-main-bg-color);
border-radius: 8px;
padding: 16px 20px;
margin-bottom: 16px;
}
.filter-row {
display: flex;
align-items: center;
margin-bottom: 14px;
}
.filter-label {
width: 120px;
color: #666;
margin-right: 8px;
flex-shrink: 0;
font-size: 14px;
}
.filter-tags {
flex: 1;
color: #333;
font-weight: 500;
font-size: 14px;
}
.customer-tabs {
margin-bottom: 8px;
}
.status-following {
color: #00a43f;
font-weight: bold;
}
.status-dealed {
color: #3471ff;
font-weight: bold;
}
.status-lost {
color: #ff0000;
font-weight: bold;
}
.customer-table {
background: var(--art-main-bg-color);
border-radius: 8px;
margin-top: 0;
}
.filter-more-btn {
text-align: center;
margin-top: 8px;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
.tag-items {
cursor: pointer;
border-radius: 4px;
padding: 5px 10px;
transition: background 0.2s;
min-width: 100px;
display: inline-block;
margin-right: 30px;
}
.tag-item {
border-radius: 4px;
padding: 5px 10px;
}
.tag-itemall {
border-radius: 4px;
padding: 5px 10px;
margin-right: 20px;
}
.tag-active {
background: #3471ff;
color: #fff;
}
.tag-active :deep(.el-badge__content) {
color: #3471ff !important; /* 文字颜色 */
background-color: #fff !important; /* 背景色 */
}
</style>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,157 +0,0 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<div class="toolbar-left">
<ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton>
</div>
<div class="toolbar-right">
<el-input
v-model="keyword"
placeholder="请输入客户名称"
clearable
style="width: 260px"
@keyup.enter="getList"
>
<template #suffix>
<el-icon class="clickable" @click="getList"><Search /></el-icon>
</template>
</el-input>
</div>
</div>
<div class="boxshadow">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="备货单编号" prop="stock_no" min-width="140" />
<ElTableColumn label="阿里订单号/PN号" prop="order_no" min-width="160" />
<ElTableColumn label="客户名称" prop="customer_name" min-width="120" />
<ElTableColumn label="客户来源" prop="customer_source" min-width="120" />
<ElTableColumn label="业务员" prop="salesman" min-width="100" />
<ElTableColumn label="日期" prop="date" min-width="120" />
<ElTableColumn label="补充" prop="remark" min-width="160" />
<ElTableColumn label="状态" prop="status" width="120">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="220" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-button link type="primary" @click="handleView(scope.row)">查看备货单</el-button>
<el-button link type="primary" @click="handleCreateRepair(scope.row)"
>创建终版备货单</el-button
>
<el-button link type="primary" @click="handleView1(scope.row)"
>查看终版备货单</el-button
>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
</div>
</template>
<script setup lang="ts">
import { router } from '@/router'
const loading = ref(false)
const keyword = ref('')
const tableRef = ref()
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
onMounted(() => {
getList()
})
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
})
const getList = async () => {
loading.value = true
try {
// 这里先使用本地假数据占位,等后端接口确定后再切换为真实请求
const mock = Array.from({ length: 8 }).map((_, i) => ({
id: i + 1,
stock_no: `HSAT-JN00${(i + 10).toString().padStart(2, '0')}`,
order_no: 'VCS28762JN2',
customer_name: 'Alicia',
customer_source: '广交会',
salesman: '王玉凯',
date: '2025-08-27',
remark: 'XXXXXXXXXXXX',
status: 1,
}))
tableData.value = mock
pagination.total = 24
} finally {
loading.value = false
}
}
const handleSizeChange = (size: number) => {
pagination.pageSize = size
getList()
}
const handleCurrentChange = (page: number) => {
pagination.currentPage = page
getList()
}
const handleCreate = () => {
// TODO: 跳转到创建备货单页面
router.push('/crmpc/stocking_list/Add')
}
const handleView = (row: any) => {
router.push('/crmpc/stocking_list/show')
// TODO: 跳转或弹窗查看备货单
}
const handleView1 = (row: any) => {
router.push('/crmpc/stocking_list/final_show')
// TODO: 跳转或弹窗查看备货单
}
const handleCreateRepair = (row: any) => {
router.push('/crmpc/stocking_list/final')
// TODO: 跳转创建维修保单
}
</script>
<style scoped lang="scss">
.stocking-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.stocking-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 12px 16px;
background: var(--art-main-bg-color);
}
.toolbar-left {
display: flex;
align-items: center;
gap: 8px;
}
.toolbar-right {
display: flex;
align-items: center;
}
.clickable { cursor: pointer; }
</style>
+68 -52
View File
@@ -11,12 +11,12 @@
</div>
<ElForm :model="baseForm" class="base-form">
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="阿里订单号/PI号">
<ElInput v-model="baseForm.pi_no" placeholder="请输入阿里订单号/PN号" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="日期">
<ElDatePicker
v-model="baseForm.biz_date"
@@ -28,7 +28,7 @@
/>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="清关目的国">
<el-select
v-model="baseForm.clearance_country_id"
@@ -50,7 +50,7 @@
<ElInput v-model="baseForm.clearance_country_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户来源">
<el-select
v-model="baseForm.customer_source_id"
@@ -72,7 +72,7 @@
<ElInput v-model="baseForm.customer_source_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户名称">
<ElInput
v-model="baseForm.customer_snapshot"
@@ -87,7 +87,7 @@
<ElInput v-model="baseForm.customer_id" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户所在国">
<el-select
v-model="baseForm.customer_country_id"
@@ -121,7 +121,7 @@
<div class="items-wrap">
<div class="item-row" v-for="(item, idx) in items" :key="idx">
<ElRow :gutter="12">
<ElCol :span="8">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="车型" label-width="64px">
<ElInput
v-model="item.model_snapshot"
@@ -138,7 +138,7 @@
<ElInput v-model="item.sku_id" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="颜色/外饰" label-width="72px">
<el-select
v-model="item.color_exterior_snapshot"
@@ -161,7 +161,7 @@
<ElInput v-model="item.color_exterior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="颜色/内饰" label-width="72px">
<el-select
v-model="item.color_interior_snapshot"
@@ -184,7 +184,7 @@
<ElInput v-model="item.color_interior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="改装" label-width="52px">
<el-select
v-model="item.modify_ids"
@@ -209,11 +209,11 @@
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="单价" label-width="45px">
<ElInput v-model="item.unit_price" placeholder="请输入单价">
<template #append>
<ElSelect v-model="item.unit_price_currency" style="width: 61px">
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -226,11 +226,11 @@
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="总价" label-width="45px">
<ElInput v-model="item.total_price" placeholder="请输入总价">
<template #append>
<ElSelect v-model="item.total_price_currency" style="width: 61px">
<ElSelect v-model="item.total_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -243,11 +243,11 @@
<ElInput v-model="item.total_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="改装费" label-width="55px">
<ElInput v-model="item.retrofit_fee" placeholder="请输入改装费">
<template #append>
<ElSelect v-model="item.modify_fee_currency" style="width: 61px">
<ElSelect v-model="item.modify_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -260,11 +260,11 @@
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="FOB段运费" label-width="84px">
<ElInput v-model="item.fob_transport_fee" placeholder="请输入FOB段运费">
<template #append>
<ElSelect v-model="item.fob_fee_currency" style="width: 61px">
<ElSelect v-model="item.fob_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -277,11 +277,11 @@
<ElInput v-model="item.fob_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model="item.handling_fee" placeholder="请输入手续费">
<template #append>
<ElSelect v-model="item.helper_fee_currency" style="width: 61px">
<ElSelect v-model="item.helper_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -296,11 +296,11 @@
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="5">
<ElCol :sm="12" :md="12" :lg="5" :xl="5">
<ElFormItem label="港杂费" label-width="60px">
<ElInput v-model="item.port_misc_fee" placeholder="请输入港杂费">
<template #append>
<ElSelect v-model="item.port_fee_currency" style="width: 61px">
<ElSelect v-model="item.port_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -313,16 +313,16 @@
<ElInput v-model="item.port_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model="item.mileage" placeholder="请输入里程" />
</ElFormItem>
</ElCol>
<ElCol :span="5" v-if="(item.mileage ?? 0) <= 0">
<ElCol :sm="12" :md="12" :lg="5" :xl="5" v-if="(item.mileage ?? 0) <= 0">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model="item.official_price" placeholder="请输入官方指导价">
<template #append>
<ElSelect v-model="item.guide_price_currency" style="width: 61px">
<ElSelect v-model="item.guide_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -335,11 +335,11 @@
<ElInput v-model="item.guide_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5" v-else>
<ElCol :sm="12" :md="12" :lg="5" :xl="5" v-else>
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model="item.listing_price" placeholder="请输入挂牌价">
<template #append>
<ElSelect v-model="item.listing_price_currency" style="width: 61px">
<ElSelect v-model="item.listing_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -352,11 +352,11 @@
<ElInput v-model="item.listing_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6" v-if="(item.mileage ?? 0) <= 0">
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-if="(item.mileage ?? 0) <= 0">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model="item.discount_price" placeholder="请输入优惠额">
<template #append>
<ElSelect v-model="item.discount_currency" style="width: 61px">
<ElSelect v-model="item.discount_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -369,11 +369,11 @@
<ElInput v-model="item.discount_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6" v-else>
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-else>
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model="item.reduction_price" placeholder="请输入二手减价">
<template #append>
<ElSelect v-model="item.reduction_price_currency" style="width: 61px">
<ElSelect v-model="item.reduction_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -386,9 +386,14 @@
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="利润" label-width="40px">
<ElInput v-model="item.profit" placeholder="正在计算利润" disabled>
<ElInput
v-model="item.profit"
placeholder="正在计算利润"
:class="Number(item.profit) < 0 ? 'profit-negative' : ''"
disabled
>
<template #append> <span style="font-size: 11px">美元</span></template>
</ElInput>
</ElFormItem>
@@ -407,11 +412,11 @@
</ElRow>
</div>
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="baseForm.total_cif" placeholder="请输入合计到岸价">
<template #append>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 61px">
<ElSelect v-model="baseForm.total_cif_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -424,11 +429,11 @@
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="baseForm.contract_exchange_rate" placeholder="请输入">
<template #append>
<ElSelect v-model="baseForm.contract_exchange_rate_currency" style="width: 61px">
<ElSelect v-model="baseForm.contract_exchange_rate_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -450,12 +455,12 @@
</div>
<ElForm :model="baseForm" class="foot-form">
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="清关人">
<ElInput v-model="baseForm.declarant_name" placeholder="请输入清关人" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="预计发送日">
<ElDatePicker
v-model="baseForm.eta_ship_date"
@@ -467,7 +472,7 @@
/>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="运输方式">
<ElSelect
v-model="baseForm.shipping_method_id"
@@ -488,7 +493,7 @@
<ElInput v-model="baseForm.shipping_method_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="国内收货港">
<ElSelect
v-model="baseForm.domestic_port_id"
@@ -504,7 +509,7 @@
<ElInput v-model="baseForm.domestic_port_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="贸易条款">
<ElSelect
v-model="baseForm.trade_term_id"
@@ -525,7 +530,7 @@
<ElInput v-model="baseForm.trade_term_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="清关目的港">
<ElSelect
v-model="baseForm.clearance_port_id"
@@ -546,9 +551,7 @@
<ElInput v-model="baseForm.clearance_port_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="6">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="最迟到港时间">
<ElDatePicker
v-model="baseForm.latest_arrival_date"
@@ -573,7 +576,7 @@
<div v-for="(payment, idx) in paymentItems" :key="idx" class="payment-item">
<ElForm :model="payment" label-width="55px" class="payment-form">
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="汇款国">
<el-select v-model="payment.remit_country_id" filterable placeholder="请选择汇款国" @change="
(val) =>
@@ -590,7 +593,7 @@
<ElInput v-model="payment.remit_country_name_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="日期">
<ElDatePicker
v-model="payment.remit_date"
@@ -602,7 +605,7 @@
/>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="币种">
<ElSelect v-model="payment.currency_code" placeholder="请选择币种" @change="
(val) => {
@@ -620,7 +623,7 @@
<ElInput v-model="payment.currency_name_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="账户">
<ElSelect v-model="payment.account_id" placeholder="请选择账户" @change="
(val) =>
@@ -637,12 +640,12 @@
<ElInput v-model="payment.account_name_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="汇款人">
<ElInput v-model="payment.remitter_name" placeholder="请选择汇款人" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="金额">
<ElInput v-model="payment.amount" placeholder="请输入金额" />
</ElFormItem>
@@ -926,6 +929,19 @@
gap: 8px;
justify-content: flex-end;
}
/* 利润为负数时,输入文字变红(兼容 Element Plus disabled 样式) */
:deep(.profit-negative .el-input__wrapper) {
color: #ff4d4f !important;
}
:deep(.profit-negative .el-input__inner) {
color: #ff4d4f !important;
-webkit-text-fill-color: #ff4d4f !important; /* 修复 WebKit 在 disabled 下的文本颜色 */
}
:deep(.profit-negative.is-disabled .el-input__wrapper) {
background-color: var(--el-fill-color-blank) !important;
box-shadow: 0 0 0 1px var(--el-input-border-color, #dcdfe6) inset !important;
}
.row-actions span {
font-size: 12px;
cursor: pointer;
+54 -37
View File
@@ -11,12 +11,12 @@
</div>
<ElForm :model="baseForm" class="base-form">
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="阿里订单号/PN号">
<ElInput v-model="baseForm.pi_no" placeholder="请输入阿里订单号/PN号" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="日期">
<ElDatePicker
v-model="baseForm.biz_date"
@@ -28,7 +28,7 @@
/>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="清关目的国">
<el-select
v-model="baseForm.clearance_country_id"
@@ -50,7 +50,7 @@
<ElInput v-model="baseForm.clearance_country_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户来源">
<el-select
v-model="baseForm.customer_source_id"
@@ -72,7 +72,7 @@
<ElInput v-model="baseForm.customer_source_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户名称">
<ElInput
v-model="baseForm.customer_snapshot"
@@ -87,7 +87,7 @@
<ElInput v-model="baseForm.customer_id" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="客户所在国">
<el-select
v-model="baseForm.customer_country_id"
@@ -121,7 +121,7 @@
<div class="items-wrap">
<div class="item-row" v-for="(item, idx) in items" :key="idx">
<ElRow :gutter="12">
<ElCol :span="8">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="车型" label-width="64px">
<ElInput
v-model="item.model_snapshot"
@@ -139,7 +139,7 @@
<ElInput v-model="item.sku_id" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="颜色/外饰" label-width="72px">
<el-select
v-model="item.color_exterior_snapshot"
@@ -162,7 +162,7 @@
<ElInput v-model="item.color_exterior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="颜色/内饰" label-width="72px">
<el-select
v-model="item.color_interior_snapshot"
@@ -185,7 +185,7 @@
<ElInput v-model="item.color_interior_code" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
<ElFormItem label="改装" label-width="52px">
<el-select
v-model="item.modify_ids"
@@ -210,11 +210,11 @@
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="单价" label-width="45px">
<ElInput v-model.number="item.unit_price" placeholder="请输入单价">
<template #append>
<ElSelect v-model="item.unit_price_currency" style="width: 61px">
<ElSelect v-model="item.unit_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -227,11 +227,11 @@
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="总价" label-width="45px">
<ElInput v-model.number="item.total_price" placeholder="请输入总价">
<template #append>
<ElSelect v-model="item.total_price_currency" style="width: 61px">
<ElSelect v-model="item.total_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -244,11 +244,11 @@
<ElInput v-model="item.total_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="改装费" label-width="55px">
<ElInput v-model.number="item.retrofit_fee" placeholder="请输入改装费">
<template #append>
<ElSelect v-model="item.modify_fee_currency" style="width: 61px">
<ElSelect v-model="item.modify_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -261,11 +261,11 @@
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6">
<ElCol :sm="12" :md="12" :lg="5" :xl="4">
<ElFormItem label="FOB段运费" label-width="84px">
<ElInput v-model.number="item.fob_transport_fee" placeholder="请输入FOB段运费">
<template #append>
<ElSelect v-model="item.fob_fee_currency" style="width: 61px">
<ElSelect v-model="item.fob_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -278,11 +278,11 @@
<ElInput v-model="item.fob_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="手续费" label-width="60px">
<ElInput v-model.number="item.handling_fee" placeholder="请输入手续费">
<template #append>
<ElSelect v-model="item.helper_fee_currency" style="width: 61px">
<ElSelect v-model="item.helper_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -297,11 +297,11 @@
</ElCol>
</ElRow>
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="5" :xl="5">
<ElFormItem label="港杂费" label-width="60px">
<ElInput v-model.number="item.port_misc_fee" placeholder="请输入港杂费">
<template #append>
<ElSelect v-model="item.port_fee_currency" style="width: 61px">
<ElSelect v-model="item.port_fee_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -314,16 +314,16 @@
<ElInput v-model="item.port_fee_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="里程" label-width="52px">
<ElInput v-model.number="item.mileage" placeholder="请输入里程" />
</ElFormItem>
</ElCol>
<ElCol :span="5" v-if="(item.mileage ?? 0) <= 0">
<ElCol :sm="12" :md="12" :lg="5" :xl="5" v-if="(item.mileage ?? 0) <= 0">
<ElFormItem label="官方指导价" label-width="85px">
<ElInput v-model.number="item.official_price" placeholder="请输入官方指导价">
<template #append>
<ElSelect v-model="item.guide_price_currency" style="width: 61px">
<ElSelect v-model="item.guide_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -336,11 +336,11 @@
<ElInput v-model="item.guide_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="5" v-else>
<ElCol :sm="12" :md="12" :lg="5" :xl="5" v-else>
<ElFormItem label="挂牌价" label-width="55px">
<ElInput v-model.number="item.listing_price" placeholder="请输入挂牌价">
<template #append>
<ElSelect v-model="item.listing_price_currency" style="width: 61px">
<ElSelect v-model="item.listing_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -353,11 +353,11 @@
<ElInput v-model="item.listing_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6" v-if="(item.mileage ?? 0) <= 0">
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-if="(item.mileage ?? 0) <= 0">
<ElFormItem label="优惠" label-width="52px">
<ElInput v-model.number="item.discount_price" placeholder="请输入优惠额">
<template #append>
<ElSelect v-model="item.discount_currency" style="width: 61px">
<ElSelect v-model="item.discount_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -370,11 +370,11 @@
<ElInput v-model="item.discount_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="6" v-else>
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-else>
<ElFormItem label="二手减价" label-width="72px">
<ElInput v-model.number="item.reduction_price" placeholder="请输入二手减价">
<template #append>
<ElSelect v-model="item.reduction_price_currency" style="width: 61px">
<ElSelect v-model="item.reduction_price_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -387,15 +387,20 @@
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" placeholder="正在计算利润" disabled>
<ElInput
v-model="item.profit"
placeholder="正在计算利润"
:class="Number(item.profit) < 0 ? 'profit-negative' : ''"
disabled
>
<template #append> <span style="font-size: 11px">美元</span></template>
</ElInput>
<ElInput v-model="item.profit_type_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="8">
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
<ElFormItem label="车架号" label-width="70px">
<ElInput v-model.number="item.vin" placeholder="请输入" />
</ElFormItem>
@@ -403,11 +408,11 @@
</ElRow>
</div>
<ElRow :gutter="12">
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model.number="baseForm.total_cif" placeholder="请输入合计到岸价">
<template #append>
<ElSelect v-model="baseForm.total_cif_currency" style="width: 61px">
<ElSelect v-model="baseForm.total_cif_currency" style="width: 64px">
<ElOption
v-for="c in currencyOptions"
:key="c.currency_code"
@@ -420,7 +425,7 @@
<ElInput v-model="baseForm.total_cif_currency_snapshot" type="hidden" />
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="baseForm.contract_exchange_rate" placeholder="请输入" />
</ElFormItem>
@@ -930,6 +935,18 @@
gap: 8px;
justify-content: flex-end;
}
/* 利润为负数时,输入文字变红(兼容 Element Plus disabled 样式) */
:deep(.profit-negative .el-input__wrapper) {
color: #ff4d4f !important;
}
:deep(.profit-negative .el-input__inner) {
color: #ff4d4f !important;
-webkit-text-fill-color: #ff4d4f !important; /* 修复 WebKit 在 disabled 下的文本颜色 */
}
:deep(.profit-negative.is-disabled .el-input__wrapper) {
background-color: var(--el-fill-color-blank) !important;
box-shadow: 0 0 0 1px var(--el-input-border-color, #dcdfe6) inset !important;
}
.row-actions span {
font-size: 12px;
cursor: pointer;
+32 -5
View File
@@ -38,13 +38,22 @@
<ElTableColumn label="客户来源" prop="customer_source_snapshot" min-width="120" />
<ElTableColumn label="业务员" prop="salesperson_snapshot" min-width="100" />
<ElTableColumn label="日期" prop="created_at" min-width="120" />
<ElTableColumn label="补充" prop="remark" min-width="160" />
<ElTableColumn label="状态" prop="status" width="120">
<ElTableColumn label="状态" prop="approval_status">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
<div v-if="scope.row.appro_status">
<div
><span :class="statusClass(scope.row.appro_status.status)">{{
scope.row.appro_status.status_desc ? scope.row.appro_status.status_desc : ''
}}</span>
<span v-if="scope.row.appro_status.name != ''"
>【{{ scope.row.appro_status.name }}】</span
>
</div>
</div>
<div v-else></div>
</template>
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="220" align="center">
<ElTableColumn label="操作" fixed="right" min-width="120" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-button link type="primary" @click="handleView1(scope.row)">查看终版</el-button>
@@ -64,7 +73,11 @@
const { hasAuth } = useAuth()
function statusClass(status: any) {
if (status === 'rejected') return 'status-lost'
if (status === 'approved') return 'status-following'
return 'status-dealed'
}
const loading = ref(false)
const keyword = ref('')
const tableRef = ref()
@@ -146,4 +159,18 @@
align-items: center;
}
.clickable { cursor: pointer; }
.status-following {
color: #00a43f;
font-weight: bold;
}
.status-dealed {
color: #3471ff;
font-weight: bold;
}
.status-lost {
color: #ff0000;
font-weight: bold;
}
</style>
+20 -3
View File
@@ -161,7 +161,7 @@
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
<ElInput v-model="item.profit" disabled :class="Number(item.profit) < 0 ? 'profit-negative' : ''">
<template #append>{{ item.profit_currency }}</template>
</ElInput>
</ElFormItem>
@@ -175,14 +175,14 @@
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
@@ -344,6 +344,11 @@
terms: '',
latest_arrival: ''
})
function statusClass(status: any) {
if (status === 'rejected') return 'status-lost'
if (status === 'approved') return 'status-following'
return 'status-dealed'
}
const payments = ref<any[]>([])
// 合同文件
@@ -672,6 +677,18 @@
font-size: 48px;
color: #ddd;
}
/* 利润为负数时,输入文字变红(兼容 Element Plus disabled 样式) */
:deep(.profit-negative .el-input__wrapper) {
color: #ff4d4f !important;
}
:deep(.profit-negative .el-input__inner) {
color: #ff4d4f !important;
-webkit-text-fill-color: #ff4d4f !important; /* 修复 WebKit 在 disabled 下的文本颜色 */
}
:deep(.profit-negative.is-disabled .el-input__wrapper) {
background-color: var(--el-fill-color-blank) !important;
box-shadow: 0 0 0 1px var(--el-input-border-color, #dcdfe6) inset !important;
}
</style>
+15 -3
View File
@@ -161,7 +161,7 @@
</template>
<ElCol :span="8">
<ElFormItem label="利润" label-width="52px">
<ElInput v-model="item.profit" disabled>
<ElInput v-model="item.profit" disabled :class="Number(item.profit) < 0 ? 'profit-negative' : ''">
<template #append>{{ item.profit_currency }}</template>
</ElInput>
</ElFormItem>
@@ -170,14 +170,14 @@
</div>
<ElRow :gutter="12">
<ElCol :span="5">
<ElCol :span="6">
<ElFormItem label="合计到岸价" label-width="85px">
<ElInput v-model="base.total_cif" disabled>
<template #append>{{ base.total_cif_currency }}</template>
</ElInput>
</ElFormItem>
</ElCol>
<ElCol :span="4">
<ElCol :span="6">
<ElFormItem label="合同汇率" label-width="70px">
<ElInput v-model="base.contract_rate" disabled />
</ElFormItem>
@@ -664,6 +664,18 @@
font-size: 48px;
color: #ddd;
}
/* 利润为负数时,输入文字变红(兼容 Element Plus disabled 样式) */
:deep(.profit-negative .el-input__wrapper) {
color: #ff4d4f !important;
}
:deep(.profit-negative .el-input__inner) {
color: #ff4d4f !important;
-webkit-text-fill-color: #ff4d4f !important; /* 修复 WebKit 在 disabled 下的文本颜色 */
}
:deep(.profit-negative.is-disabled .el-input__wrapper) {
background-color: var(--el-fill-color-blank) !important;
box-shadow: 0 0 0 1px var(--el-input-border-color, #dcdfe6) inset !important;
}
</style>
-159
View File
@@ -1,159 +0,0 @@
<template>
<div class="stocking-page">
<div class="stocking-toolbar boxshadow">
<div class="toolbar-left">
<!-- <ElButton type="primary" v-ripple @click="handleCreate">创建备货单</ElButton> -->
</div>
<div class="toolbar-right">
<el-input
v-model="keyword"
placeholder="请输入客户名称"
clearable
style="width: 260px"
@keyup.enter="getList"
>
<template #suffix>
<el-icon class="clickable" @click="getList"><Search /></el-icon>
</template>
</el-input>
</div>
</div>
<div class="boxshadow">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="备货单编号" prop="stock_no" min-width="140" />
<ElTableColumn label="阿里订单号/PN号" prop="order_no" min-width="160" />
<ElTableColumn label="客户名称" prop="customer_name" min-width="120" />
<ElTableColumn label="客户来源" prop="customer_source" min-width="120" />
<ElTableColumn label="业务员" prop="salesman" min-width="100" />
<ElTableColumn label="日期" prop="date" min-width="120" />
<ElTableColumn label="补充" prop="remark" min-width="160" />
<ElTableColumn label="状态" prop="status" width="120">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="220" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
<el-button link type="primary" @click="handleView(scope.row)">查看备货单</el-button>
<el-button link type="primary" @click="handleCreateRepair(scope.row)"
>创建终版备货单</el-button
>
<el-button link type="primary" @click="handleView1(scope.row)"
>查看终版备货单</el-button
>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
</div>
</template>
<script setup lang="ts">
import { router } from '@/router'
import { manageService } from '@/api/adminApi'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
const loading = ref(false)
const keyword = ref('')
const tableRef = ref()
const tableData = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
onMounted(() => {
getList()
})
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
})
const getList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const params = {
current: currentPage,
size: pageSize,
is_final: 0, // 只获取备货单,非终版
keyword: keyword.value
}
const { records, current, size, total } = await manageService.getstocklist(params)
tableData.value = records || []
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取列表失败:', error)
} finally {
loading.value = false
}
}
const handleSizeChange = (size: number) => {
pagination.pageSize = size
getList()
}
const handleCurrentChange = (page: number) => {
pagination.currentPage = page
getList()
}
const handleCreate = () => {
// TODO: 跳转到创建备货单页面
router.push('/crmpc/stocking_list/Add')
}
const handleView = (row: any) => {
router.push('/crmpc/stocking_list/show')
// TODO: 跳转或弹窗查看备货单
}
const handleView1 = (row: any) => {
router.push('/crmpc/stocking_list/final_show')
// TODO: 跳转或弹窗查看备货单
}
const handleCreateRepair = (row: any) => {
router.push('/crmpc/stocking_list/final')
// TODO: 跳转创建维修保单
}
</script>
<style scoped lang="scss">
.stocking-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.stocking-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 12px 16px;
background: var(--art-main-bg-color);
}
.toolbar-left {
display: flex;
align-items: center;
gap: 8px;
}
.toolbar-right {
display: flex;
align-items: center;
}
.clickable { cursor: pointer; }
</style>
+60 -17
View File
@@ -38,12 +38,20 @@
<ElTableColumn label="客户来源" prop="customer_source_snapshot" />
<ElTableColumn label="业务员" prop="salesperson_snapshot" />
<ElTableColumn label="日期" prop="created_at" />
<ElTableColumn label="补充" prop="remark" />
<!-- <ElTableColumn label="状态" prop="status" width="120">
<!-- <ElTableColumn label="补充" prop="remark" /> -->
<ElTableColumn label="状态" prop="approval_status">
<template #default="scope">
<ElTag type="success">备货完成</ElTag>
<div v-if="scope.row.appro_status">
<div
><span :class="statusClass(scope.row.appro_status.status)">{{ scope.row.appro_status.status_desc ? scope.row.appro_status.status_desc : '' }}</span>
<span v-if="scope.row.appro_status.name != ''"
>【{{ scope.row.appro_status.name }}】</span
>
</div>
</div>
<div v-else></div>
</template>
</ElTableColumn> -->
</ElTableColumn>
<ElTableColumn label="操作" fixed="right" min-width="120" align="center">
<template #default="scope">
<ElRow :gutter="10" justify="center">
@@ -53,7 +61,7 @@
@click="printfn(scope.row)"
style="margin-right: 8px"
>
<i class="iconfont-sys">&#xe782;</i> 打印
<i class="iconfont-sys">&#xe782;</i> 打印预览
</el-link>
<el-link
type="success"
@@ -87,17 +95,33 @@
</div>
<!-- PDF 预览弹窗 -->
<el-dialog v-model="pdf.visible" title="打印预览" width="80%" top="40px" :close-on-click-modal="false">
<div style="height: 70vh; display: flex; flex-direction: column; gap: 12px;">
<div style="display:flex; justify-content:flex-end; gap: 8px;">
<!-- <el-button type="primary" @click="print()">打印</el-button> -->
<el-dialog
v-model="pdf.visible"
title="打印预览"
width="80%"
top="40px"
:close-on-click-modal="false"
>
<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>
</div>
<div
v-if="pdf.images.length"
style="overflow: auto; border: 1px solid #eee; border-radius: 6px; padding: 8px"
>
<img
v-for="(img, idx) in pdf.images"
:key="idx"
:src="img"
style="display: block; width: 100%; margin-bottom: 8px; background: #fff"
/>
</div>
<iframe
v-if="pdf.blobUrl || pdf.url"
v-else-if="pdf.blobUrl || pdf.url"
ref="frameRef"
:src="pdf.blobUrl || pdf.url"
style="flex:1; width: 100%; border: 1px solid #eee; border-radius: 6px;"
style="flex: 1; width: 100%; border: 1px solid #eee; border-radius: 6px;"
/>
</div>
</el-dialog>
@@ -108,10 +132,8 @@
import { router } from '@/router'
import { CrmService } from '@/api/crmApi'
import { usePdfPreview } from '@/composables/usePdfPreview'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
// import { useAuth } from '@/composables/useAuth'
// const { hasAuth } = useAuth()
const loading = ref(false)
const keyword = ref('')
@@ -120,12 +142,16 @@
const pagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
// PDF 预览/打印(公共)
const { pdf, frameRef, openWithResponse, download, print, preparePreview } = usePdfPreview()
const { pdf, frameRef, openWithResponse, download, print, preparePreview, prepareImages } = usePdfPreview()
onMounted(() => {
getList()
})
function statusClass(status: any) {
if (status === 'rejected') return 'status-lost'
if (status === 'approved') return 'status-following'
return 'status-dealed'
}
watch([keyword], () => {
pagination.currentPage = 1
// 不自动请求,保持与截图行为一致,点击搜索或回车触发
@@ -192,6 +218,9 @@
CrmService.printStock({ id: row.id })
.then((res) => {
openWithResponse(res)
// 优先转成图片以适配不带插件的环境
prepareImages()
// 同时保留 blob 预览作为兜底
preparePreview()
})
.catch((err) => {
@@ -223,5 +252,19 @@
align-items: center;
}
.clickable { cursor: pointer; }
.status-following {
color: #00a43f;
font-weight: bold;
}
.status-dealed {
color: #3471ff;
font-weight: bold;
}
.status-lost {
color: #ff0000;
font-weight: bold;
}
</style>
+82 -13
View File
@@ -111,6 +111,48 @@
<ElFormItem label="邮箱" prop="email">
<ElInput v-model="form.email" :disabled="!isEdit" />
</ElFormItem>
<ElFormItem label="签名" prop="signature" class="right-input">
<template v-if="form.sign_img">
<img :src="sign_img_url" class="signature-img" />
<el-button
v-if="isEdit"
style="margin-left: 12px"
@click="showReSignQR = !showReSignQR"
>
重新签名
</el-button>
<div
v-if="isEdit && showReSignQR"
class="signature-qrcode"
style="margin-top: 20px; margin-left: 20px"
>
<qrcode-vue
:value="qrcodeUrl"
:size="120"
level="L"
render-as="svg"
:include-margin="false"
background="#ffffff"
foreground="#111111"
/>
<div class="qrcode-tip">手机扫码重新签名</div>
</div>
</template>
<template v-else>
<div class="signature-qrcode">
<qrcode-vue
:value="qrcodeUrl"
:size="120"
level="L"
render-as="svg"
:include-margin="false"
background="#ffffff"
foreground="#111111"
/>
<div class="qrcode-tip">手机扫码进行签名</div>
</div>
</template>
</ElFormItem>
</ElRow>
<ElRow>
<ElFormItem
@@ -210,6 +252,8 @@
import { ElForm, FormInstance } from 'element-plus'
import imageUrl from '@/assets/img/crm/upimg.png'
import { CrmService } from '@/api/crmApi'
import { useUserStore } from '@/store/modules/user'
import QrcodeVue from 'qrcode.vue'
import { useUploadHeaders } from '@/composables/useUploadHeaders'
const { uploadHeaders } = useUploadHeaders()
let actionImageUplode = `${import.meta.env.VITE_API_URL}/ticket/upload`
@@ -221,17 +265,20 @@
const imageUrls = ref(imageUrl)
const imageUrlavatar = ref('')
const socialize_pic_full = ref('')
const sign_img_url = ref('')
const countryOptions = ref<any>()
const form = ref<CustomerInfo>({})
//获取公司 getCompanyList
const companyList = ref<any>()
// const companyList = ref<any>()
//国家
const getarea = async () => {
try {
// 这里调用获取品牌列表的接口
const res = await CrmService.getCountry()
countryOptions.value = res||[]
} catch (error) { countryOptions.value = [] }
countryOptions.value = res || []
} catch {
countryOptions.value = []
}
}
const userInfo = ref<CustomerInfo>({})
const getuserInfo = async () => {
@@ -240,10 +287,11 @@
form.value = data
imageUrlavatar.value = data.avatar_full
socialize_pic_full.value = data.socialize_pic_full
sign_img_url.value = data.sign_img_url
}
const isEdit = ref(false)
const showReSignQR = ref(false)
const isEditPwd = ref(false)
const pwdForm = reactive({
password: '',
@@ -286,18 +334,22 @@
await getarea()
await getuserInfo()
})
const edit = async() => {
if(isEdit.value){
const res = await CrmService.crmuseredit(form.value)
const edit = async () => {
if (isEdit.value) {
const payload: any = { ...(form.value as any) }
delete payload.sign_img_url
const res = await CrmService.crmuseredit(payload)
ElMessage.success(res?.message || '操作成功')
getuserInfo()
}
isEdit.value = !isEdit.value
if (!isEdit.value) {
showReSignQR.value = false
}
}
const editPwd = async() => {
if(isEditPwd.value){
const editPwd = async () => {
if (isEditPwd.value) {
// 判断新密码和确认密码是否一致
if (pwdForm.password_new !== pwdForm.confirmPassword) {
ElMessage.error('新密码和确认密码不一致')
@@ -325,6 +377,20 @@
form.value.socialize_pic = response.url || (response.data && response.data.file_name) || ''
}
const qrcodeUrl = computed(() => {
const userStore = useUserStore() as any
const userId = (form.value as any)?.id || (userInfo.value as any)?.id || ''
const base = location.origin
const params = new URLSearchParams({ userId: String(userId) })
if (userStore?.accessToken) params.append('accessToken', userStore.accessToken)
if (userStore?.language) params.append('lang', userStore.language)
if (userStore?.companyabbr) params.append('companyabbr', userStore.companyabbr)
if (userStore?.companyid) params.append('companyid', userStore.companyid)
if (userStore?.loginType) params.append('loginType', userStore.loginType)
if (userStore?.systemsabbr) params.append('systemsabbr', userStore.systemsabbr)
if (userStore?.systemsid) params.append('systemsid', userStore.systemsid)
return `${base}/auth/signature/mobile?${params.toString()}`
})
</script>
<style lang="scss">
@@ -340,7 +406,7 @@
</style>
<style lang="scss" scoped>
:deep(.qrcode-radio-group .el-form-item__content){
:deep(.qrcode-radio-group .el-form-item__content) {
height: 40px;
}
.avatar {
@@ -349,7 +415,7 @@
border-radius: 50%;
object-fit: cover;
}
.qrcode-img{
.qrcode-img {
width: 80px;
height: 80px;
}
@@ -384,7 +450,7 @@
overflow: hidden;
text-align: center;
// background: var(--art-main-bg-color);
background: linear-gradient(180deg, #E9F0FF 0%, #FFFFFF 67.9%);
background: linear-gradient(180deg, #e9f0ff 0%, #ffffff 67.9%);
border-radius: $box-radius;
.avatar {
@@ -542,4 +608,7 @@
}
}
}
.signature-img {
width: 160px;
}
</style>