初始化-第三次前端11.21
parent
d705ba0926
commit
73c57b7172
|
@ -36,9 +36,9 @@ export function addInfo(data) {
|
||||||
// 修改商品信息
|
// 修改商品信息
|
||||||
export function updateInfo(data) {
|
export function updateInfo(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/product/info/'+data.id,
|
url: '/product/info/'+data.projectAddModel.id,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data.projectAddModel
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,11 @@ export default {
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getAttribute(id).then(response => {
|
getAttribute(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
this.categoryOptionValue=[
|
||||||
|
this.form.mianType,
|
||||||
|
this.form.parentType,
|
||||||
|
this.form.type
|
||||||
|
];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改商品属性";
|
this.title = "修改商品属性";
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,7 +83,14 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="states">
|
<el-table-column label="状态" align="center" prop="states">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/>
|
<el-switch
|
||||||
|
v-model="scope.row.states"
|
||||||
|
active-text="Y"
|
||||||
|
inactive-text="N"
|
||||||
|
active-value="Y"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="changeing(scope.row)"
|
||||||
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
@ -153,8 +160,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup } from "@/api/product/attributeGroup";
|
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup } from "@/api/product/attributeGroup";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: "AttributeGroup",
|
name: "AttributeGroup",
|
||||||
dicts: ['sys_yes_no'],
|
dicts: ['sys_yes_no'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -244,6 +251,14 @@ export default {
|
||||||
this.single = selection.length!==1
|
this.single = selection.length!==1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
|
/**设置开关-状态**/
|
||||||
|
changeing(row){
|
||||||
|
var id=row.id
|
||||||
|
var states=row.states
|
||||||
|
this.updateAttributeGroupStates(id,states).then(res => {
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
@ -256,11 +271,23 @@ export default {
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getAttributeGroup(id).then(response => {
|
getAttributeGroup(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
this.categoryOptionValue=[
|
||||||
|
this.form.mianType,
|
||||||
|
this.form.parentType,
|
||||||
|
this.form.type
|
||||||
|
];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改属性组";
|
this.title = "修改属性组";
|
||||||
console.log(this.form)
|
console.log(this.form)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//修改属性状态
|
||||||
|
updateAttributeGroupStates(id,states){
|
||||||
|
return request({
|
||||||
|
url:"/product/attributeGroup/"+id+'/'+states,
|
||||||
|
method:'put'
|
||||||
|
})
|
||||||
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
|
|
@ -85,7 +85,11 @@
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="介绍" align="center" prop="introduction" />
|
<el-table-column label="介绍" align="center" prop="introduction">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div v-html="scope.row.introduction"></div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="父级品类" align="center" prop="parentId" />
|
<el-table-column label="父级品类" align="center" prop="parentIds" />
|
||||||
<el-table-column label="是否启用" align="center" prop="start">
|
<el-table-column label="是否启用" align="center" prop="start">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
||||||
|
@ -263,7 +263,21 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listCategory(this.queryParams).then(response => {
|
listCategory(this.queryParams).then(response => {
|
||||||
this.categoryList = this.handleTree(response.data, "id", "parentId");
|
const idToName = response.data.reduce((acc, node) => {
|
||||||
|
acc[node.id] = node.name;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
console.log(idToName);
|
||||||
|
const updatedTreeData = response.data.map(node => {
|
||||||
|
// 如果 parentId 为 null,说明没有父节点,不需要替换
|
||||||
|
const parentName = node.parentId !== null ? idToName[node.parentId] : null;
|
||||||
|
console.log(parentName);
|
||||||
|
return {
|
||||||
|
...node,
|
||||||
|
parentIds: parentName
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.categoryList = this.handleTree(updatedTreeData, "id", "parentId");
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -347,6 +361,11 @@ export default {
|
||||||
}
|
}
|
||||||
getCategory(row.id).then(response => {
|
getCategory(row.id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
this.categoryOptionValue=[
|
||||||
|
this.form.mianType,
|
||||||
|
this.form.parentType,
|
||||||
|
this.form.type
|
||||||
|
];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改品类信息";
|
this.title = "修改品类信息";
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,9 +92,9 @@
|
||||||
<el-table-column label="主键" align="center" prop="id" />
|
<el-table-column label="主键" align="center" prop="id" />
|
||||||
<el-table-column label="商品名称" align="center" prop="name" />
|
<el-table-column label="商品名称" align="center" prop="name" />
|
||||||
<el-table-column label="商品描述" align="center" prop="introduction" />
|
<el-table-column label="商品描述" align="center" prop="introduction" />
|
||||||
<el-table-column label="主类型" align="center" prop="mianType" />
|
<el-table-column label="主类型" align="center" prop="mianTypeName" />
|
||||||
<el-table-column label="父类型" align="center" prop="parentType" />
|
<el-table-column label="父类型" align="center" prop="parentTypeName" />
|
||||||
<el-table-column label="商品类型" align="center" prop="type" />
|
<el-table-column label="商品类型" align="center" prop="typeName" />
|
||||||
<el-table-column label="商品图片" align="center" prop="image" width="100">
|
<el-table-column label="商品图片" align="center" prop="image" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||||
|
@ -110,8 +110,8 @@
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" align="center" prop="ruleId" />
|
<el-table-column label="规格" align="center" prop="ruleName" />
|
||||||
<el-table-column label="品牌" align="center" prop="brandId" />
|
<el-table-column label="品牌" align="center" prop="brandName" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -723,6 +723,11 @@ export default {
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getInfo(id).then(response => {
|
getInfo(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
this.categoryOptionValue=[
|
||||||
|
this.form.mianType,
|
||||||
|
this.form.parentType,
|
||||||
|
this.form.type
|
||||||
|
];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改商品信息";
|
this.title = "修改商品信息";
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,7 +77,18 @@
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格状态" align="center" prop="status" />
|
<el-table-column label="规格状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-text="Y"
|
||||||
|
inactive-text="N"
|
||||||
|
active-value="Y"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="changeing(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -86,14 +97,14 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['product:rule:edit']"
|
:disabled="scope.row.flag"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['product:rule:remove']"
|
:disabled="scope.row.flag"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -360,6 +371,21 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
/**规格状态开关**/
|
||||||
|
changeing(row){
|
||||||
|
var id=row.id
|
||||||
|
var status=row.status
|
||||||
|
this.updByRuleStatus(id,status).then(res=>{
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**设置N与Y**/
|
||||||
|
updByRuleStatus(id,status){
|
||||||
|
return request({
|
||||||
|
url:"/product/rule/"+id+"/"+status,
|
||||||
|
methods: "put"
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
|
Loading…
Reference in New Issue