store-management-app/src/pages/detail/index.vue

230 lines
5.8 KiB
Vue
Raw Normal View History

2024-09-11 06:57:03 +00:00
<template>
2024-10-17 02:59:23 +00:00
<view class="content">
2024-10-21 02:44:55 +00:00
<!-- <navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
2024-10-17 03:15:33 +00:00
<navBar
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>
画筒详情
2024-10-21 02:44:55 +00:00
</navBar> -->
2024-10-17 02:59:23 +00:00
<view class="container-box">
2024-10-17 03:15:33 +00:00
<span
style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 1"
>
2024-10-17 02:59:23 +00:00
确定要出库{{ state.locateAddress }}
</span>
2024-10-17 03:15:33 +00:00
<span
style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 1"
>
{{ state.pid }}画筒吗</span
>
<span
style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>画筒号{{ state.pid }}</span
>
<span
style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>所在位置{{ state.locateAddress }}</span
>
2024-10-17 02:59:23 +00:00
<view class="painting-box">
<span>画作名称{{ state.drawName }}</span>
2024-10-17 03:15:33 +00:00
<span style="margin-top: 20rpx">画家{{ state.drawerName }}</span>
<span style="margin-top: 20rpx">预览图</span>
2024-10-17 02:59:23 +00:00
<view class="image-container">
2024-10-17 03:15:33 +00:00
<up-image :src="state.drawThumbnail"></up-image>
2024-09-11 06:57:03 +00:00
</view>
</view>
</view>
2024-10-17 02:59:23 +00:00
</view>
<view class="button-container">
2024-10-17 03:15:33 +00:00
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA"
throttleTime="5"
2024-10-17 03:39:04 +00:00
v-if="state.boxRelBucketStatus == 1 && runTimeEnv()"
2024-10-17 03:28:59 +00:00
@click="backScan"
2024-10-17 03:15:33 +00:00
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
v-if="state.boxRelBucketStatus == 1"
:disabled="isButtonDisabled"
>
{{ buttonText }}</up-button
>
<up-button
style="width: 426rpx; margin: auto; height: 86rpx"
color="#EFC54E"
throttleTime="5"
@click="backScan"
2024-10-17 03:39:04 +00:00
v-if="
(state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4) &&
runTimeEnv()
"
2024-10-17 03:15:33 +00:00
>返回继续扫码</up-button
>
2024-10-17 02:59:23 +00:00
</view>
</template>
<script setup>
import { ref, reactive, onBeforeMount } from "vue";
2024-10-18 02:19:37 +00:00
import { closeWebview, hasPermission } from "../../../utils/index.js";
2024-10-17 02:59:23 +00:00
2024-10-21 02:44:55 +00:00
import { onLoad, onShow } from "@dcloudio/uni-app";
2024-10-17 02:59:23 +00:00
import useToast from "@/hooks/toast/useToast.js";
2024-10-21 01:44:58 +00:00
import { pbDetail, outbound, getRules } from "@/api/login.js";
2024-10-17 02:59:23 +00:00
const { showMessage } = useToast();
const isDetail = ref(false);
const loading = ref(false);
const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
2024-09-14 03:31:59 +00:00
id: "",
pid: "",
2024-10-17 02:59:23 +00:00
containerName: "",
boxRelBucketStatus: "",
drawName: "",
drawerName: "",
drawThumbnail: "",
locateAddress: "",
boxUid: "",
2024-09-14 03:31:59 +00:00
});
2024-10-21 02:44:55 +00:00
onShow(() => {
uni.setNavigationBarTitle({
title: state.boxRelBucketStatus == 1 ? "出库" : "画筒详情",
});
});
2024-10-17 02:59:23 +00:00
onLoad((options) => {
2024-10-21 06:48:25 +00:00
const token = window?.plus?.storage.getItem("token");
if (token) {
document.querySelector(".uni-page-head-hd").style.display = "none";
}
2024-10-17 02:59:23 +00:00
state.id = options.id;
state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus;
2024-10-17 03:15:33 +00:00
paintingDetail();
2024-10-21 01:44:58 +00:00
getBtngetRules();
2024-10-17 02:59:23 +00:00
});
const paintingDetail = async () => {
2024-09-14 07:57:06 +00:00
loading.value = true;
const res = await pbDetail({
id: state.id,
pid: state.pid,
});
if (res.status === 0) {
state.drawName = res.data.drawName;
state.drawerName = res.data.drawerName;
state.drawThumbnail = res.data.drawThumbnail;
state.locateAddress = res.data.locateAddress;
2024-09-19 01:38:53 +00:00
state.boxUid = res.data.boxUid;
2024-10-17 02:59:23 +00:00
}
2024-09-14 07:57:06 +00:00
};
const doneSet = async () => {
loading.value = true;
const res = await outbound({
id: state.id,
pid: state.pid,
2024-10-17 02:59:23 +00:00
boxUid: state.boxUid,
2024-09-14 07:57:06 +00:00
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "出库成功" });
2024-10-17 02:59:23 +00:00
isButtonDisabled.value = true;
2024-09-19 07:40:39 +00:00
buttonText.value = "已出库";
2024-10-17 02:59:23 +00:00
} else {
2024-09-14 07:57:06 +00:00
showMessage({ type: "error", message: res.msg });
2024-10-17 02:59:23 +00:00
}
loading.value = false;
2024-09-14 07:57:06 +00:00
};
2024-10-17 03:15:33 +00:00
const backScan = () => {
closeWebview();
};
2024-10-17 05:36:41 +00:00
const runTimeEnv = () => {
2024-10-22 05:37:33 +00:00
try {
if (plus) {
const currentWebView = plus.webview.getWebviewById("wv");
return currentWebView.RunTime === "app";
} else {
return false;
}
} catch (e) {}
2024-10-17 05:36:41 +00:00
};
2024-10-21 01:44:58 +00:00
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
2024-10-17 02:59:23 +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-10-17 02:59:23 +00:00
.painting-box {
height: 100%;
width: 100%;
2024-09-11 06:57:03 +00:00
display: flex;
flex-direction: column;
2024-10-17 02:59:23 +00:00
margin-top: 60rpx;
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-10-17 02:59:23 +00:00
.image-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20rpx;
height: auto;
2024-09-11 06:57:03 +00:00
}
2024-10-17 02:59:23 +00:00
}
.button-container {
display: flex;
justify-content: space-between;
width: 100%;
position: fixed;
bottom: 1rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
height: 8%;
}
2024-10-22 02:40:32 +00:00
uni-button:after {
border: none;
}
2024-10-17 03:15:33 +00:00
</style>