wangxinhui
2025-11-12 f54b7815d8451f362554e3d2d09b4991ce13d4ff
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
    <view>
        <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
        </uni-segmented-control>
        <view class="content">
            <view v-if="current === 0" class="headerstyle">
                <view class="itemstyle">
                    <uni-forms label-width="180">
                        <uni-forms-item label="纸卷条码:">
                            <uni-easyinput type="text" placeholder="请扫描纸卷条码" ref='midInput' :focus="!focus"
                                v-model="bindCode" @confirm="barcodeInput" />
                        </uni-forms-item>
                        <uni-forms-item label="单据类型">
                            <uni-data-select placeholder="请选择" v-model="orderType"
                                :localdata="orderTypeRange"></uni-data-select>
                        </uni-forms-item>
                        <uni-forms-item>
                            <button @click="Bindrfid" type="primary" size="default" style="margin-top: 2%;">绑定</button>
                        </uni-forms-item>
                    </uni-forms>
                </view>
            </view>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    const innerAudioContext = uni.createInnerAudioContext();
    export default {
        data() {
            return {
                items: ['绑定RFID'], //, '单据信息', '解盘'
                materSn: "",
                wide: "",
                weight: "",
                lengthStock: "",
                thickness: "",
                barcode: "",
                focus: false,
                inboundBarcode: "",
                address: "",
                addressdisabled: true,
                addressFocus: false,
                current: 0,
                inboundCode: "",
                orderNo: "",
                warehouseId: "",
                Test: false,
                emptyCode: "",
                matCount: 0,
                matCode: "", //物料编码
                addressEmpty: "",
                OneCount: 0,
                targetId: "",
                materialCode: "",
                bindCode: "",
                rfidCode: "",
                rfid:"",
                outCount: 0,
                orderType: 0,
                orderTypeRange: []
            }
        },
        onShow() {},
        onLoad(res) {
            this.focus = false;
            this.addressFocus = false;
            this.Test = false;
            this.warehouseId = res.warehouseId;
            this.getDictionary();
        },
        methods: {
            onClickItem(e) {
                this.barcodeFo = true;
                this.focus = false;
                this.addressFocus = false;
                if (this.current !== e.currentIndex) {
                    this.current = e.currentIndex;
                }
            },
            barcodeInput() {
                this.$nextTick(function(x) {
                    if (this.barcode.length > 0) {
                        this.focus = true;
                    }
                })
            },
            getDictionary() {
                var param = ["inOrderTypeEnum"];
                this.$u.post('api/Sys_Dictionary/GetVueDictionary', param).then(res => {
                        //将res.data中的value改成text,key改成value
                        res[0].data.forEach(item => {
                            var obj = {
                                value: item.key,
                                text: item.value
                            }
                            if (item.key <40) {
                                this.orderTypeRange.push(obj);
                            }
                        })
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            },
            Bindrfid(){
                if (this.bindCode == "") {
                    this.$refs.uToast.show({
                        title: "请输入条码",
                        type: "error"
                    })
                    return;
                }
                if(this.orderType==0){
                    thsis.$refs.uToast.show({
                        title: "请选择单据类型",
                        type: "error"
                    })
                    return;
                }
                var url = "?palletCode=" + this.bindCode + "&orderType="+this.orderType;
                this.$u.post('api/Task/PurchaseBoxing' + url, {}).then(res => {
                    if (res.status) {
                        this.bindCode = "";
                        this.orderType = 0;
                        setTimeout(() => {
                            this.$refs.uToast.show({
                                title: "成功",
                                type: "success"
                            })
                        }, 200);
                    } else {
                        this.$refs.uToast.show({
                            title: res.message,
                            type: "error"
                        })
                    }
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            }
        }
    }
</script>
 
<style lang="scss">
    @import '@/common/uni-ui.scss';
 
    .content {
        display: flex;
        height: 150px;
    }
 
    .content-text {
        font-size: 14px;
        color: #666;
    }
 
    .itemstyle {
        margin-top: 30px;
        margin-left: 5%;
    }
 
    .headerstyle {
        width: 90%;
    }
</style>