|
...
|
...
|
@@ -6,7 +6,7 @@ |
|
6
|
6
|
<image class="opCollapse" src="/static/images/title.png" />
|
|
7
|
7
|
<text class="title">{{ title || '发货单明细' }}</text>
|
|
8
|
8
|
<view class="ops">
|
|
9
|
|
- <!-- <image v-if="mode === 'add'" class="opAdd" @click="onAdd" src="/static/images/plus.png" /> -->
|
|
|
9
|
+ <image v-if="mode === 'split'" class="opAdd" @click="onAdd" src="/static/images/plus.png" />
|
|
10
|
10
|
<view v-if="mode === 'view'" class="op1" @click="toggleViewCollapse">
|
|
11
|
11
|
<image class="opAdd" :src="collapsedView ? '/static/images/down.png' : '/static/images/up.png'" />
|
|
12
|
12
|
<text class="op">{{ collapsedView ? '展开' : '收起' }} </text>
|
|
...
|
...
|
@@ -126,13 +126,13 @@ |
|
126
|
126
|
</view>
|
|
127
|
127
|
</view>
|
|
128
|
128
|
<view class="row"><text class="label">需发数量(kg)</text><text class="value">{{ item.quantity
|
|
129
|
|
- }}</text>
|
|
|
129
|
+ }}</text>
|
|
130
|
130
|
</view>
|
|
131
|
131
|
<view class="row"><text class="label">实发数量(kg)</text><text class="value">{{ item.actualShipmentQuantity
|
|
132
|
|
- }}</text>
|
|
|
132
|
+ }}</text>
|
|
133
|
133
|
</view>
|
|
134
|
134
|
<view class="row"><text class="label">件数</text><text class="value">{{ item.num
|
|
135
|
|
- }}</text></view>
|
|
|
135
|
+ }}</text></view>
|
|
136
|
136
|
<view class="row"><text class="label">单价(元/kg)</text><text class="value">{{ item.salesPrice }}</text>
|
|
137
|
137
|
</view>
|
|
138
|
138
|
<view class="row"><text class="label">包装费(元/kg)</text><text class="value">{{
|
|
...
|
...
|
@@ -144,17 +144,17 @@ |
|
144
|
144
|
<view class="row"><text class="label">加工经销</text><text class="value">{{ item.orderType }}</text></view>
|
|
145
|
145
|
<view class="row"><text class="label">运费</text><text class="value">{{ item.contractType !==
|
|
146
|
146
|
'PROCESS_STD_AGMT' ?
|
|
147
|
|
- item.shippingCost : '' }}</text></view>
|
|
|
147
|
+ item.shippingCost : '' }}</text></view>
|
|
148
|
148
|
<view class="row"><text class="label">回程费</text><text class="value">{{ item.contractType ===
|
|
149
|
149
|
'PROCESS_STD_AGMT'
|
|
150
|
|
- ? item.shippingCost : '' }}</text></view>
|
|
|
150
|
+ ? item.shippingCost : '' }}</text></view>
|
|
151
|
151
|
<view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view>
|
|
152
|
152
|
<view class="row"><text class="label">高新</text><text class="value">-</text></view>
|
|
153
|
153
|
<view v-if="status === 'UN_SHIPMENTS' && $auth.hasPermi('shipping-plan-manage:invoice:modify')"
|
|
154
|
154
|
class="row row-opt">
|
|
155
|
155
|
<text class="row-opt_btn" @click="handleApplyDelay(item)">申请延期</text>
|
|
156
|
156
|
<text class="line"></text>
|
|
157
|
|
- <text class="row-opt_btn">拆分</text>
|
|
|
157
|
+ <text class="row-opt_btn" @click="handleSplit(item)">拆分</text>
|
|
158
|
158
|
</view>
|
|
159
|
159
|
</view>
|
|
160
|
160
|
</view>
|
|
...
|
...
|
@@ -250,13 +250,13 @@ |
|
250
|
250
|
<uni-list-item title="运费">
|
|
251
|
251
|
<template v-slot:footer>
|
|
252
|
252
|
<view class="value">{{ item.contractType !== 'PROCESS_STD_AGMT' ? item.shippingCost : ''
|
|
253
|
|
- }}</view>
|
|
|
253
|
+ }}</view>
|
|
254
|
254
|
</template>
|
|
255
|
255
|
</uni-list-item>
|
|
256
|
256
|
<uni-list-item title="回程费">
|
|
257
|
257
|
<template v-slot:footer>
|
|
258
|
258
|
<view class="value">{{ item.contractType === 'PROCESS_STD_AGMT' ? item.shippingCost : ''
|
|
259
|
|
- }}</view>
|
|
|
259
|
+ }}</view>
|
|
260
|
260
|
</template>
|
|
261
|
261
|
</uni-list-item>
|
|
262
|
262
|
<uni-list-item title="牌号">
|
|
...
|
...
|
@@ -282,6 +282,73 @@ |
|
282
|
282
|
</view>
|
|
283
|
283
|
</view>
|
|
284
|
284
|
|
|
|
285
|
+ <view v-else-if="mode === 'split'" class="section section-split" v-show="!collapsedView">
|
|
|
286
|
+ <view v-for="(item, idx) in items" :key="'v-' + idx" class="block">
|
|
|
287
|
+ <uni-list class="edit-list">
|
|
|
288
|
+ <uni-list-item title="订单编号">
|
|
|
289
|
+ <template v-slot:footer>
|
|
|
290
|
+ <view class="value">{{ item.orderNo }}</view>
|
|
|
291
|
+ </template>
|
|
|
292
|
+ </uni-list-item>
|
|
|
293
|
+ <uni-list-item title="客户名称">
|
|
|
294
|
+ <template v-slot:footer>
|
|
|
295
|
+ <view class="value">{{ item.customerName }}</view>
|
|
|
296
|
+ </template>
|
|
|
297
|
+ </uni-list-item>
|
|
|
298
|
+ <uni-list-item title="规格(mm)">
|
|
|
299
|
+ <template v-slot:footer>
|
|
|
300
|
+ <view class="value value-spec">
|
|
|
301
|
+ <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
|
|
|
302
|
+ <view v-if="item.thickness" class="value-spec_box">
|
|
|
303
|
+ <view v-if="item.thicknessTolPos" class="value-spec_box_1">{{ item.thicknessTolPos >
|
|
|
304
|
+ 0 ? '+' + item.thicknessTolPos : item.thicknessTolPos }}
|
|
|
305
|
+ </view>
|
|
|
306
|
+ <view v-if="item.thicknessTolNeg" class="value-spec_box_2">{{ item.thicknessTolNeg >
|
|
|
307
|
+ 0 ? '+' + item.thicknessTolNeg : item.thicknessTolNeg }}
|
|
|
308
|
+ </view>
|
|
|
309
|
+ </view>
|
|
|
310
|
+ <view v-if="item.width" class="value-spec_val p12">*</view>
|
|
|
311
|
+ <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
|
|
|
312
|
+ <view v-if="item.width" class="value-spec_box">
|
|
|
313
|
+ <view v-if="item.widthTolPos" class="value-spec_box_1">{{ item.widthTolPos > 0 ? '+'
|
|
|
314
|
+ + item.widthTolPos : item.widthTolPos }}
|
|
|
315
|
+ </view>
|
|
|
316
|
+ <view v-if="item.widthTolNeg" class="value-spec_box_2">{{ item.widthTolNeg > 0 ? '+'
|
|
|
317
|
+ + item.widthTolNeg : item.widthTolNeg }}
|
|
|
318
|
+ </view>
|
|
|
319
|
+ </view>
|
|
|
320
|
+ <view v-if="item.length" class="value-spec_val p12">*</view>
|
|
|
321
|
+ <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
|
|
|
322
|
+ <view v-if="item.length" class="value-spec_box">
|
|
|
323
|
+ <view v-if="item.lengthTolPos" class="value-spec_box_1">{{ item.lengthTolPos > 0 ?
|
|
|
324
|
+ '+' + item.lengthTolPos : item.lengthTolPos }}</view>
|
|
|
325
|
+ <view v-if="item.lengthTolNeg" class="value-spec_box_2">{{ item.lengthTolNeg > 0 ?
|
|
|
326
|
+ '+' + item.lengthTolNeg : item.lengthTolNeg }}</view>
|
|
|
327
|
+ </view>
|
|
|
328
|
+ </view>
|
|
|
329
|
+ </template>
|
|
|
330
|
+ </uni-list-item>
|
|
|
331
|
+
|
|
|
332
|
+ <uni-list-item title="吨位">
|
|
|
333
|
+ <template v-slot:footer>
|
|
|
334
|
+ <uni-easyinput type="digit" :value="item.quantity" placeholder="请输入吨位"
|
|
|
335
|
+ :inputBorder="false"
|
|
|
336
|
+ @input="onTwoDecimalInput($event, item, idx, 'quantity')"
|
|
|
337
|
+ @blur="onTwoDecimalBlur(item, idx, 'quantity')" />
|
|
|
338
|
+ </template>
|
|
|
339
|
+ </uni-list-item>
|
|
|
340
|
+ </uni-list>
|
|
|
341
|
+ <view class="block-ops">
|
|
|
342
|
+ <div class="del" @click="onRemove(item.itemId)">
|
|
|
343
|
+ <image src="/static/images/delete.png" class="icon" />
|
|
|
344
|
+ 删除
|
|
|
345
|
+ </div>
|
|
|
346
|
+ </view>
|
|
|
347
|
+
|
|
|
348
|
+ </view>
|
|
|
349
|
+ </view>
|
|
|
350
|
+
|
|
|
351
|
+
|
|
285
|
352
|
</view>
|
|
286
|
353
|
</template>
|
|
287
|
354
|
<script>
|
|
...
|
...
|
@@ -293,6 +360,7 @@ export default { |
|
293
|
360
|
mode: { type: String, default: 'add' },
|
|
294
|
361
|
status: { type: String, default: '' },
|
|
295
|
362
|
list: { type: Array, default: () => [] },
|
|
|
363
|
+ initItem: { type: Object, default: () => ({}) },
|
|
296
|
364
|
},
|
|
297
|
365
|
data() {
|
|
298
|
366
|
return {
|
|
...
|
...
|
@@ -332,30 +400,19 @@ export default { |
|
332
|
400
|
},
|
|
333
|
401
|
},
|
|
334
|
402
|
created() {
|
|
335
|
|
- const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }]
|
|
336
|
|
- this.items = init;
|
|
337
|
403
|
},
|
|
338
|
404
|
methods: {
|
|
339
|
405
|
defaultItem() {
|
|
340
|
406
|
return {
|
|
341
|
|
- purchaseOrderId: uuid(),
|
|
342
|
|
- collapsed: false,
|
|
343
|
|
- id: '',
|
|
344
|
|
- orderNo: '',
|
|
345
|
|
- deliveryDate: '',
|
|
346
|
|
- applyShipmentDate: '',
|
|
347
|
|
- applyCount: '',
|
|
348
|
|
- orderType: '',
|
|
349
|
|
- workshopName: '',
|
|
350
|
|
- customerName: '',
|
|
|
407
|
+ ...this.initItem,
|
|
351
|
408
|
quantity: '',
|
|
352
|
|
- delayReason: '',
|
|
|
409
|
+ itemId: uuid()
|
|
353
|
410
|
}
|
|
354
|
411
|
},
|
|
355
|
412
|
|
|
356
|
413
|
onAdd() {
|
|
|
414
|
+ console.log('this.initItem', this.initItem)
|
|
357
|
415
|
const obj = this.defaultItem()
|
|
358
|
|
- obj.collapsed = true
|
|
359
|
416
|
this.items.push(obj)
|
|
360
|
417
|
this.emitChange()
|
|
361
|
418
|
},
|
|
...
|
...
|
@@ -363,12 +420,12 @@ export default { |
|
363
|
420
|
if (!id) return
|
|
364
|
421
|
uni.showModal({
|
|
365
|
422
|
title: '系统提示',
|
|
366
|
|
- content: '是否确定删除选中的产品?',
|
|
|
423
|
+ content: '是否确定删除该发货单明细?',
|
|
367
|
424
|
confirmText: '确定',
|
|
368
|
425
|
cancelText: '取消',
|
|
369
|
426
|
success: (res) => {
|
|
370
|
427
|
if (res && res.confirm) {
|
|
371
|
|
- const i = this.items.findIndex(it => String(it.purchaseOrderId) === String(id))
|
|
|
428
|
+ const i = this.items.findIndex(it => String(it.itemId) === String(id))
|
|
372
|
429
|
if (i >= 0) {
|
|
373
|
430
|
this.items.splice(i, 1)
|
|
374
|
431
|
this.emitChange()
|
|
...
|
...
|
@@ -403,6 +460,49 @@ export default { |
|
403
|
460
|
}
|
|
404
|
461
|
if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
|
|
405
|
462
|
},
|
|
|
463
|
+ // 限制输入为2位小数
|
|
|
464
|
+ onTwoDecimalInput(val, item, idx, field) {
|
|
|
465
|
+ let v = String(val != null ? val : (item && item[field]) || '')
|
|
|
466
|
+ v = v.replace(/[^0-9.]/g, '')
|
|
|
467
|
+ v = v.replace(/(\..*)\./g, '$1')
|
|
|
468
|
+
|
|
|
469
|
+ // Restrict to 2 decimal places
|
|
|
470
|
+ const decimalIndex = v.indexOf('.')
|
|
|
471
|
+ if (decimalIndex !== -1 && v.length > decimalIndex + 3) {
|
|
|
472
|
+ v = v.substring(0, decimalIndex + 3)
|
|
|
473
|
+ }
|
|
|
474
|
+
|
|
|
475
|
+ if (v.startsWith('.')) v = '0' + v
|
|
|
476
|
+
|
|
|
477
|
+ // If the value was modified (truncated or cleaned)
|
|
|
478
|
+ if (String(val) !== v) {
|
|
|
479
|
+ // Hack: Temporarily set the dirty value to trigger Vue update mechanism
|
|
|
480
|
+ // This ensures that when we set the clean value back, Vue detects a change
|
|
|
481
|
+ item[field] = val
|
|
|
482
|
+ if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
|
|
|
483
|
+
|
|
|
484
|
+ // Then revert to the clean value asynchronously
|
|
|
485
|
+ setTimeout(() => {
|
|
|
486
|
+ item[field] = v
|
|
|
487
|
+ if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
|
|
|
488
|
+ }, 0)
|
|
|
489
|
+ } else {
|
|
|
490
|
+ item[field] = v
|
|
|
491
|
+ if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
|
|
|
492
|
+ }
|
|
|
493
|
+ },
|
|
|
494
|
+ onTwoDecimalBlur(item, idx, field) {
|
|
|
495
|
+ let v = String((item && item[field]) || '')
|
|
|
496
|
+ const num = Number(v)
|
|
|
497
|
+ if (isNaN(num) || num < 0) {
|
|
|
498
|
+ item[field] = '0'
|
|
|
499
|
+ } else {
|
|
|
500
|
+ if (v.endsWith('.')) {
|
|
|
501
|
+ item[field] = v.slice(0, -1)
|
|
|
502
|
+ }
|
|
|
503
|
+ }
|
|
|
504
|
+ if (typeof idx === 'number') this.$set(this.items, idx, { ...item })
|
|
|
505
|
+ },
|
|
406
|
506
|
onNonNegativeNumberBlur(item, idx, field) {
|
|
407
|
507
|
const v = String((item && item[field]) || '')
|
|
408
|
508
|
const num = Number(v)
|
|
...
|
...
|
@@ -456,6 +556,9 @@ export default { |
|
456
|
556
|
},
|
|
457
|
557
|
handleApplyDelay(item) {
|
|
458
|
558
|
this.$emit('applyDelay', item.id)
|
|
|
559
|
+ },
|
|
|
560
|
+ handleSplit(item) {
|
|
|
561
|
+ this.$emit('split', item)
|
|
459
|
562
|
}
|
|
460
|
563
|
}
|
|
461
|
564
|
}
|
|
...
|
...
|
@@ -806,6 +909,9 @@ export default { |
|
806
|
909
|
}
|
|
807
|
910
|
}
|
|
808
|
911
|
|
|
|
912
|
+.section-split {
|
|
|
913
|
+ background: #fff;
|
|
|
914
|
+}
|
|
809
|
915
|
|
|
810
|
916
|
.view-list {
|
|
811
|
917
|
padding: 26rpx 32rpx;
|
...
|
...
|
|