This commit is contained in:
刘仕伟
2024-02-27 15:38:08 +08:00
parent 8e87162e94
commit d1c746be14
3 changed files with 68 additions and 17 deletions

View File

@@ -10,7 +10,7 @@
<el-input type="textarea" :rows="5" v-model="form.url"></el-input>
</el-form-item>
<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="请选择">
<el-select style="width: 380px" v-model="form.targetMallId" @change="onMallChange" placeholder="请选择">
<el-option
v-for="item in $store.state.mallList"
:key="item.mallId"
@@ -19,6 +19,16 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="form.isSemi" label="经营站点" style="width: 100%;" prop="siteId" :rules="[{ required: true, message: '请选择经营站点', trigger: 'blur' }]">
<el-select style="width: 380px" multiple v-model="form.siteId" placeholder="请选择">
<el-option
v-for="item in siteList"
:key="item.siteId"
:label="item.siteName"
:value="item.siteId">
</el-option>
</el-select>
</el-form-item>
<el-form-item
prop="isSameCategory"
label="是否保持相同类目:"
@@ -109,7 +119,9 @@ export default {
type: 1, // 默认从temu复制
targetMallId: '',
targetCatId: [],
isSameCategory: true
isSameCategory: true,
isSemi: false,
siteId: []
},
goods: {},
sku: {},
@@ -120,15 +132,45 @@ export default {
goodsProperty: [],
catId: null,
currentIndex: 0,
successList: []
successList: [],
siteList: []
}
},
created () {
this.getSiteList()
if (this.params?.url) {
this.form.url = this.params.url
}
},
methods: {
onMallChange() {
if (!this.form.targetMallId) {
Message.error("请先选择店铺")
return
}
let tempMall = this.$store.state.mallList.filter(item => {
return item.mallId == this.form.targetMallId
})
if (null == tempMall || tempMall.length == 0) {
Message.error("请先选择店铺")
return
} else {
this.form.isSemi = tempMall[0].isSemiManagedMall
}
},
getSiteList() {
sendChromeAPIMessage({
url: 'bg-visage-mms/config/common/site/query',
needMallId: true,
mallId: this.$store.state.mallList[0].mallId,
data: {}}).then((res) => {
if (res.success) {
this.siteList = res.result.siteBaseList.filter(item => {
return item.matchSemiManaged
})
}
})
},
toAddToDraft() {
this.$refs.form.validate((valid) => {
if (valid) {
@@ -199,9 +241,9 @@ export default {
flag = true
}
})
if (!flag && (item1.specKeyId != 1001 && item1.specKeyId != 43404162)) {
/*if (!flag && (item1.specKeyId != 1001 && item1.specKeyId != 43404162)) {
specIds.push({spec_key_id: item1.spec_key_id, spec_value: item1.spec_value})
}
}*/
})
})
@@ -265,9 +307,9 @@ export default {
flag = true
}
})
if (!flag && (item1.specKeyId != 1001 && item1.specKeyId != 43404162)) {
/*if (!flag && (item1.specKeyId != 1001 && item1.specKeyId != 43404162)) {
specIds.push({specKeyId: item1.specKeyId, specValue: item1.specValue})
}
}*/
})
})
@@ -297,19 +339,23 @@ export default {
})
},
async createDraft(data) {
let reqData = {}
let catId = null;
if (this.form.isSameCategory) {
catId = this.catId;
reqData.catId = this.catId;
} else {
catId = this.form.targetCatId[this.form.targetCatId.length - 1]
reqData.catId = this.form.targetCatId[this.form.targetCatId.length - 1]
}
if (this.form.isSemi) {
reqData.productSemiManagedReq = {
bindSiteIds: this.form.siteId
}
}
let res = await sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/add',
needMallId: true,
mallId: this.form.targetMallId,
data: {
catId: catId
}})
data: reqData})
if (res.errorCode == 1000000) {
let draftId = res.result.productDraftId
@@ -318,7 +364,7 @@ export default {
if (this.form.isSameCategory) {
let res2 = await this.$http.post('/api/innerCategory/fullById',null , {
params: {
id: catId
id: reqData.catId
}
})
for (; i < res2.data.length; i++) {
@@ -330,7 +376,7 @@ export default {
needMallId: true,
mallId: this.form.targetMallId,
data: {
catId: catId,
catId: reqData.catId,
productCreateTime: null,
langList: [
"en"
@@ -384,6 +430,11 @@ export default {
}
},
createProduct(content) {
if (this.form.isSemi) {
content.productSemiManagedReq = {
bindSiteIds: this.form.siteId
}
}
sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/save',
needMallId: true,

View File

@@ -182,9 +182,9 @@ import AiPayment from "@/components/AiPayment.vue";
return '未激活';
} else if (this.$store.state.userInfo.flag == 1) {
if (this.$store.state.userInfo.type != 4) {
return `(${this.$store.state.userInfo.mallName})` + this.vipType[this.$store.state.userInfo.type];
return `(${this.$store.state.userInfo.mallName})` + this.vipType[this.$store.state.userInfo.type] + '(' + this.$store.state.userInfo.expireTime.substring(0,10) + ')';
} else {
return this.vipType[this.$store.state.userInfo.type]
return this.vipType[this.$store.state.userInfo.type] + '(' + this.$store.state.userInfo.expireTime.substring(0,10) + ')'
}
} else {

View File

@@ -287,7 +287,7 @@ import AiLazyCascader from "@/components/AiLazyCascader.vue"
sendChromeAPIMessage({
url: 'bg-visage-mms/config/common/site/query',
needMallId: true,
mallId: this.productPage.mallId,
mallId: this.$store.state.mallList[0].mallId,
data: {}}).then((res) => {
if (res.success) {
this.siteList = res.result.siteBaseList.filter(item => {