| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <view class="container flex-d h100" @click="playGlobalSound">
- <!-- 库位列表 -->
- <view class="location-list flex-1">
- <view class="no-data flex-c mt-60">请输入快递单号/订单编号</view>
- </view>
- <!-- 底部搜索框 -->
- <view class="pad-20 flex flex-column" style="background: #ffffff">
- <u-radio-group v-model="searchType" class="mb-20 ml-20">
- <u-radio label="查订单" name="1" label-size="17" />
- <u-radio label="查物流" custom-style="margin-left:20px" name="2" label-size="17" />
- </u-radio-group>
- <view class="flex-a">
- <u-search
- v-model="searchText"
- placeholder="请输入快递单号/订单编号"
- :show-action="false"
- :clearabled="true"
- @search="onSearch"
- height="40"
- >
- </u-search>
- <u-icon name="scan" size="28" color="#19be6b" @click="openScan"></u-icon>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, computed, onMounted, onUnmounted } from "vue";
- import { onLoad, onShow } from "@dcloudio/uni-app";
- // 搜索文本
- const searchText = ref("");
- const searchType = ref("1");
- // 点击全局音效
- function playGlobalSound(){
- uni.$u.playClickSound()
- }
- // 搜索处理
- const onSearch = () => {
- // 实现搜索逻辑
- uni.navigateTo({
- url: `/pages/index/wms/bad-out-order?searchText=${searchText.value}&searchType=${searchType.value}`,
- });
- };
- // 打开扫码
- const openScan = () => {
- // #ifdef APP-PLUS || MP-WEIXIN
- uni.scanCode({
- success: (res) => {
- searchText.value = res.result;
- onSearch();
- },
- fail: (err) => {
- uni.showToast({
- title: "扫码失败",
- icon: "error",
- });
- },
- });
- // #endif
- // #ifdef H5
- uni.showToast({
- title: "H5环境不支持扫码",
- icon: "none",
- });
- // #endif
- };
- // #ifdef APP-PLUS
- const { unregister } = uni.$u.useEventListener((e) => {
- if (e.barcode) {
- searchText.value = e.barcode
- onSearch()
- }
- });
- // #endif
- onUnmounted(() => {
- // #ifdef APP-PLUS
- unregister();
- // #endif
- });
- </script>
|