This commit is contained in:
liushiwei
2023-11-24 01:04:54 +08:00
parent fe6fd6cfdc
commit 15cd54a44e
17 changed files with 1340 additions and 39 deletions

View File

@@ -157,8 +157,9 @@ export default {
goods_id: this.goodsId
}}).then((res) => {
if (!res.goods) {
this.isCopying = false
Message.error("获取商品信息失败,采集失败")
//this.isCopying = false
//Message.error("获取商品信息失败,采集失败")
this.addToDraft()
return
}
this.goods = res.goods

View File

@@ -28,7 +28,7 @@ import { DualAxes } from '@antv/g2plot'
export default {
name: "AiProductDetail",
props: ['params'],
props: ['params', 'url'],
components: {
AiProductDropDown
},
@@ -47,7 +47,7 @@ export default {
},
methods: {
init() {
this.$http.post('/api/monitorDetail/queryProductDetail',null,{
this.$http.post(this.url ? this.url: '/api/monitorDetail/queryProductDetail',null,{
params: {
goodsId: this.params.goodsId,
monitorId: this.params.monitorId

View File

@@ -8,6 +8,7 @@
<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 v-if="isShowGroup" :command="beforeAddGroup(params.goodsId)">加入分组</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>
@@ -24,6 +25,32 @@
@close="handleClose">
<ai-copy-from-temu v-if="copyFromDlgShow" :params="temuParams" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-temu>
</ai-dialog>
<ai-dialog
title="添加到分组"
:visible.sync="addGroupDlgShow"
:close-on-click-modal="false"
width="790px"
customFooter
:append-to-body="true"
@close="handleClose">
<el-form class="ai-form" :model="addGroupForm" label-width="120px" ref="addGroupForm">
<el-form-item label="分组" style="width: 100%;" prop="groupId" :rules="[{ required: true, message: '请选择分组', trigger: 'blur' }]">
<el-select style="width: 380px" v-model="addGroupForm.groupId" placeholder="请选择分组">
<el-option
v-for="item in groupList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="addGroupDlgShow = false">取消</el-button>
<el-button type="primary" @click="addToGroup">确定</el-button>
</div>
</ai-dialog>
</div>
</template>
<script>
@@ -33,12 +60,18 @@ import { Message } from 'element-ui'
export default {
name: "AiProductDropDown",
components: {AiCopyFromTemu},
props: ['params', 'isShowDetail', 'isShowAddFavorite', 'isShowDelFavorite'],
props: ['params', 'isShowDetail', 'isShowAddFavorite', 'isShowDelFavorite', 'isShowGroup'],
data() {
return {
info: {},
copyFromDlgShow: false,
temuParams: {}
addGroupDlgShow: false,
temuParams: {},
addGroupForm: {
groupId: '',
goodsId: ''
},
groupList: []
}
},
computed: {
@@ -69,6 +102,14 @@ export default {
this.$emit('onDelFavoriteSuccess')
}
})
} else if (e.type == 'addGroup') {
this.addGroupForm.goodsId = e.goodsId
this.$http.post('/api/newProductGroup/myPage?size=1000').then(res => {
if (res.code == 0) {
this.addGroupDlgShow = true
this.groupList = res.data.records
}
})
} else if (e.type == 'goMall') {
window.open('https://www.temu.com/mall.html?mall_id=' + e.mallId, '_blank');
} else if (e.type == 'goWeb') {
@@ -88,6 +129,9 @@ export default {
beforeDelFavorite(id) {
return {type: 'delFavorite', id: id}
},
beforeAddGroup(goodsId) {
return {type: 'addGroup', goodsId: goodsId}
},
beforeCopy(url) {
return {type: 'copy', url: url}
},
@@ -102,6 +146,18 @@ export default {
},
handleSuccess() {
this.copyFromDlgShow = false
},
addToGroup() {
this.$refs.addGroupForm.validate((valid) => {
if (valid) {
this.$http.post('/api/newProductGroupDetail/add', {...this.addGroupForm}).then(res => {
if (res.code == 0) {
this.addGroupDlgShow = false
Message.success("商品成功添加到分组")
}
})
}
})
}
}
}