小鹿骑行
This commit is contained in:
parent
accf5cf1a9
commit
530a8addab
|
|
@ -647,10 +647,12 @@
|
||||||
respData:{},
|
respData:{},
|
||||||
instructions:'',
|
instructions:'',
|
||||||
duoirder:'',
|
duoirder:'',
|
||||||
zaixianflag:false
|
zaixianflag:false,
|
||||||
|
taocanId: '' // 存储从URL解析出的t参数(套餐id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
console.log(option,'sasdadas');
|
||||||
if(option.duoirder){
|
if(option.duoirder){
|
||||||
this.duoirder = option.duoirder
|
this.duoirder = option.duoirder
|
||||||
this.$u.get("/app/order/mineProcessing").then((res) => {
|
this.$u.get("/app/order/mineProcessing").then((res) => {
|
||||||
|
|
@ -716,16 +718,18 @@
|
||||||
this.zhezhaoflag = false
|
this.zhezhaoflag = false
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}else{
|
}else{
|
||||||
this.tit= '确认订单页'
|
this.tit= '确认订单页'
|
||||||
this.zhezhaoflag = false
|
this.zhezhaoflag = false
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
this.modelId = option.modelId
|
this.modelId = option.modelId
|
||||||
this.chesn = option.sn
|
this.chesn = option.sn
|
||||||
this.sn = option.sn
|
this.sn = option.sn
|
||||||
this.getzaixian() //判断是否在线
|
// 解析t参数(套餐id)
|
||||||
this.getQiniuToken()
|
this.taocanId = option.t || ''
|
||||||
this.gettaocan()
|
this.getzaixian() //判断是否在线
|
||||||
this.getcheliang()
|
this.getQiniuToken()
|
||||||
|
this.gettaocan()
|
||||||
|
this.getcheliang()
|
||||||
}
|
}
|
||||||
}else if(res.code == 401){
|
}else if(res.code == 401){
|
||||||
this.modelId = option.modelId
|
this.modelId = option.modelId
|
||||||
|
|
@ -763,6 +767,8 @@
|
||||||
let sceneValue = option.q
|
let sceneValue = option.q
|
||||||
let decodedValue = decodeURIComponent(sceneValue)
|
let decodedValue = decodeURIComponent(sceneValue)
|
||||||
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
||||||
|
// 解析t参数(套餐id)
|
||||||
|
this.taocanId = option.t || getQueryParam(decodedValue, 't') || ''
|
||||||
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
console.log('第一个');
|
console.log('第一个');
|
||||||
|
|
@ -803,6 +809,8 @@
|
||||||
let sceneValue = option.q
|
let sceneValue = option.q
|
||||||
let decodedValue = decodeURIComponent(sceneValue)
|
let decodedValue = decodeURIComponent(sceneValue)
|
||||||
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
||||||
|
// 解析t参数(套餐id)
|
||||||
|
this.taocanId = option.t || getQueryParam(decodedValue, 't') || ''
|
||||||
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
|
@ -1717,7 +1725,16 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.$u.get(`/app/suit/listByModel?modelId=${this.modelId}`).then((res) => {
|
// 判断是否有t参数(套餐id)
|
||||||
|
let apiUrl = ''
|
||||||
|
if(this.taocanId && this.taocanId !== ''){
|
||||||
|
// 有t参数:传id,不传temp和modelId
|
||||||
|
apiUrl = `/app/suit/listByModel?id=${this.taocanId}&modelId=${this.modelId}`
|
||||||
|
}else{
|
||||||
|
// 没有t参数:传temp,不传id
|
||||||
|
apiUrl = `/app/suit/listByModel?temp=false&modelId=${this.modelId}`
|
||||||
|
}
|
||||||
|
this.$u.get(apiUrl).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.taocanlist = res.data
|
this.taocanlist = res.data
|
||||||
this.instructions = res.data[0].instructions
|
this.instructions = res.data[0].instructions
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,14 @@
|
||||||
<span> %</span> -->
|
<span> %</span> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="card_li">
|
||||||
|
<view class="card_left">
|
||||||
|
智能车
|
||||||
|
</view>
|
||||||
|
<view class="card_right">
|
||||||
|
<u-switch v-model="data.smart"></u-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="card_li" v-if="data.lowBatteryReminderSwitch">
|
<view class="card_li" v-if="data.lowBatteryReminderSwitch">
|
||||||
<view class="card_left" style="width: 500rpx;">
|
<view class="card_left" style="width: 500rpx;">
|
||||||
骑行低电量提醒(%)
|
骑行低电量提醒(%)
|
||||||
|
|
@ -329,6 +337,7 @@ export default {
|
||||||
suitIds: [],
|
suitIds: [],
|
||||||
lowBatteryReminder: '20',
|
lowBatteryReminder: '20',
|
||||||
lowBatteryReminderSwitch: false,
|
lowBatteryReminderSwitch: false,
|
||||||
|
smart: false,
|
||||||
enableSeat:false,
|
enableSeat:false,
|
||||||
icon: '',
|
icon: '',
|
||||||
picture: '',
|
picture: '',
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
areaId:'',
|
areaId:'',
|
||||||
areaIdname:'',
|
areaIdname:'',
|
||||||
type:'',
|
type:'',
|
||||||
|
suitId:'', // 套餐id
|
||||||
http:this.$store.state.app.urlConfig
|
http:this.$store.state.app.urlConfig
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -38,6 +39,13 @@
|
||||||
this.areaId = e.areaId;
|
this.areaId = e.areaId;
|
||||||
this.deptId = uni.getStorageSync('deptId');
|
this.deptId = uni.getStorageSync('deptId');
|
||||||
this.generateQrcodes();
|
this.generateQrcodes();
|
||||||
|
}else if(e.t){
|
||||||
|
// 套餐二维码
|
||||||
|
this.type = 3
|
||||||
|
this.suitId = e.t;
|
||||||
|
this.sn = e.s || ''; // 如果有sn参数则使用,否则为空
|
||||||
|
this.deptId = uni.getStorageSync('deptId');
|
||||||
|
this.generateSuitQrcode();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -46,9 +54,14 @@
|
||||||
const qr = new UQRCode();
|
const qr = new UQRCode();
|
||||||
const qrSizeRpx = 600; // 二维码大小为600rpx
|
const qrSizeRpx = 600; // 二维码大小为600rpx
|
||||||
const qrSizePx = uni.upx2px(qrSizeRpx); // 将rpx转换为px
|
const qrSizePx = uni.upx2px(qrSizeRpx); // 将rpx转换为px
|
||||||
qr.data = this.http.areaPrefix + '?i=' + this.areaId
|
const qrData = this.http.areaPrefix + '?i=' + this.areaId;
|
||||||
|
qr.data = qrData;
|
||||||
qr.size = qrSizePx; // 设置二维码大小为像素值
|
qr.size = qrSizePx; // 设置二维码大小为像素值
|
||||||
|
|
||||||
|
// 打印二维码路径
|
||||||
|
console.log('二维码数据:', qrData);
|
||||||
|
console.log('二维码完整路径:', qrData);
|
||||||
|
|
||||||
// 创建 canvas 上下文
|
// 创建 canvas 上下文
|
||||||
const ctx = uni.createCanvasContext('qrcode', this);
|
const ctx = uni.createCanvasContext('qrcode', this);
|
||||||
|
|
||||||
|
|
@ -82,13 +95,19 @@
|
||||||
const qrSizeRpx = 600; // 二维码大小为600rpx
|
const qrSizeRpx = 600; // 二维码大小为600rpx
|
||||||
const qrSizePx = uni.upx2px(qrSizeRpx); // 将rpx转换为px
|
const qrSizePx = uni.upx2px(qrSizeRpx); // 将rpx转换为px
|
||||||
|
|
||||||
|
let qrData = '';
|
||||||
if (this.deptId == 100) {
|
if (this.deptId == 100) {
|
||||||
qr.data = this.http.deviceSnPrefix + '?s=' + this.sn;
|
qrData = this.http.deviceSnPrefix + '?s=' + this.sn;
|
||||||
} else if (this.deptId == 101) {
|
} else if (this.deptId == 101) {
|
||||||
qr.data = this.http.deviceSnPrefix + '?s=' + this.sn;
|
qrData = this.http.deviceSnPrefix + '?s=' + this.sn;
|
||||||
}
|
}
|
||||||
|
qr.data = qrData;
|
||||||
qr.size = qrSizePx; // 设置二维码大小为像素值
|
qr.size = qrSizePx; // 设置二维码大小为像素值
|
||||||
|
|
||||||
|
// 打印二维码路径
|
||||||
|
console.log('二维码数据:', qrData);
|
||||||
|
console.log('二维码完整路径:', qrData);
|
||||||
|
|
||||||
// 创建 canvas 上下文
|
// 创建 canvas 上下文
|
||||||
const ctx = uni.createCanvasContext('qrcode', this);
|
const ctx = uni.createCanvasContext('qrcode', this);
|
||||||
|
|
||||||
|
|
@ -117,6 +136,54 @@
|
||||||
}, 100); // 延迟100毫秒确保二维码绘制完成
|
}, 100); // 延迟100毫秒确保二维码绘制完成
|
||||||
this.showqr = true;
|
this.showqr = true;
|
||||||
},
|
},
|
||||||
|
// 生成套餐二维码
|
||||||
|
generateSuitQrcode() {
|
||||||
|
const qr = new UQRCode();
|
||||||
|
const qrSizeRpx = 600; // 二维码大小为600rpx
|
||||||
|
const qrSizePx = uni.upx2px(qrSizeRpx); // 将rpx转换为px
|
||||||
|
|
||||||
|
// 生成二维码数据,使用deviceSnPrefix,格式:?s=sn&t=suitId
|
||||||
|
let qrData = '';
|
||||||
|
if (this.http.deviceSnPrefix) {
|
||||||
|
// sn后面拼套餐id,格式:?s=sn&t=suitId
|
||||||
|
qrData = this.http.deviceSnPrefix + '?s=' + (this.sn || '') + '&t=' + this.suitId;
|
||||||
|
} else {
|
||||||
|
// 如果没有deviceSnPrefix,使用默认格式
|
||||||
|
qrData = '?s=' + (this.sn || '') + '&t=' + this.suitId;
|
||||||
|
}
|
||||||
|
|
||||||
|
qr.data = qrData;
|
||||||
|
qr.size = qrSizePx; // 设置二维码大小为像素值
|
||||||
|
|
||||||
|
// 打印二维码路径
|
||||||
|
console.log('二维码数据:', qrData);
|
||||||
|
console.log('二维码完整路径:', qrData);
|
||||||
|
|
||||||
|
// 创建 canvas 上下文
|
||||||
|
const ctx = uni.createCanvasContext('qrcode', this);
|
||||||
|
|
||||||
|
// 设置 qr 的 canvas 上下文
|
||||||
|
qr.canvasContext = ctx;
|
||||||
|
qr.make(); // 生成二维码数据
|
||||||
|
|
||||||
|
// 绘制二维码
|
||||||
|
qr.drawCanvas();
|
||||||
|
|
||||||
|
// 延迟绘制,确保二维码绘制完成后再绘制文字
|
||||||
|
setTimeout(() => {
|
||||||
|
ctx.setFontSize(24); // 设置字体大小
|
||||||
|
ctx.setFillStyle('black'); // 设置字体颜色
|
||||||
|
ctx.setTextAlign('center'); // 设置文本居中
|
||||||
|
|
||||||
|
// 在二维码下方绘制套餐信息
|
||||||
|
const suitText = '套餐ID: ' + this.suitId;
|
||||||
|
ctx.fillText(suitText, qrSizePx / 2, qrSizePx + 40);
|
||||||
|
|
||||||
|
// 传入 true,保留之前绘制的内容
|
||||||
|
ctx.draw(true);
|
||||||
|
}, 100); // 延迟100毫秒确保二维码绘制完成
|
||||||
|
this.showqr = true;
|
||||||
|
},
|
||||||
saveQrcode() {
|
saveQrcode() {
|
||||||
uni.canvasToTempFilePath({
|
uni.canvasToTempFilePath({
|
||||||
canvasId: 'qrcode',
|
canvasId: 'qrcode',
|
||||||
|
|
@ -125,6 +192,9 @@
|
||||||
width: uni.upx2px(600),
|
width: uni.upx2px(600),
|
||||||
height: uni.upx2px(700),
|
height: uni.upx2px(700),
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
// 打印二维码路径
|
||||||
|
console.log('二维码临时文件路径:', res.tempFilePath);
|
||||||
|
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: res.tempFilePath,
|
filePath: res.tempFilePath,
|
||||||
success: () => {
|
success: () => {
|
||||||
|
|
@ -143,6 +213,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
|
console.error('生成二维码路径失败:', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '生成二维码失败',
|
title: '生成二维码失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|
|
||||||
|
|
@ -211,12 +211,12 @@
|
||||||
</view>
|
</view>
|
||||||
二维码
|
二维码
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="dangeanniu" @click="btnshoufei()">
|
<view class="dangeanniu" @click="btnshoufei()">
|
||||||
<view class="pic">
|
<view class="pic">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/um8ShZ4cBnh0weV1Qtz3" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/um8ShZ4cBnh0weV1Qtz3" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
临时收费
|
临时收费
|
||||||
</view> -->
|
</view>
|
||||||
<!-- 蓝牙控制 -->
|
<!-- 蓝牙控制 -->
|
||||||
<!-- <view class="dangeanniu" @click="lanya(0)" v-if="ver_dataflag != 3">
|
<!-- <view class="dangeanniu" @click="lanya(0)" v-if="ver_dataflag != 3">
|
||||||
<view class="pic">
|
<view class="pic">
|
||||||
|
|
@ -550,7 +550,7 @@
|
||||||
// 点击跳转到临时收费
|
// 点击跳转到临时收费
|
||||||
btnshoufei(){
|
btnshoufei(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/page_shanghu/linshishoufei'
|
url:'/page_shanghu/linshishoufei?sn=' + this.deviceInfos.sn + '&cxid=' + this.deviceInfos.modelId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="btn_box">
|
<view class="btn_box">
|
||||||
<view class="">
|
<view class="" @click="generateQrcode">
|
||||||
生成二维码
|
生成二维码
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="btn1" @click="backpage()">
|
<!-- <view class="btn1" @click="backpage()">
|
||||||
|
|
@ -342,15 +342,21 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
taocanlist:[],
|
taocanlist:[],
|
||||||
tabindex:0
|
tabindex:0,
|
||||||
|
sn:'',
|
||||||
|
modelId:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
console.log(e,'eeeeeeeeeeeeeeeeeeeeeeeeeeeee');
|
||||||
this.data.areaId = uni.getStorageSync('adminAreaid')
|
this.data.areaId = uni.getStorageSync('adminAreaid')
|
||||||
// if (e.ruleId) {
|
// if (e.ruleId) {
|
||||||
// this.ruleId = e.ruleId
|
// this.ruleId = e.ruleId
|
||||||
// this.getFeeInfo()
|
// this.getFeeInfo()
|
||||||
// }
|
// }
|
||||||
|
this.modelId = e.cxid
|
||||||
|
this.taocanlist = []
|
||||||
|
this.sn = e.sn
|
||||||
this.getinfo()
|
this.getinfo()
|
||||||
this.getAccessorylist()
|
this.getAccessorylist()
|
||||||
this.getModelList()
|
this.getModelList()
|
||||||
|
|
@ -362,7 +368,7 @@
|
||||||
methods: {
|
methods: {
|
||||||
// 请求所有套餐
|
// 请求所有套餐
|
||||||
getModelList() {
|
getModelList() {
|
||||||
this.$u.get(`/bst/suit/list?pageNum=1&pageSize=999&areaId=${this.data.areaId}`).then((res) => {
|
this.$u.get(`/bst/suit/list?pageNum=1&pageSize=999&areaId=${this.data.areaId}&temp=false&modelId=${this.modelId}`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.taocanlist = res.rows
|
this.taocanlist = res.rows
|
||||||
this.ruleId = res.rows[0].id
|
this.ruleId = res.rows[0].id
|
||||||
|
|
@ -601,6 +607,78 @@
|
||||||
this.intervalRule[i].start = this.intervalRule[i-1].end;
|
this.intervalRule[i].start = this.intervalRule[i-1].end;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 生成二维码
|
||||||
|
generateQrcode() {
|
||||||
|
console.log(this.lists.suitIds,'000');
|
||||||
|
let data = {
|
||||||
|
...this.data,
|
||||||
|
type: 1,
|
||||||
|
modelIds:this.lists.suitIds,
|
||||||
|
temp: true // 添加temp字段为true
|
||||||
|
}
|
||||||
|
console.log(data,'111');
|
||||||
|
if (this.data.ridingRule == 2) {
|
||||||
|
// 区间计费时直接使用intervalRule字段
|
||||||
|
data.intervalRule = this.intervalRule.map((item, index) => ({
|
||||||
|
start: index === 0 ? 0 : Number(item.start),
|
||||||
|
end: index === this.intervalRule.length - 1 ? null : Number(item.end),
|
||||||
|
fee: Number(item.fee),
|
||||||
|
eachUnit: Number(item.eachUnit)
|
||||||
|
}))
|
||||||
|
// 删除startRule字段
|
||||||
|
delete data.startRule;
|
||||||
|
} else {
|
||||||
|
// 普通计费使用startRule
|
||||||
|
data.startRule = {
|
||||||
|
timeoutTime: this.timeoutTime,
|
||||||
|
startingPrice: this.startingPrice,
|
||||||
|
startingTime: this.startingTime,
|
||||||
|
timeoutPrice: this.timeoutPrice
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(data, '生成二维码请求数据')
|
||||||
|
// 新增套餐(带temp: true)
|
||||||
|
this.$u.post(`/bst/suit`, data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 获取套餐id,处理不同的返回结构
|
||||||
|
let suitId = '';
|
||||||
|
if (res.data && typeof res.data === 'object') {
|
||||||
|
suitId = res.data.id || res.data.suitId || res.data;
|
||||||
|
} else {
|
||||||
|
suitId = res.data;
|
||||||
|
}
|
||||||
|
console.log('套餐ID:', suitId);
|
||||||
|
console.log('完整返回数据:', res);
|
||||||
|
|
||||||
|
if (!suitId) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取套餐ID失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(this.sn,'121212121212');
|
||||||
|
// 跳转到二维码页面,传递套餐id
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/page_shanghu/guanli/Qrcode?s=${this.sn}&t=${suitId}&type=3`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg || '新增套餐失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('生成二维码失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '生成二维码失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
sub() {
|
sub() {
|
||||||
console.log(this.lists.suitIds,'000');
|
console.log(this.lists.suitIds,'000');
|
||||||
let data = {
|
let data = {
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,8 @@
|
||||||
sn:this.sn,
|
sn:this.sn,
|
||||||
mac:this.mac,
|
mac:this.mac,
|
||||||
hardwareVersionId:this.hardwareVersionId,
|
hardwareVersionId:this.hardwareVersionId,
|
||||||
simProducer:this.kaid
|
simProducer:this.kaid,
|
||||||
|
appId:this.$store.state.appid
|
||||||
}
|
}
|
||||||
console.log(data,'111');
|
console.log(data,'111');
|
||||||
this.$u.post(`/bst/device`,data).then((res) => {
|
this.$u.post(`/bst/device`,data).then((res) => {
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,9 @@
|
||||||
enableChange:false,
|
enableChange:false,
|
||||||
scdevlist:[],
|
scdevlist:[],
|
||||||
ordernum:0,
|
ordernum:0,
|
||||||
bltRemark:''
|
bltRemark:'',
|
||||||
|
endOrderRetryCount: 0, // 结束订单重试计数器
|
||||||
|
bluetoothQValue: null // 蓝牙关锁的q值
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
|
@ -970,6 +972,8 @@
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
dataObj.q = parseInt(value, 10);
|
dataObj.q = parseInt(value, 10);
|
||||||
|
// 存储q值,用于判断蓝牙关锁是否成功
|
||||||
|
this.bluetoothQValue = parseInt(value, 10);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
dataObj.s = parseInt(value, 10);
|
dataObj.s = parseInt(value, 10);
|
||||||
|
|
@ -1684,6 +1688,74 @@
|
||||||
btnfajin() {
|
btnfajin() {
|
||||||
this.gethuan()
|
this.gethuan()
|
||||||
},
|
},
|
||||||
|
// 重试结束订单接口(直接调用 /app/order/end)
|
||||||
|
retryEndOrder(endData, successCallback) {
|
||||||
|
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 {
|
||||||
|
// 其他错误,重置计数器并显示错误
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
that.wenbentxt = ''
|
||||||
|
that.wenbentxtflag = false
|
||||||
|
that.orderflag = true
|
||||||
|
if (res.msg) {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '未知错误',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
// 请求失败,重置计数器并显示错误
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
that.wenbentxt = ''
|
||||||
|
that.wenbentxtflag = false
|
||||||
|
that.orderflag = true
|
||||||
|
uni.showToast({
|
||||||
|
title: '还车失败,请稍后再试',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}, 3000)
|
||||||
|
} else {
|
||||||
|
// 超过3次重试,显示错误提示
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
that.wenbentxt = ''
|
||||||
|
that.wenbentxtflag = false
|
||||||
|
that.orderflag = true
|
||||||
|
uni.showToast({
|
||||||
|
title: '还车失败,请稍后再试',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
// 还车统一调用
|
// 还车统一调用
|
||||||
gethuan() {
|
gethuan() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -1715,6 +1787,7 @@
|
||||||
}
|
}
|
||||||
that.$u.put(`/app/order/end`, datas).then(res => {
|
that.$u.put(`/app/order/end`, datas).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
that.endOrderRetryCount = 0 // 重置重试计数器
|
||||||
that.cheflag = true
|
that.cheflag = true
|
||||||
that.fjflag = false
|
that.fjflag = false
|
||||||
that.wenbentxt = ''
|
that.wenbentxt = ''
|
||||||
|
|
@ -1729,6 +1802,28 @@
|
||||||
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
|
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
} else if (res.code == 30004) {
|
||||||
|
// 重置计数器,开始重试
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
// 创建成功回调
|
||||||
|
const successCallback = () => {
|
||||||
|
that.cheflag = true
|
||||||
|
that.fjflag = false
|
||||||
|
that.wenbentxt = ''
|
||||||
|
that.wenbentxtflag = false
|
||||||
|
uni.showToast({
|
||||||
|
title: '还车成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
// 调用重试函数
|
||||||
|
that.retryEndOrder(datas, successCallback)
|
||||||
} else{
|
} else{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '错误' + res.msg,
|
title: '错误' + res.msg,
|
||||||
|
|
@ -1768,8 +1863,13 @@
|
||||||
macList:that.scdevlist,
|
macList:that.scdevlist,
|
||||||
bltRemark:that.bltRemark
|
bltRemark:that.bltRemark
|
||||||
}
|
}
|
||||||
|
// 如果是蓝牙关锁且q值等于0,添加ignoreSmart参数
|
||||||
|
if (that.bluetoothQValue === 0) {
|
||||||
|
data.ignoreSmart = true
|
||||||
|
}
|
||||||
that.$u.put(`/app/order/end`, data).then(res => {
|
that.$u.put(`/app/order/end`, data).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
that.endOrderRetryCount = 0 // 重置重试计数器
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
that.wenbentxt = ''
|
that.wenbentxt = ''
|
||||||
that.wenbentxtflag = false
|
that.wenbentxtflag = false
|
||||||
|
|
@ -1779,6 +1879,23 @@
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
} else if (res.code == 30004) {
|
||||||
|
// 重置计数器,开始重试
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
// 创建成功回调
|
||||||
|
const successCallback = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.wenbentxt = ''
|
||||||
|
that.wenbentxtflag = false
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
// 调用重试函数
|
||||||
|
that.retryEndOrder(data, successCallback)
|
||||||
} else if (res.msg == null) {
|
} else if (res.msg == null) {
|
||||||
that.wenbentxt = ''
|
that.wenbentxt = ''
|
||||||
that.wenbentxtflag = false
|
that.wenbentxtflag = false
|
||||||
|
|
@ -1834,6 +1951,14 @@
|
||||||
that.devicename = matchedDevice.name
|
that.devicename = matchedDevice.name
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (that.ver_dataflag == 3) {
|
if (that.ver_dataflag == 3) {
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11llosesub300@"
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11reboot@"
|
||||||
|
})
|
||||||
|
}, 2000)
|
||||||
that.fjflag = false
|
that.fjflag = false
|
||||||
// 先调用锁车方法
|
// 先调用锁车方法
|
||||||
let finishData = {
|
let finishData = {
|
||||||
|
|
@ -1854,15 +1979,14 @@
|
||||||
macList:that.scdevlist,
|
macList:that.scdevlist,
|
||||||
bltRemark:that.bltRemark
|
bltRemark:that.bltRemark
|
||||||
}
|
}
|
||||||
|
// 如果是蓝牙关锁且q值等于0,添加ignoreSmart参数
|
||||||
|
if (that.bluetoothQValue === 0) {
|
||||||
|
data.ignoreSmart = true
|
||||||
|
}
|
||||||
that.$u.put(`/app/order/end`, data).then(res => {
|
that.$u.put(`/app/order/end`, data).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
xBlufi.notifySendCustomData({
|
that.endOrderRetryCount = 0 // 重置重试计数器
|
||||||
customData: "11close@"
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
xBlufi.notifySendCustomData({
|
|
||||||
customData: "11reboot@"
|
|
||||||
})
|
|
||||||
that.wenbentxt =''
|
that.wenbentxt =''
|
||||||
that.wenbentxtflag =false
|
that.wenbentxtflag =false
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -1871,6 +1995,28 @@
|
||||||
})
|
})
|
||||||
},1000)
|
},1000)
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
} else if (res.code == 30004) {
|
||||||
|
// 重置计数器,开始重试
|
||||||
|
that.endOrderRetryCount = 0
|
||||||
|
// 创建成功回调
|
||||||
|
const successCallback = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.wenbentxt =''
|
||||||
|
that.wenbentxtflag =false
|
||||||
|
uni.showToast({
|
||||||
|
title: '还车成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
|
||||||
|
})
|
||||||
|
},1000)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
// 调用重试函数
|
||||||
|
that.retryEndOrder(data, successCallback)
|
||||||
} else if (res.msg == null) {
|
} else if (res.msg == null) {
|
||||||
that.wenbentxt = ''
|
that.wenbentxt = ''
|
||||||
that.wenbentxtflag =false
|
that.wenbentxtflag =false
|
||||||
|
|
@ -2007,7 +2153,7 @@
|
||||||
}
|
}
|
||||||
findDevice()
|
findDevice()
|
||||||
}
|
}
|
||||||
} else if (res.msg == null) {
|
}else if (res.msg == null) {
|
||||||
that.wenbentxt = ''
|
that.wenbentxt = ''
|
||||||
that.wenbentxtflag = false
|
that.wenbentxtflag = false
|
||||||
that.orderflag = true
|
that.orderflag = true
|
||||||
|
|
|
||||||
|
|
@ -609,6 +609,8 @@
|
||||||
let sceneValue = res.result
|
let sceneValue = res.result
|
||||||
let decodedValue = decodeURIComponent(sceneValue)
|
let decodedValue = decodeURIComponent(sceneValue)
|
||||||
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
|
||||||
|
// 解析t参数(套餐id)
|
||||||
|
let taocanId = getQueryParam(decodedValue, 't') || ''
|
||||||
this.$u.get("/app/order/mineProcessing").then(res =>{
|
this.$u.get("/app/order/mineProcessing").then(res =>{
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
if(res.data){
|
if(res.data){
|
||||||
|
|
@ -620,8 +622,13 @@
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
if(res.data){
|
if(res.data){
|
||||||
this.modelId = res.data.modelId
|
this.modelId = res.data.modelId
|
||||||
|
// 构建跳转URL,如果有t参数则带上
|
||||||
|
let navigateUrl = '/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
|
||||||
|
if(taocanId && taocanId !== ''){
|
||||||
|
navigateUrl += '&t=' + taocanId
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
|
url: navigateUrl
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user