SFH5/pages/book/book.vue
2026-03-16 11:10:28 +08:00

53 lines
1.3 KiB
Vue

<template>
<view style="padding: 100px 0;display: flex;justify-content: center;height: 100%;align-items: center;">
<uv-button type="success" size="large" @click="goToSetOrder">跳转下单(Go to Order)</uv-button>
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { useLockApi } from "@/Apis/lock.js";
const api = useLockApi();
const state = ref({
lockerId: "",
});
onLoad((params) => {
if (params?.q) {
let urlParams = decodeURIComponent(params.q);
state.value.lockerId = urlParams.split("?id=")[1];
goToSetOrder()
}
});
const goToSetOrder= async()=>{
try {
uni.showLoading();
const {code,data} = await api.GetNewLockerId({oldLockerId: state.value.lockerId});
uni.hideLoading();
if (code === 200) {
const id = data || state.value.lockerId;
uni.navigateTo({
url: `/pages/setOrder/index?id=${id}`,
});
}else {
uni.showToast({
title: "数据出错",
icon: "none",
});
}
}catch (error) {
uni.showToast({
title: "数据出错",
icon: "none",
});
uni.hideLoading();
console.error("Error:", error);
}
};
</script>
<style>
</style>