1 files copied
20 files added
1 files renamed
23 files modified
| | |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.mall.vo.AdminHomeDeliverySettingVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminRangeSettingVo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-新增 |
| | | */ |
| | | @PostMapping("couponRuleAdd") |
| | | @ControllerEndpoint(operation = " 优惠卷列表-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse couponRuleAdd(@RequestBody @Valid CouponRuleAddDto couponRuleAddDto) { |
| | | return adminMallGoodsService.couponRuleAdd(couponRuleAddDto); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-删除 |
| | | */ |
| | | @GetMapping("couponRuleDel/{id}") |
| | | @ControllerEndpoint(operation = "优惠卷列表-删除", exceptionMessage = "操作失败") |
| | | public FebsResponse couponRuleDel(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminMallGoodsService.couponRuleDel(id); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-上架 |
| | | */ |
| | | @GetMapping("upCoupon/{id}") |
| | | @ControllerEndpoint(operation = " 优惠卷列表-上架", exceptionMessage = "上架失败") |
| | | public FebsResponse upCoupon(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminMallGoodsService.upCoupon(id); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-下架 |
| | | */ |
| | | @GetMapping("downCoupon/{id}") |
| | | @ControllerEndpoint(operation = " 优惠卷列表-下架", exceptionMessage = "下架失败") |
| | | public FebsResponse downCoupon(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminMallGoodsService.downCoupon(id); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-更新 |
| | | */ |
| | | @PostMapping("couponUpdate") |
| | | @ControllerEndpoint(operation = "优惠卷列表-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse couponUpdate(@RequestBody @Valid AdminMallGoodsCouponVo adminMallGoodsCouponVo) { |
| | | return adminMallGoodsService.couponUpdate(adminMallGoodsCouponVo); |
| | | } |
| | | |
| | | |
| | | @GetMapping("coupon/tree") |
| | | public List<AdminMallGoodsCouponTreeVo> couponTree() { |
| | | return adminMallGoodsService.findAdminMallGoodsCouponVoTree(); |
| | | } |
| | | |
| | | @GetMapping(value = "/couponTreeSet") |
| | | public FebsResponse couponTreeSet() { |
| | | return new FebsResponse().success().data(adminMallGoodsService.findAdminMallGoodsCouponVoTreeList()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 会员列表---注销 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("memberOut/{id}") |
| | | @ControllerEndpoint(operation = "会员列表---注销", exceptionMessage = "操作失败") |
| | | public FebsResponse memberOut(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return mallMemberService.memberOut(id); |
| | | } |
| | | |
| | | /** |
| | | * 会员列表---开启 |
| | | * |
| | | * @param id |
| | |
| | | return mallMemberService.agentVerifyUpdate(adminAgentVerifyVo); |
| | | } |
| | | |
| | | /** |
| | | * 会员列表-推销员设置 |
| | | */ |
| | | @GetMapping("upSale/{id}") |
| | | @ControllerEndpoint(operation = " 会员列表-推销员设置", exceptionMessage = "操作失败") |
| | | public FebsResponse upSale(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return mallMemberService.upCoupon(id); |
| | | } |
| | | |
| | | /** |
| | | * 会员列表-推销员设置 |
| | | */ |
| | | @GetMapping("downSale/{id}") |
| | | @ControllerEndpoint(operation = " 会员列表-推销员设置", exceptionMessage = "操作失败") |
| | | public FebsResponse downSale(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return mallMemberService.downCoupon(id); |
| | | } |
| | | |
| | | /** |
| | | * 推销员列表 |
| | | * |
| | | * @param mallMember |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @GetMapping("getsalemanRuleList") |
| | | public FebsResponse getsalemanRuleList(MallMember mallMember, QueryRequest request) { |
| | | mallMember.setIsSale(1); |
| | | Map<String, Object> data = getDataTable(mallMemberService.getsalemanRuleList(mallMember, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 推销员列表-优惠卷绑定 |
| | | */ |
| | | @PostMapping("salemanCoupon") |
| | | @ControllerEndpoint(operation = "推销员列表-优惠卷绑定", exceptionMessage = "操作失败") |
| | | public FebsResponse salemanCoupon(@Valid MallMember mallmember) { |
| | | return mallMemberService.salemanCoupon(mallmember); |
| | | } |
| | | |
| | | } |
| | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallMemberCoupon; |
| | | import cc.mrbird.febs.mall.entity.MallMemberPayment; |
| | | import cc.mrbird.febs.mall.service.*; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | |
| | | return memberService.activityInfo(); |
| | | } |
| | | |
| | | @ApiOperation(value = "通过邀请链接领取优惠卷") |
| | | @PostMapping(value = "/getCoupon") |
| | | public FebsResponse getCoupon(@RequestBody GetCouponDto getCouponDto) { |
| | | return memberService.getCoupon(getCouponDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MallMemberCouponVo.class) |
| | | }) |
| | | @PostMapping(value = "/memberCoupon") |
| | | public FebsResponse memberCoupon(@RequestBody MallMemberCouponDto mallMemberCouponDto) { |
| | | return memberService.memberCoupon(mallMemberCouponDto); |
| | | } |
| | | |
| | | } |
| | |
| | | @GetMapping("goodsCouponList") |
| | | @RequiresPermissions("goodsCouponList:view") |
| | | public String goodsCouponList() { |
| | | return FebsUtil.view("modules/goods/goodsCoupon"); |
| | | return FebsUtil.view("modules/goods/goodsCouponList"); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-新增 |
| | | */ |
| | | @GetMapping("goodsCouponAdd") |
| | | @RequiresPermissions("goodsCouponAdd:add") |
| | | public String goodsCouponAdd() { |
| | | return FebsUtil.view("modules/goods/goodsCouponAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-编辑-详情 |
| | | */ |
| | | @GetMapping("goodsCouponUpdate/{id}") |
| | | @RequiresPermissions("goodsCouponUpdate:update") |
| | | public String goodsCouponUpdate(@PathVariable long id, Model model) { |
| | | AdminMallGoodsCouponVo adminMallGoodsCouponVo = mallGoodsService.selectGoodsCouponById(id); |
| | | model.addAttribute("couponRule", adminMallGoodsCouponVo); |
| | | return FebsUtil.view("modules/goods/goodsCouponUpdate"); |
| | | } |
| | | } |
| | |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.MallAgentRecordMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallSalesmanMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | |
| | | private final IAdminMallMemberService mallMemberService; |
| | | |
| | | private final MallSalesmanMapper mallSalesmanMapper; |
| | | private final MallMemberMapper mallMemberMapper; |
| | | private final MallAgentRecordMapper mallAgentRecordMapper; |
| | | |
| | | public static long idFromMoneyFlow; |
| | |
| | | return FebsUtil.view("modules/mallMember/agentVerify"); |
| | | } |
| | | |
| | | /** |
| | | * 推销员列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("memberSaleman") |
| | | @RequiresPermissions("memberSaleman:view") |
| | | public String memberSaleman() { |
| | | return FebsUtil.view("modules/mallMember/memberSaleman"); |
| | | } |
| | | |
| | | /** |
| | | * 优惠卷列表-选择 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("couponSelect/{id}") |
| | | @RequiresPermissions("couponSelect:update") |
| | | public String couponSelect(@PathVariable long id, Model model) { |
| | | MallMember mallMember = mallMemberMapper.selectById(id); |
| | | AdminCouponSelectVo data = new AdminCouponSelectVo(); |
| | | data.setId(mallMember.getId()); |
| | | model.addAttribute("adminCouponSelectVo", data); |
| | | return FebsUtil.view("modules/mallMember/couponSelect"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private String levelTwoPrice; |
| | | private String levelThreePrice; |
| | | |
| | | //优惠卷IDs |
| | | private List<Long> couponIds; |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | @Data |
| | | @ApiModel(value = "CouponRuleAddDto", description = "参数类") |
| | | public class CouponRuleAddDto { |
| | | |
| | | @NotBlank(message = "名称不能为空") |
| | | private String name; |
| | | //过期天数 |
| | | @NotNull(message = "过期天数不能为空") |
| | | @Min(value = 0, message = "整数字段不能小于0") |
| | | private Integer expireDay; |
| | | //满1000减100,满0减50; |
| | | //满足金额 |
| | | @NotNull(message = "满足金额不能为空") |
| | | @DecimalMin(value = "0", message = "字段不能小于0") |
| | | @DecimalMax(value = "10000", inclusive = false, message = "字段不能大于10000") |
| | | private BigDecimal costAmount; |
| | | //减免金额 |
| | | @NotNull(message = "减免金额不能为空") |
| | | @DecimalMin(value = "0", inclusive = false, message = "字段不能小于0") |
| | | @DecimalMax(value = "10000", inclusive = false, message = "字段不能大于10000") |
| | | private BigDecimal realAmount; |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | @ApiModel(value = "GetCouponDto", description = "参数类") |
| | | public class GetCouponDto { |
| | | |
| | | private Long goodsId; |
| | | |
| | | @NotBlank(message = "inviteId不能为空") |
| | | private String inviteId; |
| | | |
| | | } |
| | |
| | | private BigDecimal levelOnePrice; |
| | | private BigDecimal levelTwoPrice; |
| | | private BigDecimal levelThreePrice; |
| | | |
| | | private List<Long> couponIds; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "MallMemberCouponDto", description = "参数类") |
| | | public class MallMemberCouponDto { |
| | | |
| | | @ApiModelProperty(value = "1:待使用 2:已使用 3:已过期", example = "1") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty(value = "一页多少个", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | @ApiModelProperty(value = "页码", example = "1") |
| | | private Integer pageNum; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long memberId; |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("coupon_goods") |
| | | public class CouponGoods extends BaseEntity { |
| | | |
| | | private Long goodsId; |
| | | |
| | | private Long couponId; |
| | | } |
| | |
| | | private BigDecimal levelTwoPrice; |
| | | private BigDecimal levelThreePrice; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private List<Long> couponIds; |
| | | |
| | | } |
| | |
| | | private String name; |
| | | //过期天数 |
| | | private Integer expireDay; |
| | | //1:未生效 2:生效中 |
| | | private Integer state; |
| | | //满1000减100,满0减50; |
| | | //满足金额 |
| | | private BigDecimal costAmount; |
| | |
| | | private String salesmansName; |
| | | |
| | | private String inviteImg; |
| | | //是否是推销员1:是 2:否 |
| | | private Integer isSale; |
| | | |
| | | //优惠卷名称 |
| | | @TableField(exist = false) |
| | | private String couponName; |
| | | |
| | | //优惠卷名称 |
| | | @TableField(exist = false) |
| | | private Long couponId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("mall_member_coupon") |
| | | public class MallMemberCoupon extends BaseEntity { |
| | | |
| | | private Long memberId; |
| | | private Long couponId; |
| | | private String couponName; |
| | | private String inviteId; |
| | | //1:待使用 2:已使用 3:已过期 |
| | | private Integer state; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date expireTime; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("saleman_coupon") |
| | | public class SalemanCoupon extends BaseEntity { |
| | | |
| | | private Long couponId; |
| | | private Long memberId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.CouponGoods; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CouponGoodsMapper extends BaseMapper<CouponGoods> { |
| | | |
| | | List<Long> selectByGoodId(Long id); |
| | | |
| | | List<CouponGoods> selectByGoodIdAndCouponId(@Param("goodsId")Long goodsId, @Param("couponId")Long couponId); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCoupon; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCouponVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | |
| | | IPage<MallGoodsCoupon> selectMallGoodsCouponListInPage(Page<MallGoodsCoupon> page, @Param("record")MallGoodsCoupon mallGoodsCoupon); |
| | | |
| | | AdminMallGoodsCouponVo selectGoodsCouponById(@Param("id")long id); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.dto.MallMemberCouponDto; |
| | | import cc.mrbird.febs.mall.entity.MallMemberCoupon; |
| | | import cc.mrbird.febs.mall.vo.MallMemberCouponVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface MallMemberCouponMapper extends BaseMapper<MallMemberCoupon> { |
| | | |
| | | IPage<MallMemberCouponVo> selectListInPage(IPage<MallMemberCouponVo> page, @Param("record") MallMemberCouponDto mallMemberCouponDto); |
| | | |
| | | } |
| | |
| | | List<MallMember> selectMemberWithLevel(String level); |
| | | |
| | | MallMember selectMemberByOpenId(@Param("openId")String openId); |
| | | |
| | | IPage<MallMember> getsalemanRuleList(Page<MallMember> page, @Param("record")MallMember mallMember); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.SalemanCoupon; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface SalemanCouponMapper extends BaseMapper<SalemanCoupon> { |
| | | |
| | | SalemanCoupon selectByMemberId(@Param("memberId")Long memberId); |
| | | |
| | | } |
| | |
| | | List<MallCarriageRule> findAllCarriageRuleTree(); |
| | | |
| | | IPage<MallGoodsCoupon> getMallGoodsCouponListInPage(MallGoodsCoupon mallGoodsCoupon, QueryRequest request); |
| | | |
| | | FebsResponse couponRuleAdd(CouponRuleAddDto couponRuleAddDto); |
| | | |
| | | FebsResponse couponRuleDel(Long id); |
| | | |
| | | FebsResponse upCoupon(Long id); |
| | | |
| | | FebsResponse downCoupon(Long id); |
| | | |
| | | AdminMallGoodsCouponVo selectGoodsCouponById(long id); |
| | | |
| | | FebsResponse couponUpdate(AdminMallGoodsCouponVo adminMallGoodsCouponVo); |
| | | |
| | | List<AdminMallGoodsCouponTreeVo> findAdminMallGoodsCouponVoTree(); |
| | | |
| | | List<AdminMallGoodsCouponTreeListVo> findAdminMallGoodsCouponVoTreeList(); |
| | | } |
| | |
| | | List<AdminAgentLevelOptionTreeVo> agentLevelOption(); |
| | | |
| | | FebsResponse agentVerifyUpdate(AdminAgentVerifyVo adminAgentVerifyVo); |
| | | |
| | | FebsResponse upCoupon(Long id); |
| | | |
| | | FebsResponse downCoupon(Long id); |
| | | |
| | | FebsResponse memberOut(Long id); |
| | | |
| | | IPage<MallMember> getsalemanRuleList(MallMember mallMember, QueryRequest request); |
| | | |
| | | FebsResponse salemanCoupon(MallMember mallmember); |
| | | } |
| | |
| | | FebsResponse activityInfo(); |
| | | |
| | | FebsResponse agentApplyInfo(); |
| | | |
| | | FebsResponse getCoupon(GetCouponDto getCouponDto); |
| | | |
| | | FebsResponse memberCoupon(MallMemberCouponDto mallMemberCouponDto); |
| | | } |
| | |
| | | private final MallCarriageRuleMapper mallCarriageRuleMapper; |
| | | private final MallCarriageRuleInfoMapper mallCarriageRuleInfoMapper; |
| | | private final MallGoodsCouponMapper mallGoodsCouponMapper; |
| | | private final CouponGoodsMapper couponGoodsMapper; |
| | | |
| | | @Override |
| | | public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | |
| | | mallGoodsImagesMapper.insert(mallGoodsImages); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Long goodsId = mallGoods.getId(); |
| | | QueryWrapper<CouponGoods> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("goods_id",goodsId); |
| | | List<CouponGoods> mallGoodsCoupons = couponGoodsMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(mallGoodsCoupons)){ |
| | | for(CouponGoods couponGoods : mallGoodsCoupons){ |
| | | couponGoodsMapper.deleteById(couponGoods); |
| | | } |
| | | } |
| | | if(CollUtil.isNotEmpty(addMallGoodsDto.getCouponIds())){ |
| | | List<Long> couponIds = addMallGoodsDto.getCouponIds(); |
| | | for(Long couponId : couponIds){ |
| | | CouponGoods couponGoods = new CouponGoods(); |
| | | couponGoods.setGoodsId(goodsId); |
| | | couponGoods.setCouponId(couponId); |
| | | couponGoodsMapper.insert(couponGoods); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | List<MallGoodsSku> skus = mallGoodsSkuMapper.selectSkuByGoodsId(mallGoods.getId()); |
| | | List<String> thumbs = mallGoodsImagesMapper.selectByGoodId(mallGoods.getId()); |
| | | List<Long> couponIds = couponGoodsMapper.selectByGoodId(mallGoods.getId()); |
| | | mallGoods.setImages(thumbs); |
| | | mallGoods.setSkus(skus); |
| | | mallGoods.setCouponIds(couponIds); |
| | | return mallGoods; |
| | | } |
| | | |
| | |
| | | mallGoodsImagesMapper.insert(mallGoodsImages); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Long goodsId = mallGoodsUpdateDto.getId(); |
| | | QueryWrapper<CouponGoods> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("goods_id",goodsId); |
| | | List<CouponGoods> mallGoodsCoupons = couponGoodsMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(mallGoodsCoupons)){ |
| | | for(CouponGoods couponGoods : mallGoodsCoupons){ |
| | | couponGoodsMapper.deleteById(couponGoods); |
| | | } |
| | | } |
| | | if(CollUtil.isNotEmpty(mallGoodsUpdateDto.getCouponIds())){ |
| | | List<Long> couponIds = mallGoodsUpdateDto.getCouponIds(); |
| | | for(Long couponId : couponIds){ |
| | | CouponGoods couponGoods = new CouponGoods(); |
| | | couponGoods.setGoodsId(goodsId); |
| | | couponGoods.setCouponId(couponId); |
| | | couponGoodsMapper.insert(couponGoods); |
| | | } |
| | | } |
| | | |
| | |
| | | IPage<MallGoodsCoupon> mallGoodsCouponIPage = mallGoodsCouponMapper.selectMallGoodsCouponListInPage(page, mallGoodsCoupon); |
| | | return mallGoodsCouponIPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse couponRuleAdd(CouponRuleAddDto couponRuleAddDto) { |
| | | String name = couponRuleAddDto.getName(); |
| | | QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("name",name); |
| | | List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(mallGoodsCoupons)){ |
| | | return new FebsResponse().fail().message("名称不能重复"); |
| | | } |
| | | |
| | | MallGoodsCoupon mallGoodsCoupon = new MallGoodsCoupon(); |
| | | mallGoodsCoupon.setName(name); |
| | | mallGoodsCoupon.setExpireDay(couponRuleAddDto.getExpireDay()); |
| | | mallGoodsCoupon.setCostAmount(couponRuleAddDto.getCostAmount()); |
| | | mallGoodsCoupon.setRealAmount(couponRuleAddDto.getRealAmount()); |
| | | mallGoodsCouponMapper.insert(mallGoodsCoupon); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse couponRuleDel(Long id) { |
| | | MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoodsCoupon)) { |
| | | return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面"); |
| | | } |
| | | Integer state = mallGoodsCoupon.getState(); |
| | | if(2 == state){ |
| | | return new FebsResponse().fail().message("请先下架优惠卷"); |
| | | } |
| | | mallGoodsCouponMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse upCoupon(Long id) { |
| | | MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoodsCoupon)) { |
| | | return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面"); |
| | | } |
| | | mallGoodsCoupon.setState(2); |
| | | mallGoodsCouponMapper.updateById(mallGoodsCoupon); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse downCoupon(Long id) { |
| | | MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoodsCoupon)) { |
| | | return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面"); |
| | | } |
| | | mallGoodsCoupon.setState(1); |
| | | mallGoodsCouponMapper.updateById(mallGoodsCoupon); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallGoodsCouponVo selectGoodsCouponById(long id) { |
| | | return mallGoodsCouponMapper.selectGoodsCouponById(id); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse couponUpdate(AdminMallGoodsCouponVo adminMallGoodsCouponVo) { |
| | | Long id = adminMallGoodsCouponVo.getId(); |
| | | MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoodsCoupon)) { |
| | | return new FebsResponse().fail().message("优惠卷不存在,请刷新当前页面"); |
| | | } |
| | | Integer state = mallGoodsCoupon.getState(); |
| | | if(2 == state){ |
| | | return new FebsResponse().fail().message("请先下架优惠卷"); |
| | | } |
| | | mallGoodsCoupon.setName(adminMallGoodsCouponVo.getName()); |
| | | mallGoodsCoupon.setExpireDay(adminMallGoodsCouponVo.getExpireDay()); |
| | | mallGoodsCoupon.setCostAmount(adminMallGoodsCouponVo.getCostAmount()); |
| | | mallGoodsCoupon.setRealAmount(adminMallGoodsCouponVo.getRealAmount()); |
| | | mallGoodsCouponMapper.updateById(mallGoodsCoupon); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsCouponTreeVo> findAdminMallGoodsCouponVoTree() { |
| | | QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("state",2); |
| | | List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper); |
| | | |
| | | List<AdminMallGoodsCouponTreeVo> objects = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(mallGoodsCoupons)){ |
| | | for(MallGoodsCoupon mallGoodsCoupon : mallGoodsCoupons){ |
| | | AdminMallGoodsCouponTreeVo adminMallGoodsCouponTreeVo = new AdminMallGoodsCouponTreeVo(); |
| | | adminMallGoodsCouponTreeVo.setCouponId(mallGoodsCoupon.getId()); |
| | | adminMallGoodsCouponTreeVo.setCouponName(mallGoodsCoupon.getName()); |
| | | objects.add(adminMallGoodsCouponTreeVo); |
| | | } |
| | | } |
| | | return objects; |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsCouponTreeListVo> findAdminMallGoodsCouponVoTreeList() { |
| | | QueryWrapper<MallGoodsCoupon> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("state",2); |
| | | List<MallGoodsCoupon> mallGoodsCoupons = mallGoodsCouponMapper.selectList(objectQueryWrapper); |
| | | |
| | | List<AdminMallGoodsCouponTreeListVo> objects = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(mallGoodsCoupons)){ |
| | | for(MallGoodsCoupon mallGoodsCoupon : mallGoodsCoupons){ |
| | | AdminMallGoodsCouponTreeListVo adminMallGoodsCouponTreeListVo = new AdminMallGoodsCouponTreeListVo(); |
| | | adminMallGoodsCouponTreeListVo.setId(mallGoodsCoupon.getId()); |
| | | adminMallGoodsCouponTreeListVo.setName(mallGoodsCoupon.getName()); |
| | | objects.add(adminMallGoodsCouponTreeListVo); |
| | | } |
| | | } |
| | | return objects; |
| | | } |
| | | } |
| | |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | |
| | | @Transactional |
| | | public class AdminMallMemberServiceImpl extends ServiceImpl<MallMemberMapper, MallMember> implements IAdminMallMemberService { |
| | | |
| | | private final RedisUtils redisUtils; |
| | | |
| | | private final MallMemberMapper mallMemberMapper; |
| | | |
| | | private final MallMemberWalletMapper mallMemberWalletMapper; |
| | |
| | | |
| | | private final MallAgentRecordMapper mallAgentRecordMapper; |
| | | private final MallSalesmanMapper mallSalesmanMapper; |
| | | private final SalemanCouponMapper salemanCouponMapper; |
| | | |
| | | @Override |
| | | public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse upCoupon(Long id) { |
| | | MallMember mallMember = this.baseMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | throw new FebsException("请刷新页面"); |
| | | } |
| | | mallMember.setIsSale(1); |
| | | this.baseMapper.updateById(mallMember); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse downCoupon(Long id) { |
| | | MallMember mallMember = this.baseMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | throw new FebsException("请刷新页面"); |
| | | } |
| | | mallMember.setIsSale(2); |
| | | this.baseMapper.updateById(mallMember); |
| | | |
| | | QueryWrapper<SalemanCoupon> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("member_id",mallMember.getId()); |
| | | List<SalemanCoupon> salemanCouponList = salemanCouponMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(salemanCouponList)){ |
| | | for(SalemanCoupon salemanCoupon : salemanCouponList){ |
| | | salemanCouponMapper.deleteById(salemanCoupon); |
| | | } |
| | | } |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse memberOut(Long id) { |
| | | |
| | | MallMember mallMember = this.baseMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | throw new FebsException("请刷新页面"); |
| | | } |
| | | redisUtils.del(AppContants.XCX_LOGIN_PREFIX + id); |
| | | redisUtils.del(AppContants.XCX_LOGIN_PHONE_PREFIX + id); |
| | | this.baseMapper.deleteById(mallMember); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MallMember> getsalemanRuleList(MallMember mallMember, QueryRequest request) { |
| | | Page<MallMember> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<MallMember> mallMembers = this.baseMapper.getsalemanRuleList(page, mallMember); |
| | | return mallMembers; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse salemanCoupon(MallMember mallmember) { |
| | | MallMember member = this.baseMapper.selectById(mallmember.getId()); |
| | | if(ObjectUtil.isEmpty(member)){ |
| | | throw new FebsException("请刷新页面"); |
| | | } |
| | | Long couponId = mallmember.getCouponId(); |
| | | |
| | | QueryWrapper<SalemanCoupon> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("member_id",member.getId()); |
| | | List<SalemanCoupon> salemanCouponList = salemanCouponMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(salemanCouponList)){ |
| | | SalemanCoupon salemanCoupon = salemanCouponList.get(0); |
| | | salemanCoupon.setCouponId(couponId); |
| | | salemanCouponMapper.updateById(salemanCoupon); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | SalemanCoupon salemanCoupon = new SalemanCoupon(); |
| | | salemanCoupon.setMemberId(member.getId()); |
| | | salemanCoupon.setCouponId(couponId); |
| | | salemanCouponMapper.insert(salemanCoupon); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminAgentMemberVo> agentChild(QueryRequest request, MallMember mallMember) { |
| | | Long memberId = mallMember.getId(); |
| | | mallMember = mallMemberMapper.selectById(memberId); |
| | |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final IMallMemberCollectionService mallMemberCollectionService; |
| | | private final IMallMemberFootprintService mallMemberFootprintService; |
| | | private final SalemanCouponMapper salemanCouponMapper; |
| | | private final CouponGoodsMapper couponGoodsMapper; |
| | | private final MallGoodsCouponMapper mallGoodsCouponMapper; |
| | | private final MallMemberCouponMapper mallMemberCouponMapper; |
| | | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | |
| | | return new FebsResponse().success().data(apiMallAgentRecordVo); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse getCoupon(GetCouponDto getCouponDto) { |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | //通过邀请人信息,获取能领取的优惠卷信息 |
| | | MallMember mallMember = this.baseMapper.selectInfoByInviteId(getCouponDto.getInviteId()); |
| | | SalemanCoupon salemanCoupon = salemanCouponMapper.selectByMemberId(mallMember.getId()); |
| | | if(ObjectUtil.isNotEmpty(salemanCoupon)){ |
| | | Long couponId = salemanCoupon.getCouponId(); |
| | | Long goodsId = getCouponDto.getGoodsId(); |
| | | //商品优惠卷如果绑定了,那么当前登陆者获取一张卷 |
| | | List<CouponGoods> couponGoodsList = couponGoodsMapper.selectByGoodIdAndCouponId(goodsId,couponId); |
| | | MallGoodsCoupon mallGoodsCoupon = mallGoodsCouponMapper.selectById(couponId); |
| | | if(CollUtil.isNotEmpty(couponGoodsList)){ |
| | | MallMemberCoupon mallMemberCoupon = new MallMemberCoupon(); |
| | | mallMemberCoupon.setCouponId(couponId); |
| | | mallMemberCoupon.setCouponName(mallGoodsCoupon.getName()); |
| | | mallMemberCoupon.setMemberId(memberId); |
| | | mallMemberCoupon.setInviteId(mallMemberCoupon.getInviteId()); |
| | | mallMemberCoupon.setState(1); |
| | | mallMemberCoupon.setExpireTime(DateUtil.offsetDay(DateUtil.date(),mallGoodsCoupon.getExpireDay())); |
| | | mallMemberCouponMapper.insert(mallMemberCoupon); |
| | | } |
| | | } |
| | | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse memberCoupon(MallMemberCouponDto mallMemberCouponDto) { |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | IPage<MallMemberCouponVo> page = new Page<>(mallMemberCouponDto.getPageNum(), mallMemberCouponDto.getPageSize()); |
| | | mallMemberCouponDto.setMemberId(memberId); |
| | | IPage<MallMemberCouponVo> pages = mallMemberCouponMapper.selectListInPage(page, mallMemberCouponDto); |
| | | return new FebsResponse().success().data(pages); |
| | | } |
| | | |
| | | private String getXcxLoginUrl(String code) { |
| | | String wechatLoginUrl =xcxProperties.getWecharLoginUrl(); |
| | | return String.format(wechatLoginUrl, xcxProperties.getXcxAppid(), xcxProperties.getXcxSecret(), code); |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminCouponSelectVo", description = "信息返回类") |
| | | public class AdminCouponSelectVo { |
| | | private Long id; |
| | | |
| | | private Long couponId; |
| | | |
| | | private String couponName; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsCouponTreeListVo", description = "信息返回类") |
| | | public class AdminMallGoodsCouponTreeListVo { |
| | | |
| | | private Long id; |
| | | |
| | | private String name; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsCouponTreeVo", description = "信息返回类") |
| | | public class AdminMallGoodsCouponTreeVo { |
| | | private Long couponId; |
| | | |
| | | private String couponName; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.*; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsCouponVo", description = "信息返回类") |
| | | public class AdminMallGoodsCouponVo { |
| | | private Long id; |
| | | |
| | | @NotBlank(message = "名称不能为空") |
| | | private String name; |
| | | //过期天数 |
| | | @NotNull(message = "过期天数不能为空") |
| | | @Min(value = 0, message = "整数字段不能小于0") |
| | | private Integer expireDay; |
| | | //满1000减100,满0减50; |
| | | //满足金额 |
| | | @NotNull(message = "满足金额不能为空") |
| | | @DecimalMin(value = "0", message = "字段不能小于0") |
| | | @DecimalMax(value = "10000", inclusive = false, message = "字段不能大于10000") |
| | | private BigDecimal costAmount; |
| | | //减免金额 |
| | | @NotNull(message = "减免金额不能为空") |
| | | @DecimalMin(value = "0", inclusive = false, message = "字段不能小于0") |
| | | @DecimalMax(value = "10000", inclusive = false, message = "字段不能大于10000") |
| | | private BigDecimal realAmount; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "MallMemberCouponVo", description = "商城商品列表") |
| | | public class MallMemberCouponVo { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "优惠卷名称") |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value = "优惠卷ID") |
| | | private Long couponId; |
| | | |
| | | @ApiModelProperty(value = "邀请人邀请码") |
| | | private String inviteId; |
| | | |
| | | @ApiModelProperty(value = "过期时间") |
| | | private String expireTime; |
| | | |
| | | @ApiModelProperty(value = "1:待使用 2:已使用 3:已过期") |
| | | private Integer state; |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.CouponGoodsMapper"> |
| | | |
| | | <select id="selectByGoodId" resultType="java.lang.Long"> |
| | | select a.coupon_id |
| | | from coupon_goods a |
| | | where goods_id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectByGoodIdAndCouponId" resultType="cc.mrbird.febs.mall.entity.CouponGoods"> |
| | | select a.* |
| | | from coupon_goods a |
| | | where goods_id = #{goodsId} |
| | | and coupon_id = #{couponId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | from mall_goods_coupon a |
| | | order by a.created_time desc |
| | | </select> |
| | | |
| | | <select id="selectGoodsCouponById" resultType="cc.mrbird.febs.mall.vo.AdminMallGoodsCouponVo"> |
| | | select * |
| | | from mall_goods_coupon |
| | | where id = #{id} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.MallMemberCouponMapper"> |
| | | |
| | | <select id="selectListInPage" resultType="cc.mrbird.febs.mall.vo.MallMemberCouponVo"> |
| | | select |
| | | a.* |
| | | from mall_member_coupon a |
| | | <where> |
| | | a.member_id=#{record.memberId} |
| | | <if test="record.state != null and record.state != ''"> |
| | | and a.state=#{record.state} |
| | | </if> |
| | | </where> |
| | | order by a.CREATED_TIME desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="record.level!=null and record.level!=''"> |
| | | and m.level=#{record.level} |
| | | </if> |
| | | <if test="record.isSale!=null and record.isSale!=''"> |
| | | and m.is_sale=#{record.isSale} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY m.id order by m.CREATED_TIME desc |
| | |
| | | where a.open_id = #{openId} limit 1 |
| | | </select> |
| | | |
| | | <select id="getsalemanRuleList" resultType="cc.mrbird.febs.mall.entity.MallMember"> |
| | | SELECT m.*, |
| | | b.name couponName |
| | | FROM mall_member m |
| | | LEFT Join saleman_coupon a on m.id = a.member_id |
| | | LEFT Join mall_goods_coupon b on b.id = a.coupon_id and b.state = 2 |
| | | <where> |
| | | <if test="record != null" > |
| | | <if test="record.name!=null and record.name!=''"> |
| | | and m.name like concat('%', #{record.name},'%') |
| | | </if> |
| | | <if test="record.account!=null and record.account!=''"> |
| | | and m.phone like concat('%', #{record.account},'%') |
| | | </if> |
| | | <if test="record.isSale!=null and record.isSale!=''"> |
| | | and m.is_sale=#{record.isSale} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by m.CREATED_TIME desc |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.SalemanCouponMapper"> |
| | | |
| | | <select id="selectByMemberId" resultType="cc.mrbird.febs.mall.entity.SalemanCoupon"> |
| | | select a.* |
| | | from saleman_coupon a |
| | | where a.member_id = #{memberId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">优惠卷设置</blockquote> |
| | | <div class="layui-form-item coupon-rule"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">优惠卷:</label> |
| | | <div class="layui-input-block"> |
| | | <div id="coupon-rule"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">多规格设置</blockquote> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">开启多规格:</label> |
| | |
| | | iconfont: { |
| | | parent: 'hidden', |
| | | }, |
| | | tips: '请选择', |
| | | filterable: true, |
| | | radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | |
| | | |
| | | febs.get(ctx + 'admin/goods/carriageRuleTree', null, function(res) { |
| | | carriageRule.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | | }) |
| | | |
| | | var couponRule = xmSelect.render({ |
| | | el: '#coupon-rule', |
| | | language: 'zn', |
| | | prop : { |
| | | value : 'id', |
| | | children : 'child' |
| | | }, |
| | | iconfont: { |
| | | parent: 'hidden', |
| | | }, |
| | | // radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | //非严格模式 |
| | | strict: false, |
| | | }, |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/goods/couponTreeSet', null, function(res) { |
| | | couponRule.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | |
| | | |
| | | form.on('submit(goods-add-form-submit)', function (data) { |
| | | data.field.goodsType = 1; |
| | | let couponRuleList = couponRule.getValue(); |
| | | if (couponRuleList.length > 0) { |
| | | var couponIds = []; |
| | | layui.each(couponRuleList, function (key, item) { |
| | | couponIds.push(item.id) |
| | | }); |
| | | data.field.couponIds=couponIds; |
| | | } |
| | | data.field.addMallGoodsSkuDtos = tableSkuData; |
| | | data.field.categoryId = category.getValue('valueStr'); |
| | | data.field.carriageRuleId = carriageRule.getValue('valueStr'); |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-coupon-rule-add" lay-title="优惠卷新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="coupon-rule-add"> |
| | | <form class="layui-form" action="" lay-filter="coupon-rule-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">优惠卷</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <blockquote class="layui-elem-quote blue-border">基本信息</blockquote> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">过期天数:</label> |
| | | <div class="layui-input-block"> |
| | | <!-- <input type="text" name="expireDay" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">--> |
| | | |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="expireDay" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">后,过期。</div> |
| | | <div class="layui-form-mid layui-word-aux">领取优惠卷开始计算过期时间。设置为0,则永不过期。</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">规则</blockquote> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">满足:</label> |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="costAmount" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">(元)金额,</div> |
| | | <div class="layui-form-mid">减免</div> |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="realAmount" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">(元)金额。</div> |
| | | <div class="layui-form-mid layui-word-aux">满足0元减免100元,则代表100元无门槛优惠卷。</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="coupon-rule-add-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | </style> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="delSku">删除</button> |
| | | </div> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#coupon-rule-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | form.on('submit(coupon-rule-add-form-submit)', function (data) { |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/goods/couponRuleAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-coupon-rule').find('#reset').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
File was renamed from src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html |
| | |
| | | background-color: #5FB878 !important; |
| | | } |
| | | </style> |
| | | |
| | | <script type="text/html" id="isStateSwitch"> |
| | | {{# if(d.state === 2) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="上架|下架" checked lay-skin="switch" lay-filter="isStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="上架|下架" lay-skin="switch" lay-filter="isStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | |
| | | table.on('tool(couponRuleTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'carriageRuleDel') { |
| | | febs.modal.confirm('删除', '确认删除['+data.name+']运费模板?', function () { |
| | | carriageRuleDel(data.id); |
| | | if (layEvent === 'couponRuleDel') { |
| | | febs.modal.confirm('删除', '确认删除['+data.name+']优惠卷?', function () { |
| | | couponRuleDel(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'carriageRuleUpdate') { |
| | | febs.modal.open('运费模板编辑', 'modules/goods/carriageRuleUpdate/' + data.id, { |
| | | if (layEvent === 'couponRuleUpdate') { |
| | | febs.modal.open('优惠卷编辑', 'modules/goods/goodsCouponUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | |
| | | }); |
| | | } |
| | | }); |
| | | function carriageRuleDel(id) { |
| | | febs.get(ctx + 'admin/goods/carriageRuleDel/' + id, null, function () { |
| | | function couponRuleDel(id) { |
| | | febs.get(ctx + 'admin/goods/couponRuleDel/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | form.on('switch(isStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | upCoupon(data.value); |
| | | } else { |
| | | downCoupon(data.value); |
| | | } |
| | | }) |
| | | |
| | | function upCoupon(id) { |
| | | febs.get(ctx + 'admin/goods/upCoupon/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function downCoupon(id) { |
| | | febs.get(ctx + 'admin/goods/downCoupon/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | |
| | | }); |
| | | |
| | | $add.on('click', function () { |
| | | febs.modal.open('运费模板新增', 'modules/goods/carriageRuleAdd/', { |
| | | febs.modal.open('优惠卷新增', 'modules/goods/goodsCouponAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | |
| | | url: ctx + 'admin/goods/couponRuleList', |
| | | cols: [[ |
| | | {field: 'name', title: '名称', minWidth: 200,align:'left'}, |
| | | {field: 'isState', title: '是否生效', templet: '#isStateSwitch', minWidth: 100,align:'center'}, |
| | | {field: 'costAmount', title: '满足金额', minWidth: 200,align:'left'}, |
| | | {field: 'realAmount', title: '减免金额', minWidth: 200,align:'left'}, |
| | | {field: 'expireDay', title: '过期天数', minWidth: 200,align:'left'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 140,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if (d.state === 1) { |
| | | return '' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="carriageRuleUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="carriageRuleDel" shiro:hasPermission="user:update">删除</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="couponRuleUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="couponRuleDel" shiro:hasPermission="user:update">删除</button>' |
| | | |
| | | }else{ |
| | | return ''; |
| | | |
| | | } |
| | | },minWidth: 160,align:'center'} |
| | | ]] |
| | | }); |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-coupon-rule-update" lay-title="优惠卷编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="coupon-rule-update"> |
| | | <form class="layui-form" action="" lay-filter="coupon-rule-update-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">运费模板</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <input type="text" name="id" placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <blockquote class="layui-elem-quote blue-border">基本信息</blockquote> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">过期天数:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="expireDay" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">后,过期。</div> |
| | | <div class="layui-form-mid layui-word-aux">领取优惠卷开始计算过期时间。设置为0,则永不过期。</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">规则</blockquote> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">满足:</label> |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="costAmount" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">(元)金额,</div> |
| | | <div class="layui-form-mid">减免</div> |
| | | <div class="layui-input-inline" style="width: 80px"> |
| | | <input type="text" name="realAmount" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | <div class="layui-form-mid">(元)金额。</div> |
| | | <div class="layui-form-mid layui-word-aux">满足0元减免100元,则代表100元无门槛优惠卷。</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="coupon-rule-update-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | </style> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="delSku">删除</button> |
| | | </div> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#coupon-rule-update'), |
| | | layedit = layui.layedit, |
| | | couponRule = [[${couponRule}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | initValue(); |
| | | |
| | | function initValue() { |
| | | form.val("coupon-rule-update-form", { |
| | | "id": couponRule.id, |
| | | "name": couponRule.name, |
| | | "expireDay": couponRule.expireDay, |
| | | "costAmount": couponRule.costAmount, |
| | | "realAmount": couponRule.realAmount |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(coupon-rule-update-form-submit)', function (data) { |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/goods/couponUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-coupon-rule').find('#reset').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">优惠卷设置</blockquote> |
| | | <div class="layui-form-item coupon-rule"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">优惠卷:</label> |
| | | <div class="layui-input-block"> |
| | | <div id="coupon-rule"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <blockquote class="layui-elem-quote blue-border">多规格设置</blockquote> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">开启多规格:</label> |
| | |
| | | // initValue(); |
| | | }) |
| | | |
| | | var couponRule = xmSelect.render({ |
| | | el: '#coupon-rule', |
| | | language: 'zn', |
| | | prop : { |
| | | value : 'id', |
| | | children : 'child' |
| | | }, |
| | | iconfont: { |
| | | parent: 'hidden', |
| | | }, |
| | | // radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | //非严格模式 |
| | | strict: false, |
| | | }, |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/goods/couponTreeSet', null, function(res) { |
| | | couponRule.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | | |
| | | initValue(); |
| | | }) |
| | | |
| | | var carriageRule = xmSelect.render({ |
| | | el: '#carriage-rule', |
| | | language: 'zn', |
| | |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | | |
| | | initValue(); |
| | | }) |
| | | |
| | | |
| | | var tableSkuData = []; |
| | | var tableIns = table.render({ |
| | |
| | | arrCarriageRule.push(goodsInfo.carriageRuleId) |
| | | carriageRule.setValue(arrCarriageRule); |
| | | |
| | | couponRule.setValue(goodsInfo.couponIds); |
| | | |
| | | if (goodsInfo.isNormal == 2) { |
| | | $(".tc-set").show(); |
| | | } |
| | |
| | | } |
| | | |
| | | form.on('submit(goods-update-form-submit)', function (data) { |
| | | let couponRuleList = couponRule.getValue(); |
| | | if (couponRuleList.length > 0) { |
| | | var couponIds = []; |
| | | layui.each(couponRuleList, function (key, item) { |
| | | couponIds.push(item.id) |
| | | }); |
| | | data.field.couponIds=couponIds; |
| | | } |
| | | data.field.goodsType=1; |
| | | data.field.mailGoodsSkuDto = tableSkuData; |
| | | data.field.delSkuId=delSku; |
New file |
| | |
| | | <style> |
| | | #coupon-select { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #coupon-select .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #coupon-select #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #coupon-select .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | #coupon-select img{ |
| | | max-width:100px |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="coupon-select"> |
| | | <form class="layui-form" action="" lay-filter="coupon-select-form"> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">用户id:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="id" data-th-value="${adminCouponSelectVo.id}"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">优惠卷:</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="couponId" class="coupon-select-category" id="couponCategarySelect"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="coupon-select-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate','upload'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | adminCouponSelectVo = [[${adminCouponSelectVo}]], |
| | | $view = $('#coupon-select'), |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | formSelects.render(); |
| | | |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/goods/coupon/tree', function (data) { |
| | | for (var k in data) |
| | | { |
| | | $(".coupon-select-category").append("<option value='" + data[k].couponId + "'>" + data[k].couponName + "</option>"); |
| | | } |
| | | layui.use('form', function () { |
| | | var form = layui.form; |
| | | $("#couponCategarySelect").val('') |
| | | form.render(); |
| | | }); |
| | | }); |
| | | initUserValue(); |
| | | |
| | | function initUserValue() { |
| | | form.val("coupon-select-form", { |
| | | "id": adminCouponSelectVo.id, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(coupon-select-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/mallMember/salemanCoupon', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('操作成功'); |
| | | $('#febs-saleman-rule').find('#reset').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchDirector"> |
| | | {{# } }} |
| | | </script> |
| | | |
| | | <script type="text/html" id="isSalesmanSwitch"> |
| | | {{# if(d.isSale === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="isSalesmanSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="isSalesmanSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <style> |
| | | .layui-form-onswitch { |
| | | background-color: #5FB878 !important; |
| | |
| | | table.on('tool(userTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'memberOut') { |
| | | febs.modal.confirm('注销', '确认注销该账号?', function () { |
| | | memberOut(data.id); |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'close') { |
| | | febs.modal.confirm('禁用', '确认禁用该账号?', function () { |
| | |
| | | } |
| | | |
| | | }); |
| | | function memberOut(id) { |
| | | febs.get(ctx + 'admin/mallMember/memberOut/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function closeAccount(id) { |
| | | febs.get(ctx + 'admin/mallMember/closeAccount/' + id, null, function () { |
| | | febs.alert.success('禁用成功'); |
| | |
| | | }); |
| | | } |
| | | |
| | | form.on('switch(isSalesmanSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | upSale(data.value); |
| | | } else { |
| | | downSale(data.value); |
| | | } |
| | | }) |
| | | |
| | | function upSale(id) { |
| | | febs.get(ctx + 'admin/mallMember/upSale/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function downSale(id) { |
| | | febs.get(ctx + 'admin/mallMember/downSale/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | |
| | | {field: 'referrerName', title: '推荐人', minWidth: 100,align:'left'}, |
| | | {field: 'levelName', title: '会员类型', minWidth: 100,align:'left'}, |
| | | // {field: 'referrerName', title: '推荐人', minWidth: 100,align:'left'}, |
| | | // {field: 'storeMaster', title: '店长', templet:'#switchStoreMaster', minWidth: 100}, |
| | | {field: 'isSalesman', title: '推销员设置', templet: '#isSalesmanSwitch', minWidth: 100,align:'center'}, |
| | | // {field: 'director', title: '总监', templet:'#switchDirector', minWidth: 100}, |
| | | // {field: 'accountType', title: '账号类型', |
| | | // templet: function (d) { |
| | |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | return '' |
| | | // '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="moneyFlow" shiro:hasPermission="user:update">资金流水</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="memberOut" shiro:hasPermission="user:update">注销</button>' |
| | | // + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="addLeader" shiro:hasPermission="user:update">设置为团长</button>' |
| | | |
| | | },minWidth: 200,align:'center'} |
copy from src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html
copy to src/main/resources/templates/febs/views/modules/mallMember/memberSaleman.html
File was copied from src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-coupon-rule" lay-title="优惠卷管理"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-saleman-rule" lay-title="推销员管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="coupon-table-form"> |
| | | <form class="layui-form layui-table-form" lay-filter="saleman-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add"> |
| | | 新增 |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">用户昵称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="用户昵称" name="name" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">手机号码</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" placeholder="手机号码" name="account" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="couponRuleTable" lay-data="{id: 'couponRuleTable'}"></table> |
| | | <table lay-filter="salemanRuleTable" lay-data="{id: 'salemanRuleTable'}"></table> |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-coupon-rule'), |
| | | $view = $('#febs-saleman-rule'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | |
| | | initTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(couponRuleTable)', function (obj) { |
| | | table.on('tool(salemanRuleTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'carriageRuleDel') { |
| | | febs.modal.confirm('删除', '确认删除['+data.name+']运费模板?', function () { |
| | | carriageRuleDel(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'carriageRuleUpdate') { |
| | | febs.modal.open('运费模板编辑', 'modules/goods/carriageRuleUpdate/' + data.id, { |
| | | if (layEvent === 'couponUpdate') { |
| | | febs.modal.open('绑定优惠卷', 'modules/mallMember/couponSelect/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-coupon-rule-update').find('#submit').trigger('click'); |
| | | $('#coupon-select').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | |
| | | }); |
| | | } |
| | | }); |
| | | function carriageRuleDel(id) { |
| | | febs.get(ctx + 'admin/goods/carriageRuleDel/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | $add.on('click', function () { |
| | | febs.modal.open('运费模板新增', 'modules/goods/carriageRuleAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-coupon-rule-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'couponRuleTable', |
| | | url: ctx + 'admin/goods/couponRuleList', |
| | | id: 'salemanRuleTable', |
| | | url: ctx + 'admin/mallMember/getsalemanRuleList', |
| | | cols: [[ |
| | | {field: 'name', title: '名称', minWidth: 200,align:'left'}, |
| | | {field: 'costAmount', title: '满足金额', minWidth: 200,align:'left'}, |
| | | {field: 'realAmount', title: '减免金额', minWidth: 200,align:'left'}, |
| | | {field: 'expireDay', title: '过期天数', minWidth: 200,align:'left'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 140,align:'left'}, |
| | | {field: 'phone', title: '手机号码', minWidth: 150,align:'left'}, |
| | | {field: 'name', title: '用户昵称', minWidth: 100,align:'left'}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left'}, |
| | | {field: 'couponName', title: '优惠卷名称', minWidth: 100,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | return '' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="carriageRuleUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="carriageRuleDel" shiro:hasPermission="user:update">删除</button>' |
| | | |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="couponUpdate" shiro:hasPermission="user:update">绑定优惠卷</button>' |
| | | },minWidth: 160,align:'center'} |
| | | ]] |
| | | }); |
| | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | account: $searchForm.find('input[name="account"]').val().trim(), |
| | | }; |
| | | } |
| | | |