116 lines
3.0 KiB
Vue
116 lines
3.0 KiB
Vue
<template>
|
||
<view class="p4 pt8">
|
||
<navbar-back title="样品查询"></navbar-back>
|
||
<up-input
|
||
v-model="sampleCode"
|
||
placeholder="请扫描或者输入样品编号"
|
||
prefixIcon="scan"
|
||
fontSize="16"
|
||
prefixIconStyle="font-size: 30px;"
|
||
@confirm="handleSearch"
|
||
>
|
||
<template #suffix>
|
||
<!-- <up-button type="primary" text="查询" icon="search"></up-button> -->
|
||
<!-- <up-icon size="20" name="search" @click="handleSearch"></up-icon> -->
|
||
</template>
|
||
</up-input>
|
||
|
||
<uni-section v-if="sampleData.id" type="line" title="样品详情" titleFontSize="15px">
|
||
<uni-card>
|
||
<view>
|
||
<view class="x-bc">
|
||
<view
|
||
>样品名称:<text>{{ sampleData.sampleName }}</text></view
|
||
>
|
||
<up-tag
|
||
plain
|
||
plainFill
|
||
size="mini"
|
||
:type="sampleData.returnStatus === 'completed' ? 'success' : 'info '"
|
||
:text="sampleData.returnStatus_dictText"
|
||
></up-tag>
|
||
</view>
|
||
<view
|
||
>样品编号:<text>{{ sampleData.sampleCode }}</text></view
|
||
>
|
||
<view class="mt4"
|
||
>归库编码:<text>{{ sampleData.sampleReturnCode }}</text></view
|
||
>
|
||
<view class="mt4"
|
||
>样品库名称:<text>{{ sampleData.warehouseName }}</text></view
|
||
>
|
||
<view class="mt4"
|
||
>库位信息:<text>{{ sampleData.warehouseLocationCode }}</text></view
|
||
>
|
||
</view>
|
||
</uni-card>
|
||
</uni-section>
|
||
<up-button
|
||
v-if="sampleData.id"
|
||
type="primary"
|
||
style="width: 90%"
|
||
text="打印归库标签"
|
||
@click="handlePrint"
|
||
></up-button>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed, onMounted, toRefs, watch } from 'vue'
|
||
import { onShow } from '@dcloudio/uni-app'
|
||
import nx from '@/nx'
|
||
|
||
const { scanQRInfo } = toRefs(nx.$store('biz'))
|
||
watch(scanQRInfo, newVal => {
|
||
if (!newVal) return
|
||
scanQRInfo.value = ''
|
||
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleSearch/index') return
|
||
try {
|
||
sampleCode.value = newVal
|
||
handleSearch()
|
||
} catch (error) {
|
||
uni.showToast({
|
||
title: '请扫描正确的样品编码',
|
||
icon: 'none'
|
||
})
|
||
}
|
||
})
|
||
onShow(() => {
|
||
scanQRInfo.value = ''
|
||
})
|
||
let sampleCode = ref('')
|
||
function handleSearch() {
|
||
getSampleDetail()
|
||
}
|
||
|
||
let sampleData = ref({})
|
||
async function getSampleDetail() {
|
||
sampleData.value = {}
|
||
const { list } = await nx.$api.sampleWarehouse.queryReturnToStockSample({
|
||
sampleReturnCode: sampleCode.value,
|
||
pageSize: 10,
|
||
pageNo: 1
|
||
})
|
||
if (list.length == 0) {
|
||
uni.showToast({
|
||
title: '未查询到该样品信息',
|
||
icon: 'none'
|
||
})
|
||
} else if (list.length > 1) {
|
||
uni.showToast({
|
||
title: '查询出重复的样品编号,请联系管理员',
|
||
icon: 'none'
|
||
})
|
||
} else {
|
||
sampleData.value = list[0]
|
||
}
|
||
}
|
||
function handlePrint() {}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
text {
|
||
color: #000;
|
||
}
|
||
</style>
|