|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<van-popover
|
|
|
v-model="showPopover"
|
|
|
+ v-if="canJoinBid"
|
|
|
:actions="actions"
|
|
|
trigger="click"
|
|
|
:placement="placement"
|
|
@@ -22,18 +23,38 @@
|
|
|
></AppIcon>
|
|
|
<template #text>参标管理</template>
|
|
|
</TabActionItem>
|
|
|
+ <van-popup
|
|
|
+ :style="popupHeight"
|
|
|
+ v-model="showBidStatus"
|
|
|
+ get-container="body"
|
|
|
+ round
|
|
|
+ position="bottom"
|
|
|
+ >
|
|
|
+ <bidStatusNode
|
|
|
+ @cancel-update="cancelUpdate"
|
|
|
+ @save-success="saveSuccess"
|
|
|
+ :project-cell-info="projectCellInfo"
|
|
|
+ @set-height="setHeight"
|
|
|
+ ></bidStatusNode>
|
|
|
+ </van-popup>
|
|
|
</template>
|
|
|
</van-popover>
|
|
|
</template>
|
|
|
<script>
|
|
|
import TabActionItem from '@/views/article/ui/TabActionItem.vue'
|
|
|
-import { Popover } from 'vant'
|
|
|
+import bidStatusNode from '@/components/bid-update/BidUpdate'
|
|
|
+import { Popover, Popup } from 'vant'
|
|
|
import { AppIcon } from '@/ui'
|
|
|
+import { getDetailBidIsJoin, ajaxCanBiaoAction } from '@/api/modules/'
|
|
|
+// import { openLinkOfOther } from '@/utils'
|
|
|
+// import { LINKS } from '@/data'
|
|
|
|
|
|
export default {
|
|
|
name: 'ActionInBidding',
|
|
|
components: {
|
|
|
[Popover.name]: Popover,
|
|
|
+ [Popup.name]: Popup,
|
|
|
+ bidStatusNode,
|
|
|
TabActionItem,
|
|
|
AppIcon
|
|
|
},
|
|
@@ -43,10 +64,6 @@ export default {
|
|
|
default: '',
|
|
|
required: true
|
|
|
},
|
|
|
- value: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
direction: {
|
|
|
type: String,
|
|
|
default: 'column',
|
|
@@ -64,10 +81,38 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
showPopover: false,
|
|
|
- actions: [{ text: '参标' }, { text: '终止参标' }]
|
|
|
+ // 参标弹窗相关
|
|
|
+ popupHeight: 'height: 440px',
|
|
|
+ showBidStatus: false,
|
|
|
+ canBiaoInfo: {
|
|
|
+ bidEndTime: 1711267101,
|
|
|
+ currentTime: 1711016637,
|
|
|
+ projectId: '',
|
|
|
+ showStopParticipate: false,
|
|
|
+ showParticipate: false,
|
|
|
+ showUpdate: false,
|
|
|
+ userName: ''
|
|
|
+ },
|
|
|
+ projectCellInfo: {
|
|
|
+ sid: ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ canJoinBid() {
|
|
|
+ return this.actions.length > 0
|
|
|
+ },
|
|
|
+ actions() {
|
|
|
+ const { showStopParticipate, showParticipate } = this.canBiaoInfo
|
|
|
+ const arr = []
|
|
|
+ if (showParticipate) {
|
|
|
+ arr.push({ text: '参标', value: 'join' })
|
|
|
+ }
|
|
|
+ if (showStopParticipate) {
|
|
|
+ arr.push({ text: '终止参标', value: 'stopJoin' })
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ },
|
|
|
calcOffset() {
|
|
|
if (this.placement === 'top-start') {
|
|
|
return [5, 10]
|
|
@@ -78,11 +123,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.getDetailBidIsJoin()
|
|
|
+ },
|
|
|
methods: {
|
|
|
onSelected(s) {
|
|
|
- console.log(s)
|
|
|
- this.doBidding()
|
|
|
+ if (s.value === 'join') {
|
|
|
+ this.doBidding()
|
|
|
+ } else {
|
|
|
+ this.cancelBidding()
|
|
|
+ }
|
|
|
},
|
|
|
showPopoverList(f = false) {
|
|
|
this.showPopover = f
|
|
@@ -90,6 +140,28 @@ export default {
|
|
|
changePopoverState() {
|
|
|
this.showPopoverList(!this.showPopover)
|
|
|
},
|
|
|
+ syncValue() {
|
|
|
+ this.$emit('change', {
|
|
|
+ ...this.canBiaoInfo
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getDetailBidIsJoin() {
|
|
|
+ this.projectCellInfo.sid = this.id
|
|
|
+ const { data, error_code: code } = await getDetailBidIsJoin({
|
|
|
+ sid: this.id
|
|
|
+ })
|
|
|
+ if (code === 0 && data) {
|
|
|
+ if (!data.bidEndTime) {
|
|
|
+ data.bidEndTime = 0
|
|
|
+ }
|
|
|
+ if (!data.currentTime) {
|
|
|
+ data.currentTime = 0
|
|
|
+ }
|
|
|
+ this.canBiaoInfo = data
|
|
|
+ this.syncValue()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 参标操作
|
|
|
async doBidding() {
|
|
|
if (this.beforeAction) {
|
|
|
const r = await this.beforeAction()
|
|
@@ -97,11 +169,75 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- // do something...
|
|
|
- this.syncValue(!this.value)
|
|
|
+ // if (!this.isLogin) {
|
|
|
+ // return openLinkOfOther(LINKS.APP登录页.app, {
|
|
|
+ // query: {
|
|
|
+ // to: 'back'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ this.projectCellInfo.sid = this.id
|
|
|
+ try {
|
|
|
+ const {
|
|
|
+ error_code: code,
|
|
|
+ data,
|
|
|
+ error_msg: msg
|
|
|
+ } = await ajaxCanBiaoAction('in', {
|
|
|
+ bidIds: this.id
|
|
|
+ })
|
|
|
+ if (code === 0 && data) {
|
|
|
+ this.$toast('已参标,请前往我的参标项目列表查看。')
|
|
|
+ this.showBidStatus = true
|
|
|
+ this.getDetailBidIsJoin()
|
|
|
+ } else {
|
|
|
+ this.$toast(msg || '参标失败,请重试。')
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async cancelBidding() {
|
|
|
+ this.projectCellInfo.sid = this.id
|
|
|
+ try {
|
|
|
+ const {
|
|
|
+ error_code: code,
|
|
|
+ data,
|
|
|
+ error_msg: msg
|
|
|
+ } = await ajaxCanBiaoAction('out', {
|
|
|
+ projectIds: this.id
|
|
|
+ })
|
|
|
+ if (code === 0 && data) {
|
|
|
+ this.$toast('已取消参标')
|
|
|
+ this.getDetailBidIsJoin()
|
|
|
+ } else {
|
|
|
+ this.$toast(msg || '取消参标失败,请重试。')
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setHeight(data) {
|
|
|
+ if (data === 2) {
|
|
|
+ if (this.$envs.inWX && this.$envs.inIOS) {
|
|
|
+ this.popupHeight = 'height: 596px;padding-bottom: 50px'
|
|
|
+ } else {
|
|
|
+ this.popupHeight = 'height: 546px'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.$envs.inWX && this.$envs.inIOS) {
|
|
|
+ this.popupHeight = 'height: 490px;padding-bottom: 50px'
|
|
|
+ } else {
|
|
|
+ this.popupHeight = 'height: 440px'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 取消更新投标状态
|
|
|
+ cancelUpdate() {
|
|
|
+ this.showBidStatus = false
|
|
|
},
|
|
|
- syncValue(v) {
|
|
|
- this.$emit('input', v)
|
|
|
+ // 更新投标状态成功
|
|
|
+ saveSuccess() {
|
|
|
+ this.showBidStatus = false
|
|
|
}
|
|
|
}
|
|
|
}
|