2024-09-11 06:57:03 +00:00
|
|
|
|
<template>
|
2024-09-14 03:44:44 +00:00
|
|
|
|
<view class="content">
|
|
|
|
|
<navBar> 入库 </navBar>
|
|
|
|
|
<view class="container-box">
|
|
|
|
|
<span style="font-weight: bold"> 已扫画筒号:{{ state.pid }} </span>
|
|
|
|
|
<span style="margin-top: 40rpx"> 请放入: </span>
|
|
|
|
|
<view class="painting-box">
|
2024-10-17 02:59:23 +00:00
|
|
|
|
<span style="font-weight: bold; text-align: center"
|
|
|
|
|
>{{ state.containerName }}货架</span
|
|
|
|
|
>
|
2024-09-14 03:44:44 +00:00
|
|
|
|
<up-line style="margin-top: 20rpx"></up-line>
|
2024-10-17 02:59:23 +00:00
|
|
|
|
<span
|
|
|
|
|
style="
|
2024-09-14 03:44:44 +00:00
|
|
|
|
color: #cf3050;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-top: 20rpx;
|
2024-10-17 02:59:23 +00:00
|
|
|
|
"
|
|
|
|
|
>
|
2024-10-15 08:45:54 +00:00
|
|
|
|
{{ state.boxName }}
|
2024-09-14 03:44:44 +00:00
|
|
|
|
</span>
|
2024-10-17 02:59:23 +00:00
|
|
|
|
<span style="text-align: center; margin-top: 20rpx">
|
|
|
|
|
{{ state.column }}列{{ state.row }}行
|
|
|
|
|
</span>
|
2024-09-11 06:57:03 +00:00
|
|
|
|
</view>
|
2024-09-14 03:44:44 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="button-container">
|
2024-10-17 02:59:23 +00:00
|
|
|
|
<up-button
|
|
|
|
|
style="width: 336rpx; margin: auto; height: 80rpx"
|
|
|
|
|
color="#BABABA"
|
|
|
|
|
throttleTime="5"
|
|
|
|
|
:disabled="closeButton"
|
|
|
|
|
@click="closeFn"
|
|
|
|
|
:loading="loading"
|
2024-10-17 03:39:04 +00:00
|
|
|
|
v-if="runTimeEnv()"
|
2024-10-17 02:59:23 +00:00
|
|
|
|
>取消</up-button
|
|
|
|
|
>
|
|
|
|
|
<up-button
|
|
|
|
|
style="width: 336rpx; margin: auto; height: 80rpx"
|
|
|
|
|
color="#EFC54E"
|
|
|
|
|
throttleTime="5"
|
|
|
|
|
@click="doneSet"
|
|
|
|
|
:disabled="isButtonDisabled"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
>{{ buttonText }}</up-button
|
|
|
|
|
>
|
2024-09-14 03:44:44 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref, reactive, onBeforeMount } from "vue";
|
|
|
|
|
import useToast from "@/hooks/toast/useToast.js";
|
|
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
2024-10-15 08:45:54 +00:00
|
|
|
|
import { freebox, bind, check_freebox, cancel } from "@/api/login.js";
|
2024-10-17 05:36:41 +00:00
|
|
|
|
import { closeWebview } from "../../../utils/index";
|
2024-09-14 03:44:44 +00:00
|
|
|
|
const { showMessage } = useToast();
|
|
|
|
|
const loading = ref(false);
|
2024-09-19 07:40:39 +00:00
|
|
|
|
const isButtonDisabled = ref(false);
|
2024-10-10 02:47:44 +00:00
|
|
|
|
const closeButton = ref(false);
|
2024-09-19 07:40:39 +00:00
|
|
|
|
const buttonText = ref("确认");
|
2024-09-14 03:44:44 +00:00
|
|
|
|
const state = reactive({
|
2024-09-14 03:31:59 +00:00
|
|
|
|
id: "",
|
|
|
|
|
pid: "",
|
2024-09-14 03:44:44 +00:00
|
|
|
|
containerName: "",
|
2024-10-15 08:45:54 +00:00
|
|
|
|
boxName: "",
|
|
|
|
|
boxUid: "",
|
2024-10-17 02:59:23 +00:00
|
|
|
|
containerUid: "",
|
2024-09-14 03:31:59 +00:00
|
|
|
|
});
|
2024-09-14 03:44:44 +00:00
|
|
|
|
onLoad((options) => {
|
|
|
|
|
state.id = options.id;
|
2024-09-14 07:57:06 +00:00
|
|
|
|
state.pid = options.pid;
|
2024-09-14 03:44:44 +00:00
|
|
|
|
bindShelfHole();
|
|
|
|
|
});
|
2024-09-14 07:57:06 +00:00
|
|
|
|
|
2024-09-14 03:44:44 +00:00
|
|
|
|
const bindShelfHole = async () => {
|
2024-09-14 03:31:59 +00:00
|
|
|
|
loading.value = true;
|
2024-09-14 03:44:44 +00:00
|
|
|
|
const res = await freebox();
|
2024-09-14 03:31:59 +00:00
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
state.containerName = res.data.containerName;
|
2024-09-14 07:57:06 +00:00
|
|
|
|
state.boxName = res.data.boxName;
|
2024-10-15 08:45:54 +00:00
|
|
|
|
state.containerUid = res.data.containerUid;
|
|
|
|
|
state.boxUid = res.data.boxUid;
|
2024-10-17 02:59:23 +00:00
|
|
|
|
check();
|
2024-09-19 07:40:39 +00:00
|
|
|
|
if (state.boxName) {
|
2024-10-15 08:45:54 +00:00
|
|
|
|
const parts = state.boxName.split(/(\d+)/);
|
2024-09-19 07:40:39 +00:00
|
|
|
|
state.column = parts[0]; // 字母部分
|
|
|
|
|
state.row = parts[1]; // 数字部分
|
|
|
|
|
}
|
2024-09-14 03:44:44 +00:00
|
|
|
|
}
|
2024-09-14 03:31:59 +00:00
|
|
|
|
loading.value = false;
|
|
|
|
|
};
|
2024-09-19 07:40:39 +00:00
|
|
|
|
//入库
|
|
|
|
|
const doneSet = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const res = await bind({
|
|
|
|
|
paintingBucketId: state.id,
|
|
|
|
|
paintingBucketUid: state.pid,
|
2024-10-15 08:45:54 +00:00
|
|
|
|
boxUid: state.boxUid,
|
|
|
|
|
containerUid: state.containerUid,
|
|
|
|
|
containerName: state.containerName,
|
|
|
|
|
boxName: state.boxName,
|
2024-09-19 07:40:39 +00:00
|
|
|
|
});
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
showMessage({ type: "sucess", message: "入库成功" });
|
2024-10-15 08:45:54 +00:00
|
|
|
|
isButtonDisabled.value = true;
|
2024-09-19 07:40:39 +00:00
|
|
|
|
buttonText.value = "已入库";
|
2024-10-17 03:39:04 +00:00
|
|
|
|
if (runTimeEnv()) {
|
|
|
|
|
closeWebview();
|
|
|
|
|
}
|
2024-10-15 08:45:54 +00:00
|
|
|
|
} else {
|
2024-09-19 07:40:39 +00:00
|
|
|
|
showMessage({ type: "error", message: res.msg });
|
2024-10-15 08:45:54 +00:00
|
|
|
|
}
|
|
|
|
|
loading.value = false;
|
2024-09-19 07:40:39 +00:00
|
|
|
|
};
|
2024-10-10 02:47:44 +00:00
|
|
|
|
//入库取消
|
|
|
|
|
const closeFn = async () => {
|
2024-10-10 03:22:07 +00:00
|
|
|
|
loading.value = true;
|
2024-10-10 02:47:44 +00:00
|
|
|
|
const res = await cancel({
|
2024-10-17 02:59:23 +00:00
|
|
|
|
boxUid: state.boxUid,
|
2024-10-10 02:47:44 +00:00
|
|
|
|
});
|
2024-10-15 08:45:54 +00:00
|
|
|
|
if (res.status === 0) {
|
2024-10-15 08:46:43 +00:00
|
|
|
|
showMessage({ type: "error", message: "取消入库" });
|
|
|
|
|
closeButton.value = true;
|
|
|
|
|
isButtonDisabled.value = true;
|
2024-10-17 03:39:04 +00:00
|
|
|
|
if (runTimeEnv()) {
|
|
|
|
|
closeWebview();
|
|
|
|
|
}
|
2024-10-15 08:45:54 +00:00
|
|
|
|
} else {
|
|
|
|
|
showMessage({ type: "error", message: res.msg });
|
|
|
|
|
}
|
2024-10-15 08:46:43 +00:00
|
|
|
|
loading.value = false;
|
2024-10-17 02:59:23 +00:00
|
|
|
|
};
|
2024-09-29 06:15:56 +00:00
|
|
|
|
//查孔洞是否能用
|
|
|
|
|
const check = async () => {
|
|
|
|
|
const res = await check_freebox({
|
2024-10-17 02:59:23 +00:00
|
|
|
|
boxUid: state.boxUid,
|
2024-09-29 06:15:56 +00:00
|
|
|
|
});
|
2024-10-15 08:45:54 +00:00
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
} else {
|
|
|
|
|
showMessage({ type: "error", message: res.msg });
|
|
|
|
|
}
|
2024-10-17 02:59:23 +00:00
|
|
|
|
};
|
2024-10-17 05:36:41 +00:00
|
|
|
|
const runTimeEnv = () => {
|
|
|
|
|
if (plus) {
|
|
|
|
|
const currentWebView = plus.webview.getWebviewById("wv");
|
|
|
|
|
return currentWebView.RunTime === "app";
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-09-14 03:44:44 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
page {
|
|
|
|
|
background: url("@/static/bgp.png") no-repeat;
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
background-attachment: fixed;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
.container-box {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 98%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
margin-top: 60rpx;
|
|
|
|
|
padding: 40rpx;
|
2024-09-11 06:57:03 +00:00
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
2024-09-14 03:44:44 +00:00
|
|
|
|
|
|
|
|
|
.painting-box {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2024-09-11 06:57:03 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2024-09-14 03:44:44 +00:00
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
|
2024-09-11 06:57:03 +00:00
|
|
|
|
}
|
2024-09-14 03:44:44 +00:00
|
|
|
|
}
|
2024-10-15 08:45:54 +00:00
|
|
|
|
|
2024-09-14 03:44:44 +00:00
|
|
|
|
.button-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: fixed;
|
2024-09-29 06:15:56 +00:00
|
|
|
|
bottom: 1rpx;
|
2024-09-14 03:44:44 +00:00
|
|
|
|
left: 0;
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
height: 8%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|