12121
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
<el-row v-show="currentTab === 0" :gutter="24">
|
<el-row v-show="currentTab === 0" :gutter="24">
|
||||||
<!-- 商品信息-->
|
<!-- 商品信息-->
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品分类:" prop="categorys" :rules="[{ required: true, message: '请选择商品分类', trigger: ['blur', 'change'] }]">
|
<el-form-item label="商品分类:" prop="categorys" :rules="[{ required: true, message: '请选择商品分类', trigger: ['blur'] }]">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
@change="cascaderChange"
|
@change="cascaderChange"
|
||||||
v-model="formValidate.categorys"
|
v-model="formValidate.categorys"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品名称:" prop="productName" :rules="[{ required: true, message: '请输入商品名称', trigger: ['blur', 'change'] }]">
|
<el-form-item label="商品名称:" prop="productName" :rules="[{ required: true, message: '请输入商品名称', trigger: ['blur'] }]">
|
||||||
<el-input v-model="formValidate.productName" maxlength="249" placeholder="请输入商品名称" :disabled="isDisabled" />
|
<el-input v-model="formValidate.productName" maxlength="249" placeholder="请输入商品名称" :disabled="isDisabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品品牌:" prop="brandId" :rules="[{ required: true, message: '请选择商品品牌', trigger: ['blur', 'change'] }]">
|
<el-form-item label="商品品牌:" prop="brandId" :rules="[{ required: true, message: '请选择商品品牌', trigger: ['blur'] }]">
|
||||||
<el-select style="width: 100%;" v-model="formValidate.brandId" placeholder="请选择">
|
<el-select style="width: 100%;" v-model="formValidate.brandId" placeholder="请选择">
|
||||||
<el-option v-for="item in brandOptions" :key="item.id" :label="item.brandName" :value="item.id"> </el-option>
|
<el-option v-for="item in brandOptions" :key="item.id" :label="item.brandName" :value="item.id"> </el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -57,12 +57,12 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品售价" prop="price" :rules="[{ required: true, message: '请输入商品售价', trigger: ['blur', 'change'] }]">
|
<el-form-item label="商品售价" prop="price" :rules="[{ required: true, message: '请输入商品售价', trigger: ['blur'] }]">
|
||||||
<el-input v-model="formValidate.price" maxlength="249" type="number" placeholder="请输入商品售价" :disabled="isDisabled" />
|
<el-input v-model="formValidate.price" maxlength="249" type="number" placeholder="请输入商品售价" :disabled="isDisabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品类型:" prop="productType" :rules="[{ required: true, message: '请选择商品类型', trigger: ['blur', 'change'] }]">
|
<el-form-item label="商品类型:" prop="productType" :rules="[{ required: true, message: '请选择商品类型', trigger: ['blur'] }]">
|
||||||
<el-select style="width: 100%;" v-model="formValidate.productType" placeholder="请选择商品类型">
|
<el-select style="width: 100%;" v-model="formValidate.productType" placeholder="请选择商品类型">
|
||||||
<el-option label="店铺商品" value="2"> </el-option>
|
<el-option label="店铺商品" value="2"> </el-option>
|
||||||
<el-option label="平台商品" value="1"> </el-option>
|
<el-option label="平台商品" value="1"> </el-option>
|
||||||
@@ -76,9 +76,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col> -->
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="自提油站" prop="siteIds" :rules="[{ required: true, message: '请选择自提油站', trigger: ['blur', 'change'] }]">
|
<el-form-item label="自提油站" prop="siteIds">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-model="formValidate.siteIds"
|
|
||||||
style="margin-left: 10px;"
|
style="margin-left: 10px;"
|
||||||
:key="tagIndex"
|
:key="tagIndex"
|
||||||
v-for="(tag, tagIndex) in OilStationSelectionList"
|
v-for="(tag, tagIndex) in OilStationSelectionList"
|
||||||
@@ -129,7 +128,7 @@
|
|||||||
<el-form-item
|
<el-form-item
|
||||||
label="选择规格:"
|
label="选择规格:"
|
||||||
prop="attributesTypeId"
|
prop="attributesTypeId"
|
||||||
:rules="[{ required: true, message: '请选择规格', trigger: ['blur', 'change'] }]"
|
:rules="[{ required: true, message: '请选择规格', trigger: ['blur'] }]"
|
||||||
>
|
>
|
||||||
<div class="acea-row">
|
<div class="acea-row">
|
||||||
<el-select v-model="formValidate.attributesTypeId">
|
<el-select v-model="formValidate.attributesTypeId">
|
||||||
@@ -555,29 +554,30 @@ export default {
|
|||||||
console.log(from.path) //从哪来
|
console.log(from.path) //从哪来
|
||||||
console.log(to.path, to.params) //到哪去
|
console.log(to.path, to.params) //到哪去
|
||||||
},
|
},
|
||||||
'formValidate.content': function(n) {
|
'formValidate.content': function(n) { },
|
||||||
console.log(n, '++++++++++++++++++++++')
|
|
||||||
},
|
|
||||||
ManyAttrValue(n) {},
|
ManyAttrValue(n) {},
|
||||||
'formValidate.attr': {
|
'formValidate.attr': {
|
||||||
handler: function(val) {
|
handler: function(val,o) {
|
||||||
if (this.isAttr) this.watCh(val) //重要!!!
|
if (this.isAttr) this.watCh(val,o) //重要!!!
|
||||||
},
|
},
|
||||||
immediate: false,
|
immediate: false,
|
||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
async created() {
|
||||||
this.chenkId()
|
await this.chenkId()
|
||||||
this.getCategorySelect()
|
await this.getCategorySelect()
|
||||||
this.productGetRule()
|
await this.productGetRule()
|
||||||
this.brandGetAll()
|
await this.brandGetAll()
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
|
deactivated() {
|
||||||
|
this.$destroy();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
chenkId() {
|
async chenkId() {
|
||||||
if (this.$route.params && this.$route.params.id) {
|
if (this.$route.query && this.$route.query.id) {
|
||||||
this.getproductInfo(this.$route.params.id)
|
await this.getproductInfo(this.$route.query.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
productAddGetSites(ids) {
|
productAddGetSites(ids) {
|
||||||
@@ -590,19 +590,23 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async inverseAnalysis(data) {
|
async inverseAnalysis(data) {
|
||||||
let { categoryOneId, categoryTwoId } = data
|
let { categoryOneId, categoryTwoId } = data;
|
||||||
let categorys = [categoryOneId, categoryTwoId]
|
let categorys = [categoryOneId, categoryTwoId];
|
||||||
this.OilStationSelectionList = data.siteInfos
|
this.OilStationSelectionList = data.siteInfos;
|
||||||
Object.assign(this.formValidate, {
|
this.formValidate = {
|
||||||
|
...this.formValidate,
|
||||||
categorys,
|
categorys,
|
||||||
...data
|
...data
|
||||||
})
|
}
|
||||||
|
// Object.assign(this.formValidate, {
|
||||||
|
// categorys,
|
||||||
|
// ...data
|
||||||
|
// })
|
||||||
this.$refs.CustomUpload.fileList = [...this.formValidate.images.filter(item => item.mainMark == '1')]
|
this.$refs.CustomUpload.fileList = [...this.formValidate.images.filter(item => item.mainMark == '1')]
|
||||||
this.$refs.CustomLBUpload.fileList = [...this.formValidate.images.filter(item => item.mainMark != '1')]
|
this.$refs.CustomLBUpload.fileList = [...this.formValidate.images.filter(item => item.mainMark != '1')]
|
||||||
await this.confirm()
|
await this.confirm()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.formValidate.attr = this.formValidate.attr
|
this.formValidate.attr = this.formValidate.attr.map(item => {
|
||||||
.map(item => {
|
|
||||||
let align = this.formValidate.checkedList.find(i => item.id == i.attributeId)
|
let align = this.formValidate.checkedList.find(i => item.id == i.attributeId)
|
||||||
if (align) {
|
if (align) {
|
||||||
return {
|
return {
|
||||||
@@ -615,22 +619,24 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
})
|
}).filter(item => item);
|
||||||
.filter(item => item)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ManyAttrValue.forEach((item, index) => {
|
this.ManyAttrValue.forEach((item, index) => {
|
||||||
let data = this.formValidate.stockList.find(i => i.attributeJson == JSON.stringify(item.data))
|
let data = this.formValidate.stockList.find(i => i.attributeJson == JSON.stringify(item.data));
|
||||||
if (data) {
|
if (data) {
|
||||||
Object.assign(item, data)
|
Object.assign(item, data,{delect:false})
|
||||||
|
}else{
|
||||||
|
Object.assign(item, data,{delect:true})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.ManyAttrValue = this.ManyAttrValue.filter(item=>!item.delect)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getproductInfo(id) {
|
async getproductInfo(id) {
|
||||||
productApi.productAddGetEdit(id).then(res => {
|
await productApi.productAddGetEdit(id).then( async res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
this.inverseAnalysis(res.data)
|
await this.inverseAnalysis(res.data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -645,8 +651,8 @@ export default {
|
|||||||
this.isOilStationSelection = false
|
this.isOilStationSelection = false
|
||||||
this.formValidate.siteIds = e.map(item => item.siteId)
|
this.formValidate.siteIds = e.map(item => item.siteId)
|
||||||
},
|
},
|
||||||
brandGetAll() {
|
async brandGetAll() {
|
||||||
productApi.brandGetAll().then(res => {
|
await productApi.brandGetAll().then(res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
this.brandOptions = res.data
|
this.brandOptions = res.data
|
||||||
}
|
}
|
||||||
@@ -709,7 +715,7 @@ export default {
|
|||||||
},
|
},
|
||||||
setTagsViewTitle() {
|
setTagsViewTitle() {
|
||||||
const title = this.isDisabled ? '商品详情' : '编辑商品'
|
const title = this.isDisabled ? '商品详情' : '编辑商品'
|
||||||
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.params.id}` })
|
const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.$route.query.id}` })
|
||||||
this.$store.dispatch('tagsView/updateVisitedView', route)
|
this.$store.dispatch('tagsView/updateVisitedView', route)
|
||||||
},
|
},
|
||||||
onChangeGroup() {
|
onChangeGroup() {
|
||||||
@@ -720,7 +726,7 @@ export default {
|
|||||||
this.checkboxGroup.includes('isHot') ? (this.formValidate.isHot = true) : (this.formValidate.isHot = false)
|
this.checkboxGroup.includes('isHot') ? (this.formValidate.isHot = true) : (this.formValidate.isHot = false)
|
||||||
},
|
},
|
||||||
// sku算法
|
// sku算法
|
||||||
watCh(val) {
|
watCh(val,o) {
|
||||||
let arr = []
|
let arr = []
|
||||||
this.manyTabDate = []
|
this.manyTabDate = []
|
||||||
for (let i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
@@ -747,7 +753,8 @@ export default {
|
|||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
[{}]
|
[{}]
|
||||||
)
|
);
|
||||||
|
console.log(this.ManyAttrValue ,"this.ManyAttrValue ")
|
||||||
},
|
},
|
||||||
attrFormat(arr) {
|
attrFormat(arr) {
|
||||||
let data = []
|
let data = []
|
||||||
@@ -852,8 +859,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 商品分类;
|
// 商品分类;
|
||||||
getCategorySelect() {
|
async getCategorySelect() {
|
||||||
productApi.getClassificationTree().then(res => {
|
await productApi.getClassificationTree().then(res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
this.merCateList = res.data
|
this.merCateList = res.data
|
||||||
}
|
}
|
||||||
@@ -961,6 +968,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
item.splice(index, 1)
|
item.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
// 添加规则名称
|
// 添加规则名称
|
||||||
createAttrName() {
|
createAttrName() {
|
||||||
@@ -1012,7 +1020,7 @@ export default {
|
|||||||
// 详情
|
// 详情
|
||||||
getInfo() {
|
getInfo() {
|
||||||
this.fullscreenLoading = true
|
this.fullscreenLoading = true
|
||||||
productDetailApi(this.$route.params.id)
|
productDetailApi(this.$route.query.id)
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
// this.isAttr = true;
|
// this.isAttr = true;
|
||||||
let info = res
|
let info = res
|
||||||
@@ -1172,6 +1180,7 @@ export default {
|
|||||||
if (this.currentTab-- < 0) this.currentTab = 0
|
if (this.currentTab-- < 0) this.currentTab = 0
|
||||||
},
|
},
|
||||||
handleSubmitNest(name) {
|
handleSubmitNest(name) {
|
||||||
|
console.log(this.formValidate,"handleSubmitNest")
|
||||||
this.$refs[name].validate(valid => {
|
this.$refs[name].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.currentTab++ > 2) this.currentTab = 0
|
if (this.currentTab++ > 2) this.currentTab = 0
|
||||||
@@ -1198,7 +1207,10 @@ export default {
|
|||||||
let [categoryOneId, categoryTwoId] = this.formValidate.categorys
|
let [categoryOneId, categoryTwoId] = this.formValidate.categorys
|
||||||
let isRecommendOrNewMark = this.formValidate.recommendOrNewMark == '1' ? 'newMark' : 'recommend'
|
let isRecommendOrNewMark = this.formValidate.recommendOrNewMark == '1' ? 'newMark' : 'recommend'
|
||||||
let siteIds = this.OilStationSelectionList.map(item => item.siteId)
|
let siteIds = this.OilStationSelectionList.map(item => item.siteId)
|
||||||
|
if(siteIds.length==0){
|
||||||
|
this.$message.error('请选择油站')
|
||||||
|
return
|
||||||
|
}
|
||||||
let checkedList = this.formValidate.attr.map(item => {
|
let checkedList = this.formValidate.attr.map(item => {
|
||||||
let attributeId = item.id
|
let attributeId = item.id
|
||||||
let checked = item.sku.value.join(',')
|
let checked = item.sku.value.join(',')
|
||||||
@@ -1224,18 +1236,11 @@ export default {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(this.formValidate, 'formValidate')
|
|
||||||
console.log(categoryOneId, categoryTwoId, 'categoryOneId categoryTwoId')
|
|
||||||
console.log(isRecommendOrNewMark, 'isRecommendOrNewMark')
|
|
||||||
console.log(siteIds, 'siteIds')
|
|
||||||
console.log(checkedList, 'checkedList')
|
|
||||||
console.log(images, 'images')
|
|
||||||
console.log(stockList, 'stockList')
|
|
||||||
this.formValidate[isRecommendOrNewMark] = '1'
|
this.formValidate[isRecommendOrNewMark] = '1'
|
||||||
loadingFn.call(
|
loadingFn.call(
|
||||||
this,
|
this,
|
||||||
'loading',
|
'loading',
|
||||||
productApi[this.$route.params.id ? 'addUpdate' : 'addSave'](
|
productApi[this.$route.query.id ? 'addUpdate' : 'addSave'](
|
||||||
Object.assign(this.formValidate, {
|
Object.assign(this.formValidate, {
|
||||||
categoryOneId,
|
categoryOneId,
|
||||||
categoryTwoId,
|
categoryTwoId,
|
||||||
@@ -1249,7 +1254,7 @@ export default {
|
|||||||
this.$message.success('操作成功')
|
this.$message.success('操作成功')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$router.push({ path: 'productList' })
|
this.$router.push({ path: 'productList' })
|
||||||
this.$destroy()
|
// this.$destroy()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="兑换积分" prop="skuNum">
|
<el-table-column label="兑换积分" prop="skuNum">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input maxlength="9" min="0.01" v-model="scope.row.skuNum" class="priceBox" />
|
<el-input maxlength="9" min="0.01" v-model="scope.row.integral" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
@@ -697,8 +697,8 @@ export default {
|
|||||||
edit(row) {
|
edit(row) {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'productAdd',
|
path: '/product/productAdd',
|
||||||
params: {
|
query: {
|
||||||
id: row.id
|
id: row.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user