diff --git a/page_fenbao/storedlist/trueorder.vue b/page_fenbao/storedlist/trueorder.vue index b45105d..3ee3770 100644 --- a/page_fenbao/storedlist/trueorder.vue +++ b/page_fenbao/storedlist/trueorder.vue @@ -647,10 +647,12 @@ respData:{}, instructions:'', duoirder:'', - zaixianflag:false + zaixianflag:false, + taocanId: '' // 存储从URL解析出的t参数(套餐id) } }, onLoad(option) { + console.log(option,'sasdadas'); if(option.duoirder){ this.duoirder = option.duoirder this.$u.get("/app/order/mineProcessing").then((res) => { @@ -716,16 +718,18 @@ this.zhezhaoflag = false uni.hideLoading() }else{ - this.tit= '确认订单页' - this.zhezhaoflag = false - uni.hideLoading() - this.modelId = option.modelId - this.chesn = option.sn - this.sn = option.sn - this.getzaixian() //判断是否在线 - this.getQiniuToken() - this.gettaocan() - this.getcheliang() + this.tit= '确认订单页' + this.zhezhaoflag = false + uni.hideLoading() + this.modelId = option.modelId + this.chesn = option.sn + this.sn = option.sn + // 解析t参数(套餐id) + this.taocanId = option.t || '' + this.getzaixian() //判断是否在线 + this.getQiniuToken() + this.gettaocan() + this.getcheliang() } }else if(res.code == 401){ this.modelId = option.modelId @@ -763,6 +767,8 @@ let sceneValue = option.q let decodedValue = decodeURIComponent(sceneValue) 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) => { 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') + // 解析t参数(套餐id) + 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) => { + // 判断是否有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) { this.taocanlist = res.data this.instructions = res.data[0].instructions diff --git a/page_shanghu/gongzuotai/modelMt.vue b/page_shanghu/gongzuotai/modelMt.vue index 9a9c0ee..560c6fd 100644 --- a/page_shanghu/gongzuotai/modelMt.vue +++ b/page_shanghu/gongzuotai/modelMt.vue @@ -36,6 +36,14 @@ % --> + + + 智能车 + + + + + 骑行低电量提醒(%) @@ -329,6 +337,7 @@ export default { suitIds: [], lowBatteryReminder: '20', lowBatteryReminderSwitch: false, + smart: false, enableSeat:false, icon: '', picture: '', diff --git a/page_shanghu/guanli/Qrcode.vue b/page_shanghu/guanli/Qrcode.vue index 552654f..1abcee2 100644 --- a/page_shanghu/guanli/Qrcode.vue +++ b/page_shanghu/guanli/Qrcode.vue @@ -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); // 将rpx转换为px - 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); // 将rpx转换为px + 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); // 将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() { 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' diff --git a/page_shanghu/guanli/device_detail.vue b/page_shanghu/guanli/device_detail.vue index e46626e..637f761 100644 --- a/page_shanghu/guanli/device_detail.vue +++ b/page_shanghu/guanli/device_detail.vue @@ -211,12 +211,12 @@ 二维码 - +