Commit 94c98ec1 by wusiyi

feat: 添加获取物流面单工具

parent 2cd8e045
...@@ -12,9 +12,7 @@ export function getLogisticsCompanyList() { ...@@ -12,9 +12,7 @@ export function getLogisticsCompanyList() {
} }
// 获取客户 // 获取客户
export function getUserMarkList() { export function getUserMarkList() {
return axios.get<never, BaseRespData<string[]>>( return axios.get<never, BaseRespData<string[]>>('dbDiyUser/getUserMarkList')
'dbDiyUser/getUserMarkList',
)
} }
// 获取用户 // 获取用户
...@@ -35,3 +33,17 @@ export function uploadFileApi(data: FormData) { ...@@ -35,3 +33,17 @@ export function uploadFileApi(data: FormData) {
data, data,
) )
} }
// 获取物流面单 US
export function getLogisticUSApi(content: string) {
return axios.get<never, BaseRespData<{ documentUrl: string }>>(
`factory/podJomallOrderUs/getDocument?content=${content}`,
)
}
// 获取物流面单 CN
export function getLogisticCNApi(content: string) {
return axios.get<never, BaseRespData<{ documentUrl: string }>>(
`factory/podJomallOrder/getDocument?content=${content}`,
)
}
...@@ -113,12 +113,15 @@ ...@@ -113,12 +113,15 @@
</div> </div>
<!-- 右侧工具栏 --> <!-- 右侧工具栏 -->
<div class="tool_warper"> <div class="tool_warper">
<div title="格式工具" class="tool-item" @click="formatDrawer = true">
<img src="../assets/images/brush-no.png" width="24" height="24" />
</div>
<div <div
title="格式工具" title="获取物流面单"
style="cursor: pointer" class="tool-item"
@click="formatDrawer = true" @click="getLogisticDrawer = true"
> >
<img src="../assets/images/brush-no.png" width="24" height="24" /> <img src="../assets/images/package.png" width="24" height="24" />
</div> </div>
</div> </div>
</div> </div>
...@@ -196,12 +199,22 @@ ...@@ -196,12 +199,22 @@
</div> </div>
<template #footer> <template #footer>
<span style="display: flex; justify-content: center"> <span style="display: flex; justify-content: center">
<el-button size="medium" @click="formatDrawer = false"> <el-button @click="formatDrawer = false"> 取 消 </el-button>
取 消 <el-button type="primary" @click="copy"> 拷 贝 </el-button>
</el-button> </span>
<el-button size="medium" type="primary" @click="copy"> </template>
拷 贝 </el-drawer>
</el-button> <el-drawer
v-model="getLogisticDrawer"
class="get-logistic-drawer"
title="获取物流面单"
@close="content = ''"
>
<el-input v-model="content" placeholder="请输入单号" clearable />
<template #footer>
<span style="display: flex; justify-content: center">
<el-button @click="getLogisticDrawer = false"> 取 消 </el-button>
<el-button type="primary" @click="getLogistic">查 询</el-button>
</span> </span>
</template> </template>
</el-drawer> </el-drawer>
...@@ -230,6 +243,9 @@ import userUserStore from '@/store/user' ...@@ -230,6 +243,9 @@ import userUserStore from '@/store/user'
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { changePasswordApi } from '@/api/auth' import { changePasswordApi } from '@/api/auth'
import { getLogisticUSApi, getLogisticCNApi } from '@/api/common'
import { filePath } from '@/api/axios'
import { ElMessage } from 'element-plus'
interface MenuItem { interface MenuItem {
index: string index: string
id: number id: number
...@@ -255,8 +271,10 @@ const userStore = userUserStore() ...@@ -255,8 +271,10 @@ const userStore = userUserStore()
const userInfo = userStore.user const userInfo = userStore.user
const dialogVisible = ref(false) const dialogVisible = ref(false)
const formatDrawer = ref(false) const formatDrawer = ref(false)
const getLogisticDrawer = ref(false)
const textareaT = ref('') const textareaT = ref('')
const newTextareaT = ref('') const newTextareaT = ref('')
const content = ref('')
// 密码form // 密码form
const [passwordForm, resetPasswordForm] = useValue<PasswordForm>( const [passwordForm, resetPasswordForm] = useValue<PasswordForm>(
{} as PasswordForm, {} as PasswordForm,
...@@ -470,6 +488,7 @@ const confimTools = (v: string) => { ...@@ -470,6 +488,7 @@ const confimTools = (v: string) => {
} }
} }
// 复制
const copy = () => { const copy = () => {
const oInput = document.createElement('input') const oInput = document.createElement('input')
oInput.value = newTextareaT.value oInput.value = newTextareaT.value
...@@ -485,6 +504,40 @@ const copy = () => { ...@@ -485,6 +504,40 @@ const copy = () => {
}) })
} }
// 获取物流面单
const getLogistic = () => {
if (!content.value) {
ElMessage.warning('请输入单号')
return
}
// 按_分割字符串
const parts = content.value.split('_')
// 检查是否有足够的_分隔符
if (parts.length < 4) {
ElMessage.error('单号格式错误,请检查输入')
return
}
// 获取第三个_后面的内容
const thirdPart = parts[3]
if (thirdPart.startsWith('USPSC')) {
// 美国物流
getLogisticUSApi(content.value).then((res) => {
if (res.code === 200) {
window.open(filePath + res.data.documentUrl, '_blank')
}
})
} else if (thirdPart.startsWith('JMPSC')) {
// 中国物流
getLogisticCNApi(content.value).then((res) => {
if (res.code === 200) {
window.open(filePath + res.data.documentUrl, '_blank')
}
})
} else {
ElMessage.error('单号格式错误,请检查输入')
}
}
// 监听路由变化,自动添加标签 // 监听路由变化,自动添加标签
watch( watch(
() => route.path, () => route.path,
...@@ -646,4 +699,16 @@ onUnmounted(() => { ...@@ -646,4 +699,16 @@ onUnmounted(() => {
top: 15%; top: 15%;
right: 40px; right: 40px;
} }
::v-deep(.get-logistic-drawer.el-drawer.rtl) {
height: 20% !important;
top: 35% !important;
}
.tool-item {
width: 24px;
height: 24px;
cursor: pointer;
margin-bottom: 10px;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment