Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
5c6a1eab
Commit
5c6a1eab
authored
Aug 13, 2025
by
wusiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 打印物流面单修改
parent
48c61c7d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
273 deletions
+29
-273
src/api/common.ts
+6
-4
src/components/NavMenu.vue
+4
-269
src/components/SideBar.vue
+0
-0
src/types/api/podMakeOrder.ts
+19
-0
No files found.
src/api/common.ts
View file @
5c6a1eab
import
{
BaseRespData
}
from
'@/types/api'
import
axios
from
'./axios'
import
{
LogisticsData
}
from
'@/types/api/order'
import
{
LogisticBill
}
from
'@/types/api/podMakeOrder'
import
{
userData
}
from
'@/types/api/user'
import
{
VersionImageList
}
from
'@/types/api/typesetting'
...
...
@@ -36,14 +38,14 @@ export function uploadFileApi(data: FormData) {
// 打印物流面单 US
export
function
getLogisticUSApi
(
content
:
string
)
{
return
axios
.
get
<
never
,
BaseRespData
<
{
documentUrl
:
string
}
>>
(
`factory/podJomallOrderUs/get
Document?content
=
${
content
}
`
,
return
axios
.
get
<
never
,
BaseRespData
<
LogisticBill
>>
(
`factory/podJomallOrderUs/get
OrderByFactorySubOrderNumber?factorySubOrderNumber
=
${
content
}
`
,
)
}
// 打印物流面单 CN
export
function
getLogisticCNApi
(
content
:
string
)
{
return
axios
.
get
<
never
,
BaseRespData
<
{
documentUrl
:
string
}
>>
(
`factory/podJomallOrder/get
Document?content
=
${
content
}
`
,
return
axios
.
get
<
never
,
BaseRespData
<
LogisticBill
>>
(
`factory/podJomallOrder/get
OrderByThirdSubOrderNumber?thirdSubOrderNumber
=
${
content
}
`
,
)
}
src/components/NavMenu.vue
View file @
5c6a1eab
...
...
@@ -34,6 +34,7 @@
</el-sub-menu>
</template>
</el-menu>
<SideBar
/>
<div
v-if=
"userInfo"
class=
"user-info"
>
<span
class=
"user-avatar"
style=
"color: #fff; font-size: 14px"
>
工厂: {{ userInfo.factoryCode }}
...
...
@@ -111,19 +112,6 @@
<ArrowRight
/>
</el-icon>
</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=
"打印物流面单"
class=
"tool-item"
@
click=
"getLogisticDrawer = true"
>
<img
src=
"../assets/images/printer.png"
width=
"24"
height=
"24"
/>
</div>
</div>
</div>
<el-dialog
v-model=
"dialogVisible"
...
...
@@ -170,81 +158,6 @@
</span>
</
template
>
</el-dialog>
<span>
<el-drawer
v-model=
"formatDrawer"
class=
"format-drawer"
title=
"格式工具"
direction=
"rtl"
size=
"45%"
>
<el-input
v-model=
"textareaT"
style=
"width: 100%"
:rows=
"10"
type=
"textarea"
placeholder=
"请输入"
@
input=
"confimTools"
/>
<div
style=
"
margin-top: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
padding: 10px;
"
>
{{ newTextareaT }}
</div>
<
template
#
footer
>
<span
style=
"display: flex; justify-content: center"
>
<el-button
@
click=
"formatDrawer = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"copy"
>
拷 贝
</el-button>
</span>
</
template
>
</el-drawer>
<el-drawer
v-model=
"getLogisticDrawer"
direction=
"btt"
class=
"get-logistic-drawer"
title=
"打印物流面单"
@
close=
"content = ''"
>
<ElSelect
v-model=
"sheetPrinter"
placeholder=
"请选择打印机"
style=
"width: 200px; margin-right: 10px"
@
change=
"handlePrinterChange"
>
<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
@
keyup
.
enter=
"getLogistic"
/>
<el-button
type=
"primary"
@
click=
"getLogistic"
>
查 询
</el-button>
<el-button
type=
"success"
@
click=
"printLogistic"
>
打印面单
</el-button>
<div
style=
"font-size: 20px; margin-top: 20px; color: #666666"
>
<div
style=
"margin-bottom: 10px; display: flex; gap: 20px"
>
<div
style=
"width: 400px"
>
店铺单号: {{ shopNo }}
</div>
<div>
包含产品数:
<span
style=
"color: red"
>
{{ productCount }}
</span>
</div>
</div>
<div>
物流跟踪号: {{ trackingNo }}
</div>
</div>
</el-drawer>
</span>
</template>
<
script
setup
lang=
"ts"
>
import
{
...
...
@@ -269,12 +182,12 @@ 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
,
FileCnPath
}
from
'@/api/axios'
import
{
ElMessage
}
from
'element-plus'
import
SideBar
from
'./SideBar.vue'
interface
MenuItem
{
index
:
string
id
:
number
...
...
@@ -299,14 +212,6 @@ const menuList = reactive(Menu)
const
userStore
=
userUserStore
()
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
(
''
)
// 密码form
const
[
passwordForm
,
resetPasswordForm
]
=
useValue
<
PasswordForm
>
(
{}
as
PasswordForm
,
...
...
@@ -498,124 +403,6 @@ const ensureActiveTabVisible = () => {
})
}
// 格式工具输入
const
confimTools
=
(
v
:
string
)
=>
{
// 先处理结尾的多个空格,只保留一个
let
text
=
v
.
replace
(
/
\s
+$/
,
' '
)
// 处理开头的多个空格,只保留一个
text
=
text
.
replace
(
/^
\s
+/
,
' '
)
// 将多个连续空格替换为单个空格
text
=
text
.
replace
(
/
\s
+/g
,
' '
)
// 然后将所有空格和换行符替换为逗号
text
=
text
.
replace
(
/
(\s
|
[\r\n])
/g
,
','
)
// 如果结尾是逗号,则删除
if
(
text
.
slice
(
-
1
)
===
','
)
{
newTextareaT
.
value
=
text
.
slice
(
0
,
-
1
)
}
else
{
newTextareaT
.
value
=
text
}
}
// 复制
const
copy
=
()
=>
{
const
oInput
=
document
.
createElement
(
'input'
)
oInput
.
value
=
newTextareaT
.
value
document
.
body
.
appendChild
(
oInput
)
oInput
.
select
()
// 选择对象
document
.
execCommand
(
'Copy'
)
// 执行浏览器复制命令
oInput
.
className
=
'oInput'
oInput
.
style
.
display
=
'none'
document
.
body
.
removeChild
(
oInput
)
ElMessage
({
message
:
'复制成功'
,
type
:
'success'
,
})
}
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
trackingNo
=
ref
(
''
)
const
shopNo
=
ref
(
''
)
const
documentUrl
=
ref
(
''
)
const
productCount
=
ref
()
// 打印物流面单
const
getLogistic
=
()
=>
{
if
(
!
content
.
value
)
{
ElMessage
.
warning
(
'请输入单号'
)
return
}
// 按_分割字符串
const
parts
=
content
.
value
.
split
(
'_'
)
// 检查是否有足够的_分隔符
if
(
parts
.
length
<
4
)
{
ElMessage
.
error
(
'单号格式错误,请检查输入'
)
return
}
// 获取第三个_后面的内容
const
thirdPart
=
parts
[
3
]
productCount
.
value
=
parts
[
2
]
if
(
thirdPart
.
startsWith
(
'USPSC'
))
{
// 美国物流
getLogisticUSApi
(
content
.
value
).
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
trackingNo
.
value
=
(
res
.
data
as
any
).
trackingNo
shopNo
.
value
=
(
res
.
data
as
any
).
shopNo
documentUrl
.
value
=
res
.
data
.
documentUrl
window
.
open
(
filePath
+
res
.
data
.
documentUrl
,
'_blank'
)
}
})
}
else
if
(
thirdPart
.
startsWith
(
'JMPSC'
))
{
// 中国物流
getLogisticCNApi
(
content
.
value
).
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
trackingNo
.
value
=
(
res
.
data
as
any
).
trackingNo
shopNo
.
value
=
(
res
.
data
as
any
).
shopNo
documentUrl
.
value
=
res
.
data
.
documentUrl
window
.
open
(
FileCnPath
+
res
.
data
.
documentUrl
,
'_blank'
)
}
})
}
else
{
ElMessage
.
error
(
'单号格式错误,请检查输入'
)
}
}
// 手动打印面单
const
printLogistic
=
()
=>
{
if
(
!
documentUrl
.
value
)
{
ElMessage
.
warning
(
'请先查询面单'
)
return
}
window
.
open
(
filePath
+
documentUrl
.
value
,
'_blank'
)
}
// 监听路由变化,自动添加标签
watch
(
()
=>
route
.
path
,
...
...
@@ -625,24 +412,6 @@ 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
)
{
...
...
@@ -775,38 +544,4 @@ onUnmounted(() => {
display
:
flex
;
align-items
:
center
;
}
.tool_warper
{
position
:
absolute
;
top
:
50px
;
right
:
0
;
bottom
:
0
;
width
:
40px
;
background
:
#001529
;
z-index
:
999
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
}
::v-deep
(
.el-drawer.rtl
)
{
height
:
650px
!important
;
right
:
40px
;
top
:
calc
(
50%
-
325px
)
!important
;
}
::v-deep
(
.get-logistic-drawer.el-drawer.btt
)
{
height
:
250px
!important
;
width
:
750px
!important
;
top
:
calc
(
50%
-
150px
)
!important
;
left
:
calc
(
50%
-
400px
)
!important
;
}
.tool-item
{
width
:
24px
;
height
:
24px
;
cursor
:
pointer
;
margin-bottom
:
10px
;
}
</
style
>
src/components/SideBar.vue
0 → 100644
View file @
5c6a1eab
This diff is collapsed.
Click to expand it.
src/types/api/podMakeOrder.ts
View file @
5c6a1eab
...
...
@@ -47,3 +47,22 @@ export interface ProductList {
podJomallUsNo
?:
string
previewImgs
?:
{
sort
:
string
|
number
;
title
:
string
;
url
:
string
}[]
}
export
interface
LogisticBill
{
expressSheet
?:
string
salesPlatform
?:
string
orderStatus
?:
string
shopWay
?:
string
blocked
?:
boolean
logisticsCompanyName
?:
string
logisticsWayNameId
?:
string
shopNumber
?:
string
id
?:
string
shopId
?:
string
orderId
?:
string
orderNumber
?:
string
trackingNumber
?:
string
systemWeight
?:
number
|
string
purchaseNumber
?:
number
productList
?:
ProductList
[]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment