6 files added
14 files modified
| | |
| | | import cc.mrbird.febs.mall.entity.MallGoods; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | |
| | | return adminMallGoodsService.updateMallGoods(mallGoodsUpdateDto); |
| | | } |
| | | |
| | | /** |
| | | * 商品-全部选择 |
| | | */ |
| | | @GetMapping("goods/allTree") |
| | | @ControllerEndpoint(exceptionMessage = "获取商品失败") |
| | | public List<AdminMallGoodsTreeVo> getAllGoodsTree(){ |
| | | return adminMallGoodsService.getAllGoodsTree(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.AppVersion; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.vo.AdminAgentLevelOptionTreeVo; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 代理列表---激活 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("activateAccount/{id}") |
| | | @ControllerEndpoint(operation = "代理列表---激活", exceptionMessage = "操作失败") |
| | | public FebsResponse activateAccount(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return mallMemberService.activateAccount(id); |
| | | } |
| | | |
| | | /** |
| | | * 奖励设置-列表 |
| | | * @param rankAwardDto |
| | | * @param request |
| | |
| | | return mallMemberService.updateAppVersion(appVersion); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-列表 |
| | | * @param mallNewsInfo |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @GetMapping("getNewInfoList") |
| | | public FebsResponse getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(mallMemberService.getNewInfoList(mallNewsInfo, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-新增 |
| | | */ |
| | | @PostMapping("addNewsInfo") |
| | | @ControllerEndpoint(operation = " 新闻中心-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) { |
| | | return mallMemberService.addNewsInfo(mallNewsInfoDto); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-删除 |
| | | */ |
| | | @GetMapping("delNewsInfo/{id}") |
| | | @ControllerEndpoint(operation = " 新闻中心-删除", exceptionMessage = "操作失败") |
| | | public FebsResponse delNewsInfo(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return mallMemberService.delNewsInfo(id); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-更新 |
| | | */ |
| | | @PostMapping("updateNewsInfo") |
| | | @ControllerEndpoint(operation = "新闻中心-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse updateNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) { |
| | | return mallMemberService.updateNewsInfo(mallNewsInfoDto); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.entity.AppVersion; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | return FebsUtil.view("modules/mallMember/appVerSionUpdate"); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("newsInfoList") |
| | | @RequiresPermissions("newsInfoList:view") |
| | | public String newsInfoList() { |
| | | return FebsUtil.view("modules/mallMember/newsInfoList"); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-新增 |
| | | * @return |
| | | */ |
| | | @GetMapping("newsInfoAdd") |
| | | @RequiresPermissions("newsInfoAdd:add") |
| | | public String newsInfoAdd() { |
| | | return FebsUtil.view("modules/mallMember/newsInfoAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 新闻中心-详情 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("newsInfoUpdate/{id}") |
| | | @RequiresPermissions("newsInfoUpdate:update") |
| | | public String newsInfoUpdate(@PathVariable long id, Model model) { |
| | | MallNewsInfo data = mallMemberService.getNewsInfoById(id); |
| | | model.addAttribute("newsInfo", data); |
| | | return FebsUtil.view("modules/mallMember/newsInfoUpdate"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "MallNewsInfoDto", description = "参数接收类") |
| | | public class MallNewsInfoDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String title; |
| | | |
| | | private String content; |
| | | |
| | | private Long goodsId; |
| | | /** |
| | | * 1-文章2-跳转到产品 |
| | | */ |
| | | private Integer type; |
| | | |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.mall.dto.MallGoodsQueryDto; |
| | | import cc.mrbird.febs.mall.entity.MallGoods; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsVo; |
| | | import cc.mrbird.febs.mall.vo.MallGoodsListVo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | List<MallGoods> selectMallGoodsByCategaryId(@Param("categaryId")Long id); |
| | | |
| | | AdminMailGoodsUpdateVo getMallGoodsUpdateInfoById(@Param("id")long id); |
| | | |
| | | List<AdminMallGoodsTreeVo> getAllGoodsTree(); |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallNewsInfoVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | public interface MallNewsInfoMapper extends BaseMapper<MallNewsInfo> { |
| | | |
| | | IPage<AdminMallNewsInfoVo> getNewInfoListInPage(Page<AdminMallNewsInfoVo> page, MallNewsInfo mallNewsInfo); |
| | | |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsVo; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IAdminMallGoodsService extends IService<MallGoods> { |
| | | |
| | |
| | | AdminMailGoodsUpdateVo getMallGoodsUpdateInfoById(long id); |
| | | |
| | | FebsResponse updateMallGoods(MallGoodsUpdateDto mallGoodsUpdateDto); |
| | | |
| | | List<AdminMallGoodsTreeVo> getAllGoodsTree(); |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.AppVersion; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | |
| | | AppVersion getAppVersionInfoById(long id); |
| | | |
| | | FebsResponse updateAppVersion(AppVersion appVersion); |
| | | |
| | | FebsResponse activateAccount(Long id); |
| | | |
| | | MallNewsInfo getNewsInfoById(long id); |
| | | |
| | | IPage<AdminMallNewsInfoVo> getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request); |
| | | |
| | | FebsResponse addNewsInfo(MallNewsInfoDto mallNewsInfoDto); |
| | | |
| | | FebsResponse delNewsInfo(Long id); |
| | | |
| | | FebsResponse updateNewsInfo(MallNewsInfoDto mallNewsInfoDto); |
| | | } |
| | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsTreeVo> getAllGoodsTree() { |
| | | return mallGoodsMapper.getAllGoodsTree(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.AppVersion; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.entity.MallMoneyFlow; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | private final IApiMallMemberWalletService iApiMallMemberWalletService; |
| | | |
| | | private final AppVersionMapper appVersionMapper; |
| | | |
| | | private final MallNewsInfoMapper mallNewsInfoMapper; |
| | | |
| | | @Override |
| | | public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) { |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse activateAccount(Long id) { |
| | | MallMember mallMember = mallMemberMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新页面重试"); |
| | | } |
| | | String level = mallMember.getLevel(); |
| | | if(StrUtil.isEmpty(level) || !AgentLevelEnum.ZERO_LEVEL.name().equals(mallMember.getLevel())){ |
| | | return new FebsResponse().fail().message("该用户无法激活"); |
| | | } |
| | | mallMember.setLevel(AgentLevelEnum.FIRST_LEVEL.name()); |
| | | mallMemberMapper.updateById(mallMember); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public MallNewsInfo getNewsInfoById(long id) { |
| | | return mallNewsInfoMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminMallNewsInfoVo> getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) { |
| | | Page<AdminMallNewsInfoVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminMallNewsInfoVo> adminMallNewsInfoVos = mallNewsInfoMapper.getNewInfoListInPage(page, mallNewsInfo); |
| | | return adminMallNewsInfoVos; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addNewsInfo(MallNewsInfoDto mallNewsInfoDto) { |
| | | Integer type = mallNewsInfoDto.getType(); |
| | | if(type == 2){ |
| | | Long goodsId = mallNewsInfoDto.getGoodsId()==null?0L:mallNewsInfoDto.getGoodsId(); |
| | | if(goodsId == 0L){ |
| | | return new FebsResponse().fail().message("请选择跳转的产品"); |
| | | } |
| | | } |
| | | MallNewsInfo mallNewsInfo = new MallNewsInfo(); |
| | | mallNewsInfo.setTitle(mallNewsInfoDto.getTitle()); |
| | | mallNewsInfo.setContent(mallNewsInfoDto.getContent()); |
| | | mallNewsInfo.setType(mallNewsInfoDto.getType()); |
| | | if(mallNewsInfoDto.getType() == 2){ |
| | | mallNewsInfo.setTargetId(mallNewsInfoDto.getGoodsId()); |
| | | } |
| | | mallNewsInfoMapper.insert(mallNewsInfo); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse delNewsInfo(Long id) { |
| | | MallNewsInfo mallNewsInfo = mallNewsInfoMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallNewsInfo)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新页面重试"); |
| | | } |
| | | mallNewsInfoMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateNewsInfo(MallNewsInfoDto mallNewsInfoDto) { |
| | | MallNewsInfo mallNewsInfoBefore = mallNewsInfoMapper.selectById(mallNewsInfoDto.getId()); |
| | | if(ObjectUtil.isEmpty(mallNewsInfoBefore)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新页面重试"); |
| | | } |
| | | Integer type = mallNewsInfoDto.getType(); |
| | | if(type == 2){ |
| | | Long goodsId = mallNewsInfoDto.getGoodsId()==null?0L:mallNewsInfoDto.getGoodsId(); |
| | | if(goodsId == 0L){ |
| | | return new FebsResponse().fail().message("请选择跳转的产品"); |
| | | } |
| | | } |
| | | MallNewsInfo mallNewsInfo = new MallNewsInfo(); |
| | | mallNewsInfo.setTitle(mallNewsInfoDto.getTitle()); |
| | | mallNewsInfo.setContent(mallNewsInfoDto.getContent()); |
| | | mallNewsInfo.setType(mallNewsInfoDto.getType()); |
| | | if(mallNewsInfoDto.getType() == 2){ |
| | | mallNewsInfo.setTargetId(mallNewsInfoDto.getGoodsId()); |
| | | } |
| | | mallNewsInfoMapper.insert(mallNewsInfo); |
| | | mallNewsInfoMapper.deleteById(mallNewsInfoDto.getId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsTreeVo", description = "信息返回类") |
| | | public class AdminMallGoodsTreeVo { |
| | | |
| | | private Long goodsId; |
| | | |
| | | private String goodsName; |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallNewsInfoVo", description = "信息返回类") |
| | | public class AdminMallNewsInfoVo { |
| | | |
| | | private Long id; |
| | | |
| | | private String title; |
| | | |
| | | private String content; |
| | | |
| | | private Long targetId; |
| | | |
| | | private String targetName; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createdTime; |
| | | |
| | | /** |
| | | * 1-文章2-跳转到产品 |
| | | */ |
| | | private Integer type; |
| | | } |
| | |
| | | <select id="getMallGoodsUpdateInfoById" resultType="cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo"> |
| | | select * from mall_goods a where a.id = #{id} |
| | | </select> |
| | | |
| | | <select id="getAllGoodsTree" resultType="cc.mrbird.febs.mall.vo.AdminMallGoodsTreeVo"> |
| | | select |
| | | a.id goodsId, |
| | | a.goods_name goodsName |
| | | from mall_goods a |
| | | </select> |
| | | </mapper> |
| | |
| | | <!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.MallNewsInfoMapper"> |
| | | |
| | | <select id="getNewInfoListInPage" resultType="cc.mrbird.febs.mall.vo.AdminMallNewsInfoVo"> |
| | | SELECT |
| | | a.*, |
| | | b.goods_name targetName |
| | | FROM mall_news_info a |
| | | left join mall_goods b on a.target_id = b.id |
| | | group by a.id |
| | | order by a.CREATED_TIME desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <div class="layui-input-inline"> |
| | | <select name="level"> |
| | | <option value="">请选择</option> |
| | | <option value="ZERO_LEVEL">未激活</option> |
| | | <option value="FIRST_LEVEL">普通会员</option> |
| | | <option value="SECOND_LEVEL">业务经理</option> |
| | | <option value="THIRD_LEVEL">区域代理</option> |
| | |
| | | maxmin: true, |
| | | }); |
| | | } |
| | | if (layEvent === 'activate') { |
| | | febs.modal.confirm('激活', '确认激活该账号?', function () { |
| | | activateAccount(data.id); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function activateAccount(id) { |
| | | febs.get(ctx + 'admin/mallMember/activateAccount/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | |
| | | {field: 'amount', title: '团队业绩', minWidth: 100,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if (d.level === 'ZERO_LEVEL'){ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="activate" shiro:hasPermission="user:update">激活</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agentAllMember" shiro:hasPermission="user:update">全部成员</button>' |
| | | }else{ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agentAllMember" shiro:hasPermission="user:update">全部成员</button>' |
| | | } |
| | | },minWidth: 300,align:'center'} |
| | | ]] |
| | | }); |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-appVersion" lay-title="商品分类"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-appVersion" lay-title="版本管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | |
| | | <option value="5">转账</option> |
| | | <option value="6">提现</option> |
| | | <option value="7">排名奖励</option> |
| | | <option value="8">利润分红</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | return '<span>提现</span>' |
| | | }else if (d.type === 7) { |
| | | return '<span>排名奖励</span>' |
| | | }else if (d.type === 8) { |
| | | return '<span>利润分红</span>' |
| | | }else{ |
| | | return '' |
| | | } |
New file |
| | |
| | | <style> |
| | | #newsInfo-add { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #newsInfo-add .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #newsInfo-add #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #newsInfo-add .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | #newsInfo-add img{ |
| | | max-width:100px |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="newsInfo-add"> |
| | | <form class="layui-form" action="" lay-filter="newsInfo-add-form"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">标题:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="title" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">内容:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="content" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">类型:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="type" value="1" title="文章" checked=""> |
| | | <input type="radio" name="type" value="2" title="跳转到产品"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">绑定产品:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="goodsId" class="newsInfo-add-goods" id="goodsSelect" > |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="newsInfo-add-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#newsInfo-add'), |
| | | validate = layui.validate; |
| | | |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/goods/goods/allTree', function (data) { |
| | | for (var k in data) |
| | | { |
| | | $(".newsInfo-add-goods").append("<option value='" + data[k].goodsId + "'>" + data[k].goodsName + "</option>"); |
| | | } |
| | | layui.use('form', function () { |
| | | var form = layui.form; |
| | | // $("#goodsSelect").val(mailGoodsUpdate.categoryId) |
| | | form.render(); |
| | | }); |
| | | }); |
| | | |
| | | form.render(); |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | formSelects.render(); |
| | | |
| | | form.on('submit(newsInfo-add-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/mallMember/addNewsInfo', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('操作成功'); |
| | | $('#febs-newInfo').find('#reset').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-newInfo" 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="user-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> |
| | | <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 class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="newInfoTable" lay-data="{id: 'newInfoTable'}"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="user-option"> |
| | | <span shiro:lacksPermission="user:view,user:update,user:delete"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | <a lay-event="edit" shiro:hasPermission="user:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-newInfo'), |
| | | $query = $view.find('#query'), |
| | | $add = $view.find('#add'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'phone', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(newInfoTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'newsInfoUpdate') { |
| | | febs.modal.open('编辑', 'modules/mallMember/newsInfoUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#newsInfo-update').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | if (layEvent === 'delNewsInfo') { |
| | | febs.modal.confirm('删除', '确认删除?', function () { |
| | | delNewsInfo(data.id); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function delNewsInfo(id) { |
| | | febs.get(ctx + 'admin/mallMember/delNewsInfo/' + 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: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | $add.on('click', function () { |
| | | febs.modal.open('新增', 'modules/mallMember/newsInfoAdd/', { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#newsInfo-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'newInfoTable', |
| | | url: ctx + 'admin/mallMember/getNewInfoList', |
| | | cols: [[ |
| | | {field: 'title', title: '标题', minWidth: 120,align:'center'}, |
| | | {field: 'content', title: '内容', minWidth: 120,align:'center'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 120,align:'center'}, |
| | | {field: 'type', title: '类型', |
| | | templet: function (d) { |
| | | if(d.type === 1){ |
| | | return '<span>文章</span>' |
| | | }else if(d.type === 2){ |
| | | return '<span>跳转到产品</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | | }, minWidth: 100,align:'center'}, |
| | | {field: 'targetId', title: '跳转到目标ID', minWidth: 200,align:'center'}, |
| | | {field: 'targetName', title: '跳转到目标', minWidth: 200,align:'center'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="newsInfoUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="delNewsInfo" shiro:hasPermission="user:update">删除</button>' |
| | | },minWidth: 300,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <style> |
| | | #newsInfo-update { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #newsInfo-update .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #newsInfo-update #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #newsInfo-update .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | #newsInfo-update img{ |
| | | max-width:100px |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="newsInfo-update"> |
| | | <form class="layui-form" action="" lay-filter="newsInfo-update-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="${newsInfo.id}"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">标题:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="title" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">内容:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="content" lay-verify="required" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">类型:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="type" value="1" title="文章" checked=""> |
| | | <input type="radio" name="type" value="2" title="跳转到产品"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">绑定产品:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="goodsId" class="newsInfo-update-goods" id="goodsSelectUpdate" > |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="newsInfo-update-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate'], function () { |
| | | var $ = layui.$, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | newsInfo = [[${newsInfo}]], |
| | | $view = $('#newsInfo-update'), |
| | | validate = layui.validate; |
| | | |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/goods/goods/allTree', function (data) { |
| | | for (var k in data) |
| | | { |
| | | $(".newsInfo-update-goods").append("<option value='" + data[k].goodsId + "'>" + data[k].goodsName + "</option>"); |
| | | } |
| | | layui.use('form', function () { |
| | | var form = layui.form; |
| | | $("#goodsSelectUpdate").val(newsInfo.targetId) |
| | | form.render(); |
| | | }); |
| | | }); |
| | | |
| | | form.render(); |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | formSelects.render(); |
| | | |
| | | |
| | | initUserValue(); |
| | | |
| | | function initUserValue() { |
| | | form.val("newsInfo-update-form", { |
| | | "id": newsInfo.id, |
| | | "targetId": newsInfo.targetId, |
| | | "title": newsInfo.title, |
| | | "content": newsInfo.content, |
| | | "type": newsInfo.type |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(newsInfo-update-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/mallMember/updateNewsInfo', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('操作成功'); |
| | | $('#febs-newInfo').find('#reset').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |