This commit is contained in:
liushiwei
2023-09-25 10:13:54 +08:00
parent 2fb3f13787
commit 794ac780ae
11 changed files with 749 additions and 46 deletions

View File

@@ -70,7 +70,7 @@
productName: '',
productSkcIds: ''
}, getProductList()">重置</el-button>
<el-button type="primary" @click="search.page =1, getProductList()">查询</el-button>
<el-button type="primary" @click="productPage.page =1, getProductList()">查询</el-button>
</template>
</ai-search-bar>
<ai-table
@@ -284,7 +284,7 @@ import { Message } from 'element-ui'
};
})
} else {
Message.error("【拼多多】" + res.errorMsg)
this.getProductList()
}
});
},
@@ -300,37 +300,42 @@ import { Message } from 'element-ui'
return;
}
this.productIds.map((productSpu, index) => {
setTimeout(() => {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/query',
needMallId: true,
mallId: this.productPage.mallId,
data: {
productEditTaskUid: '',
productId: productSpu
}}).then((res) => {
if (res.errorCode == 1000000) {
let content = transform(res.result)
let mallInfo = this.$store.state.mallList.filter(item => {
return item.mallId == this.productPage.mallId
})
this.$http.post('/api/product/add', {
mallId: mallInfo[0].mallId,
mallName: mallInfo[0].mallName,
productSpu: res.result.productId,
productName: res.result.productName,
content: content
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
setTimeout(() => {
this.saveTemplate(productSpu, index)
}, 200 * index)
})
},
saveTemplate(spu, index) {
sendChromeAPIMessage({
url: 'bg-visage-mms/product/query',
needMallId: true,
mallId: this.productPage.mallId,
data: {
productEditTaskUid: '',
productId: spu
}}).then((res) => {
if (res.errorCode == 1000000) {
let content = transform(res.result)
let mallInfo = this.$store.state.mallList.filter(item => {
return item.mallId == this.productPage.mallId
})
this.$http.post('/api/product/add', {
mallId: mallInfo[0].mallId,
mallName: mallInfo[0].mallName,
productSpu: res.result.productId,
productName: res.result.productName,
content: content
}).then(res1 => {
if (res1.code == 0) {
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
if (index == this.productIds.length - 1) {
this.getList()
}
}
})
}, 200 * index)
} else {
this.saveTemplate(spu, index)
}
})
},
beforeAddToDraft() {