This commit is contained in:
Vinjor 2024-10-18 20:03:26 +08:00
parent 3ecaab7b2b
commit 40e8b7f9b3
5 changed files with 134 additions and 47 deletions

View File

@ -42,13 +42,22 @@
</view> </view>
</view> </view>
<view class="footer"> <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>
<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>
<view @click="gotoDetail" v-else class="btn pg"> <view class="btn pg">
<!-- 在什么都不能操作的情况下可以查看详情--> <!-- 在什么都不能操作的情况下可以查看详情-->
查看详情 查看详情
</view> </view>
@ -58,6 +67,11 @@
</template> </template>
<script> <script>
import {
getUserInfo,
getStrData
} from '@/utils/auth';
import request from '@/utils/request';
export default { export default {
name: "orderCard", name: "orderCard",
props: { props: {
@ -77,7 +91,40 @@ export default {
} }
}, },
data() { 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: { methods: {
getFlagColor(flag) { getFlagColor(flag) {
@ -87,6 +134,54 @@ export default {
return '#999' 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() { gotoDetail() {
uni.navigateTo({ uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail?id=' + this.order.id + '&isDetail=' + '1' url: '/pages-order/orderDetail/orderDetail?id=' + this.order.id + '&isDetail=' + '1'

View File

@ -34,7 +34,7 @@
<view class="todoList"> <view class="todoList">
<scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom" <scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"> 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"> <view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image> <image class="" src="@/static/images/nothing.png" ></image>
</view> </view>
@ -52,7 +52,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue"; import OrderCard from "@/components/orderCard.vue";
import config from '@/config' import config from '@/config'
import request from '@/utils/request'; import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,getDictByCode} from "@/utils/utils"; import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import { import {
getToken, getToken,
getUserInfo, getUserInfo,
@ -164,19 +164,7 @@ export default {
if(res.data && res.data.hasOwnProperty("records")){ if(res.data && res.data.hasOwnProperty("records")){
for (let i = 0; i < res.data.records.length; i++) { for (let i = 0; i < res.data.records.length; i++) {
let order = res.data.records[i] let order = res.data.records[i]
let viewOrder = { let viewOrder = builderOrder(order)
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,
}
if(order.booking){ if(order.booking){
viewOrder['appointDate'] = formatTimestamp(order.createTime) viewOrder['appointDate'] = formatTimestamp(order.createTime)
} }

View File

@ -18,7 +18,7 @@
<view class="orderList"> <view class="orderList">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom" <scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"> 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"> <view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image> <image class="" src="@/static/images/nothing.png" ></image>
</view> </view>
@ -34,7 +34,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue' import tabBarVue from '@/components/tabBar/tabBar.vue'
import OrderCard from "@/components/orderCard.vue"; import OrderCard from "@/components/orderCard.vue";
import request from '@/utils/request'; import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,getDictByCode} from "@/utils/utils"; import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import { import {
getToken, getToken,
getUserInfo, getUserInfo,
@ -137,19 +137,7 @@ export default {
if(res.data && res.data.hasOwnProperty("records")){ if(res.data && res.data.hasOwnProperty("records")){
for (let i = 0; i < res.data.records.length; i++) { for (let i = 0; i < res.data.records.length; i++) {
let order = res.data.records[i] let order = res.data.records[i]
let viewOrder = { let viewOrder = builderOrder(order)
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,
}
if(order.booking){ if(order.booking){
viewOrder['appointDate'] = formatTimestamp(order.createTime) viewOrder['appointDate'] = formatTimestamp(order.createTime)
} }

View File

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

View File

@ -4,7 +4,7 @@ import {
getStorageWithExpiry getStorageWithExpiry
} from '@/utils/auth' } from '@/utils/auth'
function getWXStatusHeight() { export function getWXStatusHeight() {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// 获取距上 // 获取距上
const barTop = wx.getSystemInfoSync().statusBarHeight const barTop = wx.getSystemInfoSync().statusBarHeight
@ -33,7 +33,7 @@ function getWXStatusHeight() {
* @param ticketsStatus 订单状态 * @param ticketsStatus 订单状态
* @param workStatus 维修工作状态 * @param workStatus 维修工作状态
*/ */
function getOrderStatusText(ticketsStatus,workStatus){ export function getOrderStatusText(ticketsStatus,workStatus){
let str = ""; let str = "";
if("04"==ticketsStatus){ if("04"==ticketsStatus){
//待派工 //待派工
@ -61,7 +61,7 @@ function getOrderStatusText(ticketsStatus,workStatus){
* 查询字典可选值 * 查询字典可选值
* @param dictCode * @param dictCode
*/ */
function getDictByCode(dictCode){ export function getDictByCode(dictCode){
let dictArray = getStorageWithExpiry(dictCode); let dictArray = getStorageWithExpiry(dictCode);
if(null==dictArray){ if(null==dictArray){
request({ request({
@ -84,7 +84,7 @@ function getDictByCode(dictCode){
* 翻译字典 * 翻译字典
* @param dictCode * @param dictCode
*/ */
function getDictTextByCodeAndValue(dictCode,value){ export function getDictTextByCodeAndValue(dictCode,value){
let dictArray = getStorageWithExpiry(dictCode); let dictArray = getStorageWithExpiry(dictCode);
if(null==dictArray){ if(null==dictArray){
dictArray = getDictByCode(dictCode) dictArray = getDictByCode(dictCode)
@ -97,7 +97,7 @@ function getDictTextByCodeAndValue(dictCode,value){
} }
} }
function formatTimestamp(timestamp) { export function formatTimestamp(timestamp) {
// 将时间戳转换为Date对象 // 将时间戳转换为Date对象
const date = new Date(timestamp); const date = new Date(timestamp);
// 获取年月日时分秒 // 获取年月日时分秒
@ -111,10 +111,23 @@ function formatTimestamp(timestamp) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} }
export { /**
getWXStatusHeight, * 组装订单对象
formatTimestamp, * @param order
getOrderStatusText, */
getDictByCode, export function builderOrder(order){
getDictTextByCodeAndValue 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,
}
} }