Commit 94c98ec1 by wusiyi

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

parent 2cd8e045
......@@ -12,9 +12,7 @@ export function getLogisticsCompanyList() {
}
// 获取客户
export function getUserMarkList() {
return axios.get<never, BaseRespData<string[]>>(
'dbDiyUser/getUserMarkList',
)
return axios.get<never, BaseRespData<string[]>>('dbDiyUser/getUserMarkList')
}
// 获取用户
......@@ -35,3 +33,17 @@ export function uploadFileApi(data: FormData) {
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 @@
</div>
<!-- 右侧工具栏 -->
<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
title="格式工具"
style="cursor: pointer"
@click="formatDrawer = true"
title="获取物流面单"
class="tool-item"
@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>
......@@ -196,12 +199,22 @@
</div>
<template #footer>
<span style="display: flex; justify-content: center">
<el-button size="medium" @click="formatDrawer = false">
取 消
</el-button>
<el-button size="medium" type="primary" @click="copy">
拷 贝
</el-button>
<el-button @click="formatDrawer = false"> 取 消 </el-button>
<el-button type="primary" @click="copy"> 拷 贝 </el-button>
</span>
</template>
</el-drawer>
<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>
</template>
</el-drawer>
......@@ -230,6 +243,9 @@ import userUserStore from '@/store/user'
import type { FormRules } from 'element-plus'
import { useValue } from '@/utils/hooks/useValue'
import { changePasswordApi } from '@/api/auth'
import { getLogisticUSApi, getLogisticCNApi } from '@/api/common'
import { filePath } from '@/api/axios'
import { ElMessage } from 'element-plus'
interface MenuItem {
index: string
id: number
......@@ -255,8 +271,10 @@ const userStore = userUserStore()
const userInfo = userStore.user
const dialogVisible = ref(false)
const formatDrawer = ref(false)
const getLogisticDrawer = ref(false)
const textareaT = ref('')
const newTextareaT = ref('')
const content = ref('')
// 密码form
const [passwordForm, resetPasswordForm] = useValue<PasswordForm>(
{} as PasswordForm,
......@@ -470,6 +488,7 @@ const confimTools = (v: string) => {
}
}
// 复制
const copy = () => {
const oInput = document.createElement('input')
oInput.value = newTextareaT.value
......@@ -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(
() => route.path,
......@@ -646,4 +699,16 @@ onUnmounted(() => {
top: 15%;
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>
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