|
|
|
@ -193,6 +193,16 @@
|
|
|
|
<!-- 销售设置 -->
|
|
|
|
<!-- 销售设置 -->
|
|
|
|
<el-tab-pane label="销售设置" name="fourth">
|
|
|
|
<el-tab-pane label="销售设置" name="fourth">
|
|
|
|
<el-form ref="fourth" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%">
|
|
|
|
<el-form ref="fourth" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%">
|
|
|
|
|
|
|
|
<el-form-item label="所属品牌" prop="brandId">
|
|
|
|
|
|
|
|
<el-select v-model="baseForm.brandId" placeholder="请选择">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in brandList"
|
|
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
|
|
:label="item.name"
|
|
|
|
|
|
|
|
:value="item.id">
|
|
|
|
|
|
|
|
</el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="虚拟销量" prop="virtualSalesCount">
|
|
|
|
<el-form-item label="虚拟销量" prop="virtualSalesCount">
|
|
|
|
<el-input v-model="baseForm.virtualSalesCount" placeholder="请输入虚拟销量" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"/>
|
|
|
|
<el-input v-model="baseForm.virtualSalesCount" placeholder="请输入虚拟销量" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -221,8 +231,10 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import {getBrandList} from "@/api/mall/product/brand";
|
|
|
|
import {getProductCategoryList} from "@/api/mall/product/category";
|
|
|
|
import {getProductCategoryList} from "@/api/mall/product/category";
|
|
|
|
import {createSpu,} from "@/api/mall/product/spu";
|
|
|
|
import {createSpu, getSpu} from "@/api/mall/product/spu";
|
|
|
|
import {getPropertyPage,} from "@/api/mall/product/property";
|
|
|
|
import {getPropertyPage,} from "@/api/mall/product/property";
|
|
|
|
import Editor from "@/components/Editor";
|
|
|
|
import Editor from "@/components/Editor";
|
|
|
|
import ImageUpload from "@/components/ImageUpload";
|
|
|
|
import ImageUpload from "@/components/ImageUpload";
|
|
|
|
@ -232,6 +244,13 @@ export default {
|
|
|
|
Editor,
|
|
|
|
Editor,
|
|
|
|
ImageUpload
|
|
|
|
ImageUpload
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
props:{//props列表
|
|
|
|
|
|
|
|
type:{
|
|
|
|
|
|
|
|
type:String,
|
|
|
|
|
|
|
|
default:"add" //定义参数默认值
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
obj: Object
|
|
|
|
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
activeName: "base",
|
|
|
|
activeName: "base",
|
|
|
|
@ -251,6 +270,7 @@ export default {
|
|
|
|
status: 0,
|
|
|
|
status: 0,
|
|
|
|
virtualSalesCount: 0,
|
|
|
|
virtualSalesCount: 0,
|
|
|
|
showStock: true,
|
|
|
|
showStock: true,
|
|
|
|
|
|
|
|
brandId: null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
categoryList: [],
|
|
|
|
categoryList: [],
|
|
|
|
// 价格库存
|
|
|
|
// 价格库存
|
|
|
|
@ -270,6 +290,7 @@ export default {
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
],
|
|
|
|
],
|
|
|
|
propertyPageList: [],
|
|
|
|
propertyPageList: [],
|
|
|
|
|
|
|
|
brandList: [],
|
|
|
|
specValue: null,
|
|
|
|
specValue: null,
|
|
|
|
|
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
// 表单校验
|
|
|
|
@ -283,11 +304,13 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
|
|
|
|
this.getListBrand();
|
|
|
|
this.getListCategory();
|
|
|
|
this.getListCategory();
|
|
|
|
this.getPropertyPageList();
|
|
|
|
this.getPropertyPageList();
|
|
|
|
|
|
|
|
if(this.type == 'upd'){
|
|
|
|
|
|
|
|
this.updateType(this.obj.id)
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
removeSpec(index){
|
|
|
|
removeSpec(index){
|
|
|
|
@ -351,6 +374,13 @@ export default {
|
|
|
|
getProductCategoryList().then((response) => {
|
|
|
|
getProductCategoryList().then((response) => {
|
|
|
|
this.categoryList = this.handleTree(response.data, "id", "parentId");
|
|
|
|
this.categoryList = this.handleTree(response.data, "id", "parentId");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/** 查询品牌列表 */
|
|
|
|
|
|
|
|
getListBrand() {
|
|
|
|
|
|
|
|
// 执行查询
|
|
|
|
|
|
|
|
getBrandList().then((response) => {
|
|
|
|
|
|
|
|
this.brandList = response.data;
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
cancel() {
|
|
|
|
this.$emit("closeDialog");
|
|
|
|
this.$emit("closeDialog");
|
|
|
|
@ -366,7 +396,13 @@ export default {
|
|
|
|
rates.forEach(r => {
|
|
|
|
rates.forEach(r => {
|
|
|
|
let properties = []
|
|
|
|
let properties = []
|
|
|
|
Array.of(r.spec).forEach(s => {
|
|
|
|
Array.of(r.spec).forEach(s => {
|
|
|
|
Array.of(s).forEach((v, i) => {
|
|
|
|
let obj;
|
|
|
|
|
|
|
|
if (s instanceof Array) {
|
|
|
|
|
|
|
|
obj = s;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
obj = Array.of(s);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
obj.forEach((v, i) => {
|
|
|
|
console.log(this.dynamicSpec, r, s, v, i)
|
|
|
|
console.log(this.dynamicSpec, r, s, v, i)
|
|
|
|
let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v);
|
|
|
|
let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v);
|
|
|
|
console.log(specValue)
|
|
|
|
console.log(specValue)
|
|
|
|
@ -382,9 +418,6 @@ export default {
|
|
|
|
rates[0].name = this.baseForm.name;
|
|
|
|
rates[0].name = this.baseForm.name;
|
|
|
|
rates[0].status = this.baseForm.status;
|
|
|
|
rates[0].status = this.baseForm.status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log(rates)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let form = this.baseForm
|
|
|
|
let form = this.baseForm
|
|
|
|
if(form.picUrls instanceof Array){
|
|
|
|
if(form.picUrls instanceof Array){
|
|
|
|
form.picUrls = form.picUrls.flatMap(m=>m.split(','))
|
|
|
|
form.picUrls = form.picUrls.flatMap(m=>m.split(','))
|
|
|
|
@ -422,6 +455,24 @@ export default {
|
|
|
|
spec.specValue = obj.propertyValueList;
|
|
|
|
spec.specValue = obj.propertyValueList;
|
|
|
|
this.dynamicSpec = dynamicSpec;
|
|
|
|
this.dynamicSpec = dynamicSpec;
|
|
|
|
this.buildRatesFormRates();
|
|
|
|
this.buildRatesFormRates();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
updateType(id){
|
|
|
|
|
|
|
|
getSpu(id).then((response) =>{
|
|
|
|
|
|
|
|
console.log(response)
|
|
|
|
|
|
|
|
let data = response.data;
|
|
|
|
|
|
|
|
this.baseForm.name=data.name;
|
|
|
|
|
|
|
|
this.baseForm.sellPoint=data.sellPoint;
|
|
|
|
|
|
|
|
this.baseForm.categoryIds=data.categoryIds;
|
|
|
|
|
|
|
|
this.baseForm.sort=data.sort;
|
|
|
|
|
|
|
|
this.baseForm.description=data.description;
|
|
|
|
|
|
|
|
this.baseForm.picUrls=data.picUrls;
|
|
|
|
|
|
|
|
this.baseForm.status=data.status;
|
|
|
|
|
|
|
|
this.baseForm.virtualSalesCount=data.virtualSalesCount;
|
|
|
|
|
|
|
|
this.baseForm.showStock=data.showStock;
|
|
|
|
|
|
|
|
this.baseForm.brandId=data.brandId;
|
|
|
|
|
|
|
|
this.ratesForm.spec=data.specType;
|
|
|
|
|
|
|
|
this.ratesForm.rates=data.skus
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|