|
@@ -39,7 +39,7 @@
|
|
|
<el-button v-show="ismakeup===0" @click="openMakeup">选择商品</el-button>
|
|
|
</template>
|
|
|
<template v-slot:makeupTable>
|
|
|
- <div v-if="makeupList.length>0">
|
|
|
+ <div v-if="ismakeup===0">
|
|
|
<by-table :propConfig="makeupTable" ref="makeupTable"></by-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -326,8 +326,7 @@
|
|
|
tableConfig : any = {
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
- height: 486,
|
|
|
- align: 'center',
|
|
|
+ align: 'left',
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
@@ -863,7 +862,7 @@
|
|
|
size: 'mini',
|
|
|
align: 'left',
|
|
|
checkbox: true,
|
|
|
- height: 560,
|
|
|
+ calculateH: '100%',
|
|
|
},
|
|
|
columns: [{
|
|
|
width: 250,
|
|
@@ -925,7 +924,6 @@
|
|
|
}
|
|
|
// 确定商品新增
|
|
|
confirmProduct(e : any) {
|
|
|
- this.makeupList = e;
|
|
|
this.$nextTick(() => {
|
|
|
let nowData = (this.$refs.makeupTable as any).getValue();
|
|
|
let names = '';
|
|
@@ -947,8 +945,9 @@
|
|
|
let obj : any = {};
|
|
|
obj.skuTitle = item.skuTitle
|
|
|
obj.skuSubtitle = item.skuSubtitle
|
|
|
- // obj.materialId = item.materialId
|
|
|
obj.materialSkuId = item.id
|
|
|
+ obj.isDeleted = 0
|
|
|
+ this.makeupList.push(obj);
|
|
|
nowData.push(obj);
|
|
|
}
|
|
|
};
|
|
@@ -982,7 +981,7 @@
|
|
|
doFormData() {
|
|
|
(this as any).$refs.form.validate().then(() => {
|
|
|
let query = (this as any).$refs.form.getValue();
|
|
|
- // console.log('物料信息 ==> ',query);
|
|
|
+ console.log('物料信息 ==> ', query);
|
|
|
query.materialSpec = this.materialSpec; // 商品规格
|
|
|
query.attributeList = JSON.stringify(this.attributeList) // 物料属性
|
|
|
query.attributeId = this.attributeId // 物料属性ID
|
|
@@ -1014,7 +1013,7 @@
|
|
|
if (!v.height) return this.$message.warning('物料高必填');
|
|
|
if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
|
|
|
};
|
|
|
- data = { maindataMaterial: query, maindataMaterialSkus: this.tableList }
|
|
|
+ data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
|
|
|
let newArray : any = []
|
|
|
let materialSpecData : any = []
|
|
|
let attributeLength = this.attributeList.length
|
|
@@ -1035,8 +1034,8 @@
|
|
|
if (materialSpecData[i]) v.materialSpec = JSON.stringify(materialSpecData[i])
|
|
|
})
|
|
|
} else { // 单规格
|
|
|
- data = { maindataMaterial: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
|
|
|
- console.log('单规格表格数据 ==> ', data.maindataMaterialSkus);
|
|
|
+ data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
|
|
|
+ // console.log('单规格表格数据 ==> ', data.maindataMaterialSkus);
|
|
|
for (let v of data.maindataMaterialSkus) {
|
|
|
if (!v.price) return this.$message.warning('物料价格必填');
|
|
|
if (parseInt(v.price) <= 0) return this.$message.warning('物料价格不能小于1');
|
|
@@ -1055,44 +1054,41 @@
|
|
|
if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
|
|
|
};
|
|
|
data.maindataMaterialSkus[0].isDeleted = 0;
|
|
|
- data.maindataMaterial.attributeList = ""
|
|
|
+ data.maindataMaterialReceiveParam.attributeList = ""
|
|
|
}
|
|
|
- console.log('data ==> ', data);
|
|
|
if (this.ismakeup === 0) {
|
|
|
- if (this.makeupList.length <= 0) return this.$message.warning('请选择组合商品');
|
|
|
- let makeupData = (this as any).$refs.makeupTable.getValue();
|
|
|
- for (let v of makeupData) {
|
|
|
- if (parseInt(v.number) <= 0) return this.$message.warning('组合商品数量不能小于1');
|
|
|
- v.materialId = data.maindataMaterial.id
|
|
|
- };
|
|
|
- console.log(makeupData);
|
|
|
- api.saveList(makeupData, 'maindataMaterialLink').then((value : any) => {
|
|
|
- console.log(value);
|
|
|
- })
|
|
|
+ if (this.makeupList.length < 0) return this.$message.warning('请选择组合商品');
|
|
|
+ data.maindataMaterialLinks = this.makeupList;
|
|
|
+ // 表格删除
|
|
|
+ data.maindataMaterialLinks.map((v : any, i : any) => {
|
|
|
+ if (v.isDeleted === 1 && !v.id) {
|
|
|
+ data.maindataMaterialLinks.splice(i, 1)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log('data ==> ', data);
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
+ if (this.isEdit) { // 编辑
|
|
|
+ api.updateList(data, 'maindataMaterial').then((res : any) => {
|
|
|
+ loading.close()
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.isShow = 'home';
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.getDataList();
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ } else {// 新增
|
|
|
+ api.saveList(data, 'maindataMaterial').then((res : any) => {
|
|
|
+ loading.close()
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.isShow = 'home';
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.getDataList();
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
}
|
|
|
-
|
|
|
- // let loading = this.$loading({ target: '.main-container' });
|
|
|
- // if (this.isEdit) { // 编辑
|
|
|
- // other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
- // loading.close()
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.isShow = 'home';
|
|
|
- // (this as any).$refs.sideTree.request();
|
|
|
- // this.getDataList();
|
|
|
- // this.$message.success('保存成功');
|
|
|
- // }
|
|
|
- // }).catch(() => loading.close());
|
|
|
- // } else {// 新增
|
|
|
- // other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
- // loading.close()
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.isShow = 'home';
|
|
|
- // (this as any).$refs.sideTree.request();
|
|
|
- // this.getDataList();
|
|
|
- // this.$message.success('保存成功');
|
|
|
- // }
|
|
|
- // }).catch(() => loading.close());
|
|
|
- // }
|
|
|
|
|
|
});
|
|
|
}
|
|
@@ -1125,84 +1121,98 @@
|
|
|
let loading = this.$loading({ target: '.my-container' });
|
|
|
api.single({ id: e.id }, 'maindataMaterial').then((v : any) => {
|
|
|
let data = v.data;
|
|
|
- api.single({ id: data.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data) data.vmCategoryName = res.data.name;
|
|
|
- }
|
|
|
- }).catch(() => loading.close());
|
|
|
- api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data) data.organizationCategoryName = res.data.name;
|
|
|
- }
|
|
|
- }).catch(() => loading.close());
|
|
|
- api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
- if (res.code === 200) data.categoryName = res.data.name;
|
|
|
- if (data.attributeId) {
|
|
|
- api.single({ id: data.attributeId }, 'maindataMaterialAttribute').then((p : any) => {
|
|
|
- if (p.code === 200) {
|
|
|
- if (p.data) this.selectValue = p.data.name
|
|
|
- }
|
|
|
- }).catch(() => loading.close());
|
|
|
- }
|
|
|
- this.intercept = data.attributeId // 拦截物料属性判断
|
|
|
- this.isEdit = true;
|
|
|
- this.editInfo = data;
|
|
|
- this.isShow = 'add';
|
|
|
- // 标签
|
|
|
- if (data.tags) {
|
|
|
- this.tagsData = data.tags.split(",")
|
|
|
- } else this.tagsData = [];
|
|
|
- this.materialSpec = data.materialSpec
|
|
|
- this.isSingle = data.materialSpec === 0 ? true : false;
|
|
|
- if (data.attributeList) this.attributeList = JSON.parse(data.attributeList);
|
|
|
- other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
|
|
|
- if (info.code === 200) {
|
|
|
- this.status = data.status
|
|
|
- this.ismakeup = data.ismakeup
|
|
|
- this.issued = data.issued
|
|
|
- if (this.isSingle) {
|
|
|
- this.selectValue = '' // 物料属性名称
|
|
|
- this.towTable = '' // 表格数据
|
|
|
- this.attributeList = []; // 属性规格
|
|
|
- this.$nextTick(() => {
|
|
|
- (this as any).$refs.singeTable.setValue(info.data);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.forFun(this.attributeList[0], 0) // 生成sku
|
|
|
- let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
|
|
|
- let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
|
|
|
- let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
|
|
|
- info.data.map((v : any, i : any) => {
|
|
|
- v = Object.assign(v, skuRuleList[i])
|
|
|
- v.dataIndex = i
|
|
|
- });
|
|
|
- newColumns.map((v : any) => {
|
|
|
- tableConfig.columns.unshift({
|
|
|
- width: '80px',
|
|
|
- title: v.title,
|
|
|
- field: v.field,
|
|
|
+ if (data.vmCategoryId) {
|
|
|
+ api.single({ id: data.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data) data.vmCategoryName = res.data.name;
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }
|
|
|
+ if (data.organizationCategoryId) {
|
|
|
+ api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data) data.organizationCategoryName = res.data.name;
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }
|
|
|
+ if (data.categoryId) {
|
|
|
+ api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) data.categoryName = res.data.name;
|
|
|
+ if (data.attributeId) {
|
|
|
+ api.single({ id: data.attributeId }, 'maindataMaterialAttribute').then((p : any) => {
|
|
|
+ if (p.code === 200) {
|
|
|
+ if (p.data) this.selectValue = p.data.name
|
|
|
+ }
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }
|
|
|
+ this.intercept = data.attributeId // 拦截物料属性判断
|
|
|
+ this.isEdit = true;
|
|
|
+ this.editInfo = data;
|
|
|
+ this.isShow = 'add';
|
|
|
+ // 标签
|
|
|
+ if (data.tags) {
|
|
|
+ this.tagsData = data.tags.split(",")
|
|
|
+ } else this.tagsData = [];
|
|
|
+ this.materialSpec = data.materialSpec
|
|
|
+ this.isSingle = data.materialSpec === 0 ? true : false;
|
|
|
+ if (data.attributeList) this.attributeList = JSON.parse(data.attributeList);
|
|
|
+ other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
|
|
|
+ if (info.code === 200) {
|
|
|
+ this.status = data.status
|
|
|
+ console.log(data.ismakeup);
|
|
|
+ this.ismakeup = data.ismakeup
|
|
|
+ if (data.ismakeup === 0 && data.maindataMaterialLinks.length > 0) {
|
|
|
+ (this as any).makeupList = data.maindataMaterialLinks;
|
|
|
+ setTimeout(() => {
|
|
|
+ (this as any).$refs.makeupTable.setValue(data.maindataMaterialLinks) // 设置组合表格数据
|
|
|
})
|
|
|
- });
|
|
|
- this.tableList = (this as any).$lodash.cloneDeep(info.data);
|
|
|
- // console.log('表格配置 ==> ', tableConfig);
|
|
|
- console.log('skuRuleList ==> ', skuRuleList);
|
|
|
- console.log('表格数据 ==> ', this.tableList);
|
|
|
- this.setTableConfig = tableConfig;
|
|
|
- this.$nextTick(() => {
|
|
|
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
- (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
|
|
|
- });
|
|
|
+ }
|
|
|
+ this.issued = data.issued
|
|
|
+ if (this.isSingle) {
|
|
|
+ this.selectValue = '' // 物料属性名称
|
|
|
+ this.towTable = '' // 表格数据
|
|
|
+ this.attributeList = []; // 属性规格
|
|
|
+ this.$nextTick(() => {
|
|
|
+ (this as any).$refs.singeTable.setValue(info.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.forFun(this.attributeList[0], 0) // 生成sku
|
|
|
+ let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
|
|
|
+ let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
|
|
|
+ let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
|
|
|
+ info.data.map((v : any, i : any) => {
|
|
|
+ v = Object.assign(v, skuRuleList[i])
|
|
|
+ v.dataIndex = i
|
|
|
+ });
|
|
|
+ newColumns.map((v : any) => {
|
|
|
+ tableConfig.columns.unshift({
|
|
|
+ width: '80px',
|
|
|
+ title: v.title,
|
|
|
+ field: v.field,
|
|
|
+ })
|
|
|
+ });
|
|
|
+ this.tableList = (this as any).$lodash.cloneDeep(info.data);
|
|
|
+ // console.log('表格配置 ==> ', tableConfig);
|
|
|
+ console.log('skuRuleList ==> ', skuRuleList);
|
|
|
+ console.log('表格数据 ==> ', this.tableList);
|
|
|
+ this.setTableConfig = tableConfig;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
+ (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- (this as any).$refs.form.setValue(data)
|
|
|
- loading.close()
|
|
|
+ (this as any).$refs.form.setValue(data)
|
|
|
+ loading.close()
|
|
|
+ }).catch(() => loading.close());
|
|
|
}).catch(() => loading.close());
|
|
|
- }).catch(() => loading.close());
|
|
|
+ }
|
|
|
+
|
|
|
}).catch(() => loading.close());
|
|
|
}
|
|
|
// 同步到财务系统
|
|
|
- syncSystem(){
|
|
|
-
|
|
|
+ syncSystem() {
|
|
|
+
|
|
|
}
|
|
|
// 立即生成
|
|
|
generateNow() {
|
|
@@ -1538,14 +1548,21 @@
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
let data = (this.$refs.makeupTable as any).getValue();// 获取表格数据
|
|
|
- console.log(data);
|
|
|
let i = -1;
|
|
|
+ let j = -1;
|
|
|
for (const v of data) {
|
|
|
i++;
|
|
|
if (v.id == item.id) {
|
|
|
break
|
|
|
}
|
|
|
};
|
|
|
+ for (const v of this.makeupList) {
|
|
|
+ j++;
|
|
|
+ if (v.id == item.id && item.isDeleted === 0) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ };
|
|
|
+ this.makeupList[j].isDeleted = 1;
|
|
|
data.splice(i, 1);
|
|
|
(this.$refs.makeupTable as any).setValue(data);// 设置表格数据
|
|
|
this.$message.success('删除成功');
|