chuangte_bike_newxcx/page_user/hcshenhe.vue

310 lines
7.0 KiB
Vue
Raw Normal View History

2025-04-10 08:57:21 +08:00
<template>
<view class="page">
<u-navbar title="拍照还车" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='45'
back-icon-color='#fff'></u-navbar>
<view class="tip_box">
请将车辆正确停放指定停车点后环绕车拍摄视 押金将在审核通过后退还账户
</view>
<view class="cont">
<view class="tip_txt">
我们将在12小时内完成审核
</view>
<view class="vadio_png1">
<image class="backimg" src="https://lxnapi.ccttiot.com/bike/img/static/uEP0UPJw6a1WuxA7ZlMo" mode="" v-if="videoUrl==''"></image>
<image @click="recordVideo" class="tip_img" src="https://lxnapi.ccttiot.com/bike/img/static/uXFG7Vee8MWx5y7pha2U" mode="" v-if="videoUrl==''"></image>
<video class="vad" :src="videoUrl" controls="controls" style="width: 100%;" v-if="videoUrl!=''"></video>
<!-- <view class="glass" v-if="videoUrl!=''"></view>
<image class="tip_img" src="https://lxnapi.ccttiot.com/bike/img/static/uXFG7Vee8MWx5y7pha2U" mode="" v-if="videoUrl!=''"></image> -->
</view>
<view class="tip_txt" style="font-weight: 500;font-size: 32rpx;color: #3D3D3D;">
保持车辆录像的完整清晰,不要随意拍摄确保视频中车辆出境并且出现车牌号
</view>
<view class="vadio_png">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uVuGMvfe3xlz3x8WSmcC" mode=""></image>
</view>
<view class="btn" @click="sub" :class='videoUrl!="" ? "act1": ""'>
还车
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#4297F3",
},
videoPath: '',
imglist:[],
token: '',
upurl:'',
orderinfo:{},
userId:'',
videoUrl:''
}
},
onLoad(e) {
this.orderId = e.orderid
},
onShow() {
this.getQiniuToken()
// this.getuserInfo()
},
methods: {
sub(){
uni.getLocation({
type: 'wgs84',
success: (res) => {
console.log(res);
this.lat = res.latitude
this.lon = res.longitude
this.getfeiyong()
},
fail: (err) => {
console.error('获取位置失败:', err)
this.getfeiyong()
}
})
},
getfeiyong(){
let data = {
orderId:this.orderId,
picture:this.videoUrl,
lon:this.lon,
lat:this.lat
}
this.$u.put(`/app/order/end`,data).then(res =>{
if(res.code == 200){
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 2000
})
setTimeout(()=>{
uni.switchTab({
url:'/pages/myorder/returned/index'
})
},1500)
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
getisInOrder() {
// uni.showLoading({
// })
this.orderinfo = {}
if (this.userId) {
this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => {
// uni.hideLoading()
if (res.code === 200) {
// this.freList=res.rows
this.orderinfo=res.data[0]
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
}
},
getuserInfo() {
this.$u.get("/getAppInfo").then((res) => {
if (res.code == 200) {
this.$store.commit('SET_USERID', res.user.userId);
this.info = res.user
this.userId=res.user.userId
this.getisInOrder()
// if( res.user.role==2){
// uni.navigateTo({
// url:'/page_fix/fix_index'
// })
// }
} else {
}
});
},
getQiniuToken() {
console.log('diaou');
this.$u.get("/common/qiniuToken").then((res) => {
if (res.code == 200) {
this.token=res.data
// console.log(res,'resres');
// this.upurl=res.domain
}
});
// this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => {
// console.log(res.data);
// this.token = res.data.token
// }).catch(err => {
// console.log(err)
// })
},
recordVideo() {
// 调用录像API
uni.chooseVideo({
sourceType: ['camera'], // 指定使用相机录像
camera: 'back', // 指定使用后置摄像头可选值有front、back
maxDuration: 15, // 最大录制时长(秒)
success: (res) => {
// 获取视频录制文件的临时路径
this.videoPath = res.tempFilePath;
console.log(res.tempFilePath);
this.upload()
},
fail: (err) => {
console.log('录像失败:', err);
}
});
},
upload(){
uni.showLoading({
title:'上传中'
})
let _this=this
let math='static/'+_this.$u.guid(20)
wx.uploadFile({
url: 'https://up-z2.qiniup.com',
name: 'file',
filePath: this.videoPath,
formData: {
token: _this.token, //后端返回的token
key:'bike/video/'+math
},
success: function(res) {
uni.hideLoading()
console.log(res,'resres');
let str = JSON.parse(res.data)
console.log(str.key)
_this.videoUrl = 'https://api.ccttiot.com/' + str.key
console.log(_this.userImgs)
// _this.imglist.push(_this.userImgs)
}
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #F7FAFE;
}
.page {
// width: 750rpx;
width: 750rpx;
// height: 530rpx;
// background: linear-gradient( 180deg, #4297F3 0%, rgba(255,255,255,0) 100%), #FFFFFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.tip_box {
padding: 44rpx 36rpx;
font-weight: 400;
font-size: 32rpx;
color: #ccc;
// background: #4297F3;
}
.vadio_png1{
position: relative;
width: 672rpx;
height: 370rpx;
margin-top: 30rpx;
.backimg{
width: 672rpx;
height: 370rpx;
}
.tip_img{
position: absolute;
top: 72rpx;
left: 210rpx;
width: 252rpx;
height: 194rpx;
z-index: 11;
}
.vad{
width: 672rpx;
height: 370rpx;
border-radius: 40rpx;
z-index: 1;
}
.glass{
position: absolute;
top: 0;
left: 0;
width: 672rpx;
height: 370rpx;
background: rgba(255, 255, 255, 0.2);
border-radius: 40rpx;
// box-shadow: 0 rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10rpx);
-webkit-backdrop-filter: blur(10rpx); /* For Safari */
// border: 1rpx solid rgba(255, 255, 255, 0.3);
z-index: 10;
}
}
.cont {
width: 100%;
padding: 0 39rpx;
.tip_txt {
width: 100%;
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
.vadio_png {
margin-top: 52rpx;
image {
width: 672rpx;
height: 370rpx;
}
}
.btn {
position: fixed;
bottom: 100rpx;
left: 38rpx;
// margin-top: 128rpx;
display: flex;
align-items: center;
justify-content: center;
width: 680rpx;
height: 90rpx;
background: #4297F3;
border-radius: 54rpx 54rpx 54rpx 54rpx;
z-index: 10;
font-weight: 500;
font-size: 40rpx;
color: #FFFFFF;
}
.act1{
background: #4297F3;
}
}
}
</style>