location-order.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="container">
  3. <!-- 底部扫码输入框 -->
  4. <view class="fixed-bottom pad-20" style="background: #ffffff;">
  5. <u-search placeholder="请输入库位编号" :searchIconSize="24" bgColor="#f6f7f6" @search="onSearch"
  6. v-model="positionCode" :clearabled="true" :focus="false" :showAction="false" :height="42"></u-search>
  7. <u-icon name="scan" size="32" color="#19be6b" @click="openScan"></u-icon>
  8. </view>
  9. </view>
  10. </template>
  11. <script setup>
  12. import {
  13. ref,
  14. onUnmounted
  15. } from 'vue'
  16. import {
  17. onLoad,
  18. onShow
  19. } from '@dcloudio/uni-app'
  20. const positionCode = ref('')
  21. const onSearch = () => {
  22. if (positionCode.value) {
  23. uni.navigateTo({
  24. url: '/pages/index/wms/location-order-list?positionCode=' + positionCode.value
  25. })
  26. } else {
  27. uni.$u.toast('请输入库位编号')
  28. }
  29. }
  30. function openScan() {
  31. uni.scanCode({
  32. success: (res) => {
  33. positionCode.value = res.result
  34. onSearch()
  35. }
  36. })
  37. }
  38. // #ifdef APP-PLUS
  39. const { unregister } = uni.$u.useEventListener((e) => {
  40. if (e.barcode) {
  41. positionCode.value = e.barcode
  42. onSearch()
  43. }
  44. });
  45. // #endif
  46. onUnmounted(() => {
  47. // #ifdef APP-PLUS
  48. unregister();
  49. // #endif
  50. });
  51. </script>
  52. <style lang="scss" scoped>
  53. .header {
  54. display: flex;
  55. justify-content: space-between;
  56. padding: 20rpx 30rpx;
  57. background-color: #ffffff;
  58. }
  59. .status {
  60. color: green;
  61. }
  62. .log-item {
  63. display: flex;
  64. justify-content: space-between;
  65. padding: 20rpx 30rpx;
  66. border-bottom: 1px solid #e0e0e0;
  67. }
  68. </style>