code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222 values | license stringclasses 20 values | size int64 1 1.05M |
|---|---|---|---|---|---|
package com.kong.meirimall.product.dao;
import com.kong.meirimall.product.entity.SpuInfoEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* spu信息
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Mapper
public interface SpuInfoDao extends BaseMapper<SpuInfoEntity> {
void updateSpuStatus(@Param("spuId") Long spuId, @Param("code") int code);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/dao/SpuInfoDao.java | Java | apache-2.0 | 492 |
package com.kong.meirimall.product.dao;
import com.kong.meirimall.product.entity.SpuInfoDescEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* spu信息介绍
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Mapper
public interface SpuInfoDescDao extends BaseMapper<SpuInfoDescEntity> {
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/dao/SpuInfoDescDao.java | Java | apache-2.0 | 388 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 属性&属性分组关联
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_attr_attrgroup_relation")
public class AttrAttrgroupRelationEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 属性id
*/
private Long attrId;
/**
* 属性分组id
*/
private Long attrGroupId;
/**
* 属性组内排序
*/
private Integer attrSort;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/AttrAttrgroupRelationEntity.java | Java | apache-2.0 | 710 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 商品属性
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_attr")
public class AttrEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性id
*/
@TableId
private Long attrId;
/**
* 属性名
*/
private String attrName;
/**
* 是否需要检索[0-不需要,1-需要]
*/
private Integer searchType;
/**
* 属性图标
*/
private String icon;
/**
* 可选值列表[用逗号分隔]
*/
private String valueSelect;
/**
* 属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]
*/
private Integer attrType;
/**
* 启用状态[0 - 禁用,1 - 启用]
*/
private Long enable;
/**
* 所属分类
*/
private Long catalogId;
/**
* 快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整
*/
private Integer showDesc;
private Integer valueType;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/AttrEntity.java | Java | apache-2.0 | 1,182 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 属性分组
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_attr_group")
public class AttrGroupEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分组id
*/
@TableId
private Long attrGroupId;
/**
* 组名
*/
private String attrGroupName;
/**
* 排序
*/
private Integer sort;
/**
* 描述
*/
private String descript;
/**
* 组图标
*/
private String icon;
/**
* 所属分类id
*/
private Long catalogId;
@TableField(exist = false)
private Long[] catelogPath;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/AttrGroupEntity.java | Java | apache-2.0 | 880 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import com.kong.common.valid.AddGroup;
import com.kong.common.valid.ListValue;
import com.kong.common.valid.UpdateGroup;
import com.kong.common.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.*;
/**
* 品牌
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 品牌id
*/
@NotNull(message="修改必须指定品牌 id",groups = {UpdateGroup.class})
@Null(message = "新增不能指定 id",groups = {AddGroup.class})
@TableId
private Long brandId;
/**
* 品牌名
*/
@NotBlank(message = "品牌名必须提交",groups = {AddGroup.class, UpdateGroup.class})
private String name;
/**
* 品牌logo地址
*/
@NotEmpty(groups = {AddGroup.class})
@URL(message = "logo 必须是一个合法的 url 地址",groups = {AddGroup.class, UpdateGroup.class})
private String logo;
/**
* 介绍
*/
private String descript;
/**
* 显示状态[0-不显示;1-显示]
*/
@NotNull(groups = {AddGroup.class,UpdateStatusGroup.class})
@ListValue(vals={0,1},groups = {AddGroup.class, UpdateStatusGroup.class})
private Integer showStatus;
/**
* 检索首字母
*/
@NotBlank(groups = {AddGroup.class})
@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母",groups = {AddGroup.class, UpdateGroup.class})
private String firstLetter;
/**
* 排序
*/
@NotNull(groups = {AddGroup.class})
@Min(value = 0,message = "排序必须大于等于0",groups = {AddGroup.class, UpdateGroup.class})
private Integer sort;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/BrandEntity.java | Java | apache-2.0 | 1,889 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 品牌分类关联
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_category_brand_relation")
public class CategoryBrandRelationEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 品牌id
*/
private Long brandId;
/**
* 分类id
*/
private Long catalogId;
/**
*
*/
private String brandName;
/**
*
*/
private String catelogName;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/CategoryBrandRelationEntity.java | Java | apache-2.0 | 720 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* 商品三级分类
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_category")
public class CategoryEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分类id
*/
@TableId
private Long catId;
/**
* 分类名称
*/
private String name;
/**
* 父分类id
*/
private Long parentCid;
/**
* 层级
*/
private Integer catLevel;
/**
* 是否显示[0-不显示,1显示]
*/
@TableLogic(value = "1",delval = "0") //与全局的逻辑删除配置相反,设置 删除成功,该字段显示 1,不成功显示 0
private Integer showStatus;
/**
* 排序
*/
private Integer sort;
/**
* 图标地址
*/
private String icon;
/**
* 计量单位
*/
private String productUnit;
/**
* 商品数量
*/
private Integer productCount;
// 选择框三个级别列表后还有一个空白页面,设置 空列表不显示
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private List<CategoryEntity> children;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/CategoryEntity.java | Java | apache-2.0 | 1,485 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 商品评价回复关系
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_comment_replay")
public class CommentReplayEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 评论id
*/
private Long commentId;
/**
* 回复id
*/
private Long replyId;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/CommentReplayEntity.java | Java | apache-2.0 | 625 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu属性值
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_product_attr_value")
public class ProductAttrValueEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 商品id
*/
private Long spuId;
/**
* 属性id
*/
private Long attrId;
/**
* 属性名
*/
private String attrName;
/**
* 属性值
*/
private String attrValue;
/**
* 顺序
*/
private Integer attrSort;
/**
* 快速展示【是否展示在介绍上;0-否 1-是】
*/
private Integer quickShow;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/ProductAttrValueEntity.java | Java | apache-2.0 | 863 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* sku图片
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_sku_images")
public class SkuImagesEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* sku_id
*/
private Long skuId;
/**
* 图片地址
*/
private String imgUrl;
/**
* 排序
*/
private Integer imgSort;
/**
* 默认图[0 - 不是默认图,1 - 是默认图]
*/
private Integer defaultImg;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SkuImagesEntity.java | Java | apache-2.0 | 741 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* sku信息
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_sku_info")
public class SkuInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* skuId
*/
@TableId
private Long skuId;
/**
* spuId
*/
private Long spuId;
/**
* sku名称
*/
private String skuName;
/**
* sku介绍描述
*/
private String skuDesc;
/**
* 所属分类id
*/
private Long catalogId;
/**
* 品牌id
*/
private Long brandId;
/**
* 默认图片
*/
private String skuDefaultImg;
/**
* 标题
*/
private String skuTitle;
/**
* 副标题
*/
private String skuSubtitle;
/**
* 价格
*/
private BigDecimal price;
/**
* 销量
*/
private Long saleCount;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SkuInfoEntity.java | Java | apache-2.0 | 1,036 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* sku销售属性&值
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_sku_sale_attr_value")
public class SkuSaleAttrValueEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* sku_id
*/
private Long skuId;
/**
* attr_id
*/
private Long attrId;
/**
* 销售属性名
*/
private String attrName;
/**
* 销售属性值
*/
private String attrValue;
/**
* 顺序
*/
private Integer attrSort;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SkuSaleAttrValueEntity.java | Java | apache-2.0 | 781 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 商品评价
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_spu_comment")
public class SpuCommentEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* sku_id
*/
private Long skuId;
/**
* spu_id
*/
private Long spuId;
/**
* 商品名字
*/
private String spuName;
/**
* 会员昵称
*/
private String memberNickName;
/**
* 星级
*/
private Integer star;
/**
* 会员ip
*/
private String memberIp;
/**
* 创建时间
*/
private Date createTime;
/**
* 显示状态[0-不显示,1-显示]
*/
private Integer showStatus;
/**
* 购买时属性组合
*/
private String spuAttributes;
/**
* 点赞数
*/
private Integer likesCount;
/**
* 回复数
*/
private Integer replyCount;
/**
* 评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]
*/
private String resources;
/**
* 内容
*/
private String content;
/**
* 用户头像
*/
private String memberIcon;
/**
* 评论类型[0 - 对商品的直接评论,1 - 对评论的回复]
*/
private Integer commentType;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SpuCommentEntity.java | Java | apache-2.0 | 1,434 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu图片
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_spu_images")
public class SpuImagesEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* spu_id
*/
private Long spuId;
/**
* 图片名
*/
private String imgName;
/**
* 图片地址
*/
private String imgUrl;
/**
* 顺序
*/
private Integer imgSort;
/**
* 是否默认图
*/
private Integer defaultImg;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SpuImagesEntity.java | Java | apache-2.0 | 756 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu信息介绍
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_spu_info_desc")
public class SpuInfoDescEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品id
*/
@TableId(type = IdType.INPUT)
private Long spuId;
/**
* 商品介绍
*/
private String decript;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SpuInfoDescEntity.java | Java | apache-2.0 | 652 |
package com.kong.meirimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu信息
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
@Data
@TableName("pms_spu_info")
public class SpuInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品id
*/
@TableId
private Long id;
/**
* 商品名称
*/
private String spuName;
/**
* 商品描述
*/
private String spuDescription;
/**
* 所属分类id
*/
private Long catalogId;
/**
* 品牌id
*/
private Long brandId;
/**
*
*/
private BigDecimal weight;
/**
* 上架状态[0 - 下架,1 - 上架]
*/
private Integer publishStatus;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/entity/SpuInfoEntity.java | Java | apache-2.0 | 959 |
package com.kong.meirimall.product.exception;
import com.kong.common.exception.BizCodeEnume;
import com.kong.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.HashMap;
import java.util.Map;
/**
集中处理所有异常,不用 BindingResult
*/
@Slf4j // 日志记录
// 同时具有 @ControllerAdvice 和 @ResponseBody(因为要以 json 写出去) 功能
@RestControllerAdvice("com.kong.meirimall.product.controller")
public class MeirimallExceptionControllerAdvice {
// 处理校验出现的异常
@ExceptionHandler(value = MethodArgumentNotValidException.class)
public R handleValidException(MethodArgumentNotValidException e){
log.error("数据校验出现问题{},异常类型:{}",e.getMessage(),e.getClass());
BindingResult bindingResult = e.getBindingResult();
Map<String,String> errMap = new HashMap<>();
bindingResult.getFieldErrors().forEach(fieldError -> {
errMap.put(fieldError.getField(),fieldError.getDefaultMessage());
});
return R.error(BizCodeEnume.VALID_EXCEPTION.getCode(), BizCodeEnume.VALID_EXCEPTION.getMsg()).put("data",errMap);
}
//处理任意类型的异常
@ExceptionHandler(value = Throwable.class)
public R handleException(Throwable throwable){
log.error("错误:",throwable);
return R.error(BizCodeEnume.UNKNOW_EXCEPTION.getCode(), BizCodeEnume.UNKNOW_EXCEPTION.getMsg());
}
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/exception/MeirimallExceptionControllerAdvice.java | Java | apache-2.0 | 1,830 |
package com.kong.meirimall.product.feign;
import com.kong.common.to.SkuReductionTo;
import com.kong.common.to.SpuBoundTo;
import com.kong.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient("meirimall-coupon")
public interface CouponFeignService {
@PostMapping("/coupon/spubounds/save")
R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);
@PostMapping("coupon/skufullreduction/saveInfo")
R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/feign/CouponFeignService.java | Java | apache-2.0 | 628 |
package com.kong.meirimall.product.feign;
import com.kong.common.to.es.SkuEsModel;
import com.kong.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(value = "meirimall-search")
public interface SearchFeignService {
@PostMapping("/search/save/product")
public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/feign/SearchFeignService.java | Java | apache-2.0 | 512 |
package com.kong.meirimall.product.feign;
import com.kong.common.utils.R;
import com.kong.common.vo.SkuHasStockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient("meirimall-ware")
public interface WareFeignService {
/**
* 方便获取返回值的方法
* 1、R 设计时可加上泛型 ----> R<T>
* 2、直接返回我们想要的结果,不返回 R 了
* 3、自己封装解析结果
* @param skuIds
* @return
*/
@PostMapping("/ware/waresku/hasStock")
public R getSkusHasStock(@RequestBody List<Long> skuIds);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/feign/WareFeignService.java | Java | apache-2.0 | 730 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.AttrAttrgroupRelationEntity;
import com.kong.meirimall.product.vo.AttrGroupRelationVo;
import java.util.List;
import java.util.Map;
/**
* 属性&属性分组关联
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface AttrAttrgroupRelationService extends IService<AttrAttrgroupRelationEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveBatch(List<AttrGroupRelationVo> vos);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/AttrAttrgroupRelationService.java | Java | apache-2.0 | 633 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.AttrGroupEntity;
import com.kong.meirimall.product.vo.AttrGroupWithAttrsVo;
import java.util.List;
import java.util.Map;
/**
* 属性分组
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface AttrGroupService extends IService<AttrGroupEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPage(Map<String, Object> params, Long catalogId);
List<AttrGroupWithAttrsVo> getAttrGroupWithAttrsBycatalogId(Long catalogId);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/AttrGroupService.java | Java | apache-2.0 | 685 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.AttrEntity;
import com.kong.meirimall.product.vo.AttrGroupRelationVo;
import com.kong.meirimall.product.vo.AttrGroupWithAttrsVo;
import com.kong.meirimall.product.vo.AttrResponseVo;
import com.kong.meirimall.product.vo.AttrVo;
import java.util.List;
import java.util.Map;
/**
* 商品属性
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface AttrService extends IService<AttrEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveAttr(AttrVo attrVo);
PageUtils queryPageAttr(Map<String, Object> params, Long catlogId, String type);
AttrResponseVo geAttrInfo(Long attrId);
void updateAttr(AttrVo attr);
List<AttrEntity> getRelationAttr(Long attrgroupId);
void deleteRelation(AttrGroupRelationVo[] vos);
PageUtils getNoRelationAttr(Map<String, Object> params, Long attrgroupId);
List<Long> selectSearchAttrs(List<Long> attrIds);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/AttrService.java | Java | apache-2.0 | 1,120 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.BrandEntity;
import org.springframework.context.annotation.Bean;
import java.util.Map;
/**
* 品牌
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface BrandService extends IService<BrandEntity> {
PageUtils queryPage(Map<String, Object> params);
void updateDetail(BrandEntity brand);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/BrandService.java | Java | apache-2.0 | 529 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.BrandEntity;
import com.kong.meirimall.product.entity.CategoryBrandRelationEntity;
import java.util.List;
import java.util.Map;
/**
* 品牌分类关联
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface CategoryBrandRelationService extends IService<CategoryBrandRelationEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveDetail(CategoryBrandRelationEntity categoryBrandRelation);
void updateBrand(Long brandId, String name);
void updateCategory(Long catId, String name);
List<BrandEntity> getBrandsByCatId(Long catId);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/CategoryBrandRelationService.java | Java | apache-2.0 | 797 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.CategoryEntity;
import com.kong.meirimall.product.vo.Catalog2Vo;
import java.util.List;
import java.util.Map;
/**
* 商品三级分类
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface CategoryService extends IService<CategoryEntity> {
List<CategoryEntity> listWithTree();
PageUtils queryPage(Map<String, Object> params);
void removeMenueByIds(List<Long> list);
//找到 catalogId 的完整路径 [父/子/孙子]
Long[] findCatelogPath(Long catalogId);
void updateCascade(CategoryEntity category);
List<CategoryEntity> getLevel1Categorys();
Map<String, List<Catalog2Vo>> geCatelogJson();
// 从数据库查询 三级分类 并存入缓存
Map<String, List<Catalog2Vo>> geCatelogJsonFromDb();
// 从数据库查询 三级分类 并存入缓存
Map<String, List<Catalog2Vo>> geCatelogJsonFromDbWithRedisLock();
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/CategoryService.java | Java | apache-2.0 | 1,102 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.CommentReplayEntity;
import java.util.Map;
/**
* 商品评价回复关系
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface CommentReplayService extends IService<CommentReplayEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/CommentReplayService.java | Java | apache-2.0 | 475 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.ProductAttrValueEntity;
import java.util.List;
import java.util.Map;
/**
* spu属性值
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface ProductAttrValueService extends IService<ProductAttrValueEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveProductAttr(List<ProductAttrValueEntity> attrValueEntities);
List<ProductAttrValueEntity> baseAttrListforspu(Long spuId);
void updateSpuAttr(Long spuId, List<ProductAttrValueEntity> entities);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/ProductAttrValueService.java | Java | apache-2.0 | 712 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SkuImagesEntity;
import java.util.Map;
/**
* sku图片
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SkuImagesService extends IService<SkuImagesEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SkuImagesService.java | Java | apache-2.0 | 448 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SkuInfoEntity;
import java.util.List;
import java.util.Map;
/**
* sku信息
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SkuInfoService extends IService<SkuInfoEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveSkuInfo(SkuInfoEntity skuInfoEntity);
PageUtils queryPageByCondition(Map<String, Object> params);
List<SkuInfoEntity> getSkusBySpuId(Long spuId);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SkuInfoService.java | Java | apache-2.0 | 635 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SkuSaleAttrValueEntity;
import java.util.Map;
/**
* sku销售属性&值
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SkuSaleAttrValueService extends IService<SkuSaleAttrValueEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SkuSaleAttrValueService.java | Java | apache-2.0 | 479 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SpuCommentEntity;
import java.util.Map;
/**
* 商品评价
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SpuCommentService extends IService<SpuCommentEntity> {
PageUtils queryPage(Map<String, Object> params);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SpuCommentService.java | Java | apache-2.0 | 454 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SpuImagesEntity;
import java.util.List;
import java.util.Map;
/**
* spu图片
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SpuImagesService extends IService<SpuImagesEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveImages(Long id, List<String> images);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SpuImagesService.java | Java | apache-2.0 | 523 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SpuInfoDescEntity;
import java.util.Map;
/**
* spu信息介绍
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SpuInfoDescService extends IService<SpuInfoDescEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveSpuInfoDesc(SpuInfoDescEntity infoDescEntity);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SpuInfoDescService.java | Java | apache-2.0 | 521 |
package com.kong.meirimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kong.common.utils.PageUtils;
import com.kong.meirimall.product.entity.SpuInfoDescEntity;
import com.kong.meirimall.product.entity.SpuInfoEntity;
import com.kong.meirimall.product.vo.SpuSaveVo;
import java.util.Map;
/**
* spu信息
*
* @author kong
* @email kong@gmail.com
* @date 2024-10-03 18:13:07
*/
public interface SpuInfoService extends IService<SpuInfoEntity> {
PageUtils queryPage(Map<String, Object> params);
void saveSpuInfo(SpuSaveVo spuSaveVo);
void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity);
PageUtils queryPageByCondition(Map<String, Object> params);
void up(Long spuId);
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/SpuInfoService.java | Java | apache-2.0 | 741 |
package com.kong.meirimall.product.service.impl;
import com.kong.meirimall.product.vo.AttrGroupRelationVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.AttrAttrgroupRelationDao;
import com.kong.meirimall.product.entity.AttrAttrgroupRelationEntity;
import com.kong.meirimall.product.service.AttrAttrgroupRelationService;
@Service("attrAttrgroupRelationService")
public class AttrAttrgroupRelationServiceImpl extends ServiceImpl<AttrAttrgroupRelationDao, AttrAttrgroupRelationEntity> implements AttrAttrgroupRelationService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<AttrAttrgroupRelationEntity> page = this.page(
new Query<AttrAttrgroupRelationEntity>().getPage(params),
new QueryWrapper<AttrAttrgroupRelationEntity>()
);
return new PageUtils(page);
}
@Override
public void saveBatch(List<AttrGroupRelationVo> vos) {
List<AttrAttrgroupRelationEntity> collect = vos.stream().map(item -> {
AttrAttrgroupRelationEntity relationEntity = new AttrAttrgroupRelationEntity();
BeanUtils.copyProperties(item, relationEntity);
return relationEntity;
}).collect(Collectors.toList());
this.saveBatch(collect);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/AttrAttrgroupRelationServiceImpl.java | Java | apache-2.0 | 1,774 |
package com.kong.meirimall.product.service.impl;
import cn.hutool.db.Page;
import com.kong.meirimall.product.entity.AttrEntity;
import com.kong.meirimall.product.service.AttrService;
import com.kong.meirimall.product.vo.AttrGroupWithAttrsVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.AttrGroupDao;
import com.kong.meirimall.product.entity.AttrGroupEntity;
import com.kong.meirimall.product.service.AttrGroupService;
@Service("attrGroupService")
public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEntity> implements AttrGroupService {
@Autowired
AttrService attrService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<AttrGroupEntity> page = this.page(
new Query<AttrGroupEntity>().getPage(params),
new QueryWrapper<AttrGroupEntity>()
);
return new PageUtils(page);
}
@Override
public PageUtils queryPage(Map<String, Object> params, Long catalogId) {
// 根据三级分类查
//select * from pms_attr_group where catalog_id=? and (attr_group_id=key or attr_group_name like %key%)
String key = (String)params.get("key");
QueryWrapper<AttrGroupEntity> wrapper = new QueryWrapper<AttrGroupEntity>();
if(!StringUtils.isEmpty(key)){
wrapper.and((obj)->{
// 条件拼装
obj.eq("attr_group_id",key).or().like("attr_group_name",key);
});
}
// 如果传过来的三级分类 id 为 0 , 查所有
if(catalogId==0){
IPage<AttrGroupEntity> page = this.page(new Query<AttrGroupEntity>().getPage(params),wrapper);
return new PageUtils(page);
}else {
wrapper.eq("catalog_id",catalogId);
IPage<AttrGroupEntity> page = this.page(new Query<AttrGroupEntity>().getPage(params),wrapper);
return new PageUtils(page);
}
}
@Override
public List<AttrGroupWithAttrsVo> getAttrGroupWithAttrsBycatalogId(Long catalogId) {
//查出所有分组
List<AttrGroupEntity> groupEntities = this.list(new QueryWrapper<AttrGroupEntity>().eq("catalog_id", catalogId));
List<AttrGroupWithAttrsVo> groupWithAttrsVos = groupEntities.stream().map(group -> {
AttrGroupWithAttrsVo groupWithAttrsVo = new AttrGroupWithAttrsVo();
BeanUtils.copyProperties(group, groupWithAttrsVo);
//查出所有属性,将 vo 拼装完整
List<AttrEntity> attrEntities = attrService.getRelationAttr(groupWithAttrsVo.getAttrGroupId());
groupWithAttrsVo.setAttrs(attrEntities);
return groupWithAttrsVo;
}).collect(Collectors.toList());
return groupWithAttrsVos;
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/AttrGroupServiceImpl.java | Java | apache-2.0 | 3,341 |
package com.kong.meirimall.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.kong.common.constant.ProductConstant;
import com.kong.meirimall.product.dao.AttrAttrgroupRelationDao;
import com.kong.meirimall.product.dao.AttrGroupDao;
import com.kong.meirimall.product.dao.CategoryDao;
import com.kong.meirimall.product.entity.AttrAttrgroupRelationEntity;
import com.kong.meirimall.product.entity.AttrGroupEntity;
import com.kong.meirimall.product.entity.CategoryEntity;
import com.kong.meirimall.product.service.CategoryService;
import com.kong.meirimall.product.vo.AttrGroupRelationVo;
import com.kong.meirimall.product.vo.AttrResponseVo;
import com.kong.meirimall.product.vo.AttrVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.AttrDao;
import com.kong.meirimall.product.entity.AttrEntity;
import com.kong.meirimall.product.service.AttrService;
@Service("attrService")
public class AttrServiceImpl extends ServiceImpl<AttrDao, AttrEntity> implements AttrService {
@Autowired
AttrAttrgroupRelationDao relationDao;
@Autowired
AttrGroupDao attrGroupDao;
@Autowired
CategoryDao categoryDao;
@Autowired
CategoryService categoryService;
@Autowired
AttrService attrService;
@Autowired
private AttrDao attrDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<AttrEntity> page = this.page(
new Query<AttrEntity>().getPage(params),
new QueryWrapper<AttrEntity>()
);
return new PageUtils(page);
}
@Override
public void saveAttr(AttrVo attrVo) {
AttrEntity attrEntity = new AttrEntity();
BeanUtils.copyProperties(attrVo, attrEntity);
//1、保存基本数据
this.save(attrEntity);
//2、保存关联关系
AttrAttrgroupRelationEntity entity = new AttrAttrgroupRelationEntity();
if(entity.getAttrGroupId()!=null){
if(attrEntity.getAttrType()== ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode()){
entity.setAttrGroupId(attrVo.getAttrGroupId()); // 属性分组 id
}
entity.setAttrId(attrEntity.getAttrId()); // 属性 id
}
relationDao.insert(entity);
}
@Override
public PageUtils queryPageAttr(Map<String, Object> params, Long catalogId, String type) {
System.out.println(params);
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
String key = (String) params.get("key");
System.out.println("key:"+key);
if(!StringUtils.isEmpty(key)){
wrapper.and((obj)->{
obj.eq("attr_id",key).or().like("attr_name",key);
});
}
if(catalogId!=0){
wrapper.eq("catalog_id",catalogId);
}
wrapper.eq("attr_type","base".equalsIgnoreCase(type)?ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode():ProductConstant.AttrEnum.ATTR_TYPE_SALE.getCode());
IPage<AttrEntity> page = this.page(new Query<AttrEntity>().getPage(params),wrapper);
PageUtils pageUtils = new PageUtils(page);
List<AttrEntity> records = page.getRecords();
List<AttrResponseVo> responseVoList = records.stream().map((attrEntity) -> {
AttrResponseVo attrRespVo = new AttrResponseVo();
BeanUtils.copyProperties(attrEntity, attrRespVo);
// 属性在其他表,不联表,分多次查
// 查分组的名,需要先从关联表中查到 该属性的 分组id,再用 分组id 在 分组表中查
// base 才需要设置分组信息
if("base".equalsIgnoreCase(type)){
AttrAttrgroupRelationEntity relationEntity = relationDao.selectOne(new QueryWrapper<AttrAttrgroupRelationEntity>()
.eq("attr_id", attrEntity.getAttrId()));
if (relationEntity != null && relationEntity.getAttrGroupId() != null) {
AttrGroupEntity groupEntity = attrGroupDao.selectById(relationEntity.getAttrGroupId());
attrRespVo.setGroupName(groupEntity.getAttrGroupName());
}
}
// 查分类的名,用 分类id 在分类表中查
CategoryEntity categoryEntity = categoryDao.selectById(attrEntity.getCatalogId());
if (categoryEntity != null) {
attrRespVo.setCatelogName(categoryEntity.getName());
}
return attrRespVo;
}).collect(Collectors.toList());
pageUtils.setList(responseVoList);
return pageUtils;
}
@Override
public AttrResponseVo geAttrInfo(Long attrId) {
AttrResponseVo respVo = new AttrResponseVo();
AttrEntity attrEntity = this.getById(attrId);
BeanUtils.copyProperties(attrEntity, respVo);
//设置分组信息
if(attrEntity.getAttrType()==ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode()){
AttrAttrgroupRelationEntity relationEntity = relationDao.selectOne(new QueryWrapper<AttrAttrgroupRelationEntity>().eq("attr_id", attrId));
if (relationEntity != null) {
respVo.setAttrGroupId(relationEntity.getAttrGroupId());
AttrGroupEntity groupEntity = attrGroupDao.selectById(relationEntity.getAttrGroupId());
respVo.setGroupName(groupEntity.getAttrGroupName());
}
}
//设置分类信息
Long catalogId = attrEntity.getCatalogId();
respVo.setCatelogPath(categoryService.findCatelogPath(catalogId));
CategoryEntity categoryEntity = categoryDao.selectById(catalogId);
if (categoryEntity != null) {
respVo.setCatelogName(categoryEntity.getName());
}
return respVo;
}
@Override
public void updateAttr(AttrVo attrVo) {
AttrEntity attrEntity = new AttrEntity();
BeanUtils.copyProperties(attrVo, attrEntity);
this.updateById(attrEntity);
//修改分组关联
AttrAttrgroupRelationEntity relationEntity = new AttrAttrgroupRelationEntity();
if(attrEntity.getAttrType()==ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode()){
relationEntity.setAttrGroupId(attrVo.getAttrGroupId());
}
relationEntity.setAttrId(attrVo.getAttrId());
UpdateWrapper<AttrAttrgroupRelationEntity> wrapper = new UpdateWrapper<AttrAttrgroupRelationEntity>().eq("attr_id", attrEntity.getAttrId());
//如果 attr_id匹配成功 且 attr_name 不为 null ,修改
if(relationDao.selectCount(wrapper)>0){
relationDao.update(relationEntity,wrapper);
}else {
//否则新增
relationDao.insert(relationEntity);
}
}
/**
* 根据 分组id 查到 所有属性
* @param attrgroupId
* @return
*/
@Override
public List<AttrEntity> getRelationAttr(Long attrgroupId) {
//用 组id 在关联表中查,查出所有 关联对象,用该对象得到 属性id,用 属性id 在属性表中查询
List<AttrAttrgroupRelationEntity> relationEntities = relationDao.selectList(new QueryWrapper<AttrAttrgroupRelationEntity>().eq("attr_group_id", attrgroupId));
List<Long> attrIds = relationEntities.stream().map((relationEntity) -> {
return relationEntity.getAttrId();
}).collect(Collectors.toList());
if(attrIds==null || attrIds.size()==0){
return null;
}
Collection<AttrEntity> attrEntities = attrService.listByIds(attrIds);
return (List<AttrEntity>) attrEntities;
}
@Override
public void deleteRelation(AttrGroupRelationVo[] vos) {
// relationDao.delete(new QueryWrapper<AttrAttrgroupRelationEntity>().eq("attr_id",1L)
// .eq("attr_group_id",1L));
//只发一个请求,批量删除
List<AttrAttrgroupRelationEntity> relationEntities = Arrays.asList(vos).stream().map((item) -> {
AttrAttrgroupRelationEntity relationEntity = new AttrAttrgroupRelationEntity();
BeanUtils.copyProperties(item, relationEntity);
return relationEntity;
}).collect(Collectors.toList());
relationDao.deleteBatchRelation(relationEntities);
}
//获取当前未关联的属性
@Override
public PageUtils getNoRelationAttr(Map<String, Object> params, Long attrgroupId) {
//1、当前分组只能关联 自己所属的分类里面的所有属性
AttrGroupEntity groupEntity = attrGroupDao.selectById(attrgroupId);
// 限定 该类下的
Long catalogId = groupEntity.getCatalogId();
//2、当前分组只能关联 该类别的分组没有引用的属性
// 1) 查出所有组 的 id
List<AttrGroupEntity> groupEntities = attrGroupDao.selectList(new QueryWrapper<AttrGroupEntity>()
.eq("catalog_id",catalogId));
List<Long> groupIds = groupEntities.stream().map((obj) -> {
return obj.getAttrGroupId();
}).collect(Collectors.toList());
// 2) 再用 groupId 通过关联表 查出所有关联的 属性
QueryWrapper<AttrAttrgroupRelationEntity> queryWrapper = new QueryWrapper<AttrAttrgroupRelationEntity>()
.in("attr_group_id",groupIds);
List<AttrAttrgroupRelationEntity> relationEntities = relationDao.selectList(queryWrapper);
List<Long> attrIds = relationEntities.stream().map((item) -> {
return item.getAttrId();
}).collect(Collectors.toList());
// 3) 剔除
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<AttrEntity>().eq("catalog_id", catalogId)
.eq("attr_type",ProductConstant.AttrEnum.ATTR_TYPE_BASE.getCode());
if(attrIds!=null&&attrIds.size()>0){
wrapper.notIn("attr_id", attrIds);
}
//模糊查询条件
String key = (String) params.get("key");
if(!StringUtils.isEmpty(key)){
wrapper.and((w)->{
w.eq("attr_id",key).or().like("attr_name",key);
});
}
IPage<AttrEntity> page = this.page(new Query<AttrEntity>().getPage(params), wrapper);
return new PageUtils(page);
}
@Override
public List<Long> selectSearchAttrs(List<Long> attrIds) {
return baseMapper.selectSearchAttrIds(attrIds);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/AttrServiceImpl.java | Java | apache-2.0 | 10,947 |
package com.kong.meirimall.product.service.impl;
import com.kong.meirimall.product.service.CategoryBrandRelationService;
import com.kong.meirimall.product.service.CategoryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.BrandDao;
import com.kong.meirimall.product.entity.BrandEntity;
import com.kong.meirimall.product.service.BrandService;
import org.springframework.transaction.annotation.Transactional;
@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandDao, BrandEntity> implements BrandService {
@Autowired
CategoryBrandRelationService categoryBrandRelationService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 1、获取 key
String key = (String) params.get("key");
QueryWrapper<BrandEntity> wrapper = new QueryWrapper<>();
if(!StringUtils.isEmpty(key)){
wrapper.eq("brand_id", key).or().like("name",key);
}
IPage<BrandEntity> page = this.page(new Query<BrandEntity>().getPage(params), wrapper);
return new PageUtils(page);
}
@Transactional
@Override
public void updateDetail(BrandEntity brand) {
//保证冗余字段的数据一致
this.updateById(brand);
if(!StringUtils.isEmpty((brand.getName()))){
//同步更新其他关联表中的数据
categoryBrandRelationService.updateBrand(brand.getBrandId(),brand.getName());
// TODO 更新其他关联表的冗余信息
}
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/BrandServiceImpl.java | Java | apache-2.0 | 2,002 |
package com.kong.meirimall.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.kong.meirimall.product.dao.BrandDao;
import com.kong.meirimall.product.dao.CategoryDao;
import com.kong.meirimall.product.entity.BrandEntity;
import com.kong.meirimall.product.entity.CategoryEntity;
import com.kong.meirimall.product.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.CategoryBrandRelationDao;
import com.kong.meirimall.product.entity.CategoryBrandRelationEntity;
import com.kong.meirimall.product.service.CategoryBrandRelationService;
@Service("categoryBrandRelationService")
public class CategoryBrandRelationServiceImpl extends ServiceImpl<CategoryBrandRelationDao, CategoryBrandRelationEntity> implements CategoryBrandRelationService {
@Autowired
BrandDao brandDao;
@Autowired
CategoryDao categoryDao;
@Autowired
CategoryBrandRelationDao categoryBrandRelationDao;
@Autowired
BrandService brandService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CategoryBrandRelationEntity> page = this.page(
new Query<CategoryBrandRelationEntity>().getPage(params),
new QueryWrapper<CategoryBrandRelationEntity>()
);
return new PageUtils(page);
}
@Override
public void saveDetail(CategoryBrandRelationEntity categoryBrandRelation) {
//获取品牌 id
Long brandId = categoryBrandRelation.getBrandId();
//获取分类 id
Long catalogId = categoryBrandRelation.getCatalogId();
//查询 品牌名 和 分类名
BrandEntity brandEntity = brandDao.selectById(brandId);
CategoryEntity categoryEntity = categoryDao.selectById(catalogId);
categoryBrandRelation.setBrandName(brandEntity.getName());
categoryBrandRelation.setCatelogName(categoryEntity.getName());
this.save(categoryBrandRelation);
}
@Override
public void updateBrand(Long brandId, String name) {
CategoryBrandRelationEntity relationEntity = new CategoryBrandRelationEntity();
relationEntity.setBrandId(brandId);
relationEntity.setBrandName(name);
this.update(relationEntity,new UpdateWrapper<CategoryBrandRelationEntity>().eq("brand_id",brandId));
}
@Override
public void updateCategory(Long catId, String name) {
this.baseMapper.updateCategory(catId,name);
}
@Override
public List<BrandEntity> getBrandsByCatId(Long catId) {
List<CategoryBrandRelationEntity> relationEntities = categoryBrandRelationDao.selectList(new QueryWrapper<CategoryBrandRelationEntity>()
.eq("catalog_id", catId));
//品牌名和id在关联表中都有,但是因为 别人可能想获得品牌的详细信息,所以还是应该返回品牌对象
List<BrandEntity> brandEntities = relationEntities.stream().map(item -> {
BrandEntity brandEntity = brandService.getById(item.getBrandId());
return brandEntity;
}).collect(Collectors.toList());
return brandEntities;
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/CategoryBrandRelationServiceImpl.java | Java | apache-2.0 | 3,622 |
package com.kong.meirimall.product.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.kong.meirimall.product.service.CategoryBrandRelationService;
import com.kong.meirimall.product.vo.Catalog2Vo;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.CategoryDao;
import com.kong.meirimall.product.entity.CategoryEntity;
import com.kong.meirimall.product.service.CategoryService;
import org.springframework.transaction.annotation.Transactional;
@Service("categoryService")
public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService {
// @Autowired
// CategoryDao categoryDao;
@Autowired
CategoryBrandRelationService categoryBrandRelationService;
@Autowired
StringRedisTemplate redisTemplate;
@Autowired
RedissonClient redisson;
@Override
public List<CategoryEntity> listWithTree() {
//1.查出所有分类
// 直接用 baseMapper,因为 ServiceImpl 中 将 CategoryDao extends 成了 该泛型
List<CategoryEntity> entities = baseMapper.selectList(null);// 没有查询条件(即查所有)
//2.组装成父子的树形结构
// 找到所有的一级分类(父id 为 0 的)
List<CategoryEntity> level1Menus = entities.stream().filter(categoryEntity -> categoryEntity.getParentCid() == 0)
.map((menu)->{
menu.setChildren(getChildren(menu,entities));
return menu;
}).sorted((menu1,menu2)->((menu1.getSort()==null ? 0:menu1.getSort())-(menu2.getSort()==null ? 0:menu2.getSort())
)).collect((Collectors.toList()));
return level1Menus;
}
// 递归查找所有菜单的子菜单
private List<CategoryEntity> getChildren(CategoryEntity root, List<CategoryEntity> all) {
List<CategoryEntity> children = all.stream().filter(categoryEntity -> {
return categoryEntity.getParentCid() == root.getCatId();
}).map(categoryEntity -> {
categoryEntity.setChildren(getChildren(categoryEntity,all));
return categoryEntity;
}).sorted((menu1,menu2)->{
return ((menu1.getSort()==null?0: menu1.getSort())-(menu2.getSort()==null?0: menu2.getSort()));
}).collect(Collectors.toList());
return children;
}
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CategoryEntity> page = this.page(
new Query<CategoryEntity>().getPage(params),
new QueryWrapper<CategoryEntity>()
);
return new PageUtils(page);
}
@Override
public void removeMenueByIds(List<Long> list) {
// 代办事项列表,可在左下角查看
// TODO 1.检查当前删除的菜单,是否被别的地方引用
// 逻辑删除,查看 mybatis plus 的官方文档,表中要有一个标志逻辑删除状态的字段
// 1). 配置全局的逻辑删除规则(yml中)(可省略)
// 2). 配置逻辑删除的组件 Bean (mybatis plus 3.1 以上版本不需要)
// 3). 给 showStatus 属性加上逻辑删除注解 @Tablelogic
baseMapper.deleteBatchIds(list);
}
//[2,25,225]
@Override
public Long[] findCatelogPath(Long catalogId) {
List<Long> paths = new ArrayList<>();
findParentPath(catalogId, paths);
Collections.reverse(paths); //存入的顺序是 子->父,而路径是 父->子,需要将集合逆序
return paths.toArray(new Long[paths.size()]);
}
// 级联更新所有关联的数据(当前表和其他表)
@Caching(evict={
@CacheEvict(value = "category",key = "'getLevel1Categorys'"),
@CacheEvict(value = "category",key = "'geCatelogJson'")
})
@Transactional //事务
@Override
public void updateCascade(CategoryEntity category) {
this.updateById(category);
categoryBrandRelationService.updateCategory(category.getCatId(),category.getName());
}
private void findParentPath(Long catalogId,List<Long> Paths) {
Paths.add(catalogId);
CategoryEntity category = this.getById(catalogId);
//向上查找父,一层层递归
if (category.getParentCid() != 0) {
findParentPath(category.getParentCid(), Paths);
}
}
@Cacheable(value = "category",key = "#root.method.name") // 代表当前方法的结果需要缓存,如果缓存中有,方法不用调用
@Override
public List<CategoryEntity> getLevel1Categorys() {
System.out.println("Get Level 1 Categorys");
List<CategoryEntity> selectList = baseMapper.selectList(null);
// 1、查出所有一级分类
List<CategoryEntity> level1Categorys = getParentCid(selectList,0L);
return level1Categorys;
}
@Cacheable(value = "category",key = "#root.method.name")
@Override
public Map<String, List<Catalog2Vo>> geCatelogJson() {
/**
* 1、空结果缓存:解决穿透
* 2、设置过期时间(加随机值):解决雪崩
* 3、加锁:解决击穿
*/
Map<String, List<Catalog2Vo>> stringListMap=null;
//缓存的数据 都是 json 字符串形式(全平台兼容)
ValueOperations<String, String> ops = redisTemplate.opsForValue();
String catelogJson = ops.get("catalogJson");
if(StringUtils.isEmpty(catelogJson)){
stringListMap = geCatelogJsonFromDb();
}else {
stringListMap = JSON.parseObject(catelogJson,new TypeReference<Map<String, List<Catalog2Vo>>>() {});
}
return stringListMap;
}
private List<CategoryEntity> getParentCid(List<CategoryEntity> selectList,Long parentCid) {
List<CategoryEntity> collect = selectList.stream().filter(item -> item.getParentCid().equals(parentCid)).collect(Collectors.toList());
return collect;
}
// 从数据库查询 三级分类 并存入缓存
@Override
public Map<String, List<Catalog2Vo>> geCatelogJsonFromDb(){
ValueOperations<String, String> ops = redisTemplate.opsForValue();
String catelogJson = ops.get("catalogJson");
if(!StringUtils.isEmpty(catelogJson)) {
Map<String, List<Catalog2Vo>> stringListMap = JSON.parseObject(catelogJson, new TypeReference<Map<String, List<Catalog2Vo>>>() {
});
return stringListMap;
}
System.out.println("查询了数据库");
// 加索后,线程需排队执行,在缓存中判断,如果没有再继续查询
// 将数据库的多次查询变为 1 次,提高性能
List<CategoryEntity> selectList = baseMapper.selectList(null);
// 1、查出所有一级分类
List<CategoryEntity> level1Categorys = getParentCid(selectList,0L);
// 2、封装子对象
Map<String, List<Catalog2Vo>> map = level1Categorys.stream().collect(Collectors.toMap(k -> k.getCatId().toString(), v -> {
// 查到每个一级分类的所有二级分类,转化,再转为 list 集合
List<CategoryEntity> categoryEntities = getParentCid(selectList,v.getCatId());
List<Catalog2Vo> catalog2Vos = null;
if (categoryEntities != null) {
catalog2Vos = categoryEntities.stream().map(l2 -> {
Catalog2Vo catalog2Vo = new Catalog2Vo(v.getCatId().toString(), null, l2.getCatId().toString(), l2.getName());
List<CategoryEntity> level3Catalogs = getParentCid(selectList,l2.getCatId());
List<Catalog2Vo.Catalog3Vo> catalog3Vos=null;
if(level3Catalogs!=null){
catalog3Vos = level3Catalogs.stream().map(l3 -> {
Catalog2Vo.Catalog3Vo catalog3Vo = new Catalog2Vo.Catalog3Vo(l2.getCatId().toString(), l3.getCatId().toString(), l3.getName());
return catalog3Vo;
}).collect(Collectors.toList());
catalog2Vo.setCatalog3List(catalog3Vos);
}
return catalog2Vo;
}).collect(Collectors.toList());
}
return catalog2Vos;
}));
catelogJson = JSON.toJSONString(map);
ops.set("catalogJson", catelogJson,1, TimeUnit.DAYS);
return map;
}
/**
* @return
*/
@Override
public Map<String, List<Catalog2Vo>> geCatelogJsonFromDbWithRedisLock(){
// 1、抢占分布式锁,去 redis 占坑
RLock lock = redisson.getLock("CatalogJson-lick");
lock.lock();
Map<String, List<Catalog2Vo>> dataFromDb;
try{
dataFromDb = geCatelogJsonFromDb();
}finally {
lock.unlock();
}
return dataFromDb;
}
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/CategoryServiceImpl.java | Java | apache-2.0 | 10,051 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.CommentReplayDao;
import com.kong.meirimall.product.entity.CommentReplayEntity;
import com.kong.meirimall.product.service.CommentReplayService;
@Service("commentReplayService")
public class CommentReplayServiceImpl extends ServiceImpl<CommentReplayDao, CommentReplayEntity> implements CommentReplayService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CommentReplayEntity> page = this.page(
new Query<CommentReplayEntity>().getPage(params),
new QueryWrapper<CommentReplayEntity>()
);
return new PageUtils(page);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/CommentReplayServiceImpl.java | Java | apache-2.0 | 1,040 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.ProductAttrValueDao;
import com.kong.meirimall.product.entity.ProductAttrValueEntity;
import com.kong.meirimall.product.service.ProductAttrValueService;
@Service("productAttrValueService")
public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao, ProductAttrValueEntity> implements ProductAttrValueService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ProductAttrValueEntity> page = this.page(
new Query<ProductAttrValueEntity>().getPage(params),
new QueryWrapper<ProductAttrValueEntity>()
);
return new PageUtils(page);
}
@Override
public void saveProductAttr(List<ProductAttrValueEntity> attrValueEntities) {
this.saveBatch(attrValueEntities);
}
@Override
public List<ProductAttrValueEntity> baseAttrListforspu(Long spuId) {
List<ProductAttrValueEntity> entities = this.baseMapper.selectList(new QueryWrapper<ProductAttrValueEntity>().eq("spu_id", spuId));
return entities;
}
@Override
public void updateSpuAttr(Long spuId, List<ProductAttrValueEntity> entities) {
// 因为页面上重新操作了-->更新,将之前的属性删掉,再添加,就不用判断哪个更新了
// this.baseMapper.delete(new QueryWrapper<ProductAttrValueEntity>().eq("spu_id", spuId));
for (ProductAttrValueEntity entity : entities) {
this.baseMapper.update(entity,new QueryWrapper<ProductAttrValueEntity>().eq("spu_id",spuId));
}
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/ProductAttrValueServiceImpl.java | Java | apache-2.0 | 2,000 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SkuImagesDao;
import com.kong.meirimall.product.entity.SkuImagesEntity;
import com.kong.meirimall.product.service.SkuImagesService;
@Service("skuImagesService")
public class SkuImagesServiceImpl extends ServiceImpl<SkuImagesDao, SkuImagesEntity> implements SkuImagesService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuImagesEntity> page = this.page(
new Query<SkuImagesEntity>().getPage(params),
new QueryWrapper<SkuImagesEntity>()
);
return new PageUtils(page);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SkuImagesServiceImpl.java | Java | apache-2.0 | 996 |
package com.kong.meirimall.product.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SkuInfoDao;
import com.kong.meirimall.product.entity.SkuInfoEntity;
import com.kong.meirimall.product.service.SkuInfoService;
@Service("skuInfoService")
public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoDao, SkuInfoEntity> implements SkuInfoService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuInfoEntity> page = this.page(
new Query<SkuInfoEntity>().getPage(params),
new QueryWrapper<SkuInfoEntity>()
);
return new PageUtils(page);
}
@Override
public void saveSkuInfo(SkuInfoEntity skuInfoEntity) {
this.baseMapper.insert(skuInfoEntity);
}
@Override
public PageUtils queryPageByCondition(Map<String, Object> params) {
QueryWrapper<SkuInfoEntity> wrapper = new QueryWrapper<>();
String key = (String) params.get("key");
if (!StringUtils.isEmpty(key)){
wrapper.and((obj)->{
obj.eq("sku_id",key).or().like("sku_name",key);
});
}
String catalogId = (String) params.get("catalogId");
if (!StringUtils.isEmpty(catalogId) && !"0".equalsIgnoreCase(catalogId)){
wrapper.and((obj)->{
obj.eq("catalog_id",catalogId);
});
}
String brandId = (String) params.get("brandId");
if (!StringUtils.isEmpty(brandId) && !"0".equalsIgnoreCase(brandId)){
wrapper.and((obj)->{
obj.eq("brand_id",brandId);
});
}
String mim = (String) params.get("min");
if (!StringUtils.isEmpty(mim)){
wrapper.ge("price",mim);
}
String max = (String) params.get("max");
if (!StringUtils.isEmpty(max)){
try {
BigDecimal decimal = new BigDecimal(max);
if(decimal.compareTo(new BigDecimal(0))==1){
wrapper.le("price",max);
}
}catch (Exception e){
e.printStackTrace();
}
}
IPage<SkuInfoEntity> page = this.page(new Query<SkuInfoEntity>().getPage(params),wrapper);
return new PageUtils(page);
}
@Override
public List<SkuInfoEntity> getSkusBySpuId(Long spuId) {
List<SkuInfoEntity> entities = this.list(new QueryWrapper<SkuInfoEntity>().eq("spu_id", spuId));
return entities;
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SkuInfoServiceImpl.java | Java | apache-2.0 | 2,956 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SkuSaleAttrValueDao;
import com.kong.meirimall.product.entity.SkuSaleAttrValueEntity;
import com.kong.meirimall.product.service.SkuSaleAttrValueService;
@Service("skuSaleAttrValueService")
public class SkuSaleAttrValueServiceImpl extends ServiceImpl<SkuSaleAttrValueDao, SkuSaleAttrValueEntity> implements SkuSaleAttrValueService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuSaleAttrValueEntity> page = this.page(
new Query<SkuSaleAttrValueEntity>().getPage(params),
new QueryWrapper<SkuSaleAttrValueEntity>()
);
return new PageUtils(page);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SkuSaleAttrValueServiceImpl.java | Java | apache-2.0 | 1,073 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SpuCommentDao;
import com.kong.meirimall.product.entity.SpuCommentEntity;
import com.kong.meirimall.product.service.SpuCommentService;
@Service("spuCommentService")
public class SpuCommentServiceImpl extends ServiceImpl<SpuCommentDao, SpuCommentEntity> implements SpuCommentService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuCommentEntity> page = this.page(
new Query<SpuCommentEntity>().getPage(params),
new QueryWrapper<SpuCommentEntity>()
);
return new PageUtils(page);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SpuCommentServiceImpl.java | Java | apache-2.0 | 1,007 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SpuImagesDao;
import com.kong.meirimall.product.entity.SpuImagesEntity;
import com.kong.meirimall.product.service.SpuImagesService;
@Service("spuImagesService")
public class SpuImagesServiceImpl extends ServiceImpl<SpuImagesDao, SpuImagesEntity> implements SpuImagesService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuImagesEntity> page = this.page(
new Query<SpuImagesEntity>().getPage(params),
new QueryWrapper<SpuImagesEntity>()
);
return new PageUtils(page);
}
@Override
public void saveImages(Long id, List<String> images) {
if(images == null || images.size() == 0){
return;
}else {
List<SpuImagesEntity> imagesEntities = images.stream().map(img -> {
SpuImagesEntity spuImagesEntity = new SpuImagesEntity();
spuImagesEntity.setSpuId(id);
spuImagesEntity.setImgUrl(img);
return spuImagesEntity;
}).collect(Collectors.toList());
this.saveBatch(imagesEntities);
}
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SpuImagesServiceImpl.java | Java | apache-2.0 | 1,609 |
package com.kong.meirimall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SpuInfoDescDao;
import com.kong.meirimall.product.entity.SpuInfoDescEntity;
import com.kong.meirimall.product.service.SpuInfoDescService;
@Service("spuInfoDescService")
public class SpuInfoDescServiceImpl extends ServiceImpl<SpuInfoDescDao, SpuInfoDescEntity> implements SpuInfoDescService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuInfoDescEntity> page = this.page(
new Query<SpuInfoDescEntity>().getPage(params),
new QueryWrapper<SpuInfoDescEntity>()
);
return new PageUtils(page);
}
@Override
public void saveSpuInfoDesc(SpuInfoDescEntity infoDescEntity) {
this.baseMapper.insert(infoDescEntity);
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SpuInfoDescServiceImpl.java | Java | apache-2.0 | 1,155 |
package com.kong.meirimall.product.service.impl;
import com.alibaba.fastjson.TypeReference;
import com.kong.common.constant.ProductConstant;
import com.kong.common.to.SkuReductionTo;
import com.kong.common.to.SpuBoundTo;
import com.kong.common.to.es.SkuEsModel;
import com.kong.common.utils.R;
import com.kong.common.vo.SkuHasStockVo;
import com.kong.meirimall.product.entity.*;
import com.kong.meirimall.product.feign.CouponFeignService;
import com.kong.meirimall.product.feign.SearchFeignService;
import com.kong.meirimall.product.feign.WareFeignService;
import com.kong.meirimall.product.service.*;
import com.kong.meirimall.product.vo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kong.common.utils.PageUtils;
import com.kong.common.utils.Query;
import com.kong.meirimall.product.dao.SpuInfoDao;
import org.springframework.transaction.annotation.Transactional;
@Service("spuInfoService")
public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
@Autowired
SpuInfoDescService spuInfoDescService;
@Autowired
SpuImagesService spuImagesService;
@Autowired
AttrService attrService;
@Autowired
ProductAttrValueService productAttrValueService;
@Autowired
SkuInfoService skuInfoService;
@Autowired
SkuImagesService skuImagesService;
@Autowired
SkuSaleAttrValueService skuSaleAttrValueService;
@Autowired
CouponFeignService couponFeignService;
@Autowired
BrandService brandService;
@Autowired
CategoryService categoryService;
@Autowired
WareFeignService wareFeignService;
@Autowired
SearchFeignService searchFeignService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuInfoEntity> page = this.page(
new Query<SpuInfoEntity>().getPage(params),
new QueryWrapper<SpuInfoEntity>()
);
return new PageUtils(page);
}
@Transactional //因为要保存很多东西,这是一个事务
@Override
public void saveSpuInfo(SpuSaveVo spuSaveVo) {
// 1、保存 spu 基本信息;pms_spu_info
SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
BeanUtils.copyProperties(spuSaveVo, spuInfoEntity);
spuInfoEntity.setCreateTime(new Date());
spuInfoEntity.setUpdateTime(new Date());
this.saveBaseSpuInfo(spuInfoEntity);
// 2、保存 spu 的描述图片 到 pms_spu_info_desc 表
// spu_id 不是自增的,要拿来
List<String> decript = spuSaveVo.getDecript();
SpuInfoDescEntity infoDescEntity = new SpuInfoDescEntity();
infoDescEntity.setSpuId(spuInfoEntity.getId());
infoDescEntity.setDecript(String.join(",",decript));
spuInfoDescService.saveSpuInfoDesc(infoDescEntity);
// 3、保存 spu 的图片集;pms_spu_images
List<String> images = spuSaveVo.getImages();
//保存图片之前,还要知道是给哪个商品的,传入参数 spu 的 id
spuImagesService.saveImages(spuInfoEntity.getId(),images);
// 4、保存 spu 的规格参数;pms_product_attr_value
List<BaseAttrs> baseAttrs = spuSaveVo.getBaseAttrs();
List<ProductAttrValueEntity> attrValueEntities = baseAttrs.stream().map(attr -> {
ProductAttrValueEntity attrValueEntity = new ProductAttrValueEntity();
Long attrId = attr.getAttrId();
attrValueEntity.setAttrId(attrId);
//页面没提交 attrName ,需要查
attrValueEntity.setAttrName(attrService.getById(attrId).getAttrName());
attrValueEntity.setAttrValue(attr.getAttrValues());
attrValueEntity.setQuickShow(attr.getShowDesc());
attrValueEntity.setSpuId(spuInfoEntity.getId());
return attrValueEntity;
}).collect(Collectors.toList());
productAttrValueService.saveProductAttr(attrValueEntities);
// 5、保存 spu 的积分信息;跨库:sms_spu_bounds
Bounds bounds = spuSaveVo.getBounds();
SpuBoundTo spuBoundTo = new SpuBoundTo();
BeanUtils.copyProperties(bounds, spuBoundTo);
spuBoundTo.setSpuId(spuInfoEntity.getId());
R r1 = couponFeignService.saveSpuBounds(spuBoundTo);
if(r1.getCode()==0){
log.error("远程保存 sku 优惠信息失败");
}
// 6、保存 当前 spu 对应的所有 sku 信息;
List<Skus> skus = spuSaveVo.getSkus();
if(skus !=null && skus.size()>0){
skus.forEach(sku -> {
// 1)、sku 的基本信息;pms_sku_info
//遍历 sku 中的每个图片,判断哪个是默认图片
String defaultImg = "";
for (Images img : sku.getImages()) {
if(img.getDefaultImg()==1){
defaultImg=img.getImgUrl();
}
}
SkuInfoEntity skuInfoEntity = new SkuInfoEntity();
BeanUtils.copyProperties(sku,skuInfoEntity);
skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());
skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());
skuInfoEntity.setSpuId(spuInfoEntity.getId());
skuInfoEntity.setSaleCount(0L);
skuInfoEntity.setSkuDefaultImg(defaultImg);
skuInfoService.saveSkuInfo(skuInfoEntity);
//将 skuInfoEntity 保存到数据库后,才能从库中取得自动生成的 skuId,拼装 图片对象(一个 sku 的所有图片对象的 skuId 同)
Long skuId = skuInfoEntity.getSkuId();
// 2)、sku 的图片信息;pms_sku_images
// TODO 没有图片路径的无需保存(没选中的)
List<SkuImagesEntity> imagesEntities = sku.getImages().stream().map(img -> {
SkuImagesEntity skuImagesEntity = new SkuImagesEntity();
skuImagesEntity.setSkuId(skuId);
skuImagesEntity.setImgUrl(img.getImgUrl());
skuImagesEntity.setDefaultImg(img.getDefaultImg());
return skuImagesEntity;
}).filter(entity->{
//返回 false 就会被过滤掉
return !StringUtils.isEmpty(entity.getImgUrl());
}).collect(Collectors.toList());
skuImagesService.saveBatch(imagesEntities);
// 3)、sku 的销售属性信息;pms_sku_sale_attr_value
List<Attr> attrs = sku.getAttr();
List<SkuSaleAttrValueEntity> saleAttrValueEntities = attrs.stream().map(attr -> {
SkuSaleAttrValueEntity skuSaleAttrValue = new SkuSaleAttrValueEntity();
BeanUtils.copyProperties(attr, skuSaleAttrValue);
skuSaleAttrValue.setSkuId(skuId);
return skuSaleAttrValue;
}).collect(Collectors.toList());
skuSaleAttrValueService.saveBatch(saleAttrValueEntities);
// 4)、sku 的优惠、满减等信息;跨库:sms_sku_ladder、sms_sku_full_reduction、sms_member_price
SkuReductionTo skuReductionTo = new SkuReductionTo();
BeanUtils.copyProperties(sku, skuReductionTo);
skuReductionTo.setSkuId(skuId);
if(skuReductionTo.getFullCount()>0 || skuReductionTo.getFullPrice().compareTo(new BigDecimal(0))==1){
R r = couponFeignService.saveSkuReduction(skuReductionTo);
if(r.getCode()!=0){
log.error("远程保存 spu 积分信息失败");
}
}
});
}
}
@Override
public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
this.baseMapper.insert(spuInfoEntity);
}
@Override
public PageUtils queryPageByCondition(Map<String, Object> params) {
QueryWrapper<SpuInfoEntity> wrapper = new QueryWrapper<SpuInfoEntity>();
String key = (String) params.get("key");
if(!StringUtils.isEmpty(key)){
wrapper.and((w)->{
w.eq("id", key).or().like("spu_name", key);
});
}
String status = (String) params.get("status");
if(!StringUtils.isEmpty(status)){
wrapper.eq("publish_status", status);
}
String brandId = (String) params.get("brandId");
if(!StringUtils.isEmpty(brandId) && !"0".equalsIgnoreCase(brandId)){
wrapper.eq("brand_id", brandId);
}
String catalogId = (String) params.get("catalogId");
if(!StringUtils.isEmpty(catalogId) && !"0".equalsIgnoreCase(catalogId)){
wrapper.eq("catalog_id",catalogId);
}
IPage<SpuInfoEntity> page = this.page(new Query<SpuInfoEntity>().getPage(params), wrapper);
return new PageUtils(page);
}
// 商品上架
@Override
public void up(Long spuId) {
//存储需要上架的商品
List<SkuEsModel> upProducts=new ArrayList<>();
//1、组装需要的数据
SkuEsModel esModel = new SkuEsModel();
// 查询当前 sku 的所有规格属性信息(只需要 可以被检索的)
// 所有实体 -> 所有 attrId -> 用 xml 查出符合要求的 attrId -> 用符合要求的 attrId 过滤出 符合要求的实体
List<ProductAttrValueEntity> attrValueEntities = productAttrValueService.baseAttrListforspu(spuId);
List<Long> attrIds = attrValueEntities.stream().map(attr -> {
return attr.getAttrId();
}).collect(Collectors.toList());
// 过滤出可被检索且 在 查出来的 attrIds 中的数据
List<Long> searchAttrIds=attrService.selectSearchAttrs(attrIds);
Set<Long> idSet=new HashSet<>(searchAttrIds);
List<SkuEsModel.Attrs> attrs = attrValueEntities.stream().filter(item -> {
return idSet.contains(item.getAttrId());
}).map(item -> {
SkuEsModel.Attrs attrs1 = new SkuEsModel.Attrs();
BeanUtils.copyProperties(item, attrs1);
return attrs1;
}).collect(Collectors.toList());
// 查出当前 spuId 对应的所有 sku 信息,并转为 传入 es 的模型
List<SkuInfoEntity> skuInfoEntities=skuInfoService.getSkusBySpuId(spuId);
List<Long> skuIds = skuInfoEntities.stream().map(SkuInfoEntity::getSkuId).collect(Collectors.toList());
//发送远程调用,库存系统查询是否有库存
Map<Long, Boolean> booleanMap=null;
try{
R hasStock = wareFeignService.getSkusHasStock(skuIds);
TypeReference<List<SkuHasStockVo>> typeReference = new TypeReference<List<SkuHasStockVo>>() {
};
booleanMap = hasStock.getData(typeReference).stream().collect(Collectors.toMap(SkuHasStockVo::getSkuId, SkuHasStockVo::getHasStock));
}catch (Exception e){
log.error("库存服务查询异常:原因{}",e);
}
Map<Long, Boolean> finalBooleanMap = booleanMap;
upProducts = skuInfoEntities.stream().map(skuInfo -> {
SkuEsModel esModel1 = new SkuEsModel();
BeanUtils.copyProperties(skuInfo,esModel1);
esModel1.setSkuPrice(skuInfo.getPrice());
esModel1.setSkuImg(skuInfo.getSkuDefaultImg());
BrandEntity brandEntity = brandService.getById(skuInfo.getBrandId());
esModel1.setBrandName(brandEntity.getName());
esModel1.setBrandImg(brandEntity.getLogo());
Long catalogId = skuInfo.getCatalogId();
CategoryEntity category = categoryService.getById(catalogId);
esModel1.setCategoryName(category.getName());
esModel1.setCategoryId(catalogId);
// 设置检索属性
esModel1.setAttrs(attrs);
// 设置库存信息
if(finalBooleanMap ==null){ //内部引用外面的局部变量必须加 final,保证数据的一致性
esModel1.setHasStock(true);
}else {
esModel1.setHasStock(finalBooleanMap.get(skuInfo.getSkuId()));
}
// TODO 2.热度评分。先设为0,不写
esModel1.setHotScore(0L);
return esModel1;
}).collect(Collectors.toList());
//2、将数据发送给 es 进行保存:调用 meirimall-search(检索服务)
R r = searchFeignService.productStatusUp(upProducts);
if(r.getCode()==0){
//远程调用成功,TODO 修改 spu 的状态为已上架
baseMapper.updateSpuStatus(spuId, ProductConstant.StatusEnum.SPU_UP.getCode());
}else {
// TODO 重复调用(接口幂等性)
}
}
} | 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/service/impl/SpuInfoServiceImpl.java | Java | apache-2.0 | 13,337 |
package com.kong.meirimall.product.vo;
import lombok.Data;
@Data
public class AttrGroupRelationVo {
private Long attrGroupId;
private Long attrId;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/AttrGroupRelationVo.java | Java | apache-2.0 | 159 |
package com.kong.meirimall.product.vo;
import com.kong.meirimall.product.entity.AttrEntity;
import lombok.Data;
import java.util.List;
@Data
public class AttrGroupWithAttrsVo {
/**
* 分组id
*/
private Long attrGroupId;
/**
* 组名
*/
private String attrGroupName;
/**
* 排序
*/
private Integer sort;
/**
* 描述
*/
private String descript;
/**
* 组图标
*/
private String icon;
private List<AttrEntity> attrs;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/AttrGroupWithAttrsVo.java | Java | apache-2.0 | 518 |
package com.kong.meirimall.product.vo;
import lombok.Data;
@Data
public class AttrResponseVo extends AttrVo{
// 所属分类名
private String catelogName;
// 所属分组名
private String groupName;
private Long[] catelogPath;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/AttrResponseVo.java | Java | apache-2.0 | 254 |
package com.kong.meirimall.product.vo;
import lombok.Data;
@Data
public class AttrVo {
/**
* 属性id
*/
private Long attrId;
/**
* 属性名
*/
private String attrName;
/**
* 是否需要检索[0-不需要,1-需要]
*/
private Integer searchType;
/**
* 属性图标
*/
private String icon;
/**
* 可选值列表[用逗号分隔]
*/
private String valueSelect;
/**
* 属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]
*/
private Integer attrType;
/**
* 启用状态[0 - 禁用,1 - 启用]
*/
private Long enable;
/**
* 所属分类
*/
private Long catalogId;
/**
* 快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整
*/
private Integer showDesc;
private Integer valueType;
private Long attrGroupId;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/AttrVo.java | Java | apache-2.0 | 950 |
package com.kong.meirimall.product.vo;
import lombok.Data;
@Data
public class BrandVo {
private Long brandId;
private String brandName;
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/BrandVo.java | Java | apache-2.0 | 148 |
package com.kong.meirimall.product.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor // 构造器,无参和全参
@AllArgsConstructor
@Data
public class Catalog2Vo {
private String catalog1Id; // 1级父分类id
private List<Catalog3Vo> catalog3List; //三级子分类
private String id;
private String name;
@NoArgsConstructor
@AllArgsConstructor
@Data
public static class Catalog3Vo{
private String catalog2Id;
private String id;
private String name;
}
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/vo/Catalog2Vo.java | Java | apache-2.0 | 610 |
package com.kong.meirimall.product.web;
import com.kong.meirimall.product.entity.CategoryEntity;
import com.kong.meirimall.product.service.CategoryService;
import com.kong.meirimall.product.vo.Catalog2Vo;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Controller
public class IndexController {
@Autowired
CategoryService categoryService;
@Autowired
RedissonClient redisson;
@GetMapping({"/","/index.html"})
public String indexPage(Model model){
//查出所有的一级分类
List<CategoryEntity> categoryEntities=categoryService.getLevel1Categorys();
model.addAttribute("categorys",categoryEntities);
return "index";
}
@ResponseBody
@GetMapping("/index/catalog.json") //多层对象用 map 返回
public Map<String,List<Catalog2Vo>> getCatalogJson(){
Map<String,List<Catalog2Vo>> map=categoryService.geCatelogJsonFromDbWithRedisLock();
return map;
}
@ResponseBody
@GetMapping("/hello")
public String hello(){
// 1、获取一把锁,只要锁名一样,就是同一把锁
RLock lock = redisson.getLock("my-lock");
// 2、加锁
//lock.lock();
// 1)阻塞式等待,就算没有解锁代码,也默认 30s 后自动删除
// 2)锁的自动续期,如果业务运行时间超长,自动给锁续上新的 30s(看门狗 在 30/3==10 秒后)
lock.lock(10, TimeUnit.SECONDS); // 手动设置 10s 后自动解锁(注意 一定要 大于 业务时间,因为 有参数后不会自动续期)
try {
// 3、执行业务
System.out.println("加锁成功,执行业务"+Thread.currentThread().getId());
Thread.sleep(30000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
// 4、解锁 假设停电了,解锁代码没有运行
System.out.println("释放锁"+Thread.currentThread().getId());
lock.unlock();
}
return "hello";
}
}
| 2401_83448718/meirimall | meirimall-product/src/main/java/com/kong/meirimall/product/web/IndexController.java | Java | apache-2.0 | 2,456 |
<template>
<el-dialog
:title="!dataForm.attrId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="属性名" prop="attrName">
<el-input v-model="dataForm.attrName" placeholder="属性名"></el-input>
</el-form-item>
<el-form-item label="是否需要检索[0-不需要,1-需要]" prop="searchType">
<el-input v-model="dataForm.searchType" placeholder="是否需要检索[0-不需要,1-需要]"></el-input>
</el-form-item>
<el-form-item label="属性图标" prop="icon">
<el-input v-model="dataForm.icon" placeholder="属性图标"></el-input>
</el-form-item>
<el-form-item label="可选值列表[用逗号分隔]" prop="valueSelect">
<el-input v-model="dataForm.valueSelect" placeholder="可选值列表[用逗号分隔]"></el-input>
</el-form-item>
<el-form-item label="属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]" prop="attrType">
<el-input v-model="dataForm.attrType" placeholder="属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]"></el-input>
</el-form-item>
<el-form-item label="启用状态[0 - 禁用,1 - 启用]" prop="enable">
<el-input v-model="dataForm.enable" placeholder="启用状态[0 - 禁用,1 - 启用]"></el-input>
</el-form-item>
<el-form-item label="所属分类" prop="catalogId">
<el-input v-model="dataForm.catalogId" placeholder="所属分类"></el-input>
</el-form-item>
<el-form-item label="快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整" prop="showDesc">
<el-input v-model="dataForm.showDesc" placeholder="快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
attrId: 0,
attrName: '',
searchType: '',
icon: '',
valueSelect: '',
attrType: '',
enable: '',
catalogId: '',
showDesc: ''
},
dataRule: {
attrName: [
{ required: true, message: '属性名不能为空', trigger: 'blur' }
],
searchType: [
{ required: true, message: '是否需要检索[0-不需要,1-需要]不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '属性图标不能为空', trigger: 'blur' }
],
valueSelect: [
{ required: true, message: '可选值列表[用逗号分隔]不能为空', trigger: 'blur' }
],
attrType: [
{ required: true, message: '属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]不能为空', trigger: 'blur' }
],
enable: [
{ required: true, message: '启用状态[0 - 禁用,1 - 启用]不能为空', trigger: 'blur' }
],
catalogId: [
{ required: true, message: '所属分类不能为空', trigger: 'blur' }
],
showDesc: [
{ required: true, message: '快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.attrId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.attrId) {
this.$http({
url: this.$http.adornUrl(`/product/attr/info/${this.dataForm.attrId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.attrName = data.attr.attrName
this.dataForm.searchType = data.attr.searchType
this.dataForm.icon = data.attr.icon
this.dataForm.valueSelect = data.attr.valueSelect
this.dataForm.attrType = data.attr.attrType
this.dataForm.enable = data.attr.enable
this.dataForm.catalogId = data.attr.catalogId
this.dataForm.showDesc = data.attr.showDesc
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/attr/${!this.dataForm.attrId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'attrId': this.dataForm.attrId || undefined,
'attrName': this.dataForm.attrName,
'searchType': this.dataForm.searchType,
'icon': this.dataForm.icon,
'valueSelect': this.dataForm.valueSelect,
'attrType': this.dataForm.attrType,
'enable': this.dataForm.enable,
'catalogId': this.dataForm.catalogId,
'showDesc': this.dataForm.showDesc
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attr-add-or-update.vue | Vue | apache-2.0 | 6,143 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:attr:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:attr:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="attrId"
header-align="center"
align="center"
label="属性id">
</el-table-column>
<el-table-column
prop="attrName"
header-align="center"
align="center"
label="属性名">
</el-table-column>
<el-table-column
prop="searchType"
header-align="center"
align="center"
label="是否需要检索[0-不需要,1-需要]">
</el-table-column>
<el-table-column
prop="icon"
header-align="center"
align="center"
label="属性图标">
</el-table-column>
<el-table-column
prop="valueSelect"
header-align="center"
align="center"
label="可选值列表[用逗号分隔]">
</el-table-column>
<el-table-column
prop="attrType"
header-align="center"
align="center"
label="属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]">
</el-table-column>
<el-table-column
prop="enable"
header-align="center"
align="center"
label="启用状态[0 - 禁用,1 - 启用]">
</el-table-column>
<el-table-column
prop="catalogId"
header-align="center"
align="center"
label="所属分类">
</el-table-column>
<el-table-column
prop="showDesc"
header-align="center"
align="center"
label="快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.attrId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.attrId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './attr-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/attr/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.attrId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/attr/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attr.vue | Vue | apache-2.0 | 6,178 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="属性id" prop="attrId">
<el-input v-model="dataForm.attrId" placeholder="属性id"></el-input>
</el-form-item>
<el-form-item label="属性分组id" prop="attrGroupId">
<el-input v-model="dataForm.attrGroupId" placeholder="属性分组id"></el-input>
</el-form-item>
<el-form-item label="属性组内排序" prop="attrSort">
<el-input v-model="dataForm.attrSort" placeholder="属性组内排序"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
attrId: '',
attrGroupId: '',
attrSort: ''
},
dataRule: {
attrId: [
{ required: true, message: '属性id不能为空', trigger: 'blur' }
],
attrGroupId: [
{ required: true, message: '属性分组id不能为空', trigger: 'blur' }
],
attrSort: [
{ required: true, message: '属性组内排序不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/attrattrgrouprelation/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.attrId = data.attrAttrgroupRelation.attrId
this.dataForm.attrGroupId = data.attrAttrgroupRelation.attrGroupId
this.dataForm.attrSort = data.attrAttrgroupRelation.attrSort
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/attrattrgrouprelation/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'attrId': this.dataForm.attrId,
'attrGroupId': this.dataForm.attrGroupId,
'attrSort': this.dataForm.attrSort
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attrattrgrouprelation-add-or-update.vue | Vue | apache-2.0 | 3,481 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:attrattrgrouprelation:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:attrattrgrouprelation:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="attrId"
header-align="center"
align="center"
label="属性id">
</el-table-column>
<el-table-column
prop="attrGroupId"
header-align="center"
align="center"
label="属性分组id">
</el-table-column>
<el-table-column
prop="attrSort"
header-align="center"
align="center"
label="属性组内排序">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './attrattrgrouprelation-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/attrattrgrouprelation/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/attrattrgrouprelation/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attrattrgrouprelation.vue | Vue | apache-2.0 | 5,251 |
<template>
<el-dialog
:title="!dataForm.attrGroupId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="组名" prop="attrGroupName">
<el-input v-model="dataForm.attrGroupName" placeholder="组名"></el-input>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
<el-form-item label="描述" prop="descript">
<el-input v-model="dataForm.descript" placeholder="描述"></el-input>
</el-form-item>
<el-form-item label="组图标" prop="icon">
<el-input v-model="dataForm.icon" placeholder="组图标"></el-input>
</el-form-item>
<el-form-item label="所属分类id" prop="catalogId">
<el-input v-model="dataForm.catalogId" placeholder="所属分类id"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
attrGroupId: 0,
attrGroupName: '',
sort: '',
descript: '',
icon: '',
catalogId: ''
},
dataRule: {
attrGroupName: [
{ required: true, message: '组名不能为空', trigger: 'blur' }
],
sort: [
{ required: true, message: '排序不能为空', trigger: 'blur' }
],
descript: [
{ required: true, message: '描述不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '组图标不能为空', trigger: 'blur' }
],
catalogId: [
{ required: true, message: '所属分类id不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.attrGroupId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.attrGroupId) {
this.$http({
url: this.$http.adornUrl(`/product/attrgroup/info/${this.dataForm.attrGroupId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.attrGroupName = data.attrGroup.attrGroupName
this.dataForm.sort = data.attrGroup.sort
this.dataForm.descript = data.attrGroup.descript
this.dataForm.icon = data.attrGroup.icon
this.dataForm.catalogId = data.attrGroup.catalogId
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/attrgroup/${!this.dataForm.attrGroupId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'attrGroupId': this.dataForm.attrGroupId || undefined,
'attrGroupName': this.dataForm.attrGroupName,
'sort': this.dataForm.sort,
'descript': this.dataForm.descript,
'icon': this.dataForm.icon,
'catalogId': this.dataForm.catalogId
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attrgroup-add-or-update.vue | Vue | apache-2.0 | 4,240 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:attrgroup:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:attrgroup:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="attrGroupId"
header-align="center"
align="center"
label="分组id">
</el-table-column>
<el-table-column
prop="attrGroupName"
header-align="center"
align="center"
label="组名">
</el-table-column>
<el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="descript"
header-align="center"
align="center"
label="描述">
</el-table-column>
<el-table-column
prop="icon"
header-align="center"
align="center"
label="组图标">
</el-table-column>
<el-table-column
prop="catalogId"
header-align="center"
align="center"
label="所属分类id">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.attrGroupId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.attrGroupId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './attrgroup-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/attrgroup/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.attrGroupId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/attrgroup/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/attrgroup.vue | Vue | apache-2.0 | 5,517 |
<template>
<el-dialog
:title="!dataForm.brandId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="品牌名" prop="name">
<el-input v-model="dataForm.name" placeholder="品牌名"></el-input>
</el-form-item>
<el-form-item label="品牌logo地址" prop="logo">
<el-input v-model="dataForm.logo" placeholder="品牌logo地址"></el-input>
</el-form-item>
<el-form-item label="介绍" prop="descript">
<el-input v-model="dataForm.descript" placeholder="介绍"></el-input>
</el-form-item>
<el-form-item label="显示状态[0-不显示;1-显示]" prop="showStatus">
<el-input v-model="dataForm.showStatus" placeholder="显示状态[0-不显示;1-显示]"></el-input>
</el-form-item>
<el-form-item label="检索首字母" prop="firstLetter">
<el-input v-model="dataForm.firstLetter" placeholder="检索首字母"></el-input>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
brandId: 0,
name: '',
logo: '',
descript: '',
showStatus: '',
firstLetter: '',
sort: ''
},
dataRule: {
name: [
{ required: true, message: '品牌名不能为空', trigger: 'blur' }
],
logo: [
{ required: true, message: '品牌logo地址不能为空', trigger: 'blur' }
],
descript: [
{ required: true, message: '介绍不能为空', trigger: 'blur' }
],
showStatus: [
{ required: true, message: '显示状态[0-不显示;1-显示]不能为空', trigger: 'blur' }
],
firstLetter: [
{ required: true, message: '检索首字母不能为空', trigger: 'blur' }
],
sort: [
{ required: true, message: '排序不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.brandId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.brandId) {
this.$http({
url: this.$http.adornUrl(`/product/brand/info/${this.dataForm.brandId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.name = data.brand.name
this.dataForm.logo = data.brand.logo
this.dataForm.descript = data.brand.descript
this.dataForm.showStatus = data.brand.showStatus
this.dataForm.firstLetter = data.brand.firstLetter
this.dataForm.sort = data.brand.sort
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/brand/${!this.dataForm.brandId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'brandId': this.dataForm.brandId || undefined,
'name': this.dataForm.name,
'logo': this.dataForm.logo,
'descript': this.dataForm.descript,
'showStatus': this.dataForm.showStatus,
'firstLetter': this.dataForm.firstLetter,
'sort': this.dataForm.sort
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/brand-add-or-update.vue | Vue | apache-2.0 | 4,661 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:brand:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:brand:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="brandId"
header-align="center"
align="center"
label="品牌id">
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
label="品牌名">
</el-table-column>
<el-table-column
prop="logo"
header-align="center"
align="center"
label="品牌logo地址">
</el-table-column>
<el-table-column
prop="descript"
header-align="center"
align="center"
label="介绍">
</el-table-column>
<el-table-column
prop="showStatus"
header-align="center"
align="center"
label="显示状态[0-不显示;1-显示]">
</el-table-column>
<el-table-column
prop="firstLetter"
header-align="center"
align="center"
label="检索首字母">
</el-table-column>
<el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.brandId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.brandId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './brand-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/brand/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.brandId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/brand/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/brand.vue | Vue | apache-2.0 | 5,666 |
<template>
<el-dialog
:title="!dataForm.catId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="分类名称" prop="name">
<el-input v-model="dataForm.name" placeholder="分类名称"></el-input>
</el-form-item>
<el-form-item label="父分类id" prop="parentCid">
<el-input v-model="dataForm.parentCid" placeholder="父分类id"></el-input>
</el-form-item>
<el-form-item label="层级" prop="catLevel">
<el-input v-model="dataForm.catLevel" placeholder="层级"></el-input>
</el-form-item>
<el-form-item label="是否显示[0-不显示,1显示]" prop="showStatus">
<el-input v-model="dataForm.showStatus" placeholder="是否显示[0-不显示,1显示]"></el-input>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
<el-form-item label="图标地址" prop="icon">
<el-input v-model="dataForm.icon" placeholder="图标地址"></el-input>
</el-form-item>
<el-form-item label="计量单位" prop="productUnit">
<el-input v-model="dataForm.productUnit" placeholder="计量单位"></el-input>
</el-form-item>
<el-form-item label="商品数量" prop="productCount">
<el-input v-model="dataForm.productCount" placeholder="商品数量"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
catId: 0,
name: '',
parentCid: '',
catLevel: '',
showStatus: '',
sort: '',
icon: '',
productUnit: '',
productCount: ''
},
dataRule: {
name: [
{ required: true, message: '分类名称不能为空', trigger: 'blur' }
],
parentCid: [
{ required: true, message: '父分类id不能为空', trigger: 'blur' }
],
catLevel: [
{ required: true, message: '层级不能为空', trigger: 'blur' }
],
showStatus: [
{ required: true, message: '是否显示[0-不显示,1显示]不能为空', trigger: 'blur' }
],
sort: [
{ required: true, message: '排序不能为空', trigger: 'blur' }
],
icon: [
{ required: true, message: '图标地址不能为空', trigger: 'blur' }
],
productUnit: [
{ required: true, message: '计量单位不能为空', trigger: 'blur' }
],
productCount: [
{ required: true, message: '商品数量不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.catId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.catId) {
this.$http({
url: this.$http.adornUrl(`/product/category/info/${this.dataForm.catId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.name = data.category.name
this.dataForm.parentCid = data.category.parentCid
this.dataForm.catLevel = data.category.catLevel
this.dataForm.showStatus = data.category.showStatus
this.dataForm.sort = data.category.sort
this.dataForm.icon = data.category.icon
this.dataForm.productUnit = data.category.productUnit
this.dataForm.productCount = data.category.productCount
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/category/${!this.dataForm.catId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'catId': this.dataForm.catId || undefined,
'name': this.dataForm.name,
'parentCid': this.dataForm.parentCid,
'catLevel': this.dataForm.catLevel,
'showStatus': this.dataForm.showStatus,
'sort': this.dataForm.sort,
'icon': this.dataForm.icon,
'productUnit': this.dataForm.productUnit,
'productCount': this.dataForm.productCount
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/category-add-or-update.vue | Vue | apache-2.0 | 5,529 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:category:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:category:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="catId"
header-align="center"
align="center"
label="分类id">
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
label="分类名称">
</el-table-column>
<el-table-column
prop="parentCid"
header-align="center"
align="center"
label="父分类id">
</el-table-column>
<el-table-column
prop="catLevel"
header-align="center"
align="center"
label="层级">
</el-table-column>
<el-table-column
prop="showStatus"
header-align="center"
align="center"
label="是否显示[0-不显示,1显示]">
</el-table-column>
<el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="icon"
header-align="center"
align="center"
label="图标地址">
</el-table-column>
<el-table-column
prop="productUnit"
header-align="center"
align="center"
label="计量单位">
</el-table-column>
<el-table-column
prop="productCount"
header-align="center"
align="center"
label="商品数量">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.catId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.catId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './category-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/category/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.catId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/category/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/category.vue | Vue | apache-2.0 | 5,982 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="品牌id" prop="brandId">
<el-input v-model="dataForm.brandId" placeholder="品牌id"></el-input>
</el-form-item>
<el-form-item label="分类id" prop="catalogId">
<el-input v-model="dataForm.catalogId" placeholder="分类id"></el-input>
</el-form-item>
<el-form-item label="" prop="brandName">
<el-input v-model="dataForm.brandName" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="catelogName">
<el-input v-model="dataForm.catelogName" placeholder=""></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
brandId: '',
catalogId: '',
brandName: '',
catelogName: ''
},
dataRule: {
brandId: [
{ required: true, message: '品牌id不能为空', trigger: 'blur' }
],
catalogId: [
{ required: true, message: '分类id不能为空', trigger: 'blur' }
],
brandName: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
catelogName: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/categorybrandrelation/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.brandId = data.categoryBrandRelation.brandId
this.dataForm.catalogId = data.categoryBrandRelation.catalogId
this.dataForm.brandName = data.categoryBrandRelation.brandName
this.dataForm.catelogName = data.categoryBrandRelation.catelogName
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/categorybrandrelation/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'brandId': this.dataForm.brandId,
'catalogId': this.dataForm.catalogId,
'brandName': this.dataForm.brandName,
'catelogName': this.dataForm.catelogName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/categorybrandrelation-add-or-update.vue | Vue | apache-2.0 | 3,829 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:categorybrandrelation:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:categorybrandrelation:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="brandId"
header-align="center"
align="center"
label="品牌id">
</el-table-column>
<el-table-column
prop="catalogId"
header-align="center"
align="center"
label="分类id">
</el-table-column>
<el-table-column
prop="brandName"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="catelogName"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './categorybrandrelation-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/categorybrandrelation/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/categorybrandrelation/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/categorybrandrelation.vue | Vue | apache-2.0 | 5,371 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="评论id" prop="commentId">
<el-input v-model="dataForm.commentId" placeholder="评论id"></el-input>
</el-form-item>
<el-form-item label="回复id" prop="replyId">
<el-input v-model="dataForm.replyId" placeholder="回复id"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
commentId: '',
replyId: ''
},
dataRule: {
commentId: [
{ required: true, message: '评论id不能为空', trigger: 'blur' }
],
replyId: [
{ required: true, message: '回复id不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/commentreplay/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.commentId = data.commentReplay.commentId
this.dataForm.replyId = data.commentReplay.replyId
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/commentreplay/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'commentId': this.dataForm.commentId,
'replyId': this.dataForm.replyId
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/commentreplay-add-or-update.vue | Vue | apache-2.0 | 2,973 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:commentreplay:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:commentreplay:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="commentId"
header-align="center"
align="center"
label="评论id">
</el-table-column>
<el-table-column
prop="replyId"
header-align="center"
align="center"
label="回复id">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './commentreplay-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/commentreplay/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/commentreplay/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/commentreplay.vue | Vue | apache-2.0 | 5,043 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="商品id" prop="spuId">
<el-input v-model="dataForm.spuId" placeholder="商品id"></el-input>
</el-form-item>
<el-form-item label="属性id" prop="attrId">
<el-input v-model="dataForm.attrId" placeholder="属性id"></el-input>
</el-form-item>
<el-form-item label="属性名" prop="attrName">
<el-input v-model="dataForm.attrName" placeholder="属性名"></el-input>
</el-form-item>
<el-form-item label="属性值" prop="attrValue">
<el-input v-model="dataForm.attrValue" placeholder="属性值"></el-input>
</el-form-item>
<el-form-item label="顺序" prop="attrSort">
<el-input v-model="dataForm.attrSort" placeholder="顺序"></el-input>
</el-form-item>
<el-form-item label="快速展示【是否展示在介绍上;0-否 1-是】" prop="quickShow">
<el-input v-model="dataForm.quickShow" placeholder="快速展示【是否展示在介绍上;0-否 1-是】"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
spuId: '',
attrId: '',
attrName: '',
attrValue: '',
attrSort: '',
quickShow: ''
},
dataRule: {
spuId: [
{ required: true, message: '商品id不能为空', trigger: 'blur' }
],
attrId: [
{ required: true, message: '属性id不能为空', trigger: 'blur' }
],
attrName: [
{ required: true, message: '属性名不能为空', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '属性值不能为空', trigger: 'blur' }
],
attrSort: [
{ required: true, message: '顺序不能为空', trigger: 'blur' }
],
quickShow: [
{ required: true, message: '快速展示【是否展示在介绍上;0-否 1-是】不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/productattrvalue/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.spuId = data.productAttrValue.spuId
this.dataForm.attrId = data.productAttrValue.attrId
this.dataForm.attrName = data.productAttrValue.attrName
this.dataForm.attrValue = data.productAttrValue.attrValue
this.dataForm.attrSort = data.productAttrValue.attrSort
this.dataForm.quickShow = data.productAttrValue.quickShow
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/productattrvalue/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'spuId': this.dataForm.spuId,
'attrId': this.dataForm.attrId,
'attrName': this.dataForm.attrName,
'attrValue': this.dataForm.attrValue,
'attrSort': this.dataForm.attrSort,
'quickShow': this.dataForm.quickShow
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/productattrvalue-add-or-update.vue | Vue | apache-2.0 | 4,765 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:productattrvalue:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:productattrvalue:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="spuId"
header-align="center"
align="center"
label="商品id">
</el-table-column>
<el-table-column
prop="attrId"
header-align="center"
align="center"
label="属性id">
</el-table-column>
<el-table-column
prop="attrName"
header-align="center"
align="center"
label="属性名">
</el-table-column>
<el-table-column
prop="attrValue"
header-align="center"
align="center"
label="属性值">
</el-table-column>
<el-table-column
prop="attrSort"
header-align="center"
align="center"
label="顺序">
</el-table-column>
<el-table-column
prop="quickShow"
header-align="center"
align="center"
label="快速展示【是否展示在介绍上;0-否 1-是】">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './productattrvalue-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/productattrvalue/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/productattrvalue/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/productattrvalue.vue | Vue | apache-2.0 | 5,707 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="图片地址" prop="imgUrl">
<el-input v-model="dataForm.imgUrl" placeholder="图片地址"></el-input>
</el-form-item>
<el-form-item label="排序" prop="imgSort">
<el-input v-model="dataForm.imgSort" placeholder="排序"></el-input>
</el-form-item>
<el-form-item label="默认图[0 - 不是默认图,1 - 是默认图]" prop="defaultImg">
<el-input v-model="dataForm.defaultImg" placeholder="默认图[0 - 不是默认图,1 - 是默认图]"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
skuId: '',
imgUrl: '',
imgSort: '',
defaultImg: ''
},
dataRule: {
skuId: [
{ required: true, message: 'sku_id不能为空', trigger: 'blur' }
],
imgUrl: [
{ required: true, message: '图片地址不能为空', trigger: 'blur' }
],
imgSort: [
{ required: true, message: '排序不能为空', trigger: 'blur' }
],
defaultImg: [
{ required: true, message: '默认图[0 - 不是默认图,1 - 是默认图]不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/skuimages/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.skuImages.skuId
this.dataForm.imgUrl = data.skuImages.imgUrl
this.dataForm.imgSort = data.skuImages.imgSort
this.dataForm.defaultImg = data.skuImages.defaultImg
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/skuimages/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'skuId': this.dataForm.skuId,
'imgUrl': this.dataForm.imgUrl,
'imgSort': this.dataForm.imgSort,
'defaultImg': this.dataForm.defaultImg
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skuimages-add-or-update.vue | Vue | apache-2.0 | 3,864 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:skuimages:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:skuimages:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="skuId"
header-align="center"
align="center"
label="sku_id">
</el-table-column>
<el-table-column
prop="imgUrl"
header-align="center"
align="center"
label="图片地址">
</el-table-column>
<el-table-column
prop="imgSort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="defaultImg"
header-align="center"
align="center"
label="默认图[0 - 不是默认图,1 - 是默认图]">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './skuimages-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/skuimages/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/skuimages/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skuimages.vue | Vue | apache-2.0 | 5,362 |
<template>
<el-dialog
:title="!dataForm.skuId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="spuId" prop="spuId">
<el-input v-model="dataForm.spuId" placeholder="spuId"></el-input>
</el-form-item>
<el-form-item label="sku名称" prop="skuName">
<el-input v-model="dataForm.skuName" placeholder="sku名称"></el-input>
</el-form-item>
<el-form-item label="sku介绍描述" prop="skuDesc">
<el-input v-model="dataForm.skuDesc" placeholder="sku介绍描述"></el-input>
</el-form-item>
<el-form-item label="所属分类id" prop="catalogId">
<el-input v-model="dataForm.catalogId" placeholder="所属分类id"></el-input>
</el-form-item>
<el-form-item label="品牌id" prop="brandId">
<el-input v-model="dataForm.brandId" placeholder="品牌id"></el-input>
</el-form-item>
<el-form-item label="默认图片" prop="skuDefaultImg">
<el-input v-model="dataForm.skuDefaultImg" placeholder="默认图片"></el-input>
</el-form-item>
<el-form-item label="标题" prop="skuTitle">
<el-input v-model="dataForm.skuTitle" placeholder="标题"></el-input>
</el-form-item>
<el-form-item label="副标题" prop="skuSubtitle">
<el-input v-model="dataForm.skuSubtitle" placeholder="副标题"></el-input>
</el-form-item>
<el-form-item label="价格" prop="price">
<el-input v-model="dataForm.price" placeholder="价格"></el-input>
</el-form-item>
<el-form-item label="销量" prop="saleCount">
<el-input v-model="dataForm.saleCount" placeholder="销量"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
skuId: 0,
spuId: '',
skuName: '',
skuDesc: '',
catalogId: '',
brandId: '',
skuDefaultImg: '',
skuTitle: '',
skuSubtitle: '',
price: '',
saleCount: ''
},
dataRule: {
spuId: [
{ required: true, message: 'spuId不能为空', trigger: 'blur' }
],
skuName: [
{ required: true, message: 'sku名称不能为空', trigger: 'blur' }
],
skuDesc: [
{ required: true, message: 'sku介绍描述不能为空', trigger: 'blur' }
],
catalogId: [
{ required: true, message: '所属分类id不能为空', trigger: 'blur' }
],
brandId: [
{ required: true, message: '品牌id不能为空', trigger: 'blur' }
],
skuDefaultImg: [
{ required: true, message: '默认图片不能为空', trigger: 'blur' }
],
skuTitle: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
],
skuSubtitle: [
{ required: true, message: '副标题不能为空', trigger: 'blur' }
],
price: [
{ required: true, message: '价格不能为空', trigger: 'blur' }
],
saleCount: [
{ required: true, message: '销量不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.skuId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.skuId) {
this.$http({
url: this.$http.adornUrl(`/product/skuinfo/info/${this.dataForm.skuId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.spuId = data.skuInfo.spuId
this.dataForm.skuName = data.skuInfo.skuName
this.dataForm.skuDesc = data.skuInfo.skuDesc
this.dataForm.catalogId = data.skuInfo.catalogId
this.dataForm.brandId = data.skuInfo.brandId
this.dataForm.skuDefaultImg = data.skuInfo.skuDefaultImg
this.dataForm.skuTitle = data.skuInfo.skuTitle
this.dataForm.skuSubtitle = data.skuInfo.skuSubtitle
this.dataForm.price = data.skuInfo.price
this.dataForm.saleCount = data.skuInfo.saleCount
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/skuinfo/${!this.dataForm.skuId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'skuId': this.dataForm.skuId || undefined,
'spuId': this.dataForm.spuId,
'skuName': this.dataForm.skuName,
'skuDesc': this.dataForm.skuDesc,
'catalogId': this.dataForm.catalogId,
'brandId': this.dataForm.brandId,
'skuDefaultImg': this.dataForm.skuDefaultImg,
'skuTitle': this.dataForm.skuTitle,
'skuSubtitle': this.dataForm.skuSubtitle,
'price': this.dataForm.price,
'saleCount': this.dataForm.saleCount
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skuinfo-add-or-update.vue | Vue | apache-2.0 | 6,259 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:skuinfo:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:skuinfo:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="skuId"
header-align="center"
align="center"
label="skuId">
</el-table-column>
<el-table-column
prop="spuId"
header-align="center"
align="center"
label="spuId">
</el-table-column>
<el-table-column
prop="skuName"
header-align="center"
align="center"
label="sku名称">
</el-table-column>
<el-table-column
prop="skuDesc"
header-align="center"
align="center"
label="sku介绍描述">
</el-table-column>
<el-table-column
prop="catalogId"
header-align="center"
align="center"
label="所属分类id">
</el-table-column>
<el-table-column
prop="brandId"
header-align="center"
align="center"
label="品牌id">
</el-table-column>
<el-table-column
prop="skuDefaultImg"
header-align="center"
align="center"
label="默认图片">
</el-table-column>
<el-table-column
prop="skuTitle"
header-align="center"
align="center"
label="标题">
</el-table-column>
<el-table-column
prop="skuSubtitle"
header-align="center"
align="center"
label="副标题">
</el-table-column>
<el-table-column
prop="price"
header-align="center"
align="center"
label="价格">
</el-table-column>
<el-table-column
prop="saleCount"
header-align="center"
align="center"
label="销量">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.skuId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.skuId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './skuinfo-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/skuinfo/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.skuId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/skuinfo/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skuinfo.vue | Vue | apache-2.0 | 6,247 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="attr_id" prop="attrId">
<el-input v-model="dataForm.attrId" placeholder="attr_id"></el-input>
</el-form-item>
<el-form-item label="销售属性名" prop="attrName">
<el-input v-model="dataForm.attrName" placeholder="销售属性名"></el-input>
</el-form-item>
<el-form-item label="销售属性值" prop="attrValue">
<el-input v-model="dataForm.attrValue" placeholder="销售属性值"></el-input>
</el-form-item>
<el-form-item label="顺序" prop="attrSort">
<el-input v-model="dataForm.attrSort" placeholder="顺序"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
skuId: '',
attrId: '',
attrName: '',
attrValue: '',
attrSort: ''
},
dataRule: {
skuId: [
{ required: true, message: 'sku_id不能为空', trigger: 'blur' }
],
attrId: [
{ required: true, message: 'attr_id不能为空', trigger: 'blur' }
],
attrName: [
{ required: true, message: '销售属性名不能为空', trigger: 'blur' }
],
attrValue: [
{ required: true, message: '销售属性值不能为空', trigger: 'blur' }
],
attrSort: [
{ required: true, message: '顺序不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/skusaleattrvalue/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.skuSaleAttrValue.skuId
this.dataForm.attrId = data.skuSaleAttrValue.attrId
this.dataForm.attrName = data.skuSaleAttrValue.attrName
this.dataForm.attrValue = data.skuSaleAttrValue.attrValue
this.dataForm.attrSort = data.skuSaleAttrValue.attrSort
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/skusaleattrvalue/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'skuId': this.dataForm.skuId,
'attrId': this.dataForm.attrId,
'attrName': this.dataForm.attrName,
'attrValue': this.dataForm.attrValue,
'attrSort': this.dataForm.attrSort
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skusaleattrvalue-add-or-update.vue | Vue | apache-2.0 | 4,225 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:skusaleattrvalue:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:skusaleattrvalue:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="skuId"
header-align="center"
align="center"
label="sku_id">
</el-table-column>
<el-table-column
prop="attrId"
header-align="center"
align="center"
label="attr_id">
</el-table-column>
<el-table-column
prop="attrName"
header-align="center"
align="center"
label="销售属性名">
</el-table-column>
<el-table-column
prop="attrValue"
header-align="center"
align="center"
label="销售属性值">
</el-table-column>
<el-table-column
prop="attrSort"
header-align="center"
align="center"
label="顺序">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './skusaleattrvalue-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/skusaleattrvalue/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/skusaleattrvalue/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/skusaleattrvalue.vue | Vue | apache-2.0 | 5,516 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="spu_id" prop="spuId">
<el-input v-model="dataForm.spuId" placeholder="spu_id"></el-input>
</el-form-item>
<el-form-item label="商品名字" prop="spuName">
<el-input v-model="dataForm.spuName" placeholder="商品名字"></el-input>
</el-form-item>
<el-form-item label="会员昵称" prop="memberNickName">
<el-input v-model="dataForm.memberNickName" placeholder="会员昵称"></el-input>
</el-form-item>
<el-form-item label="星级" prop="star">
<el-input v-model="dataForm.star" placeholder="星级"></el-input>
</el-form-item>
<el-form-item label="会员ip" prop="memberIp">
<el-input v-model="dataForm.memberIp" placeholder="会员ip"></el-input>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item>
<el-form-item label="显示状态[0-不显示,1-显示]" prop="showStatus">
<el-input v-model="dataForm.showStatus" placeholder="显示状态[0-不显示,1-显示]"></el-input>
</el-form-item>
<el-form-item label="购买时属性组合" prop="spuAttributes">
<el-input v-model="dataForm.spuAttributes" placeholder="购买时属性组合"></el-input>
</el-form-item>
<el-form-item label="点赞数" prop="likesCount">
<el-input v-model="dataForm.likesCount" placeholder="点赞数"></el-input>
</el-form-item>
<el-form-item label="回复数" prop="replyCount">
<el-input v-model="dataForm.replyCount" placeholder="回复数"></el-input>
</el-form-item>
<el-form-item label="评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]" prop="resources">
<el-input v-model="dataForm.resources" placeholder="评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input v-model="dataForm.content" placeholder="内容"></el-input>
</el-form-item>
<el-form-item label="用户头像" prop="memberIcon">
<el-input v-model="dataForm.memberIcon" placeholder="用户头像"></el-input>
</el-form-item>
<el-form-item label="评论类型[0 - 对商品的直接评论,1 - 对评论的回复]" prop="commentType">
<el-input v-model="dataForm.commentType" placeholder="评论类型[0 - 对商品的直接评论,1 - 对评论的回复]"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
skuId: '',
spuId: '',
spuName: '',
memberNickName: '',
star: '',
memberIp: '',
createTime: '',
showStatus: '',
spuAttributes: '',
likesCount: '',
replyCount: '',
resources: '',
content: '',
memberIcon: '',
commentType: ''
},
dataRule: {
skuId: [
{ required: true, message: 'sku_id不能为空', trigger: 'blur' }
],
spuId: [
{ required: true, message: 'spu_id不能为空', trigger: 'blur' }
],
spuName: [
{ required: true, message: '商品名字不能为空', trigger: 'blur' }
],
memberNickName: [
{ required: true, message: '会员昵称不能为空', trigger: 'blur' }
],
star: [
{ required: true, message: '星级不能为空', trigger: 'blur' }
],
memberIp: [
{ required: true, message: '会员ip不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
showStatus: [
{ required: true, message: '显示状态[0-不显示,1-显示]不能为空', trigger: 'blur' }
],
spuAttributes: [
{ required: true, message: '购买时属性组合不能为空', trigger: 'blur' }
],
likesCount: [
{ required: true, message: '点赞数不能为空', trigger: 'blur' }
],
replyCount: [
{ required: true, message: '回复数不能为空', trigger: 'blur' }
],
resources: [
{ required: true, message: '评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]不能为空', trigger: 'blur' }
],
content: [
{ required: true, message: '内容不能为空', trigger: 'blur' }
],
memberIcon: [
{ required: true, message: '用户头像不能为空', trigger: 'blur' }
],
commentType: [
{ required: true, message: '评论类型[0 - 对商品的直接评论,1 - 对评论的回复]不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/spucomment/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.spuComment.skuId
this.dataForm.spuId = data.spuComment.spuId
this.dataForm.spuName = data.spuComment.spuName
this.dataForm.memberNickName = data.spuComment.memberNickName
this.dataForm.star = data.spuComment.star
this.dataForm.memberIp = data.spuComment.memberIp
this.dataForm.createTime = data.spuComment.createTime
this.dataForm.showStatus = data.spuComment.showStatus
this.dataForm.spuAttributes = data.spuComment.spuAttributes
this.dataForm.likesCount = data.spuComment.likesCount
this.dataForm.replyCount = data.spuComment.replyCount
this.dataForm.resources = data.spuComment.resources
this.dataForm.content = data.spuComment.content
this.dataForm.memberIcon = data.spuComment.memberIcon
this.dataForm.commentType = data.spuComment.commentType
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/spucomment/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'skuId': this.dataForm.skuId,
'spuId': this.dataForm.spuId,
'spuName': this.dataForm.spuName,
'memberNickName': this.dataForm.memberNickName,
'star': this.dataForm.star,
'memberIp': this.dataForm.memberIp,
'createTime': this.dataForm.createTime,
'showStatus': this.dataForm.showStatus,
'spuAttributes': this.dataForm.spuAttributes,
'likesCount': this.dataForm.likesCount,
'replyCount': this.dataForm.replyCount,
'resources': this.dataForm.resources,
'content': this.dataForm.content,
'memberIcon': this.dataForm.memberIcon,
'commentType': this.dataForm.commentType
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spucomment-add-or-update.vue | Vue | apache-2.0 | 8,904 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:spucomment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:spucomment:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="skuId"
header-align="center"
align="center"
label="sku_id">
</el-table-column>
<el-table-column
prop="spuId"
header-align="center"
align="center"
label="spu_id">
</el-table-column>
<el-table-column
prop="spuName"
header-align="center"
align="center"
label="商品名字">
</el-table-column>
<el-table-column
prop="memberNickName"
header-align="center"
align="center"
label="会员昵称">
</el-table-column>
<el-table-column
prop="star"
header-align="center"
align="center"
label="星级">
</el-table-column>
<el-table-column
prop="memberIp"
header-align="center"
align="center"
label="会员ip">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="showStatus"
header-align="center"
align="center"
label="显示状态[0-不显示,1-显示]">
</el-table-column>
<el-table-column
prop="spuAttributes"
header-align="center"
align="center"
label="购买时属性组合">
</el-table-column>
<el-table-column
prop="likesCount"
header-align="center"
align="center"
label="点赞数">
</el-table-column>
<el-table-column
prop="replyCount"
header-align="center"
align="center"
label="回复数">
</el-table-column>
<el-table-column
prop="resources"
header-align="center"
align="center"
label="评论图片/视频[json数据;[{type:文件类型,url:资源路径}]]">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
label="内容">
</el-table-column>
<el-table-column
prop="memberIcon"
header-align="center"
align="center"
label="用户头像">
</el-table-column>
<el-table-column
prop="commentType"
header-align="center"
align="center"
label="评论类型[0 - 对商品的直接评论,1 - 对评论的回复]">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './spucomment-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/spucomment/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/spucomment/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spucomment.vue | Vue | apache-2.0 | 7,178 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="spu_id" prop="spuId">
<el-input v-model="dataForm.spuId" placeholder="spu_id"></el-input>
</el-form-item>
<el-form-item label="图片名" prop="imgName">
<el-input v-model="dataForm.imgName" placeholder="图片名"></el-input>
</el-form-item>
<el-form-item label="图片地址" prop="imgUrl">
<el-input v-model="dataForm.imgUrl" placeholder="图片地址"></el-input>
</el-form-item>
<el-form-item label="顺序" prop="imgSort">
<el-input v-model="dataForm.imgSort" placeholder="顺序"></el-input>
</el-form-item>
<el-form-item label="是否默认图" prop="defaultImg">
<el-input v-model="dataForm.defaultImg" placeholder="是否默认图"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
spuId: '',
imgName: '',
imgUrl: '',
imgSort: '',
defaultImg: ''
},
dataRule: {
spuId: [
{ required: true, message: 'spu_id不能为空', trigger: 'blur' }
],
imgName: [
{ required: true, message: '图片名不能为空', trigger: 'blur' }
],
imgUrl: [
{ required: true, message: '图片地址不能为空', trigger: 'blur' }
],
imgSort: [
{ required: true, message: '顺序不能为空', trigger: 'blur' }
],
defaultImg: [
{ required: true, message: '是否默认图不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/spuimages/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.spuId = data.spuImages.spuId
this.dataForm.imgName = data.spuImages.imgName
this.dataForm.imgUrl = data.spuImages.imgUrl
this.dataForm.imgSort = data.spuImages.imgSort
this.dataForm.defaultImg = data.spuImages.defaultImg
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/spuimages/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'spuId': this.dataForm.spuId,
'imgName': this.dataForm.imgName,
'imgUrl': this.dataForm.imgUrl,
'imgSort': this.dataForm.imgSort,
'defaultImg': this.dataForm.defaultImg
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuimages-add-or-update.vue | Vue | apache-2.0 | 4,165 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:spuimages:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:spuimages:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="spuId"
header-align="center"
align="center"
label="spu_id">
</el-table-column>
<el-table-column
prop="imgName"
header-align="center"
align="center"
label="图片名">
</el-table-column>
<el-table-column
prop="imgUrl"
header-align="center"
align="center"
label="图片地址">
</el-table-column>
<el-table-column
prop="imgSort"
header-align="center"
align="center"
label="顺序">
</el-table-column>
<el-table-column
prop="defaultImg"
header-align="center"
align="center"
label="是否默认图">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './spuimages-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/spuimages/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/spuimages/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuimages.vue | Vue | apache-2.0 | 5,479 |
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="商品名称" prop="spuName">
<el-input v-model="dataForm.spuName" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item label="商品描述" prop="spuDescription">
<el-input v-model="dataForm.spuDescription" placeholder="商品描述"></el-input>
</el-form-item>
<el-form-item label="所属分类id" prop="catalogId">
<el-input v-model="dataForm.catalogId" placeholder="所属分类id"></el-input>
</el-form-item>
<el-form-item label="品牌id" prop="brandId">
<el-input v-model="dataForm.brandId" placeholder="品牌id"></el-input>
</el-form-item>
<el-form-item label="" prop="weight">
<el-input v-model="dataForm.weight" placeholder=""></el-input>
</el-form-item>
<el-form-item label="上架状态[0 - 下架,1 - 上架]" prop="publishStatus">
<el-input v-model="dataForm.publishStatus" placeholder="上架状态[0 - 下架,1 - 上架]"></el-input>
</el-form-item>
<el-form-item label="" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder=""></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
spuName: '',
spuDescription: '',
catalogId: '',
brandId: '',
weight: '',
publishStatus: '',
createTime: '',
updateTime: ''
},
dataRule: {
spuName: [
{ required: true, message: '商品名称不能为空', trigger: 'blur' }
],
spuDescription: [
{ required: true, message: '商品描述不能为空', trigger: 'blur' }
],
catalogId: [
{ required: true, message: '所属分类id不能为空', trigger: 'blur' }
],
brandId: [
{ required: true, message: '品牌id不能为空', trigger: 'blur' }
],
weight: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
publishStatus: [
{ required: true, message: '上架状态[0 - 下架,1 - 上架]不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/product/spuinfo/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.spuName = data.spuInfo.spuName
this.dataForm.spuDescription = data.spuInfo.spuDescription
this.dataForm.catalogId = data.spuInfo.catalogId
this.dataForm.brandId = data.spuInfo.brandId
this.dataForm.weight = data.spuInfo.weight
this.dataForm.publishStatus = data.spuInfo.publishStatus
this.dataForm.createTime = data.spuInfo.createTime
this.dataForm.updateTime = data.spuInfo.updateTime
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/spuinfo/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'spuName': this.dataForm.spuName,
'spuDescription': this.dataForm.spuDescription,
'catalogId': this.dataForm.catalogId,
'brandId': this.dataForm.brandId,
'weight': this.dataForm.weight,
'publishStatus': this.dataForm.publishStatus,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuinfo-add-or-update.vue | Vue | apache-2.0 | 5,538 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:spuinfo:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:spuinfo:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="商品id">
</el-table-column>
<el-table-column
prop="spuName"
header-align="center"
align="center"
label="商品名称">
</el-table-column>
<el-table-column
prop="spuDescription"
header-align="center"
align="center"
label="商品描述">
</el-table-column>
<el-table-column
prop="catalogId"
header-align="center"
align="center"
label="所属分类id">
</el-table-column>
<el-table-column
prop="brandId"
header-align="center"
align="center"
label="品牌id">
</el-table-column>
<el-table-column
prop="weight"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="publishStatus"
header-align="center"
align="center"
label="上架状态[0 - 下架,1 - 上架]">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './spuinfo-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/spuinfo/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/spuinfo/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuinfo.vue | Vue | apache-2.0 | 5,956 |
<template>
<el-dialog
:title="!dataForm.spuId ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="商品介绍" prop="decript">
<el-input v-model="dataForm.decript" placeholder="商品介绍"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
spuId: 0,
decript: ''
},
dataRule: {
decript: [
{ required: true, message: '商品介绍不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.spuId = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.spuId) {
this.$http({
url: this.$http.adornUrl(`/product/spuinfodesc/info/${this.dataForm.spuId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.decript = data.spuInfoDesc.decript
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/product/spuinfodesc/${!this.dataForm.spuId ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'spuId': this.dataForm.spuId || undefined,
'decript': this.dataForm.decript
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuinfodesc-add-or-update.vue | Vue | apache-2.0 | 2,583 |
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('product:spuinfodesc:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('product:spuinfodesc:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="spuId"
header-align="center"
align="center"
label="商品id">
</el-table-column>
<el-table-column
prop="decript"
header-align="center"
align="center"
label="商品介绍">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.spuId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.spuId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './spuinfodesc-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/product/spuinfodesc/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.spuId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/product/spuinfodesc/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/src/views/modules/product/spuinfodesc.vue | Vue | apache-2.0 | 4,903 |
$(function(){
$.getJSON("/index/catalog.json",function (data) {
var ctgall=data;
$(".header_main_left_a").each(function(){
var ctgnums= $(this).attr("ctg-data");
if(ctgnums){
var panel=$("<div class='header_main_left_main'></div>");
var panelol=$("<ol class='header_ol'></ol>");
var ctgnumArray = ctgnums.split(",");
$.each(ctgnumArray,function (i,ctg1Id) {
var ctg2list= ctgall[ctg1Id];
$.each(ctg2list,function (i,ctg2) {
var cata2link=$("<a href='#' style= 'color: #111;' class='aaa'>"+ctg2.name+" ></a>");
console.log(cata2link.html());
var li=$("<li></li>");
var ctg3List=ctg2["catalog3List"];
var len=0;
$.each(ctg3List,function (i,ctg3) {
var cata3link = $("<a href=\"http://search.gulimall.com/list.html?catalog3Id="+ctg3.id+"\" style=\"color: #999;\">" + ctg3.name + "</a>");
li.append(cata3link);
len=len+1+ctg3.name.length;
});
if(len>=46&&len<92){
li.attr("style","height: 60px;");
}else if(len>=92){
li.attr("style","height: 90px;");
}
panelol.append(cata2link).append(li);
});
});
panel.append(panelol);
$(this).after(panel);
$(this).parent().addClass("header_li2");
console.log($(".header_main_left").html());
}
});
});
}); | 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/catalogLoader.js | JavaScript | apache-2.0 | 1,822 |
$(".header_banner1").hover(function() {
$(".header_banner1_div").stop(true).animate({
width:"990px"
},500)
}, function() {
$(".header_banner1_div").stop(true).animate({
width:"0"
},300)
})
$(".head p").on("click", function() {
$(".head").fadeOut(500)
})
$(".header_banner1_div p").on("click", function() {
$(".header_banner1_div").stop(true).animate({
width:"0"
},200)
})
$(".header_ol a").hover(function() {
$(this).css({
color: "#c81623"
})
}, function() {
$(this).css({
color: "#999"
})
$(".aaa").css({
color: "#111"
})
})
//轮播图
var swiper1 = new Swiper(".swiper1", {
loop: true,
autoplay: 2000,
effect: 'fade',
fade: {
crossFade: false,
},
pagination: ".swiper-pagination",
paginationClickable: true,
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
autoplayDisableOnInteraction: false,
})
//货品分类
$('.header_main_left>ul>li').hover(function() {
$(this).css({
background: "#989898"
}).find('.header_main_left_main').stop(true).fadeIn(300)
}, function() {
$(this).css({
background: "#6e6568"
}).find(".header_main_left_a").css({
color: "#fff"
})
$(this).find('.header_main_left_main').stop(true).fadeOut(100)
})
$(".header_sj a").hover(function() {
$(this).css({
background: "#444"
})
}, function() {
$(this).css({
background: "#6e6568"
})
})
//购物车下拉
$('.header_gw').hover(function() {
$(this).next('.header_ko').stop(true).fadeIn(100)
}, function() {
$(this).next('.header_ko').stop(true).fadeOut(100)
})
//我的京东下拉
$(".header_wdjd").hover(function() {
$(this).children(".header_wdjd_txt").stop(true).show(100)
$(this).css({
background: "#fff"
})
}, function() {
$(this).css({
background: "#E3E4E5"
})
$(this).children(".header_wdjd_txt").stop(true).hide(100)
})
//地理位置下拉
$(".header_head_p").hover(function() {
$(this).children(".header_head_p_cs").stop(true).show(100)
$(this).css({
background: "#fff"
})
}, function() {
$(this).css({
background: "#E3E4E5"
})
$(this).children(".header_head_p_cs").stop(true).hide(100)
})
$(".header_head_p_cs a").hover(function(){
$(this).css({background:"#f0f0f0"})
$(".header_head_p_cs a:nth-child(1)").css({background:"#c81623"})
},function(){
$(this).css({background:"#fff"})
$(".header_head_p_cs a:nth-child(1)").css({background:"#c81623"})
})
//客户服务下拉
$(".header_wdjd1").hover(function() {
$(this).children(".header_wdjd_txt").stop(true).show(100)
$(this).css({
background: "#fff"
})
}, function() {
$(this).css({
background: "#E3E4E5"
})
$(this).children(".header_wdjd_txt").stop(true).hide(100)
})
//网站导航下拉
$(".header_wzdh").hover(function() {
$(this).children(".header_wzdh_txt").stop(true).show(100)
$(this).css({
background: "#fff"
})
}, function() {
$(this).css({
background: "#E3E4E5"
})
$(this).children(".header_wzdh_txt").stop(true).hide(100)
})
//促销公告选项卡
$(".header_new_t p").hover(function() {
var i = $(this).index()
$(".header_new_t p").removeClass("active").eq(i).addClass("active")
$(".header_new_connter_1").hide().eq(i).show()
})
//话费机票
$(".ser_box_aaa_nav li").hover(function() {
var i = $(this).index()
$(".ser_box_aaa_nav li").removeClass("active").eq(i).addClass("active")
$(".ser_ol_li").hide().eq(i).show()
})
$(".guanbi").on("click", function() {
$(".ser_box_aaa .ser_box_aaa_one").stop(true).animate({
top: "210px"
},600)
})
$(".ser_box_item span").hover(function() {
$(".ser_box_aaa .ser_box_aaa_one").css("display", "block")
$(".ser_box_aaa .ser_box_aaa_one").stop(true).animate({
top: "0"
},600)
}, function() {
})
//右侧侧边栏
$(".header_bar_box ul li").hover(function() {
$(this).css({
background: "#7A6E6E",
borderRadius: 0
}).children(".div").css({
display: "block"
}).stop(true).animate({
left: "-60px"
}, 300)
}, function() {
$(this).css({
background: "#7A6E6E",
borderRadius: 5
}).children(".div").css({
display: "none"
}).stop(true).animate({
left: "0"
}, 300)
})
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/header.js | JavaScript | apache-2.0 | 4,007 |
var swiper = new Swiper(".banner", {
loop: true,
autoplay: 1000,
nextButton: ".swiper-button-next",
prevButton: ".swiper-button-prev",
pagination: '.swiper-pagination',
effect: 'fade',
fade: {
crossFade: false,
},
})
var swiper1 = new Swiper(".banner1", {
loop: true,
nextButton: ".swiper-button-next",
prevButton: ".swiper-button-prev",
})
$(".section_ash_content .section_ash_con_bottom .banner1").mousemove(function() {
$(this).children(".swiper-button-next , .swiper-button-prev").css({"display": "block"})
}).mouseleave(function() {
$(this).children(".swiper-button-next , .swiper-button-prev").css({"display": "none"})
})
$(".section_ash_content .section_ash_con_bottom .banner1 .swiper-button-next , .swiper-button-prev").mousemove(function() {
$(this).css({"color": "#EC0110"})
}).mouseleave(function() {
$(this).css({"color": "gray"})
})
$(".section_xpz_content_left img").hover(function() {
$(this).stop(true).animate({
"left": "-10px"
}, 400)
}, function() {
$(this).stop(true).animate({
"left": "10px"
}, 400)
})
$(".xpz_right_bottom .right_bottom_left img").hover(function() {
$(this).stop(true).animate({
"left": "-10px"
}, 400)
}, function() {
$(this).stop(true).animate({
"left": 0
}, 400)
})
$(".section_ash_con_top .con_top_left img").hover(function() {
$(this).stop(true).animate({
"left": "-5px"
}, 400)
}, function() {
$(this).stop(true).animate({
"left": "5px"
}, 400)
})
$(".con_top_right .right_con_img ").hover(function() {
$(this).stop(true).animate({
"right": "5px"
}, 400)
}, function() {
$(this).stop(true).animate({
"right": "-5px"
}, 400)
})
$(".xpz_right_bottom img").hover(function() {
$(this).stop(true).animate({
"left": "-5px"
}, 400)
}, function() {
$(this).stop(true).animate({
"left": "5px"
}, 400)
})
$(".section_ash_center_img img").hover(function() {
$(this).stop(true).animate({
"left": "-5px"
}, 400)
}, function() {
$(this).stop(true).animate({
"left": "5px"
}, 400)
})
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/index.js | JavaScript | apache-2.0 | 2,161 |
$(window).scroll(function(event) {
var hi= $(document).scrollTop();
if(hi>825){
$(".top_find").stop().animate({
top:0
},500)
}else{
$(".top_find").stop().animate({
top:"-66px"
},0)
}
if(hi>1850){
$(".left_floor").stop().animate({
opacity:1
},300)
}else{
$(".left_floor").stop().animate({
opacity:0
},300)
}
//楼层滑动选中
if(hi<2612){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_xiang").addClass('left_floor_active');
}else if(hi>=2612&&hi<3207){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_fu").addClass('left_floor_active');
}else if(hi>=3207&&hi<3742){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_jia").addClass('left_floor_active');
}
else if(hi>=3742&&hi<4280){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_dian").addClass('left_floor_active');
}else if(hi>=4280&&hi<4832){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_3C").addClass('left_floor_active');
}else if(hi>=4832&&hi<5398){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_ai").addClass('left_floor_active');
}else if(hi>=5398&&hi<5932){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_mu").addClass('left_floor_active');
}else if(hi>=5932&&hi<6442){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_tu").addClass('left_floor_active');
}else if(hi>=6442&&hi<6977){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_you").addClass('left_floor_active');
}else if(hi>=6977&&hi<7910){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_lv").addClass('left_floor_active');
}else if(hi>7910){
$(".left_floor li").removeClass("left_floor_active");
$(".left_floor_hai").addClass('left_floor_active');
}
})
//楼层点击选中
$(".left_floor li").click(function(){
$(".left_floor li").removeClass("left_floor_active");
$(this).addClass('left_floor_active');
console.log($(this).index());
});
$(".left_floor li").mouseover(function(){
$(this).addClass('left_floor_active1');
console.log($(this).index());
}).mouseout(function(){
$(this).removeClass('left_floor_active1');
});
//楼层点击滑动指定位置
$(".left_floor_xiang").click(function(){
$("body,html").animate({
scrollTop:1858,
},500)
})
$(".left_floor_fu").click(function(){
$("body,html").animate({
scrollTop:2612,
},500)
})
$(".left_floor_jia").click(function(){
$("body,html").animate({
scrollTop:3207,
},500)
})
$(".left_floor_dian").click(function(){
$("body,html").animate({
scrollTop:3742,
},500)
})
$(".left_floor_3C").click(function(){
$("body,html").animate({
scrollTop:4280,
},500)
})
$(".left_floor_ai").click(function(){
$("body,html").animate({
scrollTop:4832,
},500)
})
$(".left_floor_mu").click(function(){
$("body,html").animate({
scrollTop:5398,
},500)
})
$(".left_floor_tu").click(function(){
$("body,html").animate({
scrollTop:5932,
},500)
})
$(".left_floor_you").click(function(){
$("body,html").animate({
scrollTop:6442,
},500)
})
$(".left_floor_lv").click(function(){
$("body,html").animate({
scrollTop:6977,
},500)
})
$(".left_floor_hai").click(function(){
$("body,html").animate({
scrollTop:7917,
},500)
})
$(".left_floor_ding").click(function(){
$("body,html").animate({
scrollTop:0,
},500)
})
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/left,top.js | JavaScript | apache-2.0 | 3,629 |
$(window).scroll(function(event) {
var hi = $(document).scrollTop();
console.log(hi)
})
var myswiper = new Swiper(".swiper_section_second_list_left", {
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
loop: true
})
var myswiper2 = new Swiper(".swiper_section_find_center_list", {
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
loop: true,
autoplay: 3000,
pagination: ".swiper-pagination",
effect: 'fade'
})
var myswiper3 = new Swiper(".swiper_section_ling_right_list", {
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
loop: true,
autoplay: 3000,
pagination: ".swiper-pagination",
effect: 'fade'
})
// 倒计时
setTimeout(function() {
var cha = 4 * 1000 * 3600;
function time() {
cha = cha - 1000;
var hours = parseInt(cha / 1000 / 3600) % 24;
var minutes = parseInt(cha / 1000 / 60) % 60;
var seconds = parseInt(cha / 1000) % 60;
if(hours < 10) {
hours = "0" + hours
}
if(minutes < 10) {
minutes = "0" + minutes
}
if(seconds < 10) {
seconds = "0" + seconds
}
$(".section_second_header_right_hours").html(hours);
$(".section_second_header_right_minutes").html(minutes);
$(".section_second_header_right_second").html(seconds);
}
setInterval(time, 1000)
}, 1)
//秒杀图片上移 文字变红
$(".swiper_section_second_list_left li p").mouseover(function() {
$(this).css("color", "#F90013");
$(this).prev().stop().animate({
marginTop: "0px",
marginBottom: "8px",
}, 500)
}).mouseout(function() {
$(this).css("color", "#999")
$(this).prev().stop().animate({
marginTop: "8px",
marginBottom: "0px",
}, 500)
})
$(".swiper_section_second_list_left li img").mouseover(function() {
$(this).next().css("color", "#F90013");
$(this).stop().animate({
marginTop: "0px",
marginBottom: "8px",
}, 500)
}).mouseout(function() {
$(this).next().css("color", "#999")
$(this).stop().animate({
marginTop: "8px",
marginBottom: "0px",
}, 500)
})
//秒杀左侧轮播按钮
$(".swiper_section_second_list_left").mouseover(function() {
$(".second_list").css("display", "block")
}).mouseout(function() {
$(".second_list").css("display", "none")
})
//发现center轮播按钮
$(".swiper_section_find_center_list").mouseover(function() {
$(".center_list").css("display", "block")
console.log("aaa")
}).mouseout(function() {
$(".center_list").css("display", "none")
console.log("bbb")
})
//觅me轮播按钮
$(".swiper_section_ling_right_list").mouseover(function() {
$(".right_list1").css("display", "block")
$(".right_list2").css("display", "block")
console.log("aaa")
}).mouseout(function() {
$(".right_list1").css("display", "none")
$(".right_list2").css("display", "none")
console.log("bbb")
})
//秒杀右侧图片小轮播
$(".section_second_list_right_button p").mouseover(function() {
$(".section_second_list_right_button p").removeClass('section_second_list_right_button_active')
$(this).addClass("section_second_list_right_button_active")
console.log($(this).index());
var other = $(this).siblings().index()
$(".section_second_list_right li").eq(other).animate({
opacity: 0
}, 1)
$(".section_second_list_right li").eq($(this).index()).animate({
opacity: 1
}, 200)
})
//寻找图片左移
$(".section_find_left_list ul li").mouseover(function() {
$(this).children('img').stop().animate({
right: "20px"
}, 300)
}).mouseout(function() {
$(this).children('img').stop().animate({
right: "10px"
}, 300)
})
//领券中心图片右移
$(".section_ling_left_list ul li").mouseover(function() {
$(this).children('img').stop().animate({
left: "55px"
}, 400)
}).mouseout(function() {
$(this).children('img').stop().animate({
left: "40px"
}, 400)
})
//排行榜选项卡
$(".section_find_right_list_ul li").mouseover(function() {
var a = ($(this).index() - 1) * 78 + 10
$(".section_find_right_list_ul li").children('ol').removeClass("active")
$(this).children('ol').addClass("active")
$(".xiahua").stop().animate({
left: a + "px"
}, 300)
})
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/secend.js | JavaScript | apache-2.0 | 4,152 |
$(".aibaobao_pt .pt_loge").hover(function(){
$(this).children(".jiant").show()
},function(){
$(this).children(".jiant").hide()
})
$(".left").click(function() {
$(this).css('color', 'red');
$(this).parent().prev("ul").animate({
left: "0px"
}, 600)
})
$(".ringth").click(function() {
$(this).parent().prev("ul").animate({
left: "-570px"
}, 600)
})
$(".left").hover(function(){
$(this).css('color', '#c81623');
},function(){
$(this).css('color', '#736B6E');
})
$(".ringth").hover(function(){
$(this).css('color', '#c81623');
},function(){
$(this).css('color', '#736B6E');
})
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/text.js | JavaScript | apache-2.0 | 687 |
//左右箭头显示、隐藏
//电脑数码
$(".section_dnsm_gun").hover(function() {
$(this).children().children('.section_dnsm_you').stop().show()
$(this).children().children('.section_dnsm_zuo').stop().show()
}, function() {
$(this).children().children('.section_dnsm_you').stop().hide()
$(this).children().children('.section_dnsm_zuo').stop().hide()
});
//玩3c
$(".section_w3c_gun").hover(function() {
$(this).children().children('.section_w3c_you').stop().show()
$(this).children().children('.section_w3c_zuo').stop().show()
}, function() {
$(this).children().children('.section_w3c_you').stop().hide()
$(this).children().children('.section_w3c_zuo').stop().hide()
});
//爱运动
$(".section_ayd_gun").hover(function() {
$(this).children().children('.section_ayd_you').stop().show()
$(this).children().children('.section_ayd_zuo').stop().show()
}, function() {
$(this).children().children('.section_ayd_you').stop().hide()
$(this).children().children('.section_ayd_zuo').stop().hide()
});
//爱吃
$(".section_ac_gun").hover(function() {
$(this).children().children('.section_ac_you').stop().show()
$(this).children().children('.section_ac_zuo').stop().show()
}, function() {
$(this).children().children('.section_ac_you').stop().hide()
$(this).children().children('.section_ac_zuo').stop().hide()
});
//左右箭头变色
$(".section_dnsm_zuo,.section_w3c_zuo,.section_ayd_zuo,.section_ac_zuo").hover(function() {
$(this).children('img').attr('src', './img/left-active.png');
}, function() {
$(this).children('img').attr('src', './img/left.png');
});
$(".section_dnsm_you,.section_w3c_you,.section_ayd_you,.section_ac_you").hover(function() {
$(this).children('img').attr('src', './img/right-active.png');
}, function() {
$(this).children('img').attr('src', './img/right.png');
});
//左右滑动
//电脑数码
$(".section_dnsm_zuo").click(function() {
// $(".section_dnsm_xian ul").animate({"left":"+=1140px"},600);
$(".section_dnsm_xian ul").animate({"left":"-1140px"},600);
});
$(".section_dnsm_you").click(function() {
$(".section_dnsm_xian ul").animate({"left":"-2280px"},600);
});
//爱吃
$(".section_ac_zuo").click(function() {
$(".section_ac_xian ul").animate({"left":"-1140px"},600)
});
$(".section_ac_you").click(function() {
$(".section_ac_xian ul").animate({"left":"-2280px"},600);
});
//玩3c
$(".section_w3c_zuo").click(function() {
$(".section_w3c_xian ul").animate({"left":"-570px"}, 600);
});
$(".section_w3c_you").click(function() {
$(".section_w3c_xian ul").animate({"left":"-1140"}, 600);
});
//爱运动
$(".section_ayd_zuo").click(function() {
$(".section_ayd_xian ul").animate({"left":"-570px"}, 600);
});
$(".section_ayd_you").click(function() {
$(".section_ayd_xian ul").animate({"left":"-1140px"}, 600);
});
//图片滑动效果
//电脑数码
$(".section_dnsm_left>div:first-child").hover(function(){
$(".section_dnsm_left>div:first-child>img").stop().animate({
left:"-10px"
},300)
},function(){
$(".section_dnsm_left>div:first-child>img").stop().animate({
left:0
},300)
})
$(".section_dnsm_right>div:first-child").hover(function(){
$(".section_dnsm_right>div:first-child>img").stop().animate({
left:"-10px"
},300)
},function(){
$(".section_dnsm_right>div:first-child>img").stop().animate({
left:0
},300)
})
//玩3C
$(".section_w3c_left>div:first-child").hover(function(){
$(".section_w3c_left>.section_w3c_er>img").stop().animate({
left:"-10px"
},300)
},function(){
$(".section_w3c_left>.section_w3c_er>img").stop().animate({
left:0
},300)
})
//爱运动
$(".section_ayd_left div:first-child").hover(function(){
$(".section_ayd_left div:first-child img").stop().animate({
left:"-10px"
},300)
},function(){
$(".section_ayd_left div:first-child img").stop().animate({
left:0
},300)
})
//爱吃
$(".section_ac_left div:first-child").hover(function(){
$(".section_ac_left div:first-child img").stop().animate({
left:"-10px"
},300)
},function(){
$(".section_ac_left div:first-child img").stop().animate({
left:0
},300)
})
$(".section_ac_right div:not(:last-child)").hover(function(){
$(this).children('img').stop().animate({
left:"-10px"
},300)
},function(){
$(this).children('img').stop().animate({
left:0
},300)
})
//小图滑动效果
//电脑数码
$(".section_dnsm_box li").hover(function() {
$(this).children().children('.section_dnsm_tu').children('img').stop().animate({
left:"-5px"
}, 300)
}, function() {
$(this).children().children('.section_dnsm_tu').children('img').stop().animate({
left:0
}, 300)
});
$(".section_dnsm_di a").hover(function() {
$(this).children("img").stop().animate({
left:"-10px"
}, 300)
}, function() {
$(this).children("img").stop().animate({
left:0
}, 300)
});
//玩3c
$(".section_w3c_box li").hover(function() {
$(this).children().children('.section_w3c_tu').children('img').stop().animate({
left:"-5px"
}, 300)
}, function() {
$(this).children().children('.section_w3c_tu').children('img').stop().animate({
left:0
}, 300)
});
$(".section_w3c_di a").hover(function() {
$(this).children("img").stop().animate({
left:"-10px"
}, 300)
}, function() {
$(this).children("img").stop().animate({
left:0
}, 300)
});
//爱运动
$(".section_ayd_box li").hover(function() {
$(this).children().children('.section_ayd_tu').children('img').stop().animate({
left:"-5px"
}, 300)
}, function() {
$(this).children().children('.section_ayd_tu').children('img').stop().animate({
left:0
}, 300)
});
$(".section_ayd_di a").hover(function() {
$(this).children("img").stop().animate({
left:"-10px"
}, 300)
}, function() {
$(this).children("img").stop().animate({
left:0
}, 300)
});
//爱吃
$(".section_ac_box li").hover(function() {
$(this).children().children('.section_ac_tu').children('img').stop().animate({
left:"-5px"
}, 300)
}, function() {
$(this).children().children('.section_ac_tu').children('img').stop().animate({
left:0
}, 300)
});
$(".section_ac_di a").hover(function() {
$(this).children("img").stop().animate({
left:"-10px"
}, 300)
}, function() {
$(this).children("img").stop().animate({
left:0
}, 300)
});
| 2401_83448718/meirimall | meirimall-product/src/main/resources/static/index/js/zz.js | JavaScript | apache-2.0 | 6,680 |
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="/static/index/css/swiper-3.4.2.min.css">
<link rel="stylesheet" href="/static/index/css/GL.css">
<script src="/static/index/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/index/js/swiper-3.4.2.jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/index/js/swiper-3.4.2.min.js"></script>
</head>
<body>
<div class="top_find">
<div class="top_find_son">
<img src="/static/index/img/top_find_logo.png" alt="">
<div class="input_find">
<input type="text" placeholder="卸妆水" />
<span style="background: url('/static/index/img/img_12.png') 0 -1px;"></span>
<a href="/static/#"><img src="/static/index/img/img_09.png" /></a>
</div>
</div>
</div>
<ul class="left_floor">
<li class="left_floor_xiang">享品质</li>
<li class="left_floor_fu">服饰美妆</li>
<li class="left_floor_jia">家电手机</li>
<li class="left_floor_dian">电脑数码</li>
<li class="left_floor_3C">3C运动</li>
<li class="left_floor_ai">爱吃</li>
<li class="left_floor_mu">母婴家居</li>
<li class="left_floor_tu">图书汽车</li>
<li class="left_floor_you">游戏金融</li>
<li class="left_floor_lv">旅行健康</li>
<li class="left_floor_hai">还没逛够</li>
<li class="left_floor_ding">顶部</li>
</ul>
<header>
<div class="head">
<a href="/static/#"><img src="/static/index/img/img_01.png" /></a>
<p>X</p>
</div>
<!--头部-->
<div class="header_head">
<div class="header_head_box">
<a href="/static/#" class="img"><img src="/static/index/img/logo.jpg" /></a>
<b class="header_head_p">
<a href="/static/#">
<img src="/static/index/img/img_05.png" style="border-radius: 50%;"/>
<!--<span class="glyphicon glyphicon-map-marker"></span>-->
北京</a>
<div class="header_head_p_cs">
<a href="/static/#" style="background: #C81623;color: #fff;">北京</a>
<a href="/static/#">上海</a>
<a href="/static/#">天津</a>
<a href="/static/#">重庆</a>
<a href="/static/#">河北</a>
<a href="/static/#">山西</a>
<a href="/static/#">河南</a>
<a href="/static/#">辽宁</a>
<a href="/static/#">吉林</a>
<a href="/static/#">黑龙江</a>
<a href="/static/#">内蒙古</a>
<a href="/static/#">江苏</a>
<a href="/static/#">山东</a>
<a href="/static/#">安徽</a>
<a href="/static/#">浙江</a>
<a href="/static/#">福建</a>
<a href="/static/#">湖北</a>
<a href="/static/#">湖南</a>
<a href="/static/#">广东</a>
<a href="/static/#">广西</a>
<a href="/static/#">江西</a>
<a href="/static/#">四川</a>
<a href="/static/#">海南</a>
<a href="/static/#">贵州</a>
<a href="/static/#">云南</a>
<a href="/static/#">西藏</a>
<a href="/static/#">陕西</a>
<a href="/static/#">甘肃</a>
<a href="/static/#">青海</a>
<a href="/static/#">宁夏</a>
<a href="/static/#">新疆</a>
<a href="/static/#">港澳</a>
<a href="/static/#">台湾</a>
<a href="/static/#">钓鱼岛</a>
<a href="/static/#">海外</a>
</div>
</b>
<ul>
<li>
<a th:if="${session.loginUser != null}">欢迎, [[${session.loginUser.nickname}]]</a>
<a th:if="${session.loginUser == null}" href="http://auth.gulimall.com/login.html">你好,请登录</a>
</li>
<li>
<a th:if="${session.loginUser == null}" href="http://auth.gulimall.com/reg.html" class="li_2">免费注册</a>
</li>
<span>|</span>
<li>
<a href="http://member.gulimall.com/memberOrder.html">我的订单</a>
</li>
</ul>
</div>
</div>
<!--搜索导航-->
<div class="header_sous">
<div class="header_form">
<input id="searchText" type="text" placeholder="" />
<span style="background: url('/static/index/img/img_12.png') 0 -1px;"></span>
<!--<button><i class="glyphicon"></i></button>-->
<a href="javascript:search()" ><img src="/static/index/img/img_09.png" onclick="search()" /></a>
</div>
<div class="header_ico">
<div class="header_gw">
<img src="/static/index/img/img_15.png" />
<span><a href="http://cart.gulimall.com/cart.html">我的购物车</a></span>
<span>0</span>
</div>
<div class="header_ko">
<p>购物车中还没有商品,赶紧选购吧!</p>
</div>
</div>
<div class="header_form_nav">
<ul>
<li>
<a href="/static/#" class="aaaaa">满999减300</a>
</li>
<li>
<a href="/static/#">金立S11</a>
</li>
<li>
<a href="/static/#">农用物资</a>
</li>
<li>
<a href="/static/#">保暖特惠</a>
</li>
<li>
<a href="/static/#">洗衣机节</a>
</li>
<li>
<a href="/static/#">七度空间卫生巾</a>
</li>
<li>
<a href="/static/#">自动波箱油</a>
</li>
<li>
<a href="/static/#">超市</a>
</li>
</ul>
</div>
<nav>
<ul>
<li>
<a href="/static/#">秒杀</a>
</li>
<li>
<a href="/static/#">优惠券</a>
</li>
<li>
<a href="/static/#">闪购</a>
</li>
<li>
<a href="/static/#">拍卖</a>
</li>
</ul>
<div class="spacer">|</div>
<ul>
<li>
<a href="/static/#">服饰</a>
</li>
<li>
<a href="/static/#">超市</a>
</li>
<li>
<a href="/static/#">生鲜</a>
</li>
<li>
<a href="/static/#">全球购</a>
</li>
</ul>
<div class="spacer">|</div>
<ul>
<li>
<a href="/static/#">金融</a>
</li>
</ul>
</nav>
<div class="right">
<a href="/static/#"><img src="/static/index/img/img_21.png" /></a>
</div>
</div>
<!--轮播主体内容-->
<div class="header_main">
<div class="header_banner">
<div class="header_main_left">
<ul>
<li th:each=" category : ${categorys}">
<a href="#" class="header_main_left_a" th:attr="ctg-data=${category.catId}"><b th:text="${category.name}">家用电器</b></a>
</li>
</ul>
</div>
<div class="header_main_center">
<div class="swiper-container swiper1">
<div class="swiper-wrapper">
<div class="swiper-slide">
<a href="/static/#"><img src="/static/index/img/lunbo.png" /></a>
</div>
<div class="swiper-slide">
<a href="/static/#"><img src="/static/index/img/lunbo3.png" /></a>
</div>
<div class="swiper-slide">
<a href="/static/#"><img src="/static/index/img/lunbo6.png" /></a>
</div>
<div class="swiper-slide">
<a href="/static/#"><img src="/static/index/img/lunbo7.png" /></a>
</div>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-next swiper-button-white"></div>
<div class="swiper-button-prev swiper-button-white"></div>
</div>
<div class="header_main_center_b">
<a href="/static/#"><img src="/static/index/img/5a13bf0bNe1606e58.jpg" /></a>
<a href="/static/#"><img src="/static/index/img/5a154759N5385d5d6.jpg" /></a>
</div>
</div>
<div class="header_main_right">
<div class="header_main_right_user">
<div class="user_info">
<div class="user_info_tou">
<a href="/static/#"><img class="" src="/static/index/img/touxiang.png"></a>
</div>
<div class="user_info_show">
<p class="">Hi, 欢迎来到!</p>
<p>
<a href="/static/#" class="">登录</a>
<a href="/static/#" class="">注册</a>
</p>
</div>
</div>
<div class="user_info_hide">
<a href="/static/#">新人福利</a>
<a href="/static/#">PLUS会员</a>
</div>
</div>
<div class="header_main_right_new">
<div class="header_new">
<div class="header_new_t">
<p class="active">
<a href="/static/#">促销</a>
</p>
<p>
<a href="/static/#">公告</a>
</p>
<a href="/static/#">更多</a>
</div>
<div class="header_new_connter">
<div class="header_new_connter_1">
<ul>
<li>
<a href="/static/#">全民纸巾大作战</a>
</li>
<li>
<a href="/static/#">家具建材满999减300元</a>
</li>
<li>
<a href="/static/#">黑科技冰箱,下单立减千元</a>
</li>
<li>
<a href="/static/#">抢102减101神券!</a>
</li>
</ul>
</div>
<div class="header_new_connter_1" style="display: none;">
<ul>
<li>
<a href="/static/#">关于召回普利司通(天津)轮胎有限公司2个规格乘用车轮胎的公告</a>
</li>
<li>
<a href="/static/#">物流推出配送员统一外呼电话"95056”</a>
</li>
<li>
<a href="/static/#">天府大件运营中心开仓公告</a>
</li>
<li>
<a href="/static/#">大件物流“送装一体”服务全面升级!</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="header_main_right_ser">
<div class="ser_box">
<ul>
<li class="ser_box_item">
<a href="/static/#">
<img src="/static/index/img/huafei.png" />
<span>话费</span>
</a>
</li>
<li class="ser_box_item">
<a href="/static/#">
<img src="/static/index/img/jipiao.png" />
<span>机票</span>
</a>
</li>
<li class="ser_box_item">
<a href="/static/#">
<img src="/static/index/img/jiudian.png" />
<span>酒店</span>
</a>
</li>
<li class="ser_box_item">
<a href="/static/#">
<img src="/static/index/img/youxi.png" />
<span>游戏</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/qiyegou.png" />
<span>企业购</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/jiayouka.png" />
<span>加油卡</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/dianyingpiao.png" />
<span>电影票</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/huochepiao.png" style="height:20px;" />
<span>火车票</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/zhongchou.png" />
<span>众筹</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/licai.png" style="height:22px;" />
<span>理财</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/lipinka.png" style="height:14px;" />
<span>礼品卡</span>
</a>
</li>
<li class="ser_box_item1">
<a href="/static/#">
<img src="/static/index/img/baitiao.png" style="height:20px;" />
<span>白条</span>
</a>
</li>
</ul>
<div class="ser_box_aaa">
<div class="ser_box_aaa_one">
<div class="ser_box_aaa_nav">
<ol>
<li class="active">
<a href="/static/#">话费</a>
</li>
<li>
<a href="/static/#">机票</a>
</li>
<li>
<a href="/static/#">酒店</a>
</li>
<li>
<a href="/static/#">游戏</a>
</li>
</ol>
<div class="ser_ol">
<div class="ser_ol_li">
<ul>
<div class="guanbi">X</div>
<a class="active">话费充值</a>
<a>流量充值</a>
<a>套餐变更</a>
<div class="ser_ol_div">
<p>号码<input type="text" /></p>
<p style="margin: 10px 0;">面值
<select name="">
<option value="">100元</option>
<option value="">20元</option>
<option value="">50元</option>
<option value="">10元</option>
<option value="">2元</option>
</select>
<span>¥98.0-¥100.0</span></p>
</div>
<button>快速充值</button>
<p class="p">抢99减50元话费</p>
</ul>
</div>
<div class="ser_ol_li">
<ul>
<div class="guanbi">X</div>
<a class="active">国际机票</a>
<a>国际/港澳</a>
<a>特惠活动</a>
<div class="ser_ol_div1">
<p>
<input type="radio" name="a" style="vertical-align:middle;" />单程
<input type="radio" name="a" style="vertical-align:middle;" />往返
</p>
<input type="text" placeholder="出发城市" />
<input type="text" placeholder="到达城市" />
<input type="text" placeholder="日期" />
</div>
<button>机票查询</button>
<span class="p">当季热门特惠机票</span>
</ul>
</div>
<div class="ser_ol_li">
<ul>
<div class="guanbi">X</div>
<a class="active" style="width: 50%;">国内港澳台</a>
<a style="width: 50%;">促销活动</a>
<div class="ser_ol_div1">
<input type="text" placeholder="出发城市" style="margin-top: 10px;" />
<input type="text" placeholder="到达城市" />
<input type="text" placeholder="日期" />
<input type="text" placeholder="酒店 商圈 地标" />
</div>
<button>酒店查询</button>
<span class="p">订酒店到</span>
</ul>
</div>
<div class="ser_ol_li">
<ul>
<div class="guanbi">X</div>
<a class="active">点卡</a>
<a>QQ</a>
<a>页游</a>
<div class="ser_ol_div1">
<input type="text" placeholder="游戏" style="margin-top: 15px;" />
<br />面值
<select name="" style="margin: 8px 0;">
<option value="">面值</option>
<option value="">面值</option>
<option value="">面值</option>
</select><span style="color: #C81623;">¥0.00</span>
<p>
<input type="radio" name="a" style="width: 15px;vertical-align:middle;" />直充
<input type="radio" name="a" style="width: 15px;vertical-align:middle;" />卡密
</p>
</div>
<button>快速充值</button>
<span class="p">吃鸡就要快人一步</span>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="header_banner1">
<a href="/static/#" class="a">
<img src="/static/index/img/5a1e5ce2N034ce344.png" class="aa" />
</a>
<div class="header_banner1_div">
<p>X</p>
</div>
</div>
</div>
</header>
<div class="section_second">
<!-- 第一层 -->
<div class="section_second_header">
<p class="section_second_header_img"></p>
<div class="section_second_header_left">
<p></p>
<span class="">秒杀</span>
<span>总有你想不到的低价</span>
<span>
</span>
</div>
<div class="section_second_header_right">
<p>当前场次</p>
<span class="section_second_header_right_hours">00</span>
<span class="section_second_header_right_mao">:</span>
<span class="section_second_header_right_minutes">00</span>
<span class="section_second_header_right_mao">:</span>
<span class="section_second_header_right_second">00</span>
<p>后结束</p>
</div>
</div>
<div class="section_second_list">
<div class="swiper-container swiper_section_second_list_left">
<div class="swiper-wrapper">
<div class="swiper-slide">
<ul id="seckillSkuContent">
<!--<li>-->
<!--<img src="/static/index/img/section_second_list_img1.jpg" alt="">-->
<!--<p>花王 (Merries) 妙而舒 纸尿裤 大号 L54片 尿不湿(9-14千克) (日本官方直采) 花王 (Merries) 妙而舒 纸尿裤 大号 L54片 尿不湿(9-14千</p>-->
<!--<span>¥83.9</span><s>¥99.9</s>-->
<!--</li>-->
</ul>
</div>
<div class="swiper-slide">
<ul>
<li>
<img src="/static/index/img/section_second_list_img6.jpg" alt="">
<p>Apple iMac 21.5英寸一体机(2017新款四核Core i5 处理器/8GB内存/1TB/RP555显卡/4K屏 MNDY2CH/A) Apple iMac 21.5英寸一体机(2017新款四核Core i5 处理</p>
<span>¥9588.00</span><s>¥10288.00</s>
</li>
<li>
<img src="/static/index/img/section_second_list_img7.jpg" alt="">
<p>中柏(Jumper)EZpad 4S Pro 10.6英寸二合一平板电脑(X5 z</p>
<span>¥848.00</span><s>¥899.00</s>
</li>
<li>
<img src="/static/index/img/section_second_list_img8.jpg" alt="">
<p>飞利浦(PHILIPS)电动牙刷HX6761/03亮白型成人充电式声波震动牙刷粉色 飞利浦(PHILIPS)电动牙刷HX6761/03亮白型成人充电式声波
</p>
<span>¥379.00</span><s>¥698.00</s>
</li>
<li>
<img src="/static/index/img/section_second_list_img9.jpg" alt="">
<p>美的(Midea) 258升 变频智能三门冰箱 一级能效 风冷无霜 中门</p>
<span>¥3088.00</span><s>¥3299.00</s>
</li>
<li>
<img src="/static/index/img/section_second_list_img10.jpg" alt="">
<p>【第二件减50元】蒙羊 内蒙古羔羊羊肋排 2.4斤</p>
<span>¥99.90</span><s>¥199.00</s>
</li>
</ul>
</div>
</div>
<div class="swiper-button-prev second_list">
<p></p>
</div>
<div class="swiper-button-next second_list">
<p></p>
</div>
</div>
<ul class="section_second_list_right">
<li>
<img src="/static/index/img/section_second_list_right_img.jpg" alt="">
</li>
<li>
<img src="/static/index/img/section_second_list_right_img.png" alt="">
</li>
<div class="section_second_list_right_button">
<p class="section_second_list_right_button_active"></p>
<p></p>
</div>
</ul>
</div>
</div>
</body>
<script type="text/javascript">
function search() {
var keyword=$("#searchText").val()
window.location.href="http://localhost:8076/list.html?keyword="+keyword;
}
$.get("http://seckill.gulimall.com/getCurrentSeckillSkus", function (res) {
if (res.data.length > 0) {
res.data.forEach(function (item) {
$("<li onclick='toDetail(" + item.skuId + ")'></li>").append($("<img style='width: 130px; height: 130px' src='" + item.skuInfo.skuDefaultImg + "' />"))
.append($("<p>"+item.skuInfo.skuTitle+"</p>"))
.append($("<span>" + item.seckillPrice + "</span>"))
.append($("<s>" + item.skuInfo.price + "</s>"))
.appendTo("#seckillSkuContent");
})
}
})
function toDetail(skuId) {
location.href = "http://item.gulimall.com/" + skuId + ".html";
}
</script>
<script type="text/javascript" src="/static/index/js/text.js"></script>
<script type="text/javascript" src="/static/index/js/header.js"></script>
<script type="text/javascript" src="/static/index/js/secend.js"></script>
<script type="text/javascript" src="/static/index/js/zz.js"></script>
<script type="text/javascript" src="/static/index/js/index.js"></script>
<script type="text/javascript" src="/static/index/js/left,top.js"></script>
<script type="text/javascript" src="/static/index/js/catalogLoader.js"></script>
</html>
| 2401_83448718/meirimall | meirimall-product/src/main/resources/templates/index.html | HTML | apache-2.0 | 24,293 |
package com.kong.meirimall.search.Constant;
public class EsConstant {
public static final String PRODUCT_INDEX = "product"; //sku 数据在 es 中的索引
}
| 2401_83448718/meirimall | meirimall-search/src/main/java/com/kong/meirimall/search/Constant/EsConstant.java | Java | apache-2.0 | 170 |
package com.kong.meirimall.search;
import com.alibaba.alicloud.context.oss.OssContextAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan("com.kong.meirimall")
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, OssContextAutoConfiguration.class})
public class MeirimallSearchApplication {
public static void main(String[] args) {
SpringApplication.run(MeirimallSearchApplication.class, args);
}
}
| 2401_83448718/meirimall | meirimall-search/src/main/java/com/kong/meirimall/search/MeirimallSearchApplication.java | Java | apache-2.0 | 774 |
package com.kong.meirimall.search.config;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ElasticSearchConfig {
public static final RequestOptions COMMON_OPTIONS;
static {
RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
// builder.addHeader("Authorization", "Bearer " + TOKEN);
// builder.setHttpAsyncResponseConsumerFactory(
// new HttpAsyncResponseConsumerFactory
// .HeapBufferedResponseConsumerFactory(30 * 1024 * 1024 * 1024));
COMMON_OPTIONS = builder.build();
}
@Bean
public RestHighLevelClient esRestClient(){
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new HttpHost("192.168.56.19", 9200, "http")));
return client;
}
}
| 2401_83448718/meirimall | meirimall-search/src/main/java/com/kong/meirimall/search/config/ElasticSearchConfig.java | Java | apache-2.0 | 1,100 |
package com.kong.meirimall.search.controller;
import com.kong.common.exception.BizCodeEnume;
import com.kong.common.to.es.SkuEsModel;
import com.kong.common.utils.R;
import com.kong.meirimall.search.service.ProductSaveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/search/save")
public class ElasticSaveController {
@Autowired
ProductSaveService productSaveService;
//上架商品
@PostMapping("/product")
public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) {
boolean b=false;
try {
b = productSaveService.productStatusUp(skuEsModels);
} catch (IOException e) {
//可能时 elasticsearch 连不上了
log.error("ElasticSaveController 商品上架错误:{}",e);
return R.error(BizCodeEnume.PRODUCT_UP_EXCEPTION.getCode(), BizCodeEnume.UNKNOW_EXCEPTION.getMsg());
}
if(b){return R.ok();}
else {return R.error(BizCodeEnume.PRODUCT_UP_EXCEPTION.getCode(), BizCodeEnume.UNKNOW_EXCEPTION.getMsg());}
}
}
| 2401_83448718/meirimall | meirimall-search/src/main/java/com/kong/meirimall/search/controller/ElasticSaveController.java | Java | apache-2.0 | 1,486 |