147 lines
4.3 KiB
Vue
147 lines
4.3 KiB
Vue
<template>
|
||
<!-- 自定义导航栏 -->
|
||
<navigation :title="pathParams.billNo">
|
||
<template #right>
|
||
<view class="right-btn flex align-center justify-center ">
|
||
<uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px"
|
||
style="margin-top:10rpx" />
|
||
<uv-image @click="onEdit" src="../../../../static/edit.png" class="ml-24" width="20px" height="20px"
|
||
style="margin-top:10rpx" />
|
||
</view>
|
||
</template>
|
||
</Navigation>
|
||
<!-- 详情信息 -->
|
||
<detail-info type="stockIn" :detailInfo="detailInfo" />
|
||
|
||
<view v-if="detailInfo?.billType == '0'"
|
||
:class="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库' ? 'bottom' : 'bottom1'">
|
||
<uv-button type="error" v-if="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库'" text="作废"
|
||
@click="toObsolete"></uv-button>
|
||
<uv-button type="primary" text="入库单入库" @click="toPutAway"></uv-button>
|
||
</view>
|
||
</template>
|
||
<script setup>
|
||
import _ from 'lodash';
|
||
import { ref, computed } from 'vue';
|
||
import { onLoad } from "@dcloudio/uni-app";
|
||
import { objectToQuery, getBillType } from '../../../until';
|
||
import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn';
|
||
import DetailInfo from '../../../components/DetailInfo.vue';
|
||
import Navigation from '../../../components/Navigation.vue';
|
||
|
||
// 数据:路径参数
|
||
const pathParams = ref('')
|
||
// 数据:详情
|
||
const detailInfo = ref('')
|
||
// 数据:类型 stockIn:入库 stockIn-putAway:入库单入库 stockOut:出库
|
||
const type = computed(() => pathParams.value.type)
|
||
// 方法:获取详情 - 将isDelete写入
|
||
const getDetailInfo = () => {
|
||
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
|
||
detailInfo.value = res.data
|
||
})
|
||
}
|
||
|
||
// 打印
|
||
const onPrinter = () => {
|
||
|
||
}
|
||
const toObsolete = () => {
|
||
const params = {
|
||
billNo: pathParams.value?.billNo,
|
||
billType: '5'
|
||
}
|
||
inboundBillVoid(params).then((res) => {
|
||
// /pages/warehousing/stockIn/my
|
||
uni.navigateTo({
|
||
url: `/pages/warehousing/stockIn/my`
|
||
});
|
||
|
||
})
|
||
|
||
}
|
||
const setDetailInfoToStorage = (type) => {
|
||
uni.setStorageSync('app_warehousing', [{
|
||
deptName: detailInfo.value?.warehouseName,
|
||
deptCode: detailInfo.value?.warehouseCode,
|
||
}])
|
||
uni.setStorageSync('app_storageArea', [{
|
||
deptName: detailInfo.value?.areaName,
|
||
deptCode: detailInfo.value?.areaCode,
|
||
}])
|
||
if (type) {
|
||
const material = _.filter(detailInfo.value?.itemList, (i) => i?.uniqueCode && i.status == '0')
|
||
const materialSelectList = _.filter(detailInfo.value?.itemList, (i) => !i?.uniqueCode && i.status == '0')
|
||
uni.setStorageSync('app_material', material)
|
||
uni.setStorageSync('app_material_select_list', materialSelectList)
|
||
} else {
|
||
uni.setStorageSync('app_material', detailInfo.value?.itemList)
|
||
}
|
||
uni.setStorageSync('app_billRemark', detailInfo.value?.billRemark,)
|
||
|
||
}
|
||
// 按钮:入库单入库
|
||
const toPutAway = () => {
|
||
setDetailInfoToStorage('1')
|
||
uni.navigateTo({
|
||
url: `/pages/warehousing/stockIn/components/inbound?billNo=${pathParams.value.billNo}`
|
||
});
|
||
}
|
||
// 编辑
|
||
const onEdit = () => {
|
||
setDetailInfoToStorage()
|
||
const query = objectToQuery(pathParams.value)
|
||
let url = `/pages/warehousing/stockIn/create${query}`
|
||
uni.navigateTo({
|
||
url: url
|
||
});
|
||
}
|
||
|
||
// 接收路径参数:billNo
|
||
onLoad((options) => {
|
||
if (!options.billNo) {
|
||
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
|
||
return
|
||
}
|
||
pathParams.value = options
|
||
getDetailInfo()
|
||
})
|
||
|
||
</script>
|
||
<style scoped lang="scss">
|
||
/* 底部按钮 */
|
||
|
||
|
||
// 底部按钮
|
||
.bottom {
|
||
position: fixed;
|
||
bottom: 0;
|
||
height: 60rpx;
|
||
font-size: 14px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 100%;
|
||
|
||
.uv-button-wrapper {
|
||
width: 50%;
|
||
border-radius: 0;
|
||
}
|
||
}
|
||
|
||
.bottom1 {
|
||
position: fixed;
|
||
bottom: 0;
|
||
height: 60rpx;
|
||
font-size: 14px;
|
||
display: flex;
|
||
align-items: center;
|
||
// justify-content: center;
|
||
width: 100%;
|
||
|
||
.uv-button-wrapper {
|
||
width: 100%;
|
||
border-radius: 0;
|
||
}
|
||
}
|
||
</style> |