@@ -1,32 +1,19 @@
< template >
< view class = "page-container" >
< view class = "top-line" / >
<!-- 工单状态进度 -- >
< view class = "repair-detail-progress-box" >
< view class = "repair-detail-progress" >
< view v-for = "(step, idx) in progressSteps" :key="idx" class="repair-detail-step" >
< view
: class = "['repair-detail-dot', detailStep >= idx ? 'active' : '', (detailStep === idx && detailStatus !== '已结束') ? 'current' : '']" >
< / view >
< view v-if = "idx < progressSteps.length - 1"
: class = "['repair-detail-line', detailStep > idx ? 'active' : '']" > < / view >
< / view >
< / view >
< view class = "repair-detail-progress-labels" >
< view v-for = "(step, idx) in progressSteps" :key="idx" class="repair-detail-label" > {{ step }}
< / view >
< / view >
< / view >
< ! - - 工单详情 - - >
< view class = "detail-list " >
< view class = "detail-value" > < text class = "detail-key" > 工单编号 : < / text > { { detail . orderNo } } < / view >
< view class = "detail-value" > < text class = "detail- key" > 工单名称 : < / text > {{ detail . orderNam e } } < / view >
< view class = "detail-value" > < text class = "detail- key" > 工单类型 : < / text > {{ detail . typeNam e } } < / view >
< view class = "detail-value" > < text class = "detail-key" > 处理地点 : < / text > { { detail . location } } < / view >
< view class = "detail-value" > < text class = "detail-key" > 创建时间 : < / text > { { detail . createTime } } < / view >
< view class = "detail-value" > < text class = "detail-key" > 发起单位 / 人 : < / text > { { detail . initiatorPeople } } < / view >
< view class = "detail-value remark" > < text > 备注 : < / text > {{ detail . remark } } < / view >
< view class = "item-bg" > < text class = "detail-key" > 工单编号 : < / text > { { detail . orderNo } } < / view >
< view class = "item-bg " >
< view class = "item-title" > 上报人信息 < / view >
< view class = "detail-key" > 发起人 : { { detail . initiatorPeopl e } } < / view >
< view class = "detail-key" > 联系电话 : { { detail . initiatorPhon e } } < / view >
< / view >
< view class = "item-bg" >
< view class = "item-title" > 保修信息 < / view >
< view class = "detail-key" > 工单名称 : { { detail . orderName } } < / view >
< view class = "detail-key" > 工单类型 : { { detail . typeName } } < / view >
< view class = "detail-key" > 处理地点 : { { detail . location } } < / view >
< view class = "detail-key" > 备注 : { { detail . remark } } < / view >
< view class = "detail-value" > < text class = "detail-key" > 工单图片 : < / text > < / view >
< view class = "image-list" v-if = "orderImgUrls.length > 0" >
< u -image
@@ -41,18 +28,45 @@
mode = "aspectFill"
> < / u-image >
< / view >
< / view >
< view v-if = "detail.status>1" class="item-bg" >
< view class = "item-title" > 负责人信息 < / view >
< view class = "detail-key" > 负责人 : { { detail . handlerText } } < / view >
< view class = "detail-key" > 联系电话 : { { detail . handlerPhone } } < / view >
< / view >
<!-- 纵向进度条 -- >
< view class = "item-bg" >
< view class = "item-title" > 进度跟踪 < / view >
< view v-for = "(status, index) in detail.recordVoList" :key="index" class="repair-detail-step" >
< view class = "step-left" >
< text class = "step-date" > { { status . createTime . substring ( 0 , 11 ) } } < / text >
< text class = "step-time" > { { status . createTime . substring ( 11 , 16 ) } } < / text >
< / view >
< view class = "step-dot-container" >
< view class = "repair-detail-dot" > < / view >
<!-- 固定高度连线 -- >
< view
v-if = "index < detail.recordVoList.length - 1" class="repair-detail-line"
> < / view >
< / view >
< view class = "step-right" >
< text class = "step-name" > { { getStatusLabel ( status . status ) } } < / text >
< / view >
< / view >
< / view >
<!-- 底部操作按钮 -- >
< view
v-if = "((!this. isManager&&this. detailStep != 0) || (this. isManager&&this. detailStep == 0))&&this. detailStep!=3 "
v-if = "((!isManager && detailStep != 0) || (isManager && detailStep == 0)) && detailStep != 3&&!isNaomalUser "
class = "btn-group" >
< button class = "btn ghost"
@click ="transfer(1)" > {{ this. isManager ? ' 指派 ' : this. detailStep == 2 ? ' 完成 ' : ' 开始 ' }} < / button >
< button v-if = "this. detailStep == 1" class="btn primary" @click="transfer(2)" > 转派 < / button >
@click ="transfer(1)" > {{ isManager ? ' 指派 ' : ( detailStep = = 2 ? ' 完成 ' : ' 开始 ' ) }} < / button >
< button v-if = "detailStep == 1" class="btn primary" @click="transfer(2)" > 转派 < / button >
< / view >
< view class = "kg" >
< / view >
< SelectUser :visible.sync = "showSelect" :list = "users" :multiple = "false" @confirm ="onConfirm" / >
< / view >
< / template >
@@ -60,32 +74,27 @@
< script >
import SelectUser from '@/components/SelectUser.vue'
export default {
components : {
SelectUser
} ,
components : { SelectUser } ,
data ( ) {
return {
detailStep : 0 ,
detailStatus : '' ,
progressSteps : [ '创建工单' , '已接单' , '处理中' , '已结束' ] ,
currentStatus : 2 , // 0: 待分配, 1: 已接单, 2: 处理中, 3: 已完成
currentStatus : 2 ,
detail : { } ,
isManager : false ,
isNaomalUser : true ,
showSelect : false ,
users : [ ] ,
orderImgUrls : [ ] // 添加用于存储处理后的图片URL数组
orderImgUrls : [ ]
} ;
} ,
onLoad ( options ) {
this . isManager = this . vuex _user . roles [ 0 ] . roleId == 1
this . isManager = this . vuex _user ? . roles ? . [ 0 ] ? . roleId < 3
this . isNaomalUser = this . vuex _user ? . roles ? . [ 0 ] ? . roleId > 10
if ( options . item ) {
const item = JSON . parse ( decodeURIComponent ( options . item ) ) ;
this . detail = item ;
// 现在可以使用item对象了
// 进度映射
this . getStepInfo ( )
// 处理图片URL
this . getImageUrl ( )
}
if ( ( this . isManager && this . detailStep == 0 ) || ( ! this . isManager && this . detailStep == 1 ) ) {
@@ -93,49 +102,43 @@
}
} ,
methods : {
goBack ( ) {
uni . navigateBack ( ) ;
} ,
goBack ( ) { uni . navigateBack ( ) ; } ,
async getImageUrl ( ) {
if ( ! this . detail . orderImgUrl ) return ;
const imgIds = this . detail . orderImgUrl . split ( ',' ) ;
const res = await this . $u . api . getImageUrl ( { } , imgIds ) ;
if ( res . code == 200 && res . data ) {
// 提取res.data数组中每个对象的url字段
this . orderImgUrls = res . data . map ( item => item . url ) ;
}
const res = await this . $u . api . getImageUrl ( { } , imgIds . join ( ',' ) );
if ( res . code == 200 && res . data ) this . orderImgUrls = res . data . map ( item => item . url ) ;
} ,
async getHandler ( ) {
let handlers = await this . $u . api . getHandler3 ( { } , this . detail . type ) ;
if ( handlers . code === 200 ) {
this . users = [ ... this . users , ... handlers . data ] ;
}
if ( handlers . code === 200 ) this . users = [ ... this . users , ... handlers . data ] ;
} ,
getStepInfo ( ) {
if ( this . detail . status == 0 ) {
this . detailStep = 0 ;
this . detailS tatus = '创建工单' ;
} else if ( this . detail . status == 4 ) {
this . detailStep = 3 ;
this . detailStatus = '已结束' ;
} else if ( this . detail . status == 3 ) {
this . detailStep = 2 ;
this . detailStatus = '处理中' ;
} else {
this . detailStep = 1 ;
this . detailStatus = ' 已接单' ;
}
let currentIndex = 0 ;
if ( this . detail. status == 0 ) currentIndex = 0 ;
else if ( this . detail. s tatus == 1 ) currentIndex = 1 ;
else if ( this . detail . status == 3 ) currentIndex = 2 ;
else if ( this . detail . status == 4 ) currentIndex = 3 ;
this . detailStep = currentIndex ;
} ,
getStatusLabel ( status ) {
const statusMap = {
0 : "创建工单" ,
1 : " 已接单" ,
2 : "已接单" ,
3 : "处理中" ,
4 : "已完成" ,
} ;
return statusMap [ status ] || "" ;
} ,
previewImage ( urls , index ) {
// 使用uView的图片预览组件
// 过滤掉空值
const validUrls = urls . filter ( url => url && url . trim ( ) !== '' )
const validUrls = urls . filter ( url => url && url . trim ( ) !== '' ) ;
const currentIndex = validUrls . indexOf ( urls [ index ] ) ;
uni . previewImage ( {
urls : validUrls ,
current : validUrls [ index ] , // current 必须是 url, 而不是索引
indicator : 'number' , // 显示数字指示器
current : currentIndex >= 0 ? currentIndex : 0 ,
indicator : 'number' ,
backgroundColor : '#000'
} )
} ,
@@ -145,186 +148,115 @@
params . status = 1
let res = await this . $u . api . updateOrder2 ( params ) ;
if ( res . code == '200' ) {
// 关闭页面前发送事件通知前页面刷新
uni . $emit ( 'refreshData' , '' ) ;
if ( ! this . isManager ) {
uni . navigateBack ( ) ;
return
}
this . detail . handler = selected . value
this . detail . status = 1
const d = new Date ( ) ;
const z = n => n . toString ( ) . padStart ( 2 , '0' ) ;
let time = ` ${ d . getFullYear ( ) } - ${ z ( d . getMonth ( ) + 1 ) } - ${ z ( d . getDate ( ) ) } ${ z ( d . getHours ( ) ) } : ${ z ( d . getMinutes ( ) ) } : ${ z ( d . getSeconds ( ) ) } ` ;
let step = { }
step . id = this . detail . recordVoList [ 0 ] . id ,
step . orderId = this . detail . recordVoList [ 0 ] . orderId ,
step . status = '1' ,
step . handler = '' ,
step . handlerName = '' ,
step . createTime = time
this . detail . recordVoList . push ( step )
this . getStepInfo ( )
}
} ,
async submit ( ) {
let params = this . detail
if ( this . detail . status == 1 || this . detail . status == 2 ) {
params . status = 3
} else {
params . status = 4
}
if ( this . detail . status == 1 || this . detail . status == 2 ) params . status = 3
else params . status = 4
let res = await this . $u . api . updateOrder2 ( params ) ;
if ( res . code == ' 200' ) {
// 关闭页面前发送事件通知前页面刷新
if ( res . code == 200) {
uni . $emit ( 'refreshData' , '' ) ;
this . detail . status = params . status
if ( params . status == 3 ) {
this . detail . handlerText = this . vuex _user . nickName
this . detail . handlerPhone = this . vuex _user . phonenumber
}
const d = new Date ( ) ;
const z = n => n . toString ( ) . padStart ( 2 , '0' ) ;
let time = ` ${ d . getFullYear ( ) } - ${ z ( d . getMonth ( ) + 1 ) } - ${ z ( d . getDate ( ) ) } ${ z ( d . getHours ( ) ) } : ${ z ( d . getMinutes ( ) ) } : ${ z ( d . getSeconds ( ) ) } ` ;
let step = { }
step . id = this . detail . recordVoList [ 0 ] . id ,
step . orderId = this . detail . recordVoList [ 0 ] . orderId ,
step . status = params . status ,
step . handler = '' ,
step . handlerName = '' ,
step . createTime = time
this . detail . recordVoList . push ( step )
this . getStepInfo ( )
}
} ,
transfer ( type ) {
if ( this . isManager || type == 2 ) {
this . showSelect = true
} else {
this . submit ( )
if ( this . isManager || type == 2 ) this . showSelect = true
else this . submit ( )
}
}
} ,
}
} ;
< / script >
< style scoped >
. page - container {
background : # fff ;
}
. top - line {
width : 100 vw ;
height : 3 rpx ;
background : # ECECEC ;
}
. repair - detail - progress - box {
height : 107 rpx ;
margin - bottom : 41 rpx ;
display : flex ;
flex - direction : column ;
justify - content : center ;
align - items : stretch ;
}
. repair - detail - progress {
display : flex ;
align - items : center ;
justify - content : space - between ;
margin - bottom : 5 rpx ;
margin - left : 85 rpx ;
width : 100 % ;
}
. page - container { background : # f7f7f7 ; height : 100 vh ; }
. top - line { width : 100 vw ; height : 3 rpx ; background : # ECECEC ; }
. item - bg { background : # fff ; border - radius : 20 rpx ; margin - top : 10 px ; margin - left : 25 rpx ; margin - right : 25 rpx ; padding : 25 rpx ; }
. item - title { color : # 000 ; font - size : 28 rpx ; font - weight : 600 ; margin - bottom : 20 rpx ; }
. repair - detail - step - container { display : flex ; flex - direction : column ; }
. repair - detail - step {
display : flex ;
align - items : center ;
flex : 1 ;
position : relative ;
flex - direction : row ;
margin - bottom : 20 rpx ;
}
. step - left { flex : 1 ; display : flex ; flex - direction : column ; align - items : flex - end ; padding - right : 20 rpx ; }
. step - date { font - size : 24 rpx ; color : # 333 ; }
. step - time { font - size : 24 rpx ; color : # 666 ; margin - top : 10 rpx ; }
. step - dot - container {
display : flex ;
flex - direction : column ;
align - items : center ;
width : 40 rpx ;
}
. repair - detail - dot {
width : 22 rpx ;
height : 22 rpx ;
border - radius : 50 % ;
background : # BDBDBD ;
border : 2 rpx solid # BDBDBD ;
position : relative ;
z - index : 2 ;
}
. repair - detail - dot . active {
background : # 2186 FF ;
border - color : # 2186 FF ;
}
. repair - detail - dot . current {
background : # EF8D00 ;
border - color : # EF8D00 ;
}
/* 固定高度连线 */
. repair - detail - line {
flex : 1 ;
height : 4 rpx ;
width : 4 rpx ;
height : 80 rpx ; /* 每条线的高度 */
background : # BDBDBD ;
margin : 0 2 rpx ;
z - index : 1 ;
}
. repair - detail - line . active {
margin - top : 2 rpx ;
background : # 2186 FF ;
}
. repair - detail - progress - labels {
display : fle x ;
justify - content : space - between ;
margin - left : 0 ;
width : 100 % ;
}
. repair - detail - label {
font - size : 22 rpx ;
color : # 888 ;
text - align : center ;
flex : 1 ;
position : relative ;
top : 8 rpx ;
}
. detail - list {
font - size : 28 rpx ;
line - height : 2 em ;
margin - left : 40 rpx ;
}
. detail - key {
color : # 595858 ;
}
. detail - value {
margin - bottom : 30 rpx ;
color : # # 2 F2F2F ;
}
. remark {
white - space : pre - line ;
}
. link {
color : # 007 CFF ;
text - decoration : underline ;
}
. image - list {
display : flex ;
flex - wrap : wrap ;
margin - top : 20 rpx ;
}
. image - item {
width : 200 rpx ;
height : 200 rpx ;
border - radius : 10 rpx ;
margin - right : 20 rpx ;
margin - bottom : 20 rpx ;
}
. btn - group {
display : flex ;
justify - content : space - around ;
margin - top : 60 rpx ;
}
. btn {
width : 276 rpx ;
height : 88 rpx ;
padding : 20 rpx ;
font - size : 30 rpx ;
border - radius : 50 rpx ;
display : flex ;
align - items : center ;
justify - content : center ;
}
. primary {
background - color : # 1890 ff ;
color : # fff ;
}
. ghost {
background - color : # fff ;
color : # 1890 ff ;
border : 2 rpx solid # 1890 ff ;
. step - right { flex : 1 ; display : flex ; flex - direction : column ; padding - left : 20 rpx ; }
. step - name { font - size : 28 rpx ; color : # 333 ; font - weight : bold ; margin - bottom : 6 rp x; }
. step - desc { font - size : 24 rpx ; color : # 666 ; }
. detail - key { color : # 222 ; font - size : 28 rpx ; margin - bottom : 2 0rpx ; }
. detail - value { margin - bottom : 30 rpx ; color : # 2 F2F2F ; }
. image - list { display : flex ; flex - wrap : wrap ; margin - top : 20 rpx ; }
. btn - group { display : flex ; justify - content : space - around ; margin - top : 60 rpx ; }
. btn { width : 276 rpx ; height : 88 rpx ; padding : 20 rpx ; font - size : 30 rpx ; border - radius : 50 rpx ; display : flex ; align - items : center ; justify - content : center ; }
. primary { background - color : # 1890 ff ; color : # fff ; }
. ghost { background - color : # fff ; color : # 1890 ff ; border : 2 rpx solid # 1890 ff ; }
. kg {
height : 60 rpx ;
}
< / style >