Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-repair-app
This commit is contained in:
commit
3ab7e1bb0b
@ -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'
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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,8 +375,11 @@
|
||||
border-bottom: 2px solid #E8E8E8;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.inputs input{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wjworb {
|
||||
.wjworb {
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user