constant.js
4.63 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
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
/* eslint-disable */
var reg = {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
}
/* eslint-enable */
regRule = regRule || 'priceReg'
if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) {
return oldValue || ''
}
if (newValue && reg[regRule].test(newValue + '')) {
if (/\./.test(newValue)) {
newValue = newValue + ''
var interger = newValue.split('.')[0]
var point = newValue.split('.')[1]
var intergerNum = interger.length > intergerDigit ? oldValue.split('.')[0] : interger
var pointNum = point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0]
} else {
newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue
if (regRule == 'zNumReg') {
newValue = newValue.split('')[0] == '0' ? '0' : newValue
}
}
return newValue
} else {
return newValue ? oldValue : ''
}
};
function getExplorer() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
}
function exportFn(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
}
const orderManageStatusList = [
{ confId: '1', confName: '未支付' },
{ confId: '2', confName: '已支付' },
{ confId: '3', confName: '已失效' },
{ confId: '4', confName: '已发货' },
{ confId: '5', confName: '已收货' },
{ confId: '6', confName: '待审核' },
{ confId: '7', confName: '审核成功' },
{ confId: '8', confName: '审核失败' },
{ confId: '9', confName: '待确认' },
{ confId: '10', confName: '退款中' },
{ confId: '11', confName: '已退款' },
{ confId: '12', confName: '退款失败' },
{ confId: '13', confName: '待发货' },
{ confId: '14', confName: '待安装' },
{ confId: '15', confName: '已安装' }
]
const orderSourceList = [
{ confId: '1', confName: '商城订单' },
{ confId: '2', confName: '直播订单' },
{ confId: '3', confName: '活动订单' }
]
const deliveryTypeList = [
{ confId: '1', confName: '到店核销' },
{ confId: '2', confName: '快递到家' }
]
//会员中心得状态list
const statusList = [
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [{
confId: 1,
confName: '套餐'
},
{
confId: 2,
confName: '会员卡'
}
]
const orderStatusList = [
// 2: '待收货',
// 3: '已完成',
// 4: '售后中',
// 5: '退款失败',
// 6: '已经退款',
{
confId: 2,
confName: '待收货'
},
{
confId: 3,
confName: '已完成'
},
{
confId: 4,
confName: '售后中'
},
{
confId: 5,
confName: '退款失败'
},
{
confId: 6,
confName: '已退款'
},
]
const serviceStatusList = [{
confId: 1,
confName: '未生效'
},
{
confId: 2,
confName: '生效中'
},
{
confId: 3,
confName: '已失效'
}
]
const memberTypeList = [{
confId: 1,
confName: '正式会员'
},
{
confId: 2,
confName: '试用会员'
}
]
const stateList = [{
confId: 0,
confName: '待上架'
},
{
confId: 1,
confName: '在售中'
},
{
confId: 2,
confName: '已下架'
},
]
export {
limitPrice,
orderManageStatusList,
orderSourceList,
deliveryTypeList,
statusList,
serviceStatusList,
memberTypeList,
stateList,
orderTypesList,
orderStatusList,
getExplorer,
exportFn
}