|
@@ -143,7 +143,8 @@ var vm = new Vue({
|
|
|
specifications: [],
|
|
|
brands: [],
|
|
|
freights: [],
|
|
|
- showInput: true
|
|
|
+ showInput: true,
|
|
|
+ categoryId: ''
|
|
|
},
|
|
|
methods: {
|
|
|
delSpeRow: function (index) {
|
|
@@ -196,12 +197,9 @@ var vm = new Vue({
|
|
|
vm.brands = [];
|
|
|
vm.freights = [];
|
|
|
vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
|
|
|
- vm.attributeCategories = [];
|
|
|
vm.getMacro();
|
|
|
vm.getBrand();
|
|
|
vm.getFreights();
|
|
|
- vm.getAttributeCategories();
|
|
|
- vm.getAttributes();
|
|
|
vm.showInput = true;
|
|
|
},
|
|
|
update: function (event) {
|
|
@@ -213,22 +211,19 @@ var vm = new Vue({
|
|
|
vm.title = "修改";
|
|
|
vm.uploadList = [];
|
|
|
vm.getInfo(id);
|
|
|
+ var opt = {};
|
|
|
+ opt.value = vm.goods.categoryId;
|
|
|
+ opt.flag = 1;
|
|
|
+ vm.getAttributes(opt);
|
|
|
vm.getMacro();
|
|
|
vm.getBrand();
|
|
|
vm.getFreights();
|
|
|
- vm.getAttributeCategories();
|
|
|
vm.getGoodsGallery(id);
|
|
|
- vm.getAttributes();
|
|
|
vm.showInput = true;
|
|
|
if (vm.goods.goodsBizType == '10' || vm.goods.goodsBizType == '02') {
|
|
|
vm.showInput = false;
|
|
|
}
|
|
|
},
|
|
|
- getAttributes: function () {
|
|
|
- $.get("../attribute/queryAll", function (r) {
|
|
|
- vm.attributes = r.list;
|
|
|
- });
|
|
|
- },
|
|
|
getMacro: function () {
|
|
|
// 获取货品业务类型
|
|
|
$.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
|
|
@@ -251,11 +246,6 @@ var vm = new Vue({
|
|
|
vm.uploadList = r.list;
|
|
|
});
|
|
|
},
|
|
|
- getAttributeCategories: function () {
|
|
|
- $.get("../attributecategory/queryAll", function (r) {
|
|
|
- vm.attributeCategories = r.list;
|
|
|
- });
|
|
|
- },
|
|
|
saveOrUpdate: function (event) {
|
|
|
var url = vm.goods.id == null ? "../goods/save" : "../goods/update";
|
|
|
vm.goods.goodsDesc = $('#goodsDesc').editable('getHTML');
|
|
@@ -374,8 +364,10 @@ var vm = new Vue({
|
|
|
getInfo: function (id) {
|
|
|
$.get("../goods/info/" + id, function (r) {
|
|
|
vm.goods = r.goods;
|
|
|
+ vm.categoryId = r.goods.categoryId;
|
|
|
// vm.getCategory();
|
|
|
- var opt = {}; opt.value = vm.goods.attributeCategory;
|
|
|
+ var opt = {};
|
|
|
+ opt.value = vm.goods.attributeCategory;
|
|
|
vm.changeCategories(opt);
|
|
|
if (r.goods.attributeEntityList.length > 0) {
|
|
|
vm.attributeEntityList = r.goods.attributeEntityList;
|
|
@@ -387,6 +379,7 @@ var vm = new Vue({
|
|
|
} else {
|
|
|
vm.productEntityList = [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}];
|
|
|
}
|
|
|
+
|
|
|
$('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
|
|
|
});
|
|
|
},
|
|
@@ -458,12 +451,33 @@ var vm = new Vue({
|
|
|
var value = opt.value;
|
|
|
$.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
|
|
|
vm.queryCategoriesTwo = r.list;
|
|
|
- // vm.reload();
|
|
|
});
|
|
|
},
|
|
|
+ getAttributes: function (opt) {
|
|
|
+ var value = opt.value;
|
|
|
+ $.get("../attribute/query?attributeCategoryId=" + value, function (r) {
|
|
|
+ vm.attributes = r.list;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (opt.flag != 1 && !(value === vm.categoryId)) {
|
|
|
+ if (vm.attributeEntityList.length > 0) {
|
|
|
+ for (var i = 0; i < vm.attributeEntityList.length; i++) {
|
|
|
+ if (!(vm.attributeEntityList[0].attributeId === '')) {
|
|
|
+ vm.attributeEntityList[i].isDelete = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var goodsId = '';
|
|
|
+ if (vm.goods) {
|
|
|
+ goodsId = vm.goods.id;
|
|
|
+ }
|
|
|
+ vm.attributeEntityList.unshift({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
changeCategories: function (opt) {
|
|
|
var value = opt.value;
|
|
|
- $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
|
|
|
+ $.get("../category/getCategorySelectByParent?isShow=1&parentId=" + value, function (r) {
|
|
|
vm.categoriesTwo = r.list;
|
|
|
});
|
|
|
},
|
|
@@ -559,7 +573,9 @@ var vm = new Vue({
|
|
|
// this.uploadList = this.$refs.upload.fileList;
|
|
|
$.get("../category/getCategorySelect", function (r) {
|
|
|
vm.queryCategories = r.list;
|
|
|
+ });
|
|
|
+ $.get("../category/getCategorySelect?isShow=1", function (r) {
|
|
|
vm.categories = r.list;
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
});
|