whycq
2022-03-09 a27ddbef869c993682355a6aed02b5f6a0c0b84a
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="cu-form-group margin-top">
            <view class="title">库位</view>
            <input v-model="locNo" placeholder="库位编号" name="input" @input="findByLocNo()" focus></input>
        </view>
        <view class="cu-form-group margin-top">
            <view class="title">产品</view>
            <input v-model="matNo" placeholder="产品ID" name="input" @input="findByMatNo()"></input>
        </view>
        <view class="margin-top">
            <uni-table border stripe emptyText="暂无更多数据">
                <uni-tr>
                    <uni-th width="90">产品ID</uni-th>
                    <uni-th width="90">产品名称</uni-th>
                    <uni-th width="90">库位</uni-th>
                    <uni-th width="70">数量</uni-th>
                </uni-tr>
                <uni-tr v-for="(item, index) in locDetlData" :key="index" @input="tabRender()">
                    <uni-td>{{item.matNo}}</uni-td>
                    <uni-td>{{item.matName}}</uni-td>
                    <uni-td>{{item.locNo}}</uni-td>
                    <uni-td>{{item.count}}</uni-td>
                </uni-tr>
            </uni-table>
            
        </view>
        <view style="height: 200rpx;">
             <!-- 空白层 -->
        </view>
        <view class="cu-bar foot justify-center input" style="height: 130rpx;">
            <view class="reset flex solid-bottom padding justify-center" >
                <button class="cu-btn bg-grey main-btn margin-xs" style="width: 400rpx;" @click="reset">重 置</button>
            </view>
        </view>
        
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                locNo:'',
                matNo:'',
                locDetlData:[],
                basePORT:'',
            }
        },
        mounted(){
            const UIP = uni.getStorageSync('UIP');
            this.baseIP = UIP;
            const UPORT = uni.getStorageSync('UPORT');
            this.basePORT = UPORT;
        },
        methods: {
            reset:function() {
                let that = this;
                that.locNo = '';
                that.matNo = '';
                that.locDetlData = [];
            },
            // 根据库位号查找库存明细
            findByLocNo(){
                if(this.locNo.length === 0){
                    return;
                }
                this.matNo = ''
                this.find(this.locNo,this.matNo)
            },
            // 根据产品号查找库存明细
            findByMatNo(){
                if(this.matNo.length === 0){
                    return;
                }
                this.locNo = '',
                this.find(this.locNo,this.matNo)
            },
            // find
            find(){
                let that = this
                uni.request({
                    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/mobile/locDetl/stockQuery",
                    header:{
                        'content-type':'application/x-www-form-urlencoded',
                        'token':uni.getStorageSync('token')
                    },
                    data:{
                        locNo: that.locNo,
                        matNo: that.matNo,
                    },
                    method: 'POST',
                    success(res) {
                        if(res.data.code === 200){
                            if(res.data.data != null){
                                that.locDetlData = res.data.data
                            } else if (res.data.code ===403){
                                
                            } else {
                                
                            }
                        }
                    }
                })
            },
            
        }
    }
</script>
 
<style>
    /* .reset {
        
        position: absolute;
        width: 750upx;
        bottom: 280upx;
    } */
    .pda-btn1 {
        margin-left:260rpx;
        margin-right: auto;
        margin-top: 150rpx;
        width: 200rpx;
        height: 80rpx;
        font-size: 30upx;
        font-weight: bold;
    }
</style>