|
@@ -9,12 +9,13 @@ import {
|
|
toRef
|
|
toRef
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import { ajaxGetReportBtnStatus, ajaxReportEquityDeduct } from '@/api/modules'
|
|
import { ajaxGetReportBtnStatus, ajaxReportEquityDeduct } from '@/api/modules'
|
|
|
|
+import { debounce } from '@/utils/'
|
|
|
|
|
|
const that = getCurrentInstance().proxy
|
|
const that = getCurrentInstance().proxy
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
// 来源 ent: 企业画像;unit: 采购单位画像;article: 标讯详情 detail: 项目详情
|
|
// 来源 ent: 企业画像;unit: 采购单位画像;article: 标讯详情 detail: 项目详情
|
|
- source: {
|
|
|
|
|
|
+ from: {
|
|
type: String,
|
|
type: String,
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
@@ -114,6 +115,31 @@ const isPackage = computed(() => {
|
|
return packageInfo.value?.zmStatus && packageInfo.value?.zmStatus > 0
|
|
return packageInfo.value?.zmStatus && packageInfo.value?.zmStatus > 0
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+const discountText = computed(() => {
|
|
|
|
+ const packageType = packageInfo.value?.zmStatus
|
|
|
|
+ const expiredDay = packageInfo.value?.expiredDay
|
|
|
|
+ const balance = packageInfo.value?.zmNumber
|
|
|
|
+ // const total = packageInfo.value?.zmAllNumber
|
|
|
|
+ const price = packageInfo.value?.comboOne
|
|
|
|
+
|
|
|
|
+ if (packageType > 0) {
|
|
|
|
+ if (balance > 0) {
|
|
|
|
+ return `<div class="gray-text">本月剩余报告下载额度:<em class="highlight-text">${balance}</em>份</div>`
|
|
|
|
+ } else {
|
|
|
|
+ return `<div class="gray-text">本月免费额度已用完,可享权益特价:<span class="highlight-text">${price}/份</span></div>`
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ // packageType < 0:套餐过期天数
|
|
|
|
+ // 其他:首购优惠等
|
|
|
|
+ if (packageType < 0 && expiredDay) {
|
|
|
|
+ return `<div class="highlight-text">您的权益已过期${expiredDay}天,开通权益享特惠</div>`
|
|
|
|
+ } else {
|
|
|
|
+ return `<div class="highlight-text">${discountMsg.value}</div>`
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ''
|
|
|
|
+})
|
|
|
|
+
|
|
const getReportId = (type, entName) => {
|
|
const getReportId = (type, entName) => {
|
|
let reportId = ''
|
|
let reportId = ''
|
|
switch (type) {
|
|
switch (type) {
|
|
@@ -148,7 +174,7 @@ const getReportMold = (type) => {
|
|
return mold
|
|
return mold
|
|
}
|
|
}
|
|
|
|
|
|
-const handleDownload = (item) => {
|
|
|
|
|
|
+const handleDownload = debounce((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
|
|
that.$forceUpdate()
|
|
that.$forceUpdate()
|
|
@@ -166,9 +192,7 @@ const handleDownload = (item) => {
|
|
} else {
|
|
} else {
|
|
// 买过套餐权益则抵扣次数
|
|
// 买过套餐权益则抵扣次数
|
|
deductPackage(item, (code, data) => {
|
|
deductPackage(item, (code, data) => {
|
|
- console.log(code, data)
|
|
|
|
- debugger
|
|
|
|
- if (code === 0 && data?.id) {
|
|
|
|
|
|
+ if (code === 0 && data) {
|
|
// 抵扣成功 生成报告id
|
|
// 抵扣成功 生成报告id
|
|
window.open(
|
|
window.open(
|
|
`/swordfish/page_big_pc/report/analysis/detail?id=${data}`
|
|
`/swordfish/page_big_pc/report/analysis/detail?id=${data}`
|
|
@@ -187,7 +211,7 @@ const handleDownload = (item) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}, 300)
|
|
const onClickCompetitor = (ent, parent) => {
|
|
const onClickCompetitor = (ent, parent) => {
|
|
if (!entCrnMap.value[ent]) return
|
|
if (!entCrnMap.value[ent]) return
|
|
parent.showPopover = false
|
|
parent.showPopover = false
|
|
@@ -217,6 +241,11 @@ const onClickCompetitor = (ent, parent) => {
|
|
// 获取报告入口按钮状态
|
|
// 获取报告入口按钮状态
|
|
const getReportBtnStatus = async () => {
|
|
const getReportBtnStatus = async () => {
|
|
if (!props.bId && !props.buyerName && !props.winnerName) return
|
|
if (!props.bId && !props.buyerName && !props.winnerName) return
|
|
|
|
+ /**
|
|
|
|
+ * 项目分析报告需要bidding_id和采购单位名称,同时不是招标类型调接口时则不会传bidding_id,为了区分采购单位画像只需传采购单位的场景(采购单位分析报告),
|
|
|
|
+ * 如果是项目详情页面且不是招标类型的跳出 不再调用接口
|
|
|
|
+ */
|
|
|
|
+ if (props.from === 'detail' && props.topType !== '招标') return
|
|
const { error_code: code, data } = await ajaxGetReportBtnStatus({
|
|
const { error_code: code, data } = await ajaxGetReportBtnStatus({
|
|
bidding_id: props.topType === '招标' ? props.bId : '',
|
|
bidding_id: props.topType === '招标' ? props.bId : '',
|
|
buyer: props.buyerName,
|
|
buyer: props.buyerName,
|
|
@@ -303,8 +332,12 @@ const deductPackage = async (item, callback) => {
|
|
project_name: type === 'project' ? props.projectName : '',
|
|
project_name: type === 'project' ? props.projectName : '',
|
|
bidding_id: props.topType === '招标' ? props.bId : ''
|
|
bidding_id: props.topType === '招标' ? props.bId : ''
|
|
}
|
|
}
|
|
- const { error_code: code, data } = await ajaxReportEquityDeduct(params)
|
|
|
|
- callback && callback(code, data)
|
|
|
|
|
|
+ try {
|
|
|
|
+ const { error_code: code, data } = await ajaxReportEquityDeduct(params)
|
|
|
|
+ callback && callback(code, data)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ callback && callback()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -335,8 +368,8 @@ onUnmounted(() => {
|
|
>{{ statusMap[packageInfo.zmStatus].text }}</span
|
|
>{{ statusMap[packageInfo.zmStatus].text }}</span
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
- <div v-if="discountMsg" class="discount-container">
|
|
|
|
- <span :class="{ 'gray-text': isPackage }" v-html="discountMsg"></span>
|
|
|
|
|
|
+ <div v-if="discountText" class="discount-container">
|
|
|
|
+ <span v-html="discountText"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
@@ -407,9 +440,6 @@ onUnmounted(() => {
|
|
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;
|
|
@@ -516,6 +546,9 @@ onUnmounted(() => {
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
|
|
+ .gray-text {
|
|
|
|
+ color: #999999;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|