detail.vue
10.1 KB
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
<template>
<view>
<view class="content">
<view class="top">
<view class="common u-f u-f-jcsb plr-10">
<view>
单据编号
</view>
<view>
{{detailInfo.code}}
</view>
</view>
<view class="common u-f u-f-jcsb plr-10">
<view>
当前状态
</view>
<view>
<text class="already" v-if="detailInfo.statusCyc >= 100">已完成</text>
<text class="not" v-else>未完成</text>
</view>
</view>
<view class="common u-f u-f-jcsb plr-10">
<view>
盘点仓库
</view>
<view>
{{warehouseCodeFormat(detailInfo.warehouseCode)}}
</view>
</view>
<view class="common u-f u-f-jcsb plr-10">
<view>
所属货主
</view>
<view>
{{companyCodeFormat(detailInfo.companyCode)}}
</view>
</view>
</view>
<view class="center">
<view class="common u-f u-f-jcsb plr-10">
<view>
货位
</view>
<view class="num">
合计货位数:{{trayTotal?trayTotal:''}}
</view>
</view>
<view class="select-content">
<view class="select-list u-f u-f-jcsb u-f-aic plr-10" v-for="(item,index) in materialArr"
:key="index" @tap="showPop(item)">
<view class="left-content">
<view class="name">
{{item.materialName}}
</view>
<view class="code">
库位号:{{item.locationCode}}
</view>
<!-- <view class="total">
库存:{{item.systemQty}},实盘:{{item.countedQty}},差异:{{item.gapQty}}
</view> -->
</view>
<view class="spec u-f u-f-aic">
<text class="model">容器号:{{item.containerCode}}</text>
<uni-icons type="arrowright" size="18" color="gray"></uni-icons>
</view>
</view>
</view>
</view>
<view class="bottom">
<view class="common u-f u-f-jcsb plr-10">
<view>
创建人
</view>
<view>
{{detailInfo.createdBy}}
</view>
</view>
<view class="common u-f u-f-jcsb plr-10">
<view>
创建时间
</view>
<view>
{{formatTime(detailInfo.created)}}
</view>
</view>
</view>
</view>
<view class="mask" @tap="maskClick" @touchmove.stop.prevent v-show="flag == true">
<view class="operate">
<view class="register" @tap="registerCycle(detailInfo.id,detailInfo.code)"
v-if="detailInfo.statusCyc >= 5&&detailInfo.statusCyc <= 15">
实盘登记
</view>
<view class="delete" @tap="delCycle(detailInfo.id,index)">
删除
</view>
</view>
<view class="cancel">
取消
</view>
</view>
<uni-popup ref="popup" type="bottom">
<view class="pop-box">
<view class="pop-title u-f u-f-jcsb u-f-aic plr-10">
<view>
查看明细
</view>
<view @tap="clearCart" class="u-f u-f-aic">
<uni-icons type="close" size="17"></uni-icons>
<text class="clear" @tap="popClose">关闭</text>
</view>
</view>
<view class="pop-content" @touchmove.stop.prevent>
<view class="content-top plr-10">
<view class="u-f u-f-jcsb">
<view class="name">
{{materialInfo.materialName}}
</view>
</view>
<view class="u-f u-f-jcsb c-s">
<view>
库位号:{{materialInfo.locationCode}}
</view>
<view>
容器号:{{materialInfo.containerCode}}
</view>
</view>
</view>
</view>
<view class="pop-footer u-f u-f-aic">
<button type="default" plain class="closeBtn" @tap="popClose">关闭</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
flag: false,
detailInfo: {},
materialInfo: {},
companyArr: [],
warehouseArr: [],
materialArr: [],
trayTotal: null,
timer: null,
timer2: null,
index: null
}
},
onNavigationBarButtonTap() {
this.flag = !this.flag
},
onBackPress() {
this.$prePage().handleRegister(this.index, this.detailInfo)
},
onLoad(option) {
this.index = option.index;
this.getCycleCountHeader(option.id);
this.getCycleCountDetail(option.code);
this.$api.dict.getCompaniesByToken().then(res => {
this.companyArr = res.data
});
this.$api.dict.getWarehouseByUserCode(uni.getStorageSync('historyUser').username).then(res => {
this.warehouseArr = res.data.data
});
},
onUnload() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
if (this.timer2) {
clearTimeout(this.timer2);
this.timer2 = null;
}
},
methods: {
// 查询盘点主单
getCycleCountHeader(id) {
this.$api.cycle.listCycleCountHeader({
id: id
}).then(res => {
if (res.data.code == 200) {
this.detailInfo = res.data.rows[0];
}
})
},
// 获取盘点单明细列表
getCycleCountDetail(code) {
this.$api.cycle.listCycleCountDetail({
cycleCountHeadCode: code
}).then(res => {
this.materialArr = res.data.rows;
this.trayTotal = res.data.rows.length;
});
},
// 货主字典翻译
companyCodeFormat(companyCode) {
return this.selectCommonLabel(this.companyArr, companyCode);
},
// 仓库字典翻译
warehouseCodeFormat(warehouseCode) {
return this.selectCommonLabel(this.warehouseArr, warehouseCode);
},
// 物料列表点击
showPop(item) {
this.materialInfo = item;
this.$refs.popup.open();
},
// 操作遮罩层点击
maskClick() {
this.flag = false
},
// 关闭按钮操作
popClose() {
this.$refs.popup.close();
},
// 实盘登记操作
registerCycle(id, code) {
uni.navigateTo({
url: 'register?code=' + code + '&id=' + id
})
},
// 删除操作
delCycle(id, index) {
uni.showModal({
title: '提示',
content: '确定要删除该盘点单吗?',
success: (res) => {
if (res.confirm) {
this.flag = false
this.$api.cycle.delCycleCountHeader(id).then(res => {
if (res.data.code == 200) {
this.$prePage().handleDel(index);
this.$wx.showToast({
title: '删除成功!'
});
this.timer = setTimeout(() => {
uni.navigateBack()
}, 400)
} else {
uni.showModal({
title: '提示',
content: res.data.msg
});
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
}
}
</script>
<style lang="scss" scoped>
.content {
overflow-y: auto;
.top,
.center,
.bottom {
background-color: $uni-bg-color;
.common {
height: 90rpx;
line-height: 90rpx;
font-size: $uni-font-size-lg;
border-bottom: 2rpx solid $uni-border-color;
.already {
color: $uni-color-success;
}
.not {
color: $uni-color-warning;
}
.num {
color: $uni-color-primary;
font-size: $uni-font-size-base;
}
}
}
.center {
margin: $uni-spacing-col-base 0;
.select-content {
.select-list {
height: 170rpx;
background-color: $uni-bg-color;
border-bottom: 2rpx solid $uni-border-color;
.left-content {
.name {
font-size: $uni-font-size-lg;
font-weight: bold;
}
.code,
.total {
margin-top: $uni-spacing-col-sm;
}
.code {
color: $uni-text-color-gray;
}
.total {
color: $uni-color-primary;
}
}
.spec {
color: $uni-text-color-gray;
.model {
margin-right: $uni-spacing-row-sm;
}
.uni-icons {
margin-right: -10rpx;
}
}
}
}
}
}
.mask {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: 999;
inset: 0;
background-color: rgba(0, 0, 0, 0.4);
transition-duration: 0.3s;
.operate {
position: absolute;
left: $uni-spacing-row-base;
right: $uni-spacing-row-base;
bottom: 130rpx;
color: $uni-color-primary;
background-color: $uni-bg-color;
font-size: $uni-font-size-lg;
.register,
.delete {
height: 90rpx;
line-height: 90rpx;
text-align: center;
border-bottom: 2rpx solid $uni-border-color;
}
.delete {
border: none;
}
}
.cancel {
position: absolute;
left: $uni-spacing-row-base;
right: $uni-spacing-row-base;
bottom: $uni-spacing-col-base;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: $uni-color-primary;
background-color: $uni-bg-color;
font-size: $uni-font-size-lg;
font-weight: bold;
}
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
height: 100rpx;
border-top: 2rpx solid $uni-border-color;
border-bottom: 2rpx solid $uni-border-color;
background-color: $uni-bg-color;
.del,
.save,
.rece {
width: 220rpx;
// width: 50%;
height: 60rpx;
line-height: 60rpx;
margin: 0 $uni-spacing-row-base;
border: 2rpx solid $uni-border-color;
border-radius: 80rpx !important;
text-align: center;
border-color: $uni-border-color;
}
.btn {
width: 50%;
}
.btn2 {
width: 100%;
}
}
.pop-box {
position: relative;
background-color: $uni-bg-color-grey;
height: 800rpx;
.pop-title {
height: 80rpx;
.clear {
margin-left: 4rpx;
}
}
.pop-content {
.content-top {
height: 130rpx;
background-color: $uni-bg-color;
border-bottom: 2rpx solid $uni-border-color;
.c-s {
margin-top: $uni-spacing-col-sm;
color: $uni-text-color-gray;
}
.name {
margin-top: $uni-spacing-col-base;
font-size: $uni-font-size-lg;
font-weight: bold;
}
}
.content-center {
margin-top: $uni-spacing-row-base;
font-size: $uni-font-size-lg;
.qty,
.unit {
height: 90rpx;
line-height: 90rpx;
background-color: $uni-bg-color;
border-bottom: 2rpx solid $uni-border-color;
}
}
}
.pop-footer {
position: absolute;
width: 100%;
bottom: 0;
height: 130rpx;
border-top: 2rpx solid $uni-border-color;
border-bottom: 2rpx solid $uni-border-color;
background-color: $uni-bg-color;
.closeBtn {
width: 100%;
margin: 0 $uni-spacing-row-base;
border-color: $uni-border-color;
border-radius: 90rpx;
}
}
}
</style>