@@ -3,8 +3,11 @@
< view class = "header" >
< text class = "back-btn" @click ="goBack" > ‹ 返回 < / text >
< text class = "title" > 订单详情 < / text >
< text v-if = "canModify" class="edit-btn" @click="goEdit" > 编辑 < / text >
< view v-else class = "header-right "> < / view >
< view class = "header-actions" >
< text v-if = "order" class="print-btn" @click="printOrder "> 🖨 < / text >
< text v-if = "canModify" class="edit-btn" @click="goEdit" > 编辑 < / text >
< view v-else class = "header-right" > < / view >
< / view >
< / view >
< scroll-view scroll -y class = "content" refresher -enabled @refresherrefresh ="onRefresh" :refresher-triggered = "refreshing" >
@@ -24,6 +27,10 @@
< text class = "info-label" > 链接 < / text >
< text class = "info-value link" @click ="openLink" > {{ order.Link }} < / text >
< / view >
< view class = "info-row" v-if = "order.Styles" >
< text class = "info-label" > 样式 < / text >
< text class = "info-value" > { { order . Styles } } < / text >
< / view >
< view class = "info-row" v-if = "order.Remark" >
< text class = "info-label" > 备注 < / text >
< text class = "info-value" > { { order . Remark } } < / text >
@@ -324,6 +331,58 @@ async function confirmStatusChange() {
function goBack ( ) { uni . navigateBack ( ) }
function printOrder ( ) {
if ( ! order . value ) return
// #ifndef APP-PLUS
uni . showToast ( { title : '打印功能仅在 App 端可用' , icon : 'none' } )
return
// #endif
// #ifdef APP-PLUS
const printer = uni . requireNativePlugin ( 'LcPrinter' )
// 初始化打印机
printer . initPrinter ( { } )
printer . setConcentration ( { level : 39 } )
printer . setLineSpacing ( { spacing : 1 } )
// 标签打印模式(使用黑标定位)
printer . printEnableMark ( { enable : true } )
// 第一行:标题(加粗大字)
printer . setFontSize ( { fontSize : 1 } )
printer . setTextBold ( { bold : true } )
printer . printText ( { content : ( order . value . Title || '(无标题)' ) + '\n' } )
//printer.printLine({ line_length: 1 })
// 第二行:备注
printer . setFontSize ( { fontSize : 0 } )
printer . setTextBold ( { bold : false } )
printer . printText ( { content : '备注: ' + ( order . value . Remark || '(无备注)' ) + '\n' } )
//printer.printLine({ line_length: 1 })
// 第三行:样式
printer . printText ( { content : '样式: ' + ( order . value . Styles || '(无样式)' ) + '\n' } )
//printer.printLine({ line_length: 1 })
// 第四行:创建日期
printer . printText ( { content : '日期: ' + formatDate ( order . value . CreatedAt ) } )
//printer.printLine({ line_length: 1 })
// 条形码:内容 po:ID,高度 4
printer . printBarcode ( {
text : 'po:' + orderId . value ,
height : 40 ,
barcodeType : 73
} )
printer . printGoToNextMark ( )
// #endif
}
function goEdit ( ) {
uni . navigateTo ( { url : ` /pages/order/edit-order?id= ${ orderId . value } ` } )
}
@@ -368,6 +427,8 @@ onShow(() => {
. header { background - color : # fff ; padding : 30 rpx ; display : flex ; align - items : center ; }
. back - btn { font - size : 32 rpx ; color : # 007 AFF ; margin - right : 20 rpx ; }
. title { font - size : 36 rpx ; font - weight : bold ; color : # 333 ; flex : 1 ; text - align : center ; }
. header - actions { display : flex ; align - items : center ; gap : 20 rpx ; }
. print - btn { font - size : 36 rpx ; color : # 007 AFF ; }
. edit - btn { font - size : 28 rpx ; color : # 007 AFF ; }
. header - right { width : 60 rpx ; }
. content { padding : 20 rpx ; height : calc ( 100 vh - 120 rpx ) ; }