add score goods-list and goods-add
2 files added
8 files modified
| | |
| | | } |
| | | return FebsUtil.view("modules/score/setting"); |
| | | } |
| | | |
| | | @GetMapping("goods") |
| | | public String goodsList() { |
| | | return FebsUtil.view("modules/score/goodsList"); |
| | | } |
| | | |
| | | @GetMapping("goods/add") |
| | | public String goodsAdd() { |
| | | return FebsUtil.view("modules/score/goodsAdd"); |
| | | } |
| | | } |
| | |
| | | * 是否普通商品 1-普通商品 2-套餐 |
| | | */ |
| | | private Integer isNormal; |
| | | |
| | | private BigDecimal score; |
| | | |
| | | private Integer goodsType; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "是否套餐 1-普通商品 2-套餐", example = "2") |
| | | private Integer isNormal; |
| | | |
| | | @ApiModelProperty(value = "1-付费商品 2-积分商品") |
| | | private Integer goodsType; |
| | | } |
| | |
| | | */ |
| | | private BigDecimal costPrice; |
| | | |
| | | /** |
| | | * 商品类型 1-付费商品 2-积分商品 |
| | | */ |
| | | private Integer goodsType; |
| | | |
| | | /** |
| | | * 积分 |
| | | */ |
| | | private BigDecimal score; |
| | | |
| | | @TableField(exist = false) |
| | | private List<MallGoodsStyle> styles; |
| | | |
| | |
| | | if(mallGoodsByGoodsNo > 0){ |
| | | return new FebsResponse().fail().message("商品编号不能重复"); |
| | | } |
| | | |
| | | // 付费商品 |
| | | if (addMallGoodsDto.getGoodsType() != 2) { |
| | | Long categoryId = addMallGoodsDto.getCategoryId(); |
| | | if(ObjectUtil.isEmpty(categoryId)){ |
| | | return new FebsResponse().fail().message("商品分类不能为空"); |
| | | } |
| | | |
| | | List<AddMallGoodsSkuDto> addSkus = addMallGoodsDto.getAddMallGoodsSkuDtos(); |
| | | if(CollUtil.isEmpty(addSkus)){ |
| | | return new FebsResponse().fail().message("商品规格不能为空"); |
| | |
| | | if(StrUtil.isEmpty(presentPrice)){ |
| | | return new FebsResponse().fail().message("商品规格现价不能为空"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | //新增商品 |
| | | MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto); |
| | |
| | | } |
| | | } |
| | | |
| | | if (addMallGoodsDto.getGoodsType() == 2) { |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | | |
| | | |
| | | List<AddMallGoodsSkuDto> addMallGoodsSkuDtos = addMallGoodsDto.getAddMallGoodsSkuDtos(); |
| | |
| | | mallScoreSignRecord = new MallScoreSignRecord(); |
| | | } |
| | | |
| | | System.out.println(DateUtil.between(mallScoreSignRecord.getSignTime(), new Date(), DateUnit.DAY)); |
| | | if (mallScoreSignRecord.getSignTime() != null && DateUtil.between(mallScoreSignRecord.getSignTime(), new Date(), DateUnit.DAY) == 0) { |
| | | throw new FebsException("今天已签到"); |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsVo", description = "信息返回类") |
| | | public class AdminMallGoodsVo { |
| | |
| | | private Integer skuVolume; |
| | | |
| | | private Integer stock; |
| | | |
| | | private BigDecimal score; |
| | | } |
| | |
| | | <if test="record.isNormal != null and record.isNormal != ''"> |
| | | and a.is_normal = #{record.isNormal} |
| | | </if> |
| | | <if test="record.goodsType != null and record.goodsType != ''"> |
| | | and a.goods_type = #{record.goodsType} |
| | | </if> |
| | | <if test="record.categoryId != null and record.categoryId != ''"> |
| | | and (c.id = #{record.categoryId} or c.parent_id=#{record.categoryId}) |
| | | </if> |
| | |
| | | a.original_price, |
| | | a.present_price, |
| | | a.is_hot, |
| | | a.score, |
| | | b.name categaryName, |
| | | sum(c.sku_volume) skuVolume, |
| | | sum(c.stock) stock |
| | | IFNULL(sum(c.sku_volume), a.volume) skuVolume, |
| | | IFNULL(sum(c.stock), a.stock) stock |
| | | from mall_goods a |
| | | left join mall_goods_category b on b.id = a.category_id |
| | | left join mall_goods_sku c on c.goods_id = a.id |
| | |
| | | <if test="record.goodsName != null and record.goodsName != ''"> |
| | | and a.goods_name like CONCAT('%', CONCAT(#{record.goodsName}, '%')) |
| | | </if> |
| | | <if test="record.goodsType != null and record.goodsType != ''"> |
| | | and a.goods_type=#{record.goodsType} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | group by a.id |
New file |
| | |
| | | <style> |
| | | #score-goods-add { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #score-goods-add .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #score-goods-add #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #score-goods-add .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | .layui-upload-img{ |
| | | max-width: 300px; |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="score-goods-add"> |
| | | <form class="layui-form" action="" lay-filter="score-goods-add-form"> |
| | | <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="goodsName" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">商品编号:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="goodsNo" 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="originalPrice" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">兑换积分:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="score" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="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="stock" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">销量:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="volume" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">商品介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <label> |
| | | <textarea name="goodsIntrodution" rows="5" autocomplete="off" class="layui-textarea" ></textarea> |
| | | </label> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">缩略图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn" id="test2">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="demo2"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">缩略图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="thumb" name="thumb" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">轮播图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="thumbsBanner">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="thumbsBanners"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label">缩略图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="thumbs" lay-verify="required" name="thumbs" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | |
| | | <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> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="score-goods-add-form-submit" id="submit"></button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'laydate','layedit','upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | member = [[${member}]], |
| | | $view = $('#score-goods-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | formSelects.render(); |
| | | |
| | | formSelects.config('user-add-goods', { |
| | | searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | beforeSuccess: function (id, url, searchVal, result) { |
| | | var data = result.data; |
| | | var tranData = []; |
| | | for (var i = 0; i < data.length; i++) { |
| | | tranData.push({ |
| | | name: data[i].name, |
| | | value: data[i].id |
| | | }) |
| | | } |
| | | result.data = tranData; |
| | | return result; |
| | | }, |
| | | success: function () { |
| | | // formSelects.value('user-add-goods', result.id); |
| | | }, |
| | | error: function (id, url, searchVal, err) { |
| | | console.error(err); |
| | | febs.alert.error('获取分类列表失败'); |
| | | } |
| | | }); |
| | | |
| | | //普通图片上传 |
| | | upload.render({ |
| | | elem: '#skuImg' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#skuImgs').attr('src', result); //图片链接(base64) |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | febs.alert.success(res.data.src); |
| | | $("#skuImage").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //多图片上传 |
| | | upload.render({ |
| | | elem: '#test2' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,multiple: true |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | var thumbs = $("#thumb").val(); |
| | | if(thumbs == ''){ |
| | | $("#thumb").val(res.data.src); |
| | | }else{ |
| | | $("#thumb").val(thumbs + ',' + res.data.src); |
| | | } |
| | | // alert($("#thumb").val()); |
| | | } |
| | | }); |
| | | |
| | | upload.render({ |
| | | elem: '#thumbsBanner' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,multiple: true |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#thumbsBanners').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width: 100px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | var thumbs = $("#thumbs").val(); |
| | | if(thumbs == ''){ |
| | | $("#thumbs").val(res.data.src); |
| | | }else{ |
| | | $("#thumbs").val(thumbs + ',' + res.data.src); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | layedit.set({ //设置图片接口 |
| | | uploadImage: { |
| | | url: 'admin/goods/uploadFileBase64', //接口url |
| | | type: 'post', |
| | | } |
| | | }); |
| | | //创建一个编辑器 |
| | | var index = layedit.build('lay_edit',{ |
| | | height: 300 |
| | | }); |
| | | //提交时把值同步到文本域中 |
| | | form.verify({ |
| | | //content富文本域中的lay-verify值 |
| | | goodsDetails: function(value) { |
| | | return layedit.sync(index); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(score-goods-add-form-submit)', function (data) { |
| | | data.field.goodsType = 2; |
| | | // febs.post(ctx + 'admin/goods/addMallGoods', data.field, function () { |
| | | // layer.closeAll(); |
| | | // febs.alert.success('新增成功'); |
| | | // $('#febs-score-goods').find('#query').click(); |
| | | // }); |
| | | |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/goods/addMallGoods', |
| | | '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==0){ |
| | | layer.closeAll(); |
| | | febs.alert.success('新增成功'); |
| | | $('#febs-score-goods').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-score-goods" 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-goods-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="goodsName" 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-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="scoreGoodsTable" lay-data="{id: 'scoreGoodsTable'}"></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-goods'), |
| | | $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(scoreGoodsTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'downGoods') { |
| | | febs.modal.confirm('下架', '确认下架该商品?', function () { |
| | | downGoods(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'upGoods') { |
| | | febs.modal.confirm('上架', '确认上架该商品?', function () { |
| | | upGoods(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'delGoods') { |
| | | febs.modal.confirm('删除', '确认删除该商品?', function () { |
| | | delGoods(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'detailGoods') { |
| | | febs.modal.open( '商品详情', 'modules/goods/detailGoods/' + data.id, { |
| | | maxmin: true, |
| | | }); |
| | | } |
| | | if (layEvent === 'goodsUpdate') { |
| | | febs.modal.open('编辑', 'modules/goods/goodsUpdateNew/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#goods-updatenew').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | if (layEvent === 'seeImgThumb') { |
| | | var t = $view.find('#seeImgThumb'+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 downGoods(id) { |
| | | febs.get(ctx + 'admin/goods/downMallGoods/' + id, null, function () { |
| | | febs.alert.success('下架成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function delGoods(id) { |
| | | febs.get(ctx + 'admin/goods/delMallGoods/' + id, null, function () { |
| | | febs.alert.success('删除成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function upGoods(id) { |
| | | febs.get(ctx + 'admin/goods/upMallGoods/' + 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/score/goods/add', { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#score-goods-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | // return false; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'scoreGoodsTable', |
| | | url: ctx + 'admin/goods/goodsList?goodsType=2', |
| | | cols: [[ |
| | | {field: 'goodsNo', title: '商品编号', minWidth: 150,align:'left'}, |
| | | {field: 'goodsName', title: '商品名称', minWidth: 150,align:'left'}, |
| | | {field: 'thumb', title: '缩略图', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImgThumb"><img id="seeImgThumb'+d.id+'" src="'+d.thumb+'" alt=""></a>'; |
| | | }, minWidth: 150,align:'center'}, |
| | | {field: 'isSale', title: '是否上架', |
| | | templet: function (d) { |
| | | if (d.isSale === 1) { |
| | | return '<span>上架</span>' |
| | | } else if (d.isSale === 2) { |
| | | return '<span>下架</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'score', title: '兑换积分', minWidth: 150,align:'left'}, |
| | | {field: 'originalPrice', title: '原价', minWidth: 150,align:'left'}, |
| | | {field: 'stock', title: '商品库存', minWidth: 150,align:'left'}, |
| | | {field: 'skuVolume', title: '商品销量', minWidth: 150,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if (d.isSale === 1) { |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-orange" lay-event="downGoods" shiro:hasPermission="user:update">下架</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detailGoods" shiro:hasPermission="user:update">详情</button>' |
| | | }else{ |
| | | return '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-green" lay-event="upGoods" shiro:hasPermission="user:update">上架</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="goodsUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="delGoods" shiro:hasPermission="user:update">删除</button>' |
| | | |
| | | } |
| | | },minWidth: 160,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | goodsName: $searchForm.find('input[name="goodsName"]').val().trim(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |