This commit is contained in:
2026-10-12 13:43:37 +08:00
parent 9c3855cec2
commit aebe4f9528
21 changed files with 482 additions and 141 deletions
@@ -0,0 +1,31 @@
<template>
<view class="label-confirmation">
<text v-if="confirmed">标签已扫码确认,可按该包裹/箱号出库</text>
<template v-else>
<ScanTargetInput v-model="code" label="确认已贴标签" placeholder="贴好后扫描此包裹/箱标签" @submit="confirm" />
<button class="secondary" :disabled="busy || !code.trim()" @tap="confirm(code)">确认贴标</button>
<text v-if="error">{{ error }}</text>
</template>
</view>
</template>
<script>
import ScanTargetInput from '@/components/ScanTargetInput.vue'
import { confirmReturnLabel } from '@/api/return-packing.js'
export default {
components: { ScanTargetInput },
props: { cartonMark: { type: String, required: true } },
data() { return { code: '', confirmed: false, busy: false, error: '' } },
methods: {
acceptScan(value) { if (String(value).trim() === this.cartonMark) return this.confirm(value) },
async confirm(raw) {
if (this.busy || this.confirmed) return
const mark = String(raw?.detail?.value ?? raw ?? this.code).trim()
if (mark !== this.cartonMark) { this.error = '请扫描当前包裹/箱的标签'; return }
this.busy = true; this.error = ''
try { await confirmReturnLabel(mark); this.confirmed = true }
catch (error) { this.error = error?.message || '贴标确认失败,请重试' }
finally { this.busy = false }
}
}
}
</script>