diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js index 7cd987c..72de6d1 100644 --- a/src/components/common/langs/en.js +++ b/src/components/common/langs/en.js @@ -995,8 +995,8 @@ colTitle: 'Template title', step3: 'References', step: 'step', Information: 'Fill in information', - - + startPreAccept: 'Start the pre-acceptance process', + startPreAcceptWithPayment: 'Start the pre-acceptance process and complete your payment', }, Formula: { FormulaTemplate: 'Formula Template' diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js index d05537f..9a557f5 100644 --- a/src/components/common/langs/zh.js +++ b/src/components/common/langs/zh.js @@ -984,8 +984,8 @@ const zh = { step3: '参考', step: 'step', Information: 'Fill in information', - - + startPreAccept: '开始预接收流程', + startPreAcceptWithPayment: '开始预接收流程并完成支付', }, Formula:{ FormulaTemplate:'公式模版' diff --git a/src/components/page/articleList.vue b/src/components/page/articleList.vue index 18f8cb9..f35204a 100644 --- a/src/components/page/articleList.vue +++ b/src/components/page/articleList.vue @@ -107,11 +107,11 @@ - + - Start the pre-acceptance process and complete your payment + {{ preAcceptEntryButtonText(item) }} @@ -539,6 +539,61 @@ this.getdate(); }, methods: { + /** 与 Complete_profile.vue getDetail 中订单/支付展示逻辑一致:preOrderDetail → is_buy、期刊费、折后费、isFree */ + _feeNum(v) { + if (v == null || v === '') return 0; + const n = Number(String(v).replace(/,/g, '')); + return Number.isFinite(n) ? n : 0; + }, + computePreacceptShortButton(articleInfo, journalInfo) { + if (!articleInfo || !journalInfo) return false; + const journalFee = journalInfo.fee; + const articleFee = articleInfo.fee; + const isBuy = Number(articleInfo.is_buy) === 1; + const tableFee = journalFee ? this._feeNum(articleFee) : 0; + const isFree = isBuy && tableFee === 0; + const noJournalFee = !journalFee || this._feeNum(journalFee) === 0 || String(journalFee) === '0.00'; + // Complete_profile: active=1 当已付,或 未付但期刊无 APC + if (isFree) return true; + if (isBuy) return true; + if (!isBuy && noJournalFee) return true; + return false; + }, + preAcceptButtonReady(item) { + const p = item._preacceptPay; + return !!(p && p.loading === false); + }, + async hydratePreacceptPaymentForList(rows) { + if (!rows || !rows.length) return; + const targets = rows.filter((r) => Number(r.state) === 6); + await Promise.all( + targets.map(async (row) => { + try { + const res = await this.$api.post('api/Order/preOrderDetail', { + article_id: row.article_id + }); + if (res && Number(res.code) === 0) { + const article = res.data.article_detail || {}; + const journal = res.data.journal_detail || {}; + const shortButton = this.computePreacceptShortButton(article, journal); + this.$set(row, '_preacceptPay', { loading: false, shortButton }); + } else { + this.$set(row, '_preacceptPay', { loading: false, shortButton: false }); + } + } catch (e) { + console.error(e); + this.$set(row, '_preacceptPay', { loading: false, shortButton: false }); + } + }) + ); + }, + preAcceptEntryButtonText(item) { + const pay = item._preacceptPay; + if (!pay || pay.loading) return ''; + return pay.shortButton + ? this.$t('PreAccept.startPreAccept') + : this.$t('PreAccept.startPreAcceptWithPayment'); + }, formatToHtml(val) { if (!val) return ''; @@ -612,8 +667,12 @@ return processedText; 1 + '-'; let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(); res.data[i].ctime = Y + M + D; + if (Number(res.data[i].state) === 6) { + this.$set(res.data[i], '_preacceptPay', { loading: true, shortButton: false }); + } } - this.tableData = res.data + this.tableData = res.data; + this.hydratePreacceptPaymentForList(res.data); }) .catch(err => { console.log(err);