This commit is contained in:
liushiwei
2023-11-08 13:39:21 +08:00
parent 66c89f71e1
commit 0e9d59b1eb
18 changed files with 939 additions and 443 deletions

View File

@@ -6,6 +6,8 @@
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="isShowDetail" :command="beforeGoDetail(params.goodsId)">查看详情</el-dropdown-item>
<el-dropdown-item v-if="isShowAddFavorite" :command="beforeAddFavorite(params.goodsId, params.monitorId)">加入收藏</el-dropdown-item>
<el-dropdown-item v-if="isShowDelFavorite" :command="beforeDelFavorite(params.id)">取消收藏</el-dropdown-item>
<el-dropdown-item divided :command="beforeCopy(params.url)">商品采集</el-dropdown-item>
<el-dropdown-item divided :command="beforeGoWeb(params.url)">访问商品</el-dropdown-item>
<el-dropdown-item :command="beforeGoMal(params.mallId)">访问店铺</el-dropdown-item>
@@ -26,10 +28,12 @@
</template>
<script>
import AiCopyFromTemu from "./AiCopyFromTemu.vue";
import { Message } from 'element-ui'
export default {
name: "AiProductDropDown",
components: {AiCopyFromTemu},
props: ['params', 'isShowDetail'],
props: ['params', 'isShowDetail', 'isShowAddFavorite', 'isShowDelFavorite'],
data() {
return {
info: {},
@@ -52,6 +56,19 @@ export default {
this.temuParams = {url: 'https://www.temu.com/' + e.url}
}
this.copyFromDlgShow = true
} else if (e.type == 'addFavorite') {
this.$http.post('/api/monitorFavorite/add',{goodsId: e.goodsId, monitorId: e.monitorId}).then(res => {
if (res.code == 0) {
Message.success('收藏成功')
}
})
} else if (e.type == 'delFavorite') {
this.$http.post('/api/monitorFavorite/del?id=' + e.id).then(res => {
if (res.code == 0) {
Message.success('删除收藏成功')
this.$emit('onDelFavoriteSuccess')
}
})
} else if (e.type == 'goMall') {
window.open('https://www.temu.com/mall.html?mall_id=' + e.mallId, '_blank');
} else if (e.type == 'goWeb') {
@@ -65,6 +82,12 @@ export default {
beforeGoDetail(goodsId) {
return {type: 'detail', goodsId: goodsId}
},
beforeAddFavorite(goodsId, monitorId) {
return {type: 'addFavorite', goodsId: goodsId, monitorId: monitorId}
},
beforeDelFavorite(id) {
return {type: 'delFavorite', id: id}
},
beforeCopy(url) {
return {type: 'copy', url: url}
},