methods.ts 2.2 KB
import { BASE_URL } from '@/service/config'

// immuneStatus: { 1:'',2:'',3: '',4: '' }
type ObjectString = {
  [key: string]: {
    [key: string]: string | number
  }
}

const GlobalData: ObjectString = {
  'examineState': { 0: '去认证', 10: '审核中', 30: '认证失败', 20: '认证成功' },
  'incomeTypeList': { 1: '问诊订单', 2: '提现' },
  'ReceivePatients': { 0: '暂不接诊', 1: '在线坐诊' },
  'sexData': { 0: '未知', 1: '男', 2: '女' },
  'MessageType': { 1: '系统通知', 2: '用户反馈' },
  'consultationWay': { 10: '快速问诊', 21: '专家图文语音问诊', 22: '专家视频问诊', 23: '专家电话问诊' },
  'isReply': { 0: '否', 1: '是' }, //
  'orderState': { 20: '待问诊', 30: '问诊中', 40: '问诊结束', 50: '已取消' },
  'state': { 0: '待发货', 1: '已发货', 2: '已完成', 3: '已退货' },
  'isSterilization': { 0: '否', 1: '是' }, // 是否绝育
  'petSex': { 0: '母', 1: '公' },
  'immuneStatus': { 1: '已免疫', 2: '未免疫', 3: '免疫不全', 4: '免疫不详' },
  'feedType': { 1: '配方粮', 2: '配方粮+零食', 3: '只吃人食物', 4: '自制犬猫粮' },
  'batheFrequency': { 1: '一周一次(狗狗)', 2: '洗澡频次不规律', 3: '想起来才洗', 4: '定期洗澡(猫猫)' },
  'timeFrame': { 1: '<7天', 2: '<1个月', 3: '<3个月', 4: '3个月以上' },
  'petType': { 10: '猫', 20: '狗', 30: '异宠' },
  'isAgain': { 1: '是', 0: '否' }, // 是否为复诊
  'symptom': { 1: '呕吐', 2: '软便拉稀', 3: '皮肤问题', 4: '眼睛问题', 5: '泌尿问题', 6: '绝育', 7: '疫苗', 8: '驱虫', 9: '养护问题', 10: '其他' }
}

export default {
  optData(key: string) {
    return GlobalData[key]
  },
  optObjectValue(object: string, key: string | number) {
    return GlobalData[object][key] || ''
  },
  downFile(fileName: string) {
    if (fileName == '' || fileName == undefined) return ''

    if (fileName.indexOf(BASE_URL) > -1 || fileName.indexOf('http://') > -1 || fileName.indexOf('https://') > -1) return fileName

    return BASE_URL + '/v1/public/downLoadPic?fileName=' + fileName
  },
  formatStr(str: string, val: string) {
    if (str == null || str == undefined) return val || ''
    return str
  },
}