This commit is contained in:
Leo
2026-02-03 15:27:02 +08:00
parent df0bcf9d27
commit 6f3b0a2467

View File

@@ -314,6 +314,19 @@
/>
</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center" fixed="right">
<template slot-scope="scope">
<el-button
v-if="scope.row.source === '京东评论'"
type="warning"
size="mini"
icon="el-icon-upload2"
:loading="statFetchLoading"
@click="handleStatFetchComments(scope.row)"
>获取评论</el-button>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
@@ -393,7 +406,8 @@ export default {
imageList: [],
// 获取评论 loading
jdFetchLoading: false,
tbFetchLoading: false
tbFetchLoading: false,
statFetchLoading: false
}
},
computed: {
@@ -467,6 +481,24 @@ export default {
...this.jdQueryParams
}, `jd_comment_${new Date().getTime()}.xlsx`)
},
/** 统计信息表格仅京东商品可点击用该行商品ID 调用获取评论 */
handleStatFetchComments(row) {
if (row.source !== '京东评论') return
const productId = (row.productId || '').toString().trim()
if (!productId) {
this.$modal.msgWarning('商品ID为空')
return
}
this.statFetchLoading = true
fetchComments(productId).then(() => {
this.$modal.msgSuccess('获取评论请求已发送')
this.getStatistics()
}).catch(e => {
this.$modal.msgError(e && (e.message || e.msg) || '获取评论失败')
}).finally(() => {
this.statFetchLoading = false
})
},
/** 京东调用获取评论接口使用商品ID(SKU) 作为 product_id */
handleJdFetchComments() {
const productId = (this.jdQueryParams.productId || '').toString().trim()