assignShipment.vue
28.6 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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
<template>
<div>
<glsx-dialog :show="show" width="80%" title="分配发货" usefooter @closed="cancel">
<el-form ref="assignShipmentFrom" :model="form" :rules="formRules" label-width="110px">
<el-form-item label="是否扫码">
<el-radio v-model="form.deviceScanType" label="Y" :disabled="disabled_need">需扫码</el-radio>
<el-radio v-model="form.deviceScanType" label="N" :disabled="disabled_notNeed">不需扫码</el-radio>
</el-form-item>
<div class="line_box" v-if="info.deviceScanType == 'Y'">
<div class="left">
<el-form-item label="设备类型" prop="deviceTypeId">
<el-select v-model="form.deviceTypeId" placeholder="请选择" class="el_select" @change="getDevice(form.deviceTypeId)">
<!-- <el-option value="" label="全部">全部</el-option> -->
<el-option v-for="item in deviceTypeList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
</div>
<div class="right">
<el-form-item label="硬件设备" prop="deviceId">
<el-select v-model="form.deviceId" placeholder="请选择" class="el_select" filterable @change="changeDevice(form.deviceId)">
<el-option v-for="item in deviceList" :key="item.deviceCode" :value="item.deviceCode" :label="item.deviceCode + '/' + item.deviceName" />
</el-select>
</el-form-item>
</div>
</div>
<div class="line_box" v-if="info.deviceScanType == 'Y'">
<div v-if="isNet" class="left">
<el-form-item label="套餐" prop="packageOne" v-if="packageOneShow">
<el-select v-model="form.packageOne" placeholder="请选择" class="el_select">
<el-option v-for="item in packageList" :key="item.packageCode" :value="item.packageCode" :label="item.packageName" />
</el-select>
</el-form-item>
</div>
<div class="right">
<el-form-item label="审核数量" prop="totalCheck">
<el-input v-model="form.totalCheck" disabled />
<!-- <el-input-number size="small" v-model="form.totalCheck" :max="maxNumber" :controls="false" /> -->
</el-form-item>
</div>
</div>
<div v-if="info.deviceScanType == 'N'">
<el-form-item label="物料编码">
<el-input v-model="form.materialCode" disabled />
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="form.materialName" disabled />
</el-form-item>
<el-form-item label="物料类型">
<el-input v-model="form.deviceTypeName" disabled />
</el-form-item>
<el-form-item label="审核数量">
<el-input v-model="form.totalCheck" disabled />
</el-form-item>
<el-form-item label="发往商户">
<el-input v-model="form.merchantInfo" disabled />
</el-form-item>
<el-form-item label="联系人">
<el-input v-model="form.contacts" disabled />
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="form.mobile" disabled />
</el-form-item>
<el-form-item label="发货地址">
<el-input v-model="form.address" disabled />
</el-form-item>
<el-form-item label="审核备注">
<el-input v-model="form.checkRemark" disabled />
</el-form-item>
</div>
<hr style="background-color: blue;border: none;height: 2px;opacity: .1;" /><br />
<div v-if="info.deviceScanType == 'Y'">
<h3 class="h2">设备配置:</h3>
<el-form-item label="物料编码" required>
<el-input v-model="attribCode" class="sort_input" clearable />
<el-button type="primary" @click="searchAttribCode">搜索</el-button>
<span class="warningFont" v-if="noCode">未找到商务审核的料号,请前往“设备配置管理”中创建</span>
</el-form-item>
<div class="table_box">
<el-table v-loading="tableLoading" :data="list" stripe style="width: 100%" :max-height="TB_height" border>
<el-table-column width="50" fixed="left" align="center">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row.attribCode" @change="changgeAttr(scope.row)"> </el-radio>
</template>
</el-table-column>
<el-table-column prop="attribCode" label="物料编码" width="150" />
<el-table-column prop="devTypeName" label="设备类型" :width="tdWidth" />
<el-table-column prop="devMnumName" label="设备型号" style="width: 100%" :formatter="formatter" />
<el-table-column prop="orNetName" label="是否联网" :width="tdWidth" :formatter="formatter" />
<el-table-column prop="cardSelfName" label="卡类型" :width="tdWidth" :formatter="formatter" />
<el-table-column prop="orOpenName" label="专用/通用" width="90" :formatter="formatter" />
<el-table-column prop="screenName" label="是否带屏" :width="tdWidth" :formatter="formatter" />
<el-table-column prop="sourceName" label="有源/无源" width="90" :formatter="formatter" />
<el-table-column prop="modelName" label="机型" :width="tdWidth" :formatter="formatter" />
<el-table-column prop="typeName" label="裸机/整机" width="90" :formatter="formatter" />
<!-- <el-table-column prop="configureName" label="配置" :width="tdWidth" />
<el-table-column prop="msizeName" label="尺寸" :width="tdWidth" />
<el-table-column prop="boardVersion" label="主板版本号" :width="tdWidth" />
<el-table-column prop="softVersion" label="软件版本号" :width="tdWidth" />
<el-table-column prop="fastenerVersion" label="固件版本号" :width="tdWidth" />
<el-table-column prop="mcuVersion" label="芯片版本号" :width="tdWidth" /> -->
</el-table>
<span style="color:#f00;" v-if="showMaterialCodeError">未选择设备配置</span>
</div>
</div>
<br />
<!-- <div v-if="showCarInfo"> -->
<h3>车辆信息:</h3>
<div class="table_box">
<el-table v-loading="tableLoading" :data="carList" stripe style="width: 100%" border>
<el-table-column prop="bsParentBrandName" label="品牌" width="100" />
<el-table-column prop="bsSubBrandName" label="子品牌" :width="car_tdWidth" />
<el-table-column prop="bsAudiName" label="车系" :width="car_tdWidth" />
<el-table-column prop="bsMotorcycle" label="车型" width="200" />
<el-table-column prop="bsMotorHmdName" label="高中低配" width="80" />
<el-table-column prop="bsRemark" label="车价/颜色/备注" width="120" />
<el-table-column prop="bsCheckMaterialName" label="审核物料" width="170">
<template slot-scope="{row}">{{row.bsCheckMaterialCode +'/'+ row.bsCheckMaterialName}}</template>
</el-table-column>
<el-table-column prop="bsCheckQuantity" label="审核数量" width="100" />
<el-table-column prop="bsCheckMaterialName" label="分配实发物料" width="170" v-if="info.deviceScanType == 'Y'">
<template slot-scope="{row}">
<el-select v-model="row.sendMaterialCode" filterable>
<el-option v-for="(k,idx) in list" :key="idx" :value="k.attribCode" :label="k.attribCode +'/'+ k.attribName"></el-option>
</el-select>
<div class="warningFont">{{judageMater(row.sendMaterialCode)}}</div>
</template>
</el-table-column>
<el-table-column prop="fastenConfigDesc" label="固定配置" width="200">
<template slot-scope="scope">
<span class="text-wrapper">{{scope.row.fastenConfigDesc}}</span>
</template>
</el-table-column>
<el-table-column prop="optionConfigDesc" label="选项配置" width="200">
<template slot-scope="scope">
<span class="text-wrapper">{{scope.row.optionConfigDesc}}</span>
</template>
</el-table-column>
</el-table>
</div>
<!-- </div> -->
<!-- 附件信息 开始 -->
<h3>附件信息:</h3>
<div class="form_row">
<div class="cell">
<div class="name">上传附件</div>
<div class="txt_content">
<div class="" v-for="(item,idx) in fileList" :key="idx">
<a :href="item.puUrl" target="_blank">{{item.puOriFileName}}</a>
</div>
</div>
</div>
<div class="cell">
<div class="name">发货单</div>
<div class="txt_content">
<a :href="info.urlDispatchBills" target="_blank" v-if="info.urlDispatchBills">{{info.urlDispatchBillsName}}</a>
</div>
</div>
</div>
<!-- 附件信息 end -->
<div class="line_box" v-if="info.deviceScanType == 'Y'">
<div class="left">
<el-form-item label="发往商户" prop="sendMerchantNo">
<!-- <el-select v-model="form.sendMerchantNo" class="el_select"
filterable
remote
:remote-method="getMerchant"
default-first-option
:key="key"
placeholder="请输入关键词" @change="changeMerchant(form.sendMerchantNo)">
<el-option
v-for="item in merchantList"
:key="item.merchantId"
:label="item.merchantId + '/' + item.merchantName"
:value="item.merchantId">
</el-option>
</el-select> -->
<el-input v-model="form.merchantInfo" disabled />
</el-form-item>
</div>
<div class="right">
<el-form-item label="选择仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" placeholder="请选择" class="el_select">
<el-option v-for="item in warehouse" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
</div>
</div>
<div class="line_box" v-if="info.deviceScanType == 'Y'">
<div class="left">
<el-form-item label="联系人" prop="contacts">
<el-input v-model="form.contacts" maxlength="10" disabled />
</el-form-item>
</div>
<div class="right">
<el-form-item label="联系电话" prop="mobile">
<el-input v-model="form.mobile" maxlength="13" disabled />
</el-form-item>
</div>
</div>
<el-form-item label="发货地址" prop="address" v-if="info.deviceScanType == 'Y'">
<el-input v-model="form.address" type="textarea" disabled />
</el-form-item>
<el-form-item label="备注" v-if="info.deviceScanType == 'Y'">
<el-input v-model="form.remark" type="textarea" disabled />
</el-form-item>
<div class="line_box" v-if="info.deviceScanType == 'N'">
<div class="left">
<el-form-item label="发货仓库" prop="warehouseId2">
<el-select v-model="form.warehouseId2" placeholder="请选择" class="el_select">
<el-option v-for="item in warehouse" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
</div>
<div class="right">
</div>
</div>
</el-form>
<div slot="footer">
<el-button type="primary" @click="saveInfo">确认</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</glsx-dialog>
</div>
</template>
<script>
import GlsxDialog from '@/components/dialog/index'
import util from '@/libs/util'
import {
LISTDEVICETYPE,
LISTDEVICECODE,
LISTATTRIBMANA,
GETWAREHOUSEINFO,
FINDSENDMERCHANTNO,
LISTPACKAGE,
INSERTORDERS,
FINDMERCHANTINFOBYMERCHANTID,
GETORDERINFO,
DISPATCHSPORDERSCANY,
DISPATCHSPORDERSCANN,
LISTSPORDERVEHICLE,
} from '@/http/interface'
import {LISTBSPICTUREURLBYBSMERCHANTORDER} from '@/http/order'
import { Util } from '@/common/util'
export default {
name: 'AssignShipment',
props: {
info: {
type: Object,
default: function () {
return {}
},
},
show: {
type: Boolean,
default: false,
},
},
components: {
'glsx-dialog': GlsxDialog,
},
// watch: {
// info(val) {
// if(val){
// console.log('111')
// console.log(val)
// // this.form = val
// this.form.deviceTypeId = val.deviceTypeId
// this.attribCode = val.materialCode
// this.radio = val.materialCode
// this.scanCode = val.deviceScanType
// if(this.scanCode == 'Y'){
// this.disabled_notNeed = true
// }else if(this.scanCode == 'N'){
// this.disabled_need = true
// }
// }else{
// }
// }
// },
data() {
function checkPhone(rule, value, callback) {
if (!Util.checkPhone(value) && !Util.validationTel(value)) {
callback(new Error('请输入正确的联系电话'))
return false
}
callback()
}
return {
key: new Date(),
disabled_need: false,
disabled_notNeed: false,
form: {
bsAddressDto: {},
},
deviceTypeList: [],
deviceList: [],
list: [],
carList: [],
TB_height: 300,
tdWidth: 80,
car_tdWidth: 150,
radio: '',
// CUTSTR: (str, num) => {
// return this.$Util.cutStr(str, num)
// },
warehouse: [],
loading: false,
merchantList: [],
packageList: [],
isNet: true,
attribCode: '',
noCode: false,
showMaterialCodeError: false,
showCarInfo: false,
tableLoading: false,
packageOneShow: false,
formRules: {
deviceTypeId: [
{
required: true,
message: '请选择设备类型',
trigger: 'change',
},
],
deviceId: [
{
required: true,
message: '请选择硬件设备',
trigger: 'change',
},
],
totalCheck: [
{
required: true,
message: '请输入审核数量',
trigger: 'blur',
},
// {
// min: 0,
// message: '数量不能为0',
// trigger: 'blur'
// }
],
packageOne: [
{
required: true,
message: '请选择套餐',
trigger: 'change',
},
],
sendMerchantNo: [
{
required: true,
message: '请选择发往商户',
trigger: 'change',
},
],
warehouseId: [
{
required: true,
message: '请选择仓库',
trigger: 'change',
},
],
warehouseId2: [
{
required: true,
message: '请选择仓库',
trigger: 'blur',
},
],
contacts: [
{
required: true,
message: '请输入联系人',
trigger: 'blur',
},
],
mobile: [
{
required: true,
message: '请输入联系电话',
trigger: 'blur',
},
{
validator: checkPhone,
trigger: 'blur',
},
],
address: [
{
required: true,
message: '请输入发货地址',
trigger: 'blur',
},
],
},
fileList:[],
materialFlag: false
}
},
created() {},
mounted: function () {
// this.maxNumber = this.info.totalCheck;
if (this.info.bsAddressDto) {
this.info.contacts = this.info.bsAddressDto.name
this.info.mobile = this.info.bsAddressDto.mobile
this.info.address =
(this.info.bsAddressDto.provinceName
? this.info.bsAddressDto.provinceName + '省'
: '') +
(this.info.bsAddressDto.cityName
? this.info.bsAddressDto.cityName + '市'
: '') +
(this.info.bsAddressDto.areaName
? this.info.bsAddressDto.areaName
: '') +
(this.info.bsAddressDto.address ? this.info.bsAddressDto.address : '')
} else {
this.info.contacts = ''
this.info.mobile = ''
this.info.address = ''
}
this.info.remark = this.info.checkRemark
// this.form = JSON.parse(JSON.stringify(this.info));
this.form = util.deepClone(this.info)
this.form.merchantInfo =
this.form.whMerchantCode + ' / ' + this.form.whMerchantName
this.radio = this.form.materialCode
console.log(this.form)
if (this.info.deviceScanType == 'Y') {
this.disabled_notNeed = true
this.merchantList = [
{
merchantId: this.form.whMerchantCode,
merchantName: this.form.whMerchantName,
},
]
this.form.sendMerchantNo = this.form.whMerchantCode
this.form.sendMerchantName = this.form.whMerchantName
} else if (this.info.deviceScanType == 'N') {
this.disabled_need = true
}
this.init()
this.getFiles()
},
methods: {
/**
* 初始化函数
*/
init: function () {
this.getDeviceList()
this.getDevice()
this.getWarehouseList()
this.getCarInfo()
},
formatter: function (row, column, cellValue) {
if (cellValue) {
if (cellValue == '未知' || cellValue == "'未知'") {
return '--'
} else {
return cellValue
}
} else {
return ''
}
},
// replaceStr: function(row, column, cellValue){
// if(cellValue){
// return cellValue.replace(/\\n/gm,"<br/>")
// }else{
// return ''
// }
// },
/**
* 获取设备类型列表
*/
getDeviceList: function () {
let _this = this
LISTDEVICETYPE().then((res) => {
const { data } = res
_this.deviceTypeList = data || []
})
},
/**
* 获取硬件设备
*/
getDevice: function (e) {
const _this = this
const oParams = {}
oParams.typeId = e || _this.form.deviceTypeId
if (e) {
delete _this.form.deviceId
delete _this.form.packageOne
}
LISTDEVICECODE(oParams).then((res) => {
console.log(res)
const { data } = res
_this.deviceList = data || []
})
this.searchAttribCode()
},
/**
* 获取设备配置列表
*/
searchAttribCode: function (param) {
const _this = this
let oParams = {}
oParams.attribCode = this.attribCode
oParams.deviceTypeId = this.form.deviceTypeId
_this.tableLoading = true
LISTATTRIBMANA(oParams).then((res) => {
let list = res.data
if (list.length > 0) {
this.TB_height = 300
let _info = {}
for (var key in list) {
if (list[key].attribCode == this.form.materialCode) {
this.noCode = false
_info = list[key]
if (
_info.orNetName == '不联网' ||
_info.orNetName == '未知' ||
_info.orNetName == "'未知'"
) {
//不联网或无联网信息,不显示套餐选项
this.packageOneShow = false
} else {
//有联网信息,显示套餐选项
this.packageOneShow = true
}
list.splice(key, 1) //先将需要排到第一位的对象删除
break
} else {
this.noCode = true
}
}
if (!this.noCode) {
list.unshift(_info) //再将对象添加到第一位显示
}
} else {
this.TB_height = 90
}
_this.tableLoading = false
_this.list = list || []
})
},
/**
* 获取仓库列表
*/
getWarehouseList: function (e) {
const _this = this
const oParams = {}
GETWAREHOUSEINFO(oParams).then((res) => {
const { list } = res.data
_this.warehouse = list || []
})
},
/**
* 获取发往商户
*/
getMerchant: function (query) {
const _this = this
let Regex = new RegExp('[\\u4E00-\\u9FFF]+', 'g')
let obj = {}
if (query) {
if (Regex.test(query)) {
obj = { sendMerchantName: query }
} else {
obj = { sendMerchantNo: query }
}
}
FINDSENDMERCHANTNO(obj).then((res) => {
const { data } = res
_this.merchantList = data || []
})
},
/**
* 切换商户
*/
changeMerchant: function (e) {
console.log(e)
let list = this.merchantList
let o = list.find((k) => k.merchantId == e)
this.form.sendMerchantName = o.merchantName
this.key = new Date()
},
/**
* 获取套餐列表
*/
getPackage: function (e) {
console.log(e)
const _this = this
const oParams = {}
oParams.deviceCode = e
LISTPACKAGE(oParams).then((res) => {
console.log(res)
const { data } = res
_this.packageList = data || []
})
},
/**
* 切换设备
*/
changeDevice: function (e) {
let list = this.deviceList
let o = list.find((k) => k.deviceCode == e)
this.form.deviceName = o.deviceName
this.getPackage(e)
},
/**
* 获取子订单车辆审核列表
*/
getCarInfo: function () {
const _this = this
const oParams = {}
let orderList = []
orderList.push(this.form.merchantOrder)
oParams.listMerchantOrder = orderList
LISTSPORDERVEHICLE(oParams).then((res) => {
console.log(res)
const { data } = res
data.map((k) => {
// k.sendMaterialCode = _this.radio
k.sendMaterialCode = k.bsCheckMaterialCode
})
_this.carList = data || []
// if (_this.carList.length > 0) {
// for (var key in _this.carList) {
// if (_this.carList[key].bsParentBrandId) {
// this.showCarInfo = true
// break
// }
// }
// } else {
// this.showCarInfo = false
// }
})
},
/**
* 物料单选按钮事件
*/
changgeAttr: function (row) {
console.log(row)
if (
row.orNetName == '不联网' ||
row.orNetName == '未知' ||
row.orNetName == "'未知'"
) {
this.packageOneShow = false
} else {
this.packageOneShow = true
}
let _list = this.carList || []
_list.map((k) => {
k.sendMaterialCode = row.attribCode
k.sendMaterialName = row.attribName
})
},
/**
* 保存数据
*/
saveInfo: function () {
const _this = this
_this.$refs.assignShipmentFrom.validate((valid) => {
if (!valid) {
return false
}
if(this.form.deviceScanType == 'Y' && !this.materialFlag){
this.$message({
message: '请选择物料选项里存在的物料!',
type: 'error',
duration: 2000,
center: true,
})
return false
}
let checkRadio = _this.list.find((k) => {
return k.attribCode == _this.radio
})
if (_this.form.deviceScanType == 'Y' && !checkRadio) {
if(!_this.carList || _this.carList.length == 0){//无车型情况下必选
//未选择物料
_this.showMaterialCodeError = true
return false
}
} else {
_this.showMaterialCodeError = false
}
let oParams = {}
oParams.address = _this.form.address
oParams.batchOption = 'N' //是否批量操作(Y:批量操作 N:非批量操作)
oParams.contacts = _this.form.contacts
oParams.mobile = _this.form.mobile
oParams.remark = _this.form.remark
if (this.info.deviceScanType == 'Y') {
//子订单扫码模式分配发货
/**扫码时物料编号和名称以选中的为主 */
oParams.materialCode = checkRadio.attribCode
oParams.materialName = checkRadio.attribName
oParams.deviceId = _this.form.deviceId
oParams.deviceName = _this.form.deviceName
oParams.packageOne = _this.form.packageOne
oParams.sendMerchantNo = _this.form.whMerchantCode
oParams.sendMerchantName = _this.form.whMerchantName
let listOrderWarehouseVo = []
let warehouseVo = {
merchantOrder: this.info.merchantOrder,
warehouseId: this.form.warehouseId,
}
listOrderWarehouseVo.push(warehouseVo)
oParams.listOrderWarehouseVo = listOrderWarehouseVo
// 有车型
let _list = _this.carList || []
if (_list && _list.length > 0) {
let arr = []
_list.map((k) => {
let o = {}
let m = _this.list.find((j) => j.attribCode == k.sendMaterialCode)
o.id = k.id
o.sendMaterialName = m ? m.attribName : ''
o.sendMaterialCode = k.sendMaterialCode
arr.push(o)
})
oParams.listVehicleVo = arr
}
console.log(oParams)
DISPATCHSPORDERSCANY(oParams).then((res) => {
if (res.returnCode == 0) {
this.$message({
type: 'success',
message: '操作成功!',
})
_this.$emit('closed', true)
}
})
} else if (this.info.deviceScanType == 'N') {
//子订单不扫码模式分配发货
/**不扫码时物料编号和名称不变 */
oParams.materialCode = _this.form.materialCode
oParams.materialName = _this.form.materialName
oParams.sendMerchantName = _this.form.whMerchantName
oParams.sendMerchantNo = _this.form.whMerchantCode
let listOrderWarehouseVo = []
let warehouseVo = {
merchantOrder: this.info.merchantOrder,
warehouseId: this.form.warehouseId2,
}
listOrderWarehouseVo.push(warehouseVo)
oParams.listOrderWarehouseVo = listOrderWarehouseVo
console.log(oParams)
DISPATCHSPORDERSCANN(oParams).then((res) => {
if (res.returnCode == 0) {
this.$message({
type: 'success',
message: '操作成功!',
})
_this.$emit('closed', true)
}
})
}
})
},
/**
* 关闭弹框
*/
cancel: function () {
this.$emit('closed')
},
// 获取附件
getFiles(){
let oParams = {}
oParams.bsMerchantOrder = this.info.merchantOrder
LISTBSPICTUREURLBYBSMERCHANTORDER(oParams).then(res => {
let obj = res.data || {}
this.fileList = obj.listDto||[]
})
},
// nextStep(){
// let isPass = this.judageMater();
// if(!isPass){
// return
// }
// },
// 判断车型审核物料是否在现有物料列表里
judageMater(code){
let list = this.list;
let m = list.findIndex(k => k.attribCode == code);
let arr = [];
this.carList.map(k => {
let o = list.findIndex(kk => kk.attribCode == code);
if(o<0){
arr.push(code)
}
})
if(arr.length>0){
this.materialFlag = false
}else{
this.materialFlag = true
}
if(m<0){
//this.arr.push(code)
return `物料${code}不存在`
}
}
},
}
</script>
<style lang="scss" scoped>
.addorder_page {
padding: 20px;
position: relative;
}
.line_box {
display: flex;
.left,
.right {
flex: 1;
}
}
.el_select {
width: 100%;
}
.sort_input {
width: 200px;
}
.warningFont {
font-size: 14px;
color: #f00;
font-weight: normal;
}
.text-wrapper {
white-space: pre-wrap;
}
.form_row {
display: flex;
flex-wrap: wrap;
margin: 20px 0 40px 0;
.cell {
flex: 0 0 50%;
display: flex;
.name {
width: 98px;
flex-shrink: 0;
text-align: right;
}
.txt_content {
flex: 1;
padding: 0 10px;
}
}
}
</style>