hz-zhhq-app/pages/malfunc-repair/service-photo.vue

893 lines
21 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="hzIndex">
<hzHeader title="服务受理照片"></hzHeader>
<view class="hzContent" style="padding-top: 200upx;">
<view class="content" style="position: relative;">
<view class="interviewee">
<view class="form-box" style="border-radius: 20upx;">
<view class="form-item" v-if="this.STATE =='1'">
<view style="color: #333;font-size: 30upx;font-weight: bold;padding: 10upx 0px;">
<text>服务反馈结果<text style="color: red;">*</text>:</text>
</view>
<view style="width: 100%;border: 1px solid #E5E5E5;margin-top: 20upx;padding: 20upx;min-height: 200upx;color: #666;border-radius: 10upx;">
<textarea class="textarea" style="width: 100%;" v-model="feedback" placeholder="请输入服务反馈结果" maxlength="200"/>
</view>
</view>
<!-- <view class="footer" v-if="STATE==0" style="border-bottom: 1px solid #eee;"><text class="input_left">服务前照片:</text></view> -->
<view v-if="STATE==0" style="margin-bottom: 40upx;">
<view class="img-box">
<view class="img-item" v-for="(item, index) in imgs" :key="index">
<image class="remove-btn" @click="removeImg(index)" src="/static/icons/delete-icon.png"
mode=""></image>
<image class="img" :src="item.replace(/[\r\n]/g,'')" mode=""></image>
</view>
<view class="img-item upload-btn" @click="chooseImg()" v-if="imgs.length < 1">
<image class="img" src="/static/imgs/tianjia-img.png" mode=""></image>
</view>
<view style="margin-top: 20upx;font-size: 24rpx;font-weight: 600;">点击上传服务前现场照片</view>
<view style="font-size: 26rpx;font-weight: 600;color: red;">互联网信息系统严禁存储、传输、处理涉及国家秘密企业秘密以及敏感信息,违者将严肃问责追责!</view>
</view>
</view>
<!-- <view class="footer" v-if="STATE==1" style="border-bottom: 1px solid #eee;"><text class="input_left">服务后照片:</text></view> -->
<view v-if="STATE==1" style="margin-bottom: 40upx;">
<view class="img-box">
<view class="img-item" v-for="(item, index) in idPhoto" :key="index">
<image class="remove-btn" @click="removeImg2(index)" src="/static/icons/delete-icon.png"
mode=""></image>
<image class="img" :src="item.replace(/[\r\n]/g,'')" mode=""></image>
</view>
<view class="img-item upload-btn" @click="chooseImg2()" v-if="idPhoto.length < 1">
<image class="img" src="/static/imgs/tianjia-img.png" mode=""></image>
</view>
<view style="margin-top: 20upx;font-size: 24rpx;font-weight: 600;">点击上传服务后现场照片</view>
<view style="font-size: 26rpx;font-weight: 600;color: red;margin-top: 10rpx;">互联网信息系统严禁存储、传输、处理涉及国家秘密企业秘密以及敏感信息,违者将严肃问责追责!</view>
</view>
</view>
</view>
</view>
</view>
<view class="occupied" style="height: 200upx;"></view>
<view class="footer-btn" @click="submit">
<view class="btn" v-if="STATE==0">确认开始服务</view>
<view class="btn" v-if="STATE==1">确认结束服务</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
updateProperty
} from '@/common/api.js';
import {
callbackRequest,
getStorage,
alertTip,
convertImgToBase64,
wxSdk,
uploadImg
} from '@/common/util.js';
import {
pathToBase64
} from '@/js_sdk/mmmm-image-tools/index.js';
export default {
components: {},
data() {
return {
//分页
page: 1,
pageSize: 10,
loadingType: 0, //0-loading前1-loading中2-没有更多了
userInfo: getStorage('userInfo'),
userId:getStorage('userInfo').userId,
examIndex: 0,
examList: [],
index: 0,
firstIndex: 0,
submitFlag: true,
STATE:'',
APPROVAL_ID:'',
feedback:'',
id:'',
imgs: [],
imgsId: [],
idPhoto: [],
idPhotoId: [],
};
},
watch: {
},
onLoad(option) {
this.APPROVAL_ID = option.APPROVAL_ID||'';
this.STATE = option.STATE||'';
this.id = option.id||'';
},
onShow() {
},
methods: {
//上传开始照片
async chooseImg() {
let chec = 0;
let sty = [];
let _this = this;
uni.showActionSheet({
itemList: ['拍照', '相册'],
success: function(resp) {
chec = resp.tapIndex;
if (chec == 0) {
sty = ['camera']; //从相册相机选择
} else {
sty = ['album']; //从相册相机选择
}
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: sty,
quality: 1,
success: async function(res) {
let resData = res.tempFilePaths;
for (let i = 0; i < resData.length; i++) {
if (_this.imgs.length > 1) {
break;
}
uni.getImageInfo({
src: resData[i],
success: async (path) => {
convertImgToBase64(path.path,
async function(base64) {
if (_this.imgs.length <
1) {
// _this.imgs.push(base64);
uni.showLoading({
title: '图片上传中'
})
let blength =
base64.length;
let glength = 7500;
// console.log(
// "base64:",
// base64)
if (blength <=
glength) {
let uploadParam = {
base64: base64,
userId: getStorage(
'userInfo'
)
.userId +
i,
groupEnd: '1'
}
await uploadImg
(
uploadParam)
.then(
resu => {
resu =
resu
.data;
uni
.hideLoading();
if (resu
.returnCode !=
1
) {
alertTip
(resu
.returnMsg
);
} else {
_this
.imgs
.push(
base64
);
_this
.imgsId
.push(
resu
.returnData +
".jpg"
);
}
});
} else {
let fnum =
parseInt(
blength /
glength
);
for (let j =
1; j <
fnum +
1; j++) {
if (j ==
fnum) {
let groupBase =
base64
.slice(
(j -
1) *
glength
);
// console
// .log(
// groupBase
// .length,
// "groupBaselength"
// );
let uploadParam = {
base64: groupBase,
userId: getStorage(
'userInfo'
)
.userId +
i,
groupEnd: '1'
}
await uploadImg
(
uploadParam)
.then(
resu => {
resu =
resu
.data;
if (resu
.returnCode ==
1
) {
_this
.imgs
.push(
base64
);
_this
.imgsId
.push(
resu
.returnData +
".jpg"
);
} else {
uni
.hideLoading();
alertTip
(resu
.returnMsg
);
return;
}
}
);
} else {
let groupBase =
base64
.slice(
(j -
1) *
glength,
glength *
j
);
let uploadParam = {
base64: groupBase,
userId: getStorage(
'userInfo'
)
.userId +
i,
groupEnd: '0'
}
await uploadImg
(
uploadParam)
.then(
resu => {
resu =
resu
.data;
if (resu
.returnCode ==
1
) {} else {
uni
.hideLoading();
alertTip
(resu
.returnMsg
);
return;
}
}
);
}
}
uni
.hideLoading();
}
}
});
},
});
}
}
});
},
fail: function(resp) {
console.log(resp.errMsg);
}
});
},
//上传结束照片
async chooseImg2() {
let chec = 0;
let sty = [];
let _this = this;
uni.showActionSheet({
itemList: ['拍照', '相册'],
success: function(resp) {
chec = resp.tapIndex;
if (chec == 0) {
sty = ['camera']; //从相册相机选择
} else {
sty = ['album']; //从相册相机选择
}
uni.chooseImage({
count: 2,
sizeType: ['compressed'],
sourceType: sty,
quality: 1,
success: async function(res) {
let resData = res.tempFilePaths;
for (let i = 0; i < resData.length; i++) {
if (_this.idPhoto.length > 1) {
break;
}
uni.getImageInfo({
src: resData[i],
success: async (path) => {
convertImgToBase64(path.path,
async function(base64) {
if (_this.idPhoto.length < 1) {
// _this.imgs.push(base64);
uni.showLoading({
title: '图片上传中'
})
let blength = base64.length;
let glength = 7500;
// console.log("base64:",base64)
if (blength <=
glength) {
let uploadParam = {
base64: base64,
userId: getStorage('userInfo').userId +i,
groupEnd: '1'
}
await uploadImg(uploadParam)
.then(
resu => {
resu =resu.data;
uni.hideLoading();
if (resu.returnCode !=1) {
alertTip(resu.returnMsg);
} else {
_this.idPhoto.push(base64);
_this.idPhotoId.push(resu.returnData +".jpg");
}
});
} else {
let fnum =parseInt(blength /glength);
for (let j =1; j <fnum +1; j++) {
if (j ==fnum) {
let groupBase =base64.slice((j -1) *glength);
// console.log(groupBase.length,"groupBaselength");
let uploadParam = {
base64: groupBase,
userId: getStorage(
'userInfo'
)
.userId +
i,
groupEnd: '1'
}
await uploadImg
(
uploadParam)
.then(
resu => {
resu =
resu
.data;
if (resu
.returnCode ==
1
) {
_this
.idPhoto
.push(
base64
);
_this
.idPhotoId
.push(
resu
.returnData +
".jpg"
);
} else {
uni
.hideLoading();
alertTip
(resu
.returnMsg
);
return;
}
}
);
} else {
let groupBase =
base64
.slice(
(j -
1) *
glength,
glength *
j
);
let uploadParam = {
base64: groupBase,
userId: getStorage(
'userInfo'
)
.userId +
i,
groupEnd: '0'
}
await uploadImg
(
uploadParam)
.then(
resu => {
resu =
resu
.data;
if (resu
.returnCode ==
1
) {} else {
uni
.hideLoading();
alertTip
(resu
.returnMsg
);
return;
}
}
);
}
}
uni
.hideLoading();
}
}
});
},
});
}
}
});
},
fail: function(resp) {
console.log(resp.errMsg);
}
});
},
//删除开始图片
removeImg(index) {
this.imgs.splice(index, 1);
this.imgsId.splice(index, 1);
},
//删除结束图片
removeImg2(index) {
this.idPhoto.splice(index, 1);
this.idPhotoId.splice(index, 1);
},
submit(state){
if(!this.submitFlag){
return false;
}
this.submitFlag=false;
// console.log(this.APPROVAL_ID)
if (this.APPROVAL_ID !=this.userId && this.APPROVAL_ID!='') {
alertTip('办理人与当前用户不一致');
this.submitFlag = true;
return false;
}
if (this.STATE =='1'&&!this.feedback) {
alertTip('请输入服务反馈结果');
this.submitFlag = true;
return false;
}
if (this.STATE =='0'&&this.imgsId=='') {
alertTip('请上传服务前照片');
this.submitFlag = true;
return false;
}
if (this.STATE =='1'&&this.idPhoto=='') {
alertTip('请上传服务后照片');
this.submitFlag = true;
return false;
}
let params = {
"method": updateProperty,
"data":{
id: this.id,
userId:getStorage('userInfo').id,
userName:getStorage('userInfo').userName,
state:this.STATE,
feedback:this.feedback,
serviceFront: this.imgsId.toString(),
serviceAfter: this.idPhotoId.toString()
}
};
// console.log(params)
callbackRequest(params).then(res => {
res = res.data;
if (res.returnCode == 1) {
alertTip(res.returnMsg);
uni.navigateBack({
delta: 1
});
} else {
alertTip(res.returnMsg);
}
})
},
// 跳转详情
details: function(item) {
uni.navigateTo({
url: '/pages/access-card/access-card-detail?id=' + item.ID + '&item=' + JSON.stringify(
item)
});
},
},
onReachBottom() {
},
};
</script>
<style lang="scss">
@import url('../../static/css/repair/malfunction-repair.css');
@import '@/static/css/common.scss';
.radioBox{
height: 280upx;
}
.chosenCard{
background-color: #8DDDC5 !important;
}
.nolist {
font-size: 30upx;
color: #797979;
text-align: center;
margin-top: 20upx;
}
.main {
margin: 240upx 40upx 0;
position: relative;
z-index: 10;
.tab-box {
overflow: hidden;
// border-radius: 10upx 10upx 0 0;
// background: rgba(132, 149, 167, 0.8);
height: 80upx;
.tab-item {
float: left;
height: 70upx;
width: 35%;
font-size: 30upx;
// color: #e5f6ff;
// text-align: center;
line-height: 70upx;
}
.active {
// background: #fff;
color: #333;
border-radius: 10upx 10upx 0 0;
font-weight: bold;
}
.activeLine{
background: linear-gradient( 90deg, #50CBA1 0%, #06AEA6 100%), #5685F2;
border-radius: 10upx;
width: 80upx;
height: 10upx;
}
}
}
.list-content {
font-size: 28upx;
margin: 0 25upx;
margin-top: 20upx;
.details {
background: white;
padding: 0 20upx 20upx;
border-radius: 18upx;
margin-bottom: 20upx;
.detail_header {
border-bottom: #f8f8f8 5upx solid;
height: 100upx;
line-height: 100upx;
// margin: 0;
// border-radius: 10upx;
.blueSign {
height: 28upx;
width: 5upx;
background: #00c277;
display: inline-block;
margin-left: 20upx;
vertical-align: middle;
}
.font-tilte {
font-size: 32upx;
font-weight: bold;
margin-left: 20upx;
vertical-align: middle;
}
}
.detail_msg {
margin-left: 20upx;
border-radius: 10upx;
overflow: hidden;
view {
height: 60upx;
line-height: 60upx;
}
.status {
position: absolute;
color: red;
margin-left: 580upx;
margin-top: -15upx;
}
}
}
}
.statusgr {
float: right;
margin-right: 30upx;
color: #00c277;
}
.statusred {
width: 160upx;
height: 60upx;
line-height: 60upx;
text-align: center;
border-radius: 50upx;
float: right;
margin-right: 30upx;
margin-top: 25upx;
}
.img-box {
overflow: hidden;
padding: 40upx;
// padding-top: 20rpx;
// padding-bottom: 20rpx;
width: 100%;
text-align: center;
.img-item {
// float: left;
width: 100%;
height: 300upx;
border: 1px solid #ddd;
// margin: 0 22rpx 20upx 0upx;
position: relative;
box-sizing: border-box;
.img {
display: block;
width: 100%;
height: 100%;
}
.remove-btn {
position: absolute;
top: -18upx;
right: -18upx;
width: 44upx;
height: 44upx;
z-index: 2;
}
}
.upload-btn {
.img {
width: 60upx;
height: 60upx;
margin: 120upx auto;
}
}
}
.detail_msg .info-item {
font-size: 28upx;
margin-right: 30upx;
text {
display: inline-block;
width: 140upx;
color: #999;
}
.infoSpan {
width: auto;
font-size: 28upx;
color: #999;
float: right;
}
}
.input-box {
margin-left:40upx;
input {
width: 100%;
height: 50upx;
line-height: 50upx;
font-size: 26upx;
color: #666;
}
}
.form-box {
background: #fff;
.form-item {
overflow: hidden;
border-bottom: 1px solid #eee;
padding: 30upx 20upx;
.label {
float: left;
width: 150upx;
font-size: 28upx;
color: #333;
font-weight: bold;
line-height: 50upx;
}
.ipt-box {
margin-left: 160upx;
.areaBtn{
font-size: 24upx;
width: 100upx;
height: 60upx;
line-height: 65upx;
text-align: center;
background: linear-gradient( 90deg, #50CBA1 0%, #06AEA6 100%), #C1EFEA;
border-radius: 15upx;
color: #fff;
margin-right: 20upx;
}
input {
width: 100%;
height: 50upx;
line-height: 50upx;
font-size: 26upx;
color: #666;
}
}
.select {
.arrow {
float: right;
width: 16upx;
height: 29upx;
margin-top: 10upx;
}
.picker {
height: 50upx;
line-height: 50upx;
font-size: 26upx;
color: #666;
margin-left: 10upx;
}
}
}
}
.comment-btn {
float: right;
font-size: 24upx;
border-radius: 10upx;
color: #fff;
// line-height: 30upx;
text-align: center;
min-width: 120upx;
margin-right: 30upx;
background-color: #00c277;
}
.common-shade {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.7);
z-index: 99;
}
.box {
display: flex;
display: -webkit-flex;
}
.box-row-reverse {
flex-direction: row;
}
/*上下排列*/
.box-column {
flex-direction: column;
}
/*上下排列*/
.box-left {
justify-content: flex-start;
}
/*居右*/
.box-right {
justify-content: flex-end;
}
/*居左*/
.box-center {
justify-content: center;
}
/*居中*/
.box-between {
justify-content: space-between;
}
/*两端对齐*/
.box-align-center {
align-items: center;
}
.box-wrap {
flex-wrap: wrap;
}
</style>