智能柜扫码和跳转

This commit is contained in:
weiwei committed 2025-04-15 20:29:11 +08:00
1 parent 4d00ee6fd4
commit 7af87b8e80
2 files changed
+15 -7

No files matched your search

+8 -4
View File
@@ -67,7 +67,6 @@
</view>
</tm-sheet>
<view class="h-30rpx" />
<template #main-bottom>
<view class="m-30rpx">
<tm-button block @click="openDoor" :disabled="state.disabled">开 门</tm-button>
@@ -78,7 +77,7 @@
<script setup lang="ts">
import { reactive } from "vue"
import { onShow } from "@dcloudio/uni-app"
import { onLoad } from "@dcloudio/uni-app"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
import { router } from "@/sheep"
@@ -86,9 +85,14 @@ const state = reactive({
disabled: true,
})
onShow(() => {
onLoad((options: any) => {
if (!options) return
const { hardDoorId, cabinetNo } = options
if (!hardDoorId || !cabinetNo) return
// 检查钱包余额
console.log("onShow")
state.disabled = false
})
// 去充值
+7 -3
View File
@@ -46,7 +46,7 @@
</template>
<script setup lang="ts">
import { reactive, ref } from "vue"
import { reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
import { filePath } from "@@/utils/file"
@@ -249,6 +249,7 @@ const scanCode = {
usePayStore().setPayData({})
try {
const decodedString = await scanCode.getScanResult()
console.log("二维码解码结果:", decodedString)
if (decodedString) {
scanCode.processScanResult(decodedString)
@@ -269,8 +270,9 @@ const scanCode = {
// 开发环境模拟扫码
// const testQrCode = "eyJpZCI6IjE4OTYxNTcyMDc2NDQwNTM1MDYiLCJuYW1lIjoi5rWL6K+V5ZWG5oi3In0=" // 线上-测试超市-收款码
// const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 测试环境-邓本地-新县府超市-收款码
const testQrCode = "eyJpZCI6IjE5MDc2ODQwNTY4NDA4NDMyNjYiLCJuYW1lIjoi5pm66IO95p+c6Ieq6JCl5ZWG5oi3MSJ9" // 测试环境-邓本地-智能柜自营商户1-收款码
uni.showToast({ title: "开发环境不是浙政钉环境,扫码仅供测试,收款商家为测试商户超市", icon: "none" })
// const testQrCode = "eyJpZCI6IjE5MDc2ODQwNTY4NDA4NDMyNjYiLCJuYW1lIjoi5pm66IO95p+c6Ieq6JCl5ZWG5oi3MSJ9" // 测试环境-邓本地-智能柜自营商户1-收款码
const testQrCode = "eyJoYXJkRG9vcklkIjoiMTkxMTYwNDg5ODQ1NTc4OTU2OSIsImNhYmluZXRObyI6IjEifQ==" // 测试智能柜货柜二维码
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试,收款商家为测试商户超市" })
return scanCode.decodeBase64(testQrCode)
} else if (state.appInfo == "dd") {
// 浙政钉扫码
@@ -292,6 +294,8 @@ const scanCode = {
if (decodedJson?.id && decodedJson?.name) {
usePayStore().setPayData(decodedJson)
router.jump("/pages/pay/scanPay")
} else if (decodedJson?.hardDoorId && decodedJson?.cabinetNo) {
router.jump("/pages/cabinet/buy", { hardDoorId: decodedJson.hardDoorId, cabinetNo: decodedJson.cabinetNo })
} else {
uni.showToast({ title: "无效的二维码", icon: "none" })
}