labelRefundStatus.js
2.89 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
// packageWorkspace/pages/refundApply/components/labelRefundStatus/labelRefundStatus.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
infoData: {
type: Object,
observer: function(n) {
this.setStatusInfo(n.beforeStatus, n.afterStatus, n.transferStatus)
}
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
statusList: [ //进度条
{
nameObj: {
1: '申请标记退款',
2: '已申请'
},
type: 1,
active: true
},
{
nameObj: {
1: '区域运营审核',
2: '区域运营审核',
3: '区域运营审核'
},
type: 1,
active: false
}
]
},
/**
* 组件的方法列表
*/
methods: {
setStatusInfo(beforeStatus, afterStatus, transferStatus) {
const STATUS = {
INITIATE: 0, // 发起申请
APPLIED: 1, // 已申请
REGION_REVIEW: 2, // 区域运营审核
REGION_PASS: 3, // 区域运营审核通过
REGION_REJECT: 4, // 区域运营审核不通过
}
// 定义状态类型
const STATUS_TYPE = {
CURRENT: 1, // 当前进行中
COMPLETED: 2, // 已完成
REJECTED: 3 // 已驳回
}
// 处理空值
const before = beforeStatus ?? ''
const after = afterStatus ?? ''
const transfer = transferStatus ?? ''
// 确定当前状态
let currentStatus
if (transfer == 3) {
currentStatus = STATUS.REGION_PASS
}
if (before === '' && after === '') {
currentStatus = STATUS.INITIATE
} else if (before === '' && after == 6) {
currentStatus = STATUS.APPLIED
} else if (before == 6 && after == 7) {
currentStatus = STATUS.REGION_REVIEW
} else if (before == 7 && after == 5) {
currentStatus = STATUS.REGION_REJECT
}
// 更新状态列表
const { statusList } = this.data
statusList.forEach((item, index) => {
// 第一步状态
if (index === 0) {
item.type = currentStatus === STATUS.INITIATE ? STATUS_TYPE.CURRENT : STATUS_TYPE.COMPLETED
item.active = currentStatus === STATUS.INITIATE
}
// 第二步状态(区域审核)
if (index === 1) {
if (currentStatus === STATUS.REGION_REVIEW) {
item.type = STATUS_TYPE.CURRENT
item.active = true
} else if (currentStatus === STATUS.REGION_REJECT) {
item.type = STATUS_TYPE.REJECTED
item.active = true
} else if (currentStatus > STATUS.REGION_REVIEW) {
item.type = STATUS_TYPE.COMPLETED
item.active = false
}
}
})
this.setData({
statusList
})
}
}
})