NurseStationPersonApp/pages/confirmCompletion/confirmCompletion.vue

349 lines
8.3 KiB
Vue
Raw Normal View History

2022-11-03 18:16:30 +08:00
<template>
<view class="app">
<view class="picture">
<view class="attendantImg">
护理员到岗照片
</view>
2022-11-10 10:51:44 +08:00
<view class="uppicture" @tap='uploadonDutyPictureUrl'>
2022-11-10 11:42:23 +08:00
<view class="choice" v-if="!onDutyPictureUrl">
2022-11-18 13:20:45 +08:00
拍摄照片
2022-11-10 10:51:44 +08:00
</view>
2022-11-10 11:42:23 +08:00
<image v-else :src="onDutyPictureUrl" mode=""></image>
2022-11-10 10:51:44 +08:00
<!-- <u-upload class="slot-btn" width="530" height="130" ></u-upload> -->
2022-11-03 18:16:30 +08:00
</view>
</view>
2022-11-10 10:51:44 +08:00
<!-- <view class="picture" style="height: 330rpx;">
2022-11-03 18:16:30 +08:00
<view class="attendantImg">
服务进行中视频不少于1min<span>*选填</span>
</view>
<view class="uppicture">
2022-11-10 10:51:44 +08:00
<u-upload class="slot-btn" width="530" height="130"></u-upload>
2022-11-03 18:16:30 +08:00
</view>
<view class="user">
<image src="../../static/radio.png" mode=""></image>
用户不同意拍摄
</view>
2022-11-10 10:51:44 +08:00
</view> -->
2022-11-03 18:16:30 +08:00
<view class="picture">
<view class="attendantImg">
服务结束照片
</view>
2022-11-10 10:51:44 +08:00
<view class="uppicture" @tap='uploadserviceEndPictureUrl'>
2022-11-10 11:42:23 +08:00
<view class="choice" v-if="!serviceEndPictureUrl">
2022-11-18 13:20:45 +08:00
拍摄照片
2022-11-10 10:51:44 +08:00
</view>
2022-11-10 11:42:23 +08:00
<image v-else :src="serviceEndPictureUrl" mode=""></image>
2022-11-10 10:51:44 +08:00
<!-- <u-upload class="slot-btn" width="530" height="130" ></u-upload> -->
2022-11-03 18:16:30 +08:00
</view>
</view>
2022-11-18 13:20:45 +08:00
<view class="picture" style="height: 730rpx;">
2022-11-03 18:16:30 +08:00
<view class="attendantImg" style="border-bottom: 1rpx solid #BAB7B8;">
用户签名确认
</view>
<view class="receive">
我确认已接受服务
</view>
2022-11-10 10:51:44 +08:00
<view class="uppicture" @tap='show=true'>
2022-11-10 11:42:23 +08:00
<image v-if="!userSignaturePictureUrl" style="width: 36rpx;height: 36rpx;margin:8% 0 0 35%"
2022-11-10 10:51:44 +08:00
src="../../static/autograph.png" mode="">
</image>
2022-11-10 11:42:23 +08:00
<span v-if="!userSignaturePictureUrl">点此签名</span>
<image v-else :src="userSignaturePictureUrl" mode=""></image>
2022-11-03 18:16:30 +08:00
<!-- <u-upload class="slot-btn" :action="action" :file-list="fileList" width="620" height="130"></u-upload> -->
</view>
</view>
<view class="submit">
2022-11-10 10:51:44 +08:00
<view class="finish" @tap='buyfinish'>
2022-11-03 18:16:30 +08:00
去完成
</view>
</view>
2022-11-10 10:51:44 +08:00
<u-mask :show="show" @click="show = false">
2022-11-10 11:42:23 +08:00
<signature @userSignaturePictureUrl='userSignaturePicture' @click.native.stop
2022-11-10 10:51:44 +08:00
style='position:absolute;bottom:0%;width: 100%;height: 800rpx;'></signature>
</u-mask>
<u-toast ref="uToast" />
2022-11-03 18:16:30 +08:00
</view>
</template>
<script>
2022-11-10 10:51:44 +08:00
import signature from '../signature/signature.vue'
import {
orderConfirm
} from '@/api/confirmCompletion/index.js'
import baseurl from '@/api/baseurl.js'
2022-11-03 18:16:30 +08:00
export default {
2022-11-10 10:51:44 +08:00
components: {
signature
},
2022-11-03 18:16:30 +08:00
data() {
return {
2022-11-10 10:51:44 +08:00
show: false,
orderNo: null,
2022-11-10 11:42:23 +08:00
onDutyPictureUrl: null,
serviceEndPictureUrl: null,
userSignaturePictureUrl: null,
2022-11-10 10:51:44 +08:00
list: {
2023-02-23 09:54:22 +08:00
res: {},
2022-11-10 10:51:44 +08:00
id: null,
2023-02-23 09:54:22 +08:00
serviceLocationName:null,
2022-11-10 10:51:44 +08:00
onDutyPictureUrl: null,
serviceEndPictureUrl: null,
userSignaturePictureUrl: null,
2022-12-01 17:05:15 +08:00
serveLocationLatitude: null,
serveLocationLongitude: null,
2022-11-10 10:51:44 +08:00
},
2022-11-03 18:16:30 +08:00
}
},
methods: {
2022-11-10 10:51:44 +08:00
//签名
2022-11-10 11:42:23 +08:00
userSignaturePicture(data) {
this.userSignaturePictureUrl = data
2022-11-10 10:51:44 +08:00
this.show = false
},
// /base64转二进制
dataURLtoBlob(dataurl) {
var arr = dataurl.split(","),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {
type: mime,
});
},
//上传头像
uploadserviceEndPictureUrl() { //服务结束照片
var that = this;
uni.chooseImage({
count: 1,
2022-11-18 13:20:45 +08:00
sourceType: ['camera'],
2022-11-10 10:51:44 +08:00
success(res) {
2022-11-10 11:42:23 +08:00
that.serviceEndPictureUrl = res.tempFilePaths[0]
2022-11-10 10:51:44 +08:00
}
})
},
uploadonDutyPictureUrl() { //护理员到岗照片
var that = this;
uni.chooseImage({
count: 1,
2022-11-18 13:20:45 +08:00
sourceType: ['camera'],
2022-11-10 10:51:44 +08:00
success(res) {
2022-11-10 11:42:23 +08:00
that.onDutyPictureUrl = res.tempFilePaths[0]
2022-11-10 10:51:44 +08:00
}
})
},
//完成
buyfinish() {
2022-11-18 13:20:45 +08:00
if (this.serviceEndPictureUrl && this.userSignaturePictureUrl && this.onDutyPictureUrl) {
let that = this
uni.uploadFile({
url: baseurl + '/nurseApplet/uploadFile/uploadPictureUrl',
filePath: that.serviceEndPictureUrl,
name: 'file',
formData: {
'orderNo': that.orderNo
},
timeout: 5000,
success(res) {
that.list.serviceEndPictureUrl = JSON.parse(res.data).imgUrl
uni.uploadFile({
url: baseurl + '/nurseApplet/uploadFile/uploadPictureUrl',
filePath: that.userSignaturePictureUrl,
name: 'file',
formData: {
'orderNo': that.orderNo
},
timeout: 5000,
success(res) {
that.list.userSignaturePictureUrl = JSON.parse(res.data).imgUrl
uni.uploadFile({
url: baseurl + '/nurseApplet/uploadFile/uploadPictureUrl',
filePath: that.onDutyPictureUrl,
name: 'file',
formData: {
'orderNo': that.orderNo
},
timeout: 5000,
success(res) {
that.list.onDutyPictureUrl = JSON.parse(res.data)
.imgUrl
orderConfirm(that.list).then(res => {
if (res.code == 200) {
that.$refs.uToast.show({
title: '服务完成',
type: 'success',
duration: '1500',
2022-11-10 10:51:44 +08:00
})
2022-12-01 17:05:15 +08:00
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
2022-11-18 13:20:45 +08:00
uni.navigateBack({
delta: 1
})
}, 1500)
} else {
that.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
}
})
}
})
}
})
} else {
this.$refs.uToast.show({
title: '请上传全部照片并用户签名确认',
type: 'error'
})
}
2022-11-10 10:51:44 +08:00
},
},
onLoad(options) {
this.list.id = options.orderDetailsId
this.orderNo = options.orderNo
2022-12-01 17:05:15 +08:00
var that = this
uni.getLocation({
2023-02-23 09:54:22 +08:00
type: 'gcj02',
geocode: true,
2022-12-01 17:05:15 +08:00
success: function(res) {
2023-02-23 09:54:22 +08:00
that.list.serviceLocationName = res.address.poiName
2022-12-01 17:05:15 +08:00
that.list.serveLocationLatitude = res.latitude
that.list.serveLocationLongitude = res.longitude
},
fail: error => {
uni.showModal({
title: '提示',
content: '获取定位失败,是否授权打开定位',
success: (res) => {
if (res.confirm) {
uni.getSystemInfo({
success: (sys) => {
if (sys.platform == 'ios') {
plus.runtime.openURL(
"app-settings://");
} else {
var main = plus.android
.runtimeMainActivity();
var Intent = plus.android.importClass(
"android.content.Intent");
//可能应该直接进入应用列表的权限设置?=> android.settings.APPLICATION_SETTINGS
var mIntent = new Intent(
'android.settings.LOCATION_SOURCE_SETTINGS'
);
main.startActivity(mIntent);
}
}
})
}
}
})
}
});
2022-11-10 10:51:44 +08:00
},
2022-11-03 18:16:30 +08:00
}
</script>
<style lang="scss">
.app {
padding: 3%;
font-size: 36rpx;
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
.picture {
width: 95%;
2022-11-18 13:20:45 +08:00
height: 630rpx;
2022-11-03 18:16:30 +08:00
background: #FFFFFF;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20px;
2022-11-18 13:20:45 +08:00
margin: 20rpx auto 0;
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
.attendantImg {
color: #000000;
height: 88rpx;
line-height: 88rpx;
margin-left: 30rpx;
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
span {
color: #BAB7B8;
}
}
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
.uppicture {
border: 1rpx dashed #818181;
width: 90%;
2022-11-18 13:20:45 +08:00
height: 500rpx;
2022-11-03 18:16:30 +08:00
margin: 0 auto;
2022-11-10 10:51:44 +08:00
position: relative;
image {
width: 100%;
2022-11-18 13:20:45 +08:00
height: 100%;
2022-11-10 10:51:44 +08:00
}
.choice {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
2022-11-03 18:16:30 +08:00
::v-deep .u-list-item[data-v-49deb6f2] {
background: #FFFFFF;
}
span {
font-size: 35rpx;
color: #969394;
}
}
2022-11-10 10:51:44 +08:00
.user {
2022-11-03 18:16:30 +08:00
height: 88rpx;
line-height: 88rpx;
color: #969394;
margin-left: 30rpx;
2022-11-10 10:51:44 +08:00
image {
2022-11-03 18:16:30 +08:00
width: 34rpx;
height: 34rpx;
}
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
}
2022-11-10 10:51:44 +08:00
2022-11-03 18:16:30 +08:00
.receive {
height: 88rpx;
line-height: 88rpx;
color: #969394;
margin-left: 30rpx;
}
}
2022-11-10 10:51:44 +08:00
.submit {
2022-11-18 13:20:45 +08:00
width: 32%;
2022-11-03 18:16:30 +08:00
height: 68rpx;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
margin-left: 60%;
2022-11-10 10:51:44 +08:00
.finish {
2022-11-18 13:20:45 +08:00
width: 100%;
2022-11-03 18:16:30 +08:00
height: 68rpx;
line-height: 68rpx;
background: #4C7BC9;
border-radius: 26rpx;
2022-11-18 13:20:45 +08:00
margin-top: 100rpx;
2022-11-03 18:16:30 +08:00
}
}
}
</style>