122 lines
4.6 KiB
Vue
122 lines
4.6 KiB
Vue
<script setup>
|
|
import { ref } from 'vue'
|
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
import { getInventory, getInventoryRelated } from '@/api/db'
|
|
import { inventoryStatusLabel, dash, formatWeight } from '@/utils/dbLabels'
|
|
import { PAGE_PATHS } from '@/config/api'
|
|
|
|
const id = ref('')
|
|
const detail = ref(null)
|
|
const related = ref({ plan: null, weighing: null })
|
|
|
|
const goBack = () => {
|
|
uni.navigateBack({
|
|
fail: () => uni.navigateTo({ url: PAGE_PATHS.dbInventoryList })
|
|
})
|
|
}
|
|
|
|
const load = async () => {
|
|
if (!id.value) return
|
|
try {
|
|
detail.value = await getInventory(id.value)
|
|
related.value = await getInventoryRelated(id.value)
|
|
} catch (e) {
|
|
uni.showToast({ title: e.message || '加载失败', icon: 'none' })
|
|
}
|
|
}
|
|
|
|
const openWeighing = () => {
|
|
if (!related.value?.weighing?.id) {
|
|
uni.showToast({ title: '暂无关联地磅单', icon: 'none' })
|
|
return
|
|
}
|
|
uni.navigateTo({
|
|
url: `${PAGE_PATHS.dbWeighingDetail}?id=${related.value.weighing.id}`
|
|
})
|
|
}
|
|
|
|
const openPlan = () => {
|
|
if (!related.value?.plan?.id) {
|
|
uni.showToast({ title: '暂无关联计划', icon: 'none' })
|
|
return
|
|
}
|
|
uni.navigateTo({
|
|
url: `${PAGE_PATHS.dbPlansDetail}?id=${related.value.plan.id}`
|
|
})
|
|
}
|
|
|
|
onLoad((q) => {
|
|
id.value = q?.id || ''
|
|
})
|
|
onShow(() => load())
|
|
</script>
|
|
|
|
<template>
|
|
<view class="mp-page mp-page--sub">
|
|
<view class="mp-header mp-header--db">
|
|
<text class="mp-subpage-back" @click="goBack">← 返回</text>
|
|
<text class="mp-header__title" style="margin-top: 16rpx">出入库详情</text>
|
|
</view>
|
|
|
|
<view v-if="detail" class="mp-detail-hero">
|
|
<view class="mp-detail-hero__top">
|
|
<view>
|
|
<text class="mp-detail-hero__title">{{ dash(detail.batchNo || detail.id) }}</text>
|
|
<text class="mp-detail-hero__sub">{{ dash(detail.product) }} · {{ dash(detail.businessType) }}</text>
|
|
</view>
|
|
<text class="mp-tag" :class="'mp-tag--' + inventoryStatusLabel(detail.status).tag">
|
|
{{ inventoryStatusLabel(detail.status).text }}
|
|
</text>
|
|
</view>
|
|
<view class="mp-detail-hero__meta">
|
|
<text class="mp-detail-hero__chip">{{ dash(detail.vehicleNo) }}</text>
|
|
<text class="mp-detail-hero__chip">{{ formatWeight(detail.quantity) }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="mp-block">
|
|
<text class="mp-block__title">基本信息</text>
|
|
<view class="mp-block__panel">
|
|
<view class="mp-kv"><text class="mp-kv__label">日期</text><text class="mp-kv__value">{{ dash(detail?.date) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">往来单位</text><text class="mp-kv__value">{{ dash(detail?.partnerCompany) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">规格</text><text class="mp-kv__value">{{ dash(detail?.specification) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">计划号</text><text class="mp-kv__value">{{ dash(detail?.planNo) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">备注</text><text class="mp-kv__value">{{ dash(detail?.remarks) }}</text></view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="mp-block">
|
|
<text class="mp-block__title">过磅数据</text>
|
|
<view class="mp-block__panel">
|
|
<view class="mp-kv"><text class="mp-kv__label">毛重</text><text class="mp-kv__value">{{ formatWeight(detail?.grossWeight) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">皮重</text><text class="mp-kv__value">{{ formatWeight(detail?.tareWeight) }}</text></view>
|
|
<view class="mp-kv"><text class="mp-kv__label">净重</text><text class="mp-kv__value">{{ formatWeight(detail?.netWeight) }}</text></view>
|
|
</view>
|
|
</view>
|
|
|
|
<view v-if="detail?.siteFeedbackRemark || detail?.siteFeedbackImages?.length" class="mp-block">
|
|
<text class="mp-block__title">现场反馈</text>
|
|
<view class="mp-block__panel" style="padding: 28rpx">
|
|
<text style="font-size: 26rpx">{{ dash(detail.siteFeedbackRemark) }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="mp-section">
|
|
<view class="mp-list">
|
|
<view class="mp-card" @click="openWeighing">
|
|
<view class="mp-card__head">
|
|
<text class="mp-card__title">关联地磅单</text>
|
|
<text class="mp-tag mp-tag--info">{{ related.weighing ? '查看' : '无' }}</text>
|
|
</view>
|
|
</view>
|
|
<view class="mp-card" @click="openPlan">
|
|
<view class="mp-card__head">
|
|
<text class="mp-card__title">关联计划</text>
|
|
<text class="mp-tag mp-tag--info">{{ related.plan ? '查看' : '无' }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|