Compare commits

..

No commits in common. "2159256e53cebac81b10f1e42a143852a2a4a260" and "5747761671917036083527225b589de86be24a97" have entirely different histories.

2 changed files with 57 additions and 49 deletions

View File

@ -5,25 +5,43 @@
<span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span> <span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span>
<span style="margin-top: 40rpx"> 请放入 </span> <span style="margin-top: 40rpx"> 请放入 </span>
<view class="painting-box"> <view class="painting-box">
<span style="font-weight: bold; text-align: center">{{ state.containerName }}货架</span> <span style="font-weight: bold; text-align: center"
>{{ state.containerName }}货架</span
>
<up-line style="margin-top: 20rpx"></up-line> <up-line style="margin-top: 20rpx"></up-line>
<span style=" <span
style="
color: #cf3050; color: #cf3050;
font-size: 24px; font-size: 24px;
text-align: center; text-align: center;
margin-top: 20rpx; margin-top: 20rpx;
"> "
{{ state.boxName }} >
{{state.boxName}}
</span> </span>
<span style="text-align: center; margin-top: 20rpx"> {{ state.column }}{{ state.row }} </span> <span style="text-align: center; margin-top: 20rpx"> {{state.column}}{{state.row}} </span>
</view> </view>
</view> </view>
</view> </view>
<view class="button-container"> <view class="button-container">
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#BABABA" throttleTime="5" <up-button
:disabled="closeButton" @click="closeFn" :loading="loading">取消</up-button> style="width: 336rpx; margin: auto; height: 80rpx"
<up-button style="width: 336rpx; margin: auto; height: 80rpx" color="#EFC54E" throttleTime="5" @click="doneSet" color="#BABABA"
:disabled="isButtonDisabled" :loading="loading">{{ buttonText }}</up-button> throttleTime="5"
:disabled="closeButton"
@click="closeFn"
:loading="loading"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
:disabled="isButtonDisabled"
:loading="loading"
>{{ buttonText }}</up-button
>
</view> </view>
</template> </template>
@ -31,8 +49,7 @@
import { ref, reactive, onBeforeMount } from "vue"; import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js"; import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { freebox, bind, check_freebox, cancel } from "@/api/login.js"; import { freebox,bind,check_freebox,cancel} from "@/api/login.js";
import { closeWebview, runTimeEnv } from "@/utils/index.js"
const { showMessage } = useToast(); const { showMessage } = useToast();
const loading = ref(false); const loading = ref(false);
const isButtonDisabled = ref(false); const isButtonDisabled = ref(false);
@ -42,9 +59,9 @@ const state = reactive({
id: "", id: "",
pid: "", pid: "",
containerName: "", containerName: "",
boxName: "", boxName:"",
boxUid: "", boxUid:"",
containerUid: '', containerUid:'',
}); });
onLoad((options) => { onLoad((options) => {
@ -59,15 +76,15 @@ const bindShelfHole = async () => {
if (res.status === 0) { if (res.status === 0) {
state.containerName = res.data.containerName; state.containerName = res.data.containerName;
state.boxName = res.data.boxName; state.boxName = res.data.boxName;
state.containerUid = res.data.containerUid; state.containerUid=res.data.containerUid;
state.boxUid = res.data.boxUid; state.boxUid=res.data.boxUid;
check() check()
if (state.boxName) { if (state.boxName) {
const parts = state.boxName.split(/(\d+)/); const parts = state.boxName.split(/(\d+)/);
state.column = parts[0]; // state.column = parts[0]; //
state.row = parts[1]; // state.row = parts[1]; //
} }
} }
loading.value = false; loading.value = false;
}; };
@ -77,44 +94,44 @@ const doneSet = async () => {
const res = await bind({ const res = await bind({
paintingBucketId: state.id, paintingBucketId: state.id,
paintingBucketUid: state.pid, paintingBucketUid: state.pid,
boxUid: state.boxUid, boxUid:state.boxUid,
containerUid: state.containerUid, containerUid:state.containerUid,
containerName: state.containerName, containerName:state.containerName,
boxName: state.boxName, boxName:state.boxName,
}); });
if (res.status === 0) { if (res.status === 0) {
showMessage({ type: "sucess", message: "入库成功" }); showMessage({ type: "sucess", message: "入库成功" });
isButtonDisabled.value = true; isButtonDisabled.value = true;
buttonText.value = "已入库"; buttonText.value = "已入库";
} else { }else{
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
loading.value = false; loading.value = false;
}; };
// //
const closeFn = async () => { const closeFn = async () => {
loading.value = true; loading.value = true;
const res = await cancel({ const res = await cancel({
boxUid: state.boxUid boxUid : state.boxUid
}); });
if (res.status === 0) { if(res.status === 0){
showMessage({ type: "error", message: "取消入库" }); showMessage({ type: "error", message: "取消入库" });
closeButton.value = true; closeButton.value = true;
isButtonDisabled.value = true; isButtonDisabled.value = true;
} else { }else{
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
loading.value = false; loading.value = false;
} }
// //
const check = async () => { const check = async () => {
const res = await check_freebox({ const res = await check_freebox({
boxUid: state.boxUid boxUid : state.boxUid
}); });
if (res.status === 0) { if(res.status === 0){
} else { }else{
showMessage({ type: "error", message: res.msg }); showMessage({ type: "error", message: res.msg });
} }
} }
</script> </script>
@ -156,7 +173,6 @@ page {
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5); box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
} }
} }
.button-container { .button-container {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -1,8 +0,0 @@
const currentWebView = plus.webview.getWebviewById("wv");
export const runTimeEnv = () => {
return currentWebView.RunTime === "app";
};
export const closeWebview = () => {
currentWebView.close();
};