hz-zhhq-app/pages/repair-record2/repair-details2.vue

391 lines
8.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container">
<view class="details">
<view class="detail_msg">
<view class="info-item status">
<text class="label">报修状态 </text>
<text class="infoSpan">{{item.status}}</text>
</view>
<view class="info-item">
<text class="label">报修人 </text>
<text class="infoSpan">{{item.userName}}</text>
</view>
<view class="info-item">
<text class="label">报修选项 </text>
<text class="infoSpan">{{ fixList[item.opt-1].title }}</text>
</view>
<view class="info-item">
<text class="label">报修位置 </text>
<text class="infoSpan">{{item.repairAddr}}</text>
</view>
<view class="info-item">
<text class="label">报修描述 </text>
<text class="infoSpan">{{item.faultDetail}}</text>
</view>
<view class="info-item">
<text class="label">报修时间 </text>
<text class="infoSpan">{{formatDate(item.apply_time, 'dateTime')}}</text>
</view>
<view class="img-box" >
<image v-for="(itemImg,imgIndex) in item.pictures" :key="imgIndex" :src="itemImg" mode=""></image>
</view>
</view>
</view>
<view style="clear: both;"></view>
<view class="occupied"></view>
<!-- <view class="footer-btn" v-if="role=='1' && first_status=='0'">
<view class="btn">取消</view>
</view> -->
<view class="footer-btn footer-btn-two" v-if="item.statusCode == '10'">
<view class="btn btn-col" @click="submit(2)">拒绝</view>
<view class="btn btn-col1" @click="submit(1)">接受</view>
</view>
<view class="footer-btn footer-btn-two" v-if="item.statusCode == '11' && item.person_id ">
<view class="btn btn-col1" style="width: 100%; border-radius: 10rpx;" @click="dispose()">处理完成</view>
</view>
<UniPopup ref="popup" type="center">
<view class="interviewee">
<view class="p-title"><text>请选择处理人</text></view>
<view class="center">
<text class="input_left">处理人:</text>
<picker class="picker" :range="persons" range-key="name" @change="person($event)">
<view>{{persons[index].name}}</view>
</picker>
<image class="arrow" src="/static/icons/right-arrow.png" mode=""></image>
</view>
<view class="bu">
<button class="cancel" @click="cancel()">取消</button>
<button class="confirm" @click="confirm()">确认</button>
</view>
</view>
</UniPopup>
</view>
</template>
<script>
import {
doHitch,
getPerson,
dispose
} from '@/common/api.js';
import {
callbackRequest,
getStorage,
alertTip,
formatDate,
sureAlterTip
} from '@/common/util.js';
import UniPopup from '@/components/uni-popup/uni-popup2.vue';
export default {
components: {
UniPopup
},
data() {
return {
userInfo:'',
formatDate:formatDate,
item: {},
fixList: [{
title: "空调",
more: "风系统"
},
{
title: "给排水",
more: "饮水、清洁、排水"
},
{
title: "电",
more: "照明、办公、生产"
},
{
title: "木",
more: "办公桌、椅、门等"
},
{
title: "安保",
more: "门禁、监控等"
},
{
title: "电梯",
more: "货运、人员等"
},
{
title: "消防",
more: "报警、逃生、灭火器"
},
{
title: "其它",
more: ""
},
],
persons: [{name:'',id:''}],
index:0
}
},
onLoad(option) {
this.userInfo = getStorage('userInfo');
this.item = JSON.parse(decodeURIComponent(option.item));
// option.item && ());
},
methods: {
submit(type){
if (type != 1 && type != 2 ){
return
}
var tip = '拒绝';
if (type == 1){
tip = '接受';
this.getPersons();
this.$refs.popup.open();
return;
}
sureAlterTip('提示',"确定要"+tip+"?",true)
.then(res =>{
if (res === 200){
// 1 同意 2 拒绝
let params = {
"method": doHitch,
"data":{
userId: this.userInfo.id,
type: type,
id: this.item.id
}
};
console.log("params:",params);
callbackRequest(params).then(res => {
res = res.data;
console.log("return:", res);
alertTip(res.returnMsg);
if ( res.returnCode === "1"){
alertTip(res.returnMsg);
// 跳回列表页
setTimeout(function() {
// uni.redirectTo({
// url:'/pages/repair-record/repair-record'
// })
uni.navigateBack({
delta:1
})
}, 1500);
}
})
}
})
},
confirm: function(){
if(!this.persons[this.index].id){
alertTip('请选择处理人');
return;
}
let params = {
"method": doHitch,
"data":{
userId: this.userInfo.id,
type: 1,
id: this.item.id,
personId:this.persons[this.index].id,
repairId: this.item.repairId
}
};
callbackRequest(params).then(res => {
res = res.data;
console.log("return:", res);
alertTip(res.returnMsg);
if ( res.returnCode === "1"){
this.$refs.popup.close();
alertTip(res.returnMsg);
// 跳回列表页
setTimeout(function() {
// uni.redirectTo({
// url:'/pages/repair-record/repair-record'
// })
uni.navigateBack({
delta:1
})
}, 1500);
}
})
},
cancel: function(){
this.$refs.popup.close();
},
getPersons: function(){
let params = {
"method": getPerson,
"data": {
userId: this.userInfo.id
}
};
callbackRequest(params)
.then(res => {
res = res.data;
if (res.returnCode == 1) {
this.persons = res.returnData || [{name:'暂无处理人',id:''}];
}else {
this.persons = [{name:'暂无处理人',id:''}];
alertTip(res.returnMsg);
}
})
},
person : function(e){
this.index = e.detail.value;
console.log(e)
},
dispose: function(){
sureAlterTip('提示',"确定要处理完成?",true)
.then(res =>{
if (res === 200){
let params = {
"method": dispose,
"data":{
userId: this.userInfo.id,
id: this.item.id
}
};
console.log("params:",params);
callbackRequest(params).then(res => {
res = res.data;
alertTip(res.returnMsg);
if ( res.returnCode === "1"){
alertTip(res.returnMsg);
// 跳回列表页
setTimeout(function() {
// uni.redirectTo({
// url:'/pages/repair-record/repair-record'
// })
uni.navigateBack({
delta:1
})
}, 1500);
}
})
}
})
}
}
}
</script>
<style lang="scss">
@import '@/static/css/common.scss';
.container {
min-height:100vh;
background: #f8f8f8;
font-size: 28upx;
.details{
// height: 550upx;
background: white;
margin: 15upx;
border-radius: 15upx;
padding-bottom:15rpx;
.detail_header {
border-bottom: #f8f8f8 5upx solid;
height: 90upx;
line-height: 90upx;
margin: 15upx;
border-radius: 10upx;
.blueSign {
height: 28upx;
width: 5upx;
background: #00c277;
display: inline-block;
margin-left: 20upx;
}
.font-tilte {
font-weight:bold;
margin-left: 20upx;
}
}
.detail_msg {
margin-left: 20upx;
border-radius: 10upx;
.info-item{
border-bottom:1px solid #f8f8f8;
padding:20upx 10upx;
line-height: 50upx;
.label{
display:inline-block;
width:150upx;
font-size:28upx;
color:#333;
font-weight:bold;
}
}
.status {
.infoSpan{
color: red;
}
}
.img-box {
// background: #fff;
image{
width: 200upx;
height: 200upx;
margin:20upx 20upx 0 0;
}
}
}
}
.interviewee {
background: #FFFFFF;
width: 625rpx;
height: 270rpx;
border-radius: 10rpx;
.p-title {
background: #DCDFE6;
text-align: center;
border-radius: 10rpx;
font-size: 30rpx;
width: 100%;
height: 70rpx;
line-height: 70rpx;
}
.center {
padding: 26upx;
display: flex;
align-items: center;
position: relative;
border-bottom:1px solid #eee;
.input_left {
font-size:30rpx;
font-weight: bold;
}
.arrow{
float: right;
width: 16upx;
height: 29upx;
margin-top: 10upx;
}
.picker{
margin-right:40upx;
margin-left: 10upx;
font-size:28upx;
line-height:50upx;
color:#666;
width: 72%;
}
}
.bu{
margin: 10rpx;
.cancel{
width: 45%;
height: 80rpx;
margin-left: 10rpx;
background: #cc;
}
.confirm{
width: 45%;
height: 80rpx;
margin-right: 10rpx;
margin-top: -80rpx;
background: #00c277;
}
}
}
}
</style>