维修班工单

This commit is contained in:
nyoung 2024-10-21 21:25:18 +08:00
parent 35ba779fe1
commit 940cfc28fd
2 changed files with 589 additions and 0 deletions

View File

@ -0,0 +1,319 @@
<template>
<view class="container">
<view class="header">
<view class="searchBox">
<input class="searchInput" type="text" v-model="searchText" placeholder="车牌号查询工单" placeholder-style="font-size: 28rpx">
<text class="searchBtn" @click="onRefresherrefresh">搜索</text>
<text class="searchBtn" @click="clearText">清空</text>
</view>
</view>
<view class="body">
<view class="tabList">
<view v-for="(item, index) in tabList" :key="index" :class="{actived: item.id === activeKey}" class="tabItem"
@click.stop="changeTabFun(item.id)">
{{ item.title }}
<view v-if="activeKey === item.id" class="activeLine"></view>
</view>
</view>
<view class="orderList">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh" @startWork="startWork"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</scroll-view>
</view>
</view>
<tabBarVue msg="2"></tabBarVue>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
import OrderCard from "@/components/repairCard.vue";
import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import {
getToken,
getUserInfo,
getStrData,
getTenantId
} from '@/utils/auth'
export default {
components: {
OrderCard,
tabBarVue,
VNavigationBar
},
data() {
return {
searchText:"",
payShow: false,
activeKey: 0,
pageNo: 1,
pageSize: 10,
total: 0,
//
isTriggered:false,
imageUrl: '',
tabList: [
{
id: 0,
title: '待处理'
},
{
id: 1,
title: '全部'
},
],
orderList: [
],
}
},
onShow() {
if(!getToken()){
uni.reLaunch({
url: '/pages/login/login'
})
}else{
//
this.userInfo = getUserInfo()
this.onRefresherrefresh()
}
},
methods: {
/**
* 上滑加载数据
*/
onReachBottom() {
// *
if (this.pageNo * this.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//+1,
this.pageNo++
//
this.getOrderList()
},
/**
* 下拉刷新数据
*/
onRefresherrefresh(){
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.orderList = []
this.getOrderList()
},
/**
* 清空
*/
clearText(){
this.searchText = ""
this.onRefresherrefresh()
},
/**
* 开始施工
*/
startWork(id){
let paramsObj = {ticketId:id}
//
request({
url: '/admin-api/repair/titem/listProject',
method: 'get',
params:paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
if(res.data.length==1){
//1
this.startWorkRequest(id,"02",res.data[0].id,"02","kssg","开始施工")
}else{
uni.showActionSheet({
itemList: res.data.map(m => m.itemName),
success: ({
tapIndex
}) => {
this.startWorkRequest(id,"02",res.data[tapIndex].id,"02","kssg","开始施工")
}
})
}
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
/**
* 开始施工请求后台
*/
async startWorkRequest(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark){
try {
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
console.error("result",result);
this.onRefresherrefresh()
} catch (error) {
console.error(error);
}
},
getOrderList(){
let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"}
console.log("this.searchText",this.searchText)
if(''!=this.searchText){
paramsObj['ticketNo'] = this.searchText
}
if(1==this.activeKey){
//
paramsObj['selectType'] = "all"
}
request({
url: '/admin-api/repair/tickets/pageType',
method: 'get',
params:paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200) {
let thisPageRecords = []
if(res.data && res.data.hasOwnProperty("records")){
for (let i = 0; i < res.data.records.length; i++) {
let order = res.data.records[i]
let viewOrder = builderOrder(order)
if(order.booking){
viewOrder['appointDate'] = formatTimestamp(order.createTime)
}
let projectList = []
if(order.itemList){
for (let j = 0; j < order.itemList.length; j++) {
let itemObj = order.itemList[j]
if("01"==itemObj.itemType){
projectList.push({
id:itemObj.id,
name:itemObj.itemName
})
}
}
}
viewOrder['projectList'] = projectList
thisPageRecords.push(viewOrder)
}
}
// concat n
if (this.pageNo != 1) {
this.orderList = this.orderList.concat(thisPageRecords)
} else {
this.orderList = thisPageRecords
}
//
this.total = res.data.total
this.isTriggered = false
}
})
},
changeTabFun(id) {
this.activeKey = id
this.onRefresherrefresh()
},
gotoDetail(row) {
if (row.goodsType === '2') {
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail?ticketsId=' + row.goodsId
})
} else {
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail'
})
}
},
}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
background: #F3F5F7;
display: flex;
flex-direction: column;
color: #333333;
.header {
padding: 40rpx 32rpx 20rpx;
background-color: #fff;
.searchBox {
background: #F3F5F7;
padding: 20rpx 32rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
column-gap: 12rpx;
.searchInput {
flex: 1;
width: 0;
}
.searchBtn {
font-weight: 500;
font-size: 28rpx;
color: #0174F6;
}
}
}
.body {
flex: 1;
height: 0;
padding: 24rpx 32rpx;
overflow: auto;
}
.tabList {
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
padding: 0 40rpx;
.tabItem {
padding: 30rpx;
flex: 1;
z-index: 9999999;
text-align: center;
position: relative;
font-size: 24rpx;
&.actived {
color: #0174F6;
}
.activeLine {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 96rpx;
height: 6rpx;
background: #0174F6;
border-radius: 4rpx 4rpx 0rpx 0rpx;
}
}
}
.orderList {
//padding: 30rpx 0;
padding-top: 10rpx;
height: calc(100% - 90rpx);
display: flex;
flex-direction: column;
row-gap: 20rpx;
.orderItem {
}
}
}
</style>

View File

@ -0,0 +1,270 @@
<template>
<view class="container">
<VNavigationBar background-color="#fff" title="申请单详情" title-color="#333"></VNavigationBar>
<view class="body">
<div class="userList">
<view v-for="item in twItem" :key="item.id" class="userItem">
<view class="info">
<text class="name">{{ item.waresName }}</text>
<text class="num">x{{ item.waresCount}}</text>
</view>
<view class="info2">
<view class="info2-item">
<text class="label">规格型号</text>
<text class="value">{{ item.wares.model }}</text>
</view>
<view class="info2-item">
<text class="label">当前库存</text>
<text class="value">{{ item.wares.stock }}</text>
</view>
</view>
</view>
</div>
</view>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import request from '@/utils/request';
export default {
components: {
VNavigationBar,
},
data() {
return {
list: [
{name: '7字小钩', id: 1, typeName: '机修', num: 3, count: 35},
{name: '反光贴', id: 2, typeName: '机修', num: 3, count: 35},
{name: '刹车油DOT4', id: 3, typeName: '喷漆', num: 3, count: 35},
],
show: false,
argument: '',
twId:'',
//
twItem:[],
formData:{}
}
},
onLoad(data) {
this.formData = JSON.parse(decodeURIComponent(data.formData))
this.listByTwId()
},
methods: {
/**
* 根据twId查询对应配件
*/
listByTwId(){
console.log(this.formData)
request({
url: '/admin-api/repair/twi/list',
method: 'get',
params:{twId:this.formData.id}
}).then((res)=>{
console.log(res.data,90)
if (res.code == 200){
this.twItem = res.data
}
})
},
close() {
this.show = false
},
open() {},
noFun() {
this.handleAudit('05')
},
yesFun() {
this.handleAudit('02')
},
/**
* 审批接口
* @param flag"02:审批通过""05:驳回"
*/
handleAudit(flag){
this.formData['status'] = flag
//
this.formData.wares = [...this.twItem.map(item => {
return {
itemName: item.waresName,
itemCount: item.waresCount,
itemUnit: item.wares.unit,
itemPrice: item.wares.price,
repairIds: this.formData.repairId,
repairNames: this.formData.repairName,
saleId: this.formData.adviserId,
saleName: this.formData.adviserName,
itemDiscount: item.itemDiscount,
itemMoney: item.wares.price * item.waresCount,
partId: item.waresId,
remark: item.remark
}
})]
console.log(this.twItem,132)
request({
url: '/admin-api/repair/tw/audit',
method: 'post',
data:this.formData
}).then((res)=>{
if (res.code == 200){
uni.showToast({
title: '审批成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
},700)
}
})
},
confirm() {
this.show = false
uni.navigateBack()
},
cancel() {
this.show = false
this.argument = ''
}
}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
background-color: #F3F5F7;
display: flex;
flex-direction: column;
.body {
flex: 1;
height: 0;
overflow: auto;
padding: 20rpx 0;
.userList {
margin: 20rpx 32rpx 0;
background-color: #fff;
padding: 0 20rpx;
.userItem {
padding: 30rpx 0;
border-bottom: 1rpx solid #DDDDDD;
.info {
margin-bottom: 30rpx;
display: flex;
align-items: flex-end;
column-gap: 10rpx;
row-gap: 20rpx;
.name {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.num {
font-size: 28rpx;
color: #0174F6;
}
}
.info2 {
display: flex;
.info2-item {
display: flex;
flex-direction: column;
flex: 1;
width: 0;
.label {
font-size: 28rpx;
color: #858BA0;
}
.value {
font-size: 28rpx;
color: #333333;
}
}
}
}
.userItem:last-child {
border-bottom: none;
}
}
}
.foot {
background-color: #fff;
padding: 30rpx;
display: flex;
align-items: center;
.btn1, .btn2 {
flex: 1;
width: 0;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
column-gap: 10rpx;
}
.btn1 {
color: #858BA0;
}
.btn2 {
color: #0174F6;
}
.line {
height: 32rpx;
width: 1rpx;
background-color: #ddd;
}
}
.pop {
//background-color: #fff;
height: 60vh;
}
.popHeader {
padding: 40rpx;
display: flex;
align-items: center;
border-bottom: 1rpx solid #EEEEEE;
.btn2 {
color: #0174F6;
}
.btn1 {
color: #999999;
}
.popHeaderText {
flex: 1;
width: 0;
text-align: center;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
.popContent {
}
}
</style>