@ -13,7 +13,7 @@
< view class = "mt20 ml10" >
< up -upload :fileList ="fileList.glove" @afterRead ="afterRead" @delete ="deletePic" name = "glove"
multiple : maxCount = "2" width = "131rpx" height = "131rpx" >
multiple : maxCount = "2" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -30,7 +30,7 @@
< view class = "level" >
< view class = "mt20 ml10" >
< up -upload :fileList ="fileList.ShoeCover" @afterRead ="afterRead" @delete ="deletePic"
name = "ShoeCover" multiple : maxCount = "2" width = "131rpx" height = "131rpx" >
name = "ShoeCover" multiple : maxCount = "2" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -51,7 +51,7 @@
< view class = "level" >
< view class = "mt20 ml10 mr20" >
< up -upload : fileList = "fileList['pet' + index]" @afterRead ="afterRead" @delete ="deletePic"
: name = "'pet' + index" multiple : maxCount = "2" width = "131rpx" height = "131rpx" >
: name = "'pet' + index" multiple : maxCount = "2" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = ""
: style = "{width:'131rpx',height:'131rpx'}" >
@ -70,7 +70,7 @@
< view class = "level" >
< view class = "mt20 ml10" >
< up -upload :fileList ="fileList.foodA" @afterRead ="afterRead" @delete ="deletePic" name = "foodA"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -80,7 +80,7 @@
< / view >
< view class = "mt20 ml10 ml28" >
< up -upload :fileList ="fileList.foodB" @afterRead ="afterRead" @delete ="deletePic" name = "foodB"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -93,7 +93,7 @@
< view class = "level" >
< view class = "mt20 ml10" >
< up -upload :fileList ="fileList.waterA" @afterRead ="afterRead" @delete ="deletePic" name = "waterA"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -103,7 +103,7 @@
< / view >
< view class = "mt20 ml10 ml28" >
< up -upload :fileList ="fileList.waterB" @afterRead ="afterRead" @delete ="deletePic" name = "waterB"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -116,7 +116,7 @@
< view class = "level" >
< view class = "mt20 ml10" >
< up -upload :fileList ="fileList.urinalA" @afterRead ="afterRead" @delete ="deletePic" name = "urinalA"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -126,7 +126,7 @@
< / view >
< view class = "mt20 ml10 ml28" >
< up -upload :fileList ="fileList.urinalB" @afterRead ="afterRead" @delete ="deletePic" name = "urinalB"
multiple : maxCount = "1" width = "131rpx" height = "131rpx" >
multiple : maxCount = "1" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -147,7 +147,7 @@
< view class = "level" >
< view class = "mt20 ml10 mr20" >
< up -upload :fileList ="fileList.testa" @afterRead ="afterRead" @delete ="deletePic" name = "testa"
multiple : maxCount = "3" width = "131rpx" height = "131rpx" >
multiple : maxCount = "3" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -162,7 +162,7 @@
< view class = "level" >
< view class = "mt20 ml10 mr20" >
< up -upload :fileList ="fileList.testb" @afterRead ="afterRead" @delete ="deletePic" name = "testb"
multiple : maxCount = "3" width = "131rpx" height = "131rpx" >
multiple : maxCount = "3" width = "131rpx" height = "131rpx" : disabled = "isRead" >
< image src = "/static/images/ydd/add_photo.png" mode = "" :style ="{width:'131rpx',height:'131rpx'}" >
< / image >
@ -181,13 +181,24 @@
< view class = "mt24" >
< textarea name = "" id = "" cols = "30" rows = "10" placeholder = "请输入内容"
: style = "{color:'#999999',fontSize:'30rpx',backgroundColor:'#F5F5F5',borderRadius:'16rpx',width:'681rpx',height:'180rpx'}"
class = "pd20 box-size" > < / textarea >
class = "pd20 box-size" : disabled = "isRead" > < / textarea >
< / view >
< / view >
< view class = "buttom mt60 box-size" @click ="submit" >
< view class = "buttom-item level size-30" :style ="{borderRadius:'41rpx',color:'#fff'}" >
< view class = "buttom mt60 box-size"
style = "display: flex;gap: 20rpx;"
>
< view class = "buttom-item buttom-item-2 level size-30"
@ click = "saveDraft(false)"
: style = "{borderRadius:'41rpx',color:'#ff842c'}" >
保存草稿
< / view >
< view class = "buttom-item level size-30"
@ click = "submit"
: style = "{borderRadius:'41rpx',color:'#fff'}" >
确定提交
< / view >
< / view >
< / view >
< / template >
@ -206,13 +217,19 @@
} from '@/utils/oss-upload/oss/index.js'
import { orderItemLogGetByOrderId } from '@/api/order/order.js'
import {
getOrderPetById ,
orderItemLogAddOrUpdate ,
} from "@/api/order/order.js" ;
onLoad ( ( options ) => {
orderId . value = options . id || null ;
isRead . value = options . isRead || false ;
GetByOrderId ( )
} ) ;
const orderId = ref ( 0 )
const isRead = ref ( false )
const fileList = reactive ( {
@ -225,17 +242,16 @@
const form = ref ( { } )
const petList = ref ( [ {
title : '小汪'
} ,
{
title : '大黄'
} ,
const petList = ref ( [
/ / {
/ / t i t l e : ' 小 汪 '
/ / } ,
/ / {
/ / t i t l e : ' 大 黄 '
/ / } ,
] )
petList . value . forEach ( ( n , i ) => {
fileList [ 'pet' + i ] = [ ]
} )
/ / 删 除 图 片
const deletePic = ( event ) => {
@ -274,36 +290,151 @@
}
}
if ( ! fileList . foodA || fileList . foodA . length < 2 ||
! fileList . foodB || fileList . foodB . length < 2 ) {
if ( ! fileList . foodA || fileList . foodA . length < 1 ||
! fileList . foodB || fileList . foodB . length < 1 ) {
return msg ( '请上传粮碗前后照片' )
}
if ( ! fileList . waterA || fileList . waterA . length < 2 ||
! fileList . waterB || fileList . waterB . length < 2 ) {
if ( ! fileList . waterA || fileList . waterA . length < 1 ||
! fileList . waterB || fileList . waterB . length < 1 ) {
return msg ( '请上传水碗前后照片' )
}
if ( ! fileList . urinalA || fileList . urinalA . length < 2 ||
! fileList . urinalB || fileList . urinalB . length < 2 ) {
if ( ! fileList . urinalA || fileList . urinalA . length < 1 ||
! fileList . urinalB || fileList . urinalB . length < 1 ) {
return msg ( '请上传猫砂盆、尿盆照片' )
}
saveDraft ( true )
}
function GetByOrderId ( ) {
orderItemLogGetByOrderId ( orderId . value )
. then ( res => {
if ( res . code == 200 && res . data ) {
const data = res . data ;
form . value = data
/ / 回 显 手 套 照 片
if ( data . glovePhoto ) {
fileList . glove = data . glovePhoto . split ( ',' ) . map ( url => ( { url } ) ) ;
}
/ / 回 显 鞋 套 照 片
if ( data . shoeCoverPhoto ) {
fileList . ShoeCover = data . shoeCoverPhoto . split ( ',' ) . map ( url => ( { url } ) ) ;
}
/ / 回 显 宠 物 照 片
if ( data . petPhoto ) {
const pets = JSON . parse ( data . petPhoto ) ;
petList . value = pets ;
pets . forEach ( ( pet , index ) => {
if ( pet . fileList ) {
fileList [ 'pet' + index ] = pet . fileList . split ( ',' ) . map ( url => ( { url } ) ) ;
}
} ) ;
}
/ / 回 显 粮 碗 照 片
if ( data . grainBowlFront ) fileList . foodA = data . grainBowlFront . split ( ',' ) . map ( url => ( { url } ) ) ;
if ( data . grainBowlAfter ) fileList . foodB = data . grainBowlAfter . split ( ',' ) . map ( url => ( { url } ) ) ;
/ / 回 显 水 碗 照 片
if ( data . waterBowlFront ) fileList . waterA = data . waterBowlFront . split ( ',' ) . map ( url => ( { url } ) ) ;
if ( data . waterBowlAfter ) fileList . waterB = data . waterBowlAfter . split ( ',' ) . map ( url => ( { url } ) ) ;
/ / 回 显 猫 砂 盆 / 尿 垫 照 片
if ( data . basinFront ) fileList . urinalA = data . basinFront . split ( ',' ) . map ( url => ( { url } ) ) ;
if ( data . basinAfter ) fileList . urinalB = data . basinAfter . split ( ',' ) . map ( url => ( { url } ) ) ;
/ / 回 显 定 制 服 务 照 片
if ( data . workDogImage ) fileList . testa = data . workDogImage . split ( ',' ) . map ( url => ( { url } ) ) ;
if ( data . workPalyImage ) fileList . testb = data . workPalyImage . split ( ',' ) . map ( url => ( { url } ) ) ;
} else {
getOrderPetByIdFN ( )
}
} )
}
function getOrderPetByIdFN ( ) {
getOrderPetById ( orderId . value )
. then ( res => {
if ( res . code == 200 ) {
res . data . forEach ( ( n , i ) => {
fileList [ 'pet' + i ] = [ ]
} )
res . data . forEach ( ( n , i ) => {
petList . value . push ( {
title : n . name ,
id : n . id ,
} )
} )
}
} )
}
function saveDraft ( ) {
function saveDraft ( flag ) {
/ / 将 所 有 图 片 数 组 转 换 为 逗 号 分 隔 的 字 符 串
const params = {
orderId : orderId . value ,
glovePhoto : fileList . glove ? . map ( item => item . url ) . join ( ',' ) || '' ,
shoeCoverPhoto : fileList . ShoeCover ? . map ( item => item . url ) . join ( ',' ) || '' ,
/ / 合 并 所 有 宠 物 照 片
petPhoto : JSON . stringify (
petList . value . map ( ( pet , index ) => {
return {
id : pet . id ,
title : pet . title ,
fileList : fileList [ 'pet' + index ] ? . map ( item => item . url ) . join ( ',' ) || ''
} ;
} )
) ,
/ / 粮 碗 照 片
grainBowlFront : fileList . foodA ? . map ( item => item . url ) . join ( ',' ) || '' ,
grainBowlAfter : fileList . foodB ? . map ( item => item . url ) . join ( ',' ) || '' ,
/ / 水 碗 照 片
waterBowlFront : fileList . waterA ? . map ( item => item . url ) . join ( ',' ) || '' ,
waterBowlAfter : fileList . waterB ? . map ( item => item . url ) . join ( ',' ) || '' ,
/ / 猫 砂 盆 / 尿 垫 照 片
basinFront : fileList . urinalA ? . map ( item => item . url ) . join ( ',' ) || '' ,
basinAfter : fileList . urinalB ? . map ( item => item . url ) . join ( ',' ) || '' ,
/ / 定 制 服 务 照 片
workDogImage : fileList . testa ? . map ( item => item . url ) . join ( ',' ) || '' ,
workPalyImage : fileList . testb ? . map ( item => item . url ) . join ( ',' ) || '' ,
/ / 备 注 信 息
notes : form . value . notes || '' ,
submitFlag : 1 ,
}
if ( form . value . id ) {
params . id = form . value . id
}
if ( flag ) {
params . submitFlag = 2
}
orderItemLogAddOrUpdate ( params )
. then ( res => {
if ( res . code === 200 ) {
uni . showToast ( {
title : '提交成功' ,
icon : 'success'
} )
/ / 如 果 是 确 认 提 交 ( 非 草 稿 ) , 则 返 回 上 一 页
if ( flag ) {
setTimeout ( ( ) => {
uni . navigateBack ( )
} , 1500 )
}
} else {
uni . showToast ( {
title : res . msg || '提交失败' ,
icon : 'none'
} )
}
} )
. catch ( err => {
uni . showToast ( {
title : '提交失败' ,
icon : 'none'
} )
} )
}
function msg ( content ) {