|
@@ -110,6 +110,9 @@
|
|
|
<template #default="{ row }">
|
|
|
<!-- <div>{{ row }}</div> -->
|
|
|
<div v-if="row.currentTitle">{{ row.currentTitle }}</div>
|
|
|
+ <div v-if="row.productType">
|
|
|
+ 商品类型: <span style="color: black">{{ productTypeDict[row.productType] }}</span>
|
|
|
+ </div>
|
|
|
<div v-if="row.cna || row.dialogTitle">
|
|
|
分类: <span style="color: black">{{ row.cna ? row.cna : row.dialogTitle }}</span>
|
|
|
</div>
|
|
@@ -119,7 +122,7 @@
|
|
|
</div>
|
|
|
<div v-if="row.delivery">
|
|
|
配送:
|
|
|
- <span style="color: black">{{ row.delivery ? row.delivery: '--' }}</span>
|
|
|
+ <span style="color: black">{{ row.delivery ? row.delivery : '--' }}</span>
|
|
|
</div>
|
|
|
<div v-if="row.lookback">
|
|
|
回溯期: <span style="color: black">{{ row.lookback ? row.lookback : '--' }}</span>
|
|
@@ -162,7 +165,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, ref, watch, reactive, CSSProperties } from 'vue'
|
|
|
+import { onMounted, ref, watch, reactive, CSSProperties, onUnmounted } from 'vue'
|
|
|
import { request } from '/@/utils/service'
|
|
|
import BrowseSearch from './BrowseSearch.vue'
|
|
|
import BuySearch from './BuySearch.vue'
|
|
@@ -170,6 +173,7 @@ import { ElMessage, type FormInstance, type FormRules, type TabsPaneContext } fr
|
|
|
import { getAudiencesList } from '../api/index'
|
|
|
import { useShopInfo } from '/@/stores/shopInfo'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
+import emitter from '/@/utils/emitter'
|
|
|
|
|
|
const shopInfo = useShopInfo()
|
|
|
const { profile } = storeToRefs(shopInfo)
|
|
@@ -299,7 +303,7 @@ function browseOrientation(data) {
|
|
|
cna: data.cna,
|
|
|
lookback: viewsLookBack.value,
|
|
|
bid: bid.value,
|
|
|
- classificationId: data.cid
|
|
|
+ classificationId: data.cid,
|
|
|
}
|
|
|
addedTableData.value.push(dataWithLookback)
|
|
|
} else {
|
|
@@ -318,7 +322,6 @@ function buyOrientation(data) {
|
|
|
lookback: viewsLookBack.value,
|
|
|
currentTitle: '购买再营销',
|
|
|
}
|
|
|
- console.log('dataWithLookback', dataWithLookback)
|
|
|
addedTableData.value.push(dataWithLookback)
|
|
|
} else {
|
|
|
ElMessage({
|
|
@@ -460,28 +463,34 @@ function singleDelete(row) {
|
|
|
addedTableData.value = addedTableData.value.filter((item) => item.cid !== row.cid)
|
|
|
} else if ('classificationId' in row) {
|
|
|
addedTableData.value = addedTableData.value.filter((item) => item.classificationId !== row.classificationId)
|
|
|
+ } else if ('asin' in row) {
|
|
|
+ addedTableData.value = addedTableData.value.filter((item) => !(item.productType === row.productType && item.asin === row.asin))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const promoteGoodsAsin = ref('')
|
|
|
+const productTypeDict = {
|
|
|
+ relatedProduct: '推广商品',
|
|
|
+ similarProduct: '浏览再营销',
|
|
|
+}
|
|
|
+
|
|
|
function addPromoteProduct() {
|
|
|
const newProduct = {
|
|
|
+ currentTitle: '浏览再营销',
|
|
|
type: 'p',
|
|
|
- tactictype: 'purchases',
|
|
|
+ tactictype: 'view',
|
|
|
lookback: viewsLookBack.value,
|
|
|
- asin: '',
|
|
|
+ asin: promoteGoodsAsin.value,
|
|
|
bid: 0.2,
|
|
|
productType: 'relatedProduct',
|
|
|
}
|
|
|
- // 例如 type, tactictype, productType 等字段来判断
|
|
|
const exists = addedTableData.value.some(
|
|
|
(item) => item.type === newProduct.type && item.tactictype === newProduct.tactictype && item.productType === newProduct.productType
|
|
|
)
|
|
|
|
|
|
if (!exists) {
|
|
|
- // 如果不存在,则添加它到 addedTableData
|
|
|
addedTableData.value.push(newProduct)
|
|
|
} else {
|
|
|
- // 如果已存在,显示一个警告消息
|
|
|
ElMessage({
|
|
|
message: '已经添加了相关商品,不能重复添加',
|
|
|
type: 'warning',
|
|
@@ -489,7 +498,29 @@ function addPromoteProduct() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function addPromoteSimilar() {}
|
|
|
+function addPromoteSimilar() {
|
|
|
+ const newProduct = {
|
|
|
+ currentTitle: '浏览再营销',
|
|
|
+ type: 'p',
|
|
|
+ tactictype: 'view',
|
|
|
+ lookback: viewsLookBack.value,
|
|
|
+ asin: promoteGoodsAsin.value,
|
|
|
+ bid: 0.2,
|
|
|
+ productType: 'similarProduct',
|
|
|
+ }
|
|
|
+ const exists = addedTableData.value.some(
|
|
|
+ (item) => item.type === newProduct.type && item.tactictype === newProduct.tactictype && item.productType === newProduct.productType
|
|
|
+ )
|
|
|
+
|
|
|
+ if (!exists) {
|
|
|
+ addedTableData.value.push(newProduct)
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: '已经添加了相关商品,不能重复添加',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
// 点击保存触发
|
|
|
function handleSave() {
|
|
@@ -504,6 +535,17 @@ function changeTableHeader(row) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ emitter.on('send-firstAsin', (value: any) => {
|
|
|
+ promoteGoodsAsin.value = value
|
|
|
+ console.log('promoteGoodsAsin', promoteGoodsAsin.value)
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ emitter.off('send-firstAsin')
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -527,6 +569,7 @@ function changeTableHeader(row) {
|
|
|
border: 1px solid #e5e7eb;
|
|
|
height: 700px;
|
|
|
margin-bottom: 20px;
|
|
|
+ border-radius: 6px;
|
|
|
}
|
|
|
.left-container {
|
|
|
width: 50%;
|