assignShipmentForBatch.vue
20.4 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
<template>
<div>
<glsx-dialog :show="show" width="60%" title="批量分配发货" usefooter @closed="cancel">
<el-form ref="assignShipmentForBatchFrom" :model="form" :rules="formRules" label-width="110px">
<el-form-item label="是否扫码" prop="scanCode">
<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="form.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" @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="form.deviceScanType == 'Y'">
<div v-if="isNet" class="left">
<el-form-item label="套餐" prop="packageOne">
<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">
</div>
</div>
<div v-if="form.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>
</div>
<hr style="background-color: blue;border: none;height: 2px;opacity: .1;" /><br />
<div v-if="form.deviceScanType == 'Y'">
<h3 class="h2">设备配置:</h3>
<el-form-item label="物料编码">
<el-input v-model="attribCode" class="sort_input" clearable />
<el-button type="primary" @click="searchAttribCode">搜索</el-button>
<span style="color:#f00;" v-if="noCode">未找到商务审核的料号,请前往“设备配置管理”中创建</span>
</el-form-item>
<div class="table_box">
<el-table v-loading="tableLoading" :data="list" stripe style="width: 100%" :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="channgegeAttr(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>
<span style="color:#f00;" v-if="showMaterialCodeError">未选择设备配置</span>
</div>
</div>
<br />
<div class="line_box">
<div class="left">
<el-form-item label="选择仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" placeholder="请选择" class="el_select" @change="setListWare">
<el-option v-for="item in warehouse" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
</el-select>
</el-form-item>
</div>
<div class="right">
<span style="color:#f00;">选择发货仓库后,以下订单自动填充为已选发货仓库<br />如需特殊处理,可选择订单,单独配置发货仓库</span>
</div>
</div>
<div class="table_box">
<el-table ref="tableAB" v-loading="tableLoading" :data="infoList" stripe style="width: 100%" border>
<el-table-column prop="merchantOrder" label="订单号" :width="order_tdWidth" />
<el-table-column prop="merchantName" label="下单客户" :width="order_tdWidth" />
<el-table-column prop="totalCheck" label="审核数量(总)" width="180" />
<el-table-column prop="checkRemark" label="审核备注" :width="order_tdWidth" />
<el-table-column label="发货仓库" :width="order_tdWidth">
<template slot-scope="scope">
<el-select v-model="scope.row.chooseWarehouseId" placeholder="请选择" class="el_select">
<el-option v-for="item in warehouse" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</div>
<br />
<div v-if="showCarInfo">
<el-collapse>
<el-collapse-item>
<h3 slot="title" class="el_collapse">车辆信息:<span style="font-size:10px;color:blue"> 点击展开/收起信息</span></h3>
<!-- <h3>车辆信息:</h3> -->
<div class="table_box">
<el-table v-loading="tableLoading" :data="carList" stripe style="width: 100%" border>
<el-table-column prop="merchantOrder" label="订单号" width="230" />
<el-table-column prop="merchantName" label="下单客户" :width="car_tdWidth" />
<el-table-column prop="carInfo" label="车辆信息" width="250">
<template slot-scope="scoped">
品牌:{{scoped.row.bsParentBrandName}} <br />
子品牌:{{scoped.row.bsSubBrandName}} <br />
车系:{{scoped.row.bsAudiName}} <br />
车型:{{scoped.row.bsMotorcycle}} <br />
高中低配:{{scoped.row.bsMotorHmdName}} <br />
车价/颜色:{{scoped.row.bsRemark}}
</template>
</el-table-column>
<el-table-column prop="bsCheckQuantity" label="审核数量" width="80" />
<el-table-column prop="bsCheckMaterialName" label="审核物料" width="160">
<template slot-scope="{row}">{{row.bsCheckMaterialCode +'/'+ row.bsCheckMaterialName}}</template>
</el-table-column>
<el-table-column prop="bsCheckMaterialName" label="分配实发物料" width="160" v-if="form.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>
</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>
</el-collapse-item>
</el-collapse>
</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,
LISTPACKAGE,
LISTSPORDERVEHICLE,
DISPATCHSPORDERSCANY,
DISPATCHSPORDERSCANN,
} from '@/http/interface'
import { Validator } from '@/common/validator'
export default {
name: 'AssignShipmentForBatch',
props: {
infoList: {
type: Array,
default: function () {
return []
},
},
show: {
type: Boolean,
default: false,
},
},
components: {
'glsx-dialog': GlsxDialog,
},
// watch: {
// infoList(val) {
// if(val && val.length > 0){
// // console.log(val)
// // this.form = val
// // this.attribCode = val.auditAttribCode
// this.radio = this.attribCode
// // this.scanCode = val.scanCode
// if(this.scanCode == '1'){
// this.disabled_notNeed = true
// }else if(this.scanCode == '2'){
// this.disabled_need = true
// this.info = val[0]
// }
// // for(var key in val){
// // val[key].chooseWarehouseId = ''
// // }
// }else{
// }
// }
// },
data() {
var checkPhone = (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入联系人电话'))
}
if (!Validator.PHONEREG.test(value)) {
return callback(new Error('联系人电话格式不正确'))
}
callback()
}
return {
disabled_need: false,
disabled_notNeed: false,
form: {},
deviceTypeList: [],
deviceList: [],
list: [],
carList: [],
TB_height: 300,
tdWidth: 80,
car_tdWidth: 150,
order_tdWidth: 225,
radio: '',
warehouse: [],
loading: false,
packageList: [],
isNet: true,
attribCode: '',
noCode: false,
showCarInfo: false,
showMaterialCodeError: false,
tableLoading: false,
formRules: {
deviceTypeId: [
{
required: true,
message: '请选择设备类型',
trigger: 'change',
},
],
deviceId: [
{
required: true,
message: '请选择硬件设备',
trigger: 'change',
},
],
packageOne: [
{
required: true,
message: '请选择套餐',
trigger: 'change',
},
],
warehouseId: [
{
required: true,
message: '请选择仓库',
trigger: 'change',
},
],
},
}
},
created() {},
mounted: function () {
this.form = util.deepClone(this.infoList[0])
// this.attribCode = this.form.materialCode
this.radio = this.form.materialCode
console.log(this.form)
if (this.form.deviceScanType == 'Y') {
this.disabled_notNeed = true
} else if (this.form.deviceScanType == 'N') {
this.disabled_need = true
}
this.init()
},
methods: {
/**
* 初始化函数
*/
init: function () {
this.getDeviceList()
this.getDevice()
this.getWarehouseList()
this.getCarInfo()
this.searchAttribCode()
},
formatter: function (row, column, cellValue) {
if (cellValue) {
if (cellValue == '未知' || cellValue == "'未知'") {
return '--'
} else {
return cellValue
}
} 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
// if(param){
// oParams = param
// }
// oParams.pageNum = 1
// oParams.pageSize = 10000
// oParams.pageStart = 0
// oParams.currentPage = 1
_this.tableLoading = true
LISTATTRIBMANA(oParams).then((res) => {
const 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]
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 || []
})
},
/**
* 获取套餐列表
*/
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)
},
/**
* 是否显示套餐
*/
// showPackage: function(row) {
// console.log(row)
// const n = row
// const m = this.form
// if (row.orNetId == 57) {
// this.isNet = false
// } else {
// this.isNet = true
// }
// m.attribCode = n.attribCode
// this.form = m
// },
/**
* 获取子订单车辆审核列表
*/
getCarInfo: function () {
const _this = this
const oParams = {}
let orderList = []
this.infoList.map((k) => {
orderList.push(k.merchantOrder)
})
oParams.listMerchantOrder = orderList
LISTSPORDERVEHICLE(oParams).then((res) => {
console.log(res)
const { data } = res
data.map((k) => {
k.sendMaterialCode = _this.radio
})
_this.carList = data || []
if (_this.carList.length > 0) {
// let carInfo = _this.carList[0]
// if(!carInfo.bsParentBrandName && !carInfo.bsSubBrandName){
// this.showCarInfo = false
// }else{
// this.showCarInfo = true
// }
for (var key in _this.carList) {
if (
_this.carList[key].bsParentBrandName &&
_this.carList[key].bsSubBrandName
) {
this.showCarInfo = true
break
}
}
} else {
this.showCarInfo = false
}
})
},
/**
* 选择仓库时,将订单仓库自动填充
*/
setListWare: function () {
let val = this.form.warehouseId
let list = this.infoList
// for(var key in list){
// console.log(list[key])
// list[key].chooseWarehouseId = val
// }
list.map((k) => {
this.$set(k, 'chooseWarehouseId', val)
return k
})
},
/**
* 保存数据
*/
saveInfo: function () {
const _this = this
_this.$refs.assignShipmentForBatchFrom.validate((valid) => {
if (!valid) {
return false
}
let checkRadio = _this.list.find((k) => {
return k.attribCode == _this.radio
})
if (_this.form.deviceScanType == 'Y' && !checkRadio) {
//未选择物料
_this.showMaterialCodeError = true
return false
} else {
_this.showMaterialCodeError = false
}
let oParams = {}
oParams.batchOption = 'Y' //是否批量操作(Y:批量操作 N:非批量操作)
oParams.materialCode = _this.form.materialCode
oParams.materialName = _this.form.materialName
let listOrderWarehouseVo = []
_this.infoList.map((k) => {
listOrderWarehouseVo.push({
merchantOrder: k.merchantOrder,
warehouseId: k.chooseWarehouseId,
})
})
oParams.listOrderWarehouseVo = listOrderWarehouseVo
if (this.form.deviceScanType == 'Y') {
//子订单扫码模式分配发货
oParams.deviceId = _this.form.deviceId
oParams.deviceName = _this.form.deviceName
oParams.packageOne = _this.form.packageOne
// 有车型
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.form.deviceScanType == 'N') {
//子订单不扫码模式分配发货
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')
},
//
channgegeAttr(row) {
let _list = this.carList || []
_list.map((k) => {
k.sendMaterialCode = row.attribCode
k.sendMaterialName = row.attribName
})
},
},
}
</script>
<style lang="scss" scoped>
.addorder_page {
padding: 20px;
position: relative;
}
.table_box {
/* padding: 0 10px; */
}
.line_box {
display: flex;
.left,
.right {
flex: 1;
}
}
.el_select {
width: 100%;
}
.sort_input {
width: 200px;
}
.el_collapse {
font-size: 1.2em;
color: #606266;
font-weight: 600;
}
</style>