|
@@ -8,7 +8,7 @@
|
|
|
custom-class="prop-report-download-dialog"
|
|
|
width="1000px"
|
|
|
>
|
|
|
- <div class="content" v-loading="pageLoading">
|
|
|
+ <div class="content" v-loading="pageLoading || sendLoading">
|
|
|
<section class="report-effect-box">
|
|
|
<div class="left">
|
|
|
<p class="box-label">报告作用:</p>
|
|
@@ -22,6 +22,7 @@
|
|
|
:buyerName="buyerName"
|
|
|
:backFilter="backFilter"
|
|
|
:canSelect="canSelect"
|
|
|
+ @changeFilter="changeFilter"
|
|
|
></download-filter>
|
|
|
<section class="empty" v-if="!hasPower">
|
|
|
<div>该业主暂无采购项目,暂无法下载报告</div>
|
|
@@ -37,6 +38,15 @@
|
|
|
<span>外省中标企业:<strong>{{ totalInfo.otherWinner }}</strong></span>
|
|
|
<span class="highlight view-more" @click="viewMore">查看更多</span>
|
|
|
</section>
|
|
|
+ <section class="email-box">
|
|
|
+ <span class="email-label"><i class="star">*</i>接收邮箱:</span>
|
|
|
+ <el-input v-model="s_email" placeholder="必填,报告将发送至邮箱" @input="showEmailError = false" @change="checkEmail"></el-input>
|
|
|
+ <span class="error-tip" v-if="showEmailError">
|
|
|
+ <i class="el-icon-error"></i>
|
|
|
+ <span v-if="s_email">邮箱格式错误</span>
|
|
|
+ <span v-else>请输入邮箱</span>
|
|
|
+ </span>
|
|
|
+ </section>
|
|
|
<section class="download-notice-box" v-if="hasPower && !emptyShow">
|
|
|
<p class="box-label">下载须知:</p>
|
|
|
<div class="box-desc">
|
|
@@ -48,21 +58,23 @@
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
|
- <div slot="footer" v-if="hasPower && !emptyShow && !pageLoading">
|
|
|
+ <div slot="footer" :class="{ 'mask': sendLoading }" v-if="hasPower && !emptyShow && !pageLoading">
|
|
|
<div class="footer-con">
|
|
|
- <span class="residue">业主采购分析报告下载余额:1份</span>
|
|
|
+ <span class="residue">业主采购分析报告下载余额:{{ residueCount }}份</span>
|
|
|
<span class="go-recharge" @click="goRecharge">去充值></span>
|
|
|
<span class="deduct">本次扣除:<em>1份</em></span>
|
|
|
<span class="zero-tip" v-if="residueCount === 0">余额不足,请先充值</span>
|
|
|
</div>
|
|
|
- <el-button class="download-btn" type="primary" @click="downloadHandle">立即下载</el-button>
|
|
|
+ <el-button class="download-btn" type="primary" :disabled="sendLoading" @click="downloadHandle">立即下载</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { debounce } from '@/utils/'
|
|
|
import DownloadFilter from './DownloadFilter.vue'
|
|
|
+import { getPDFPackBalance, sendPdfEmail, getPdfEmail, savePdfCondition } from '@/api/modules/'
|
|
|
+import { emailRegExp } from '@/utils/constant'
|
|
|
+import { debounce } from '@/utils/'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -112,7 +124,22 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
// 下载余额
|
|
|
- residueCount: 0
|
|
|
+ residueCount: 0,
|
|
|
+ s_email: '',
|
|
|
+ showEmailError: false,
|
|
|
+ sendLoading: false,
|
|
|
+ // 筛选条件
|
|
|
+ filterParams: {
|
|
|
+ buyer: this.buyerName || '',
|
|
|
+ entId: this.entId || '',
|
|
|
+ exactMatch: '0', // 模糊、精准搜索
|
|
|
+ match: '', // 关键词
|
|
|
+ matchRange: 'purchasing', // 搜索范围
|
|
|
+ area: {}, // 地区
|
|
|
+ scopeClass: '', // 行业
|
|
|
+ timeRange: 2018 + '_' + new Date().getFullYear(), // 成交时间范围
|
|
|
+ buyerClass: '' // 采购单位类型
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -120,37 +147,93 @@ export default {
|
|
|
return this.options.hasPower
|
|
|
}
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ Object.assign(this.filterParams, this.backFilter)
|
|
|
+ console.log( this.filterParams)
|
|
|
+ this.getEmail()
|
|
|
+ this.getResidueCount()
|
|
|
+ },
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ async getEmail () {
|
|
|
+ const {error_code: code, data } = await getPdfEmail()
|
|
|
+ if(data && code === 0) {
|
|
|
+ this.s_email = data || ''
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取下载余额
|
|
|
- getResidueCount () {
|
|
|
-
|
|
|
+ async getResidueCount () {
|
|
|
+ const {error_code: code, data } = await getPDFPackBalance()
|
|
|
+ if(code === 0 && data) {
|
|
|
+ this.residueCount = data.market?.total || 0
|
|
|
+ }
|
|
|
},
|
|
|
// 查看报告样例
|
|
|
- viewExample (fileUrl) {
|
|
|
- // TODO 需要服务端提供链接
|
|
|
- window.open('https://www.kdocs.cn/l/ctXdN3LVDdjP', '_blank')
|
|
|
+ viewExample () {
|
|
|
+ window.open('/pdf-files/markerPdf/buyer.pdf', '_blank')
|
|
|
+ },
|
|
|
+ // 筛选条件改变
|
|
|
+ changeFilter (filter) {
|
|
|
+ this.filterParams = filter
|
|
|
},
|
|
|
// 立即下载
|
|
|
- downloadHandle: debounce(function (fileUrl) {
|
|
|
+ downloadHandle: debounce(function () {
|
|
|
+
|
|
|
if(this.residueCount === 0) {
|
|
|
- this.options.visible = false
|
|
|
- this.$confirm('您可前往“资产-报告下载记录”查看详情。', '报告下载成功', {
|
|
|
- confirmButtonText: '返回',
|
|
|
- cancelButtonText: '查看下载记录',
|
|
|
- center: true,
|
|
|
- showClose: false,
|
|
|
- customClass: 'download-message-tip btn-reverse',
|
|
|
- }).then(() => {
|
|
|
- }).catch(() => {
|
|
|
- this.$router.push('/report/download_record?active=record')
|
|
|
- })
|
|
|
+ // 校验邮箱
|
|
|
+ this.checkEmail()
|
|
|
+ if(this.showEmailError) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.ajaxPdf()
|
|
|
} else {
|
|
|
this.goRecharge()
|
|
|
}
|
|
|
|
|
|
}, 300),
|
|
|
+ ajaxPdf () {
|
|
|
+ const params = {
|
|
|
+ type: 2,
|
|
|
+ s_email: this.s_email,
|
|
|
+ ...this.filterParams
|
|
|
+ }
|
|
|
+ this.sendLoading = true
|
|
|
+ // 保存pdf的条件
|
|
|
+ savePdfCondition(params).then(res => {
|
|
|
+ const {error_code: code, data } = res
|
|
|
+ if(code === 0 && data) {
|
|
|
+ // 发送邮箱
|
|
|
+ // 此处id是接口返回的id
|
|
|
+ const params = {
|
|
|
+ sid: data
|
|
|
+ }
|
|
|
+ sendPdfEmail(params).then(response => {
|
|
|
+ if(response.error_code === 0 && response.data) {
|
|
|
+ this.showConfirmDialog()
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.sendLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.sendLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showConfirmDialog () {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm('报告将于10分钟内发送至您的邮箱内,您也可前往“资产-报告下载记录”查看详情。', '报告下载成功', {
|
|
|
+ confirmButtonText: '返回',
|
|
|
+ cancelButtonText: '查看下载记录',
|
|
|
+ center: true,
|
|
|
+ showClose: false,
|
|
|
+ customClass: 'download-message-tip btn-reverse',
|
|
|
+ }).then(() => {
|
|
|
+ _this.options.visible = false
|
|
|
+ }).catch(() => {
|
|
|
+ _this.options.visible = false
|
|
|
+ _this.$router.push('/report/download_record?active=record')
|
|
|
+ })
|
|
|
+ },
|
|
|
// 查看更多
|
|
|
viewMore () {
|
|
|
this.options.visible = false
|
|
@@ -164,6 +247,13 @@ export default {
|
|
|
openCustomer() {
|
|
|
this.options.visible = false
|
|
|
this.contactCustomer(this)
|
|
|
+ },
|
|
|
+ checkEmail () {
|
|
|
+ if (!emailRegExp.test(this.s_email)) {
|
|
|
+ this.showEmailError = true
|
|
|
+ } else {
|
|
|
+ this.showEmailError = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -225,7 +315,44 @@ export default {
|
|
|
border-radius: 8px;
|
|
|
border: 1px solid rgba(0,0,0, 0.05);
|
|
|
}
|
|
|
+ .email-box{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size:14px;
|
|
|
+ .email-label{
|
|
|
+ display: inline-block;
|
|
|
+ width:94px;
|
|
|
+ color: #5F5E64;
|
|
|
+ }
|
|
|
+ .star {
|
|
|
+ color: #ff3a20;
|
|
|
+ margin-right:3px;
|
|
|
+ }
|
|
|
+ .error-tip {
|
|
|
+ color: #ff3a20;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .el-icon-error{
|
|
|
+ font-size:22px;
|
|
|
+ margin:0 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ::v-deep {
|
|
|
+ .el-input {
|
|
|
+ width: 590px;
|
|
|
+ }
|
|
|
+ .el-input__inner{
|
|
|
+ width: 590px;
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size:14px;
|
|
|
+ line-hieght: 22px;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
.empty{
|
|
|
font-size: 14px;
|
|
|
line-height: 22px;
|
|
@@ -241,6 +368,9 @@ export default {
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
.el-dialog__footer{
|
|
|
+ .mask {
|
|
|
+ opacity: .6;
|
|
|
+ }
|
|
|
.download-btn{
|
|
|
padding: 11px 58px;
|
|
|
font-size:16px;
|