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>
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 {
onLaunch: function () {},
onShow: function () {
const token = window?.plus?.storage.getItem("token");
uni.setStorageSync("token", token);
console.log("App Show", uni.getStorageSync("token"));
console.log('2222222')
// const token = window?.plus?.storage.getItem("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 () {
console.log("App Hide");

View File

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

View File

@ -117,7 +117,7 @@ const isCode = ref(false);
const haveCode = ref(false);
onLoad((options) => {
if (options.id && options.pid) {
console.log("options", options);
state.id = options.id;
state.pid = options.pid;
//
@ -142,17 +142,17 @@ onLoad((options) => {
});
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: () => {
@ -179,14 +179,10 @@ const paintingDetail = async () => {
},
});
} else {
uni.setStorageSync('data',res.data)
uni.navigateTo({
url:
"/pages/detail/index?id=" +
state.id +
"&pid=" +
state.pid +
"&boxRelBucketStatus=" +
state.boxRelBucketStatus,
"/pages/detail/index?id="+ state.id + "&pid=" + state.pid+'&boxRelBucketStatus='+state.boxRelBucketStatus,
success: () => {
loading.value = false;
},