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-input type="textarea" :rows="5" v-model="form.url"></el-input>
</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="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 <el-option
v-for="item in $store.state.mallList" v-for="item in $store.state.mallList"
:key="item.mallId" :key="item.mallId"
@@ -19,6 +19,16 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </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 <el-form-item
prop="isSameCategory" prop="isSameCategory"
label="是否保持相同类目:" label="是否保持相同类目:"
@@ -109,7 +119,9 @@ export default {
type: 1, // 默认从temu复制 type: 1, // 默认从temu复制
targetMallId: '', targetMallId: '',
targetCatId: [], targetCatId: [],
isSameCategory: true isSameCategory: true,
isSemi: false,
siteId: []
}, },
goods: {}, goods: {},
sku: {}, sku: {},
@@ -120,15 +132,45 @@ export default {
goodsProperty: [], goodsProperty: [],
catId: null, catId: null,
currentIndex: 0, currentIndex: 0,
successList: [] successList: [],
siteList: []
} }
}, },
created () { created () {
this.getSiteList()
if (this.params?.url) { if (this.params?.url) {
this.form.url = this.params.url this.form.url = this.params.url
} }
}, },
methods: { 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() { toAddToDraft() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
@@ -199,9 +241,9 @@ export default {
flag = true 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}) specIds.push({spec_key_id: item1.spec_key_id, spec_value: item1.spec_value})
} }*/
}) })
}) })
@@ -265,9 +307,9 @@ export default {
flag = true 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}) specIds.push({specKeyId: item1.specKeyId, specValue: item1.specValue})
} }*/
}) })
}) })
@@ -297,19 +339,23 @@ export default {
}) })
}, },
async createDraft(data) { async createDraft(data) {
let reqData = {}
let catId = null; let catId = null;
if (this.form.isSameCategory) { if (this.form.isSameCategory) {
catId = this.catId; reqData.catId = this.catId;
} else { } 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({ let res = await sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/add', url: 'bg-visage-mms/product/draft/add',
needMallId: true, needMallId: true,
mallId: this.form.targetMallId, mallId: this.form.targetMallId,
data: { data: reqData})
catId: catId
}})
if (res.errorCode == 1000000) { if (res.errorCode == 1000000) {
let draftId = res.result.productDraftId let draftId = res.result.productDraftId
@@ -318,7 +364,7 @@ export default {
if (this.form.isSameCategory) { if (this.form.isSameCategory) {
let res2 = await this.$http.post('/api/innerCategory/fullById',null , { let res2 = await this.$http.post('/api/innerCategory/fullById',null , {
params: { params: {
id: catId id: reqData.catId
} }
}) })
for (; i < res2.data.length; i++) { for (; i < res2.data.length; i++) {
@@ -330,7 +376,7 @@ export default {
needMallId: true, needMallId: true,
mallId: this.form.targetMallId, mallId: this.form.targetMallId,
data: { data: {
catId: catId, catId: reqData.catId,
productCreateTime: null, productCreateTime: null,
langList: [ langList: [
"en" "en"
@@ -384,6 +430,11 @@ export default {
} }
}, },
createProduct(content) { createProduct(content) {
if (this.form.isSemi) {
content.productSemiManagedReq = {
bindSiteIds: this.form.siteId
}
}
sendChromeAPIMessage({ sendChromeAPIMessage({
url: 'bg-visage-mms/product/draft/save', url: 'bg-visage-mms/product/draft/save',
needMallId: true, needMallId: true,

View File

@@ -182,9 +182,9 @@ import AiPayment from "@/components/AiPayment.vue";
return '未激活'; return '未激活';
} else if (this.$store.state.userInfo.flag == 1) { } else if (this.$store.state.userInfo.flag == 1) {
if (this.$store.state.userInfo.type != 4) { 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 { } 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 { } else {

View File

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