智能柜货柜二维码和刷新

This commit is contained in:
weiwei committed 2025-04-15 20:03:49 +08:00
1 parent d10ba485a6
commit dcd70aadd5
3 files changed
+62 -28

No files matched your search

+30 -3
View File
@@ -68,6 +68,7 @@
<el-descriptions :column="3" title="货柜信息" border>
<template #extra>
<el-space>
<el-button icon="RefreshRight" type="primary" @click="refreshCabinetQrCode">刷新货柜二维码</el-button>
<el-button icon="CircleCheck" type="primary" @click="checkOpenAccess" :disabled="checkCloseLoading" :loading="checkOpenLoading">
检修开门
</el-button>
@@ -108,6 +109,15 @@
<el-tag v-if="item.saleStatus == 1" type="primary">在售</el-tag>
<el-tag v-if="item.saleStatus == 2" type="danger">停售</el-tag>
</el-descriptions-item>
<el-descriptions-item label="收款二维码:">
<div class="flex justify-start">
<preview-image
:src="item.qrCode"
download
:downloadName="`货柜 ${state.deviceDetail.deviceCode}-${item.cabinetNo} 二维码`"
/>
</div>
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
@@ -187,7 +197,7 @@ import { displayPrice } from "/@/utils/formatMoney"
import * as hardDoorManager from "/@/api/hard/hard-door-manager"
import { ElMessageBox } from "element-plus"
import { getByCabinetNo, unPutaway } from "/@/api/hard/hard-spu"
import { closeAccess, openAccess } from "/@/api/hard/hard-door-manager"
import { closeAccess, openAccess, refreshQrCode } from "/@/api/hard/hard-door-manager"
const InfoSetting = defineAsyncComponent(() => import("./info-setting.vue"))
const VolumeSetting = defineAsyncComponent(() => import("./volume-setting.vue"))
@@ -207,6 +217,8 @@ const state = reactive<any>({
curActivedDoorTabIndex: 0,
curActivedTabIndex: 0,
})
const hardDoorId = computed<string | undefined>(() => state.deviceDetail.cabinetList?.[state.curActivedDoorTabIndex]?.hardDoorId)
const cabinetNo = computed<string | undefined>(() => state.deviceDetail.cabinetList?.[state.curActivedDoorTabIndex]?.cabinetNo)
onMounted(async () => {
await getDetail()
@@ -268,12 +280,27 @@ const refreshVolume = (data: { hardId: string; mediaVolume: number; systemVolume
state.deviceDetail.systemVolume = data.systemVolume
}
// 刷新货柜收款二维码
const refreshCabinetQrCode = async () => {
try {
const res = await refreshQrCode({ hardDoorId: hardDoorId.value, cabinetNo: cabinetNo.value })
if (res.code == 0) {
useMessage().success("刷新成功")
state.deviceDetail.cabinetList[state.curActivedDoorTabIndex].qrCode = res.data
} else {
useMessage().error(res.msg || "刷新失败")
}
} catch (error: any) {
useMessage().error(error.msg)
}
}
// 检修开门
const checkOpenAccess = async () => {
try {
checkOpenLoading.value = true
const res = await openAccess({
hardDoorId: state.hardId,
hardDoorId: hardDoorId.value,
cabinetNo: state.deviceDetail.cabinetList[state.curActivedDoorTabIndex].cabinetNo,
})
if (res.code == 0) {
@@ -293,7 +320,7 @@ const checkCloseAccess = async () => {
try {
checkCloseLoading.value = true
const res = await closeAccess({
hardDoorId: state.hardId,
hardDoorId: hardDoorId.value,
cabinetNo: state.deviceDetail.cabinetList[state.curActivedDoorTabIndex].cabinetNo,
})
if (res.code == 0) {