xiaoyong931011
2023-09-07 36f5cf295fa7f425fa80c9f329e747c48ffeae63
优惠卷列表
4 files added
4 files modified
240 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java 14 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/ViewMallGoodsController.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsCoupon.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsCouponMapper.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java 8 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsCouponMapper.xml 10 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html 161 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/AdminMallGoodsController.java
@@ -8,10 +8,7 @@
import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
import cc.mrbird.febs.common.utils.OssUtils;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.entity.MallCarriageRule;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsCategory;
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;
@@ -286,5 +283,14 @@
        return new FebsResponse().success().data(adminMallGoodsService.findAllCarriageRuleTree());
    }
    /**
     * 优惠卷列表
     */
    @GetMapping("couponRuleList")
    public FebsResponse couponRuleList(MallGoodsCoupon mallGoodsCoupon, QueryRequest request) {
        Map<String, Object> data = getDataTable(adminMallGoodsService.getMallGoodsCouponListInPage(mallGoodsCoupon, request));
        return new FebsResponse().success().data(data);
    }
}
src/main/java/cc/mrbird/febs/mall/controller/ViewMallGoodsController.java
@@ -168,4 +168,13 @@
        model.addAttribute("carriageRule", adminMallCarriageRuleVo);
        return FebsUtil.view("modules/goods/carriageRuleUpdate");
    }
    /**
     * 优惠卷列表
     */
    @GetMapping("goodsCouponList")
    @RequiresPermissions("goodsCouponList:view")
    public String goodsCouponList() {
        return FebsUtil.view("modules/goods/goodsCoupon");
    }
}
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsCoupon.java
New file
@@ -0,0 +1,22 @@
package cc.mrbird.febs.mall.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("mall_goods_coupon")
public class MallGoodsCoupon extends BaseEntity {
    private String name;
    //过期天数
    private Integer expireDay;
    //满1000减100,满0减50;
    //满足金额
    private BigDecimal costAmount;
    //减免金额
    private BigDecimal realAmount;
}
src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsCouponMapper.java
New file
@@ -0,0 +1,13 @@
package cc.mrbird.febs.mall.mapper;
import cc.mrbird.febs.mall.entity.MallGoodsCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
public interface MallGoodsCouponMapper extends BaseMapper<MallGoodsCoupon> {
    IPage<MallGoodsCoupon> selectMallGoodsCouponListInPage(Page<MallGoodsCoupon> page, @Param("record")MallGoodsCoupon mallGoodsCoupon);
}
src/main/java/cc/mrbird/febs/mall/service/IAdminMallGoodsService.java
@@ -6,6 +6,7 @@
import cc.mrbird.febs.mall.entity.MallCarriageRule;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsCategory;
import cc.mrbird.febs.mall.entity.MallGoodsCoupon;
import cc.mrbird.febs.mall.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -53,4 +54,6 @@
    FebsResponse carriageRuleUpdate(AdminCarriageRuleUpdateDto adminCarriageRuleUpdateDto);
    List<MallCarriageRule> findAllCarriageRuleTree();
    IPage<MallGoodsCoupon> getMallGoodsCouponListInPage(MallGoodsCoupon mallGoodsCoupon, QueryRequest request);
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -42,6 +42,7 @@
    private final MallShoppingCartMapper mallShoppingCartMapper;
    private final MallCarriageRuleMapper mallCarriageRuleMapper;
    private final MallCarriageRuleInfoMapper mallCarriageRuleInfoMapper;
    private final MallGoodsCouponMapper mallGoodsCouponMapper;
    @Override
    public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) {
@@ -799,4 +800,11 @@
        List<MallCarriageRule> mallCarriageRules = mallCarriageRuleMapper.selectList(new QueryWrapper<>());
        return mallCarriageRules;
    }
    @Override
    public IPage<MallGoodsCoupon> getMallGoodsCouponListInPage(MallGoodsCoupon mallGoodsCoupon, QueryRequest request) {
        Page<MallGoodsCoupon> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<MallGoodsCoupon> mallGoodsCouponIPage = mallGoodsCouponMapper.selectMallGoodsCouponListInPage(page, mallGoodsCoupon);
        return mallGoodsCouponIPage;
    }
}
src/main/resources/mapper/modules/MallGoodsCouponMapper.xml
New file
@@ -0,0 +1,10 @@
<?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.MallGoodsCouponMapper">
    <select id="selectMallGoodsCouponListInPage" resultType="cc.mrbird.febs.mall.entity.MallGoodsCoupon">
        select a.*
        from mall_goods_coupon a
        order by a.created_time desc
    </select>
</mapper>
src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html
New file
@@ -0,0 +1,161 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-coupon-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">
                        <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">&#xe848;</i>
                                </div>
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
                                    <i class="layui-icon">&#xe79b;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="couponRuleTable" lay-data="{id: 'couponRuleTable'}"></table>
                    <style type="text/css">
                        .layui-table-cell{
                            text-align:center;
                            height: auto;
                            white-space: nowrap; /*文本不会换行,在同一行显示*/
                            overflow: hidden; /*超出隐藏*/
                            text-overflow: ellipsis; /*省略号显示*/
                        }
                        .layui-table img{
                            max-width:100px
                        }
                        ::-webkit-scrollbar {
                            height: 20px !important;
                            background-color: #f4f4f4;
                        }
                    </style>
                </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">&#xe7a5;</i></a>
</script>
<style>
    .layui-form-onswitch {
        background-color: #5FB878 !important;
    }
</style>
<!-- 表格操作栏 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-coupon-rule'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
            $add = $view.find('#add'),
            sortObject = {field: 'phone', type: null},
            tableIns;
        form.render();
        // 表格初始化
        initTable();
        // 初始化表格操作栏各个按钮功能
        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 === 'carriageRuleUpdate') {
                febs.modal.open('运费模板编辑', 'modules/goods/carriageRuleUpdate/' + data.id, {
                    btn: ['提交', '取消'],
                    area:['100%','100%'],
                    yes: function (index, layero) {
                        $('#febs-coupon-rule-update').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: 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/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',
                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'},
                    {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>'
                        },minWidth: 160,align:'center'}
                ]]
            });
        }
        // 获取查询参数
        function getQueryParams() {
            return {
            };
        }
    })
</script>