chuangte_bike_newxcx/page_user/hcshenhe.vue

717 lines
18 KiB
Vue
Raw Normal View History

2025-04-10 08:57:21 +08:00
<template>
<view class="page">
2025-04-11 18:23:16 +08:00
<u-navbar title="还车" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='45'
2025-04-10 08:57:21 +08:00
back-icon-color='#fff'></u-navbar>
<view class="tip_box">
请将车辆正确停放指定停车点后环绕车拍摄视 押金将在审核通过后退还账户
</view>
<view class="cont">
<view class="tip_txt">
我们将在12小时内完成审核
</view>
2025-04-17 17:12:42 +08:00
<view class="vadio_png1">
2025-04-11 18:23:16 +08:00
<image @click="recordVideo" class="backimg" src="https://api.ccttiot.com/smartmeter/img/static/uTwV4aH6HbxqmM1ssvTs" mode="" v-if="videoUrl==''"></image>
2025-04-10 08:57:21 +08:00
<video class="vad" :src="videoUrl" controls="controls" style="width: 100%;" v-if="videoUrl!=''"></video>
</view>
2025-04-11 18:23:16 +08:00
<view class="tip_txt" style="font-weight: 500;font-size: 32rpx;color: #3D3D3D;margin-top: 30rpx;">
2025-04-10 08:57:21 +08:00
保持车辆录像的完整清晰,不要随意拍摄确保视频中车辆出境并且出现车牌号
</view>
<view class="vadio_png">
2025-06-06 11:32:12 +08:00
<image :src="iconobj.huancheimgone" mode=""></image>
2025-04-10 08:57:21 +08:00
</view>
<view class="btn" @click="sub" :class='videoUrl!="" ? "act1": ""'>
还车
</view>
</view>
2025-04-11 18:23:16 +08:00
<!-- 扫码用车未在停车点内还车弹窗 -->
<view class="tingchetc" v-if="fjflag">
<view class="topname">
2025-06-06 11:32:12 +08:00
<image :src="iconobj.huancheimgtwo" mode=""></image> {{fajinobj.manageFee > 0 ? '不在运营区' : fajinobj.dispatchFee > 0 ? '不在停车点' : ''}}
2025-04-11 18:23:16 +08:00
</view>
<view class="shuom">
需支付<text>{{fajinobj.manageFee > 0 ? fajinobj.manageFee : fajinobj.dispatchFee > 0 ? fajinobj.dispatchFee : ''}}</text>你可查看<text @click="btntcd">最近停车点</text>
</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uzRrRFiToK3bb3IurIHU" class="tcimg" mode=""></image>
<view class="btnan">
<view class="fj" @click="btnfajin">
缴纳罚金还车
</view>
<view class="qx" @click="fjflag = false">
继续骑行
</view>
</view>
</view>
<view class="mask" v-if="fjflag"></view>
2025-04-10 08:57:21 +08:00
</view>
</template>
<script>
2025-06-25 17:07:51 +08:00
var xBlufi = require("@/components/blufi/xBlufi.js")
2025-04-10 08:57:21 +08:00
export default {
data() {
return {
2025-06-06 11:32:12 +08:00
iconobj:this.$store.state.iconobj,
2025-04-10 08:57:21 +08:00
bgc: {
backgroundColor: "#4297F3",
},
videoPath: '',
imglist:[],
token: '',
upurl:'',
orderinfo:{},
userId:'',
2025-04-11 18:23:16 +08:00
videoUrl:'',
fjflag:false,
fajinobj:{},
2025-06-06 11:32:12 +08:00
orderAreaId:'',
2025-12-20 14:29:10 +08:00
flag:true,
2025-10-25 15:52:11 +08:00
mac:'',
2026-02-06 15:28:01 +08:00
scdevlist:[],
endOrderRetryCount: 0, // 结束订单重试计数器
bluetoothQValue: null // 蓝牙关锁的q值
2025-04-10 08:57:21 +08:00
}
},
onLoad(e) {
this.orderId = e.orderid
2025-04-11 18:23:16 +08:00
this.orderAreaId = e.orderAreaId
2025-06-06 11:32:12 +08:00
this.flag = e.flag
2025-10-25 15:52:11 +08:00
this.scdevlist = e.macList.split(',')
console.log(e)
2025-06-06 11:32:12 +08:00
if(e.mac){
this.mac = e.mac
}
console.log(e,this.flag);
2025-12-20 14:29:10 +08:00
},
2025-04-10 08:57:21 +08:00
onShow() {
this.getQiniuToken()
},
methods: {
2025-04-11 18:23:16 +08:00
// 点击缴纳罚金继续还车
btnfajin(){
this.fjflag = false
this.gethc()
},
// 点击跳转到最近停车点
btntcd(){
uni.navigateTo({
url:'/pages/myorder/returned/tingche?areaId=' + this.orderAreaId
})
},
2025-04-10 08:57:21 +08:00
sub(){
2025-04-17 17:12:42 +08:00
uni.showLoading({
title: '还车中...',
mask: true
})
2025-04-10 08:57:21 +08:00
uni.getLocation({
2025-08-30 17:38:15 +08:00
type: 'gcj02',
2025-04-17 17:12:42 +08:00
isHighAccuracy:true,
2025-04-10 08:57:21 +08:00
success: (res) => {
console.log(res);
this.lat = res.latitude
this.lon = res.longitude
this.getfeiyong()
},
fail: (err) => {
2025-06-06 11:32:12 +08:00
this.lat = null
this.lon = null
2025-04-10 08:57:21 +08:00
console.error('获取位置失败:', err)
this.getfeiyong()
}
})
},
2025-04-11 18:23:16 +08:00
// 点击还车判断是否需要另外缴费
2025-04-10 08:57:21 +08:00
getfeiyong(){
2025-04-11 18:23:16 +08:00
let data = {
orderId:this.orderId,
2025-04-17 17:12:42 +08:00
lon:this.lon,
2025-04-23 17:50:42 +08:00
lat:this.lat,
2025-06-06 11:32:12 +08:00
checkLocation:true,
2025-11-08 09:37:13 +08:00
macList:this.scdevlist
2025-04-11 18:23:16 +08:00
}
this.$u.post(`/app/order/calcFee`,data).then(res =>{
if(res.code == 200){
this.fajinobj = res.data
if(res.data.manageFee > 0 || res.data.dispatchFee > 0){
2025-04-17 17:12:42 +08:00
uni.hideLoading()
2025-04-11 18:23:16 +08:00
this.fjflag = true
}else{
this.gethc()
}
2025-04-17 17:12:42 +08:00
}else{
uni.hideLoading()
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2025-04-17 17:12:42 +08:00
})
2025-04-11 18:23:16 +08:00
}
})
},
2026-02-06 15:28:01 +08:00
// 重试结束订单接口(直接调用 /app/order/end
retryEndOrder(endData, successCallback) {
uni.showLoading({
title: '还车中...',
mask: true
})
let that = this
// 如果重试次数小于3次继续重试
if (that.endOrderRetryCount < 3) {
that.endOrderRetryCount++
// 如果是蓝牙关锁且q值等于0添加ignoreSmart参数
if (that.bluetoothQValue === 0) {
endData.ignoreSmart = true
}
// 延迟1秒后发送请求
setTimeout(() => {
that.$u.put(`/app/order/end`, endData).then(res => {
if (res.code == 200) {
// 成功,重置计数器并执行成功回调
that.endOrderRetryCount = 0
if (successCallback) {
successCallback()
}
} else if (res.code == 30004) {
// 还是30004继续重试
that.retryEndOrder(endData, successCallback)
} else {
uni.hideLoading()
// 其他错误,重置计数器并显示错误
that.endOrderRetryCount = 0
if (res.msg) {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 5000
})
} else {
uni.hideLoading()
uni.showToast({
title: '未知错误',
icon: 'none',
duration: 5000
})
}
}
}).catch(err => {
// 请求失败,重置计数器并显示错误
uni.hideLoading()
that.endOrderRetryCount = 0
uni.showToast({
title: '还车失败,请稍后再试',
icon: 'none',
duration: 5000
})
})
}, 3000)
} else {
// 超过3次重试显示错误提示
uni.hideLoading()
that.endOrderRetryCount = 0
uni.showToast({
title: '还车失败,请稍后再试',
icon: 'none',
duration: 5000
})
}
},
2025-04-11 18:23:16 +08:00
gethc(){
2025-07-15 17:36:34 +08:00
uni.showLoading({
title: '还车中...',
mask: true
})
2025-12-20 14:29:10 +08:00
if(this.videoUrl == ''){
uni.showToast({
title: '请上传还车视频',
icon: 'success',
duration: 5000
})
return
}
console.log(this.flag,'222222222222222');
2025-06-25 17:07:51 +08:00
if(this.flag == true){
2025-12-20 14:29:10 +08:00
console.log('121212121121121212121212121212121212121');
2026-01-17 17:33:26 +08:00
let finishData = {
orderId: this.orderId,
lon: this.lon,
lat: this.lat,
2025-12-20 14:29:10 +08:00
requiredIot: true,
2026-01-17 17:33:26 +08:00
macList:this.scdevlist,
2025-06-25 17:07:51 +08:00
}
2026-01-17 17:33:26 +08:00
this.$u.put(`/app/order/finishDevice`, finishData).then(res => {
if(res.code == 200){
let data = {
orderId:this.orderId,
picture:this.videoUrl,
lon:this.lon,
lat:this.lat,
macList:this.scdevlist
}
this.$u.put(`/app/order/end`,data).then(res =>{
if (res.code == 200) {
this.fjflag = false
uni.hideLoading()
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 2000
})
setTimeout(()=>{
uni.redirectTo({
url:'/page_user/yongche/orderxq?id=' + this.orderId
})
2026-02-06 15:28:01 +08:00
},200)
} else if (res.code == 30004) {
// 重置计数器,开始重试
this.endOrderRetryCount = 0
// 创建成功回调
const successCallback = () => {
this.fjflag = false
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 2000
})
setTimeout(() => {
uni.redirectTo({
url: '/page_user/yongche/orderxq?id=' +this.orderId
})
}, 200)
}
// 调用重试函数
this.retryEndOrder(datas, successCallback)
} else if(res.msg == null) {
2026-01-17 17:33:26 +08:00
uni.hideLoading()
uni.showToast({
title: '未知错误',
icon: 'none',
duration: 2000
2025-06-25 17:07:51 +08:00
})
2026-01-17 17:33:26 +08:00
} else {
uni.hideLoading()
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2026-01-17 17:33:26 +08:00
})
}
2025-06-06 11:32:12 +08:00
})
2026-01-17 17:33:26 +08:00
}else{
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2025-06-06 11:32:12 +08:00
})
2025-06-25 17:07:51 +08:00
}
})
}else{
2026-01-17 17:33:26 +08:00
let finishData = {
orderId: this.orderId,
lon: this.lon,
lat: this.lat,
requiredIot: true,
macList:this.scdevlist,
2025-06-25 17:07:51 +08:00
}
2026-01-17 17:33:26 +08:00
this.$u.put(`/app/order/finishDevice`, finishData).then(res => {
if(res.code == 200){
console.log('55987897857894878787878');
let data = {
orderId:this.orderId,
picture:this.videoUrl,
lon:this.lon,
lat:this.lat,
macList:this.scdevlist
}
this.$u.put(`/app/order/end`,data).then(res =>{
if (res.code == 200) {
this.fjflag = false
2025-07-15 17:36:34 +08:00
uni.hideLoading()
2026-01-17 17:33:26 +08:00
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 2000
2025-07-15 17:36:34 +08:00
})
2026-01-17 17:33:26 +08:00
setTimeout(()=>{
uni.redirectTo({
url:'/page_user/yongche/orderxq?id=' + this.orderId
})
2026-02-06 15:28:01 +08:00
},200)
} else if (res.code == 30004) {
// 重置计数器,开始重试
this.endOrderRetryCount = 0
// 创建成功回调
const successCallback = () => {
setTimeout(() => {
setTimeout(() => {
uni.redirectTo({
url: '/page_user/yongche/orderxq?id=' +this.orderId
})
}, 1000)
}, 200)
}
// 调用重试函数
this.retryEndOrder(data, successCallback)
2026-01-17 17:33:26 +08:00
}else if(res.msg == null) {
uni.hideLoading()
uni.showToast({
title: '未知错误',
icon: 'none',
duration: 2000
})
} else {
uni.hideLoading()
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2026-01-17 17:33:26 +08:00
})
}
2025-06-06 11:32:12 +08:00
})
2026-01-17 17:33:26 +08:00
}else if(res.code == 20001 || res.code == 20002 || res.code == 20003){
xBlufi.notifySendCustomData({
customData: "11closesub300@"
})
let finishData = {
orderId: this.orderId,
lon: this.lon,
lat: this.lat,
requiredIot: false,
macList:this.scdevlist,
}
this.$u.put(`/app/order/finishDevice`, finishData).then(res =>{
if(res.code == 200){
let data = {
orderId:this.orderId,
picture:this.videoUrl,
lon:this.lon,
lat:this.lat,
macList:this.scdevlist
}
this.$u.put(`/app/order/end`,data).then(res =>{
if (res.code == 200) {
this.fjflag = false
let data = {
mac:this.mac,
reason:'还车',
command:'11closesub300@',
longitude:this.lon,
latitude:this.lat,
result:'成功'
}
this.$u.post(`/app/commandLog/bluetooth`,data).then(res => {
console.log(res,'蓝牙')
})
setTimeout(()=>{
xBlufi.notifySendCustomData({
customData: "11reboot@"
})
setTimeout(()=>{
uni.hideLoading()
uni.redirectTo({
url:'/page_user/yongche/orderxq?id=' + this.orderId
})
},1000)
},1000)
2026-02-06 15:28:01 +08:00
} else if (res.code == 30004) {
// 重置计数器,开始重试
this.endOrderRetryCount = 0
// 创建成功回调
const successCallback = () => {
setTimeout(() => {
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 5000
})
setTimeout(() => {
uni.navigateTo({
url: '/page_user/yongche/orderxq?id=' +this.orderId
})
},1000)
}, 1000)
}
// 调用重试函数
this.retryEndOrder(data, successCallback)
} else if(res.msg == null) {
2026-01-17 17:33:26 +08:00
uni.hideLoading()
uni.showToast({
title: '未知错误',
icon: 'none',
2026-02-02 17:32:09 +08:00
duration: 5000
2026-01-17 17:33:26 +08:00
})
} else {
uni.hideLoading()
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2026-01-17 17:33:26 +08:00
})
}
})
}else{
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2026-01-17 17:33:26 +08:00
})
}
})
}else{
2026-02-02 17:32:09 +08:00
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
confirmText: '知道了'
2025-06-06 16:53:36 +08:00
})
2025-06-06 11:32:12 +08:00
}
2025-06-25 17:07:51 +08:00
})
}
2025-04-10 08:57:21 +08:00
},
getisInOrder() {
this.orderinfo = {}
if (this.userId) {
this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => {
if (res.code === 200) {
this.orderinfo=res.data[0]
} else {
uni.showToast({
title: res.msg,
icon: 'none',
2026-02-02 17:32:09 +08:00
duration: 5000
2025-10-25 15:52:11 +08:00
})
2025-04-10 08:57:21 +08:00
}
})
}
},
getuserInfo() {
this.$u.get("/getAppInfo").then((res) => {
2025-04-27 17:37:23 +08:00
if (res.code == 200) {
2025-04-10 08:57:21 +08:00
this.$store.commit('SET_USERID', res.user.userId);
this.info = res.user
this.userId=res.user.userId
this.getisInOrder()
} else {
}
2025-04-27 17:37:23 +08:00
})
2025-04-10 08:57:21 +08:00
},
getQiniuToken() {
2025-10-25 15:52:11 +08:00
console.log('diaou')
this.$u.get("/common/qiniuToken").then((res) => {
if (res.code == 200) {
this.token = res.data
}
})
2025-04-10 08:57:21 +08:00
},
recordVideo() {
// 调用录像API
uni.chooseVideo({
sourceType: ['camera'], // 指定使用相机录像
camera: 'back', // 指定使用后置摄像头可选值有front、back
maxDuration: 15, // 最大录制时长(秒)
success: (res) => {
// 获取视频录制文件的临时路径
2025-10-25 15:52:11 +08:00
this.videoPath = res.tempFilePath
console.log(res.tempFilePath)
2025-04-10 08:57:21 +08:00
this.upload()
},
fail: (err) => {
2025-10-25 15:52:11 +08:00
console.log('录像失败:', err)
2025-04-10 08:57:21 +08:00
}
2025-10-25 15:52:11 +08:00
})
2025-04-10 08:57:21 +08:00
},
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)
}
2025-10-25 15:52:11 +08:00
})
2025-04-10 08:57:21 +08:00
}
}
}
</script>
<style lang="scss">
page {
background-color: #F7FAFE;
}
2025-04-11 18:23:16 +08:00
.mask{
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .3);
z-index: 9;
}
.tingchetc{
width: 624rpx;
height: 610rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
top: 572rpx;
z-index: 10;
padding: 28rpx 36rpx;
box-sizing: border-box;
.btnan{
display: flex;
justify-content: space-between;
margin-top: 40rpx;
.fj{
width: 252rpx;
height: 72rpx;
border-radius: 45rpx 45rpx 45rpx 45rpx;
border: 2rpx solid #808080;
font-weight: 600;
font-size: 32rpx;
color: #808080;
text-align: center;
line-height: 72rpx;
}
.qx{
width: 252rpx;
height: 72rpx;
background: #4C97E7;
border-radius: 45rpx 45rpx 45rpx 45rpx;
text-align: center;
line-height: 72rpx;
box-sizing: border-box;
font-weight: 600;
font-size: 32rpx;
color: #FFFFFF;
}
}
.tcimg{
width: 552rpx;
height: 300rpx;
margin-top: 28rpx;
}
.shuom{
font-size: 26rpx;
color: #3D3D3D;
margin-top: 18rpx;
text{
color: #4C97E7;
}
}
.topname{
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
display: flex;
align-items: center;
image{
width: 48rpx;
height: 48rpx;
margin-right: 14rpx;
}
}
}
2025-04-10 08:57:21 +08:00
.page {
width: 750rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.tip_box {
padding: 44rpx 36rpx;
font-weight: 400;
font-size: 32rpx;
color: #ccc;
}
.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;
backdrop-filter: blur(10rpx);
-webkit-backdrop-filter: blur(10rpx); /* For Safari */
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;
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>