|
@@ -21,8 +21,8 @@
|
|
|
:procuretInfo="item"
|
|
|
@popupAdd="popupAdd"
|
|
|
@popupChange="popupChange"
|
|
|
- @proDelete='proDelete'
|
|
|
- @procureDetail='procureDetail'
|
|
|
+ @proDelete="proDelete"
|
|
|
+ @procureDetail="procureDetail"
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -62,7 +62,13 @@
|
|
|
</view>
|
|
|
<view style="position: relative;">
|
|
|
<view class="input_icon">¥</view>
|
|
|
- <input class="uni-input" type="number" focus v-model="joinData.price" />
|
|
|
+ <input
|
|
|
+ class="uni-input"
|
|
|
+ type="number"
|
|
|
+ focus
|
|
|
+ v-model="joinData.price"
|
|
|
+ @input="fpNumInput($event, 'joinData')"
|
|
|
+ />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="uni-form-item uni-column">
|
|
@@ -71,7 +77,13 @@
|
|
|
采购数量:
|
|
|
</view>
|
|
|
<view style="position: relative;">
|
|
|
- <input class="uni-input" type="number" focus v-model="joinData.number" />
|
|
|
+ <input
|
|
|
+ class="uni-input"
|
|
|
+ type="number"
|
|
|
+ focus
|
|
|
+ v-model="joinData.number"
|
|
|
+ @input="NumberInput($event, 'joinData')"
|
|
|
+ />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="submit_btn">
|
|
@@ -94,11 +106,12 @@
|
|
|
import proCard from './components/procurement_card.vue'
|
|
|
import jumpMixins from '@/mixins/jumpMixins.js'
|
|
|
import { mapState } from 'vuex'
|
|
|
+import procurementMixins from './mixins/procurementMixins.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
proCard
|
|
|
},
|
|
|
- mixins: [jumpMixins],
|
|
|
+ mixins: [jumpMixins, procurementMixins],
|
|
|
data() {
|
|
|
return {
|
|
|
skeletonShow: true, // loading
|
|
@@ -133,20 +146,21 @@ export default {
|
|
|
plain: false
|
|
|
}
|
|
|
],
|
|
|
- // 组件传递集采需求
|
|
|
- proDataInfo: {},
|
|
|
+ proDataInfo: {}, // 弹窗prodata
|
|
|
popupShow: false, // 底部上移栏
|
|
|
loadding: true, // 下拉刷新
|
|
|
pullUpOn: true, // 下拉刷新
|
|
|
// 分页参数
|
|
|
pageInfo: {
|
|
|
pageNo: 1,
|
|
|
- pageSize: 10
|
|
|
+ pageSize: 10,
|
|
|
+ userId: '',
|
|
|
+ status: 0
|
|
|
},
|
|
|
// 我参与的数据请求
|
|
|
participate: {
|
|
|
userId: '',
|
|
|
- procurementType: 0,
|
|
|
+ procurementType: 0
|
|
|
},
|
|
|
// 删除退出
|
|
|
deleteData: {
|
|
@@ -157,25 +171,11 @@ export default {
|
|
|
// 所有数据
|
|
|
procurementList: [],
|
|
|
// 下拉刷新
|
|
|
- nomoreText: '已经被掏空了~',
|
|
|
+ nomoreText: '已经没有了~',
|
|
|
userInfo: {},
|
|
|
isLastPage: false, // 是否是最后一页
|
|
|
joinData: {}, // 我要参与
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- currentTab(val) {
|
|
|
- this.loadding = true
|
|
|
- this.pullUpOn = true
|
|
|
- this.pageInfo.pageNo =1
|
|
|
- if (val>0) {
|
|
|
- this.participate.procurementType = --val
|
|
|
- this.procurementTabChange()
|
|
|
- } else {
|
|
|
- this.isLastPage = false
|
|
|
- this.pageInfo.pageNo = 1
|
|
|
- this.procurementAllList()
|
|
|
- }
|
|
|
+ isEditDetail: false // 是否修改详情
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -183,44 +183,54 @@ export default {
|
|
|
...mapState(['hasLogin'])
|
|
|
},
|
|
|
onShow() {
|
|
|
- if (uni.getStorageSync('userInfo')) {
|
|
|
- this.userInfo = uni.getStorageSync('userInfo')
|
|
|
- this.pageInfo.userId = this.userInfo.userId
|
|
|
- this.participate.userId = this.userInfo.userId
|
|
|
- this.procurementAllList()
|
|
|
- } else {
|
|
|
- this.$api.redirectTo('/pages/login/login')
|
|
|
+ if(this.hasLogin){
|
|
|
+ this.userInfo = uni.getStorageSync('userInfo')
|
|
|
+ this.pageInfo.userId = this.userInfo.userId
|
|
|
+ this.participate.userId = this.userInfo.userId
|
|
|
+ this.procurementAllList()
|
|
|
+ }else{
|
|
|
+ this.$api.redirectTo('/pages/login/login')
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
- uni.$on('refreshAddData',() => {
|
|
|
+ uni.$on('refreshAddData', () => {
|
|
|
this.procurementAllAddList()
|
|
|
})
|
|
|
- uni.$on('refreshChangeData', () => {
|
|
|
- this.procurementTabChange()
|
|
|
- })
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
if (!this.isLastPage) {
|
|
|
- this.pageInfo.pageNo+=1
|
|
|
+ this.loadding = true
|
|
|
+ this.pullUpOn = true
|
|
|
+ this.pageInfo.pageNo += 1
|
|
|
this.procurementAllList()
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.procurementList = []
|
|
|
+ this.procurementAllList()
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ },
|
|
|
methods: {
|
|
|
// tab 切换
|
|
|
handlerTabs($event) {
|
|
|
+ this.isLastPage = false
|
|
|
+ this.procurementList = []
|
|
|
this.currentTab = $event.index
|
|
|
+ this.loadding = true
|
|
|
+ this.pullUpOn = true
|
|
|
+ this.pageInfo.pageNo = 1
|
|
|
+ this.pageInfo.status = $event.index
|
|
|
+ this.procurementAllList()
|
|
|
},
|
|
|
// 弹窗确认或取消
|
|
|
handleClick($event) {
|
|
|
if ($event.index === 1) {
|
|
|
- if(this.proDataInfo.isInvolved === 1) {
|
|
|
+ if (this.proDataInfo.isInvolved === 1) {
|
|
|
// 退出参与
|
|
|
- this.procurementUpdate(1)
|
|
|
- } else{
|
|
|
+ this.procurementUpdate(1, this.proDataInfo.sid)
|
|
|
+ } else {
|
|
|
// 删除
|
|
|
- this.procurementUpdate(0)
|
|
|
+ this.procurementUpdate(0, this.proDataInfo.id)
|
|
|
}
|
|
|
}
|
|
|
this.modal = false
|
|
@@ -238,18 +248,18 @@ export default {
|
|
|
},
|
|
|
// 我要参与
|
|
|
popupAdd($event) {
|
|
|
- this.joinData = Object.assign($event, {number: '', price: '', userId: this.userInfo.userId})
|
|
|
+ this.joinData = Object.assign($event, { userId: this.userInfo.userId })
|
|
|
this.popupShow = true
|
|
|
},
|
|
|
// 修改
|
|
|
popupChange($event) {
|
|
|
this.joinData = $event
|
|
|
console.log($event)
|
|
|
- if(this.joinData.isInvolved === 1) {
|
|
|
+ if (this.joinData.isInvolved === 1) {
|
|
|
this.procurementEditData()
|
|
|
} else {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/goods/procurementAdd?id='+$event.sid
|
|
|
+ url: '/pages/goods/procurementAdd?id=' + $event.id
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -268,7 +278,7 @@ export default {
|
|
|
// 详情
|
|
|
procureDetail($event) {
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/goods/procurement_info?id=${$event.sid}&proTabId=${this.currentTab}`
|
|
|
+ url: `/pages/goods/procurement_info?id=${$event.id}&proTabId=${this.currentTab}`
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
@@ -278,11 +288,11 @@ export default {
|
|
|
async procurementAllList() {
|
|
|
if (!this.isLastPage) {
|
|
|
try {
|
|
|
- const {data} = await this.ProcurementService.procurementAllList(this.pageInfo)
|
|
|
- this.procurementList = data.list
|
|
|
- this.isLastPage = data.isLastPage
|
|
|
- this.loadding = !data.isLastPage
|
|
|
- this.pullUpOn = !data.isLastPage
|
|
|
+ const { data } = await this.ProcurementService.procurementAllList(this.pageInfo)
|
|
|
+ this.procurementList = [...this.procurementList, ...data.list]
|
|
|
+ this.isLastPage = data.total === this.procurementList.length
|
|
|
+ this.loadding = !this.isLastPage
|
|
|
+ this.pullUpOn = !this.isLastPage
|
|
|
this.skeletonShow = false
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
@@ -294,36 +304,25 @@ export default {
|
|
|
const form = {
|
|
|
pageNo: 1,
|
|
|
userId: this.userInfo.userId,
|
|
|
- pageSize: this.pageInfo.pageNo*this.pageInfo.pageSize
|
|
|
+ pageSize: this.pageInfo.pageNo * this.pageInfo.pageSize,
|
|
|
+ status: this.currentTab
|
|
|
}
|
|
|
try {
|
|
|
- const {data} = await this.ProcurementService.procurementAllList(form)
|
|
|
+ const { data } = await this.ProcurementService.procurementAllList(form)
|
|
|
this.procurementList = data.list
|
|
|
- this.isLastPage = data.isLastPage
|
|
|
- this.loadding = !data.isLastPage
|
|
|
- this.pullUpOn = !data.isLastPage
|
|
|
+ this.isLastPage = data.total === this.procurementList.length
|
|
|
+ this.loadding = !this.isLastPage
|
|
|
+ this.pullUpOn = !this.isLastPage
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
},
|
|
|
- // 我参与的 | 我发起的
|
|
|
- async procurementTabChange() {
|
|
|
- try{
|
|
|
- const {data} = await this.ProcurementService.procurementTabChange(this.participate)
|
|
|
- this.procurementList = data
|
|
|
- this.loadding = false
|
|
|
- this.pullUpOn = false
|
|
|
- this.skeletonShow = false
|
|
|
- }catch(error){
|
|
|
- console.log(error)
|
|
|
- }
|
|
|
- },
|
|
|
// 我要参与
|
|
|
async procurementParticipate() {
|
|
|
- if(this.joinData.price === '') {
|
|
|
+ if (this.joinData.price === '') {
|
|
|
return this.$util.msg('请输入期望单价', 2000)
|
|
|
}
|
|
|
- if(this.joinData.number === '') {
|
|
|
+ if (this.joinData.number === '') {
|
|
|
return this.$util.msg('请输入期望数量', 2000)
|
|
|
}
|
|
|
const form = {
|
|
@@ -331,39 +330,42 @@ export default {
|
|
|
productImage: this.joinData.productImage,
|
|
|
productName: this.joinData.productName,
|
|
|
price: this.joinData.price,
|
|
|
- number: this.joinData.number
|
|
|
+ number: this.joinData.number,
|
|
|
+ status: 0,
|
|
|
+ id: this.joinData.id
|
|
|
+ }
|
|
|
+ if (this.joinData.isInvolved === 1) {
|
|
|
+ form.id = this.joinData.sid
|
|
|
+ form.status = 1 // 0参与 1 修改
|
|
|
}
|
|
|
- try{
|
|
|
+ try {
|
|
|
const data = await this.ProcurementService.procurementParticipate(form)
|
|
|
- if (this.joinData.isInvolved === 0) {
|
|
|
- this.procurementAllAddList()
|
|
|
- } else {
|
|
|
- this.procurementTabChange()
|
|
|
- }
|
|
|
+ this.procurementAllAddList()
|
|
|
this.popupShow = false
|
|
|
+ this.isEditDetail = false
|
|
|
uni.showToast({
|
|
|
- title:`${this.joinData.isInvolved === 0 ? '参与' : '修改'}成功`,
|
|
|
+ title: `${this.joinData.procurePo.isInvolved === 0 ? '参与' : '修改'}成功`,
|
|
|
icon: 'success'
|
|
|
})
|
|
|
- }catch(error){
|
|
|
+ } catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
},
|
|
|
// 删除 退出
|
|
|
- async procurementUpdate(type) {
|
|
|
+ async procurementUpdate(type, id) {
|
|
|
const form = {
|
|
|
- id: `${this.proDataInfo.sid}`,
|
|
|
+ id: `${this.proDataInfo.id}`,
|
|
|
userId: this.userInfo.userId,
|
|
|
procurementType: type
|
|
|
}
|
|
|
- try{
|
|
|
+ try {
|
|
|
await this.ProcurementService.procurementUpdate(form)
|
|
|
- this.procurementTabChange()
|
|
|
+ this.procurementAllAddList()
|
|
|
uni.showToast({
|
|
|
title: `${type === 0 ? '删除' : '退出'}成功`,
|
|
|
icon: 'success'
|
|
|
})
|
|
|
- }catch(error){
|
|
|
+ } catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
},
|
|
@@ -374,11 +376,11 @@ export default {
|
|
|
userId: this.userInfo.userId,
|
|
|
procurementType: 0
|
|
|
}
|
|
|
- try{
|
|
|
+ try {
|
|
|
const data = await this.ProcurementService.procurementEditData(form)
|
|
|
this.joinData = data.data
|
|
|
this.popupShow = true
|
|
|
- }catch(error){
|
|
|
+ } catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
}
|