This commit is contained in:
jyx 2024-10-23 16:42:29 +08:00
parent 210cde7f2f
commit 405f59418d
3 changed files with 124 additions and 50 deletions

View File

@ -1,10 +1,85 @@
<script> <script>
import { onLoad } from "@dcloudio/uni-app";
import { pbDetail } from "@/api/login.js";
import useToast from "@/hooks/toast/useToast.js";
import { ref, reactive } from "vue";
const { showMessage } = useToast();
const state = reactive({
id: "",
pid: "",
});
const loading = ref(false);
export default { export default {
onLaunch: function () {}, onLaunch: function () {},
onShow: function () { onShow: function () {
const token = window?.plus?.storage.getItem("token"); console.log('2222222')
uni.setStorageSync("token", token); // const token = window?.plus?.storage.getItem("token");
console.log("App Show", uni.getStorageSync("token")); // uni.setStorageSync("token", token);
// console.log("App Show", uni.getStorageSync("token"));
const params = new URLSearchParams(window.location.search); // URL
state.id = params.get("id");
state.pid = params.get("pid");
console.log(state)
const paintingDetail = async () => {
loading.value = true;
console.log("state", state);
const res = await pbDetail({
id: state.id,
pid: state.pid,
});
if (res.status === 0) {
console.log("成功拉1");
state.boxRelBucketStatus = res.data.boxRelBucketStatus;
console.log("boxRelBucketStatus", state.boxRelBucketStatus);
if (res.data.pbStatus == 1) {
console.log("成功拉2");
uni.navigateTo({
url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
} else {
if (
res.data.boxRelBucketStatus == 3 &&
res.data.locateAddress == "公司内"
) {
uni.navigateTo({
url: "/pages/painting/index?id=" + state.id + "&pid=" + state.pid,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
} else {
uni.setStorageSync('data',res.data)
console.log()
uni.navigateTo({
url:
"/pages/detail/index?id="+ state.id + "&pid=" + state.pid+'&boxRelBucketStatus='+state.boxRelBucketStatus,
success: () => {
loading.value = false;
},
fail: () => {
loading.value = false;
showMessage({ type: "default", message: "跳转失败" });
},
});
}
}
}
};
paintingDetail()
}, },
onHide: function () { onHide: function () {
console.log("App Hide"); console.log("App Hide");

View File

@ -9,32 +9,32 @@
<view class="container-box"> <view class="container-box">
<span <span
style="font-weight: bold; text-align: center" style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 1" v-if="state.data.boxRelBucketStatus == 1"
> >
确定要出库{{ state.locateAddress }} 确定要出库{{ state.data.locateAddress }}
</span> </span>
<span <span
style="font-weight: bold; text-align: center; margin-top: 20rpx" style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 1" v-if="state.data.boxRelBucketStatus == 1"
> >
{{ state.pid }}画筒吗</span {{ state.data.pid }}画筒吗</span
> >
<span <span
style="font-weight: bold; text-align: center" style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4" v-if="state.data.boxRelBucketStatus == 2 || state.data.boxRelBucketStatus == 4"
>画筒号{{ state.pid }}</span >画筒号{{ state.data.pid }}</span
> >
<span <span
style="font-weight: bold; text-align: center; margin-top: 20rpx" style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4" v-if="state.data.boxRelBucketStatus == 2 || state.data.boxRelBucketStatus == 4"
>所在位置{{ state.locateAddress }}</span >所在位置{{ state.data.locateAddress }}</span
> >
<view class="painting-box"> <view class="painting-box">
<span>画作名称{{ state.drawName }}</span> <span>画作名称{{ state.data.drawName }}</span>
<span style="margin-top: 20rpx">画家{{ state.drawerName }}</span> <span style="margin-top: 20rpx">画家{{ state.data.drawerName }}</span>
<span style="margin-top: 20rpx">预览图</span> <span style="margin-top: 20rpx">预览图</span>
<view class="image-container"> <view class="image-container">
<up-image :src="state.drawThumbnail" @click="enlarge(state.drawThumbnail)"></up-image> <up-image :src="state.data.drawThumbnail" @click="enlarge(state.data.drawThumbnail)"></up-image>
</view> </view>
</view> </view>
</view> </view>
@ -44,7 +44,7 @@
style="width: 336rpx; margin: auto; height: 80rpx" style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA" color="#BABABA"
throttleTime="5" throttleTime="5"
v-if="state.boxRelBucketStatus == 1 && runTimeEnv()" v-if="state.data.boxRelBucketStatus == 1 && runTimeEnv()"
@click="backScan" @click="backScan"
>取消</up-button >取消</up-button
> >
@ -53,7 +53,7 @@
color="#EFC54E" color="#EFC54E"
throttleTime="5" throttleTime="5"
@click="doneSet" @click="doneSet"
v-if="state.boxRelBucketStatus == 1" v-if="state.data.boxRelBucketStatus == 1"
:disabled="isButtonDisabled" :disabled="isButtonDisabled"
> >
{{ buttonText }}</up-button {{ buttonText }}</up-button
@ -64,7 +64,7 @@
throttleTime="5" throttleTime="5"
@click="backScan" @click="backScan"
v-if=" v-if="
(state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4) && (state.data.boxRelBucketStatus == 2 || state.data.boxRelBucketStatus == 4) &&
runTimeEnv() runTimeEnv()
" "
>返回继续扫码</up-button >返回继续扫码</up-button
@ -94,10 +94,11 @@ const state = reactive({
drawThumbnail: "", drawThumbnail: "",
locateAddress: "", locateAddress: "",
boxUid: "", boxUid: "",
data:{},
}); });
onShow(() => { onShow(() => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: state.boxRelBucketStatus == 1 ? "出库" : "画筒详情", title: state.data.boxRelBucketStatus == 1 ? "出库" : "画筒详情",
}); });
}); });
onLoad((options) => { onLoad((options) => {
@ -105,32 +106,34 @@ onLoad((options) => {
if (token) { if (token) {
document.querySelector(".uni-page-head-hd").style.display = "none"; document.querySelector(".uni-page-head-hd").style.display = "none";
} }
state.id = options.id; // state.id = options.id;
state.pid = options.pid; // state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus; // state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail(); // paintingDetail();
state.data = uni.getStorageSync('data')
getBtngetRules(); getBtngetRules();
}); console.log('state.data',state.data)
const paintingDetail = async () => { });
loading.value = true; // const paintingDetail = async () => {
const res = await pbDetail({ // loading.value = true;
id: state.id, // const res = await pbDetail({
pid: state.pid, // id: state.id,
}); // pid: state.pid,
if (res.status === 0) { // });
state.drawName = res.data.drawName; // if (res.status === 0) {
state.drawerName = res.data.drawerName; // state.drawName = res.data.drawName;
state.drawThumbnail = res.data.drawThumbnail; // state.drawerName = res.data.drawerName;
state.locateAddress = res.data.locateAddress; // state.drawThumbnail = res.data.drawThumbnail;
state.boxUid = res.data.boxUid; // state.locateAddress = res.data.locateAddress;
} // state.boxUid = res.data.boxUid;
}; // }
// };
const doneSet = async () => { const doneSet = async () => {
loading.value = true; loading.value = true;
const res = await outbound({ const res = await outbound({
id: state.id, id: state.data.id,
pid: state.pid, pid: state.data.pid,
boxUid: state.boxUid, boxUid: state.data.boxUid,
}); });
if (res.status === 0) { if (res.status === 0) {
showMessage({ type: "sucess", message: "出库成功" }); showMessage({ type: "sucess", message: "出库成功" });

View File

@ -117,7 +117,7 @@ const isCode = ref(false);
const haveCode = ref(false); const haveCode = ref(false);
onLoad((options) => { onLoad((options) => {
if (options.id && options.pid) { if (options.id && options.pid) {
console.log("options", options);
state.id = options.id; state.id = options.id;
state.pid = options.pid; state.pid = options.pid;
// //
@ -142,17 +142,17 @@ onLoad((options) => {
}); });
const paintingDetail = async () => { const paintingDetail = async () => {
loading.value = true; loading.value = true;
console.log("state", state);
const res = await pbDetail({ const res = await pbDetail({
id: state.id, id: state.id,
pid: state.pid, pid: state.pid,
}); });
if (res.status === 0) { if (res.status === 0) {
console.log("成功拉1");
state.boxRelBucketStatus = res.data.boxRelBucketStatus; state.boxRelBucketStatus = res.data.boxRelBucketStatus;
console.log("boxRelBucketStatus", state.boxRelBucketStatus); console.log("boxRelBucketStatus", state.boxRelBucketStatus);
if (res.data.pbStatus == 1) { if (res.data.pbStatus == 1) {
console.log("成功拉2");
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid, url: "/pages/index/index?id=" + state.id + "&pid=" + state.pid,
success: () => { success: () => {
@ -179,14 +179,10 @@ const paintingDetail = async () => {
}, },
}); });
} else { } else {
uni.setStorageSync('data',res.data)
uni.navigateTo({ uni.navigateTo({
url: url:
"/pages/detail/index?id=" + "/pages/detail/index?id="+ state.id + "&pid=" + state.pid+'&boxRelBucketStatus='+state.boxRelBucketStatus,
state.id +
"&pid=" +
state.pid +
"&boxRelBucketStatus=" +
state.boxRelBucketStatus,
success: () => { success: () => {
loading.value = false; loading.value = false;
}, },