1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- export default {
- data() {
- return{
- imageUrl: require('@/static/procurement/default.png'),
- }
- },
- filters: {
- subText(str, index) {
- if(str) {
- if (str.length <= index) {
- return str
- }
- return str.substring(0, index) + '...'
- }
- return str
- }
- },
- methods: {
- // 校验 只能输入数字和小数点
- fpNumInput(e, str) {
- const o = e.target
- const inputRule = /[^\d.]/g //修改inputRule 的值
- this.$nextTick(() => {
- this[str].price = o.value.replace(inputRule, '')
- if (o.value[0] == '.') {
- this[str].price = ''
- } else if (o.value[0] == '0' && o.value[1] == '0') {
- this[str].price = '0'
- }
- this[str].price = this[str].price.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.') // 只能输入一个小数点
- })
- },
- // 校验 只能输入数字
- NumberInput(e, str) {
- const o = e.target
- const inputRule = /[^\d]/g //修改inputRule 的值
- this.$nextTick(() => {
- this[str].number = o.value.replace(inputRule, '')
- if (o.value[0] == '0') {
- this[str].number = ''
- }
- })
- },
- // 状态
- procurementStatus(str, res) {
- const form = {
- isDelFlag: () => res == 1, // 是否删除
- isAchieve: () => res == 1, // 是否实现
- isAllTab: () => res === 0, // 是否在全部的tab栏下
- isSelfParticipationTab: () => res > 0, // 是否在已参与tab栏 是否在自已发布的tab中
- isInvolved: () => res === 2, // 是否我创建的
- isAdd: () => res === 1, // 是否参与
- }
- return form[str]()
- },
- // 图片是否上传
- isImageUrl: (url) => {
- if (url) return url.indexOf('none.jpg') > 0
- else return true
- },
- }
- }
|