src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java
@@ -9,6 +9,8 @@ @ApiModel(value = "AddMallGoodsSkuDto", description = "参数接收类") public class AddMallGoodsSkuDto { private String styleName; private String skuName; private String skuImage; src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsStyleMapper.java
@@ -8,4 +8,5 @@ void deleteByGoodsId(@Param("id")Long id); MallGoodsStyle selectByStyleName(@Param("name")String styleName, @Param("goodsId")Long id); } src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -20,9 +20,12 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.HashSet; import java.util.List; import java.util.Set; @Slf4j @Service @@ -43,6 +46,7 @@ } @Override @Transactional public FebsResponse addMallGoods(AddMallGoodsDto addMallGoodsDto) { String goodsName = addMallGoodsDto.getGoodsName(); if(StrUtil.isEmpty(goodsName)){ @@ -120,18 +124,31 @@ i++; } } } List<AddMallGoodsSkuDto> addMallGoodsSkuDtos = addMallGoodsDto.getAddMallGoodsSkuDtos(); Set<String> styles = new HashSet<>(); if(CollUtil.isNotEmpty(addMallGoodsSkuDtos)){ for(AddMallGoodsSkuDto addMallGoodsSkuDto : addMallGoodsSkuDtos){ for(AddMallGoodsSkuDto addStyleDto : addMallGoodsSkuDtos){ styles.add(addStyleDto.getStyleName()); } } if(CollUtil.isNotEmpty(styles)){ for(String style : styles){ //新增样式 MallGoodsStyle mallGoodsStyle = new MallGoodsStyle(); mallGoodsStyle.setName(addMallGoodsSkuDto.getSkuName()); mallGoodsStyle.setName(style); mallGoodsStyle.setGoodsId(mallGoods.getId()); mallGoodsStyleMapper.insert(mallGoodsStyle); } } if(CollUtil.isNotEmpty(addMallGoodsSkuDtos)){ for(AddMallGoodsSkuDto addMallGoodsSkuDto : addMallGoodsSkuDtos){ MallGoodsStyle mallGoodsStyleSku = mallGoodsStyleMapper.selectByStyleName(addMallGoodsSkuDto.getStyleName(),mallGoods.getId()); //新增商品规格 MallGoodsSku mallGoodsSku = new MallGoodsSku(); mallGoodsSku.setSkuName(addMallGoodsSkuDto.getSkuName()); @@ -140,7 +157,7 @@ mallGoodsSku.setSkuVolume(addMallGoodsSkuDto.getSkuVolume()==null?0:addMallGoodsSkuDto.getSkuVolume()); mallGoodsSku.setOriginalPrice(new BigDecimal(addMallGoodsSkuDto.getOriginalPrice())); mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getPresentPrice())); mallGoodsSku.setStyleId(mallGoodsStyle.getId()); mallGoodsSku.setStyleId(mallGoodsStyleSku.getId()); mallGoodsSku.setGoodsId(mallGoods.getId()); mallGoodsSkuMapper.insert(mallGoodsSku); } src/main/resources/mapper/modules/MallGoodsStyleMapper.xml
@@ -6,4 +6,10 @@ delete from mall_goods_style where goods_id = #{id} </delete> <select id="selectByStyleName" resultType="cc.mrbird.febs.mall.entity.MallGoodsStyle"> select * from mall_goods_style where goods_id = #{goodsId} and name = #{name} </select> </mapper> src/main/resources/mapper/modules/MallMoneyFlowMapper.xml
@@ -41,7 +41,6 @@ inner join mall_member b on a.member_id=b.id left join mall_order_info c on a.order_no = c.order_no <where> a.type != 6 <if test="record != null" > <if test="record.name!=null and record.name!=''"> and b.name like concat('%', #{record.name},'%') src/main/resources/templates/febs/views/modules/goods/detailGoods.html
@@ -75,17 +75,17 @@ <input type="text" name="goodsIntrodution" autocomplete="off" class="layui-input" > </div> </div> <div class="layui-row layui-col-space10 layui-form-item"> <div class="layui-col-lg6"> <label class="layui-form-label">规格:</label> <div class="layui-input-block"> <input type="text" name="addMallGoodsSkuDtos" autocomplete="off" class="layui-input" id="attrName"> </div> </div> <div class="layui-col-lg6"> <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" id="test3" >添加</button> </div> </div> <!-- <div class="layui-row layui-col-space10 layui-form-item">--> <!-- <div class="layui-col-lg6">--> <!-- <label class="layui-form-label">规格:</label>--> <!-- <div class="layui-input-block">--> <!-- <input type="text" name="addMallGoodsSkuDtos" autocomplete="off" class="layui-input" id="attrName">--> <!-- </div>--> <!-- </div>--> <!-- <div class="layui-col-lg6">--> <!-- <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" id="test3" >添加</button>--> <!-- </div>--> <!-- </div>--> <div id="attrWrap"></div> <div class="layui-form-item"> <label class="layui-form-label">缩略图链接:</label> @@ -161,11 +161,65 @@ initUserValue(); function appendSku(sku,skuIndex){ var index = skuIndex; let attrNameVal = sku.skuName; let stockVal = sku.stock; let skuVolume = sku.skuVolume; let originalPrice = sku.originalPrice; let presentPrice = sku.presentPrice; let skuImage = sku.skuImage; $('#attrWrap').append(` <div class="layui-form-item"> <label class="layui-form-label">规格详情:</label> <div class="layui-input-block layui-form-item item"> <div style="float:left" > <div> <input type="text" class="layui-input" value="` + attrNameVal + `" readonly > </div> </div> <div style="float:left" > <div> <img class="layui-upload-img" src="` + skuImage + `" style="width: 100px" readonly> </div> </div> <div style="float:left" > <div> <input type="text" value="` + stockVal + `" placeholder="库存" autocomplete="off" class="layui-input" readonly> </div> </div> <div style="float:left" > <div> <input type="text" value="` + skuVolume + `" placeholder="销售数量" autocomplete="off" class="layui-input" readonly> </div> </div> <div style="float:left" > <div> <input type="text" value="` + originalPrice + `" placeholder="原价" autocomplete="off" class="layui-input" readonly> </div> </div> <div style="float:left" > <div> <input type="text" value="` + presentPrice + `" placeholder="现价" autocomplete="off" class="layui-input" readonly> </div> </div> </div> </div> `) } function initUserValue() { var skuIndex = 0; let skuLength = mailGoodsDetail.mailGoodsSkuDetailVo.length; for(var skuIndex = 0; skuIndex < skuLength; skuIndex++){ appendSku(mailGoodsDetail.mailGoodsSkuDetailVo[skuIndex],skuIndex); } form.val("goods-detail-form", { "id": mailGoodsDetail.id, "goodsNo": mailGoodsDetail.goodsNo, "categoryId": mailGoodsDetail.categoryId, "mailGoodsSkuDetailVo": mailGoodsDetail.mailGoodsSkuDetailVo, "unit": mailGoodsDetail.unit, "originalPrice": mailGoodsDetail.originalPrice, "presentPrice": mailGoodsDetail.presentPrice, src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -57,7 +57,7 @@ </div> <div class="layui-row layui-col-space10 layui-form-item"> <div class="layui-col-lg6"> <label class="layui-form-label">规格:</label> <label class="layui-form-label">样式:</label> <div class="layui-input-block"> <input type="text" name="addMallGoodsSkuDtos" autocomplete="off" class="layui-input" id="attrName"> </div> @@ -232,43 +232,53 @@ $('#test3').on('click', function (){ var index = $("#attrWrap").children().length; let attrNameVal = $('#attrName').val(); if(attrNameVal==null || attrNameVal==""){ febs.alert.warn('样式名称不能为空'); return false; } $('#attrWrap').append(` <div class="layui-form-item item"> <div style="float:left" > <input type="text" name="skuName` + index + `" autocomplete="off" class="layui-input" value="` + $('#attrName').val() + `" readonly > <input type="text" name="styleName` + index + `" value="` + $('#attrName').val() + `" autocomplete="off" class="layui-input" readonly > </div> <div style="float:left" > <div> <input type="text" name="skuName` + index +`" placeholder="名称" autocomplete="off" class="layui-input" > </div> </div> <div style="float:left" > <label class="layui-form-label">图片:</label> <div class="layui-input-block"> <div class="layui-upload"> <button type="button" class="layui-btn layui-btn-normal layui-btn-xs sku-img" id="` + index + `">上传</button> <input type="text" id="skuImage` + index +`" name="skuImage` + index + `" autocomplete="off" class="layui-input"> <button type="button" class="layui-btn layui-btn-normal layui-btn-xs sku-img" id="skuImg` + index + `">上传</button> <img class="layui-upload-img" id="imageUrls` + index + `" style="width: 100px" > </div> </div> </div> <div style="float:left" > <label class="layui-form-label">库存:</label> <div class="layui-input-block"> <input type="text" name="stock` + index +`" autocomplete="off" class="layui-input" > <div style="float:left" class="febs-hide"> <div> <input type="text" id="skuImage` + index +`" name="skuImage` + index + `" autocomplete="off" class="layui-input"> </div> </div> <div style="float:left" > <label class="layui-form-label">销售数量:</label> <div class="layui-input-block"> <input type="text" name="skuVolume` + index +`" autocomplete="off" class="layui-input" > <div> <input type="number" name="stock` + index +`" placeholder="库存" autocomplete="off" class="layui-input" > </div> </div> <div style="float:left" > <label class="layui-form-label">原价:</label> <div class="layui-input-block"> <input type="text" name="originalPrice` + index +`" autocomplete="off" class="layui-input" > <div> <input type="number" name="skuVolume` + index +`" placeholder="销售数量" autocomplete="off" class="layui-input" > </div> </div> <div style="float:left" > <label class="layui-form-label">现价:</label> <div class="layui-input-block"> <input type="text" name="presentPrice` + index + `" autocomplete="off" class="layui-input" > <div> <input type="number" name="originalPrice` + index +`" placeholder="原价" autocomplete="off" class="layui-input" > </div> </div> <div style="float:left" > <div> <input type="number" name="presentPrice` + index + `" placeholder="现价" autocomplete="off" class="layui-input" > </div> </div> <div style="float:left" > @@ -278,30 +288,25 @@ `) //普通图片上传 upload.render({ elem: '.sku-img' elem: '#skuImg' + index ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 ,done: function(res){ febs.alert.success(res.data.src); var cid = this.item.attr('id'); $('#skuImgPreview' + cid).attr('src', res.data.src); $('#skuImage'+cid).val(res.data.src); $('#imageUrls' + index).attr('src', res.data.src); $('#skuImage'+ index).val(res.data.src); } }); }); upload.render({ elem: '.sku-img' elem: '#skuImg'+index ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 ,done: function(res){ febs.alert.success(res.data.src); var cid = this.item.attr('id'); $('#skuImgPreview' + cid).attr('src', res.data.src); $('#skuImage'+cid).val(res.data.src); $('#imageUrls' + index).attr('src', res.data.src); $('#skuImage'+ index).val(res.data.src); } }); $("#attrWrap").on("click",".del-attr-btn",function(){ // console.log(this) // console.log($(this).index()) // console.log($(this).attr('data-index')) var index = $(this).attr('data-index') $($("#attrWrap").find(".item")[index].remove()); }); @@ -310,6 +315,7 @@ var skuArr = $("#attrWrap").find(".item"); for(var i = 0;i < skuArr.length;i++){ skuArrs.push({ styleName: $("input[name='styleName" + i + "']").val(), skuName: $("input[name='skuName" + i + "']").val(), skuImage: $("input[name='skuImage" + i + "']").val(), stock: $("input[name='stock" + i + "']").val(), src/main/resources/templates/febs/views/modules/mallMember/moneyFlow.html
@@ -47,9 +47,9 @@ {field: 'type', title: '流水类型', templet: function (d) { if (d.type === 1) { return '<span>分红收入</span>' return '<span>直推奖励</span>' } else if (d.type === 2) { return '<span>业绩奖励</span>' return '<span>团队奖励</span>' } else if (d.type === 3) { return '<span>订单支付</span>' } else if (d.type === 4) { @@ -58,6 +58,8 @@ return '<span>转账</span>' }else if (d.type === 6) { return '<span>提现</span>' }else if (d.type === 7) { return '<span>排名奖励</span>' }else{ return '' } src/main/resources/templates/febs/views/modules/mallMember/moneyFlowList.html
@@ -22,11 +22,13 @@ <div class="layui-input-inline"> <select name="type"> <option value="">请选择</option> <option value="1">分红收入</option> <option value="2">业绩奖励</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> @@ -99,16 +101,20 @@ {field: 'type', title: '流水类型', templet: function (d) { if (d.type === 1) { return '<span>分红收入</span>' return '<span>直推奖励</span>' } else if (d.type === 2) { return '<span>业绩奖励</span>' return '<span>团队奖励</span>' } else if (d.type === 3) { return '<span>订单支付</span>' } else if (d.type === 4) { return '<span>退款</span>' } else if (d.type === 5) { }else if (d.type === 5) { return '<span>转账</span>' } else{ }else if (d.type === 6) { return '<span>提现</span>' }else if (d.type === 7) { return '<span>排名奖励</span>' }else{ return '' } }, minWidth: 80,align:'center'}, src/main/resources/templates/febs/views/modules/product/categoryUpdate.html
@@ -61,16 +61,6 @@ <input type="text" id="imageUrl" name="image" class="layui-input" readonly> </div> </div> <!-- <div class="layui-form-item">--> <!-- <label class="layui-form-label ">父类:</label>--> <!-- <div class="layui-input-block">--> <!-- <select name="parentId"--> <!-- xm-select-direction="down"--> <!-- xm-select="user-update-category"--> <!-- xm-select-skin="default">--> <!-- </select>--> <!-- </div>--> <!-- </div>--> <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">是否推荐:</label> <div class="layui-input-block"> @@ -134,31 +124,6 @@ form.render(); }); }); // formSelects.config('user-update-category', { // 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-update-category', goodsCategoryVo.parentId); // }, // error: function (id, url, searchVal, err) { // console.error(err); // febs.alert.error('获取分类列表失败'); // } // }); initUserValue(); function initUserValue() {