|
@@ -1,13 +1,14 @@
|
|
<script setup>
|
|
<script setup>
|
|
import {
|
|
import {
|
|
ref,
|
|
ref,
|
|
- watch,
|
|
|
|
computed,
|
|
computed,
|
|
nextTick,
|
|
nextTick,
|
|
getCurrentInstance,
|
|
getCurrentInstance,
|
|
- onMounted
|
|
|
|
|
|
+ onMounted,
|
|
|
|
+ onUnmounted,
|
|
|
|
+ toRef
|
|
} from 'vue'
|
|
} from 'vue'
|
|
-import { ajaxGetReportBtnStatus } from '@/api/modules'
|
|
|
|
|
|
+import { ajaxGetReportBtnStatus, ajaxReportEquityDeduct } from '@/api/modules'
|
|
|
|
|
|
const that = getCurrentInstance().proxy
|
|
const that = getCurrentInstance().proxy
|
|
|
|
|
|
@@ -17,10 +18,6 @@ const props = defineProps({
|
|
type: String,
|
|
type: String,
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
- status: {
|
|
|
|
- type: String,
|
|
|
|
- default: '' // month: 月卡 season: 季卡 year: 年卡
|
|
|
|
- },
|
|
|
|
// 采购单位名称
|
|
// 采购单位名称
|
|
buyerName: {
|
|
buyerName: {
|
|
type: String,
|
|
type: String,
|
|
@@ -55,7 +52,8 @@ const btnList = [
|
|
icon: 'icon-img-download',
|
|
icon: 'icon-img-download',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/unit',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/unit',
|
|
visible: false,
|
|
visible: false,
|
|
- showPopover: false
|
|
|
|
|
|
+ showPopover: false,
|
|
|
|
+ mold: 3
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'competitor',
|
|
type: 'competitor',
|
|
@@ -63,7 +61,8 @@ const btnList = [
|
|
icon: 'icon-img-download-white',
|
|
icon: 'icon-img-download-white',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/competitor',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/competitor',
|
|
visible: false,
|
|
visible: false,
|
|
- showPopover: false
|
|
|
|
|
|
+ showPopover: false,
|
|
|
|
+ mold: 2
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'project',
|
|
type: 'project',
|
|
@@ -71,20 +70,21 @@ const btnList = [
|
|
icon: 'icon-img-download',
|
|
icon: 'icon-img-download',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/project',
|
|
url: '/swordfish/page_big_pc/order/analysis-report/project',
|
|
visible: false,
|
|
visible: false,
|
|
- showPopover: false
|
|
|
|
|
|
+ showPopover: false,
|
|
|
|
+ mold: 1
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|
|
const statusMap = {
|
|
const statusMap = {
|
|
- month: {
|
|
|
|
|
|
+ 1: {
|
|
text: '月卡VIP',
|
|
text: '月卡VIP',
|
|
bg: 'bg-member-month'
|
|
bg: 'bg-member-month'
|
|
},
|
|
},
|
|
- season: {
|
|
|
|
|
|
+ 2: {
|
|
text: '季卡VIP',
|
|
text: '季卡VIP',
|
|
bg: 'bg-member-season'
|
|
bg: 'bg-member-season'
|
|
},
|
|
},
|
|
- year: {
|
|
|
|
|
|
+ 3: {
|
|
text: '年卡VIP',
|
|
text: '年卡VIP',
|
|
bg: 'bg-member-year'
|
|
bg: 'bg-member-year'
|
|
}
|
|
}
|
|
@@ -96,6 +96,10 @@ const buyerReportId = ref('')
|
|
const competitorReportId = ref({})
|
|
const competitorReportId = ref({})
|
|
const discountMsg = ref('')
|
|
const discountMsg = ref('')
|
|
const reportBtnList = ref([])
|
|
const reportBtnList = ref([])
|
|
|
|
+const bubbleLeft = ref('10px')
|
|
|
|
+const bubbleTimer = ref(null)
|
|
|
|
+const bubbleText = ref('')
|
|
|
|
+const packageInfo = toRef({})
|
|
|
|
|
|
const entNameList = computed(() => {
|
|
const entNameList = computed(() => {
|
|
return props.winnerName.split(',') || []
|
|
return props.winnerName.split(',') || []
|
|
@@ -106,6 +110,10 @@ const showBanner = computed(() => {
|
|
return reportBtnList.value.length > 0
|
|
return reportBtnList.value.length > 0
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+const isPackage = computed(() => {
|
|
|
|
+ return packageInfo.value?.zmStatus && packageInfo.value?.zmStatus > 0
|
|
|
|
+})
|
|
|
|
+
|
|
const getReportId = (type, entName) => {
|
|
const getReportId = (type, entName) => {
|
|
let reportId = ''
|
|
let reportId = ''
|
|
switch (type) {
|
|
switch (type) {
|
|
@@ -123,6 +131,23 @@ const getReportId = (type, entName) => {
|
|
}
|
|
}
|
|
return reportId
|
|
return reportId
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+const getReportMold = (type) => {
|
|
|
|
+ let mold = 0
|
|
|
|
+ switch (type) {
|
|
|
|
+ case 'project':
|
|
|
|
+ mold = 1
|
|
|
|
+ break
|
|
|
|
+ case 'competitor':
|
|
|
|
+ mold = 2
|
|
|
|
+ break
|
|
|
|
+ case 'buyer':
|
|
|
|
+ mold = 3
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ return mold
|
|
|
|
+}
|
|
|
|
+
|
|
const handleDownload = (item) => {
|
|
const handleDownload = (item) => {
|
|
if (item.type === 'competitor' && entNameList.value.length > 1) {
|
|
if (item.type === 'competitor' && entNameList.value.length > 1) {
|
|
item.showPopover = !item.showPopover
|
|
item.showPopover = !item.showPopover
|
|
@@ -139,15 +164,27 @@ const handleDownload = (item) => {
|
|
`/swordfish/page_big_pc/report/analysis/detail?id=${reportId}`
|
|
`/swordfish/page_big_pc/report/analysis/detail?id=${reportId}`
|
|
)
|
|
)
|
|
} else {
|
|
} else {
|
|
- // 没购买过跳到购买页
|
|
|
|
- if (item.type === 'project') {
|
|
|
|
- // 项目分析报告 name: 项目名称(下单展示用),buyer:采购单位名称(下单接口参数用)
|
|
|
|
- window.open(
|
|
|
|
- `${item.url}?name=${item.name}&id=${props.bId}&buyer=${props.buyerName}`
|
|
|
|
- )
|
|
|
|
- } else {
|
|
|
|
- window.open(`${item.url}?name=${item.name}&id=${props.bId}`)
|
|
|
|
- }
|
|
|
|
|
|
+ // 买过套餐权益则抵扣次数
|
|
|
|
+ deductPackage(item, (code, data) => {
|
|
|
|
+ console.log(code, data)
|
|
|
|
+ debugger
|
|
|
|
+ if (code === 0 && data?.id) {
|
|
|
|
+ // 抵扣成功 生成报告id
|
|
|
|
+ window.open(
|
|
|
|
+ `/swordfish/page_big_pc/report/analysis/detail?id=${data}`
|
|
|
|
+ )
|
|
|
|
+ } else {
|
|
|
|
+ // 没购买过跳到购买页
|
|
|
|
+ if (item.type === 'project') {
|
|
|
|
+ // 项目分析报告 name: 项目名称(下单展示用),buyer:采购单位名称(下单接口参数用)
|
|
|
|
+ window.open(
|
|
|
|
+ `${item.url}?name=${item.name}&id=${props.bId}&buyer=${props.buyerName}`
|
|
|
|
+ )
|
|
|
|
+ } else {
|
|
|
|
+ window.open(`${item.url}?name=${item.name}&id=${props.bId}`)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -160,8 +197,21 @@ const onClickCompetitor = (ent, parent) => {
|
|
// 有报告id即为已购买过该报告,跳转到报告预览页面
|
|
// 有报告id即为已购买过该报告,跳转到报告预览页面
|
|
window.open(`/swordfish/page_big_pc/report/analysis/detail?id=${reportId}`)
|
|
window.open(`/swordfish/page_big_pc/report/analysis/detail?id=${reportId}`)
|
|
} else {
|
|
} else {
|
|
- // 没购买过跳到购买页
|
|
|
|
- window.open(`${parent.url}?name=${ent}&id=${props.bId}`)
|
|
|
|
|
|
+ const item = {
|
|
|
|
+ type: 'competitor',
|
|
|
|
+ name: ent
|
|
|
|
+ }
|
|
|
|
+ // 套餐抵扣次数
|
|
|
|
+ deductPackage(item, (code, data) => {
|
|
|
|
+ if (code === 0 && data) {
|
|
|
|
+ window.open(`/swordfish/page_big_pc/report/analysis/detail?id=${data}`)
|
|
|
|
+ // 重新获取报告按钮状态
|
|
|
|
+ getReportBtnStatus()
|
|
|
|
+ } else {
|
|
|
|
+ // 没购买过||抵扣失败跳到购买页
|
|
|
|
+ window.open(`${parent.url}?name=${ent}&id=${props.bId}`)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 获取报告入口按钮状态
|
|
// 获取报告入口按钮状态
|
|
@@ -181,27 +231,34 @@ const getReportBtnStatus = async () => {
|
|
buyer_report_id,
|
|
buyer_report_id,
|
|
ent_report_ids = {},
|
|
ent_report_ids = {},
|
|
project_report_id,
|
|
project_report_id,
|
|
- ent_crn
|
|
|
|
|
|
+ ent_crn,
|
|
|
|
+ guidingCopy,
|
|
|
|
+ zmAnalysis
|
|
} = data
|
|
} = data
|
|
entCrnMap.value = ent_crn
|
|
entCrnMap.value = ent_crn
|
|
projectReportId.value = project_report_id
|
|
projectReportId.value = project_report_id
|
|
buyerReportId.value = buyer_report_id
|
|
buyerReportId.value = buyer_report_id
|
|
competitorReportId.value = ent_report_ids
|
|
competitorReportId.value = ent_report_ids
|
|
discountMsg.value = discount_msg
|
|
discountMsg.value = discount_msg
|
|
|
|
+ packageInfo.value = zmAnalysis
|
|
const list = btnList.map((item) => {
|
|
const list = btnList.map((item) => {
|
|
if (item.type === 'buyer') {
|
|
if (item.type === 'buyer') {
|
|
item.visible = buyer_report_button
|
|
item.visible = buyer_report_button
|
|
item.name = props.buyerName
|
|
item.name = props.buyerName
|
|
|
|
+ item.marketText = guidingCopy?.buyer
|
|
} else if (item.type === 'competitor') {
|
|
} else if (item.type === 'competitor') {
|
|
item.visible = ent_report_button
|
|
item.visible = ent_report_button
|
|
item.name = props.winnerName
|
|
item.name = props.winnerName
|
|
|
|
+ item.marketText = guidingCopy?.ent
|
|
} else if (item.type === 'project') {
|
|
} else if (item.type === 'project') {
|
|
item.visible = project_report_button
|
|
item.visible = project_report_button
|
|
item.name = props.projectName
|
|
item.name = props.projectName
|
|
|
|
+ item.marketText = guidingCopy?.project
|
|
}
|
|
}
|
|
return item
|
|
return item
|
|
})
|
|
})
|
|
reportBtnList.value = list.filter((v) => v.visible)
|
|
reportBtnList.value = list.filter((v) => v.visible)
|
|
|
|
+ startBubbleAnimation()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const onClickOutSide = () => {
|
|
const onClickOutSide = () => {
|
|
@@ -209,9 +266,54 @@ const onClickOutSide = () => {
|
|
v.showPopover = false
|
|
v.showPopover = false
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+const startBubbleAnimation = () => {
|
|
|
|
+ const btnLen = reportBtnList.value.length
|
|
|
|
+ if (btnLen === 0) return
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ const btnRefs = that.$refs.reportBtn
|
|
|
|
+ let currentIndex = 0
|
|
|
|
+ if (bubbleTimer.value) clearInterval(bubbleTimer.value)
|
|
|
|
+ if (btnLen === 1) {
|
|
|
|
+ bubbleLeft.value = '10px'
|
|
|
|
+ bubbleText.value = reportBtnList.value[0].marketText
|
|
|
|
+ } else {
|
|
|
|
+ bubbleText.value = reportBtnList.value[0].marketText
|
|
|
|
+ bubbleTimer.value = setInterval(() => {
|
|
|
|
+ currentIndex = (currentIndex + 1) % btnLen
|
|
|
|
+ const btn = btnRefs[currentIndex]
|
|
|
|
+ if (btn) {
|
|
|
|
+ bubbleLeft.value = btn?.offsetLeft - 10 + 'px'
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ bubbleText.value = reportBtnList.value[currentIndex].marketText
|
|
|
|
+ }, 300)
|
|
|
|
+ }
|
|
|
|
+ }, 2500)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 套餐扣除
|
|
|
|
+const deductPackage = async (item, callback) => {
|
|
|
|
+ const { type, name } = item
|
|
|
|
+ const params = {
|
|
|
|
+ ent_name: type === 'competitor' ? name : '',
|
|
|
|
+ buyer: type !== 'competitor' ? props.buyerName : '',
|
|
|
|
+ report_mold: getReportMold(type),
|
|
|
|
+ project_name: type === 'project' ? props.projectName : '',
|
|
|
|
+ bidding_id: props.topType === '招标' ? props.bId : ''
|
|
|
|
+ }
|
|
|
|
+ const { error_code: code, data } = await ajaxReportEquityDeduct(params)
|
|
|
|
+ callback && callback(code, data)
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getReportBtnStatus()
|
|
getReportBtnStatus()
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+onUnmounted(() => {
|
|
|
|
+ if (bubbleTimer.value) clearInterval(bubbleTimer.value)
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
<template>
|
|
<template>
|
|
<div
|
|
<div
|
|
@@ -227,14 +329,14 @@ onMounted(() => {
|
|
/>
|
|
/>
|
|
<img class="zhima-logo" src="@/assets/images/logo/zhima-logo.png" />
|
|
<img class="zhima-logo" src="@/assets/images/logo/zhima-logo.png" />
|
|
<span
|
|
<span
|
|
- v-if="status"
|
|
|
|
|
|
+ v-if="isPackage"
|
|
class="member-status"
|
|
class="member-status"
|
|
- :class="statusMap[status].bg"
|
|
|
|
- >{{ statusMap[status].text }}</span
|
|
|
|
|
|
+ :class="statusMap[packageInfo.zmStatus].bg"
|
|
|
|
+ >{{ statusMap[packageInfo.zmStatus].text }}</span
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
<div v-if="discountMsg" class="discount-container">
|
|
<div v-if="discountMsg" class="discount-container">
|
|
- <span>{{ discountMsg }}</span>
|
|
|
|
|
|
+ <span :class="{ 'gray-text': isPackage }" v-html="discountMsg"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
@@ -267,6 +369,7 @@ onMounted(() => {
|
|
class="flex flex-items-center report-btn"
|
|
class="flex flex-items-center report-btn"
|
|
slot="reference"
|
|
slot="reference"
|
|
@click="handleDownload(item, index)"
|
|
@click="handleDownload(item, index)"
|
|
|
|
+ :ref="'reportBtn'"
|
|
>
|
|
>
|
|
<span>{{ item.text }}</span>
|
|
<span>{{ item.text }}</span>
|
|
<i class="j-icon j-icon-base icon-img-download"></i>
|
|
<i class="j-icon j-icon-base icon-img-download"></i>
|
|
@@ -274,6 +377,9 @@ onMounted(() => {
|
|
</button>
|
|
</button>
|
|
</el-popover>
|
|
</el-popover>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-show="bubbleText" class="bubble" :style="{ left: bubbleLeft }">
|
|
|
|
+ {{ bubbleText }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -301,6 +407,9 @@ onMounted(() => {
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
line-height: 18px;
|
|
line-height: 18px;
|
|
color: $color_main;
|
|
color: $color_main;
|
|
|
|
+ .gray-text {
|
|
|
|
+ color: #999999;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.member-status {
|
|
.member-status {
|
|
padding: 2px 8px;
|
|
padding: 2px 8px;
|
|
@@ -385,6 +494,18 @@ onMounted(() => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ .bubble {
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: -14px;
|
|
|
|
+ //left: 10px;
|
|
|
|
+ background: linear-gradient(101.8deg, #2abed1 0%, #0a6cff 100%);
|
|
|
|
+ padding: 1px 8px;
|
|
|
|
+ border-radius: 8px 2px 8px 2px;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ line-height: 18px;
|
|
|
|
+ color: #fff;
|
|
|
|
+ transition: left 0.5s ease-in-out;
|
|
|
|
+ }
|
|
::v-deep {
|
|
::v-deep {
|
|
.report-btn-popover {
|
|
.report-btn-popover {
|
|
padding: 0 !important;
|
|
padding: 0 !important;
|