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

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

View File

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

View File

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

View File

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