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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<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="Code" required
                        style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                        <input v-model="warehouse.Code" placeholder="请录入或扫码" @focus="focu=true" @confirm="query"
                            class="width padding_left25rpx" style="font-weight: bolder;margin-left: 15rpx;">
                        </input>
                        <u-icon name="close-circle-fill" color="#848484" v-if="warehouse.Code && focu"
                            @click="warehouse.Code=''"></u-icon>
                    </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 v-if="singlist.length>0" :style="'height:calc(100vh - '+(CustomBar+155)+'px'">
            <view class="margin_top10rpx overflow_auto" style="height:calc(100% - 20rpx)">
                <scroll-view scroll-y="true" style="height: 60vh;">
                    <u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex"
                        @click="longpress" @open="open" :options="options">
                        <view class="item u-border-bottom">
                            <!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
                            <view class="title-wrap">
                                <view :key="eindex+'singlist'" :class="item.edit?'clickactive':''"
                                    class=" width margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
                                    <view class="flex justify-between">
                                        <view
                                            class="flex justify-center align-end height56rpx align-center padding5_10 fontSize32rpx">
                                            <view class="margin_right10rpx flex align-center justify-center"
                                                style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 65rpx;height: 45rpx;">
                                                {{eindex+1}}
                                            </view>
                                            <text
                                                class="text-gray width23 color_f18202">{{item.wareMaterialCode}}</text>
                                            <text class=" width70"></text>
                                        </view>
                                        <view class=" align-end height56rpx padding5_0 fontSize32rpx color_f18202">
                                            <text class="">数量:</text>
                                            <text class="text_overflow text-bold ">{{item.quantity}}</text>
                                        </view>
                                    </view>
                                    <view class="flex justify-between align-center
                                 flex-wrap fontSize32rpx">
                                        <view class="width33 flex align-center">
                                            <view class=" text_align_center padding_left25rpx">
                                                <text class="text-gray">名称:</text>
                                                <text class="text_overflow text-bold ">{{item.wareMaterialName}}</text>
                                            </view>
                                        </view>
                                        <view class="">
                                            <!-- 数量 -->
                                            <view class=" align-end height56rpx padding5_0">
                                                <text class=" padding_left30rpx">单位:</text>
                                                <text class="text_overflow text-bold ">{{item.unit}}</text>
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </u-swipe-action>
                </scroll-view>
            </view>
            <view
                class="width flex justify-between align-center padding15 fontSize32rpx font_weight_bold fixed background_fff"
                style="bottom: 140rpx;border-bottom: 1px solid #C8C9CC;" @tap="modalshow=true">
                <view class="background_fff">
                    <view class="width">
                        下架口:
                    </view>
                </view>
                <view class=" flex">
                    <text v-if="loca" class="padding_right10rpx">{{loca}}</text>
                    <u-icon v-else name="arrow-down"></u-icon>
                </view>
            </view>
            <u-select v-model="modalshow" :list="wolist" @confirm="confirm"></u-select>
            <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.wareMaterialCode}}</text>
                    </view>
 
                    <view class="line flex justify-between">
                        <text class="text-gray">物料名称</text>
                        <text>{{materlist.wareMaterialName}}</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>
            </u-popup>
        </view>
        <button-modal :subShow='true' garmenTitle='确认下架' @submit='submit' />
 
    </view>
</template>
 
<script>
    import ButtonModal from '../../../components/buttonModal.vue'
    import ModalCode from '../../../components/ModalCode.vue'
    import {
        query,
        issue
    } from '../../../api/unpack/plan.js'
    export default {
        data() {
            return {
                renameFocus: false,
                modalshow: false,
                rescode: 0,
                resmessage: "",
                detailshow: false,
                operator: '',
                loca: '', //下架口
                focu: false,
                wolist: [{
                        value: 1,
                        label: 801
                    },
                    {
                        value: 1,
                        label: 802
                    }
                ], //下架列表
                singlist: [
                    //     {
                    //     "warematerialCode": "string",
                    //     "collectNo": "string",
                    //     "purchaseNo": "string",
                    //     "category": "string",
                    //     "wareMaterialTypeName": "string",
                    //     "specificationModel": "string",
                    //     "long": "string",
                    //     "width": "string",
                    //     "high": "string",
                    //     "weight": "string",
                    //     "barCode": "string",
                    //     "company": "string",
                    //     "uncollectedQuantity": 0,
                    //     "id": 0
                    // }
                ], //物料详情
                options: [
                    // {
                    //     text: '删除',
                    //     style: {
                    //         backgroundColor: '#ff2323'
                    //     }
                    // },
                    {
                        text: '详情',
                        style: {
                            backgroundColor: '#35db00'
                        }
                    }
                ],
                materlist: [],
                warehouse: {
                    Code: ''
                },
                warehouseRules: {
                    Code: [{
                        required: true,
                        message: '下架单号不能为空',
                        trigger: 'blur'
                    }]
                },
            };
        },
        components: {
            ButtonModal,
            ModalCode
        },
        onReady() {
            this.$refs.warehouseRef.setRules(this.warehouseRules)
        },
        mounted() {
            // this.WarehousChangePort()
            this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
        },
        methods: {
            //查询物料
            query(e) {
                this.$refs.warehouseRef.validate(valid => {
                    if (valid) {
                        setTimeout(() => {
                            this.focu = false
                            query(this.warehouse.Code).then((res) => {
                                if (res.code == 200) {
                                    this.singlist = res.data.rows[0].details
                                    // this.singlist.forEach(item => {
                                    //     item.quantity = ''
                                    //     item.wareMaterialCode = item.warematerialCode
                                    // })
                                } else {
                                    this.$refs.resmodal.show = true
                                    this.rescode = res.code
                                    this.resmessage = res.message
                                }
                            })
                        }, 200)
                    }
                })
            },
            //详情
            longpress(index, eindex) {
                // if (eindex == 0) {
                //     this.singlist.splice(index, 1)
                // } else {
                this.materlist = this.singlist[index]
                // console.log(this.materlist)
                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;
                })
            },
            //确实下架
            confirm(e) {
                this.loca = e[0].label
            },
            //确认
            submit() {
                this.$refs.warehouseRef.validate(valid => {
                    if (valid) {
                        let params = {
                            gate: this.loca,
                            orderNo: this.warehouse.Code
                        }
                        issue(params).then((res) => {
                            this.$refs.resmodal.show = true
                            this.rescode = res.code
                            this.resmessage = res.message
                            if (res.code == 200) {
                                this.singlist = []
                                this.warehouse.Code = ''
                            }
                        })
                    }
                })
            }
        },
 
    }
</script>
 
<style lang="scss">
 
</style>