|
@@ -36,6 +36,12 @@
|
|
|
<template v-slot:ismakeup>
|
|
|
<el-radio v-model="ismakeup" :label="0">是</el-radio>
|
|
|
<el-radio v-model="ismakeup" :label="1">否</el-radio>
|
|
|
+ <el-button v-show="ismakeup===0" @click="openMakeup">选择商品</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-slot:makeupTable>
|
|
|
+ <div v-if="makeupList.length>0">
|
|
|
+ <by-table :propConfig="makeupTable" ref="makeupTable"></by-table>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template v-slot:issued>
|
|
|
<el-radio v-model="issued" :label="0">是</el-radio>
|
|
@@ -107,6 +113,9 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</transition-group>
|
|
|
+ <!-- 选择物料 -->
|
|
|
+ <productModal ref="product" :mulit="true" @confirm="confirmProduct" />
|
|
|
+ <!-- <productDialog ref="product" :mulit="true" @confirm="confirmProduct" /> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
@@ -114,7 +123,9 @@
|
|
|
import api from '@/api/currency'
|
|
|
import other from '@/api/other'
|
|
|
import ForTab from "@/components/ForTab/index.vue";
|
|
|
- @Component({ components: { ForTab } })
|
|
|
+ import productModal from "../orderTask/components/productModal.vue";
|
|
|
+ import brandType from "./components/brandType.vue";
|
|
|
+ @Component({ components: { ForTab, productModal, brandType } })
|
|
|
export default class productManagement extends Vue {
|
|
|
tagsData : any = [] // 标签值
|
|
|
isShow = 'home'
|
|
@@ -125,7 +136,7 @@
|
|
|
timer : any = null
|
|
|
materialSpec : any = 0
|
|
|
status : any = 0
|
|
|
- ismakeup : any = 0
|
|
|
+ ismakeup : any = 1
|
|
|
issued : any = 0
|
|
|
textarea : any = ''
|
|
|
categoryIds : any = ''
|
|
@@ -144,6 +155,7 @@
|
|
|
tableList : any = ''
|
|
|
attributeId : any = ''
|
|
|
intercept : any = ''
|
|
|
+ makeupList : any = [] // 组合商品列表
|
|
|
// tab
|
|
|
toolConfig = {
|
|
|
tools: {
|
|
@@ -472,6 +484,48 @@
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
+ makeupTable : any = {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: '170px',
|
|
|
+ title: '标题',
|
|
|
+ field: 'skuTitle',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: '170px',
|
|
|
+ title: '副标题',
|
|
|
+ field: 'skuSubtitle',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: '170px',
|
|
|
+ title: '数量',
|
|
|
+ field: 'number',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ defaultValue: '1',
|
|
|
+ type: 'number'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ name: '删除',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).deleteMakeup(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
formConfig = {
|
|
|
attr: {
|
|
|
size: 'medium',
|
|
@@ -483,7 +537,10 @@
|
|
|
required: true, message: '请输入基本售价', trigger: 'blur'
|
|
|
}],
|
|
|
categoryName: [{
|
|
|
- required: true, message: '请输入物料分类', trigger: 'change'
|
|
|
+ required: true, message: '请选择物料分类', trigger: 'change'
|
|
|
+ }],
|
|
|
+ brandId: [{
|
|
|
+ required: true, message: '请选择物料品牌', trigger: 'change'
|
|
|
}],
|
|
|
}
|
|
|
},
|
|
@@ -608,6 +665,12 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '物料品牌',
|
|
|
+ prop: 'brandId',
|
|
|
+ component: brandType,
|
|
|
+ },
|
|
|
{
|
|
|
span: 6,
|
|
|
label: '虚拟分类',
|
|
@@ -674,14 +737,22 @@
|
|
|
prop: 'status',
|
|
|
}
|
|
|
],
|
|
|
- // [
|
|
|
- // {
|
|
|
- // span: 20,
|
|
|
- // label: '是否组合商品',
|
|
|
- // slot: true,
|
|
|
- // prop: 'ismakeup',
|
|
|
- // }
|
|
|
- // ],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 20,
|
|
|
+ label: '组合商品',
|
|
|
+ slot: true,
|
|
|
+ prop: 'ismakeup',
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 30,
|
|
|
+ label: '',
|
|
|
+ slot: true,
|
|
|
+ prop: 'makeupTable',
|
|
|
+ }
|
|
|
+ ],
|
|
|
[
|
|
|
{
|
|
|
span: 20,
|
|
@@ -754,21 +825,6 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- {
|
|
|
- span: 6,
|
|
|
- label: '基本售价',
|
|
|
- prop: 'basePrice',
|
|
|
- component: 'by-input',
|
|
|
- labelWidth: '70px',
|
|
|
- compConfig: {
|
|
|
- attr: {
|
|
|
- placeholder: '请输入基本售价',
|
|
|
- clearable: true
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- [
|
|
|
{
|
|
|
span: 6,
|
|
|
label: '财务编号',
|
|
@@ -782,7 +838,7 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
]
|
|
|
},
|
|
|
tool: {
|
|
@@ -790,8 +846,17 @@
|
|
|
add: true,
|
|
|
delete: true,
|
|
|
search: true,
|
|
|
- refresh: true
|
|
|
- }
|
|
|
+ refresh: true,
|
|
|
+ },
|
|
|
+ // customTools: [
|
|
|
+ // {
|
|
|
+ // name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
|
|
|
+ // click: () => {
|
|
|
+ // (this as any).syncSystem()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
},
|
|
|
table: {
|
|
|
attr: {
|
|
@@ -858,6 +923,44 @@
|
|
|
this.getDataList()
|
|
|
}, 500)
|
|
|
}
|
|
|
+ // 确定商品新增
|
|
|
+ confirmProduct(e : any) {
|
|
|
+ this.makeupList = e;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let nowData = (this.$refs.makeupTable as any).getValue();
|
|
|
+ let names = '';
|
|
|
+ if (e.length > 0) {
|
|
|
+ for (const item of e) {
|
|
|
+ let t = true;
|
|
|
+ for (const t_item of nowData) {
|
|
|
+ if (item.id == t_item.materialSkuId) {
|
|
|
+ if (!names) {
|
|
|
+ names = item.skuTitle
|
|
|
+ } else {
|
|
|
+ names = names + ',' + item.skuTitle
|
|
|
+ }
|
|
|
+ t = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (t) {
|
|
|
+ let obj : any = {};
|
|
|
+ obj.skuTitle = item.skuTitle
|
|
|
+ obj.skuSubtitle = item.skuSubtitle
|
|
|
+ // obj.materialId = item.materialId
|
|
|
+ obj.materialSkuId = item.id
|
|
|
+ nowData.push(obj);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ (this as any).$refs.makeupTable.setValue(nowData) // 设置表格数据
|
|
|
+ if (names) {
|
|
|
+ this.$alert('商品 “' + names + '”已存在!', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
//点击树获取数据
|
|
|
onChangeTree(e : any) {
|
|
|
this.categoryIds = e.id;
|
|
@@ -885,7 +988,7 @@
|
|
|
query.attributeId = this.attributeId // 物料属性ID
|
|
|
query.status = this.status; // 物料状态
|
|
|
query.tags = this.tagsData.join(","); // 标签
|
|
|
- // query.ismakeup = this.ismakeup; // 商品组合
|
|
|
+ query.ismakeup = this.ismakeup; // 商品组合
|
|
|
query.issued = this.issued; // 是否公布
|
|
|
query.description = this.textarea; // 备注
|
|
|
let data : any = {}
|
|
@@ -954,31 +1057,43 @@
|
|
|
data.maindataMaterialSkus[0].isDeleted = 0;
|
|
|
data.maindataMaterial.attributeList = ""
|
|
|
}
|
|
|
- // console.log('data ==> ', data);
|
|
|
- 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());
|
|
|
+ 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);
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
+ // 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());
|
|
|
+ // }
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
// 打开新增
|
|
@@ -992,7 +1107,8 @@
|
|
|
this.tableList = [] // 表格数据
|
|
|
this.materialSpec = 0; // 单规格
|
|
|
this.status = 0; // 物料状态
|
|
|
- this.ismakeup = 0; // 商品组合
|
|
|
+ this.ismakeup = 1; // 商品组合
|
|
|
+ this.makeupList = [] // 组合商品列表
|
|
|
this.issued = 0; // 是否公布
|
|
|
this.isSingle = true; // 显示单表格
|
|
|
this.isEdit = false; // 是否编辑
|
|
@@ -1083,6 +1199,10 @@
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => loading.close());
|
|
|
+ }
|
|
|
+ // 同步到财务系统
|
|
|
+ syncSystem(){
|
|
|
+
|
|
|
}
|
|
|
// 立即生成
|
|
|
generateNow() {
|
|
@@ -1189,6 +1309,10 @@
|
|
|
})
|
|
|
}).catch(() => { });
|
|
|
}
|
|
|
+ // 切换组合商品
|
|
|
+ openMakeup() {
|
|
|
+ (this.$refs.product as any).setShow(true); // 打开sku弹窗
|
|
|
+ }
|
|
|
// 切换商品规格
|
|
|
changeSingle() {
|
|
|
if (this.isSingle) {
|
|
@@ -1405,6 +1529,28 @@
|
|
|
if (e === 'onSave') this.doFormData();
|
|
|
if (e === 'onDelete') this.pageDelete(this.editInfo);
|
|
|
}
|
|
|
+ // 组合商品删除
|
|
|
+ deleteMakeup(item : any) {
|
|
|
+ this.$confirm('确定删除吗', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ let data = (this.$refs.makeupTable as any).getValue();// 获取表格数据
|
|
|
+ console.log(data);
|
|
|
+ let i = -1;
|
|
|
+ for (const v of data) {
|
|
|
+ i++;
|
|
|
+ if (v.id == item.id) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ };
|
|
|
+ data.splice(i, 1);
|
|
|
+ (this.$refs.makeupTable as any).setValue(data);// 设置表格数据
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
+ }
|
|
|
// 内页删除
|
|
|
pageDelete(item : any) {
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|