Commit eac2d845 by linjinhong

Merge remote-tracking branch 'origin/master' into lin-task

parents 15fd2ba6 f08a0ccd
......@@ -60,6 +60,12 @@ export function getFilePath() {
import.meta.env.VITE_API_BASE_URL + import.meta.env.VITE_API_BASE_UPLOAD_URL
)
}
export function getFileCnPath() {
if (!/(http|https):\/\/([^/]+)/i.test(import.meta.env.BASE_URL)) {
return location.origin
}
return import.meta.env.VITE_API_BASE_URL
}
export function getWsUrl() {
if (location.protocol === 'https:') {
return 'wss://' + location.host
......@@ -68,5 +74,6 @@ export function getWsUrl() {
}
}
export const filePath = getFilePath()
export const FileCnPath = getFileCnPath()
export default axios
......@@ -34,14 +34,14 @@ export function uploadFileApi(data: FormData) {
)
}
// 获取物流面单 US
// 打印物流面单 US
export function getLogisticUSApi(content: string) {
return axios.get<never, BaseRespData<{ documentUrl: string }>>(
`factory/podJomallOrderUs/getDocument?content=${content}`,
)
}
// 获取物流面单 CN
// 打印物流面单 CN
export function getLogisticCNApi(content: string) {
return axios.get<never, BaseRespData<{ documentUrl: string }>>(
`factory/podJomallOrder/getDocument?content=${content}`,
......
......@@ -481,7 +481,7 @@ export function batchDownloadDownloadApi(params: { id: number; type: string }) {
}
// 批量下载 删除
export function batchDownloadDeleteApi(params: { id: number }) {
export function batchDownloadDeleteApi(params: { ids?: string }) {
return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/delete`,
{
......@@ -543,3 +543,13 @@ export function statusPushApi(params: (string | number)[]) {
params,
)
}
// 完成发货
export function completeDeliveryApi(params: {
orderIdList: (string | number)[]
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/completeDelivery`,
params,
)
}
......@@ -117,11 +117,11 @@
<img src="../assets/images/brush-no.png" width="24" height="24" />
</div>
<div
title="获取物流面单"
title="打印物流面单"
class="tool-item"
@click="getLogisticDrawer = true"
>
<img src="../assets/images/package.png" width="24" height="24" />
<img src="../assets/images/printer.png" width="24" height="24" />
</div>
</div>
</div>
......@@ -206,17 +206,31 @@
</el-drawer>
<el-drawer
v-model="getLogisticDrawer"
direction="btt"
class="get-logistic-drawer"
title="获取物流面单"
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>
<ElSelect
v-model="sheetPrinter"
placeholder="请选择打印机"
@change="handlePrinterChange"
style="width: 200px; margin-right: 10px"
>
<ElOption
v-for="item in printDeviceList"
:key="item"
:label="item"
:value="item"
/>
</ElSelect>
<el-input
v-model="content"
placeholder="请输入单号"
style="width: 300px; margin-right: 10px"
clearable
/>
<el-button type="primary" @click="getLogistic">查 询</el-button>
</el-drawer>
</span>
</template>
......@@ -240,11 +254,14 @@ import {
import { useRoute, useRouter } from 'vue-router'
import Menu from '@/router/menu'
import userUserStore from '@/store/user'
import type { FormRules } from 'element-plus'
import { useValue } from '@/utils/hooks/useValue'
import useLodop from '@/utils/hooks/useLodop'
import { changePasswordApi } from '@/api/auth'
import { getLogisticUSApi, getLogisticCNApi } from '@/api/common'
import { filePath } from '@/api/axios'
import { filePath, FileCnPath } from '@/api/axios'
import { ElMessage } from 'element-plus'
interface MenuItem {
index: string
......@@ -272,6 +289,9 @@ const userInfo = userStore.user
const dialogVisible = ref(false)
const formatDrawer = ref(false)
const getLogisticDrawer = ref(false)
const printDeviceList = ref<string[]>([])
const sheetPrinter = ref('')
const textareaT = ref('')
const newTextareaT = ref('')
const content = ref('')
......@@ -504,7 +524,31 @@ const copy = () => {
})
}
// 获取物流面单
const { getCLodop } = useLodop()
const initPrintDevice = () => {
const lodop = getCLodop(null, null)
if (!lodop) return
const arr = []
// 获取打印机数量
const length = lodop.GET_PRINTER_COUNT()
for (let i = 0; i < length; i++) {
// 根据设备序号获取设备名
const name = lodop.GET_PRINTER_NAME(i)
arr.push(name)
}
// 获取默认打印机
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr
}
// 处理打印机选择变化,保存到 localStorage
const handlePrinterChange = (value: string) => {
sheetPrinter.value = value
localStorage.setItem('sheetPrinter', JSON.stringify(value))
}
// 打印物流面单
const getLogistic = () => {
if (!content.value) {
ElMessage.warning('请输入单号')
......@@ -530,7 +574,7 @@ const getLogistic = () => {
// 中国物流
getLogisticCNApi(content.value).then((res) => {
if (res.code === 200) {
window.open(filePath + res.data.documentUrl, '_blank')
window.open(FileCnPath + res.data.documentUrl, '_blank')
}
})
} else {
......@@ -547,6 +591,24 @@ watch(
{ immediate: true },
)
watch(getLogisticDrawer, async (value: boolean) => {
if (value) {
initPrintDevice()
const locaclPrinter = localStorage.getItem('sheetPrinter')
if (locaclPrinter) {
const savedPrinter = JSON.parse(locaclPrinter)
// 检查保存的打印机是否在当前打印机列表中
if (printDeviceList.value.includes(savedPrinter)) {
sheetPrinter.value = savedPrinter
} else {
// 如果保存的打印机不在当前列表中,清空 localStorage 并设置为空
localStorage.removeItem('sheetPrinter')
sheetPrinter.value = ''
}
}
}
})
// 点击标签时切换路由
watch(activeTab, (newTab) => {
if (newTab) {
......@@ -700,9 +762,11 @@ onUnmounted(() => {
top: calc(50% - 325px) !important;
}
::v-deep(.get-logistic-drawer.el-drawer.rtl) {
height: 200px !important;
top: calc(50% - 100px) !important;
::v-deep(.get-logistic-drawer.el-drawer.btt) {
height: 120px !important;
width: 700px !important;
top: calc(50% - 60px) !important;
left: calc(50% - 350px) !important;
}
.tool-item {
......
......@@ -29,7 +29,7 @@ let timer: number | undefined
const second = ref(5)
const router = useRouter()
props.showBtn &&
(timer = setInterval(() => {
(timer = window.setInterval(() => {
if (second.value === 0) {
clearInterval(timer)
router.go(-1)
......
......@@ -90,12 +90,26 @@
<p>
{{ detail?.factorySubOrderNumber }}
</p>
<el-icon
v-if="detail?.factorySubOrderNumber"
class="icon"
@click="copy(detail?.factorySubOrderNumber || '')"
>
<DocumentCopy />
</el-icon>
</div>
<div :title="detail?.thirdSubOrderNumber || ''" class="div-item">
<span>第三方生产单号</span>
<p>
{{ detail?.thirdSubOrderNumber }}
</p>
<el-icon
v-if="detail?.thirdSubOrderNumber"
class="icon"
@click="copy(detail?.thirdSubOrderNumber || '')"
>
<DocumentCopy />
</el-icon>
</div>
<div :title="String(detail?.craftName)" class="div-item">
<span>生产工艺</span>
......@@ -125,6 +139,13 @@
<div :title="detail?.shopNumber ?? ''" class="div-item">
<span>店铺单号</span>
<p>{{ detail?.shopNumber ?? '' }}</p>
<el-icon
v-if="detail?.shopNumber"
class="icon"
@click="copy(detail?.shopNumber || '')"
>
<DocumentCopy />
</el-icon>
</div>
<div :title="detail?.createTime" class="div-item">
......@@ -203,6 +224,8 @@ import {
getSubOrderBySubOrderNumber,
downloadMaterialApi,
} from '@/api/podUsOrder'
import { DocumentCopy } from '@element-plus/icons-vue'
import { cardImages, PodOrderRes } from '@/types/api/podUsOrder'
import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios'
......@@ -529,6 +552,28 @@ const trackCodeInput = async () => {
removeFromHistory()
return ElMessage.error('生产单不存在')
}
if (res.data.interceptStatus == 0 || res.data.interceptStatus == 2) {
try {
await ElMessageBox.confirm(
'该生产单已提交至拦截申请,请确认是否继续生产',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
},
)
} catch (error) {
TrackingNumber.value = ''
detail.value = {
id: -1,
podJomallOrderUsId: -1,
imgList: [],
}
trackingNumberRef.value && trackingNumberRef.value.focus()
return
}
}
const d = JSON.parse(JSON.stringify(res.data))
if (d.note) {
......@@ -559,6 +604,15 @@ const trackCodeInput = async () => {
const onOpened = () => {
trackingNumberRef.value && trackingNumberRef.value.focus()
}
const copy = (text: string) => {
try {
navigator.clipboard.writeText(text)
ElMessage.success('复制成功')
} catch (err) {
console.error('复制失败:', err)
}
}
</script>
<style lang="scss" scoped>
.sure-btn {
......
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