初始化

dev
青青子衿 2024-04-07 19:01:41 +08:00
parent 18a563e28a
commit 4543a2fbf5
30 changed files with 2959 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package com.jingtao.product.controller;
import com.jingtao.common.core.domain.R;
import com.jingtao.product.domin.pojo.ProductAttr;
import com.jingtao.product.service.ProAttrTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName ProAttrTypeController
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 10:13
*/
@RestController
@RequestMapping("/attr")
@Api(tags = "商品属性")
public class ProAttrTypeController {
@Autowired
private ProAttrTypeService proAttrTypeService;
@GetMapping("/list/{typeId}")
@ApiOperation("根据商品类型ID查找商品属性")
public R<List<ProductAttr>> list(@PathVariable Integer typeId){
List<ProductAttr> list = proAttrTypeService.list(typeId);
return R.ok(list);
}
}

View File

@ -0,0 +1,87 @@
package com.jingtao.product.controller;
import com.github.pagehelper.PageInfo;
import com.jingtao.common.core.domain.R;
import com.jingtao.product.domin.pojo.ProductType;
import com.jingtao.product.domin.req.ProTypeAttrReq;
import com.jingtao.product.domin.req.ProductClassifyReq;
import com.jingtao.product.domin.resp.ProTypeAttrResp;
import com.jingtao.product.service.ProtypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName ProTypeController
* @Description
* @Author dongyan.Ma
* @Date 2024/4/1 11:37
*/
@RestController
@Api(tags = "商品类型")
@RequestMapping("/type")
public class ProTypeController {
@Autowired
private ProtypeService protypeService;
@PostMapping("/list")
@ApiOperation("商品类型列表")
public R<PageInfo<ProductType>> list(@RequestBody ProductType productType){
PageInfo<ProductType> list = protypeService.list(productType);
return R.ok(list);
}
@GetMapping("/listType")
@ApiOperation("商品类型")
public R<List<ProductType>> listType(){
List<ProductType> list = protypeService.listType();
return R.ok(list);
}
@DeleteMapping("/delType/{id}")
@ApiOperation("商品类型逻辑删除")
public R delType(@PathVariable Integer id){
protypeService.delType(id);
return R.ok();
}
@PutMapping("/updType")
@ApiOperation("商品类型编辑")
public R updType(@RequestBody ProductType productType){
protypeService.updType(productType);
return R.ok();
}
@PostMapping("/addType")
@ApiOperation("商品类型添加")
public R addType(@RequestBody ProductType productType){
protypeService.addType(productType);
return R.ok();
}
@GetMapping("/typeAttr/{id}/{flag}")
@ApiOperation("类型属性、参数列表")
public R<List<ProTypeAttrResp>> typeAttr(@PathVariable Integer id,@PathVariable Integer flag){
List<ProTypeAttrResp> list = protypeService.typeAttr(id,flag);
return R.ok(list);
}
@PutMapping("/updTypeAttr")
@ApiOperation("类型属性、参数编辑")
public R updTypeAttr(@RequestBody ProTypeAttrReq proTypeAttrReq){
protypeService.updTypeAttr(proTypeAttrReq);
return R.ok();
}
@PostMapping("/addTypeAttr")
@ApiOperation("类型属性、参数添加")
public R addTypeAttr(@RequestBody ProTypeAttrReq proTypeAttrReq){
protypeService.addTypeAttr(proTypeAttrReq);
return R.ok();
}
@DeleteMapping("delTypeAttr/{id}")
@ApiOperation("类型属性、参数逻辑删除")
public R delTypeAttr(@PathVariable Integer id){
protypeService.delTypeAttr(id);
return R.ok();
}
}

View File

@ -0,0 +1,17 @@
package com.jingtao.product.domin.pojo;
import lombok.Data;
/**
* @ClassName Attribute
* @Description
* @Author dongyan.Ma
* @Date 2024/4/7 14:29
*/
@Data
public class Attribute {
private String typeAttrValue;
private String attrValueId;
}

View File

@ -0,0 +1,30 @@
package com.jingtao.product.domin.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @ClassName ProLadder
* @Description
* @Author dongyan.Ma
* @Date 2024/3/31 16:13
*/
@Data
public class ProLadder {
@ApiModelProperty(value = "阶梯价格ID")
private Integer id;
@ApiModelProperty(value = "商品ID外键")
private Integer productId;
@ApiModelProperty(value = "满足的商品数量")
private Integer count;
@ApiModelProperty(value = "折扣")
private BigDecimal discount;
@ApiModelProperty(value = "折后价格")
private BigDecimal price;
}

View File

@ -0,0 +1,28 @@
package com.jingtao.product.domin.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName ProMember
* @Description
* @Author dongyan.Ma
* @Date 2024/3/31 16:13
*/
@Data
public class ProMember {
@ApiModelProperty(value = "会员价格ID")
private Integer id;
@ApiModelProperty(value = "商品id")
private Integer productId;
@ApiModelProperty(value = "黄金会员价格")
private Double goldPrice;
@ApiModelProperty(value = "白金会员价格")
private Double platinumPrice;
@ApiModelProperty(value = "钻石会员价格名称")
private Double diamondPrice;
}

View File

@ -0,0 +1,25 @@
package com.jingtao.product.domin.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName ProReduction
* @Description
* @Author dongyan.Ma
* @Date 2024/3/31 16:13
*/
@Data
public class ProReduction {
@ApiModelProperty(value = "满减价格ID")
private Integer id;
@ApiModelProperty(value = "商品id")
private Integer productId;
@ApiModelProperty(value = "商品满足金额")
private Double fullPrice;
@ApiModelProperty(value = "商品减少金额")
private Double reducePrice;
}

View File

@ -0,0 +1,57 @@
package com.jingtao.product.domin.pojo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.List;
/**
* @ClassName ProductAttr
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 10:16
*/
@Data
@Api(tags = "商品属性")
public class ProductAttr {
@ApiModelProperty(value = "属性列表主键")
private Integer id;
@ApiModelProperty(value = "类型外键")
private Integer productTypeId;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "属性名称")
private String attrName;
@ApiModelProperty(value = "是否支持可选 0-可多选 1-不可选")
private Integer isChoise;
@ApiModelProperty(value = "录入方式 0-列表选择 1-手动录入")
private Integer inputMethod;
@ApiModelProperty(value = "排序 0最大")
private Integer sort;
@ApiModelProperty(value = "分类标识 0-属性 1-参数")
private Integer flag;
@ApiModelProperty(value = "分类筛选样式 0-普通 1-颜色 默认 0")
private Integer filteringStyles;
@ApiModelProperty(value = "能否进行检索 0不需要检索 1-关键字检索 2-范围检索")
private Integer isRetrieva;
@ApiModelProperty(value = "商品属性关联 0-是 1-否 默认0")
private Integer isAttrRelate;
@ApiModelProperty(value = "支持手动新增 0-是 1-否 默认 1")
private Integer isAdd;
private List<Attribute> attrs;
}

View File

@ -0,0 +1,37 @@
package com.jingtao.product.domin.pojo;
import com.jingtao.common.core.domain.EntityBaseInfo;
import com.jingtao.common.core.web.domain.BaseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
/**
* @ClassName ProductType
* @Description
* @Author dongyan.Ma
* @Date 2024/4/1 11:40
*/
@Data
@Api(tags = "商品类型")
public class ProductType extends EntityBaseInfo {
@ApiModelProperty(value = "类型ID")
private Integer id;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "类型属性个数")
private Integer countAttr;
@ApiModelProperty(value = "类型参数个数")
private Integer countParam;
@ApiModelProperty(value = "当前页数")
private Integer pageNum=1;
@ApiModelProperty(value = "分页条数")
private Integer pageSize=3;
}

View File

@ -0,0 +1,57 @@
package com.jingtao.product.domin.req;
import com.jingtao.common.core.domain.EntityBaseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @ClassName ProTypeAttrReq
* @Description
* @Author dongyan.Ma
* @Date 2024/4/5 16:17
*/
@Data
@Api(tags = "类型属性、参数请求体")
public class ProTypeAttrReq extends EntityBaseInfo {
@ApiModelProperty(value = "属性列表主键")
private Integer id;
@ApiModelProperty(value = "类型外键")
private Integer productTypeId;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "属性名称")
private String attrName;
@ApiModelProperty(value = "是否支持可选 0-可多选 1-不可选")
private Integer isChoise;
@ApiModelProperty(value = "录入方式 0-列表选择 1-手动录入")
private Integer inputMethod;
@ApiModelProperty(value = "排序 0最大")
private Integer sort;
@ApiModelProperty(value = "分类标识 0-属性 1-参数")
private Integer flag;
@ApiModelProperty(value = "分类筛选样式 0-普通 1-颜色 默认 0")
private Integer filteringStyles;
@ApiModelProperty(value = "能否进行检索 0不需要检索 1-关键字检索 2-范围检索")
private Integer isRetrieva;
@ApiModelProperty(value = "商品属性关联 0-是 1-否 默认0")
private Integer isAttrRelate;
@ApiModelProperty(value = "支持手动新增 0-是 1-否 默认 1")
private Integer isAdd;
@ApiModelProperty(value = "可选值")
private String attrValues;//用来接收前台传过来的可选值用\n切割
}

View File

@ -0,0 +1,25 @@
package com.jingtao.product.domin.req;
import com.jingtao.common.core.domain.EntityBaseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName ProTypeAttrValueReq
* @Description
* @Author dongyan.Ma
* @Date 2024/4/7 08:45
*/
@Data
@Api(tags = "属性值")
public class ProTypeAttrValueReq extends EntityBaseInfo {
@ApiModelProperty(value = "属性值主键")
private Integer id;
@ApiModelProperty(value = "属性外键")
private Integer typeAttrId;
@ApiModelProperty(value = "属性值")
private String attrValue;
@ApiModelProperty(value = "属性值的录入方式 0-列表选择 1-手动录入")
private Integer inputMethod;
}

View File

@ -0,0 +1,55 @@
package com.jingtao.product.domin.req;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @ClassName ProductQueryReq
* @Description
* @Author dongyan.Ma
* @Date 2024/3/31 10:58
*/
@Data
@Api(tags = "商品信息查询参数")
public class ProductQueryReq {
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品货号")
private String productSn;
@ApiModelProperty(value = "商品分类ID外键")
private Integer classifyId;
@ApiModelProperty(value = "品牌ID外键")
private Integer brandId;
@ApiModelProperty(value = "审核状态0->未审核1->审核通过")
private Integer verifyStatus;
@ApiModelProperty(value = "上架状态0->下架1->上架")
private Integer publishStatus;
private Integer pageNum=1;
private Integer pageSize=3;
}

View File

@ -0,0 +1,56 @@
package com.jingtao.product.domin.resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @ClassName ProTypeAttrResp
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 19:47
*/
@Data
@Api(tags = "类型属性、参数返回结果集")
public class ProTypeAttrResp {
@ApiModelProperty(value = "属性列表主键")
private Integer id;
@ApiModelProperty(value = "类型外键")
private String productTypeId;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "属性名称")
private String attrName;
@ApiModelProperty(value = "是否支持可选 0-可多选 1-不可选")
private Integer isChoise;
@ApiModelProperty(value = "录入方式 0-列表选择 1-手动录入")
private Integer inputMethod;
@ApiModelProperty(value = "排序 0最大")
private Integer sort;
@ApiModelProperty(value = "分类标识 0-属性 1-参数")
private Integer flag;
@ApiModelProperty(value = "分类筛选样式 0-普通 1-颜色 默认 0")
private Integer filteringStyles;
@ApiModelProperty(value = "能否进行检索 0不需要检索 1-关键字检索 2-范围检索")
private Integer isRetrieva;
@ApiModelProperty(value = "商品属性关联 0-是 1-否 默认0")
private Integer isAttrRelate;
@ApiModelProperty(value = "支持手动新增 0-是 1-否 默认 1")
private Integer isAdd;
@ApiModelProperty(value = "可选值")
private String attrValue;
}

View File

@ -0,0 +1,18 @@
package com.jingtao.product.mapper;
import com.jingtao.product.domin.pojo.ProductAttr;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName ProAttrTypeMapper
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 10:21
*/
@Mapper
public interface ProAttrTypeMapper {
List<ProductAttr> list(@Param("typeId") Integer typeId);
}

View File

@ -0,0 +1,19 @@
package com.jingtao.product.mapper;
import com.jingtao.product.domin.pojo.ProLadder;
import com.jingtao.product.domin.pojo.ProMember;
import com.jingtao.product.domin.pojo.ProReduction;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ClassName PromotionMapper
* @Description
* @Author dongyan.Ma
* @Date 2024/3/31 16:17
*/
@Mapper
public interface PromotionMapper {
}

View File

@ -0,0 +1,18 @@
package com.jingtao.product.service;
import com.jingtao.product.domin.pojo.ProductAttr;
import java.util.List;
/**
* @ClassName ProAttrTypeService
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 10:14
*/
public interface ProAttrTypeService {
List<ProductAttr> list(Integer typeId);
}

View File

@ -0,0 +1,35 @@
package com.jingtao.product.service;
import com.github.pagehelper.PageInfo;
import com.jingtao.product.domin.pojo.ProductType;
import com.jingtao.product.domin.req.ProTypeAttrReq;
import com.jingtao.product.domin.resp.ProTypeAttrResp;
import java.util.List;
/**
* @ClassName ProtypeService
* @Description
* @Author dongyan.Ma
* @Date 2024/4/1 11:39
*/
public interface ProtypeService {
PageInfo<ProductType> list(ProductType productType);
List<ProTypeAttrResp> typeAttr(Integer id, Integer flag);
void delType(Integer id);
void updType(ProductType productType);
void addType(ProductType productType);
void updTypeAttr(ProTypeAttrReq proTypeAttrReq);
void delTypeAttr(Integer id);
List<ProductType> listType();
void addTypeAttr(ProTypeAttrReq proTypeAttrReq);
}

View File

@ -0,0 +1,27 @@
package com.jingtao.product.service.impl;
import com.jingtao.product.domin.pojo.ProductAttr;
import com.jingtao.product.mapper.ProAttrTypeMapper;
import com.jingtao.product.service.ProAttrTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName ProAttrTypeServiceImpl
* @Description
* @Author dongyan.Ma
* @Date 2024/4/2 10:15
*/
@Service
public class ProAttrTypeServiceImpl implements ProAttrTypeService {
@Autowired
private ProAttrTypeMapper proAttrTypeMapper;
@Override
public List<ProductAttr> list(Integer typeId) {
return proAttrTypeMapper.list(typeId);
}
}

View File

@ -0,0 +1,86 @@
package com.jingtao.product.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jingtao.product.domin.pojo.ProductType;
import com.jingtao.product.domin.req.ProTypeAttrReq;
import com.jingtao.product.domin.req.ProTypeAttrValueReq;
import com.jingtao.product.domin.resp.ProTypeAttrResp;
import com.jingtao.product.mapper.ProTypeMapper;
import com.jingtao.product.service.ProtypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName ProtypeServiceImpl
* @Description
* @Author dongyan.Ma
* @Date 2024/4/1 11:39
*/
@Service
public class ProtypeServiceImpl implements ProtypeService {
@Autowired
private ProTypeMapper proTypeMapper;
@Override
public PageInfo<ProductType> list(ProductType productType) {
PageHelper.startPage(productType.getPageNum(),productType.getPageSize());
List<ProductType> list = proTypeMapper.list(productType);
PageInfo<ProductType> productTypePageInfo = new PageInfo<>(list);
return productTypePageInfo;
}
@Override
public List<ProTypeAttrResp> typeAttr(Integer id, Integer flag) {
return proTypeMapper.typeAttr(id,flag);
}
@Override
public void delType(Integer id) {
proTypeMapper.delType(id);
}
@Override
public void updType(ProductType productType) {
proTypeMapper.updType(productType);
}
@Override
public void addType(ProductType productType) {
proTypeMapper.addType(productType);
}
@Override
public void updTypeAttr(ProTypeAttrReq proTypeAttrReq) {
proTypeMapper.updTypeAttr(proTypeAttrReq);
}
@Override
public void delTypeAttr(Integer id) {
proTypeMapper.delTypeAttr(id);
}
@Override
public List<ProductType> listType() {
return proTypeMapper.listType();
}
@Override
public void addTypeAttr(ProTypeAttrReq proTypeAttrReq) {
proTypeMapper.addTypeAttr(proTypeAttrReq);
//添加成功后获取主键自增的id添加属性、参数值表
ProTypeAttrValueReq proTypeAttrValueReq = new ProTypeAttrValueReq();
String attrValues = proTypeAttrReq.getAttrValues();
String[] split = attrValues.split("\n");
//手动录入的可选值 \n 切割
for (String s : split) {
//属性、参数id
proTypeAttrValueReq.setTypeAttrId(proTypeAttrReq.getId());
proTypeAttrValueReq.setAttrValue(s);
proTypeAttrValueReq.setInputMethod(proTypeAttrReq.getInputMethod());
//添加属性值表
proTypeMapper.addTypeAttrValue(proTypeAttrValueReq);
}
}
}

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jingtao.product.mapper.ProAttrTypeMapper">
<resultMap id="attrMap" type="com.jingtao.product.domin.pojo.ProductAttr">
<id column="id" property="id"/>
<result column="product_type_id" property="productTypeId"/>
<result column="type_name" property="typeName"/>
<result column="attr_name" property="attrName"/>
<result column="is_choise" property="isChoise"/>
<result column="input_method" property="inputMethod"/>
<result column="sort" property="sort"/>
<result column="flag" property="flag"/>
<result column="filtering_styles" property="filteringStyles"/>
<result column="is_retrieva" property="isRetrieva"/>
<result column="is_add" property="isAdd"/>
<result column="is_attr_relate" property="isAttrRelate"/>
<collection property="attrs" ofType="com.jingtao.product.domin.pojo.Attribute">
<result column="attr_valueId" property="attrValueId"/>
<result column="type_attrValue" property="typeAttrValue"/>
</collection>
</resultMap>
<select id="list" resultMap="attrMap">
SELECT
ta.id as id,
ta.product_type_id,
type_name,
attr_name,
is_choise,
ta.input_method,
ta.sort,
ta.flag,
ta.is_add,
ta.filtering_styles,
ta.is_retrieva,
ta.is_attr_relate,
tav.id as attr_valueId,
tav.attr_value as type_attrValue
FROM
t_product_type t
INNER JOIN t_product_type_attr ta ON t.id = ta.product_type_id
INNER JOIN t_product_type_attr_value tav ON tav.type_attr_id = ta.id
WHERE t.id=#{typeId}
</select>
</mapper>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jingtao.product.mapper.PromotionMapper">
</mapper>

View File

@ -0,0 +1,27 @@
import request from '@/utils/request'
//
export function listClass() {
return request({
url: '/product/classify/listClassify',
method: 'get'
})
}
export function queryCategory(productClassify) {
return request({
url: '/product/classify/list',
method: 'post',
data:productClassify
})
}
export function listLevel(id) {
return request({
url: '/product/classify/listLevel/'+id,
method: 'get',
params: id
})
}

View File

@ -0,0 +1,41 @@
import request from '@/utils/request'
//
export function listBrand() {
return request({
url: '/product/brand/listBrand',
method: 'get'
})
}
export function queryBrand(brandReq) {
return request({
url: '/product/brand/list',
method: 'post',
data: brandReq
})
}
export function addBrand(brandReq) {
return request({
url: '/product/brand/addBrand',
method: 'post',
data: brandReq
})
}
export function delBrand(brandId) {
return request({
url: '/product/brand/delBrand/'+brandId,
method: 'delete',
params: brandId
})
}
export function updBrand(brandReq) {
return request({
url: '/product/brand/updBrand',
method: 'put',
data: brandReq
})
}

View File

@ -0,0 +1,21 @@
import request from '@/utils/request'
//
export function listMember() {
return request({
url: '/product/promotion/member',
method: 'get',
})
}
export function listLadder() {
return request({
url: '/product/promotion/ladder',
method: 'get',
})
}
export function listReduction() {
return request({
url: '/product/promotion/reduction',
method: 'get',
})
}

View File

@ -0,0 +1,74 @@
import request from "@/utils/request";
export function queryTypeAll(productType) {
return request({
url: '/product/type/list',
method: 'post',
data:productType
})
}
export function queryTypeAttr(id,flag) {
return request({
url: '/product/type/typeAttr/'+id+'/'+flag,
method: 'get',
params: id,flag
})
}
export function attrType(typeId) {
return request({
url: '/product/attr/list/'+typeId,
method: 'get',
params: typeId
})
}
export function delType(id) {
return request({
url: '/product/type/delType/'+id,
method: 'delete',
params: id
})
}
export function updType(typeEdit) {
return request({
url: '/product/type/updType',
method: 'put',
data: typeEdit
})
}
export function addType(typeEdit) {
return request({
url: '/product/type/addType',
method: 'post',
data: typeEdit
})
}
export function updTypeAttr(numType) {
return request({
url: '/product/type/updTypeAttr',
method: 'put',
data: numType
})
}
export function addTypeAttr(numType) {
return request({
url: '/product/type/addTypeAttr',
method: 'post',
data: numType
})
}
export function delTypeAttr(id) {
return request({
url: '/product/type/delTypeAttr/'+id,
method: 'delete',
params: id
})
}

View File

@ -0,0 +1,256 @@
<template>
<div class="app-container">
<el-form :model="brand" ref="brand" size="small" :inline="true">
<el-form-item label="输入搜索">
<el-input
v-model="brand.brandName"
placeholder="品牌名称/关键字"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-button
size="mini"
@click="handleAdd()">添加</el-button>
<el-table :data="arr" style="width: 100%">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.$index+1 }}</span>
</template>
</el-table-column>
<el-table-column label="品牌名称" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.brandName }}</span>
</template>
</el-table-column>
<el-table-column label="品牌首字母" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.brandInitial}}</span>
</template>
</el-table-column>
<el-table-column label="排序" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column label="品牌制造商" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isMakeBrand"
:active-value="0"
:inactive-value="1"
></el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
:active-value="0"
:inactive-value="1"
></el-switch>
</template>
</el-table-column>
<el-table-column label="相关" width="180">
<template slot-scope="scope">
商品<span style="margin-left: 10px;color: #00afff">{{ scope.row.productCount }}</span>
评论<span style="margin-left: 10px;color: #00afff">{{ scope.row.productCommentCount }}</span>
</template>
</el-table-column>
<el-table-column label="设置">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete( scope.row.brandId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="title" :visible.sync="dialogTypeVisible">
<el-form :model="brandReq">
<el-form-item label="品牌名称" :label-width="formLabelWidth">
<el-input v-model="brandReq.brandName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="品牌首字母" :label-width="formLabelWidth">
<el-input v-model="brandReq.brandInitial" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="品牌Logo" :label-width="formLabelWidth">
<image-upload v-model="brandReq.brandLogo" :limit="1" :is-show-tip="false"/>
</el-form-item>
<el-form-item label="品牌专区大图" :label-width="formLabelWidth">
<image-upload v-model="brandReq.brandBigimg" :limit="1" :is-show-tip="false"/>
</el-form-item>
<el-form-item label="商品故事">
<el-input
type="textarea"
:rows="2"
placeholder="请输入内容"
v-model="brandReq.brandStore">
</el-input>
</el-form-item>
<el-form-item label="排序" :label-width="formLabelWidth">
<el-input v-model="brandReq.sort" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="是否显示">
<el-radio-group v-model="brandReq.isShow">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="品牌制造商">
<el-radio-group v-model="brandReq.isMakeBrand">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTypeVisible = false"> </el-button>
<el-button type="primary" @click="onOk"> </el-button>
</div>
</el-dialog>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="brand.pageNum"
:page-sizes="[1,3,5,10]"
:page-size="brand.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {addBrand, delBrand, queryBrand, updBrand} from "@/api/product/brand";
export default {
name: "Brand",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
total:0,
title:'',
brandReq:{},
formLabelWidth:'120px',
dialogTypeVisible:false,
brand:{
pageNum:1,
pageSize:10,
},
arr:[]
};
},
created() {
this.getList();
},
methods: {
/*逻辑删除*/
handleDelete(brandId){
delBrand(brandId).then(res=>{
this.$message.success('删除成功')
this.getList();
})
},
handleSizeChange(val) {
this.brand.pageSize=val
this.getList();
},
handleCurrentChange(val) {
this.brand.pageNum=val
this.getList();
},
/*编辑*/
handleEdit(brand){
this.title='编辑商品品牌'
this.dialogTypeVisible=true
this.brandReq=brand;
},
handleAdd(){
this.title='添加商品品牌'
this.brandReq={}
this.dialogTypeVisible=true
},
onOk(){
if(this.brandReq.brandId>0){
//
this.upd()
}else {
//
this.add()
}
},
upd(){
updBrand(this.brandReq).then(res=>{
this.$message.success('修改成功')
this.dialogTypeVisible=false
this.brandReq={}
this.getList();
})
},
add(){
addBrand(this.brandReq).then(res=>{
this.$message.success('添加成功')
this.dialogTypeVisible=false
this.brandReq={}
this.getList();
})
},
/** 查询品牌列表 */
getList() {
queryBrand(this.brand).then(
response=>{
console.log(response)
this.arr = response.data.list
this.total=response.data.total
}
)
},
//
cancel() {
this.open = false;
this.reset();
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
}
};
</script>

View File

@ -0,0 +1,110 @@
<template>
<div class="app-container">
<el-table :data="levelArr" style="width: 100%">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.$index+1 }}</span>
</template>
</el-table-column>
<el-table-column label="分类名称" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyName }}</span>
</template>
</el-table-column>
<el-table-column label="级别" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyLevel }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.num }}</span>
</template>
</el-table-column>
<el-table-column label="数量单位" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.numUnit }}</span>
</template>
</el-table-column>
<el-table-column label="导航栏" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.navigationBar"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column label="设置">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleDelete(scope.$index, scope.row)">转移商品</el-button>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-button
size="mini"
@click="handleEdit()">返回上级</el-button>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Category",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
levelArr:[]
};
},
created() {
this.levelArr = this.$route.query.levelArr;
},
methods: {
/** 查询上级列表 */
handleEdit(){
this.$router.push("/product/classify/");
},
/** 新增按钮操作 */
handleAdd(row) {},
}
};
</script>

View File

@ -0,0 +1,183 @@
<template>
<div class="app-container">
<el-button
size="mini"
@click="addClassify()">添加</el-button>
<el-table :data="arr" style="width: 100%">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.$index+1 }}</span>
</template>
</el-table-column>
<el-table-column label="分类名称" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyName }}</span>
</template>
</el-table-column>
<el-table-column label="级别" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyLevel }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.num }}</span>
</template>
</el-table-column>
<el-table-column label="数量单位" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.numUnit }}</span>
</template>
</el-table-column>
<el-table-column label="导航栏" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.navigationBar"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column label="设置">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.row.id)">查看下级</el-button>
<el-button
size="mini"
@click="handleDeletee(scope.$index, scope.row)">转移商品</el-button>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleClassifyEdit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="title" :visible.sync="dialogClassVisible">
<el-form :model="classReq">
<el-form-item label="类型名称" :label-width="formLabelWidth">
<el-input v-model="classReq.typeName" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogClassVisible = false"> </el-button>
<el-button type="primary" @click="ok"> </el-button>
</div>
</el-dialog>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="productClassify.pageNum"
:page-sizes="[1,3,5,10]"
:page-size="productClassify.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listLevel, queryCategory} from "@/api/product/Classify";
export default {
name: "Category",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
title:'',
dialogClassVisible:false,
formLabelWidth:'120px',
total:0,
arr:[],
levelArr:[],
productClassify: {
pageNum:1,
pageSize:10,
},
classReq:{}
};
},
created() {
this.getList();
},
methods: {
/** 查询分类列表 */
getList() {
queryCategory(this.productClassify).then(
response =>{
this.arr = response.data.list
this.total=response.data.total
}
)
},
/*查看下级*/
handleEdit(id){
listLevel(id).then(res=>{
this.levelArr=res.data
console.log(this.levelArr)
this.$router.push({ path: '/product/class', query: { levelArr: this.levelArr } });
})
},
/*商品分类编辑*/
handleClassifyEdit(classify){
if(classify.id>0){
//
this.title='商品分类编辑'
this.dialogClassVisible=true
}
},
/*商品分类逻辑删除*/
handleDelete(){
},
/*商品分类添加*/
addClassify(){
this.dialogClassVisible=true
},
/*确定*/
ok(){
this.dialogClassVisible=false
},
handleSizeChange(val) {
this.productClassify.pageSize=val
this.getList();
},
handleCurrentChange(val) {
this.productClassify.pageNum=val
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {},
}
};
</script>

View File

@ -0,0 +1,110 @@
<template>
<div class="app-container">
<el-table :data="levelArr" style="width: 100%">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.$index+1 }}</span>
</template>
</el-table-column>
<el-table-column label="分类名称" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyName }}</span>
</template>
</el-table-column>
<el-table-column label="级别" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.classifyLevel }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.num }}</span>
</template>
</el-table-column>
<el-table-column label="数量单位" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.numUnit }}</span>
</template>
</el-table-column>
<el-table-column label="导航栏" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.navigationBar"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
:active-value="1"
:inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column label="设置">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleDelete(scope.$index, scope.row)">转移商品</el-button>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-button
size="mini"
@click="handleEdit()">返回上级</el-button>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Category",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
levelArr:[]
};
},
created() {
this.levelArr = this.$route.query.levelArr;
},
methods: {
/** 查询上级列表 */
handleEdit(){
this.$router.push("/product/classify/");
},
/** 新增按钮操作 */
handleAdd(row) {},
}
};
</script>

View File

@ -0,0 +1,945 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="商品名称" prop="roleName">
<el-input
v-model="queryParams.roleName"
placeholder="请输入商品名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商品货号" prop="roleName">
<el-input
v-model="queryParams.roleName"
placeholder="请输入商品货号"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="商品品牌" prop="brand">
<el-select
v-model="queryParams.status"
placeholder="请选择"
clearable
style="width: 240px"
>
<el-option
v-for="brand in productBrand"
:key="brand.brandId"
:label="brand.brandValue"
:value="brand.brandId"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:role:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:role:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:role:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="productInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="商品编号" prop="roleId" width="120"/>
<el-table-column label="商品名称" prop="roleName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="显示顺序" prop="roleSort" width="100"/>
<el-table-column label="状态" align="center" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:role:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:role:remove']"
>删除
</el-button>
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)"
v-hasPermi="['system:role:edit']">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleDataScope" icon="el-icon-circle-check"
v-hasPermi="['system:role:edit']">数据权限
</el-dropdown-item>
<el-dropdown-item command="handleAuthUser" icon="el-icon-user"
v-hasPermi="['system:role:edit']">分配用户
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
<el-steps :active="active" finish-status="success">
<el-step title="步骤 1"></el-step>
<el-step title="步骤 2"></el-step>
<el-step title="步骤 3"></el-step>
</el-steps>
<el-form ref="form" v-if="active == 0" :model="form" :rules="rules" label-width="100px">
<el-form-item label="商品名称" prop="roleName">
<el-input v-model="form.roleName" placeholder="请输入商品名称"/>
</el-form-item>
<el-form-item prop="roleKey">
<span slot="label">
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
权限字符
</span>
<el-input v-model="form.roleKey" placeholder="请输入权限字符"/>
</el-form-item>
<el-form-item label="角色顺序" prop="roleSort">
<el-input-number v-model="form.roleSort" controls-position="right" :min="0"/>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品类型">
<el-cascader :options="options" clearable></el-cascader>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
<el-form ref="form" v-if="active == 1" :model="form" :rules="rules" label-width="100px">
<el-form-item label="优惠名称" prop="roleName">
<el-input v-model="form.roleName" placeholder="请输入商品名称"/>
</el-form-item>
</el-form>
<el-form ref="form" v-if="active == 2" :model="form" :rules="rules" label-width="100px">
<el-form-item label="属性类型" prop="brand">
<el-select
v-model="typeId"
placeholder="请选择"
clearable
style="width: 240px"
@change="getAttrByTyId"
>
<el-option
v-for="brand in productBrand"
:key="brand.brandId"
:label="brand.brandValue"
:value="brand.brandId"
/>
</el-select>
</el-form-item>
<el-form-item label="商品规格">
<div v-for="(value, key) in Object.entries(attrForm)" :key="key">
{{ value[1].name }}
<el-checkbox-group v-model="checkAttrs">
<el-checkbox v-for="item in value[1].value" @change="checkedAttrs(item,value[0])"
:key="item.attrValueId" :label="item.typeAttrValue"></el-checkbox>
</el-checkbox-group>
</div>
<el-table :data="skuInfos" stripe style="width: 80%">
<el-table-column v-for="item in attrRows" :prop="String(item.id)" :label="item.attrName" width="180"></el-table-column>
<el-table-column label="销售价格" width="180">
<template slot-scope="scope">
<el-input v-model="scope.row.salePrice" placeholder="请输入销售价格"></el-input>
</template>
</el-table-column>
<el-table-column prop="name" label="促销价格" width="180"></el-table-column>
<el-table-column prop="address" label="商品库存"></el-table-column>
</el-table>
<el-button type="primary" @click="refreshSkuInfos" style="margin-top: 20px">刷新SKU组合列表</el-button>
<el-button type="primary" @click="test1" style="margin-top: 20px">测试</el-button>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button style="margin-top: 12px;" @click="next"></el-button>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 分配角色数据权限对话框 -->
<el-dialog :title="title" :visible.sync="openDataScope" width="500px" append-to-body>
<el-form :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.roleName" :disabled="true"/>
</el-form-item>
<el-form-item label="权限字符">
<el-input v-model="form.roleKey" :disabled="true"/>
</el-form-item>
<el-form-item label="权限范围">
<el-select v-model="form.dataScope" @change="dataScopeSelectChange">
<el-option
v-for="item in dataScopeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据权限" v-show="form.dataScope == 2">
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">/</el-checkbox>
<el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">/
</el-checkbox>
<el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">
</el-checkbox>
<el-tree
class="tree-border"
:data="deptOptions"
show-checkbox
default-expand-all
ref="dept"
node-key="id"
:check-strictly="!form.deptCheckStrictly"
empty-text="加载中,请稍候"
:props="defaultProps"
></el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitDataScope"> </el-button>
<el-button @click="cancelDataScope"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listRole,
getRole,
delRole,
addRole,
updateRole,
dataScope,
changeRoleStatus,
deptTreeSelect
} from "@/api/system/role";
import {listProduct, saveOrUpdate, getAttrByTyId} from "@/api/product/info";
import {treeselect as menuTreeselect, roleMenuTreeselect} from "@/api/system/menu";
export default {
name: "ProductInfo",
dicts: ['sys_normal_disable'],
data() {
return {
//
active: 0,
productType: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则'
}, {
value: 'daohang',
label: '导航',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
}, {
value: 'zujian',
label: '组件',
children: [{
value: 'basic',
label: 'Basic',
children: [{
value: 'layout',
label: 'Layout 布局'
}, {
value: 'color',
label: 'Color 色彩'
}, {
value: 'typography',
label: 'Typography 字体'
}, {
value: 'icon',
label: 'Icon 图标'
}, {
value: 'button',
label: 'Button 按钮'
}]
}, {
value: 'form',
label: 'Form',
children: [{
value: 'radio',
label: 'Radio 单选框'
}, {
value: 'checkbox',
label: 'Checkbox 多选框'
}, {
value: 'input',
label: 'Input 输入框'
}, {
value: 'input-number',
label: 'InputNumber 计数器'
}, {
value: 'select',
label: 'Select 选择器'
}, {
value: 'cascader',
label: 'Cascader 级联选择器'
}, {
value: 'switch',
label: 'Switch 开关'
}, {
value: 'slider',
label: 'Slider 滑块'
}, {
value: 'time-picker',
label: 'TimePicker 时间选择器'
}, {
value: 'date-picker',
label: 'DatePicker 日期选择器'
}, {
value: 'datetime-picker',
label: 'DateTimePicker 日期时间选择器'
}, {
value: 'upload',
label: 'Upload 上传'
}, {
value: 'rate',
label: 'Rate 评分'
}, {
value: 'form',
label: 'Form 表单'
}]
}, {
value: 'data',
label: 'Data',
children: [{
value: 'table',
label: 'Table 表格'
}, {
value: 'tag',
label: 'Tag 标签'
}, {
value: 'progress',
label: 'Progress 进度条'
}, {
value: 'tree',
label: 'Tree 树形控件'
}, {
value: 'pagination',
label: 'Pagination 分页'
}, {
value: 'badge',
label: 'Badge 标记'
}]
}, {
value: 'notice',
label: 'Notice',
children: [{
value: 'alert',
label: 'Alert 警告'
}, {
value: 'loading',
label: 'Loading 加载'
}, {
value: 'message',
label: 'Message 消息提示'
}, {
value: 'message-box',
label: 'MessageBox 弹框'
}, {
value: 'notification',
label: 'Notification 通知'
}]
}, {
value: 'navigation',
label: 'Navigation',
children: [{
value: 'menu',
label: 'NavMenu 导航菜单'
}, {
value: 'tabs',
label: 'Tabs 标签页'
}, {
value: 'breadcrumb',
label: 'Breadcrumb 面包屑'
}, {
value: 'dropdown',
label: 'Dropdown 下拉菜单'
}, {
value: 'steps',
label: 'Steps 步骤条'
}]
}, {
value: 'others',
label: 'Others',
children: [{
value: 'dialog',
label: 'Dialog 对话框'
}, {
value: 'tooltip',
label: 'Tooltip 文字提示'
}, {
value: 'popover',
label: 'Popover 弹出框'
}, {
value: 'card',
label: 'Card 卡片'
}, {
value: 'carousel',
label: 'Carousel 走马灯'
}, {
value: 'collapse',
label: 'Collapse 折叠面板'
}]
}]
}, {
value: 'ziyuan',
label: '资源',
children: [{
value: 'axure',
label: 'Axure Components'
}, {
value: 'sketch',
label: 'Sketch Templates'
}, {
value: 'jiaohu',
label: '组件交互文档'
}]
}],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
productInfoList: [],
//
title: "",
//
open: false,
//
openDataScope: false,
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
//
dateRange: [],
//
productBrand: [
{
brandId: "1",
brandValue: "华为"
},
{
brandId: "2",
brandValue: "小米"
}],
//
dataScopeOptions: [
{
value: "1",
label: "全部数据权限"
},
{
value: "2",
label: "自定数据权限"
},
{
value: "3",
label: "本部门数据权限"
},
{
value: "4",
label: "本部门及以下数据权限"
},
{
value: "5",
label: "仅本人数据权限"
}
],
//
menuOptions: [],
//
deptOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
roleName: undefined,
roleKey: undefined,
status: undefined
},
typeId: undefined,
//
form: {},
//
attrForm: {},
//
attrRows:[],
//
/*{"1": ["白色","蓝色"],"2": ["s","l"]}*/
checkedAttrValue:{},
//sku
skuInfos: [],
checkAttrs: [[]],
defaultProps: {
children: "children",
label: "label"
},
//
rules: {
roleName: [
{required: true, message: "角色名称不能为空", trigger: "blur"}
],
roleKey: [
{required: true, message: "权限字符不能为空", trigger: "blur"}
],
roleSort: [
{required: true, message: "角色顺序不能为空", trigger: "blur"}
]
}
};
},
created() {
this.getList();
},
methods: {
//
test1(attrValueId, id) {
console.log(JSON.stringify(this.skuInfos))
},
//
checkedAttrs(attrItem,id){
//checkedAttrValuekeyididvaluevalueattrItem
if (this.checkedAttrValue[id]) {
//idvalueattrItem.typeAttrValue
//
const index = this.checkedAttrValue[id].indexOf(attrItem.typeAttrValue);
if (index > -1) {
this.checkedAttrValue[id].splice(index, 1); //
} else {
this.checkedAttrValue[id].push(attrItem.typeAttrValue); //
}
}else {
this.checkedAttrValue[id] = Array(attrItem.typeAttrValue)
}
console.log(JSON.stringify(this.checkedAttrValue))
},
//sku
refreshSkuInfos() {
this.skuInfos = [];
// skuInfos
const keys = Object.keys(this.checkedAttrValue);
for (let i = 0; i < this.checkedAttrValue[keys[0]].length; i++) {
for (let j = 0; j < this.checkedAttrValue[keys[1]].length; j++) {
const item = {};
item[keys[0]] = this.checkedAttrValue[keys[0]][i];
item[keys[1]] = this.checkedAttrValue[keys[1]][j];
this.skuInfos.push(item);
}
}
console.log(JSON.stringify(this.skuInfos))
},
//
next() {
if (this.active++ > 2) {
this.active = 0;
}
},
//id
getAttrByTyId() {
getAttrByTyId(this.typeId).then(response => {
let attrsStr = "{\"total\":2,\"rows\":[{\"productTypeId\":1,\"id\":1,\"typeName\":\"服装-T恤\",\"attrName\":\"颜色\",\"multipleChoice\":\"0\",\"inputMethod\":\"0\",\"attrs\":[{\"typeAttrValue\":\"白色\",\"attrValueId\":\"1\"},{\"typeAttrValue\":\"蓝色\",\"attrValueId\":\"2\"},{\"typeAttrValue\":\"金色\",\"attrValueId\":\"3\"}]},{\"productTypeId\":1,\"id\":2,\"typeName\":\"服装-T恤\",\"attrName\":\"尺寸\",\"multipleChoice\":\"0\",\"inputMethod\":\"0\",\"attrs\":[{\"typeAttrValue\":\"m\",\"attrValueId\":\"8\"},{\"typeAttrValue\":\"s\",\"attrValueId\":\"9\"},{\"typeAttrValue\":\"xl\",\"attrValueId\":\"7\"}]}],\"code\":200,\"msg\":\"查询成功\"}";
//attrStr
response = JSON.parse(attrsStr);
console.log(response)
//
this.attrForm = {};
this.attrRows = response.rows;
//TODO attsidkeyattrNamevalueatts
this.attrRows.forEach(item => {
//
//
const attrBody = {};
attrBody.name = item.attrName;
attrBody.value = item.attrs;
this.attrForm[item.id] = attrBody;
})
})
},
/** 查询角色列表 */
getList() {
this.loading = true;
listProduct(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.productInfoList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 查询菜单树结构 */
getMenuTreeselect() {
menuTreeselect().then(response => {
this.menuOptions = response.data;
});
},
//
getMenuAllCheckedKeys() {
//
let checkedKeys = this.$refs.menu.getCheckedKeys();
//
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys;
},
//
getDeptAllCheckedKeys() {
//
let checkedKeys = this.$refs.dept.getCheckedKeys();
//
let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys;
},
/** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.menus;
return response;
});
},
/** 根据角色ID查询部门树结构 */
getDeptTree(roleId) {
return deptTreeSelect(roleId).then(response => {
this.deptOptions = response.depts;
return response;
});
},
//
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function () {
return changeRoleStatus(row.roleId, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function () {
row.status = row.status === "0" ? "1" : "0";
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
cancelDataScope() {
this.openDataScope = false;
this.reset();
},
//
reset() {
if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([]);
}
this.menuExpand = false,
this.menuNodeAll = false,
this.deptExpand = true,
this.deptNodeAll = false,
this.form = {
roleId: undefined,
roleName: undefined,
roleKey: undefined,
roleSort: 0,
status: "0",
menuIds: [],
deptIds: [],
menuCheckStrictly: true,
deptCheckStrictly: true,
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roleId)
this.single = selection.length != 1
this.multiple = !selection.length
},
//
handleCommand(command, row) {
switch (command) {
case "handleDataScope":
this.handleDataScope(row);
break;
case "handleAuthUser":
this.handleAuthUser(row);
break;
default:
break;
}
},
// /
handleCheckedTreeExpand(value, type) {
if (type == 'menu') {
let treeList = this.menuOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
}
} else if (type == 'dept') {
let treeList = this.deptOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
}
}
},
// /
handleCheckedTreeNodeAll(value, type) {
if (type == 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []);
} else if (type == 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : []);
}
},
//
handleCheckedTreeConnect(value, type) {
if (type == 'menu') {
this.form.menuCheckStrictly = value ? true : false;
} else if (type == 'dept') {
this.form.deptCheckStrictly = value ? true : false;
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
//this.getMenuTreeselect();
this.open = true;
this.title = "添加商品";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const roleId = row.roleId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId);
getRole(roleId).then(response => {
this.form = response.data;
this.open = true;
this.$nextTick(() => {
roleMenu.then(res => {
let checkedKeys = res.checkedKeys
checkedKeys.forEach((v) => {
this.$nextTick(() => {
this.$refs.menu.setChecked(v, true, false);
})
})
});
});
this.title = "添加商品";
});
},
/** 选择角色权限范围触发 */
dataScopeSelectChange(value) {
if (value !== '2') {
this.$refs.dept.setCheckedKeys([]);
}
},
/** 分配数据权限操作 */
handleDataScope(row) {
this.reset();
const deptTreeSelect = this.getDeptTree(row.roleId);
getRole(row.roleId).then(response => {
this.form = response.data;
this.openDataScope = true;
this.$nextTick(() => {
deptTreeSelect.then(res => {
this.$refs.dept.setCheckedKeys(res.checkedKeys);
});
});
this.title = "分配数据权限";
});
},
/** 分配用户操作 */
handleAuthUser: function (row) {
const roleId = row.roleId;
this.$router.push("/system/role-auth/user/" + roleId);
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.menuIds = this.getMenuAllCheckedKeys();
saveOrUpdate(this.form).then(response => {
this.$modal.msgSuccess("操作成功");
this.open = false;
this.getList();
});
}
});
},
/** 提交按钮(数据权限) */
submitDataScope: function () {
if (this.form.roleId != undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys();
dataScope(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.openDataScope = false;
this.getList();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const roleIds = row.roleId || this.ids;
this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function () {
return delRole(roleIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/role/export', {
...this.queryParams
}, `role_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,429 @@
<template>
<div class="app-container">
<el-button
size="mini"
@click="handleAdd()">添加</el-button>
<!-- 商品类型列表 -->
<el-table :data="arr" style="width: 100%">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.$index+1 }}</span>
</template>
</el-table-column>
<el-table-column label="类型名称" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.typeName }}</span>
</template>
</el-table-column>
<el-table-column label="属性数量" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.countAttr}}</span>
</template>
</el-table-column>
<el-table-column label="参数数量" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.countParam }}</span>
</template>
</el-table-column>
<el-table-column label="设置">
<template slot-scope="scope">
<el-button size="mini" @click="handleStats(scope.row.id,0)"></el-button>
<el-button size="mini" @click="handleParam(scope.row.id,1)"></el-button>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 属性参数弹出框-->
<el-dialog :title="title" :visible.sync="dialogFormVisible">
<el-button size="mini" @click="handleTypeAdd()"></el-button>
<el-table :data="num" style="width: 3000px">
<el-table-column label="编号" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column :label="name" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.attrName }}</span>
</template>
</el-table-column>
<el-table-column label="商品类型" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.typeName}}</span>
</template>
</el-table-column>
<el-table-column label="属性是否可选" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.stats==0?'唯一':scope.row.stats==1?'单选':'多选' }}</span>
</template>
</el-table-column>
<el-table-column label="属性值得录入方式" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px" v-if="scope.row.inputMethod == 0">{{ '' }}</span>
<span style="margin-left: 10px" v-else-if="scope.row.inputMethod== 1">{{ '手动录入' }}</span>
</template>
</el-table-column>
<el-table-column label="可选值列表" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.attrValue}}</span>
</template>
</el-table-column>
<el-table-column label="排序" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.sort}}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleTypeEdit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleTypeDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!--编辑商品类型弹出表单-->
<el-dialog :title="title" :visible.sync="dialogTypeVisible">
<el-form :model="typeEdit">
<el-form-item label="类型名称" :label-width="formLabelWidth">
<el-input v-model="typeEdit.typeName" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTypeVisible = false"> </el-button>
<el-button type="primary" @click="ok"> </el-button>
</div>
</el-dialog>
<!--编辑商品参数属性弹出框-->
<el-dialog :title="tit" :visible.sync="dialogFormAttrVisible">
<el-form :model="numType">
<el-form-item label="属性名称" :label-width="formLabelWidth">
<el-input v-model="numType.attrName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="属性类型:">
<el-select v-model="numType.productTypeId">
<el-option v-for="item in arrType" :key="item.id" :label="item.typeName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类筛选样式">
<el-radio-group v-model="numType.filteringStyles">
<el-radio :label="0">普通</el-radio>
<el-radio :label="1">颜色</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="能否进行检索">
<el-radio-group v-model="numType.isRetrieva">
<el-radio :label="0">不需要检索</el-radio>
<el-radio :label="1">关键字检索</el-radio>
<el-radio :label="2">范围检索</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品属性关联">
<el-radio-group v-model="numType.isAttrRelate">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="属性是否可选">
<el-radio-group v-model="numType.isChoise">
<el-radio :label="0">唯一</el-radio>
<el-radio :label="1">单选</el-radio>
<el-radio :label="2">复选</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="属性值录入方式">
<el-radio-group v-model="numType.inputMethod">
<el-radio :label="0">手工录入</el-radio>
<el-radio :label="1">从下面列表中选择</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="可选值列表">
<el-input
type="textarea"
:rows="2"
placeholder="请输入内容"
v-model="numType.attrValues">
</el-input>
</el-form-item>
<el-form-item label="是否支持手动新增">
<el-radio-group v-model="numType.isAdd">
<el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序属性" :label-width="formLabelWidth">
<el-input v-model="numType.sort" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTypeVisible = false"> </el-button>
<el-button type="primary" @click="okAttr"></el-button>
</div>
</el-dialog>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="productType.pageNum"
:page-sizes="[1,3,5,10]"
:page-size="productType.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
queryTypeAttr,
queryTypeAll,
delType,
updType,
addType,
updTypeAttr,
delTypeAttr,
addTypeAttr
} from "@/api/product/type";
import {listType} from "@/api/product/info";
export default {
name: "Type",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
total:0,
dialogFormVisible: false,//
dialogTypeVisible: false,//
dialogFormAttrVisible: false,//
formLabelWidth: '120px',
arr:[],
num:[],
param:[],
numType: {
attrValues:['']
},
name:'',
attrNames:'',
title:'',
tit:'',
typeEdit: {
id:0,
typeName:'',
},
productType: {
pageNum:1,
pageSize:10,
},
productTypeReq:{},
//
arrType:[],
};
},
created() {
this.getList();
this.queryType();
},
methods: {
/** 查询分类列表 */
getList() {
queryTypeAll(this.productType).then(
response =>{
this.arr = response.data.list
this.total=response.data.total
console.log(response)
}
)
},
//
queryType(){
listType().then(res=>{
this.arrType=res.data
})
},
handleSizeChange(val) {
this.productType.pageSize=val
this.getList();
},
handleCurrentChange(val) {
this.productType.pageNum=val
this.getList();
},
/*删除参数或属性*/
handleTypeDelete(id){
delTypeAttr(id).then(res=>{
this.$message.success('删除成功')
this.getList();
this.dialogFormVisible=false
})
},
/*修改商品商品、参数*/
handleTypeEdit(numType){
console.log(numType)
if(numType.flag==0){
this.tit='修改商品属性'
this.attrNames='属性名称'
}else {
this.tit='修改商品参数'
this.attrNames='参数名称'
}
this.numType=numType
this.numType.productTypeId=parseInt(numType.productTypeId)
this.numType.attrValues=numType.attrValue
this.dialogFormAttrVisible=true
},
/*添加商品商品、参数*/
handleTypeAdd(){
this.numType= {}
this.dialogFormAttrVisible=true
},
/*确定*/
okAttr(){
if(this.numType.id>0){
this.updTypeAttr()
}else {
this.addType()
}
},
addType(){
if(this.name==='属性名称'){
this.tit='添加商品属性'
this.attrNames='属性名称'
this.numType.flag=0
}else {
this.tit='添加商品参数'
this.attrNames='参数名称'
this.numType.flag=1
}
console.log(this.numType)
addTypeAttr(this.numType).then(res=>{
this.$message.success('添加成功')
this.dialogFormVisible=false
this.dialogFormAttrVisible=false
this.getList();
})
},
updTypeAttr(){
updTypeAttr(this.numType).then(res=>{
this.$message.success('编辑成功')
})
this.dialogFormAttrVisible=false
this.numType= {}
},
/** 编辑商品类型 */
handleEdit(type){
this.title='编辑商品类型'
this.typeEdit={}
this.dialogTypeVisible=true
this.typeEdit.id=type.id
this.typeEdit.typeName=type.typeName
},
/*添加商品类型*/
handleAdd(){
this.title='添加商品类型'
this.typeEdit={}
this.dialogTypeVisible=true
},
/*确定判断是添加还是编辑*/
ok(){
if(this.typeEdit.id>0){
//
this.upd()
}else {
//
this.add()
}
},
/*类型编辑*/
upd(){
updType(this.typeEdit).then(res=>{
this.$message.success('编辑成功')
this.getList();
})
this.dialogTypeVisible=false
},
/*逻辑删除*/
handleDelete(id){
delType(id).then(res=>{
this.$message.success('删除成功')
this.getList();
})
},
/** 新增商品类型操作 */
add() {
addType(this.typeEdit).then(res=>{
this.$message.success('添加成功')
this.typeEdit={}
this.getList();
})
this.dialogTypeVisible=false
},
/**参数列表**/
handleStats(id,flag){
this.title='属性列表'
this.name='属性名称'
this.num=[]
this.dialogFormVisible = true
queryTypeAttr(id,flag).then(
response =>{
console.log(response)
this.num = response.data
}
)
},
/**属性列表**/
handleParam(id,flag){
this.title='参数列表'
this.num=[]
this.name='参数名称'
this.dialogFormVisible = true
queryTypeAttr(id,flag).then(
response =>{
this.num = response.data
}
)
}
}
};
</script>