164 lines
3.2 KiB
JavaScript
164 lines
3.2 KiB
JavaScript
/**
|
|
* datamap , 数据字典, 存放常用的配置常量信息。 如订单类型的判断, 用户类型的判断。
|
|
*
|
|
*
|
|
* @author terrfly
|
|
* @site https://www.jeepay.vip
|
|
* @date 2022/11/28 16:16
|
|
*/
|
|
|
|
const payOrderStateMap = {
|
|
0: {
|
|
text: '订单生成',
|
|
color: '#2980FD'
|
|
},
|
|
1: {
|
|
text: '支付中',
|
|
color: '#FFAA33'
|
|
},
|
|
2: {
|
|
text: '支付成功',
|
|
color: '#09BB07'
|
|
},
|
|
3: {
|
|
text: '支付失败',
|
|
color: '#CB2972'
|
|
},
|
|
4: {
|
|
text: '已撤销',
|
|
color: '#808080'
|
|
},
|
|
5: {
|
|
text: '已退款',
|
|
color: '#FF5B4C'
|
|
},
|
|
6: {
|
|
text: '订单关闭',
|
|
color: '#D9D9D9'
|
|
},
|
|
}
|
|
// 订单 图片 和背景颜色
|
|
const payOrderImageMap = {
|
|
WECHAT: {
|
|
title: '微信',
|
|
imgUrl: '/static/orderImg/wechat.svg', //微信支付
|
|
bgColor: '#09BB07',
|
|
},
|
|
ALIPAY: {
|
|
title: '支付宝',
|
|
imgUrl: '/static/orderImg/zfb.svg', //支付宝支付
|
|
bgColor: '#458FFF',
|
|
},
|
|
YSFPAY: {
|
|
title: '云闪付',
|
|
imgUrl: '/static/orderImg/ysf.svg', // 云闪付支付
|
|
bgColor: '#FF5B4C',
|
|
},
|
|
UNIONPAY: {
|
|
title: '银联',
|
|
imgUrl: '/static/orderImg/union-pay.svg', //银联支付
|
|
bgColor: '#0D131A',
|
|
},
|
|
OTHER: {
|
|
title: '其他',
|
|
imgUrl: '/static/orderImg/default-pay.svg', //其他支付
|
|
bgColor: '#5F36C4',
|
|
},
|
|
}
|
|
|
|
// 1-超级管理员 2-普通用户 3-拓展员, 11-店长, 12-店员
|
|
const userTypeMap = {
|
|
1: {
|
|
text: '超管',
|
|
bgColor: 'linear-gradient(270deg, rgba(35,161,252,1) 0%, rgba(26,102,255,1) 100%)',
|
|
type: 'blue'
|
|
},
|
|
2: {
|
|
text: '普通用户',
|
|
bgColor: 'linear-gradient(270deg, rgba(35,161,252,1) 0%, rgba(26,102,255,1) 100%)'
|
|
},
|
|
3: {
|
|
text: '拓展员',
|
|
bgColor: 'linear-gradient(270deg, rgba(35,161,252,1) 0%, rgba(26,102,255,1) 100%)'
|
|
},
|
|
11: {
|
|
text: '店长',
|
|
bgColor: 'linear-gradient(270deg, rgba(220,61,138,1) 0%, rgba(187,23,92,1) 100%)',
|
|
type: 'purple'
|
|
},
|
|
12: {
|
|
text: '店员',
|
|
bgColor: ' linear-gradient(270deg, rgba(61,220,68,1) 0%, rgba(23,187,118,1) 100%)',
|
|
type: 'green'
|
|
},
|
|
}
|
|
// 设备厂商
|
|
const devProvider = {
|
|
zgwl: '智谷物联',
|
|
bsj: '博实结',
|
|
fe: '飞鹅',
|
|
ps: '品生',
|
|
clj: '财来聚',
|
|
wsy: '微收银',
|
|
xjl: '小精灵',
|
|
lmspay: '立码收',
|
|
lkls: '拉卡拉',
|
|
zw: '智网'
|
|
}
|
|
|
|
const rechargeStateMap = {
|
|
0: {
|
|
text: '初始化',
|
|
color: '#2980FD'
|
|
},
|
|
1: {
|
|
text: '充值中',
|
|
color: '#FFAA33'
|
|
},
|
|
2: {
|
|
text: '充值成功',
|
|
color: '#09BB07'
|
|
},
|
|
3: {
|
|
text: '充值失败',
|
|
color: '#CB2972'
|
|
}
|
|
}
|
|
|
|
const model = {
|
|
// 订单状态文本和color
|
|
payOrderState: (state) => {
|
|
// 避免循环判断,影响性能。
|
|
if (payOrderStateMap[state]) {
|
|
return payOrderStateMap[state]
|
|
}
|
|
|
|
return {
|
|
text: '未知',
|
|
color: '#D9D9D9'
|
|
}
|
|
},
|
|
|
|
// 订单图片 和图片背景颜色
|
|
payOrderImage: (state) => {
|
|
// 取值 找到 返回当前值 未找到返回空对象
|
|
return payOrderImageMap[state] || {}
|
|
},
|
|
|
|
// 用户类型的判断
|
|
userType: (userTypeVal) => {
|
|
return userTypeMap[userTypeVal] || {}
|
|
},
|
|
// 查找设备厂商 找到就返回 找不到据返回空
|
|
provider: (state) => {
|
|
return devProvider[state] || '未知'
|
|
},
|
|
|
|
// 会员充值订单图片 和图片背景颜色
|
|
rechargeRecordImage: (state) => {
|
|
// 取值 找到 返回当前值 未找到返回空对象
|
|
return rechargeStateMap[state] || {}
|
|
},
|
|
}
|
|
|
|
export default model |