This commit is contained in:
PQZ 2024-10-18 19:55:06 +08:00
parent 5b7b7571c1
commit cd9f891c09
2 changed files with 152 additions and 122 deletions

View File

@ -4,53 +4,54 @@
<VNavigationBar background-color="#fff" title="工单详情" title-color="#333"></VNavigationBar>
<view class="body">
<view class="card cardInfo carCard">
<view :class="{'end': orderInfo.flag == 5}" class="orderFlag">
<view :class="{'end': ticketInfo.ticketsStatus == '02'}" class="orderFlag">
<template>
<image v-if="orderInfo.flag == 5" mode="aspectFit" src="/static/icons/orderEnd.png"
<image v-if="ticketInfo.ticketsStatus == '02'" mode="aspectFit" src="/static/icons/orderEnd.png"
style="width: 48rpx;height: 48rpx"></image>
<image v-else mode="aspectFit" src="/static/icons/orderIng.png"
style="width: 48rpx;height: 48rpx"></image>
<view class="flagBody">
<text>{{ orderInfo.flag == 5 ? '已完成' : '待处理' }}</text>
<text class="flagDesc">当前工单维修项目{{ orderInfo.flag == 5 ? '已全部完成' : '正在进行维修' }}</text>
<text>{{ ticketInfo.ticketsStatus == '02' ? '已完成' : ticketInfo.statusStr }}</text>
<text class="flagDesc">当前工单维修项目{{ ticketInfo.flag == '02' ? '已全部完成' : ticketInfo.statusStr }}</text>
</view>
</template>
</view>
<view class="carTitle">车辆信息</view>
<view class="carDetail">
<view class="carHeader">
<image :src="carInfo.image" class="carImage" mode="aspectFill"></image>
<image :src="imgUrlPrex + ticketInfo.carInfo.logoImg" class="carImage" mode="aspectFill"></image>
<view class="carHeaderRight">
<text class="carNumber">{{ carInfo.licenseNumber }}</text>
<text class="carType">{{ carInfo.carCategory }}</text>
<text class="carNumber">{{ ticketInfo.carNo }}</text>
<text class="carType">{{ ticketInfo.carBrandName }}</text>
</view>
</view>
<view class="carBody">
<view style="display: flex;align-items: center">
<view class="infoItem" style="flex: 1">
<view class="label">车架号</view>
<view class="value">{{ carInfo.cjNo }}</view>
<view class="value">{{ ticketInfo.carVin }}</view>
</view>
<!-- <view class="infoItem" style="flex: 1">-->
<!-- <view class="label">发动机号</view>-->
<!-- <view class="value">{{ ticketInfo.fdjNo }}</view>-->
<!-- </view>-->
<view class="infoItem" style="flex: 1">
<view class="label">发动机号</view>
<view class="value">{{ carInfo.fdjNo }}</view>
<view class="label">注册日期</view>
<view class="value">{{ ticketInfo.carRegisterDate }}</view>
</view>
</view>
<template v-if="carInfo.showAll">
<view style="display: flex;align-items: center">
<view class="infoItem" style="flex: 1">
<view class="label">年检时间</view>
<view class="value">{{ carInfo.njDate }}</view>
<view class="value">{{ ticketInfo.inspectionDate }}</view>
</view>
<view class="infoItem" style="flex: 1">
<view class="label">保险时间</view>
<view class="value">{{ carInfo.bxDate }}</view>
<view class="value">{{ ticketInfo.insuranceDate }}</view>
</view>
</view>
<view class="infoItem">
<view class="label">注册日期</view>
<view class="value">{{ carInfo.zcrqDate }}</view>
</view>
</template>
</view>
<view class="carFoot">
@ -65,39 +66,39 @@
</view>
</view>
</view>
<view v-if="userInfo" class="card cardInfo userCard">
<view class="card cardInfo userCard">
<view class="userTitle">客户信息</view>
<view class="userContainer">
<view style="display: flex;align-items: center">
<view class="infoItem" style="flex: 1">
<text class="label">姓名</text>
<text class="value">{{ userInfo.name }}</text>
<text class="value">{{ ticketInfo.userName }}</text>
</view>
<view class="infoItem" style="flex: 1">
<text class="label">性别</text>
<text class="value">{{ userInfo.sex === '1' ? '女' : '男' }}</text>
<text class="value">{{ ticketInfo.customerInfo.sex === '1' ? '女' : '男' }}</text>
</view>
</view>
<template v-if="userInfo.showAll">
<view style="display: flex;align-items: center">
<view class="infoItem" style="flex: 1">
<text class="label">联系方式</text>
<text class="value">{{ userInfo.phone }}</text>
<text class="value">{{ ticketInfo.userMobile }}</text>
</view>
<view class="infoItem" style="flex: 1">
<text class="label">出生年月</text>
<text class="value">{{ userInfo.birthday }}</text>
<text class="label">生日</text>
<text class="value">{{ ticketInfo.birthday }}</text>
</view>
</view>
<view class="infoItem">
<text class="label">联系地址</text>
<text class="value">
{{ userInfo.provinceName }} {{ userInfo.cityName }} {{ userInfo.areaName }} {{ userInfo.address }}
{{ ticketInfo.customerInfo.address }}
</text>
</view>
</template>
</view>
<view class="userFoot">
<view v-if="loginUser.roleCodes.includes('weixiu') || loginUser.roleCodes.includes('service_advisor')||loginUser.roleCodes.includes('general_inspection')" class="userFoot">
<template v-if="!userInfo.showAll">
<text @click="() => $set(userInfo, 'showAll', true)">展开</text>
<image mode="aspectFit" src="/static/icons/bottom.png" style="width: 28rpx;height: 28rpx"></image>
@ -108,31 +109,89 @@
</template>
</view>
</view>
<view v-if="selectedProj && selectedProj.length > 0" class="card cardInfo projCard">
<view v-if="ticketInfo.items && ticketInfo.items.length > 0" class="card cardInfo projCard">
<view class="projTitle">维修项目</view>
<view class="projList">
<template v-if="isDetail == '1'">
<view v-for="item in selectedProj" :key="item.id" class="projItem">
<template>
<view v-for="item in ticketInfo.items" :key="item.id" class="projEditItem">
<view class="noReviewPart" @click="showReviewList(item.id)">
<u-icon color="#E8A321" name="error-circle-fill" size="14"></u-icon>
<text class="messageText">当前项目有待审批的配件申请单</text>
<u-icon color="#E8A321" name="arrow-right" size="14"></u-icon>
</view>
<view class="projEditLine1">
<text>{{ item.itemName }}</text>
<text class="projAmount">{{ item.itemMoney }}</text>
</view>
<view class="projBaseInfo">
<view>规格{{item.project.spec}}</view>
<view>售价{{ item.itemPrice }}</view>
<view>数量{{ item.itemCount }}</view>
<view>单位{{ item.itemUnit}}</view>
<view>折扣{{ item.itemDiscount }}</view>
<view>金额{{ item.itemMoney }}</view>
</view>
<view class="projEditFoot">
<view class="block1">
<template>
<view class="editPeople">
<view class="editForm">
<text class="label">销售人员</text>
<text >{{item.saleName}}
</text>
</view>
<image v-if="isDetail == '0'" src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
@click="editPeople('xs', item)"></image>
</view>
</template>
<template v-if="isDetail == '0'">
<image src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
<text class="addText" @click="editPeople('xs', item)">添加销售人员</text>
</template>
</view>
<view class="line"></view>
<view class="block2">
<template>
<view class="editPeople">
<view class="editForm">
<text class="label">施工人员</text>
<text >{{ item.repairNames }}</text>
</view>
<image v-if="isDetail == '0'" src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
@click="editPeople('sg', item)"></image>
</view>
</template>
<template v-if="isDetail == '0'">
<image src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
<text class="addText" @click="editPeople('sg', item)">添加施工人员</text>
</template>
</view>
</view>
</view>
</template>
</view>
</view>
<view v-if="isDetail == '1'" class="card cardInfo projCard">
<view class="projTitle">维修记录</view>
<view class="projList">
<template>
<view v-for="item in ticketInfo.records" :key="item.id" class="projItem">
<view class="projTop">
<text class="projName">{{ item.projName }}</text>
<text class="projAmount">${{ item.amount }}</text>
<text class="projName">{{ item.typeStr }}</text>
<!-- <text class="projAmount">${{ item.amount }}</text>-->
</view>
<view class="projBody">
<view class="projDate">
<image mode="aspectFit" src="/static/icons/date.png" style="width: 24rpx;height: 24rpx"></image>
<text class="projDateText">{{ item.date }}</text>
<text class="projDateText">{{ item.createTime }}</text>
</view>
<view v-if="item.hasNoReviewPart" class="noReviewPart" @click="showReviewList(item.id)">
<u-icon color="#E8A321" name="error-circle-fill" size="14"></u-icon>
<text class="messageText">当前项目有待审批的配件申请单</text>
<u-icon color="#E8A321" name="arrow-right" size="14"></u-icon>
</view>
<template v-else>
<template >
<view class="projDesc">
{{ item.desc }}
{{ item.remark }}
</view>
<view class="projImg">
<image v-for="(img, imgIndex) in item.imageList" :key="imgIndex" :src="img.filePath"
<image v-for="(img, imgIndex) in item.itemList" :key="imgIndex" :src="imgUrlPrex + item.image"
class="projImgItem"></image>
</view>
<view class="projSend">
@ -147,70 +206,13 @@
</template>
</view>
</template>
</view>
</view>
</template>
<template v-else>
<view v-for="item in selectedProj" :key="item.id" class="projEditItem">
<view class="projEditLine1">
<text>{{ item.projName }}</text>
<text class="projAmount">{{ item.amount }}</text>
</view>
<view class="projBaseInfo">
<view>规格{{ '轿车' }}</view>
<view>售价{{ '280' }}</view>
<view>数量{{ '1' }}</view>
<view>单位{{ '辆' }}</view>
<view>折扣{{ '10' }}</view>
<view>金额{{ '280.00' }}</view>
</view>
<view class="projEditFoot">
<view class="block1">
<template v-if="item.salesman && item.salesman.length > 0">
<view class="editPeople">
<view class="editForm">
<text class="label">销售人员</text>
<text v-if="item.salesman">{{
item.salesman && item.salesman.map(m => m.name).join(',')
}}
</text>
</view>
<image src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
@click="editPeople('xs', item)"></image>
</view>
</template>
<template v-else>
<image src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
<text class="addText" @click="editPeople('xs', item)">添加销售人员</text>
</template>
</view>
<view class="line"></view>
<view class="block2">
<template v-if="item.constructor && item.constructor.length > 0">
<view class="editPeople">
<view class="editForm">
<text class="label">施工人员</text>
<text v-if="item.constructor">{{ item.constructor.map(m => m.name).join(',') }}</text>
</view>
<image src="/static/icons/edit.png" style="width: 28rpx;height: 28rpx"
@click="editPeople('sg', item)"></image>
</view>
</template>
<template v-else>
<image src="/pages-order/static/addIcon.png" style="width: 28rpx;height: 28rpx"></image>
<text class="addText" @click="editPeople('sg', item)">添加施工人员</text>
</template>
</view>
</view>
</view>
</template>
</view>
</view>
</view>
<view class="foot">
<view v-if="isDetail == '0'" class="foot">
<view class="submit">保存工单</view>
</view>
</view>
@ -221,39 +223,25 @@
import VNavigationBar from '@/components/VNavigationBar.vue'
import {bus} from "@/utils/eventBus";
import request from '@/utils/request';
import {getOrderStatusText} from "@/utils/utils";
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue} from "@/utils/utils";
import {getUserInfo} from '@/utils/auth'
import config from '@/config'
export default {
components: {
VNavigationBar,
},
data() {
return {
imgUrlPrex:config.baseImageUrl,
//(01)
isDetail:'1',
// role: 'yewu',
ticketId: '',
//
ticketInfo: {},
carInfo: {
licenseNumber: '川A 184AO1',
carCategory: '一汽奥迪 2024款 A6L',
cjNo: '124105112425',
fdjNo: '124109581905',
njDate: '2024年',
bxDate: '2024年',
zcrqDate: '2023-10-20',
image: ''
},
userInfo: {
name: '2其',
sex: '1',
phone: '131111111',
birthday: '2000-01-01',
provinceName: '山东省',
cityName: '泰安市',
areaName: 'xx区',
address: 'xxxxxx'
},
carInfo: {},
userInfo: {},
loginUser:{},
selectedProj: [
{
projName: '清洗内饰',
@ -305,13 +293,15 @@ export default {
};
},
onLoad(data) {
this.loginUser = getUserInfo()
console.log(this.loginUser,294)
if (data.id) {
this.ticketId = data.id
}
if (data.isDetail){
this.isDetail = data.isDetail
}
// this.getOrderDetail()
this.getOrderDetail()
},
methods: {
@ -325,8 +315,36 @@ export default {
params:{id:this.ticketId}
}).then((res)=>{
this.ticketInfo = res.data;
this.ticketInfo.statusStr = getOrderStatusText()
console.log(res.data,327)
this.ticketInfo.statusStr = getOrderStatusText(res.data.ticketsStatus)
//
if (null != this.ticketInfo.carInfo.carRegisterDate){
this.ticketInfo.carRegisterDate = formatDate(this.ticketInfo.carInfo.carRegisterDate)
}
//
if (null != this.ticketInfo.carInfo.inspectionDate){
this.ticketInfo.inspectionDate = formatDate(this.ticketInfo.carInfo.inspectionDate)
} else {
this.ticketInfo.inspectionDate = '未知'
}
//
if (null != this.ticketInfo.carInfo.insuranceDate) {
this.ticketInfo.insuranceDate = formatDate(this.ticketInfo.carInfo.insuranceDate)
} else {
this.ticketInfo.insuranceDate = '未知'
}
//
if (null != this.ticketInfo.customerInfo.birthday) {
this.ticketInfo.birthday = formatDate(this.ticketInfo.customerInfo.birthday)
} else {
this.ticketInfo.birthday = '未知'
}
//
if (null != this.ticketInfo.records){
this.ticketInfo.records.map((item)=>{
item.typeStr = getDictTextByCodeAndValue('repair_records_type',item.type)
item.createTime = formatTimestamp(item.createTime)
})
}
})
},

View File

@ -111,10 +111,22 @@ function formatTimestamp(timestamp) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
function formatDate(timestamp) {
// 将时间戳转换为Date对象
const date = new Date(timestamp);
// 获取年月日时分秒
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
// 组合成日期时间字符串
return `${year}-${month}-${day}`;
}
export {
getWXStatusHeight,
formatTimestamp,
getOrderStatusText,
getDictByCode,
getDictTextByCodeAndValue
getDictTextByCodeAndValue,
formatDate
}