扫码打开小程序并开锁功能

This commit is contained in:
dzl 2025-05-29 18:06:51 +08:00
parent 976432989c
commit ac07fbc0b7
4 changed files with 28 additions and 30 deletions

View File

@ -183,7 +183,7 @@
let arrBikeData = []; let arrBikeData = [];
const showBikeInfo = ref(false); const showBikeInfo = ref(false);
const bikeData = ref({}); const bikeData = ref({});
const onLoadData = ref(null) const onLoadData = ref({})
let ismount = false; let ismount = false;
let arrSiteData = [] let arrSiteData = []
@ -201,6 +201,7 @@
console.log("p===>" + JSON.stringify(p)) console.log("p===>" + JSON.stringify(p))
onLoadData.value = p; onLoadData.value = p;
} else if (query.number) { } else if (query.number) {
console.log("query" + JSON.stringify(query))
onLoadData.value['number'] = query.number; onLoadData.value['number'] = query.number;
onLoadData.value['_tbScancodeApproach_'] = query._tbScancodeApproach_; onLoadData.value['_tbScancodeApproach_'] = query._tbScancodeApproach_;
} }
@ -219,16 +220,10 @@
if (!oUser) { if (!oUser) {
tologin(); tologin();
} }
map.addOrder(onLoadData.value["number"], (res) => { map.addOrder(onLoadData.value["number"], false, (res) => {
console.log("00000000000000000000", res); console.log("00000000000000000000", res);
if (!res) { if (res) {
setTimeout(() => { getOrder();
bikeCode = null;
getOrder();
}, 1000);
return;
} else {
showWorn.value = true;
} }
}) })
} }

View File

@ -63,7 +63,7 @@
const agreed = ref([{ const agreed = ref([{
value: true // true value: true // true
}]); }]);
const onLoadData = ref(null) const onLoadData = ref({})
import { import {
onLoad onLoad
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
@ -242,11 +242,12 @@
let url = "/pages/user/home/home" let url = "/pages/user/home/home"
let q = ""; let q = "";
if (onLoadData.value) { if (onLoadData.value) {
url += '?number=' + onLoadData.value['number'] + "&_tbScancodeApproach_=scan" url += '?number=' + onLoadData.value['number'] + "&_tbScancodeApproach_=" + onLoadData.value[
'_tbScancodeApproach_']
} }
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/home/home" url: url
}) })
}, 500); }, 500);
} }

View File

@ -91,7 +91,7 @@
const options = getUrlParams(result); const options = getUrlParams(result);
bikeCode = options["number"]; bikeCode = options["number"];
if (type == "ride") { if (type == "ride") {
addOrder(bikeCode, (res) => { addOrder(bikeCode, true, (res) => {
console.log("00000000000000000000", res); console.log("00000000000000000000", res);
if (!res) { if (!res) {
setTimeout(() => { setTimeout(() => {

View File

@ -1,6 +1,7 @@
import config from "./config.js"; import config from "./config.js";
import { import {
showModelMessage,jkcBaseDecode showModelMessage,
jkcBaseDecode
} from "./tools.js"; } from "./tools.js";
import { import {
callOrdereApi callOrdereApi
@ -10,7 +11,7 @@ const imgPath = config.imgPath;
export const sdkKey = '22095eb86ca9e318c404f9f4a31b20d5'; export const sdkKey = '22095eb86ca9e318c404f9f4a31b20d5';
export function getMap (mapid, instance) { export function getMap(mapid, instance) {
return uni.createMapContext(mapid, { return uni.createMapContext(mapid, {
this: instance.proxy this: instance.proxy
}); });
@ -78,8 +79,8 @@ export function addLine(scolor, arrPoints) {
} }
//创建订单 //创建订单
export function addOrder(bikeCode, callback) { export function addOrder(bikeCode, jumpFlag, callback) {
const oUser =JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user"))); const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
if (!oUser) { if (!oUser) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/login/wx_login" url: "/pages/user/login/wx_login"
@ -92,10 +93,10 @@ export function addOrder(bikeCode, callback) {
userId, userId,
bikeCode bikeCode
} }
saveRide(params, 1, callback) saveRide(params, 1, jumpFlag, callback)
} }
function saveRide(params, icnt, callback) { function saveRide(params, icnt, jumpFlag, callback) {
callOrdereApi("userOrders/saveRide", params, "post").then(res => { callOrdereApi("userOrders/saveRide", params, "post").then(res => {
const { const {
code, code,
@ -107,21 +108,22 @@ function saveRide(params, icnt, callback) {
return; return;
} }
showModelMessage(message); showModelMessage(message);
if(callback) callback(false); if (callback) callback(false);
return; return;
} }
if(callback)callback(true); if (callback) callback(true);
setTimeout(() => { if (jumpFlag) {
uni.navigateTo({ setTimeout(() => {
url: "/pages/user/home/home" uni.navigateTo({
}) url: "/pages/user/home/home"
}, 1000) })
}, 1000)
}
}) })
} }
//添加面 //添加面
export function addPolygon (scolor, fcolor, arrPoints) { export function addPolygon(scolor, fcolor, arrPoints) {
return { return {
points: arrPoints, points: arrPoints,
fillColor: fcolor, fillColor: fcolor,
@ -129,4 +131,4 @@ export function addPolygon (scolor, fcolor, arrPoints) {
strokeColor: scolor, strokeColor: scolor,
zIndex: 11 zIndex: 11
} }
} }