export const LOGIN_USER = "login_user" // 获取存储的数据 export const getStorage = function(key) { var val = sessionStorage.getItem(key) if (val) { return JSON.parse(val) } else { return false } } // 存储数据 export const setStorage = function(key, val) { sessionStorage.setItem(key, JSON.stringify(val)) } // 删除存储数据 export const removeStorage = function(key) { sessionStorage.removeItem(key) } // 性别格式化 export const sexFormater = function(sex) { var val = sex if (val === 1) { return '男' } else if (val === 0) { return '女' } else if (val === -1) { return '未知' } else { return '' } } export const payTypeFormater = function(type) { if (type === 1) { return '支付宝' } else if (type === 2) { return '微信' } else { return '未知' } } export const payStatusFormater = function(payStatus) { if (payStatus === 0) { return '待支付' } else if (payStatus === 10) { return '支付完成' } else { return '未知' } } export const checkStatusFormater = function(checkStatus) { if (checkStatus === 0) { return '未核对' } else if (checkStatus === 10) { return '核对成功' } else if (checkStatus === 20) { return '核对失败' } else { return '未知' } } export const timeFormater = function(ctime) { var time = new Date(ctime * 1000) var month = time.getMonth() + 1 var day = time.getDate() if (month < 10) { month = '0' + month } if (day < 10) { day = '0' + day } return time.getFullYear() + '-' + month + '-' + day } export const timeDetailFormater = function(ctime) { var time = new Date(ctime * 1000) var month = time.getMonth() + 1 var day = time.getDate() var hour = time.getHours() var minu = time.getMinutes() var sec = time.getSeconds() if (month < 10) { month = '0' + month } if (day < 10) { day = '0' + day } if (hour < 10) { hour = '0' + hour } if (minu < 10) { minu = '0' + minu } if (sec < 10) { sec = '0' + sec } return time.getFullYear() + '-' + month + '-' + day + " " + hour + ":" + minu + ":" + sec }