flying-monkey/pagesA/workOrder/workOrderLlsit.vue

557 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="content">
<status-nav navBarTitle="工单列表" returnColor="#c2c2c2"></status-nav>
<container-subgroup-two>
<view slot="content" style="margin: -25rpx -25rpx -0rpx;">
<view class="project-list-input" :style="{top:statusBarHeight + 'px'}">
<input type="text" @keydown.enter="getDatalist" @confirm="getDatalist" class="int" v-model="dataPage.keyword" value="" placeholder="请输入关键字" />
<image @click="getDatalist" class="search" src="../../static/iocn/ss.png" mode="" lazy-load></image>
<view class="xian"></view>
</view>
<view class="screen">
<!-- 筛选状态查询、日期查询 -->
<picker class="width30 disjcac" @change="bindPickerChange" :value="workeOrderStatusIndex" :range="array" :range-key="'name'">
<view class="li">
<view class="text" v-if="workeOrderStatus!=''">{{workeOrderStatus}}</view>
<view class="text" v-else>{{array[workeOrderStatusIndex].name}}</view>
<image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load></image>
</view>
</picker>
<picker class="width30 disjcac" mode="date" :value="date" @change="bindDateChange">
<view class="li">
<view class="text" v-if="dataPage.order_times==''">工单日期</view>
<view class="text" v-else>{{dataPage.order_times}}</view>
<image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load></image>
</view>
</picker>
<view class="li width30 disjcac">
<view class="text">筛选</view>
<image class="imgA" src="../../static/iocn/sx.png" mode="aspectFill" lazy-load></image>
</view>
</view>
<view class="project-list">
<!-- 列表循环体 -->
<view class="li animated fadeIn" @click="projectDetailsFun(item.order_status,item.order_id,item.btn?item.btn.attributes.text:item.order_status_view,item.btn?item.btn.attributes.color:'#DDDDDD')" v-for="(item,index) in dataList" :key="index">
<view class="work-order-code">工单编号{{item.order_number}}</view>
<view class="message">
<image class="img" :src="item.cover_picture" mode="aspectFill" lazy-load></image>
<view class="text disjb fc" style="height: 180rpx;">
<view class="title flexs">
<view class="text clips1">{{item.project_name}}</view>
<view v-if="item.btn" class="icon" :style="{backgroundColor: item.btn.attributes.color || '#DDDDDD'}">{{item.btn.attributes.text}}</view>
<view v-else class="icon" style="background-color: #DDDDDD;color: #333333;">{{item.order_status_view}}</view>
</view>
<view class="disjb fc line-h36" style="margin-left: -20rpx;">
<view class="serial-number scal09">
<view class="type" v-if="item.fault_type">#{{item.fault_type}}#</view>
<view class="date">{{item.failure_time}}</view>
</view>
<view class="specification scal09">
紧急程度:<view class="text"> {{item.emergency_level_view}}</view>
</view>
<view class="specification scal09">主负责人:{{item.principal}}</view>
<view class="installation-site scal09 clips1">维保描述:{{item.failure_description}}</view>
</view>
</view>
</view>
<view class="project-list-address">
<view class="address clips2">
<image class="img" src="../../static/iocn/dz2.png" mode="aspectFill" lazy-load></image>
<view class="text">{{item.address}}</view>
</view>
<!-- 订单不等于已完成和待回访,并且访问人不是工程师 -->
<view class="" v-if="role==1 || role==2">
<view @tap.stop="hurryUpEv(item.order_id)" class="date" v-if="item.order_status!=5 && item.order_status!=6 && item.order_status!=7 && item.order_status!=8 && item.order_status!=9">
催一催 <image class="img" src="../../static/iocn/ld.png" mode="" lazy-load></image>
</view>
</view>
</view>
</view>
<pitera v-if="total==dataList.length && dataList.length!=0" textStr="暂无更多列表数据"></pitera>
</view>
<nothing-page v-if="dataList.length==0 && !ifLoading" content="暂无更多列表数据" currentType="0"></nothing-page>
</view>
</container-subgroup-two>
</view>
</template>
<script>
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import statusNav from '../../components/status-nav.vue';
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
import pitera from '@/components/nothing/pitera.vue';
export default {
components: {
footTabOne,
statusNav,
containerSubgroupTwo,
pitera
},
data() {
const currentDate = this.getDate({
format: true
})
return {
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 40,
role: uni.getStorageSync('type_id'), // 1业务员 2:表示客户 3:表示客服 4表示工程师 5:财务
date: currentDate,
workeOrderStatus:'工单状态',
array: [],
workeOrderStatusIndex: 0,
dataPage:{
list_rows:10,
page:1,
order_status:"",
order_times:"",
keyword:"",
is_evaluate:0//0未评价1已评价
},
total:0,
dataList:[],
statusId:0,
ifLoading:true,
orderType:[],//工单状态值
}
},
onReachBottom() {
if(this.total!=this.dataList.length) {
this.dataPage.page++;
this.getDatalist();
}
},
onShow() {
// 调用获取工单状态事件
this.getType();
},
onLoad(op) {
if(op.statusId!=undefined) this.statusId = op.statusId;
if(op.is_evaluate){this.dataPage.is_evaluate = op.is_evaluate} else {delete this.dataPage.is_evaluate}
switch (uni.getStorageSync('type_id')*1){
case 1:
case 2:
// 业务员、客户
this.orderType = ['待指派','待接单','待维修','维修中','待付款','待评价'];
break;
case 3:
// 客服
this.orderType = ['待指派','待接单','待维修','维修中','待收款','待审批','已收款','待回访','异常单','逾期单'];
break;
case 4:
// 工程师
this.orderType = ['待接单','待维修','维修中','待收款','待审批','异常单','逾期单'];
break;
case 5:
// 财务
this.orderType = [];
break;
}
},
methods: {
// 获取工单状态
getType(){
this.array = [];
this.$requst.get('/universal/api.order/order_type').then(res => {
// this.$toolAll.tools.showToast(res.msg);
if (res.code) {
if(uni.getStorageSync('type_id')!=5){
if(res.data.length){
this.orderType.forEach(item=>{
res.data.forEach(item1=>{
if(item==item1.name){
this.array.push(item1);
}
})
})
}
} else {
this.array=[...res.data];
}
if(this.statusId){
this.workeOrderStatusIndex = this.array.findIndex(item=>item.id==this.statusId);
if(this.workeOrderStatusIndex!=-1) {
this.workeOrderStatus = '';
this.dataPage.order_status = this.array[this.workeOrderStatusIndex].id;
}
}
// 如果页数等于1
if(this.dataPage.page==1) {
// 调用获取工单列表事件
this.getDatalist();
}
}
})
},
// 获取工单列表
getDatalist(){
uni.showLoading({
mask:true,
title:'加载中...'
})
this.$requst.get('/universal/api.order/order_list',this.dataPage).then(res => {
if (res.code==1) {
this.total = res.data.total;
if(this.dataPage.page==1) this.dataList = [];
this.dataList = [...this.dataList,...res.data.data];
}else{
this.dataList = [];
}
uni.hideLoading();
this.ifLoading = false;
})
},
// 催一催事件
hurryUpEv(id) {
this.$requst.post('/universal/api.order/urge',{order_id:id}).then(res=>{
if(res.code){
this.$toolAll.tools.showToast(`已催单成功`);
}
})
},
// 查看工单详情和进入接单页面
projectDetailsFun(status,id,statusText,statusColor) {
if (uni.getStorageSync('type_id')==4) {
// 工程师
if(status == 2) {
// 待接单
uni.showModal({
cancelText:'取消',
cancelColor:'#999999',
confirmColor:'#03affb',
confirmText:'确认',
content:'确认接单',
success: (res) => {
if(res.confirm){
this.$requst.post('/universal/api.order/accept_order',{order_id:id,is_order:1}).then(res=>{
if(res.code){
this.$toolAll.tools.showToast('接单成功');
setTimeout(()=>{
uni.navigateTo({
url: `/pagesA/workOrder/workOrder?id=${id}`
})
},1000)
}
})
}
}
})
}
if(status==3){
// 待维修
uni.navigateTo({
url: `/pagesA/workOrder/workOrder?id=${id}`
})
}
if(status==4){
// 维修中
uni.navigateTo({
url: `/pagesA/workOrder/workOrder?id=${id}`
})
}
} else if(uni.getStorageSync('type_id')==5){
// 财务
if(status==6){
// 审核工单
uni.navigateTo({
url: `/pagesA/workOrder/workOrderAudit?orderId=${id}&status=${status}&statusText=${statusText}&statusColor=${statusColor}`
})
} else {
// 去详情
uni.navigateTo({
url: `/pagesA/workOrder/details?orderId=${id}&status=${status}&statusText=${statusText}&statusColor=${statusColor}`
})
}
} else if(uni.getStorageSync('type_id')==3){
// 客服
if(status==1){
// 待指派工单
uni.navigateTo({
url: `/pagesA/peopleManagement/peopleManagement?orderId=${id}`
})
}
if(status==8){
// 工单回访
uni.navigateTo({
url: `/pagesA/workOrder/payReturnVisit?order_id=${id}`
})
}
} else if(uni.getStorageSync('type_id')==1 || uni.getStorageSync('type_id')==2){
// 客户、业务员待评价
if(status == 9){
uni.navigateTo({
url: `/pagesB/i-want-evaluate/i-want-evaluate?orderId=${id}`
})
}
} else {
// 客户、客服、业务员、工程师点击查看详情
uni.navigateTo({
url: `/pagesA/workOrder/details?orderId=${id}&status=${status}&statusText=${statusText}&statusColor=${statusColor}`
})
}
},
bindPickerChange(data) {
this.workeOrderStatus = '';
this.workeOrderStatusIndex = data.detail.value;
this.dataPage.order_status=this.array[data.detail.value].id-0
this.statusId = this.dataPage.order_status;
this.getDatalist()
},
bindDateChange(date) {
this.dataPage.order_times=date.detail.value
this.getDatalist()
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
console.log(year, month, day)
return `${year}-${month}-${day}`;
}
}
}
</script>
<style scoped>
page {
background-color: #F7F7F7;
}
.project-list-input .xian {
width: 3rpx;
height: 35rpx;
position: absolute;
background-color: #EAEAEA;
right: 100rpx;
top: 50%;
margin-top: -14rpx;
}
.project-list-input {
width: 100%;
height: 114rpx;
position: fixed;
z-index: 2;
padding: 20rpx 16rpx;
box-sizing: border-box;
background-color: #FFFFFF
}
.project-list-input .int {
width: 100%;
height: 100%;
background-color: #F7F7F7;
padding: 0 25rpx;
box-sizing: border-box;
border-radius: 36rpx;
}
.project-list-input .search {
width: 28rpx;
height: 28rpx;
position: absolute;
right: 43rpx;
top: 50%;
margin-top: -14rpx;
z-index: 10;
}
.screen {
display: flex;
justify-content: space-around;
padding: 25rpx 20rpx;
border-bottom: 2rpx solid #E6E6E6;
border-top: 2rpx solid #E6E6E6;
margin: 20rpx 0rpx;
margin-top: 57px;
}
.screen .li {
display: flex;
align-items: center;
}
.screen .li .text {
font-size: 32rpx;
color: #333333;
margin-right: 10rpx;
}
.screen .li .img {
width: 14rpx;
height: 8rpx;
position: relative;
z-index: 1;
}
.screen .li .imgA {
width: 24rpx;
height: 23rpx;
}
.project-list .li {
width: 710rpx;
box-sizing: border-box;
background-color: #FFFFFF;
position: relative;
margin: auto;
margin-bottom: 20rpx;
padding: 33rpx 23rpx;
}
.project-list .li .iconBer {
background-image: url(../../static/iocn/za.png);
}
.project-list .li .iconBera {
background-image: url(../../static/iocn/zaa.png);
}
.project-list .li .message {
display: flex;
}
.project-list .li .message .img {
width: 230rpx;
margin-right: 11rpx;
height: 180rpx;
}
.project-list .li .message .text {
flex: 1;
}
.project-list .li .message .text .title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
word-break: break-all;
margin-bottom: 5rpx;
font-size: 24rpx;
display: flex;
align-items: center;
color: #333333;
font-weight: bold;
}
.project-list .li .message .text .title .text {
width: 60%;
}
.project-list .li .message .text .title .icon {
font-size: 24rpx;
width: 120rpx;
height: 40rpx;
background-color: #ff5400;
border-radius: 50rpx;
color: #FFFFFF;
display: flex;justify-content: center;align-items: center;
}
.project-list .li .message .text .title .icon1 {
background-color: #00a2e9;
}
.project-list .li .message .text .title .icon3 {
background-color: #009a44;
}
.project-list .li .message .serial-number {
color: #9b9ba3;
font-size: 24rpx;
display: flex;
}
.project-list .li .message .serial-number .type {
margin-right: 60rpx;
}
.project-list .li .message .specification {
color: #9b9ba3;
font-size: 24rpx;
display: flex;
}
.project-list .li .message .specification .text {
color: #e90000;
}
.project-list .li .message .installation-site {
color: #9b9ba3;
font-size: 24rpx;
}
.project-list-address {
display: flex;
margin-top: 15rpx;
color: #9b9ba3;
align-items: center;
justify-content: space-between;
width: 100%;
}
.project-list-address .text {
font-size: 22rpx;
flex: 1;
}
.project-list-address .date {
font-size: 24rpx;
text-align: right;
margin-left: 20rpx;
align-items: center;
display: flex;
color: #e90000;
}
.project-list-address .date .img {
width: 26rpx;
height: 24rpx;
margin-left: 5rpx;
}
.project-list-address .address .img {
width: 22rpx;
height: 30rpx;
margin-right: 10rpx;
}
.project-list-address .address {
display: flex;
align-items: center;
}
.project-list .work-order-code {
font-size: 24rpx;
color: #9b9ba3;
margin-bottom: 26rpx;
}
.pickerDate {
width: 300rpx;
height: 300rpx;
}
</style>