index.vue
15.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
<!-- 采购发货 -->
<template>
<div class="layout">
<div class="purchase" :style="{ height: isHeight ? 'calc(100vh - 68px)' : '100%' }">
<!-- 订单基本信息 -->
<div class="info-section">
<div class="title">
订单基本信息
<div class="status">
<span :style="{ color: getStepText('orderStatusOpts', purchaseOrderInfo.status, 'color') }">{{ getStepText('orderStatusOpts', purchaseOrderInfo.status, 'label') }}</span>
|
<span :style="{ color: getStepText('deliveryStatusOpts', purchaseOrderInfo.deliveryStatus, 'color') }">
{{ getStepText('deliveryStatusOpts', purchaseOrderInfo.deliveryStatus, 'label') }}
</span>
</div>
</div>
<div v-for="(item, index) in orderBasicInfoList" :key="index" class="info-item">
<span>{{ item.label }}</span>
<span class="value" v-if="item.formatter">{{ item.formatter(purchaseOrderInfo) }}</span>
<span class="value" v-else>{{ purchaseOrderInfo[item.value] || '--' }}</span>
</div>
</div>
<!-- 订单基本信息 -->
<div class="info-section">
<div class="title">
产品信息
<span class="title-tip">点击产品名称可查看商品全部信息</span>
</div>
<sticky-table
:columns="tableColumns"
:data="purchaseOrderInfo.goodsList"
:height="purchaseOrderInfo && purchaseOrderInfo.goodsList && purchaseOrderInfo.goodsList.length > 5 ? '216px' : 'auto'"
>
<template #upgradeGoodsName="{ row }">
<span style="color: #347bff; cursor: pointer" @click="handleProductClick(row)">{{ row.upgradeGoodsName }}</span>
</template>
</sticky-table>
</div>
<!-- 收件信息 -->
<div class="info-section">
<div class="title">收件信息</div>
<div v-for="(item, index) in receiverInfoList" :key="index" class="info-item">
<span>{{ item.label }}</span>
<span>{{ purchaseOrderInfo[item.value] }}</span>
</div>
</div>
<!-- 审核流程进度 -->
<div class="info-section">
<div class="title">审核流程进度</div>
<review-status :infoData="purchaseOrderInfo"></review-status>
</div>
<!-- 审核记录 -->
<div class="info-section">
<div class="title">审核记录</div>
<record :recordList="purchaseOrderInfo.auditDetailList"></record>
</div>
</div>
<div class="footer">
<div class="reject btn" @click="handleReject" v-if="showRejectBtn">驳回</div>
<div class="approve btn" @click="handleApprove" v-if="showApproveBtn">通过</div>
</div>
<reject-comp :isVisible="rejectVisible" v-if="rejectVisible" :infoData="purchaseOrderInfo" @cancel="handleCancel" @success="handleSuccess"></reject-comp>
<approve-comp :isVisible="approveVisible" v-if="approveVisible" :infoData="purchaseOrderInfo" @cancel="handleApproveCancel" @success="handleApproveSuccess"></approve-comp>
<detail-comp :isVisible="detailVisible" v-if="detailVisible" :infoData="productInfo" @cancel="handleDetailCancel"></detail-comp>
</div>
</template>
<script type="text/ecmascript-6">
import { getLocalStorage } from '@/utils/util'
import { deepClone } from '@/utils/tools'
import { purchasingPatternOptions } from '@/utils/constants'
import reviewStatus from './reviewStatus.vue'
import record from './record.vue'
import rejectComp from './components/rejectComp.vue'
import ApproveComp from './components/approveComp.vue'
import detailComp from './components/detailComp.vue'
import purchaseApi from '@/api/purchase'
import StickyTable from '@/components/StickyTable.vue'
export default {
components: { reviewStatus, record, rejectComp, ApproveComp, StickyTable, detailComp },
name: '',
data() {
return {
staffType: this.$route.query.staffType, // (2-运营审核 3-商务审核 4-采购发货审核)
orderCode: this.$route.query.orderCode,
purchaseOrderInfo: {},
productInfo: {},
approveVisible: false,
rejectVisible: false,
detailVisible: false,
tableColumns: [
{ label: '产品名称', prop: 'upgradeGoodsName', width: '120px' },
{ label: '产品ID', prop: 'upgradeGoodsCommodityCode', width: '150px' },
{ label: '供应商名称', prop: 'thirdPartyName', width: '120px' },
{ label: '产品编码', prop: 'type', width: '100px' },
{ label: '规格', prop: 'specificationData', width: '90px' },
{ label: '供应商编码', prop: 'thirdPartyCode', width: '120px' },
{
label: '采购数量',
prop: 'goodsNumber',
width: '100px',
formatter: row => {
const unit = row.conversionValue ? '卷' : '件'
return (row.goodsNumber || 0) + unit
}
},
{
label: '库存总量',
prop: 'inventoryTotal',
width: '100px',
formatter: row => {
const total = (row.goodsNumber || 0) * (row.conversionValue || 1)
// 如果conversionValue为空,应该怎么算?题目说"库存数量 = goodsNumber * conversionValue 就是库存总量",但如果conversionValue为空,通常意味着是1或者就是goodsNumber。题目后半句说"如果conversionValue为空,单位就是件",暗示这种情况下库存总量可能就是goodsNumber。 这里假设 conversionValue 为空时按 1 计算,或者直接取 goodsNumber。
// 根据题目: "库存数量 = goodsNumber * conversionValue 就是库存总量。单位,如果conversionValue 为空,单位就是件,如果conversionValue 不为空,单位就是米。"
// 如果 conversionValue 为空/0/null,则总量 = goodsNumber (单位:件)
// 如果 conversionValue 有值,则总量 = goodsNumber * conversionValue (单位:米)
if (!row.conversionValue) {
return (row.goodsNumber || 0) + '件'
} else {
// 乘法可能存在精度问题,简单处理
return ((row.goodsNumber || 0) * row.conversionValue).toFixed(2) + '米'
}
}
},
{
label: '已发货数量',
prop: 'purchaseNumber',
width: '100px',
formatter: row => {
const unit = row.conversionValue ? '卷' : '件'
return (row.purchaseNumber || 0) + unit
}
},
{ label: '产品别名', prop: 'purchaseGoodsName', width: '100px' },
{
label: '单价',
prop: 'upgradePurchasePrice',
width: '90px',
formatter: row => {
return '¥' + row.upgradePurchasePrice
}
},
{
label: '总价',
prop: 'goodsTotalPrice',
width: '90px',
formatter: row => {
return '¥' + row.goodsTotalPrice
}
},
{
label: '备注',
prop: 'remark',
width: '90px'
}
],
orderBasicInfoList: [
{ label: '订单编号', value: 'orderCode' },
{ label: '下单门店', value: 'merchantName' },
{ label: '发货主体', value: 'sendOutMerchantName' },
{
label: '订单总价/元',
value: 'totalPrice',
formatter: cellValue => {
return '¥' + cellValue.totalPrice
}
},
{
label: '采购模式',
value: 'purchasingPattern',
formatter: cellValue => {
const statusItem = this.getStatusItem(this.baseData, 'purchasingPatternOptions', cellValue, 'purchasingPattern')
return statusItem ? statusItem.confValue : '--'
}
},
{ label: '下单时间', value: 'orderTime' },
{
label: '当前审核节点',
value: '商务审核',
formatter: cellValue => {
const keys = {
1: '运营审核',
8: '商务审核',
10: '总监审核',
2: '经理审核'
}
return keys[cellValue.status] || '--'
}
}
],
receiverInfoList: [
{ label: '收货人', value: 'contactName' },
{ label: '收货人电话', value: 'contactPhone' },
{ label: '收货地址', value: 'contactAddress' }
],
deliveryStatusOpts: {
1: {
label: '未发货',
color: '#999999'
},
2: {
label: '全部发货',
color: '#35C376'
},
3: {
label: '部分发货',
color: '#FF9D0A'
},
4: {
label: '结束发货',
color: '#F24724'
}
},
// 订单状态
// 1.待审核,2运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回
// 4.20更新
// 1.待审核,2运营已审核,3.已取消,4.运营已驳回,5.商务已审核,6.商务已驳回,7.发货已驳回,8.总监已审核,9.总监已驳回,10.经理审核,11.经理已驳回
orderStatusOpts: {
1: {
label: '待审核',
color: '#FF9D0A'
},
2: {
label: '待审核',
color: '#FF9D0A'
},
10: {
label: '待审核',
color: '#FF9D0A'
},
8: {
label: '待审核',
color: '#FF9D0A'
},
5: {
label: '已审核',
color: '#35C376'
},
4: {
label: '已驳回',
color: '#F24724'
},
3: {
label: '已取消',
color: '#999999'
},
6: {
label: '已驳回',
color: '#F24724'
},
7: {
label: '已驳回',
color: '#F24724'
},
9: {
label: '已驳回',
color: '#F24724'
},
11: {
label: '已驳回',
color: '#F24724'
}
},
baseData: {
purchasingPatternOptions: deepClone(purchasingPatternOptions)
}
}
},
// 第一步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/purchase?orderCode=CG26012916474916&staffType=2&name=glsadmin 运营审核
// 第二步:http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/purchase?orderCode=CG202407158682&staffType=3&name=glsadmin 商务审核
// 第二步: http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/purchase?orderCode=CG202407158682&staffType=4&name=glsadmin 采购发货审核
created() {
this.purchaseOrderDetailData()
},
computed: {
isHeight() {
const { status, deliveryStatus } = this.purchaseOrderInfo || {}
const staffType = this.staffType
return (
(status === 1 && staffType == 2) ||
(status === 2 && staffType == 6) ||
(status === 8 && staffType == 3) ||
(status === 10 && staffType == 5) ||
(deliveryStatus === 1 && staffType == 4 && status == 5)
)
},
showRejectBtn() {
const purchaseOrderInfo = this.purchaseOrderInfo
const staffType = this.staffType
// 运营审核
return (
(purchaseOrderInfo.status === 1 && staffType == 2) ||
// 经理审核
(purchaseOrderInfo.status === 2 && staffType == 6) ||
// 商务审核
(purchaseOrderInfo.status === 8 && staffType == 3) ||
// 总监审核
(purchaseOrderInfo.status === 10 && staffType == 5) ||
// 采购发货
(purchaseOrderInfo.deliveryStatus === 1 && staffType == 4 && purchaseOrderInfo.status == 5)
)
},
showApproveBtn() {
const purchaseOrderInfo = this.purchaseOrderInfo
const staffType = this.staffType
// 运营审核
return (
(purchaseOrderInfo.status === 1 && staffType == 2) ||
// 经理审核
(purchaseOrderInfo.status === 2 && staffType == 6) ||
// 商务审核
(purchaseOrderInfo.status === 8 && staffType == 3) ||
// 总监审核
(purchaseOrderInfo.status === 10 && staffType == 5)
)
}
},
mounted() {},
methods: {
handleApproveCancel() {
this.approveVisible = false
},
handleCancel() {
this.rejectVisible = false
},
handleSuccess() {
this.handleCancel()
this.purchaseOrderDetailData()
},
handleApproveSuccess() {
this.handleApproveCancel()
this.purchaseOrderDetailData()
},
getStepText(opts, status, key) {
const mapping = this[opts][status]
return mapping ? mapping[key] : ''
},
getStatusItem(baseData, optKey, row, rowKey) {
if (!baseData || !baseData[optKey] || !row) return null
return baseData[optKey].find(
item => item.confId == row[rowKey] // 使用严格相等
)
},
handleSelect() {
this.sendOutVisible = true
},
async purchaseOrderDetailData() {
let result = await purchaseApi.purchaseOrderDetail({ orderCode: this.orderCode })
if (result.code == 0) {
this.purchaseOrderInfo = result.data
}
},
handleDetailCancel() {
this.detailVisible = !this.detailVisible
},
handleProductClick(row) {
// console.log(row)
// this.productInfo = row
// this.handleDetailCancel()
this.$router.push({
path: '/purchase/detail',
query: {
id: row.id,
staffType: this.staffType
}
})
},
//驳回
handleReject() {
this.rejectVisible = true
},
//通过
handleApprove() {
this.approveVisible = true
}
}
}
</script>
<style scoped lang="scss">
.layout {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
.footer {
display: flex;
align-items: center;
justify-content: space-between;
margin: 7px 16px 10px;
.btn {
flex: 1;
border-radius: 6px;
height: 41px;
line-height: 41px;
font-size: 16px;
}
.reject {
border: 1px solid #dee0e3;
background: #f4f5f7;
color: #292d33;
text-align: center;
}
.approve {
background: #347bff;
color: #ffffff;
text-align: center;
margin-left: 11px;
}
}
}
.purchase {
width: 100vw;
padding: 12px 10px;
box-sizing: border-box;
height: calc(100% - 68px);
overflow: scroll;
.info-section {
padding: 16px 16px 6px;
border-radius: 8px;
font-size: 14px;
background: #ffffff;
box-sizing: border-box;
margin-bottom: 12px;
.title {
color: #333333;
font-size: 15px;
margin-bottom: 10px;
position: relative;
font-weight: 600;
.status {
font-size: 13px;
position: absolute;
right: 0px;
font-weight: normal;
top: 0px;
}
.title-tip {
color: #999999;
font-size: 12px;
font-weight: 400;
margin-left: 4px;
}
}
}
.info-item {
margin-bottom: 10px;
display: flex;
}
.info-item :nth-child(1) {
display: inline-block;
width: 88px;
color: #999999;
margin-right: 12px;
}
.info-item :nth-child(2) {
color: #292d33;
width: 223px;
white-space: wrap;
display: inline-block;
white-space: pre-wrap;
word-break: break-word;
}
}
</style>