<template>
  <view class="page-pick-code">
    <view class="title">
      输入核销码
    </view>
    <view class="inp-wrapper">
      <input
        class="input"
        :value="code"
        placeholder="请输入核销码"
        @input="onGetPinkCodeInp"
      >
      <view
        class="sub-btn"
        @tap="onToScanPick"
      >
        确定
      </view>
    </view>
  </view>
</template>

<script setup>
import util from '@/utils/util'
const code = ref('')
/* 跳转到取件页面 */
const onToScanPick = () => {
  if (code.value === '') {
    uni.showToast({
      title: '请输入核销码',
      icon: 'none'
    })
  } else if (!util.checkIsVerification(code.value)) {
    code.value = ''
    uni.showToast({
      title: '请输入正确的核销码',
      icon: 'none'
    })
  } else {
    // 扫码后跳转核销页面
    uni.navigateTo({
      url: '/pages/scan-pick/scan-pick?pickCode=' + code.value + '&pageType=2'
    })
  }
}
// 获取提货码
const onGetPinkCodeInp = (e) => {
  code.value = e.detail.value
}
</script>

<style lang="scss" scoped>
@import "./pick-code.scss";
</style>
