商品复制
This commit is contained in:
@@ -100,7 +100,7 @@
|
|||||||
@close="handleClose">
|
@close="handleClose">
|
||||||
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
||||||
<el-form-item label="店铺" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
|
<el-form-item label="店铺" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
|
||||||
<el-select style="width: 380px" v-model="form.targetMallId" placeholder="请选择" @change="getCateList">
|
<el-select style="width: 380px" v-model="form.targetMallId" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in $store.state.mallList"
|
v-for="item in $store.state.mallList"
|
||||||
:key="item.mallId"
|
:key="item.mallId"
|
||||||
@@ -109,8 +109,8 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品分类" style="width: 100%;" prop="targetMallId" :rules="[{ required: true, message: '请选择店铺', trigger: 'blur' }]">
|
<el-form-item label="商品分类" style="width: 100%;" prop="targetCatId" :rules="[{ required: true, message: '请选择商品分类', trigger: 'blur' }]">
|
||||||
<el-cascader style="width: 380px" :props="props"></el-cascader>
|
<el-cascader style="width: 380px" v-model="form.targetCatId" :props="props"></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="dialog-footer" slot="footer">
|
<div class="dialog-footer" slot="footer">
|
||||||
@@ -188,7 +188,8 @@ import { Message } from 'element-ui'
|
|||||||
mallDlgShow: false,
|
mallDlgShow: false,
|
||||||
productIds: [],
|
productIds: [],
|
||||||
form: {
|
form: {
|
||||||
targetMallId: ''
|
targetMallId: '',
|
||||||
|
targetCatId: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -299,35 +300,37 @@ import { Message } from 'element-ui'
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.productIds.map((productSpu, index) => {
|
this.productIds.map((productSpu, index) => {
|
||||||
setTimeout(sendChromeAPIMessage({
|
setTimeout(() => {
|
||||||
url: 'bg-visage-mms/product/query',
|
sendChromeAPIMessage({
|
||||||
needMallId: true,
|
url: 'bg-visage-mms/product/query',
|
||||||
mallId: this.productPage.mallId,
|
needMallId: true,
|
||||||
data: {
|
mallId: this.productPage.mallId,
|
||||||
productEditTaskUid: '',
|
data: {
|
||||||
productId: productSpu
|
productEditTaskUid: '',
|
||||||
}}).then((res) => {
|
productId: productSpu
|
||||||
if (res.errorCode == 1000000) {
|
}}).then((res) => {
|
||||||
let content = transform(res.result)
|
if (res.errorCode == 1000000) {
|
||||||
let mallInfo = this.$store.state.mallList.filter(item => {
|
let content = transform(res.result)
|
||||||
return item.mallId == this.productPage.mallId
|
let mallInfo = this.$store.state.mallList.filter(item => {
|
||||||
})
|
return item.mallId == this.productPage.mallId
|
||||||
this.$http.post('/api/product/add', {
|
})
|
||||||
mallId: mallInfo[0].mallId,
|
this.$http.post('/api/product/add', {
|
||||||
mallName: mallInfo[0].mallName,
|
mallId: mallInfo[0].mallId,
|
||||||
productSpu: res.result.productId,
|
mallName: mallInfo[0].mallName,
|
||||||
productName: res.result.productName,
|
productSpu: res.result.productId,
|
||||||
content: content
|
productName: res.result.productName,
|
||||||
}).then(res1 => {
|
content: content
|
||||||
if (res1.code == 0) {
|
}).then(res1 => {
|
||||||
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
|
if (res1.code == 0) {
|
||||||
if (index == this.productIds.length - 1) {
|
Message.success("商品【" + res.result.productName + "】成功添加为商品模板")
|
||||||
this.getList()
|
if (index == this.productIds.length - 1) {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
}), 200 * index)
|
}, 200 * index)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeAddToDraft() {
|
beforeAddToDraft() {
|
||||||
@@ -350,11 +353,18 @@ import { Message } from 'element-ui'
|
|||||||
needMallId: true,
|
needMallId: true,
|
||||||
mallId: this.form.targetMallId,
|
mallId: this.form.targetMallId,
|
||||||
data: {
|
data: {
|
||||||
catId: 26117
|
catId: this.form.targetCatId[this.form.targetCatId.length - 1]
|
||||||
}}).then((res) => {
|
}}).then((res) => {
|
||||||
if (res.errorCode == 1000000) {
|
if (res.errorCode == 1000000) {
|
||||||
let draftId = res.result.productDraftId
|
let draftId = res.result.productDraftId
|
||||||
let content = JSON.parse(product[0].content)
|
let content = JSON.parse(product[0].content)
|
||||||
|
let i = 0
|
||||||
|
for (; i < this.form.targetCatId.length; i++) {
|
||||||
|
content['cat' + (i+1) + 'Id'] = this.form.targetCatId[i]
|
||||||
|
}
|
||||||
|
for (; i < 10; i++) {
|
||||||
|
content['cat' + (i+1) + 'Id'] = ''
|
||||||
|
}
|
||||||
content.productDraftId = draftId
|
content.productDraftId = draftId
|
||||||
sendChromeAPIMessage({
|
sendChromeAPIMessage({
|
||||||
url: 'bg-visage-mms/product/draft/save',
|
url: 'bg-visage-mms/product/draft/save',
|
||||||
@@ -367,6 +377,8 @@ import { Message } from 'element-ui'
|
|||||||
Message.success("商品【" + product[0].productName + "】成功添加到草稿箱")
|
Message.success("商品【" + product[0].productName + "】成功添加到草稿箱")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
Message.error("【拼多多】" + res.errorMsg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 1000*index)
|
}, 1000*index)
|
||||||
|
|||||||
Reference in New Issue
Block a user