123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- 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, name) {
- const o = e.target
- const inputRule = /[^\d.]/g //修改inputRule 的值
- this.$nextTick(() => {
- this[str][name] = o.value.replace(inputRule, '')
- if (o.value[0] == '.') {
- this[str][name] = ''
- } else if (o.value[0] == '0' && o.value[1] == '0') {
- this[str][name] = '0'
- }
- this[str][name] = this[str][name].replace('.', '$#$').replace(/\./g, '').replace('$#$', '.') // 只能输入一个小数点
- })
- },
- // 校验 只能输入数字
- NumberInput(e, str, name) {
- const o = e.target
- const inputRule = /[^\d]/g //修改inputRule 的值
- this.$nextTick(() => {
- this[str][name] = o.value.replace(inputRule, '')
- if (o.value[0] == '0') {
- this[str][name] = ''
- }
- })
- },
- // 状态
- 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
- },
- // 全部集采
- async procurementAllAddList() {
- const form = {
- pageNo: 1,
- userId: this.userInfo.userId,
- pageSize: this.pageInfo.pageNo * this.pageInfo.pageSize,
- status: this.currentTab
- }
- try {
- const { data } = await this.ProcurementService.procurementAllList(form)
- this.procurementList = data.list
- this.isLastPage = data.total === this.procurementList.length
- this.loadding = !this.isLastPage
- this.pullUpOn = !this.isLastPage
- } catch (error) {
- console.log(error)
- }
- },
- // 我要参与
- async procurementParticipate($event, callback) {
- if ($event.price === '') return this.$util.msg('请输入期望单价', 2000)
- if ($event.number === '') return this.$util.msg('请输入采购数量', 2000)
- const form = {
- userId: this.userInfo.userId,
- productImage: $event.productImage,
- productName: $event.productName,
- price: $event.price,
- number: $event.number,
- status: 0,
- id: $event.id,
- userName: this.userInfo.name
- }
- if ($event.isInvolved === 1) {
- form.id = $event.id
- form.status = 1 // 0参与 1 修改
- }
- try {
- await this.ProcurementService.procurementParticipate(form)
- callback && callback()
- uni.showToast({
- title: `${$event.isInvolved === 0 ? '参与' : '修改'}成功`,
- icon: 'success'
- })
- this.popupShow=false
- } catch (error) {
- console.log(error)
- }
- },
- // 参与集采详情
- async procurementEditData() {
- const form = {
- id: `${this.procurement.sid}`,
- userId: this.userInfo.userId,
- procurementType: 0
- }
- try {
- const { data } = await this.ProcurementService.procurementEditData(form)
- this.joinData = data
- this.popupShow = true
- } catch (error) {
- console.log(error)
- }
- },
- // 删除 退出
- async procurementUpdate(type, callback) {
- const form = {
- id: `${type === 0 ? this.procurement.id : this.procurement.sid}`,
- userId: this.userInfo.userId,
- procurementType: type
- }
- try {
- await this.ProcurementService.procurementUpdate(form)
- callback && callback()
- uni.showToast({
- title: `${type === 0 ? '删除' : '退出'}成功`,
- icon: 'success'
- })
- } catch (error) {
- console.log(error)
- }
- },
- }
- }
|