<template>
    <view class="container">
        
        <!-- 底部扫码输入框 -->
        <view class="fixed-bottom pad-20" style="background: #ffffff;">
            <u-search placeholder="请输入快递单号/订单编号" :searchIconSize="24" bgColor="#f6f7f6"
                    @search="orderQuery" v-model="query.search" custom-style="font-size:32rpx"
                    placeholder-style="font-size:32rpx" :clearabled="true" :focus="false" :showAction="false"
                    :height="42"></u-search>
            <u-icon name="scan" size="34" color="#19be6b" @click="openScan"></u-icon>
        </view>
    </view>
</template>

<script setup>
import {
    reactive,
    ref
} from 'vue'
import { onLoad } from '@dcloudio/uni-app'

const query = reactive({
    searchType: 2,
    search: ''
})
//订单查询 /app/stock/findOrder
const orderQuery = () => {
    if (!query.search) {
        uni.$u.toast('请输入快递单号/订单编号')
        return
    }
    uni.navigateTo({
        url: `/pages/index/wms/order-query-list?id=${query.search}`
    })
}

function openScan() {
    uni.scanCode({
        success: (res) => {
            query.search = res.result
            orderQuery()
        }
    })
}

onLoad(() => {
     // #ifdef APP-PLUS
     uni.$u.useGlobalEvent((e) => {
        if (e.barcode) {
            query.search = e.barcode
            orderQuery()
        }
    })
    // #endif
})
</script>

<style lang="scss" scoped>
.header {
    display: flex;
    justify-content: space-between;
    padding: 20rpx 30rpx;
    background-color: #ffffff;
}

.status {
    color: green;
}


.log-item {
    display: flex;
    justify-content: space-between;
    padding: 20rpx 30rpx;
    border-bottom: 1px solid #e0e0e0;
}
</style>