野心家
2025-02-10 e191eb91bf837b58e088aef3bfd410d1b55a690e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
    <view>
        <view class="status_bar">
            <!-- 这里是状态栏 -->
        </view>
        <uni-nav-bar left-icon="left" background-color="#f8f8f8" title="关联库位" @clickLeft="back"  :fixed="true"
            :border="false" rightWidth="160rpx" leftWidth="160rpx"
            >
            <block slot="right">
                <view class="city">
                    <view>
                        <text class="uni-nav-bar-text">{{store}}</text>
                    </view>
                </view>
            </block>
         </uni-nav-bar>
        <!-- 搜索框 -->
        <!-- <view class="search-bar">
            <uni-search-bar v-model="searchVal" placeholder=" 输入库位号" bgColor="#EEEEEE" @input="search" />
        </view> -->
        <view style="margin: 0;background-color: aliceblue;text-align: center;height: 30px;">
            当前订单号: {{order.orderNo}}
        </view>
        <view class="card" v-for="item in menuList" @click="chose(item)">
            {{item}}
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                storeId: 0,
                store: '',
                orderNo: '',
                searchVal: '',
                orderId: 0,
                menuList: [],
                order: {orderNo: '--'},
                orNo: ''
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            this.storeId = uni.getStorageSync('store')
            if (this.storeId == 1) {
                this.store = '宁波仓'
            }
            if (this.storeId == 2) {
                this.store = '新昌仓'
            }
            let that = this
            const eventChannel = that.getOpenerEventChannel();
            eventChannel.on('order', function(data) {
                // console.log(data)
                that.orderId = data.orderNo.id
                that.order = data.orderNo
                that.getOrderNoList(that.orderId)
            })
        },
        methods: {
            back() {
                uni.navigateBack({})
            },
            getOrderNoList(orderId) {
                let that = this
                uni.request({
                    url: that.baseUrl + '/mobile/pda/OutLocNo',
                    data: {orderId:orderId},
                    header: {
                        'token': uni.getStorageSync('token'),
                        'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
                    },
                    method: 'POST',
                    success(res) {
                        res = res.data
                        that.menuList = res.data
                    }
                })
            },
            search() {
                let baseList = [...this.menuList]
                this.menuList = this.fuzzySearch(baseList,this.searchVal)
            },
            
            fuzzySearch(array, query) {
              const regex = new RegExp(query, 'i'); // 'i' 表示不区分大小写
              return array.filter(num => regex.test(num.toString()));
            },
            chose(item) {
                let that = this
                uni.navigateTo({
                    url: "./outMats",
                    success: function(res) {
                        // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                        res.eventChannel.emit('order', {
                            locNo: item,
                            orderId: that.orderId,
                            orderNo: that.order
                        })
                    },
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                        matList: function(data) {
                            // that.matnr = data.data
                            that.getOrderNoList(that.orderId)
                        },
                    },
                });
            }
        }
    }
</script>
 
<style>
    @import url('../../static/css/wms.css/wms.css');
    .card {
        margin: 20rpx;
        padding: 30rpx;
        background-color: #157ec1;
        border-radius: 20rpx;
        color: #FFF;
    }
</style>