1
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user