小鹿骑行

This commit is contained in:
吴鹏 2026-01-19 15:27:10 +08:00
parent accf5cf1a9
commit 530a8addab
8 changed files with 360 additions and 31 deletions

View File

@ -647,10 +647,12 @@
respData:{},
instructions:'',
duoirder:'',
zaixianflag:false
zaixianflag:false,
taocanId: '' // URLtid
}
},
onLoad(option) {
console.log(option,'sasdadas');
if(option.duoirder){
this.duoirder = option.duoirder
this.$u.get("/app/order/mineProcessing").then((res) => {
@ -722,6 +724,8 @@
this.modelId = option.modelId
this.chesn = option.sn
this.sn = option.sn
// tid
this.taocanId = option.t || ''
this.getzaixian() //线
this.getQiniuToken()
this.gettaocan()
@ -763,6 +767,8 @@
let sceneValue = option.q
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
// tid
this.taocanId = option.t || getQueryParam(decodedValue, 't') || ''
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
console.log('第一个');
@ -803,6 +809,8 @@
let sceneValue = option.q
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
// tid
this.taocanId = option.t || getQueryParam(decodedValue, 't') || ''
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
if (res.data) {
@ -1717,7 +1725,16 @@
})
}
}else{
this.$u.get(`/app/suit/listByModel?modelId=${this.modelId}`).then((res) => {
// tid
let apiUrl = ''
if(this.taocanId && this.taocanId !== ''){
// tidtempmodelId
apiUrl = `/app/suit/listByModel?id=${this.taocanId}&modelId=${this.modelId}`
}else{
// ttempid
apiUrl = `/app/suit/listByModel?temp=false&modelId=${this.modelId}`
}
this.$u.get(apiUrl).then((res) => {
if (res.code == 200) {
this.taocanlist = res.data
this.instructions = res.data[0].instructions

View File

@ -36,6 +36,14 @@
<span> %</span> -->
</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_left" style="width: 500rpx;">
骑行低电量提醒%
@ -329,6 +337,7 @@ export default {
suitIds: [],
lowBatteryReminder: '20',
lowBatteryReminderSwitch: false,
smart: false,
enableSeat:false,
icon: '',
picture: '',

View File

@ -24,6 +24,7 @@
areaId:'',
areaIdname:'',
type:'',
suitId:'', // id
http:this.$store.state.app.urlConfig
}
},
@ -38,6 +39,13 @@
this.areaId = e.areaId;
this.deptId = uni.getStorageSync('deptId');
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 qrSizeRpx = 600; // 600rpx
const qrSizePx = uni.upx2px(qrSizeRpx); // rpxpx
qr.data = this.http.areaPrefix + '?i=' + this.areaId
const qrData = this.http.areaPrefix + '?i=' + this.areaId;
qr.data = qrData;
qr.size = qrSizePx; //
//
console.log('二维码数据:', qrData);
console.log('二维码完整路径:', qrData);
// canvas
const ctx = uni.createCanvasContext('qrcode', this);
@ -82,13 +95,19 @@
const qrSizeRpx = 600; // 600rpx
const qrSizePx = uni.upx2px(qrSizeRpx); // rpxpx
let qrData = '';
if (this.deptId == 100) {
qr.data = this.http.deviceSnPrefix + '?s=' + this.sn;
qrData = this.http.deviceSnPrefix + '?s=' + this.sn;
} 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; //
//
console.log('二维码数据:', qrData);
console.log('二维码完整路径:', qrData);
// canvas
const ctx = uni.createCanvasContext('qrcode', this);
@ -117,6 +136,54 @@
}, 100); // 100
this.showqr = true;
},
//
generateSuitQrcode() {
const qr = new UQRCode();
const qrSizeRpx = 600; // 600rpx
const qrSizePx = uni.upx2px(qrSizeRpx); // rpxpx
// 使deviceSnPrefix?s=sn&t=suitId
let qrData = '';
if (this.http.deviceSnPrefix) {
// snid?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() {
uni.canvasToTempFilePath({
canvasId: 'qrcode',
@ -125,6 +192,9 @@
width: uni.upx2px(600),
height: uni.upx2px(700),
success: (res) => {
//
console.log('二维码临时文件路径:', res.tempFilePath);
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
@ -143,6 +213,7 @@
});
},
fail: (err) => {
console.error('生成二维码路径失败:', err);
uni.showToast({
title: '生成二维码失败',
icon: 'none'

View File

@ -211,12 +211,12 @@
</view>
二维码
</view>
<!-- <view class="dangeanniu" @click="btnshoufei()">
<view class="dangeanniu" @click="btnshoufei()">
<view class="pic">
<image src="https://api.ccttiot.com/smartmeter/img/static/um8ShZ4cBnh0weV1Qtz3" mode=""></image>
</view>
临时收费
</view> -->
</view>
<!-- 蓝牙控制 -->
<!-- <view class="dangeanniu" @click="lanya(0)" v-if="ver_dataflag != 3">
<view class="pic">
@ -550,7 +550,7 @@
//
btnshoufei(){
uni.navigateTo({
url:'/page_shanghu/linshishoufei'
url:'/page_shanghu/linshishoufei?sn=' + this.deviceInfos.sn + '&cxid=' + this.deviceInfos.modelId
})
},

View File

@ -242,7 +242,7 @@
</view>
<view class="btn_box">
<view class="">
<view class="" @click="generateQrcode">
生成二维码
</view>
<!-- <view class="btn1" @click="backpage()">
@ -342,15 +342,21 @@
}
],
taocanlist:[],
tabindex:0
tabindex:0,
sn:'',
modelId:''
}
},
onLoad(e) {
console.log(e,'eeeeeeeeeeeeeeeeeeeeeeeeeeeee');
this.data.areaId = uni.getStorageSync('adminAreaid')
// if (e.ruleId) {
// this.ruleId = e.ruleId
// this.getFeeInfo()
// }
this.modelId = e.cxid
this.taocanlist = []
this.sn = e.sn
this.getinfo()
this.getAccessorylist()
this.getModelList()
@ -362,7 +368,7 @@
methods: {
//
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) {
this.taocanlist = res.rows
this.ruleId = res.rows[0].id
@ -601,6 +607,78 @@
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 // temptrue
}
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() {
console.log(this.lists.suitIds,'000');
let data = {

View File

@ -312,7 +312,8 @@
sn:this.sn,
mac:this.mac,
hardwareVersionId:this.hardwareVersionId,
simProducer:this.kaid
simProducer:this.kaid,
appId:this.$store.state.appid
}
console.log(data,'111');
this.$u.post(`/bst/device`,data).then((res) => {

View File

@ -426,7 +426,9 @@
enableChange:false,
scdevlist:[],
ordernum:0,
bltRemark:''
bltRemark:'',
endOrderRetryCount: 0, //
bluetoothQValue: null // q
}
},
onLoad(e) {
@ -970,6 +972,8 @@
break;
case 'q':
dataObj.q = parseInt(value, 10);
// q
this.bluetoothQValue = parseInt(value, 10);
break;
case 's':
dataObj.s = parseInt(value, 10);
@ -1684,6 +1688,74 @@
btnfajin() {
this.gethuan()
},
// /app/order/end
retryEndOrder(endData, successCallback) {
let that = this
// 3
if (that.endOrderRetryCount < 3) {
that.endOrderRetryCount++
// q0ignoreSmart
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() {
let that = this
@ -1715,6 +1787,7 @@
}
that.$u.put(`/app/order/end`, datas).then(res => {
if (res.code == 200) {
that.endOrderRetryCount = 0 //
that.cheflag = true
that.fjflag = false
that.wenbentxt = ''
@ -1729,6 +1802,28 @@
url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId
})
}, 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{
uni.showToast({
title: '错误' + res.msg,
@ -1768,8 +1863,13 @@
macList:that.scdevlist,
bltRemark:that.bltRemark
}
// q0ignoreSmart
if (that.bluetoothQValue === 0) {
data.ignoreSmart = true
}
that.$u.put(`/app/order/end`, data).then(res => {
if (res.code == 200) {
that.endOrderRetryCount = 0 //
setTimeout(() => {
that.wenbentxt = ''
that.wenbentxtflag = false
@ -1779,6 +1879,23 @@
})
}, 1000)
}, 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) {
that.wenbentxt = ''
that.wenbentxtflag = false
@ -1834,6 +1951,14 @@
that.devicename = matchedDevice.name
setTimeout(() => {
if (that.ver_dataflag == 3) {
xBlufi.notifySendCustomData({
customData: "11llosesub300@"
})
setTimeout(() => {
xBlufi.notifySendCustomData({
customData: "11reboot@"
})
}, 2000)
that.fjflag = false
//
let finishData = {
@ -1854,15 +1979,14 @@
macList:that.scdevlist,
bltRemark:that.bltRemark
}
// q0ignoreSmart
if (that.bluetoothQValue === 0) {
data.ignoreSmart = true
}
that.$u.put(`/app/order/end`, data).then(res => {
if (res.code == 200) {
xBlufi.notifySendCustomData({
customData: "11close@"
})
that.endOrderRetryCount = 0 //
setTimeout(() => {
xBlufi.notifySendCustomData({
customData: "11reboot@"
})
that.wenbentxt =''
that.wenbentxtflag =false
setTimeout(() => {
@ -1871,6 +1995,28 @@
})
},1000)
}, 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) {
that.wenbentxt = ''
that.wenbentxtflag =false
@ -2007,7 +2153,7 @@
}
findDevice()
}
} else if (res.msg == null) {
}else if (res.msg == null) {
that.wenbentxt = ''
that.wenbentxtflag = false
that.orderflag = true

View File

@ -609,6 +609,8 @@
let sceneValue = res.result
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn')
// tid
let taocanId = getQueryParam(decodedValue, 't') || ''
this.$u.get("/app/order/mineProcessing").then(res =>{
if(res.code == 200){
if(res.data){
@ -620,8 +622,13 @@
if (res.code == 200) {
if(res.data){
this.modelId = res.data.modelId
// URLt
let navigateUrl = '/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
if(taocanId && taocanId !== ''){
navigateUrl += '&t=' + taocanId
}
uni.navigateTo({
url:'/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
url: navigateUrl
})
}else{
uni.showModal({