This commit is contained in:
PQZ 2024-10-18 21:44:34 +08:00
commit 3ab7e1bb0b
5 changed files with 138 additions and 50 deletions

View File

@ -42,13 +42,22 @@
</view>
</view>
<view class="footer">
<view @click="projectDis" v-if="order.ticketsStatus == '04'" class="btn pg">
<view @click="projectDis" v-if="order.ticketsStatus == '04' && roleCanPg" class="btn pg">
项目派工
</view>
<view @click="gotoDetail" v-else-if="order.ticketsStatus == '06'" class="btn qc">
<view @click="projectDis" v-if="order.ticketsStatus == '05' && roleCanPg" class="btn pg">
重新派工
</view>
<view @click="receiveOrder(order.id)" v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='01' && roleCanJd" class="btn qc">
接单
</view>
<view @click="doOrder(order.id)" v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='04' && roleCanSg" class="btn qc">
开始施工
</view>
<view @click="gotoDetail" v-if="order.ticketsStatus == '06' && roleCanQc" class="btn qc">
告知取车
</view>
<view @click="gotoDetail" v-else class="btn pg">
<view class="btn pg">
<!-- 在什么都不能操作的情况下可以查看详情-->
查看详情
</view>
@ -58,6 +67,11 @@
</template>
<script>
import {
getUserInfo,
getStrData
} from '@/utils/auth';
import request from '@/utils/request';
export default {
name: "orderCard",
props: {
@ -77,7 +91,40 @@ export default {
}
},
data() {
return {}
return {
//
roleCanPg:false,
//
roleCanQc:false,
//
roleCanJd:false,
//---
roleCanSg:false,
}
},
mounted(){
let userInfo = getUserInfo()
if(userInfo.roleCodes.includes("service_advisor") || userInfo.roleCodes.includes("general_inspection") || (userInfo.roleCodes.includes("repair_staff") && getStrData("ifLeader"))){
//
this.roleCanPg = true
}
if(userInfo.roleCodes.includes("service_advisor")){
//
this.roleCanQc = true
}
if(userInfo.roleCodes.includes("repair_staff")){
//
this.roleCanJd = true
console.log(this.order.nowRepairId,"this.order.nowRepairId")
console.log(userInfo.id,"userInfo.id")
if(this.order.nowRepairId==userInfo.id){
//
this.roleCanSg = true
}
}
},
onLoad(){
},
methods: {
getFlagColor(flag) {
@ -87,6 +134,54 @@ export default {
return '#999'
}
},
/**
* 接单
*/
receiveOrder(id){
request({
url: '/admin-api/repair/tickets/take',
method: 'get',
params:{id:id}
}).then((res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
icon: 'none',
title: '接单成功,请尽快处理!'
})
this.$emit('childEvent');
}else{
uni.showToast({
icon: 'none',
title: res.message
})
}
})
},
/**
* 开始施工
*/
doOrder(id){
request({
url: '/admin-api/repair/tickets/take',
method: 'get',
params:{id:id}
}).then((res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
icon: 'none',
title: '接单成功,请尽快处理!'
})
this.$emit('childEvent');
}else{
uni.showToast({
icon: 'none',
title: res.message
})
}
})
},
gotoDetail() {
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail?id=' + this.order.id + '&isDetail=' + '1'

View File

@ -34,7 +34,7 @@
<view class="todoList">
<scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item"></order-card>
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
@ -52,7 +52,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue";
import config from '@/config'
import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,getDictByCode} from "@/utils/utils";
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import {
getToken,
getUserInfo,
@ -164,19 +164,7 @@ export default {
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 = {
id:order.id,
orderNo:order.ticketNo,
flag:1,
ticketsStatus:order.ticketsStatus,
ticketsWorkStatus:order.ticketsWorkStatus,
flagStr:getOrderStatusText(order.ticketsStatus,order.ticketsWorkStatus),
carNum:order.carNo,
carModel:order.carBrandName,
userName:order.userName,
userPhone:order.userMobile,
counselorName:order.adviserName,
}
let viewOrder = builderOrder(order)
if(order.booking){
viewOrder['appointDate'] = formatTimestamp(order.createTime)
}

View File

@ -18,7 +18,7 @@
<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"></order-card>
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
@ -34,7 +34,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
import OrderCard from "@/components/orderCard.vue";
import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,getDictByCode} from "@/utils/utils";
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import {
getToken,
getUserInfo,
@ -137,19 +137,7 @@ export default {
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 = {
id:order.id,
orderNo:order.ticketNo,
flag:1,
ticketsStatus:order.ticketsStatus,
ticketsWorkStatus:order.ticketsWorkStatus,
flagStr:getOrderStatusText(order.ticketsStatus,order.ticketsWorkStatus),
carNum:order.carNo,
carModel:order.carBrandName,
userName:order.userName,
userPhone:order.userMobile,
counselorName:order.adviserName,
}
let viewOrder = builderOrder(order)
if(order.booking){
viewOrder['appointDate'] = formatTimestamp(order.createTime)
}

View File

@ -157,7 +157,7 @@
setToken(res.data.loginResult.accessToken)
setUserInfo(res.data.userinfo)
setStrData("userId",res.data.userinfo.id)
if(res.data.userinfo.roleCodes.indexOf("repair_staff")){
if(res.data.userinfo.roleCodes.includes("repair_staff")){
//
this.getIdLeader()
}
@ -375,6 +375,9 @@
border-bottom: 2px solid #E8E8E8;
margin-top: 20px;
}
.inputs input{
width: 100%;
}
.wjworb {
margin-top: 5px;

View File

@ -4,7 +4,7 @@ import {
getStorageWithExpiry
} from '@/utils/auth'
function getWXStatusHeight() {
export function getWXStatusHeight() {
// #ifdef MP-WEIXIN
// 获取距上
const barTop = wx.getSystemInfoSync().statusBarHeight
@ -33,7 +33,7 @@ function getWXStatusHeight() {
* @param ticketsStatus 订单状态
* @param workStatus 维修工作状态
*/
function getOrderStatusText(ticketsStatus,workStatus){
export function getOrderStatusText(ticketsStatus,workStatus){
let str = "";
if("04"==ticketsStatus){
//待派工
@ -61,7 +61,7 @@ function getOrderStatusText(ticketsStatus,workStatus){
* 查询字典可选值
* @param dictCode
*/
function getDictByCode(dictCode){
export function getDictByCode(dictCode){
let dictArray = getStorageWithExpiry(dictCode);
if(null==dictArray){
request({
@ -84,7 +84,7 @@ function getDictByCode(dictCode){
* 翻译字典
* @param dictCode
*/
function getDictTextByCodeAndValue(dictCode,value){
export function getDictTextByCodeAndValue(dictCode,value){
let dictArray = getStorageWithExpiry(dictCode);
if(null==dictArray){
dictArray = getDictByCode(dictCode)
@ -97,7 +97,7 @@ function getDictTextByCodeAndValue(dictCode,value){
}
}
function formatTimestamp(timestamp) {
export function formatTimestamp(timestamp) {
// 将时间戳转换为Date对象
const date = new Date(timestamp);
// 获取年月日时分秒
@ -111,7 +111,28 @@ function formatTimestamp(timestamp) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
function formatDate(timestamp) {
/**
* 组装订单对象
* @param order
*/
export function builderOrder(order) {
return {
id: order.id,
orderNo: order.ticketNo,
flag: 1,
ticketsStatus: order.ticketsStatus,
ticketsWorkStatus: order.ticketsWorkStatus,
flagStr: getOrderStatusText(order.ticketsStatus, order.ticketsWorkStatus),
carNum: order.carNo,
nowRepairId: order.nowRepairId,
carModel: order.carBrandName,
userName: order.userName,
userPhone: order.userMobile,
counselorName: order.adviserName,
}
}
export function formatDate(timestamp) {
// 将时间戳转换为Date对象
const date = new Date(timestamp);
// 获取年月日时分秒
@ -122,11 +143,4 @@ function formatDate(timestamp) {
return `${year}-${month}-${day}`;
}
export {
getWXStatusHeight,
formatTimestamp,
getOrderStatusText,
getDictByCode,
getDictTextByCodeAndValue,
formatDate
}