|
|
|
|
@ -55,6 +55,8 @@ import request from '@/utils/request'
|
|
|
|
|
import AppTitleHeader from '@/components/common/AppTitleHeader.vue'
|
|
|
|
|
|
|
|
|
|
const productId = ref(undefined)
|
|
|
|
|
const productCode = ref(undefined)
|
|
|
|
|
const productType = ref(undefined)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const detailData = ref(null)
|
|
|
|
|
const unitList = ref([])
|
|
|
|
|
@ -121,17 +123,20 @@ const statusLabel = computed(() => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function fetchAll() {
|
|
|
|
|
if (!productId.value) {
|
|
|
|
|
if (!productId.value && !productCode.value) {
|
|
|
|
|
uni.showToast({ title: '缺少产品物料ID', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const isScan = productType.value === 'scan'
|
|
|
|
|
const params = isScan ? { id: productId.value } : { code: productCode.value }
|
|
|
|
|
|
|
|
|
|
const [detailRes, unitRes] = await Promise.all([
|
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/erp/product/get',
|
|
|
|
|
method: 'get',
|
|
|
|
|
params: { id: productId.value },
|
|
|
|
|
params: params,
|
|
|
|
|
showLoading: false
|
|
|
|
|
}),
|
|
|
|
|
request({
|
|
|
|
|
@ -150,9 +155,11 @@ async function fetchAll() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onLoad((query) => {
|
|
|
|
|
const rawId = query && (query.id !== undefined ? query.id : query.code)
|
|
|
|
|
const rawId = query && query.id
|
|
|
|
|
const decoded = rawId ? decodeURIComponent(String(rawId)) : ''
|
|
|
|
|
productId.value = decoded ? decoded : undefined
|
|
|
|
|
productType.value = query && query.type
|
|
|
|
|
productCode.value = query && query.code
|
|
|
|
|
fetchAll()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|