constant.js 3.09 KB
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
  /* eslint-disable */
  var reg = {
      priceReg: /^\d[\d\.]*$/,
      numReg: /^[1-9]\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
    }
    return newValue
  } else {
    return newValue ? oldValue : ''
  }
}

const liveStatusList = [{
    confId: '101',
    confName: '直播中'
  },
  {
    confId: '102',
    confName: '未开始'
  },
  {
    confId: '103',
    confName: '已结束'
  },
  {
    confId: '104',
    confName: '禁播'
  },
  {
    confId: '105',
    confName: '暂停'
  },
  {
    confId: '106',
    confName: '异常'
  },
  {
    confId: '107',
    confName: '已过期'
  }
]

const auditStatusList = [{
    confId: 0,
    confName: '未审核'
  },
  {
    confId: 1,
    confName: '审核中'
  },
  {
    confId: 2,
    confName: '审核通过'
  },
  {
    confId: 3,
    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,
  liveStatusList,
  auditStatusList,
  statusList,
  serviceStatusList,
  memberTypeList,
  stateList,
  orderTypesList,
  orderStatusList
}