|
@@ -463,7 +463,7 @@
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
<div style="display: flex; justify-content: space-around; padding-top: 0px">
|
|
<div style="display: flex; justify-content: space-around; padding-top: 0px">
|
|
- <el-button type="primary" plain>保存</el-button>
|
|
|
|
|
|
+ <el-button type="primary" plain @click="keyWordsSave" :disabled="!addedKeyWordsTableData.length">保存</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -539,17 +539,14 @@
|
|
style="border: 0; border-right: 0; border-bottom-left-radius: 6px; border-top-left-radius: 5px; overflow: hidden">
|
|
style="border: 0; border-right: 0; border-bottom-left-radius: 6px; border-top-left-radius: 5px; overflow: hidden">
|
|
<el-tab-pane label="品类" style="border-top-left-radius: 6px">
|
|
<el-tab-pane label="品类" style="border-top-left-radius: 6px">
|
|
<div style="display: flex; align-items: center">
|
|
<div style="display: flex; align-items: center">
|
|
- <span style="width: 40px">竞价:</span>
|
|
|
|
- <el-select v-model="categoryBiddingType" @change="singleGoodsBidSelectChanged" class="m-2" placeholder="Select">
|
|
|
|
- <el-option v-for="item in categoryBiddingTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
- </el-select>
|
|
|
|
- <el-input
|
|
|
|
- v-model="singleGoodsBidInput"
|
|
|
|
- :disabled="categoryBiddingType === 'defaultBid'"
|
|
|
|
- style="width: 200px">
|
|
|
|
- <template #prepend>$</template>
|
|
|
|
- </el-input>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <span style="width: 40px">竞价:</span>
|
|
|
|
+ <el-select v-model="categoryBiddingType" @change="singleGoodsBidSelectChanged" class="m-2" placeholder="Select">
|
|
|
|
+ <el-option v-for="item in categoryBiddingTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <el-input v-model="singleGoodsBidInput" :disabled="categoryBiddingType === 'defaultBid'" style="width: 200px">
|
|
|
|
+ <template #prepend>$</template>
|
|
|
|
+ </el-input>
|
|
|
|
+ </div>
|
|
|
|
|
|
<el-tabs v-model="categoryTabs" class="category-tabs">
|
|
<el-tabs v-model="categoryTabs" class="category-tabs">
|
|
<el-tab-pane label="建议" name="first">
|
|
<el-tab-pane label="建议" name="first">
|
|
@@ -597,8 +594,7 @@
|
|
@change="dialogSelectChange"
|
|
@change="dialogSelectChange"
|
|
multiple
|
|
multiple
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
- :loading="dialogSelectLoading"
|
|
|
|
- >
|
|
|
|
|
|
+ :loading="dialogSelectLoading">
|
|
<el-option v-for="item in dialogForm.dialogOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
<el-option v-for="item in dialogForm.dialogOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -643,10 +639,7 @@
|
|
<el-select class="m-2" v-model="singleGoodsBidSelect" @change="singleGoodsBidSelectChanged">
|
|
<el-select class="m-2" v-model="singleGoodsBidSelect" @change="singleGoodsBidSelectChanged">
|
|
<el-option v-for="item in singleGoodsBidTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
<el-option v-for="item in singleGoodsBidTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
- <el-input
|
|
|
|
- v-model="singleGoodsBidInput"
|
|
|
|
- :disabled="singleGoodsBidSelect == 'defaultBid'"
|
|
|
|
- style="width: 200px">
|
|
|
|
|
|
+ <el-input v-model="singleGoodsBidInput" :disabled="singleGoodsBidSelect == 'defaultBid'" style="width: 200px">
|
|
<template #prepend>$</template>
|
|
<template #prepend>$</template>
|
|
</el-input>
|
|
</el-input>
|
|
<div style="margin-left: 20px">
|
|
<div style="margin-left: 20px">
|
|
@@ -979,6 +972,7 @@ const campaignRules = computed(() => ({
|
|
}))
|
|
}))
|
|
|
|
|
|
async function createCampaigns() {
|
|
async function createCampaigns() {
|
|
|
|
+ const previousRespCampaignId = respCampaignId.value
|
|
try {
|
|
try {
|
|
// 必需字段列表
|
|
// 必需字段列表
|
|
const requiredFields = [
|
|
const requiredFields = [
|
|
@@ -1021,9 +1015,10 @@ async function createCampaigns() {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
data: filteredRequestData,
|
|
data: filteredRequestData,
|
|
})
|
|
})
|
|
- console.log('🚀 ~ createCampaigns ~ resp-->>', resp)
|
|
|
|
- respCampaignId.value = resp.data.campaignId
|
|
|
|
- if (respCampaignId.value) {
|
|
|
|
|
|
+
|
|
|
|
+ if (resp.data && resp.data.campaignId) {
|
|
|
|
+ // 确保 resp.data 和 resp.data.campaignId 存在
|
|
|
|
+ respCampaignId.value = resp.data.campaignId // 更新 respCampaignId
|
|
adGroupSave.value = false
|
|
adGroupSave.value = false
|
|
campaignLoading.value = false
|
|
campaignLoading.value = false
|
|
ElMessage({
|
|
ElMessage({
|
|
@@ -1033,9 +1028,13 @@ async function createCampaigns() {
|
|
} else {
|
|
} else {
|
|
campaignLoading.value = false
|
|
campaignLoading.value = false
|
|
ElMessage.error('广告活动创建失败!')
|
|
ElMessage.error('广告活动创建失败!')
|
|
|
|
+ // 如果创建失败,恢复到之前的 respCampaignId
|
|
|
|
+ respCampaignId.value = previousRespCampaignId
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('请求失败:', error)
|
|
console.error('请求失败:', error)
|
|
|
|
+ // 如果请求失败,也恢复到之前的 respCampaignId
|
|
|
|
+ respCampaignId.value = previousRespCampaignId
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1726,29 +1725,29 @@ function singleGoodsSearchChaneged() {
|
|
setSearchTableData()
|
|
setSearchTableData()
|
|
}
|
|
}
|
|
function addSingleSearch(scope) {
|
|
function addSingleSearch(scope) {
|
|
- console.log('🚀 ~ addSingleSearch ~ scope-->>', scope);
|
|
|
|
|
|
+ console.log('🚀 ~ addSingleSearch ~ scope-->>', scope)
|
|
|
|
|
|
- const typesToAdd = [];
|
|
|
|
|
|
+ const typesToAdd = []
|
|
if (expand.value) {
|
|
if (expand.value) {
|
|
- typesToAdd.push('ASIN_EXPANDED_FROM');
|
|
|
|
|
|
+ typesToAdd.push('ASIN_EXPANDED_FROM')
|
|
}
|
|
}
|
|
if (accurate.value) {
|
|
if (accurate.value) {
|
|
- typesToAdd.push('ASIN_SAME_AS');
|
|
|
|
|
|
+ typesToAdd.push('ASIN_SAME_AS')
|
|
}
|
|
}
|
|
const productTypeMap = {
|
|
const productTypeMap = {
|
|
ASIN_EXPANDED_FROM: '扩展',
|
|
ASIN_EXPANDED_FROM: '扩展',
|
|
ASIN_SAME_AS: '精确',
|
|
ASIN_SAME_AS: '精确',
|
|
- };
|
|
|
|
|
|
+ }
|
|
|
|
|
|
typesToAdd.forEach((productType) => {
|
|
typesToAdd.forEach((productType) => {
|
|
- const isAlreadyAdded = productOrientationTableData.value.some(item => item.sku === scope.row.sku && item.productType === productType);
|
|
|
|
|
|
+ const isAlreadyAdded = productOrientationTableData.value.some((item) => item.sku === scope.row.sku && item.productType === productType)
|
|
|
|
|
|
- let bidValue = null;
|
|
|
|
|
|
+ let bidValue = null
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
- bidValue = adGroupRuleForm.defaultBidInp;
|
|
|
|
|
|
+ bidValue = adGroupRuleForm.defaultBidInp
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
- bidValue = singleGoodsBidInput.value;
|
|
|
|
|
|
+ bidValue = singleGoodsBidInput.value
|
|
}
|
|
}
|
|
|
|
|
|
if (!isAlreadyAdded) {
|
|
if (!isAlreadyAdded) {
|
|
@@ -1759,15 +1758,14 @@ function addSingleSearch(scope) {
|
|
productType: productType,
|
|
productType: productType,
|
|
productTypeText: productTypeMap[productType],
|
|
productTypeText: productTypeMap[productType],
|
|
bid: bidValue, // 添加 bid 值
|
|
bid: bidValue, // 添加 bid 值
|
|
- };
|
|
|
|
- productOrientationTableData.value.push(newData);
|
|
|
|
|
|
+ }
|
|
|
|
+ productOrientationTableData.value.push(newData)
|
|
} else {
|
|
} else {
|
|
- console.log(`${productType} item is already added.`);
|
|
|
|
|
|
+ console.log(`${productType} item is already added.`)
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
let selectedLabels = ref([]) // 选中的label数组
|
|
let selectedLabels = ref([]) // 选中的label数组
|
|
function dialogSelectChange(event) {
|
|
function dialogSelectChange(event) {
|
|
console.log('🚀 ~ dialogSelectChange ~ event-->>', event)
|
|
console.log('🚀 ~ dialogSelectChange ~ event-->>', event)
|
|
@@ -1813,12 +1811,12 @@ function dialogFormSubmit() {
|
|
diseligible: '不具备Prime资格',
|
|
diseligible: '不具备Prime资格',
|
|
}
|
|
}
|
|
|
|
|
|
- let bidValue = null;
|
|
|
|
|
|
+ let bidValue = null
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
- bidValue = adGroupRuleForm.defaultBidInp;
|
|
|
|
|
|
+ bidValue = adGroupRuleForm.defaultBidInp
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
- bidValue = singleGoodsBidInput.value;
|
|
|
|
|
|
+ bidValue = singleGoodsBidInput.value
|
|
}
|
|
}
|
|
|
|
|
|
selectedLabels.value.forEach((brandLabel) => {
|
|
selectedLabels.value.forEach((brandLabel) => {
|
|
@@ -1851,15 +1849,15 @@ function dialogFormSubmit() {
|
|
|
|
|
|
// 定向按钮功能
|
|
// 定向按钮功能
|
|
function orientate(node, data) {
|
|
function orientate(node, data) {
|
|
- console.log('🚀 ~ orientate ~ data-->>', data);
|
|
|
|
- const exists = productOrientationTableData.value.some(item => item.cid === data.cid);
|
|
|
|
|
|
+ console.log('🚀 ~ orientate ~ data-->>', data)
|
|
|
|
+ const exists = productOrientationTableData.value.some((item) => item.cid === data.cid)
|
|
|
|
|
|
- let bidValue = null;
|
|
|
|
|
|
+ let bidValue = null
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
// 根据 categoryBiddingType.value 的值设置 bidValue
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
if (categoryBiddingType.value === 'defaultBid') {
|
|
- bidValue = adGroupRuleForm.defaultBidInp;
|
|
|
|
|
|
+ bidValue = adGroupRuleForm.defaultBidInp
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
} else if (categoryBiddingType.value === 'customBid') {
|
|
- bidValue = singleGoodsBidInput.value;
|
|
|
|
|
|
+ bidValue = singleGoodsBidInput.value
|
|
}
|
|
}
|
|
|
|
|
|
if (!exists) {
|
|
if (!exists) {
|
|
@@ -1868,8 +1866,8 @@ function orientate(node, data) {
|
|
classification: data.cna,
|
|
classification: data.cna,
|
|
classificationId: data.cid,
|
|
classificationId: data.cid,
|
|
bid: bidValue, // 将 bid 值添加到新数据中
|
|
bid: bidValue, // 将 bid 值添加到新数据中
|
|
- };
|
|
|
|
- productOrientationTableData.value.push(newData);
|
|
|
|
|
|
+ }
|
|
|
|
+ productOrientationTableData.value.push(newData)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1877,7 +1875,7 @@ let productTargetBidList = ref([])
|
|
async function productTagetSave() {
|
|
async function productTagetSave() {
|
|
console.log('tableData', productOrientationTableData.value)
|
|
console.log('tableData', productOrientationTableData.value)
|
|
// 检查是否存在 bid 为空的行
|
|
// 检查是否存在 bid 为空的行
|
|
- const hasEmptyBid = productOrientationTableData.value.some(row => row.bid == null || row.bid === '')
|
|
|
|
|
|
+ const hasEmptyBid = productOrientationTableData.value.some((row) => row.bid == null || row.bid === '')
|
|
// 直接返回,不继续执行
|
|
// 直接返回,不继续执行
|
|
if (hasEmptyBid) {
|
|
if (hasEmptyBid) {
|
|
console.log('存在空的 bid,不发送请求')
|
|
console.log('存在空的 bid,不发送请求')
|
|
@@ -1895,7 +1893,7 @@ async function productTagetSave() {
|
|
adGroupId: respAdGroupId.value,
|
|
adGroupId: respAdGroupId.value,
|
|
campaignId: respCampaignId.value,
|
|
campaignId: respCampaignId.value,
|
|
expressionList: productOrientationTableData.value,
|
|
expressionList: productOrientationTableData.value,
|
|
- state: "PAUSED"
|
|
|
|
|
|
+ state: 'PAUSED',
|
|
}
|
|
}
|
|
const filteredRequestData = Object.fromEntries(Object.entries(requestData).filter(([_, v]) => v != null))
|
|
const filteredRequestData = Object.fromEntries(Object.entries(requestData).filter(([_, v]) => v != null))
|
|
const resp = await request({
|
|
const resp = await request({
|
|
@@ -1947,18 +1945,56 @@ const keyWordsTableData = ref([]) // 关键词定向左侧表格数据
|
|
const addedKeyWordsTableData = ref([]) // 关键词定向右侧表格数据
|
|
const addedKeyWordsTableData = ref([]) // 关键词定向右侧表格数据
|
|
const keyWordsTextarea = ref('')
|
|
const keyWordsTextarea = ref('')
|
|
|
|
|
|
|
|
+function addKeyWords() {
|
|
|
|
+ const trimmedText = keyWordsTextarea.value.trim()
|
|
|
|
+ const items = trimmedText.split(/,|\n/)
|
|
|
|
+
|
|
|
|
+ items.forEach((item) => {
|
|
|
|
+ const trimmedItem = item.trim()
|
|
|
|
+ if (trimmedItem) {
|
|
|
|
+ let keyWordEntry = {
|
|
|
|
+ keyword: trimmedItem,
|
|
|
|
+ matchType: '广泛', // 或者其他匹配类型,根据你的具体需求来设置
|
|
|
|
+ bid: bidInput.value, // 使用用户输入的出价或默认出价
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!addedKeyWordsTableData.value.some((n) => n.keyword === keyWordEntry.keyword)) {
|
|
|
|
+ addedKeyWordsTableData.value.push(keyWordEntry)
|
|
|
|
+ } else {
|
|
|
|
+ console.log('关键词已存在,未被添加到列表中')
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ console.log('有空项目,未被添加到列表中')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ keyWordsTextarea.value = ''
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function delSingleKeyWord(scope) {
|
|
|
|
+ const index = addedKeyWordsTableData.value.findIndex((item) => item.keyword === scope.row.keyword)
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ addedKeyWordsTableData.value.splice(index, 1)
|
|
|
|
+ } else {
|
|
|
|
+ console.log('无效的索引,无法删除条目')
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
function delAllKeyWords() {
|
|
function delAllKeyWords() {
|
|
- // 删除已经添加的关键词
|
|
|
|
addedKeyWordsTableData.value = []
|
|
addedKeyWordsTableData.value = []
|
|
}
|
|
}
|
|
|
|
|
|
-function addKeyWords() {
|
|
|
|
- // 添加关键词
|
|
|
|
- if (keyWordsTextarea.value) {
|
|
|
|
- addedKeyWordsTableData.value.push({
|
|
|
|
- keyWords: keyWordsTextarea.value,
|
|
|
|
- })
|
|
|
|
- keyWordsTextarea.value = ''
|
|
|
|
|
|
+async function keyWordsSave() {
|
|
|
|
+ // 假设你需要保存这些关键词到服务器
|
|
|
|
+ try {
|
|
|
|
+ const requestData = {
|
|
|
|
+ // ...其他需要的数据...
|
|
|
|
+ keywords: addedKeyWordsTableData.value,
|
|
|
|
+ }
|
|
|
|
+ // 发送请求...
|
|
|
|
+ console.log('请求发送成功,关键词已保存', requestData)
|
|
|
|
+ delAllKeyWords()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('请求失败:', error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1993,10 +2029,7 @@ function addNegative() {
|
|
console.log('有空项目,未被添加到列表中')
|
|
console.log('有空项目,未被添加到列表中')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
negativeWordsTextarea.value = ''
|
|
negativeWordsTextarea.value = ''
|
|
- console.log('🚀 ~ exactNegativeList-->>', exactNegativeList)
|
|
|
|
- console.log('🚀 ~ phraseNegativeList-->>', phraseNegativeList)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function delAllNegative() {
|
|
function delAllNegative() {
|
|
@@ -2057,9 +2090,8 @@ async function negativeWordsSave() {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
data: filteredRequestData,
|
|
data: filteredRequestData,
|
|
})
|
|
})
|
|
- console.log('🚀 ~ negativeWordsSave ~ resp-->>', resp)
|
|
|
|
negativeWordsLoading.value = false
|
|
negativeWordsLoading.value = false
|
|
- if (resp.data.negativeKeyworderror.length !== 0) {
|
|
|
|
|
|
+ if (resp.data.negativeKeywordsuccess.length !== 0) {
|
|
ElMessage({
|
|
ElMessage({
|
|
message: '否定词创建成功',
|
|
message: '否定词创建成功',
|
|
type: 'success',
|
|
type: 'success',
|