小小儁爺
2025-05-08 ebbe758df90e7049a859317c8055a7f81ca3422f
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<template>
    <view>
        <page-nav title="入厂检验"></page-nav>
 
 
 
        <view v-if="purchorderArr.length===0">
            <div class="sacnBody">
                <div class="scanImg" @click="topScanClick"></div>
                <div class="scanText">扫描物料标签</div>
            </div>
        </view>
 
        <view v-if='purchorderArr.length!==0' class="mainContent" style="">
            <view>
                <u-gap height="10" bgColor="#eff0f1"></u-gap>
                <view class="head">
                    <view class="head_block">
                        <view class="head_left">
                            <view class="head_bar"></view>
                            <view class="head_title" style="font-weight: bolder;">
                                物料信息
                            </view>
                        </view>
                    </view>
 
                    <view class="marginLeft20 marginRight20" style="height: 210rpx;">
                        <view class="marginBottom20" style="display: flex;">
                            <!--  v-for="item in purchorderArr"  -->
                            <view class="flex_column titleFont">
                                <view>单据编号:</view>
                                <view>物料编码:</view>
                                <view>物料名称:</view>
                                <view>物料规格:</view>
                            </view>
                            <view class="flex_column contentFont">
                                <view>{{purchorderObj.hbillno}}</view>
                                <view>{{purchorderObj.partcode}}</view>
                                <view>{{purchorderObj.partname}}</view>
                                <view>{{purchorderObj.partspec?purchorderObj.partspec:'/'}}</view>
                            </view>
                        </view>
                    </view>
                    <u-gap height="20" bgColor="#eff0f1"></u-gap>
 
                    <view style="max-height: 940rpx;overflow: auto;">
 
                        <view class="head" style="position: relative;">
 
                            <u-radio-group v-model="radioValue" class="flex_column">
                                <view class=" flex_column" style="width: 100%;" @click="radioValueClick(item.hbarcode)"
                                    v-for="(item,index) in purchorderDetailArr" :key="item.hbarcode">
 
 
                                    <view class="head_block" style="position: absolute;margin: 38rpx 0 0 0;">
                                        <view class="head_left">
                                            <view class="head_bar"></view>
                                            <view class="head_title" style="font-weight: bold;">
                                                标签信息
                                            </view>
                                        </view>
                                    </view>
 
 
                                    <view class="orderNumber" :key="item.hbarcode">
                                        {{(index+1).toString().padStart(2,0)}}
                                    </view>
 
                                    <view class="trash" v-show="purchorderDetailArr.length>1"
                                        @click="trashClick(index)">
                                        <u-icon name="trash" size='20'></u-icon>
                                    </view>
 
                                    <view v-show="purchorderDetailArr.length===1" style="width: 48rpx;height: 48rpx;">
                                    </view>
 
 
 
                                    <view class="flex_between marginBottom20 marginLeft20 marginTop20">
                                        <view style="display: flex;">
                                            <view class="flex_column titleFont">
                                                <view>物料标签:</view>
                                                <view>标签数量:</view>
                                                <view>供方信息:</view>
                                                <view>采购批次:</view>
                                                <view>质量状态:</view>
                                            </view>
                                            <view class="flex_column contentFont">
                                                <view>{{item.hbarcode}}</view>
                                                <view>{{item.hqty}}</view>
                                                <view class="ellipsis" style="width: 460rpx;">{{item.hcustomername}}
                                                </view>
                                                <view>{{item.hbatchno}}</view>
                                                <!-- <view>{{item.qualitystatus?item.qualitystatus:'/'}}</view> -->
                                                <view v-if="item.qualitystatus===null">/</view>
                                                <view v-else style="display: flex;align-items: center;">
                                                    <!--     <u-icon
                                                        :name="item.qualitystatus==='OK'?'checkmark-circle-fill':'close-circle-fill'"
                                                        :color="item.qualitystatus==='OK'?'#55ff00':'#FF0000'"
                                                        size="40"></u-icon>
                                                    <view style="margin-left: 10rpx;">
                                                        {{item.qualitystatus==='OK'?'合格':'不合格'}}
                                                    </view> -->
 
                                                    <u-icon name="more-circle-fill" color="#55aaff" size="20"></u-icon>
                                                    <view style="margin-left: 10rpx;">
                                                        待检
                                                    </view>
 
                                                </view>
                                            </view>
                                        </view>
                                        <u-radio size='20' class="marginRight20" :key="item.hbarcode"
                                            :name="item.hbarcode" activeColor="red"></u-radio>
                                    </view>
 
                                    <u-gap height="10" v-if="index!==purchorderDetailArr.length-1"
                                        bgColor="#eff0f1"></u-gap>
 
                                </view>
                            </u-radio-group>
                        </view>
 
                    </view>
 
                </view>
            </view>
        </view>
 
        <view v-if='purchorderArr.length!==0' class="footer">
            <view class="head_block" style="align-items: center;padding: 0 23rpx;">
                <view class="head_left">
                    <view class="head_bar"></view>
                    <view class="head_title" style="font-weight: bold;">
                        选择质检方案
                    </view>
                </view>
 
                <view class="flex_center" style="margin-right: 20rpx;">
                    <view @click='sheetClick' class="custominputClass">
 
                        <view v-show='sheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
                        <view v-show='sheetValue!==""' class="ellipsis" style="width: 390rpx;">
                            {{sheetValue}}
                        </view>
 
                        <u-icon :name="!sheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
                    </view>
                </view>
 
            </view>
        </view>
 
        <u-picker :show="sheetShow" :columns="columns" :itemHeight='55' :closeOnClickOverlay='true'
            @close='sheetShow=false' @confirm='pickerConfirm' @cancel='sheetShow=false'></u-picker>
 
 
        <u-button :disabled="!sheetValue" v-if='purchorderArr.length!==0' type="primary" size='large' :hairline="true"
            @click="navigateTo" text="下一步"></u-button>
 
        <!--         <scan-code></scan-code> -->
 
        <!-- 悬浮球 -->
        <view v-show="purchorderArr.length!==0&&!sheetShow" @click="topScanClick">
            <drag-ball :x='$DeviceInformation.screenWidth*0.8' :y="$DeviceInformation.screenHeight*0.7"></drag-ball>
        </view>
 
 
 
        <!-- <navigator :url="'./rcjy2?item='+ encodeURIComponent(JSON.stringify(item))"> -->
        <!--     <navigator :url="'./rcjy2?item='+encodeURIComponent(1)">
        </navigator>
 -->
    </view>
</template>
 
 
<script>
    import {
        InFactoryCheckScanLabCode,
        QualityScheme
    } from '../../config/api.js';
    // import scanCode from '@/components/scan-code/scan-code.vue'
    const App = getApp()
    export default {
        // components: {
        //     scanCode
        // },
        onLoad(option) {
 
            // if (option.length !== undefined) {
            //     let t1 = JSON.parse(uni.getStorageSync('purchorderArr'))
            //     let t2 = JSON.parse(uni.getStorageSync('purchorderDetailArr'))
            //     // 是否同步批次
            //     if (option.issyncbatch === 'true') { //是
            //         console.log('执行1')
            //         this.purchorderArr = t1.filter(i => {
            //             return !(i.hbillno === option.hbillno && i.partcode === option.partcode && i.hbatchno ===
            //                 option.hbatchno)
            //         })
            //         this.purchorderDetailArr = t2.filter(i => {
            //             console.log(!(i.hbillno === option.hbillno && i.partcode === option.partcode && i
            //                 .hbatchno ===
            //                 option.hbatchno))
            //             return !(i.hbillno === option.hbillno && i.partcode === option.partcode && i.hbatchno ===
            //                 option.hbatchno)
            //         })
 
            //     } else if (option.issyncbatch === 'false') { //否
            //         console.log('执行2')
            //         this.purchorderDetailArr = t2.filter(i => i.hbarcode !== option.labcode)
            //         this.purchorderArr = t1.filter(i => i.hbarcode !== option.labcode)
            //     }
            //     console.log('执行3')
            //     this.radioValue = this.purchorderDetailArr[0].hbarcode
            //     const t = this.purchorderDetailArr.find(i => i.hbarcode === this.radioValue).hbillno
            //     this.purchorderObj = this.purchorderArr.find(i => i.hbillno === t)
            //     this.$forceUpdate()
            // }
 
 
 
        },
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
 
 
                // "hbillno": "DH2303311361", //单据编号
                // "partcode": "102", //产品编码
                // "partname": "内存", //产品名称
                // "partspec": "", //产品规格
                // "hbarcode": "DH2303311360", //物料标签
                // "stocktype_code": "1", //存货类型编码
                // "hqty": 300.00, //标签数量
                // "hcustomercode": "0010002", //供应商编码
                // "hcustomername": "蒂森克虏伯发动机系统(常州)有限公司", //供应商名称
                // "hbatchno": "2", //采购批次
                // "qualitystatus": null //质量状态
 
                purchorderObj: {},
                purchorderArr: [
                    // {
                    //     hbillno: 'DH2304041465',
                    //     partcode: 'ZG-Y-001',
                    //     partname: 'ZG原材料001',
                    //     partspec: '#001'
                    // },
                    // {
                    //     hbillno: 'DH2304041463',
                    //     partcode: 'ZG-Y-002',
                    //     partname: 'ZG原材料002',
                    //     partspec: '#002'
                    // }
                ],
                purchorderDetailArr: [
                    // {
                    //     hbillno: 'DH2304041465',
                    //     hbarcode: 'DH2304041464',
                    //     hqty: 100,
                    //     hcustomername: 'ZG外购供应商',
                    //     hbatchno: '#101',
                    //     qualitystatus: 'NG'
                    // },
                    // {
                    //     hbillno: 'DH2304041463',
                    //     hbarcode: 'DH2304041462',
                    //     hqty: 400,
                    //     hcustomername: 'ZG外购供应商',
                    //     hbatchno: '#101',
                    //     qualitystatus: 'OK'
                    // },
                    // {
                    //     hbillno: 'DH2304041463',
                    //     hbarcode: 'DH2304041461',
                    //     hqty: 300,
                    //     hcustomername: 'ZG外购供应商',
                    //     hbatchno: '#101',
                    //     qualitystatus: 'NG'
                    // }, {
                    //     hbillno: 'DH2304041463',
                    //     hbarcode: 'DH2304041460',
                    //     hqty: 200,
                    //     hcustomername: 'ZG外购供应商',
                    //     hbatchno: '#101',
                    //     qualitystatus: 'OK'
                    // },
                ],
                radioValue: '',
 
                sheetShow: false, //上拉列表是否展开
                sheetValue: '',
                sheetList: [],
                columns: []
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
            this.getQualityScheme()
 
 
            // this.getInFactoryCheckScanLabCode('DH2304041467')
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
            //来自于页面3的值  进行数据处理
            fromSubmitData(option) {
 
                let t1 = JSON.parse(uni.getStorageSync('purchorderArr'))
                let t2 = JSON.parse(uni.getStorageSync('purchorderDetailArr'))
                // 是否同步批次
                if (option.issyncbatch === 'Y') { //是
                    console.log('执行1')
                    this.purchorderArr = t1.filter(i => {
                        return !(i.hbillno === option.hbillno && i.partcode === option.partcode && i.hbatchno ===
                            option.hbatchno)
                    })
                    this.purchorderDetailArr = t2.filter(i => {
                        return !(i.hbillno === option.hbillno && i.partcode === option.partcode && i.hbatchno ===
                            option.hbatchno)
                    })
 
                } else if (option.issyncbatch === 'N') { //否
                    console.log('执行2')
                    this.purchorderDetailArr = t2.filter(i => i.hbarcode !== option.labcode)
                    this.purchorderArr = t1.filter(i => i.hbarcode !== option.labcode)
                }
                console.log('执行3')
                if (this.purchorderDetailArr.length > 0) {
                    this.radioValue = this.purchorderDetailArr[0].hbarcode
                    const t = this.purchorderDetailArr.find(i => i.hbarcode === this.radioValue).hbillno
                    this.purchorderObj = this.purchorderArr.find(i => i.hbillno === t)
                }
 
                this.$forceUpdate()
 
            },
            // 扫描
            topScanClick() {
                let that = this;
 
                uni.scanCode({
                    onlyFromCamera: true,
                    // scanType: ['barCode', 'qrCode'],
                    scanType: ['qrCode'],
                    success: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                        that.scanContent = res.result;
                        let flag = false
                        that.purchorderDetailArr.forEach(item => {
                            if (item.hbarcode === res.result) {
                                flag = true
                            }
                        })
                        if (flag) {
                            that.$u.toast('此条码已扫描,已在列表中!')
                        } else {
                            //处理扫码事件
                            that.getInFactoryCheckScanLabCode(that.scanContent);
                        }
                    },
                    complete: function(res) {
 
                    },
                    fail: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                    }
 
                });
            },
            // 获取标签信息
            async getInFactoryCheckScanLabCode(labcode) {
                const data = {
                    labcode
                }
                const res = await InFactoryCheckScanLabCode(this.global.formatData(data))
 
                if (res.code === '200') {
                    console.log(res)
                    this.purchorderArr.unshift({
                        hbillno: res.data.labcont[0].hbillno,
                        partcode: res.data.labcont[0].partcode,
                        partname: res.data.labcont[0].partname,
                        partspec: res.data.labcont[0].partspec,
                        hbarcode: res.data.labcont[0].hbarcode,
                        hbatchno: res.data.labcont[0].hbatchno ? res.data.labcont[0].hbatchno : '/',
                    })
 
                    this.purchorderDetailArr.unshift({
                        hbillno: res.data.labcont[0].hbillno,
                        partcode: res.data.labcont[0].partcode,
                        hbarcode: res.data.labcont[0].hbarcode,
                        hqty: res.data.labcont[0].hqty,
                        hcustomername: res.data.labcont[0].hcustomername,
                        hcustomercode: res.data.labcont[0].hcustomercode,
                        hbatchno: res.data.labcont[0].hbatchno ? res.data.labcont[0].hbatchno : '/',
                        qualitystatus: res.data.labcont[0].qualitystatus,
                    })
 
                    this.purchorderObj = this.purchorderArr[0]
 
                    this.radioValue = res.data.labcont[0].hbarcode
 
                }
            },
            // 获取检验方案
            async getQualityScheme() {
                const res = await QualityScheme()
                this.sheetList = res.data
                this.columns = [res.data.map(r => r.name)]
            },
 
 
            // picker确认按钮
            pickerConfirm(val) {
                this.sheetValue = val.value[0]
                this.sheetShow = false
            },
            // 选择质检方案
            sheetClick(val) {
                this.sheetShow = true
            },
            // 页面跳转
            navigateTo() {
 
 
                uni.setStorageSync('purchorderArr', JSON.stringify(this.purchorderArr))
                uni.setStorageSync('purchorderDetailArr', JSON.stringify(this.purchorderDetailArr))
 
                // uni.navigateTo({
                //  url:'./rcjy2?purchorderObj=' + JSON.stringify(this.purchorderObj)+
                // })
 
 
 
                uni.navigateTo({
                    url: './rcjy2?checkstandcode=' + this.sheetList.find(i => i.name === this.sheetValue).code +
                        '&checkstandname=' + this.sheetValue + '&sampmethod=' + this.sheetList.find(i => i.name ===
                            this.sheetValue).sampmethod + '&sampscare=' + this.sheetList.find(i => i.name === this
                            .sheetValue).sampscare + '&purchorderObj=' + JSON.stringify(this
                            .purchorderObj) + '&radioSelectValue=' + JSON.stringify(this.purchorderDetailArr.find(
                            i => i.hbarcode === this.radioValue))
 
 
                });
            },
            // 单选按钮点击事件
            radioValueClick(val) {
                this.radioValue = val
                const t = this.purchorderDetailArr.find(i => i.hbarcode === val).hbillno
                this.purchorderObj = this.purchorderArr.find(i => i.hbillno === t)
            },
            // 删除事件点击
            trashClick(val) {
                this.purchorderDetailArr.splice(val, 1)
            },
 
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
 
 
 
    .orderNumber {
        width: 60rpx;
        height: 40rpx;
        // margin: -22rpx 0 0 -30rpx;
        background-color: #d3daf9;
        color: #2979FF;
        font-size: 26rpx;
        padding: 4rpx 0 0 10rpx;
        border-radius: 0 0 90% 0;
    }
 
    .trash {
        width: 48rpx;
        height: 48rpx;
        margin: -26rpx 0 0 646rpx;
        background-color: #d3daf9;
        font-size: 26rpx;
        padding: 6rpx 0 0 10rpx;
        border-radius: 100%;
    }
 
    .custominputClass {
        width: 424rpx;
        display: flex;
        justify-content: space-between;
        border: 3rpx #eff0f1 solid;
        border-radius: 10rpx;
        padding: 0 10rpx;
    }
</style>