#
whycq
2023-04-18 471057bc4ece00870751e7b1187f244e8cc4137d
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
    <view>
        <view class="square-2">
            <view class="square-title">
                <view class="title-sign"><view class="sign"></view></view>
                <view class="title-text"><text>托盘条码</text></view>
            </view>
            <view class="square-content">
                <view class="content-input">
                    <input v-model="barcode" type="text" placeholder="扫码 / 输入" 
                    :focus="barcodeFocus" @confirm="barcodeInput()" placeholder-style="line-height:  85rpx;">
                    <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
                </view>
            </view>
        </view>
        
        <view class="square-2">
            <view class="square-title">
                <view class="title-sign"><view class="sign"></view></view>
                <view class="title-text"><text>入库口</text></view>
            </view>
                <view class="content-combox" @click="staNoSelect()">
                    <uni-combox  emptyTips="暂无数据" 
                        :candidates="sites" v-model="siteId" placeholder="请选择入库站点" @input="check">
                    </uni-combox>
                </view>
        </view>
        <!-- 底部按钮 -->
        <view class="footer flex justify-around">
            <!-- 底部全选 反选按钮 -->
            <!-- <label class="label-btn" style="width: 170rpx;">
                <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
            </label>
            <label class="label-btn" style="width: 100rpx;">
                <text  @click="reChecked()">反选</text>
            </label> -->
            
            <label class="label-btn" style="width: 150rpx;">
                <button class="cu-btn" @click="resst()">重置</button>
            </label>
            <label class="label-btn">
                <button class="cu-btn bg-blue " @click="outbound()">启动入库</button>
            </label>
        </view>
    </view>
    
</template>
 
 
<script>
    import permision from "@/common/permission.js"
    import loginVue from "../login/login.vue";
    export default {
        data() {
            return {
                commonUrl:null,
                barcode: '',
                barcodeFocus: true,
                sites: ["102入库"],
                siteId: "102入库",
                staNo: 102
            }
        },
        onShow() {
            setTimeout(()=>{
                // this.focuss()
            }, 100);
            
        },
        mounted(){
            const UIP = uni.getStorageSync('UIP');
            this.baseIP = UIP;
            const UPORT = uni.getStorageSync('UPORT');
            this.basePORT = UPORT
            const PROJ = uni.getStorageSync('UPROJ');
            this.baseUrl = PROJ
            this.getUrl()
        },
        methods: {
            // 获取url
            getUrl() {
                this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
            },
            removeBarcode() {
                this.barcode = ''
                uni.vibrateShort();
                this.barcodeFocus = false;
                this.$nextTick(function() {
                    this.barcodeFocus = true;
                });
            },
            // 重置
            resst() {
                this.barcode = ''
                this.siteId = ''
            },
            staNoSelect() {
                // this.siteId = ''
            },
            outbound() {
                let that = this 
                if (that.barcode == '') {
                     uni.showToast({title: "请扫描托盘码", icon: "none",position: 'top'})
                     return;
                }
                uni.request({
                    url: that.commonUrl + "/mobile/pakin/request",
                    header: {
                        'token':uni.getStorageSync('token'),
                        'content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        barcode: that.barcode,
                        staNo: that.staNo
                    },
                    method: "POST",
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            that.barcode = ''
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        } else {
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        }
                    }
                })
            },
            check() {
                switch(this.siteId) {
                    case "102入库":
                        this.staNo = 102
                        break;
                    case "103入库":
                        this.staNo = 103
                        break;
                    default:
                        this.staNo = 0
                        
                }
            }
         }
    }
</script>
 
<style>
</style>