src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java
@@ -20,11 +20,17 @@ import cc.mrbird.febs.mall.dto.clothes.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.service.ClothesTypeService; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPrintLocationVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPrintMemberStatureVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPrintOrderVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPrintPatternVo; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSON; import cn.hutool.json.JSONUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -38,6 +44,7 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Date; @@ -343,6 +350,66 @@ return clothesTypeService.printOrder(dto); } public static void main(String[] args) { AdminClothesPrintOrderVo vo = new AdminClothesPrintOrderVo(); vo.setOrderNo("20201201"); vo.setTypeName("T恤"); vo.setTypeFront("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/1752740706568ab67808fb49940a7930b9e0ab0793238.png"); vo.setTypeBack("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/1752740734639227e7f5a0f3a4de097a2785305bff825.png"); vo.setClothName("棉"); vo.setClothCode("TX"); vo.setSizeName("XL"); vo.setSizeCode("XL"); vo.setArtName("印花"); vo.setArtCode("C"); List<AdminClothesPrintPatternVo> patterns = new ArrayList<>(); AdminClothesPrintPatternVo pattern = new AdminClothesPrintPatternVo(); pattern.setPatternName("胸口"); pattern.setPatternCode("front-one"); pattern.setPatternText("胸口"); pattern.setPatternImage("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/17527407868773d1ad92c4c2e454396a6fc051c2219bc.png"); patterns.add(pattern); AdminClothesPrintPatternVo pattern1 = new AdminClothesPrintPatternVo(); pattern1.setPatternName("左下"); pattern1.setPatternCode("front-two"); pattern1.setPatternText("左下"); pattern1.setPatternImage("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/17527407868773d1ad92c4c2e454396a6fc051c2219bc.png"); patterns.add(pattern1); AdminClothesPrintPatternVo pattern2 = new AdminClothesPrintPatternVo(); pattern2.setPatternName("袖口"); pattern2.setPatternCode("front-three"); pattern2.setPatternText("袖口"); pattern2.setPatternImage("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/17527407868773d1ad92c4c2e454396a6fc051c2219bc.png"); patterns.add(pattern2); vo.setPatterns( patterns); List<AdminClothesPrintLocationVo> locations = new ArrayList<>(); AdminClothesPrintLocationVo location = new AdminClothesPrintLocationVo(); location.setLocationName("后背"); location.setLocationCode("back-one"); location.setLocationText("后背"); location.setLocationImage("https://excoin.oss-cn-hangzhou.aliyuncs.com/clothes/17527407868773d1ad92c4c2e454396a6fc051c2219bc.png"); locations.add(location); vo.setLocations(locations); AdminClothesPrintMemberStatureVo adminClothesPrintMemberStatureVo = new AdminClothesPrintMemberStatureVo(); adminClothesPrintMemberStatureVo.setName("会员身高"); adminClothesPrintMemberStatureVo.setHeightLine(new BigDecimal("170")); adminClothesPrintMemberStatureVo.setBustLine(new BigDecimal("90")); adminClothesPrintMemberStatureVo.setWaistLine(new BigDecimal("80")); adminClothesPrintMemberStatureVo.setWideLine(new BigDecimal("100")); adminClothesPrintMemberStatureVo.setHipLine(new BigDecimal("100")); vo.setMemberStature(adminClothesPrintMemberStatureVo); //将vo转换成json字符串 JSON parse = JSONUtil.parse(vo); System.out.println(parse.toString()); } /** * 订单列表-修改物流编号 */ src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesController.java
@@ -56,7 +56,7 @@ return clothesService.clothList(dto); } @ApiOperation(value = "图案列表", notes = "图案列表") @ApiOperation(value = "正面图案列表", notes = "图案列表") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiClothesPatternVo.class) }) @@ -76,7 +76,7 @@ return clothesService.sizeList(dto); } @ApiOperation(value = "位置列表", notes = "位置列表") @ApiOperation(value = "反面图案列表", notes = "反面图案列表") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiClothesLocationVo.class) }) src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
@@ -2,20 +2,19 @@ import cc.mrbird.febs.common.controller.BaseController; import cc.mrbird.febs.common.entity.FebsConstant; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.enumerates.SocialPatternLocationTypeEnum; import cc.mrbird.febs.common.utils.AppContants; import cc.mrbird.febs.common.utils.FebsUtil; import cc.mrbird.febs.common.utils.RedisUtils; import cc.mrbird.febs.mall.dto.clothes.AdminClothesPrintOrderDto; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; import cc.mrbird.febs.mall.service.ClothesTypeService; import cc.mrbird.febs.mall.service.IAdminBannerService; import cc.mrbird.febs.mall.vo.AdminLabelSetVo; import cc.mrbird.febs.mall.vo.AdminMallOrderVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesDeliverGoodsVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesLocationRemarkVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPatternRemarkVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo; import cc.mrbird.febs.mall.vo.clothes.*; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -236,6 +235,25 @@ return FebsUtil.view("modules/clothesType/orderList"); } /** * 社区列表-查看评论 * @return */ @GetMapping("/orderPrint/{id}") @RequiresPermissions("orderPrint:view") public String orderPrint(@PathVariable Long id, Model model) { AdminClothesPrintOrderDto dto = new AdminClothesPrintOrderDto(); dto.setId(id); AdminClothesPrintOrderVo adminClothesPrintOrderVo = clothesTypeService.printOrderEvent(dto); model.addAttribute("orderPrint", adminClothesPrintOrderVo); return FebsUtil.view("modules/clothesType/orderPrint"); } /** * 订单-发货 * @param id src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java
@@ -8,6 +8,7 @@ import cc.mrbird.febs.mall.dto.clothes.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesPrintOrderVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialCommentVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -127,4 +128,5 @@ FebsResponse socialMuseUpdate(ClothesSocialMuse dto); FebsResponse printOrder(AdminClothesPrintOrderDto dto); AdminClothesPrintOrderVo printOrderEvent(AdminClothesPrintOrderDto dto); } src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java
@@ -862,7 +862,7 @@ if(ObjectUtil.isNull(orderInfo)){ throw new FebsException("订单不存在"); } if (member.getId() != orderInfo.getMemberId()) { if (!ObjectUtil.equal(member.getId(), orderInfo.getMemberId())) { throw new FebsException("无权限操作"); } if (ClothesEnum.UP.getCode() == orderInfo.getDelFlag()) { src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java
@@ -76,6 +76,11 @@ if(CollUtil.isNotEmpty(list)){ vos = buildApiClothesCategoryInfoVo(list, vos); } ApiClothesCategoryInfoVo apiClothesCategoryInfoVo = new ApiClothesCategoryInfoVo(); apiClothesCategoryInfoVo.setId(0L); apiClothesCategoryInfoVo.setName("全部"); vos.add(apiClothesCategoryInfoVo); return new FebsResponse().success().data(vos); } @@ -325,7 +330,7 @@ List<ClothesLocationRemark> clothesLocationRemarks = new ArrayList<>(); List<ClothesPatternRemark> clothesPatternRemarks = new ArrayList<>(); if(CollUtil.isEmpty(clothesOrderItems)){ if(CollUtil.isNotEmpty(clothesOrderItems)){ for (ClothesOrderItem item : clothesOrderItems){ if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) { ClothesCloth cloth = clothesClothMapper.selectById(item.getItemId()); src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java
@@ -1239,4 +1239,125 @@ return new FebsResponse().success().data(objectObjectHashMap); } @Override public AdminClothesPrintOrderVo printOrderEvent(AdminClothesPrintOrderDto dto) { AdminClothesPrintOrderVo vo = new AdminClothesPrintOrderVo(); ClothesOrder order = clothesOrderMapper.selectById(dto.getId()); if (ObjectUtil.isNotNull(order)){ vo.setOrderNo(order.getOrderNo()); } ClothesType clothesType = clothesTypeMapper.selectById(order.getTypeId()); if (ObjectUtil.isNotNull(clothesType)) { vo.setTypeName(clothesType.getName()); vo.setTypeFront(clothesType.getImageFront()); vo.setTypeBack(clothesType.getImageBack()); } List<ClothesOrderItem> clothesOrderItems = clothesOrderItemMapper.selectList( Wrappers.lambdaQuery(ClothesOrderItem.class) .eq(ClothesOrderItem::getOrderId, order.getId()) ); if(CollUtil.isNotEmpty(clothesOrderItems)){ String nullStr = "暂无"; List<AdminClothesPrintLocationVo> locations = new ArrayList<>(); List<AdminClothesPrintPatternVo> patterns = new ArrayList<>(); for (ClothesOrderItem item : clothesOrderItems){ if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) { ClothesCloth cloth = clothesClothMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(cloth)) { vo.setClothCode(cloth.getCode()); vo.setClothName(cloth.getName()); }else{ vo.setClothCode(nullStr); vo.setClothName(nullStr); } continue; } else if (ClothesOrderItemEnum.SIZE.getCode() == item.getType()) { ClothesSize size = clothesSizeMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(size)) { vo.setSizeName(size.getName()); vo.setSizeCode(size.getCode()); }else { vo.setSizeName(nullStr); vo.setSizeCode(nullStr); } continue; } else if (ClothesOrderItemEnum.LOCATION.getCode() == item.getType()) { AdminClothesPrintLocationVo locationVo = new AdminClothesPrintLocationVo(); ClothesLocation location = clothesLocationMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(location)) { locationVo.setLocationName(location.getName()); locationVo.setLocationCode(location.getCode()); JSON parse = JSONUtil.parse(item.getRemark()); locationVo.setLocationText(parse.getByPath("text", String.class)); locationVo.setLocationImage(parse.getByPath("file", String.class)); }else{ locationVo.setLocationName(nullStr); locationVo.setLocationCode(nullStr); locationVo.setLocationText(nullStr); locationVo.setLocationImage(nullStr); } locations.add(locationVo); vo.setLocations( locations); continue; } else if (ClothesOrderItemEnum.PATTERN.getCode() == item.getType()) { AdminClothesPrintPatternVo patternVo = new AdminClothesPrintPatternVo(); ClothesPattern pattern = clothesPatternMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(pattern)) { patternVo.setPatternName(pattern.getName()); patternVo.setPatternCode(pattern.getCode()); JSON parse = JSONUtil.parse(item.getRemark()); patternVo.setPatternText(parse.getByPath("text", String.class)); patternVo.setPatternImage(parse.getByPath("file", String.class)); }else{ patternVo.setPatternName(nullStr); patternVo.setPatternCode(nullStr); patternVo.setPatternText(nullStr); patternVo.setPatternImage(nullStr); } patterns.add(patternVo); vo.setPatterns( patterns); continue; } else if (ClothesOrderItemEnum.ART.getCode() == item.getType()) { ClothesArt art = clothesArtMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(art)) { vo.setArtName(art.getName()); vo.setArtCode(art.getCode()); }else{ vo.setArtName(nullStr); vo.setArtCode(nullStr); } continue; } else if (ClothesOrderItemEnum.CUSTOMIZE.getCode() == item.getType()) { AdminClothesPrintMemberStatureVo memberStature = new AdminClothesPrintMemberStatureVo(); ClothesMemberStature clothesMemberStature = clothesMemberStatureMapper.selectById(item.getItemId()); if (ObjectUtil.isNotNull(clothesMemberStature)) { memberStature.setName(clothesMemberStature.getName()); memberStature.setHeightLine(clothesMemberStature.getHeightLine()); memberStature.setBustLine(clothesMemberStature.getBustLine()); memberStature.setWaistLine(clothesMemberStature.getWaistLine()); memberStature.setWideLine(clothesMemberStature.getWideLine()); memberStature.setHipLine(clothesMemberStature.getHipLine()); }else{ memberStature.setName(nullStr); memberStature.setHeightLine(BigDecimal.ZERO); memberStature.setBustLine(BigDecimal.ZERO); memberStature.setWaistLine(BigDecimal.ZERO); memberStature.setWideLine(BigDecimal.ZERO); memberStature.setHipLine(BigDecimal.ZERO); } vo.setMemberStature(memberStature); continue; } else { continue; } } } return vo; } } src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPrintLocationVo.java
New file @@ -0,0 +1,11 @@ package cc.mrbird.febs.mall.vo.clothes; import lombok.Data; @Data public class AdminClothesPrintLocationVo { private String locationName; private String locationCode; private String locationText; private String locationImage; } src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPrintMemberStatureVo.java
New file @@ -0,0 +1,15 @@ package cc.mrbird.febs.mall.vo.clothes; import lombok.Data; import java.math.BigDecimal; @Data public class AdminClothesPrintMemberStatureVo { private String name; private BigDecimal heightLine; private BigDecimal bustLine; private BigDecimal waistLine; private BigDecimal wideLine; private BigDecimal hipLine; } src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPrintOrderVo.java
New file @@ -0,0 +1,24 @@ package cc.mrbird.febs.mall.vo.clothes; import lombok.Data; import java.util.List; @Data public class AdminClothesPrintOrderVo { private String orderNo; private String typeName; private String typeFront; private String typeBack; private String clothName; private String clothCode; private String sizeName; private String sizeCode; private String artName; private String artCode; private List<AdminClothesPrintPatternVo> patterns; private List<AdminClothesPrintLocationVo> locations; private AdminClothesPrintMemberStatureVo memberStature; } src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesPrintPatternVo.java
New file @@ -0,0 +1,11 @@ package cc.mrbird.febs.mall.vo.clothes; import lombok.Data; @Data public class AdminClothesPrintPatternVo { private String patternName; private String patternCode; private String patternText; private String patternImage; } src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -453,9 +453,6 @@ <if test="record.status == 5"> and a.status = 7 or b.state in (2,3) </if> <if test="record.orderType != null"> and a.order_type=#{record.orderType} </if> </where> order by a.created_time desc </select> src/main/resources/templates/febs/views/layout.html
@@ -64,7 +64,7 @@ <div class="layui-side-scroll"> <div class="layui-logo" style="cursor: pointer"> <img data-th-src="@{febs/images/logo.png}"> <span>快乐社区 权限系统</span> <span>设计 管理系统</span> </div> <script type="text/html" src/main/resources/templates/febs/views/login.html
@@ -2,7 +2,7 @@ <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> <title>快乐社区 权限系统</title> <title>设计 管理系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> @@ -19,7 +19,7 @@ <div class="layui-container"> <div class="layui-row"> <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc"> <div class="layui-logo"><span><b>快乐社区</b> 权限系统</span></div> <div class="layui-logo"><span><b>设计 </b> 管理系统</span></div> </div> <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div"> <div class="layui-form" lay-filter="login-form"> src/main/resources/templates/febs/views/modules/clothesType/orderList-bak.html
New file @@ -0,0 +1,522 @@ <div class="layui-fluid layui-anim febs-anim" id="febs-clothes-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="clothes-order-table-form"> <div class="layui-form-item"> <div class="layui-col-md10"> <div class="layui-inline"> <label class="layui-form-label">购买人:</label> <div class="layui-input-inline"> <input type="text" placeholder="购买人" name="name" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">订单编号:</label> <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">订单状态:</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> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label">支付状态:</label> <div class="layui-input-inline"> <select name="payResult"> <option value="">请选择</option> <option value="1">成功</option> <option value="2">未成功</option> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label">开始时间:</label> <div class="layui-input-inline"> <input type="text" name="startTime" id="febs-clothes-order-date-start" lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">结束时间:</label> <div class="layui-input-inline"> <input type="text" name="endTime" id="febs-clothes-order-date-end" lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input"> </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="orderClothesTable" lay-data="{id: 'orderClothesTable'}"></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"></i></a> </script> <script type="text/html" id="tableToolBarClothesOrder"> <div class="layui-btn-container"> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="printSelect">自定义打印</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="deliverGoods">发货</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="updateDeliver">修改物流信息</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="refundOrder">仅退款</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="confirmOrder">确认收货</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverTwo">导出待发货订单</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button> </div> </script> <!-- 表格操作栏 end --> <script data-th-inline="none" type="text/javascript"> // 引入组件并初始化 layui.use([ 'jquery', 'form', 'table', 'febs', 'formSelects', 'upload','laydate'], function () { var $ = layui.jquery, febs = layui.febs, form = layui.form, table = layui.table, upload = layui.upload, $view = $('#febs-clothes-order'), $query = $view.find('#query'), $reset = $view.find('#reset'), $searchForm = $view.find('form'), sortObject = {field: 'orderTime', type: 'desc'}, formSelects = layui.formSelects, laydate = layui.laydate, tableIns; let currPageOrder = 1;//首先默认值为1,防止出错 //获取当前页 currPageOrder = $view.find(".layui-laypage-em").next().html(); //日期范围 laydate.render({ elem: '#febs-clothes-order-date-start',type: 'datetime' }); laydate.render({ elem: '#febs-clothes-order-date-end',type: 'datetime' }); form.render(); formSelects.render(); // 表格初始化 initClothesOrderTable(); table.on('toolbar(orderClothesTable)', function(obj){ var layEvent = obj.event; var id = obj.config.id; var checkStatus = table.checkStatus(id); if(layEvent === 'printSelect'){ let data = checkStatus.data; if (data.length > 1) { febs.alert.warn('每次只能操作一个订单'); return; } let ids = ""; for(let i = 0;i < data.length;i++){ console.log(data[i].status); if(data[i].status != 2){ febs.alert.warn('请选择待发货的订单'); return; }else{ ids = data[i].id; } } if(ids == null || ids == ""){ febs.alert.warn('请选择订单'); return; } printSelectData(ids) } if (layEvent === 'deliverGoods') { let data = checkStatus.data; if (data.length > 1) { febs.alert.warn('每次只能操作一个订单'); return; } let ids = ""; for(let i = 0;i < data.length;i++){ if(data[i].status != 2){ febs.alert.warn('请选择待发货的订单'); return; }else{ ids = data[i].id; } } console.log(ids); if(ids == null || ids == ""){ febs.alert.warn('请选择订单'); return; } febs.modal.open('发货', 'modules/clothesType/deliverGoods/' + ids, { btn: ['确认','取消'], yes: function (index, layero) { $('#deliver-update-clothes').find('#submit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); } if (layEvent === 'updateDeliver') { let data = checkStatus.data; if (data.length > 1) { febs.alert.warn('每次只能操作一个订单'); return; } let ids = ""; for(let i = 0;i < data.length;i++){ if(data[i].status != 2){ febs.alert.warn('请选择待收货的订单'); return; }else{ ids = data[i].id; } } if(ids == null || ids == ""){ febs.alert.warn('请选择订单'); return; } febs.modal.open('修改物流信息', 'modules/clothesType/deliverGoods/' + ids, { btn: ['确认','取消'], yes: function (index, layero) { $('#deliver-update-clothes').find('#deliverInfoSubmit').trigger('click'); }, btn2: function () { layer.closeAll(); } }); } if(layEvent === 'refundOrder'){ let data = checkStatus.data; if (data.length > 1) { febs.alert.warn('每次只能操作一个订单'); return; } let ids = ""; for(let i = 0;i < data.length;i++){ if(data[i].status != 2 ){ febs.alert.warn('请选择待发货的订单'); return; }else{ ids = data[i].id; } } if(ids == null || ids == ""){ febs.alert.warn('请选择订单'); return; } febs.modal.confirm('仅退款', '确认退款订单?', function () { refundOrder(ids); }); } if(layEvent === 'confirmOrder'){ let data = checkStatus.data; let ids = ""; for(let i = 0;i < data.length;i++){ if(data[i].status != 3){ febs.alert.warn('请选择待收货的订单'); return; }else{ ids = ids + data[i].id+","; } } console.log(ids); if(ids == null || ids == ""){ febs.alert.warn('请选择订单'); return; } febs.get(ctx + 'admin/clothesType/confirmOrder/'+ids, null, function () { febs.alert.success('操作成功'); $query.click(); }); } if (layEvent == 'exportDeliverTwo') { let data = checkStatus.data; let ids = ""; for(let i = 0;i < data.length;i++){ if(data[i].status != 2){ febs.alert.warn('请选择待发货的订单'); return; }else if(data[i].deliveryState != 1){ febs.alert.warn('请选择待配送的订单'); return; }else{ ids = ids + data[i].id+","; } } console.log(ids); if(ids == null || ids == ""){ febs.alert.warn('请选择待发货的订单'); return; } window.location.href = ctx + "admin/clothesType/exportOrderList?ids="+ids; } }); /* * [自定义打印选中行数据] * @param {[type]} allData [传入选中行] */ function printSelectData(allData) { let orderId = allData; console.log(orderId); $.ajax({ url: '/admin/clothesType/printOrder/'+orderId, type: "get", contentType: 'application/json', success(res) { console.log(res); printSelect(res.data); }, error(xhr, status, error) { console.error("AJAX 请求失败:", error); alert("请求失败,请重试"); } }); } function printSelect(data) { //用于包含内容 var v = document.createElement("div"); //页面头部,导入css ,media="print"表示打印时使用该样式 var f = ["<head>", "<style>", "div{font-size:8px;}", ".main{width:100%;}", ".main div{width:100%;display:inline-block;}", "</style>", "</head>" ].join(""); console.log(data); var template = "<div class='main'>" + "<div style='text-align: center;font-size: 30px;font-weight: bold;margin-bottom: 10px'>订单编号:" + data.orderNo + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>类型:" + data.typeName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>布料:" + data.clothName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>编码:" + data.clothCode + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>尺码:" + data.sizeName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>编码:" + data.sizeCode + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>工艺:" + data.artName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>编码:" + data.artCode + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>正面图案:" + data.patternName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>编码:" + data.patternCode + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>文案:" + data.patternText + "</div>" + "<div class='print-images' style='font-size: 30px;font-weight: bold;'>图片:" + "<img style='width: 200px; height: 200px; max-width: 80%; margin-top: 5px;' src="+ data.patternImage+">" + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>反面图案:" + data.locationName + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>编码:" + data.locationCode + "</div>" + "<div style='font-size: 30px;font-weight: bold;'>文案:" + data.locationText + "</div>" + "<div class='print-images' style='font-size: 30px;font-weight: bold;'>图片:" + "<img style='width: 200px; height: 200px; max-width: 80%; margin-top: 5px;' src="+ data.locationImage+">" + "</div>" + "<div class='print-images' style='font-size: 30px;font-weight: bold;'>正面:" + "<img style='width: 200px; height: 200px; max-width: 80%; margin-top: 5px;' src="+ data.typeFront+">" + "</div>" + "<div class='print-images' style='font-size: 30px;font-weight: bold;'>反面:" + "<img style='width: 200px; height: 200px; max-width: 80%; margin-top: 5px;' src="+ data.typeBack+">" + "</div>" + "</div>" v.innerHTML = template; //新建窗口 var h = window.open("打印窗口", "_blank"); //写入拼凑内容 h.document.write(f + $(v).prop("outerHTML")); h.document.close(); //在新窗口的 document 中查找图片 ensureImagesLoaded(h.document, '.print-images img') .then(() => h.print()) .catch(() => layer.msg('部分图片加载失败')); //调用打印 h.print(); //关闭页面 h.close(); } function ensureImagesLoaded(doc, selector) { var imgs = $(selector, doc); // 👈 在指定文档中查找 var promises = []; imgs.each(function() { var img = this; var promise = new Promise(function(resolve, reject) { if (img.complete && img.naturalWidth !== 0) { resolve(); } else { $(img).on('load', resolve).on('error', reject); } }); promises.push(promise); }); return Promise.all(promises); } function refundOrder(id) { febs.get(ctx + 'admin/clothesType/refundOrder/' + id, null, function () { febs.alert.success('操作成功'); $query.click(); }); } upload.render({ elem: '#importDeliver' ,url: 'admin/clothesType/importDeliver' //此处配置你自己的上传接口即可 ,accept: 'file' //普通文件 ,done: function(res){ console.log("123"); febs.alert.success('操作成功'); $query.click(); } }); // 初始化表格操作栏各个按钮功能 table.on('tool(orderClothesTable)', function (obj) { var data = obj.data, layEvent = obj.event; if (layEvent === 'seeOrder') { febs.modal.open( '订单详情', 'modules/order/orderDetail/' + data.id, { maxmin: true, }); } }); // 查询按钮 $query.on('click', function () { var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); tableIns.reload({where: params, page: {curr: currPageOrder}}); }); // 刷新按钮 $reset.on('click', function () { $searchForm[0].reset(); sortObject.type = 'null'; tableIns.reload({where: getQueryParams(), page: {curr: currPageOrder}, initSort: sortObject}); }); function initClothesOrderTable() { tableIns = febs.table.init({ elem: $view.find('table'), id: 'orderClothesTable', url: ctx + 'admin/clothesType/orderList', // defaultToolbar: [], //系统自带打印导出 totalRow : true, toolbar: '#tableToolBarClothesOrder', cols: [[ {type: 'checkbox', fixed: 'left'}, {type: 'numbers', title: '', width: 80}, // {title: '操作', // templet: function (d) { // return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder">详情</button>' // },minWidth: 200,align:'center'}, {field: 'orderNo', title: '订单编号', minWidth: 200,align:'left' ,totalRowText:"合计"}, {field: 'memberName', title: '购买人', minWidth: 100,align:'left'}, {field: 'typeName', title: '类型', minWidth: 100,align:'left'}, // {field: 'goodsName', title: '商品', minWidth: 160,align:'left'}, // {field: 'typeImage', title: '图片', minWidth: 100,align:'left'}, {field: 'goodsCnt', title: '数量', minWidth: 120,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:green;">待发货</span>' }else if (d.status === 3) { return '<span style="color:green;">待收货</span>' }else if (d.status === 4) { return '<span style="color:green;">已完成</span>' }else if (d.status === 5) { return '<span style="color:green;">已取消</span>' }else{ return '' } }, minWidth: 80,align:'center'}, {field: 'amount', title: '总价', minWidth: 80,align:'left', totalRow:true}, {field: 'discountAmount', title: '优惠', minWidth: 80,align:'left', totalRow:true}, {field: 'carriage', title: '邮费', minWidth: 80,align:'left', totalRow:true}, {field: 'realAmount', title: '总金额', minWidth: 100,align:'left', totalRow:true}, {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, {field: 'payMethod', title: '支付方式', minWidth: 100,align:'left'}, {field: 'payTime', title: '支付时间', minWidth: 120,align:'left'}, {field: 'remark', title: '备注', minWidth: 160,align:'left'}, ]] }); } // 获取查询参数 function getQueryParams() { let startTimestr = $searchForm.find('input[name="startTime"]').val().trim(); let endTimeStr = $searchForm.find('input[name="endTime"]').val().trim(); if(startTimestr != '' && endTimeStr != '' && startTimestr >= endTimeStr){ febs.alert.warn('开始时间需要小于结束时间'); return{}; } return { startTime: $searchForm.find('input[name="startTime"]').val().trim(), endTime: $searchForm.find('input[name="endTime"]').val().trim(), name: $searchForm.find('input[name="name"]').val().trim(), orderNo: $searchForm.find('input[name="orderNo"]').val().trim(), payResult: $searchForm.find("select[name='payResult']").val(), status: $searchForm.find("select[name='status']").val(), }; } }) </script> src/main/resources/templates/febs/views/modules/clothesType/orderList.html
@@ -100,7 +100,7 @@ </script> <script type="text/html" id="tableToolBarClothesOrder"> <div class="layui-btn-container"> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="printSelect">自定义打印</button> <!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="printSelect">打印预览</button>--> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="deliverGoods">发货</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="updateDeliver">修改物流信息</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="refundOrder">仅退款</button> @@ -108,6 +108,10 @@ <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverTwo">导出待发货订单</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button> </div> </script> <script type="text/html" id="clothesOrderOption"> <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="orderPrint:view" lay-event="orderPrint">打印预览</button> </script> <!-- 表格操作栏 end --> <script data-th-inline="none" type="text/javascript"> @@ -427,11 +431,11 @@ table.on('tool(orderClothesTable)', function (obj) { var data = obj.data, layEvent = obj.event; if (layEvent === 'seeOrder') { febs.modal.open( '订单详情', 'modules/order/orderDetail/' + data.id, { maxmin: true, if (layEvent === 'orderPrint') { febs.modal.open('订单编号:'+data.orderNo,'modules/clothesType/orderPrint/' + data.id, { area: ['100%', '100%'], }); } }; }); @@ -461,6 +465,7 @@ cols: [[ {type: 'checkbox', fixed: 'left'}, {type: 'numbers', title: '', width: 80}, {title: '操作', toolbar: '#clothesOrderOption', minWidth: 200, align: 'center'}, // {title: '操作', // templet: function (d) { // return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder">详情</button>' src/main/resources/templates/febs/views/modules/clothesType/orderPrint.html
New file @@ -0,0 +1,249 @@ <style> .main{ width: 750px; margin: 0 auto; padding: 0 20px 20px; box-sizing: border-box; } .main .header{ display: flex; flex-wrap: wrap; font-size: 14px; } .main .header .item{ border: 1px solid #333; border-radius: 2px; margin: 0 2px; padding: 0 8px; } .main .header .item .name{ display: inline-block; border-right: 1px solid #333; margin-right: 8px; padding: 3px 8px 3px 0; } .main .content{ width: 100%; } .main .content .box{ width: 100%; position: relative; text-align: center; } .main .front-box .print-images img, .main .back-box .print-images img{ width: 440px; } .main .front-box .logo, .main .back-box .logo{ width: 100px; margin-top: 2px; } .main .front-box span, .main .back-box span{ margin: 0 5px; font-size: 12px; color: red; } .main .front-front-one{ position: absolute; left: 14%; top: 30%; text-align: right; } .main .front-front-two{ position: absolute; left: 9%; top: 69%; text-align: right; } .main .front-front-three{ position: absolute; left: 79%; top: 65%; text-align: left; } .main .back-front-one{ position: absolute; left: 67%; top: 19%; text-align: left; } .main .memberInfo-table { border-collapse: collapse; font-size: 14px; margin: 10px auto 30px; } .main .memberInfo-table, .main .memberInfo-table th, .main .memberInfo-table td { border: 1px solid #333; } .main .memberInfo-table th, .main .memberInfo-table td { padding: 5px 15px; text-align: center; } .footer{ width: 100%; font-size: 16px; } .footer>span{ display: inline-block; width: 25%; } @media print { .no-print { display: none !important; } } </style> <div id="page"></div> <div style="text-align: center;margin: 10px 0 20px;" class="no-print"> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" onclick="window.print()">打印</button> </div> <script data-th-inline="javascript"> layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree'], function () { var $ = layui.$, febs = layui.febs, layer = layui.layer, formSelects = layui.formSelects, treeSelect = layui.treeSelect, form = layui.form, eleTree = layui.eleTree, orderPrint = [[${orderPrint}]], $view = $('#page'), validate = layui.validate, _deptTree; var data = orderPrint; console.log(data); var patternHtml = ''; if(data.patterns){ for(var i = 0; i < data.patterns.length; i++) { patternHtml += "<div class="+"front-"+data.patterns[i].patternCode+">"; if(data.patterns[i].patternText){ patternHtml += "<div>" + // "<span>" + data.patterns[i].patternName +"</span>" + // "<span>" + data.patterns[i].patternCode +"</span>" + "<span>文字:" + data.patterns[i].patternText +"</span>" + "</div>" } if(data.patterns[i].patternImage){ patternHtml += "<div class='image-load'>" + "<img src='"+ data.patterns[i].patternImage+"' class='logo' />" + "</div>" + "</div>" } } } var locationHtml = ''; if (data.locations){ for(var i = 0; i < data.locations.length; i++) { locationHtml += "<div class="+"back-"+data.patterns[i].patternCode+">" if (data.locations[i].locationText){ locationHtml += "<div>" + // "<span>" + data.locations[i].locationName +"</span>" + // "<span>" + data.locations[i].locationCode +"</span>" + "<span>文字:" + data.locations[i].locationText +"</span>" + "</div>" } if (data.locations[i].locationImage){ locationHtml += "<div class='image-load'>" + "<img src='"+ data.locations[i].locationImage+"' class='logo' />" + "</div>" + "</div>" } } } var memberStatureHtml = ''; if (data.memberStature){ memberStatureHtml += "<table class='memberInfo-table'>" + "<tr>" + "<th colspan='9'>"+data.memberStature.name+"</th>" + "</tr>" + "<tr>" + "<td>身高</td>" + "<td>胸围</td>" + "<td>腰围</td>" + "<td>肩宽</td>" + "<td>臀围</td>" + "</tr>" + "<tr>" + "<td>"+data.memberStature.heightLine+"</td>" + "<td>"+data.memberStature.bustLine+"</td>" + "<td>"+data.memberStature.waistLine+"</td>" + "<td>"+data.memberStature.wideLine+"</td>" + "<td>"+data.memberStature.hipLine+"</td>" + "</tr>" + "</table>" } var mainHtml = "<div class='main'>" + "<div class='header'>" + "<div class='item'><span class='name'>类型:</span>" + data.typeName + "</div>" + "<div class='item'><span class='name'>布料:</span>" + data.clothName+ "("+data.clothCode+")"+ "</div><br>" + "<div class='item'><span class='name'>尺码:</span>" + data.sizeName + "("+data.sizeCode+")"+ "</div>" + "<div class='item'><span class='name'>工艺:</span>" + data.artName + "("+data.artCode+")"+ "</div>" + "</div>" + "<div class='content'>" + "<div class='front-box box'>" + "<div class='print-images'>" + "<div class='image-load'>" + "<img src="+ data.typeFront+">" + "</div>" + "</div>" + patternHtml + "</div>" + "<div class='back-box box'>" + "<div class='print-images'>" + "<div class='image-load'>" + "<img src="+ data.typeBack+">" + "</div>" + "</div>" + locationHtml + memberStatureHtml + "</div>" + "</div>" + "<div class='footer'>" + "<span>审核:</span>" + "<span>审批:</span>" + "<span>版师:</span>" + "<span>工艺师:</span>" + "</div>" "</div>"; document.querySelector('#page').innerHTML = mainHtml; // //在新窗口的 document 中查找图片 // ensureImagesLoaded(document, '.image-load img') // .catch(() => layer.msg('图片加载中')); // // function ensureImagesLoaded(doc, selector) { // var imgs = $(selector, doc); // 👈 在指定文档中查找 // var promises = []; // // imgs.each(function() { // var img = this; // var promise = new Promise(function(resolve, reject) { // if (img.complete && img.naturalWidth !== 0) { // resolve(); // } else { // $(img).on('load', resolve).on('error', reject); // } // }); // promises.push(promise); // }); // // return Promise.all(promises); // } }); </script> src/main/resources/templates/index.html
@@ -3,7 +3,7 @@ xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <head> <meta charset="utf-8"> <title>快乐社区 权限系统</title> <title>设计 管理系统</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">