schangxiang@126.com
2024-12-08 df485888ecb9f69c0051fc192b87aec700cc4f89
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<template>
    <view class="overflow">
        <cu-custom bgColor="bg-white" :isBack="true">
            <block slot="backText">
            </block>
            <block slot="content">入库</block>
        </cu-custom>
        <view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
            <text class="fontSize12rpx"> 操作人:{{operator}} </text>
        </view>
        <u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="10">
                    <u-form-item label="容器编号:" prop="wareContainerCode" required
                        style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <u-input v-model="warehouse.wareContainerCode" placeholder="请录入或扫码" 
                            @confirm="getWarehouseMaterial" style="font-weight: bolder;margin-left: 15rpx;"
                            class="width padding_left30rpx">
                        </u-input>
                    </u-form-item>
                </u-col>
                <u-col span="2">
                    <u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
                </u-col>
            </u-row>
            
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="10">
                    <u-form-item label="库位编号:" prop="wareLocationCode" required
                        style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <u-input v-model="warehouse.wareLocationCode" placeholder="请录入或扫码" required  style="font-weight: bolder;margin-left: 15rpx;" class="width padding_left30rpx">
                        </u-input>
                    </u-form-item>
                </u-col>
                <u-col span="2">
                    <u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
                </u-col>
            </u-row>
        </u-form>
        <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
        <view  style="margin-bottom: 180rpx;margin-top: 15rpx;" v-show="singlist.length > 0">
            <view v-for="(item, eindex) in singlist" :key="eindex" style="width: 100vw;display: flex;">
                <u-swipe-action :show="item.show" :index="eindex"
                    @click="longpress" @open="open" :options="options" style="margin-bottom: 10rpx;width: 100vw;">
                    <view class="title-wrap fontSize32rpx background_fff">
                        <u-row class="padding15">
                            <u-col span="1">
                                <text class="flex justify-center align-center" style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
                                    {{eindex+1}}
                                </text>
                            </u-col>
                            <u-col span="10">
                                <text class="color_f18202">{{item.code}}</text>
                            </u-col>
                        </u-row>
                        <u-row class="padding15">
                            <u-col span="8" class="" style="text-align: center;">
                                批次:{{item.batchNo}}
                            </u-col>
                            <u-col span="4" class="color_f18202" style="text-align: right;">
                                入库数量:{{item.quantity}}
                            </u-col>
                        </u-row>
                    </view>
                </u-swipe-action>
            </view>
        </view>
        <u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
            <view class="pop ">
                <h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
                <view class="line flex justify-between">
                    <text class="text-gray">物料编号</text>
                    <text>{{materlist.code}}</text>
                </view>
        
                <view class="line flex justify-between">
                    <text class="text-gray">物料名称</text>
                    <text>{{materlist.name}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">物料类型</text>
                    <text>{{materlist.wareMaterialTypeName}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">物料规格</text>
                    <text>{{materlist.specificationModel}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">长(mm)</text>
                    <text>{{materlist.long}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">宽(mm)</text>
                    <text>{{materlist.width}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">高(mm)</text>
                    <text>{{materlist.high}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">重量(kg)</text>
                    <text>{{materlist.weight}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">条码</text>
                    <text>{{materlist.barCode}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">单位</text>
                    <text>{{materlist.unit}}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">入库数量</text>
                    <text>{{materlist.quantity}}</text>
                </view>
            </view>
        </u-popup>
        <button-modal :subShow='true' garmenTitle='确认入库' @submit='submit' />
    </view>
</template>
 
<script>
    import ButtonModal from '../../../components/buttonModal.vue'
    import ModalCode from '../../../components/ModalCode.vue'
    import {getWarehouseMaterial,addWarehouseEstablishment} from '../../../api/putIn/three.js'
 
    export default {
        data() {
            return {
                rescode: 0,
                resmessage: "",
                detailshow: false,
                singlist: [], //物料详情
                options: [{
                    text: '详情',
                    style: {
                        backgroundColor: '#fc9f35'
                    }
                }],
                materlist: {},
                warehouse: {
                    wareContainerCode: '',
                    orderNo: '',
                    wareLocationCode: ''
                },
                warehouseRules: {
                    wareContainerCode: [{
                        required: true,
                        message: '容器编号不能为空',
                        trigger: 'blur'
                    }],
                    wareLocationCode:[{
                        required: true,
                        message: '库位编号不能为空',
                        trigger: 'blur'
                    }]
                },
                operator: ''
            };
        },
        components: {
            ButtonModal,
            ModalCode
        },
        onLoad(option){
            if(option.containerCode) {
                this.warehouse.wareContainerCode = option.containerCode
            }
        },
        onReady() {
            this.$refs.warehouseRef.setRules(this.warehouseRules)
        },
        mounted() {
            this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
        },
        methods: {
            //组盘记录
            getWarehouseMaterial() {
                if (this.warehouse.wareContainerCode !== '') {
                    getWarehouseMaterial(this.warehouse.wareContainerCode).then((res) => {
                        if (res.code == 200) {
                            if (res.data.length == 0) {
                                this.rescode = 400
                                this.resmessage = '暂无数据'
                                this.$refs.resmodal.show = true
                                this.singlist=[]
                                return
                            }
                            this.singlist = res.data
                            this.warehouse.orderNo = res.data[0].id
                        } else {
                            this.$refs.resmodal.show = true
                            this.resmessage = res.message
                            this.rescode = res.code
                        }
                    })
                }
            },
            //详情
            longpress(index, eindex) {
                this.materlist = this.singlist[index]
                this.detailshow = true
            },
            // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
            open(index) {
                // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
                // 原本为'false',再次设置为'false'会无效
                this.singlist[index].show = true;
                this.singlist.map((val, idx) => {
                    if (index != idx) this.singlist[idx].show = false;
                })
            },
            //确认
            submit() {
                this.$refs.warehouseRef.validate(valid => {
                    if (valid) {
                        if(this.warehouse.orderNo == '') {
                            this.$refs.resmodal.show = true
                            this.rescode = 400
                            this.resmessage = '组盘id获取失败'
                            return
                        }
                        addWarehouseEstablishment(this.warehouse).then((res) => {
                            this.$refs.resmodal.show = true
                            this.rescode = res.code
                            this.resmessage = res.message
                            if (res.code == 200) {
                                this.singlist = []
                                this.warehouse.wareContainerCode = ''
                                this.warehouse.wareLocationCode = ''
                                this.warehouse.orderNo = ''
                            }
                        })
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss">
 
</style>