From e033f8a6f821cdb06bbf17e5f10da2d8a8d7297e Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Tue, 17 May 2022 21:45:39 +0800 Subject: [PATCH] fix score orderList and flowList and editor --- src/main/resources/templates/febs/views/modules/score/moneyFlowList.html | 127 +++++++++++++++ src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java | 12 + src/main/resources/templates/febs/views/modules/score/goodsUpdate.html | 29 +++ src/main/resources/templates/index.html | 4 src/main/resources/templates/febs/views/modules/score/orderList.html | 215 ++++++++++++++++++++++++++ src/main/java/cc/mrbird/febs/mall/dto/MallOrderInfoDto.java | 2 src/main/resources/mapper/modules/MallOrderInfoMapper.xml | 3 src/main/resources/mapper/modules/MallMoneyFlowMapper.xml | 3 src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html | 2 src/main/resources/templates/febs/views/modules/order/orderList.html | 2 src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowListDto.java | 2 src/main/resources/templates/febs/views/modules/score/goodsAdd.html | 42 +++-- 12 files changed, 420 insertions(+), 23 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java index a650d9e..dd05b26 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewScoreController.java @@ -59,4 +59,16 @@ model.addAttribute("scoreGoods", mallGoods); return FebsUtil.view("modules/score/goodsUpdate"); } + + @GetMapping(value = "/order/list") + @RequiresPermissions("score:order:list") + public String orderList() { + return FebsUtil.view("modules/score/orderList"); + } + + @GetMapping(value = "/flow/list") + @RequiresPermissions("score:flow:view") + public String scoreFlow() { + return FebsUtil.view("modules/score/moneyFlowList"); + } } diff --git a/src/main/java/cc/mrbird/febs/mall/dto/MallOrderInfoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/MallOrderInfoDto.java index abb113d..9c40105 100644 --- a/src/main/java/cc/mrbird/febs/mall/dto/MallOrderInfoDto.java +++ b/src/main/java/cc/mrbird/febs/mall/dto/MallOrderInfoDto.java @@ -22,4 +22,6 @@ private String orderNo; private String name; + + private Integer orderType; } diff --git a/src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowListDto.java b/src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowListDto.java index 3083b01..4f9560b 100644 --- a/src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowListDto.java +++ b/src/main/java/cc/mrbird/febs/mall/dto/MoneyFlowListDto.java @@ -13,4 +13,6 @@ private Integer type; + private Integer flowType; + } diff --git a/src/main/resources/mapper/modules/MallMoneyFlowMapper.xml b/src/main/resources/mapper/modules/MallMoneyFlowMapper.xml index b29b561..183418b 100644 --- a/src/main/resources/mapper/modules/MallMoneyFlowMapper.xml +++ b/src/main/resources/mapper/modules/MallMoneyFlowMapper.xml @@ -58,6 +58,9 @@ <if test="record.type!=null and record.type!=''"> and a.type like concat('%', #{record.type},'%') </if> + <if test="record.flowType!=null and record.flowType!=''"> + and a.flow_type like concat('%', #{record.flowType},'%') + </if> </if> </where> order by a.created_time desc diff --git a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml index eca247a..7ba6277 100644 --- a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml +++ b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml @@ -19,6 +19,9 @@ <if test="record.payResult != null and record.payResult != ''"> and a.pay_result = #{record.payResult} </if> + <if test="record.orderType != null"> + and a.order_type = #{record.orderType} + </if> <if test="record.status != null and record.status != ''"> and a.status = #{record.status} </if> diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html index 200bb4a..3174f0f 100644 --- a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html +++ b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html @@ -576,8 +576,6 @@ $('#demo2').append('<img src="' + goodsInfo.thumb + '" alt="" class="layui-upload-img" style="width: 100px">') - console.log(goodsInfo.goodsDetails); - window.editor = E.createEditor({ html: goodsInfo.goodsDetails, selector: '#editor-container', diff --git a/src/main/resources/templates/febs/views/modules/order/orderList.html b/src/main/resources/templates/febs/views/modules/order/orderList.html index 292174c..f9fe296 100644 --- a/src/main/resources/templates/febs/views/modules/order/orderList.html +++ b/src/main/resources/templates/febs/views/modules/order/orderList.html @@ -170,7 +170,7 @@ tableIns = febs.table.init({ elem: $view.find('table'), id: 'orderTable', - url: ctx + 'admin/order/orderList', + url: ctx + 'admin/order/orderList?orderType=1', cols: [[ {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left'}, {field: 'memberName', title: '购买人', minWidth: 120,align:'left'}, diff --git a/src/main/resources/templates/febs/views/modules/score/goodsAdd.html b/src/main/resources/templates/febs/views/modules/score/goodsAdd.html index 8d83186..9e5facf 100644 --- a/src/main/resources/templates/febs/views/modules/score/goodsAdd.html +++ b/src/main/resources/templates/febs/views/modules/score/goodsAdd.html @@ -116,7 +116,11 @@ <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">商品详情:</label> <div class="layui-input-block"> - <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea> +<!-- <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea>--> + <div style="border: 1px solid #ccc;"> + <div id="toolbar-container" style="border-bottom: 1px solid #ccc;"></div> + <div id="editor-container" style="height: 450px;"></div> + </div> </div> </div> <div class="layui-form-item febs-hide"> @@ -203,27 +207,31 @@ } }); - layedit.set({ //设置图片接口 - uploadImage: { - url: 'admin/goods/uploadFileBase64', //接口url - type: 'post', - } + var E = window.wangEditor; + const editorConfig = { MENU_CONF: {} }; + editorConfig.MENU_CONF['uploadImage'] = { + server: '/admin/goods/uploadFileBase64', + fieldName : "file", + customInsert(res, insertFn) { + insertFn(res.data.src, res.data.title, '') + }, + } + + const editor = E.createEditor({ + selector: '#editor-container', + config : editorConfig, + mode: 'default' }); - //创建一个编辑器 - var index = layedit.build('lay_edit',{ - height: 300 - }); - //提交时把值同步到文本域中 - form.verify({ - //content富文本域中的lay-verify值 - goodsDetails: function(value) { - return layedit.sync(index); - } + + const toolbar = E.createToolbar({ + editor, + selector: '#toolbar-container', + mode: 'default' }); form.on('submit(score-goods-add-form-submit)', function (data) { data.field.goodsType = 2; - + data.field.goodsDetails = editor.getHtml(); $.ajax({ 'url':ctx + 'admin/goods/addMallGoods', 'type':'post', diff --git a/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html b/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html index 36dffe4..5b39b1f 100644 --- a/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html +++ b/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html @@ -117,7 +117,11 @@ <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">商品详情:</label> <div class="layui-input-block"> - <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea> +<!-- <textarea id="lay_edit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea>--> + <div style="border: 1px solid #ccc;"> + <div id="toolbar-container" style="border-bottom: 1px solid #ccc;"></div> + <div id="editor-container" style="height: 450px;"></div> + </div> </div> </div> <div class="layui-form-item febs-hide"> @@ -146,6 +150,16 @@ laydate.render({ elem: '#febs-form-group-date' }); + + var E = window.wangEditor; + const editorConfig = { MENU_CONF: {} }; + editorConfig.MENU_CONF['uploadImage'] = { + server: '/admin/goods/uploadFileBase64', + fieldName : "file", + customInsert(res, insertFn) { + insertFn(res.data.src, res.data.title, '') + }, + } //普通图片上传 upload.render({ @@ -244,6 +258,19 @@ } $('#demo2').append('<img src="' + goodsInfo.thumb + '" alt="" class="layui-upload-img" style="width: 100px">') + + window.editor = E.createEditor({ + html: goodsInfo.goodsDetails, + selector: '#editor-container', + config : editorConfig, + mode: 'default' + }); + + window.toolbar = E.createToolbar({ + editor, + selector: '#toolbar-container', + mode: 'default' + }); } form.on('submit(score-goods-update-form-submit)', function (data) { diff --git a/src/main/resources/templates/febs/views/modules/score/moneyFlowList.html b/src/main/resources/templates/febs/views/modules/score/moneyFlowList.html new file mode 100644 index 0000000..4d14b9f --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/score/moneyFlowList.html @@ -0,0 +1,127 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-money-flow" 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-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input type="text" placeholder="用户名" name="name" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input type="text" placeholder="手机号" name="phone" 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"> + <select name="type"> + <option value="">请选择</option> + <option value="10">支付</option> + <option value="11">退款</option> + <option value="12">佣金转竞猜积分</option> + <option value="14">签到</option> + </select> + </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 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="moneyFlowTable" lay-data="{id: 'moneyFlowTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 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-money-flow'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initTable(); + + // 初始化表格操作栏各个按钮功能 + table.on('tool(moneyFlowTable)', function (obj) { + var data = obj.data, + layEvent = obj.event; + }); + + // 查询按钮 + $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}); + }); + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'moneyFlowTable', + url: ctx + 'admin/mallMember/getMoneyFlowList?flowType=3', + cols: [[ + {field: 'name', title: '名称', minWidth: 100,align:'left'}, + {field: 'phone', title: '账号', minWidth: 150,align:'left'}, + {field: 'bindPhone', title: '手机号', minWidth: 150,align:'left'}, + {field: 'amount', title: '金额', minWidth: 150,align:'left'}, + {field: 'type', title: '流水类型', + templet: function (d) { + if (d.type === 10) { + return '<span>支付</span>' + }else if (d.type === 11) { + return '<span>退款</span>' + }else if (d.type === 12){ + return '<span>佣金转竞猜积分</span>' + }else if (d.type === 14){ + return '<span>签到</span>' + } + }, minWidth: 80,align:'center'}, + {field: 'orderNo', title: '订单编号', minWidth: 150,align:'left'}, + {field: 'createdTime', title: '创建时间', minWidth: 180,align:'center'} + ]] + }); + } + + // 获取查询参数 + function getQueryParams() { + return { + name: $searchForm.find('input[name="name"]').val().trim(), + phone: $searchForm.find('input[name="phone"]').val().trim(), + type: $searchForm.find("select[name='type']").val(), + }; + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/score/orderList.html b/src/main/resources/templates/febs/views/modules/score/orderList.html new file mode 100644 index 0000000..6c7918b --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/score/orderList.html @@ -0,0 +1,215 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-score-order" 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="score-order-table-form"> + <div class="layui-form-item"> + <div class="layui-col-md10"> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input type="text" placeholder="用户名" name="name" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input type="text" placeholder="订单编号" name="orderNo" 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"> + <select name="status"> + <option value="">请选择</option> + <option value="1">待支付</option> + <option value="2">待发货</option> + <option value="3">待收货</option> + <option value="4">已完成</option> + <option value="5">退款中</option> + <option value="6">已退款</option> + <option value="7">已取消</option> + </select> + </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 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="orderTable" lay-data="{id: 'orderTable'}"></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 + } + </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"></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-score-order'), + $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(orderTable)', function (obj) { + var data = obj.data, + layEvent = obj.event; + if (layEvent === 'deliverGoods') { + febs.modal.open('发货', 'modules/order/deliverGoods/' + data.id, { + btn: ['确认', '取消'], + yes: function (index, layero) { + $('#deliver-update').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + if (layEvent === 'seeOrder') { + febs.modal.open( '订单详情', 'modules/order/orderDetail/' + data.id, { + maxmin: true, + }); + } + if (layEvent === 'cancelOrder') { + febs.modal.confirm('取消订单', '确认取消订单?', function () { + cancelOrder(data.id); + }); + } + if (layEvent === 'seePayImage') { + var t = $view.find('#seePayImage'+data.id+''); + //页面层 + layer.open({ + type: 1, + title: "支付凭证", + skin: 'layui-layer-rim', //加上边框 + area: ['80%', '80%'], //宽高 + shadeClose: true, //开启遮罩关闭 + end: function (index, layero) { + return false; + }, + content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' + }); + } + }); + + function cancelOrder(id) { + febs.get(ctx + 'admin/order/cancelOrder/' + 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.view.tab.change("/modules/goods/goodsAddNew/"); + }); + + function initTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'orderTable', + url: ctx + 'admin/order/orderList?orderType=2', + cols: [[ + {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left'}, + {field: 'memberName', title: '购买人', minWidth: 120,align:'left'}, + {field: 'memberPhone', title: '账号', minWidth: 120,align:'left'}, + {field: 'memberBindPhone', title: '联系方式', minWidth: 120,align:'left'}, + {field: 'amount', title: '支付积分', minWidth: 120,align:'left'}, + {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, + {field: 'payTime', title: '支付时间', minWidth: 200,align:'left'}, + {field: 'status', title: '状态', + templet: function (d) { + if (d.status === 1) { + return '<span style="color:red;">待支付</span>' + } else if (d.status === 2) { + return '<span style="color:blue;">待发货</span>' + }else if (d.status === 3) { + return '<span style="color:blue;">待收货</span>' + }else if (d.status === 4) { + return '<span style="color:green;">已完成</span>' + }else if (d.status === 5) { + return '<span style="color:black;">退款中</span>' + }else if (d.status === 6) { + return '<span style="color:black;">已退款</span>' + }else if (d.status === 7) { + return '<span style="color:red;">已取消</span>' + }else{ + return '' + } + }, minWidth: 80,align:'center'}, + {title: '操作', + templet: function (d) { + if (d.status === 2) { + return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="deliverGoods" shiro:hasPermission="user:update">发货</button>' + +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' + }else{ + return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' + } + },minWidth: 300,align:'center'} + ]] + }); + } + + // 获取查询参数 + function getQueryParams() { + return { + name: $searchForm.find('input[name="name"]').val().trim(), + orderNo: $searchForm.find('input[name="orderNo"]').val().trim(), + status: $searchForm.find("select[name='status']").val(), + }; + } + + }) +</script> \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 66370b5..a55caa1 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -16,8 +16,8 @@ <link rel="stylesheet" th:href="@{febs/css/formSelects-v4.css}" media="all"> <!-- 高德地图,key为演示作用,请勿滥用--> <script src="https://webapi.amap.com/maps?v=1.4.15&key=0e8a587317998a5e03cf608649b229d6&plugin=AMap.Autocomplete"></script> - <link href="https://cdn.jsdelivr.net/npm/@wangeditor/editor@latest/dist/css/style.css" rel="stylesheet"> - <script src="https://cdn.jsdelivr.net/npm/@wangeditor/editor@latest/dist/index.min.js"></script> + <link href="https://unpkg.com/@wangeditor/editor@5.0.1/dist/css/style.css" rel="stylesheet"> + <script src="https://unpkg.com/@wangeditor/editor@latest/dist/index.js"></script> <link rel="icon" th:href="@{febs/images/favicon.ico}" type="image/x-icon"/> </head> <body> -- Gitblit v1.9.1