bad-out.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="container flex-d h100">
  3. <!-- 库位列表 -->
  4. <view class="location-list flex-1">
  5. <view class="no-data flex-c mt-60">请输入快递单号/订单编号</view>
  6. </view>
  7. <!-- 底部搜索框 -->
  8. <view class="pad-20 flex flex-column" style="background: #ffffff">
  9. <u-radio-group v-model="searchType" class="mb-20 ml-20">
  10. <u-radio label="查订单" name="1" label-size="17" />
  11. <u-radio label="查物流" custom-style="margin-left:20px" name="2" label-size="17" />
  12. </u-radio-group>
  13. <view class="flex-a">
  14. <u-search
  15. v-model="searchText"
  16. placeholder="请输入快递单号/订单编号"
  17. :show-action="false"
  18. :clearabled="true"
  19. @search="onSearch"
  20. height="40"
  21. >
  22. </u-search>
  23. <u-icon name="scan" size="28" color="#19be6b" @click="openScan"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref, computed, onMounted } from "vue";
  30. // 搜索文本
  31. const searchText = ref("");
  32. const searchType = ref("1");
  33. // 搜索处理
  34. const onSearch = () => {
  35. // 实现搜索逻辑
  36. uni.navigateTo({
  37. url: `/pages/index/wms/bad-out-order?searchText=${searchText.value}&searchType=${searchType.value}`,
  38. });
  39. };
  40. // 打开扫码
  41. const openScan = () => {
  42. // #ifdef APP-PLUS || MP-WEIXIN
  43. uni.scanCode({
  44. success: (res) => {
  45. searchText.value = res.result;
  46. onSearch();
  47. },
  48. fail: (err) => {
  49. uni.showToast({
  50. title: "扫码失败",
  51. icon: "error",
  52. });
  53. },
  54. });
  55. // #endif
  56. // #ifdef H5
  57. uni.showToast({
  58. title: "H5环境不支持扫码",
  59. icon: "none",
  60. });
  61. // #endif
  62. };
  63. </script>