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

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(() => {
bikeCode = null;
getOrder(); 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
@ -78,7 +79,7 @@ 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({
@ -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,
@ -111,12 +112,13 @@ function saveRide(params, icnt, callback) {
return; return;
} }
if (callback) callback(true); if (callback) callback(true);
if (jumpFlag) {
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/home/home" url: "/pages/user/home/home"
}) })
}, 1000) }, 1000)
}
}) })
} }