// 订单状态
export function orderStatus(status) {
  switch (+status) {
    case -2:
      return {
        name: '已取消',
        color: '#F56C6C'
      }
    case -1:
      return {
        name: '待收款确认',
        color: '#4da5a5'
      }
    case 0:
      return {
        name: '待订单审核',
        color: '#f97547'
      }
    case 1:
      return {
        name: '待财务审核',
        color: '#13c19f'
      }
    case 2:
      return {
        name: '待发货审核',
        color: '#ffaa1d'
      }
    case 3:
      return {
        name: '待收货',
        color: '#409EFF'
      }
    case 4:
      return {
        name: '已完成',
        color: '#74a2e6'
      }
    case 5:
      return {
        name: '已驳回(客服)',
        color: '#67C23A'
      }
    case 6:
      return {
        name: '已驳回(财务)',
        color: '#67C23A'
      }
    case 7:
      return {
        name: '已驳回(物流)',
        color: '#67C23A'
      }
    default :
      return {
        name: '未知订单状态',
        color: '#909399'
      }
  }
}
// 工作室订单状态
export function orderStudio(status) {
  switch (+status) {
    case -1:
      return {
        name: '已删除',
        color: '#4da5a5'
      }
    case 0:
      return {
        name: '订单未审核',
        color: '#f97547'
      }
    case 1:
      return {
        name: '财务未审核',
        color: '#13c19f'
      }
    case 2:
      return {
        name: '未发货审核',
        color: '#ffaa1d'
      }
    case 3:
      return {
        name: '待收货',
        color: '#409EFF'
      }
    case 4:
      return {
        name: '已完成',
        color: '#74a2e6'
      }
  }
}
// 支付状态
export function payStatus(status) {
  switch (+status) {
    case 0:
      return {
        name: '未付款',
        color: '#f96b6b'
      }
    case 1:
      return {
        name: '部分付款',
        color: '#f96b6b'
      }
    case 2:
      return {
        name: '已付款',
        color: '#415161'
      }
    case 3:
      return {
        name: '待退款',
        color: '#f96b6b'
      }
    default :
      return {
        name: '未知支付状态',
        color: '#909399'
      }
  }
}

// 认证状态显示
export function certStatus(status) {
  let out
  switch (status) {
    case 0:
      out = '销售未实名认证'
      break
    case 1:
      out = '等待邀请人审核'
      break
    case 2:
      out = '等待上级审核'
      break
    case 3:
      out = '等待用户确认'
      break
    case 4:
      out = '邀请人审核驳回'
      break
    case 5:
      out = '上级审核驳回'
      break
    case 6:
      out = '授权成功'
      break
    default:
      out = status
  }
  return out
}

// 确认代理级别
export function levelStatus(level) {
  if (!level && level !== 0) {
    return {
      name: '级别待定',
      color: '#909399'
    }
  }
  let out
  switch (level) {
    case 3:
      out = {
        name: '代理公司',
        color: '#f0a637'
      }
      break
    case 2:
      out = {
        name: '销售经理',
        color: '#67c23a'
      }
      break
    case 1:
      out = {
        name: '销售主管',
        color: '#1fd3c2'
      }
      break
    default:
      out = {
        name: '公司',
        color: '#409eff'
      }
  }
  return out
}

// 系统设置拆解
export function filterSet(arr, key) {
  if (arr.length < 1) {
    return null
  }
  return arr.filter(item => {
    return item.keys === key
  })[0]
}
