feat(clothes): 添加订单管理功能
- 新增订单列表查询接口和页面
- 实现订单发货、修改物流信息、确认收货等功能
- 添加订单导出功能
- 集成微信退款接口
8 files modified
7 files added
| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.OrderDeliveryStateEnum; |
| | | import cc.mrbird.febs.common.enumerates.OrderStatusEnum; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelSheetPO; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelUtil; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelVersion; |
| | | import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil; |
| | | import cc.mrbird.febs.mall.dto.DeliverGoodsDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelAddDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelUpdateDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.service.ClothesTypeService; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo; |
| | | import cc.mrbird.febs.mall.vo.memberLevel.AdminMemberLabelSetDto; |
| | | 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 lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | |
| | | public class AdminClothesTypeController extends BaseController { |
| | | |
| | | private final ClothesTypeService clothesTypeService; |
| | | |
| | | /** |
| | | * 订单列表 |
| | | * |
| | | * @param dto |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @GetMapping("orderList") |
| | | public FebsResponse getOrderList(AdminClothesOrderListDto dto, QueryRequest request) { |
| | | String startTime = dto.getStartTime(); |
| | | String endTime = dto.getEndTime(); |
| | | if(StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)){ |
| | | DateTime dateStartTime= DateUtil.parseDate(startTime); |
| | | DateTime dateEndTime = DateUtil.parseDate(endTime); |
| | | int compare = DateUtil.compare(dateStartTime, dateEndTime); |
| | | if(compare >= 0){ |
| | | return new FebsResponse().fail().message("请输入正确的开始时间和结束时间"); |
| | | } |
| | | } |
| | | Map<String, Object> data = getDataTable(clothesTypeService.getOrderListInPage(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 订单列表-发货 |
| | | */ |
| | | @PostMapping("deliverGoods") |
| | | @ControllerEndpoint(operation = "订单列表-发货", exceptionMessage = "操作失败") |
| | | public FebsResponse deliverGoods(AdminClothesDeliverGoodsDto dto) { |
| | | |
| | | return clothesTypeService.deliverGoods(dto); |
| | | } |
| | | |
| | | /** |
| | | * 订单列表-修改物流编号 |
| | | */ |
| | | @PostMapping("deliverGoodsUpdate") |
| | | @ControllerEndpoint(operation = "订单列表-修改物流编号", exceptionMessage = "操作失败") |
| | | public FebsResponse deliverGoodsUpdate(@Valid AdminClothesDeliverGoodsDto dto) { |
| | | |
| | | return clothesTypeService.deliverGoodsUpdate(dto); |
| | | } |
| | | |
| | | /** |
| | | * 订单列表-仅退款 |
| | | */ |
| | | |
| | | @GetMapping("refundOrder/{id}") |
| | | @ControllerEndpoint(operation = "订单列表-仅退款", exceptionMessage = "仅退款") |
| | | public FebsResponse refundOrder(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | AdminClothesRefundOrderDto dto = new AdminClothesRefundOrderDto(); |
| | | dto.setId(id); |
| | | return clothesTypeService.refundOrder(dto); |
| | | } |
| | | |
| | | @GetMapping("confirmOrder/{ids}") |
| | | @ControllerEndpoint(operation = "订单列表-确认收货", exceptionMessage = "操作失败") |
| | | public FebsResponse confirmOrder(@NotBlank(message = "{required}") @PathVariable String ids){ |
| | | List<String> List = StrUtil.splitTrim(ids, ","); |
| | | for(String id : List){ |
| | | long orderId = Long.parseLong(id); |
| | | clothesTypeService.confirmOrder(orderId); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @GetMapping("exportOrderList/{ids}") |
| | | @ControllerEndpoint(operation = "订单列表", exceptionMessage = "导出失败") |
| | | public FebsResponse exportOrderList(@NotBlank(message = "{required}") @PathVariable String ids, HttpServletResponse response) throws IOException { |
| | | List<String> List = StrUtil.splitTrim(ids, ","); |
| | | if(CollUtil.isNotEmpty( List)){ |
| | | ArrayList<Long> orderIds = new ArrayList<>(); |
| | | for (String id : List){ |
| | | long orderId = Long.parseLong(id); |
| | | orderIds.add(orderId); |
| | | } |
| | | if(CollUtil.isNotEmpty(orderIds)){ |
| | | |
| | | clothesTypeService.exportOrderList(orderIds,response); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @PostMapping(value = "/importDeliver") |
| | | @ControllerEndpoint(operation = "导入发货", exceptionMessage = "导入失败") |
| | | public FebsResponse importDeliver(@RequestBody MultipartFile file) throws IOException { |
| | | if (file.isEmpty()) { |
| | | return new FebsResponse().fail(); |
| | | } |
| | | |
| | | String fileName = file.getOriginalFilename(); |
| | | String dirPath = "/home/javaweb/webresource/clothes/"; |
| | | |
| | | File saveFile = new File(new File(dirPath).getAbsolutePath() + File.separator + fileName); |
| | | if (!saveFile.exists()) { |
| | | if (!saveFile.getParentFile().exists()) { |
| | | saveFile.getParentFile().mkdirs(); |
| | | } |
| | | } |
| | | |
| | | file.transferTo(saveFile); |
| | | |
| | | List<ExcelSheetPO> data = ExcelUtil.readExcel(saveFile, null, null); |
| | | if (CollUtil.isEmpty(data)) { |
| | | return new FebsResponse().fail(); |
| | | } |
| | | |
| | | List<List<Object>> dataList = data.get(0).getDataList(); |
| | | |
| | | int orderIdNoIndex = -1; |
| | | int expressNoIndex = -1; |
| | | int expressComIndex = -1; |
| | | int expressCodeIndex = -1; |
| | | for (int i = 1; i < dataList.size(); i++) { |
| | | List<Object> objects = dataList.get(i); |
| | | |
| | | String orderId = ""; |
| | | String expressNo = ""; |
| | | String expressCode = ""; |
| | | String expressCom = ""; |
| | | for (int j = 0; j < objects.size(); j++) { |
| | | Object obj = objects.get(j); |
| | | if ("订单ID".equals(obj)) { |
| | | orderIdNoIndex = j; |
| | | } |
| | | if ("物流单号".equals(obj)) { |
| | | expressNoIndex = j; |
| | | } |
| | | |
| | | if ("物流公司".equals(obj)) { |
| | | expressComIndex = j; |
| | | } |
| | | |
| | | if ("物流公司码".equals(obj)) { |
| | | expressCodeIndex = j; |
| | | } |
| | | |
| | | if (j == orderIdNoIndex) { |
| | | orderId = (String) objects.get(j); |
| | | } |
| | | |
| | | |
| | | if (j == expressNoIndex) { |
| | | expressNo = (String) objects.get(j); |
| | | } |
| | | |
| | | if (j == expressComIndex) { |
| | | expressCom = (String) objects.get(j); |
| | | } |
| | | |
| | | if (j == expressCodeIndex) { |
| | | expressCode = (String) objects.get(j);; |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(expressNo) && StrUtil.isNotBlank(expressCode) && StrUtil.isNotBlank(expressCom)) { |
| | | AdminClothesDeliverGoodsDto dto = new AdminClothesDeliverGoodsDto(); |
| | | dto.setId(Long.parseLong(orderId)); |
| | | dto.setExpressCom(expressCom); |
| | | dto.setExpressCode(expressCode); |
| | | dto.setExpressNo(expressNo); |
| | | clothesTypeService.deliverGoodsImport(dto); |
| | | } |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | /** |
| | | * 分类列表 |
| | | * @return |
| | |
| | | @ApiOperation(value = "确认收货", notes = "确认收货") |
| | | @PostMapping(value = "/confirm/{id}") |
| | | public FebsResponse confirm(@PathVariable("id") Long id) { |
| | | |
| | | return apiClothesOrderService.confirmOrder(id); |
| | | } |
| | | |
| | |
| | | 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.AdminClothesTypeInfoVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | private final ClothesTypeClothMapper clothesTypeClothMapper; |
| | | private final ClothesTypePatternMapper clothesTypePatternMapper; |
| | | private final ClothesTypeLocationMapper clothesTypeLocationMapper; |
| | | private final ClothesOrderMapper clothesOrderMapper; |
| | | private final MallExpressInfoMapper mallExpressInfoMapper; |
| | | |
| | | /** |
| | | * 订单列表 |
| | | */ |
| | | @GetMapping("orderList") |
| | | @RequiresPermissions("orderList:view") |
| | | public String orderList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/orderList"); |
| | | } |
| | | |
| | | /** |
| | | * 订单-发货 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("deliverGoods/{id}") |
| | | @RequiresPermissions("deliverGoods:update") |
| | | public String deliverGoods(@PathVariable long id, Model model) { |
| | | AdminClothesDeliverGoodsVo data = new AdminClothesDeliverGoodsVo(); |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(id); |
| | | data.setExpressCom("极兔快递"); |
| | | MallExpressInfo mallExpressInfo = mallExpressInfoMapper.selectOne( |
| | | Wrappers.lambdaQuery(MallExpressInfo.class) |
| | | .eq(MallExpressInfo::getOrderId, id) |
| | | .eq(MallExpressInfo::getOrderNo, clothesOrder.getOrderNo()) |
| | | .last("limit 1") |
| | | ); |
| | | if(ObjectUtil.isNotNull(mallExpressInfo)){ |
| | | data.setExpressNo(mallExpressInfo.getExpressNo()); |
| | | data.setExpressCom(mallExpressInfo.getExpressCom()); |
| | | }else{ |
| | | data.setExpressCom("极兔快递"); |
| | | data.setExpressNo("JT"); |
| | | } |
| | | model.addAttribute("deliverInfo", data); |
| | | return FebsUtil.view("modules/clothesType/deliverGoods"); |
| | | } |
| | | |
| | | /** |
| | | * 种类列表 |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.clothes; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminClothesDeliverGoodsDto", description = "运费模板更新参数类") |
| | | public class AdminClothesDeliverGoodsDto { |
| | | |
| | | |
| | | private Long id; |
| | | |
| | | private String expressNo; |
| | | |
| | | private String expressCom; |
| | | |
| | | private String expressCode; |
| | | |
| | | private String orderNo; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.clothes; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminClothesOrderListDto", description = "运费模板更新参数类") |
| | | public class AdminClothesOrderListDto { |
| | | |
| | | private String name; |
| | | |
| | | private String orderNo; |
| | | /** |
| | | * 状态 1-待支付 2-待发货 3-待收货 4-已完成 5-已取消 |
| | | */ |
| | | private Integer status; |
| | | |
| | | private String payResult; |
| | | |
| | | private String startTime; |
| | | |
| | | private String endTime; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.clothes; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AdminClothesRefundOrderDto { |
| | | |
| | | private Long id; |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.ApiClothesOrderListVoDto; |
| | | import cc.mrbird.febs.mall.entity.ClothesOrder; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; |
| | | import cc.mrbird.febs.mall.vo.clothes.ApiClothesOrderListVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | Page<ApiClothesOrderListVo> selectPageInOrder(Page<ApiClothesOrderListVo> page, @Param("record")ApiClothesOrderListVoDto dto); |
| | | |
| | | IPage<AdminClothesOrderListVo> selectOrderListInPage(Page<AdminClothesOrderListVo> page, @Param("record")AdminClothesOrderListDto dto); |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.List; |
| | | |
| | | public interface ClothesTypeService extends IService<ClothesType> { |
| | | |
| | |
| | | FebsResponse patternSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | FebsResponse locationSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | IPage<AdminClothesOrderListVo> getOrderListInPage(AdminClothesOrderListDto dto, QueryRequest request); |
| | | |
| | | FebsResponse deliverGoods(AdminClothesDeliverGoodsDto dto); |
| | | |
| | | FebsResponse deliverGoodsUpdate(AdminClothesDeliverGoodsDto dto); |
| | | |
| | | FebsResponse refundOrder(AdminClothesRefundOrderDto dto); |
| | | |
| | | void confirmOrder(long orderId); |
| | | |
| | | void exportOrderList(List<Long> list, HttpServletResponse response) throws IOException; |
| | | |
| | | void deliverGoodsImport(AdminClothesDeliverGoodsDto dto); |
| | | } |
| | |
| | | |
| | | clothesOrderMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesOrder.class) |
| | | .set(ClothesOrder::getStatus, OrderStatusEnum.FINISH.getValue()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .eq(ClothesOrder::getId, id) |
| | | .eq(ClothesOrder::getMemberId, member.getId()) |
| | | .set(ClothesOrder::getStatus, OrderStatusEnum.FINISH.getValue()) |
| | | .set(ClothesOrder::getDeliveryState, OrderDeliveryStateEnum.DELIVERY_FINISH.getValue()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .eq(ClothesOrder::getId, id) |
| | | .eq(ClothesOrder::getMemberId, member.getId()) |
| | | ); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.StateUpDownEnum; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.properties.XcxProperties; |
| | | import cc.mrbird.febs.common.utils.SpringContextHolder; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelSheetPO; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelUtil; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelVersion; |
| | | import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | 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.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.IMallMoneyFlowService; |
| | | import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; |
| | | import cc.mrbird.febs.pay.util.WeixinServiceUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | |
| | | private final ClothesTypeClothMapper clothesTypeClothMapper; |
| | | private final ClothesTypePatternMapper clothesTypePatternMapper; |
| | | private final ClothesTypeLocationMapper clothesTypeLocationMapper; |
| | | private final ClothesOrderMapper clothesOrderMapper; |
| | | private final MallExpressInfoMapper mallExpressInfoMapper; |
| | | private final IApiMallMemberWalletService memberWalletService; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); |
| | | @Autowired |
| | | private WeixinServiceUtil weixinServiceUtil; |
| | | |
| | | @Override |
| | | public IPage<ClothesType> adminTypeList(ClothesType dto, QueryRequest request) { |
| | |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminClothesOrderListVo> getOrderListInPage(AdminClothesOrderListDto dto, QueryRequest request) { |
| | | Page<AdminClothesOrderListVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminClothesOrderListVo> vos = clothesOrderMapper.selectOrderListInPage(page, dto); |
| | | return vos; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse deliverGoods(AdminClothesDeliverGoodsDto dto) { |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(dto.getId()); |
| | | |
| | | if(ObjectUtil.isNull(clothesOrder)){ |
| | | return new FebsResponse().fail().message("订单不存在,刷新后重试"); |
| | | } |
| | | Integer status = clothesOrder.getStatus(); |
| | | if(ClothesOrderStatusEnum.WAIT_SHIPPING.getValue() != status){ |
| | | return new FebsResponse().fail().message("订单不是待发货状态"); |
| | | } |
| | | String expressNo = dto.getExpressNo(); |
| | | if(StrUtil.isEmpty(expressNo)){ |
| | | return new FebsResponse().fail().message("请输入物流单号"); |
| | | } |
| | | String expressCom = dto.getExpressCom(); |
| | | if(StrUtil.isEmpty(expressCom)){ |
| | | return new FebsResponse().fail().message("请输入物流公司"); |
| | | } |
| | | MallExpressInfo mallExpressInfo = new MallExpressInfo(); |
| | | mallExpressInfo.setMemberId(clothesOrder.getMemberId()); |
| | | mallExpressInfo.setOrderId(clothesOrder.getId()); |
| | | mallExpressInfo.setOrderNo(clothesOrder.getOrderNo()); |
| | | mallExpressInfo.setExpressNo(expressNo); |
| | | mallExpressInfo.setExpressCom(expressCom); |
| | | mallExpressInfoMapper.insert(mallExpressInfo); |
| | | |
| | | clothesOrderMapper.update( |
| | | null, |
| | | Wrappers.lambdaUpdate(ClothesOrder.class) |
| | | .set(ClothesOrder::getStatus, ClothesOrderStatusEnum.WAIT_FINISH.getValue()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .set(ClothesOrder::getDeliveryState, OrderDeliveryStateEnum.DELIVERY_FINISH.getValue()) |
| | | .eq(ClothesOrder::getId, clothesOrder.getId()) |
| | | ); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse deliverGoodsUpdate(AdminClothesDeliverGoodsDto dto) { |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(dto.getId()); |
| | | |
| | | if(ObjectUtil.isNull(clothesOrder)){ |
| | | return new FebsResponse().fail().message("订单不存在,刷新后重试"); |
| | | } |
| | | Integer status = clothesOrder.getStatus(); |
| | | if(ClothesOrderStatusEnum.WAIT_FINISH.getValue() != status){ |
| | | return new FebsResponse().fail().message("订单不是待发货状态"); |
| | | } |
| | | String expressNo = dto.getExpressNo(); |
| | | if(StrUtil.isEmpty(expressNo)){ |
| | | return new FebsResponse().fail().message("请输入物流单号"); |
| | | } |
| | | String expressCom = dto.getExpressCom(); |
| | | if(StrUtil.isEmpty(expressCom)){ |
| | | return new FebsResponse().fail().message("请输入物流公司"); |
| | | } |
| | | MallExpressInfo mallExpressInfo = mallExpressInfoMapper.selectOne( |
| | | Wrappers.lambdaQuery(MallExpressInfo.class) |
| | | .eq(MallExpressInfo::getOrderId, clothesOrder.getId()) |
| | | .eq(MallExpressInfo::getOrderNo, clothesOrder.getOrderNo()) |
| | | .last("limit 1") |
| | | ); |
| | | if(ObjectUtil.isNull(mallExpressInfo)){ |
| | | return new FebsResponse().fail().message("请先发货"); |
| | | } |
| | | mallExpressInfoMapper.update( |
| | | null, |
| | | Wrappers.lambdaUpdate(MallExpressInfo.class) |
| | | .set(MallExpressInfo::getExpressNo, expressNo) |
| | | .set(MallExpressInfo::getExpressCom, expressCom) |
| | | .set(MallExpressInfo::getUpdatedTime, new Date()) |
| | | .eq(MallExpressInfo::getId, mallExpressInfo.getId()) |
| | | ); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | |
| | | private void clothesUpdateStatusAndUpdateTimeById(Long id, Date date, int value) { |
| | | clothesOrderMapper.update( |
| | | null, |
| | | Wrappers.lambdaUpdate(ClothesOrder.class) |
| | | .set(ClothesOrder::getStatus, ClothesOrderStatusEnum.CANCEL.getValue()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .eq(ClothesOrder::getId, id) |
| | | ); |
| | | } |
| | | |
| | | private Boolean weChatRefundOrderEvent(int refundMoney, BigDecimal orderAmount, String orderNo, String refundNo) { |
| | | Boolean flag; |
| | | Boolean debug = xcxProperties.getDebug(); |
| | | if (debug) { |
| | | if(orderAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, 1, 1, null); |
| | | flag = b; |
| | | }else{ |
| | | flag = true; |
| | | } |
| | | } else { |
| | | if(orderAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | log.info("开始调用退款接口。。。退款编号为{}", refundNo); |
| | | boolean b = weixinServiceUtil.comRefund(orderNo, refundNo, refundMoney, refundMoney, null); |
| | | flag = b; |
| | | }else{ |
| | | flag = true; |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | @Override |
| | | public FebsResponse refundOrder(AdminClothesRefundOrderDto dto) { |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(dto.getId()); |
| | | if(ObjectUtil.isNull(clothesOrder)){ |
| | | return new FebsResponse().fail().message("订单不存在,刷新后重试"); |
| | | } |
| | | Integer status = clothesOrder.getStatus(); |
| | | if(ClothesOrderStatusEnum.WAIT_SHIPPING.getValue() != status){ |
| | | return new FebsResponse().fail().message("订单不是待发货状态"); |
| | | } |
| | | |
| | | //退款订单编号 |
| | | String orderNo = clothesOrder.getOrderNo(); |
| | | //退款退款编号 |
| | | String refundNo = clothesOrder.getOrderNo()+"_REFUND_"+clothesOrder.getId(); |
| | | //退款订单金额 |
| | | BigDecimal orderAmount = clothesOrder.getRealAmount(); |
| | | |
| | | //余额支付退款 |
| | | if(ClothesOrderPayTypeEnum.BALANCE.getName().equals(clothesOrder.getPayMethod())){ |
| | | log.info("余额支付退款"); |
| | | if(orderAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | //更新订单详情 |
| | | clothesUpdateStatusAndUpdateTimeById(clothesOrder.getId(),new Date(),ClothesOrderStatusEnum.CANCEL.getValue()); |
| | | |
| | | memberWalletService.add(orderAmount, clothesOrder.getMemberId(), "balance"); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | clothesOrder.getMemberId(), |
| | | orderAmount, |
| | | ScoreFlowTypeEnum.REFUND.getValue(), |
| | | clothesOrder.getOrderNo(), |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.REFUND.getDesc(),orderAmount), |
| | | 2 |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("退款成功"); |
| | | }else if(ClothesOrderPayTypeEnum.WECHAT.getName().equals(clothesOrder.getPayMethod())){ |
| | | |
| | | int refundMoney = orderAmount.multiply(new BigDecimal(100)).intValue(); |
| | | Boolean flag = weChatRefundOrderEvent(refundMoney, orderAmount, orderNo, refundNo); |
| | | if(flag){ |
| | | if(orderAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | //更新订单详情 |
| | | clothesUpdateStatusAndUpdateTimeById(clothesOrder.getId(),new Date(),ClothesOrderStatusEnum.CANCEL.getValue()); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | clothesOrder.getMemberId(), |
| | | orderAmount, |
| | | ScoreFlowTypeEnum.WECHAT_REFUND.getValue(), |
| | | clothesOrder.getOrderNo(), |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.WECHAT_REFUND.getDesc(),orderAmount), |
| | | 2 |
| | | ); |
| | | } |
| | | }else{ |
| | | return new FebsResponse().fail().message("退款失败,请联系客服人员"); |
| | | } |
| | | }else{ |
| | | return new FebsResponse().fail().message("退款失败,请联系客服人员"); |
| | | } |
| | | |
| | | return new FebsResponse().success().message("退款成功"); |
| | | } |
| | | |
| | | @Override |
| | | public void confirmOrder(long orderId) { |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(orderId); |
| | | if(ObjectUtil.isNotNull(clothesOrder) && ClothesOrderStatusEnum.WAIT_FINISH.getValue() == clothesOrder.getStatus()){ |
| | | clothesUpdateStatusAndUpdateTimeById(clothesOrder.getId(),new Date(),ClothesOrderStatusEnum.FINISH.getValue()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void exportOrderList(List<Long> orderIds, HttpServletResponse response) throws IOException { |
| | | List<ExcelSheetPO> res = new ArrayList<>(); |
| | | |
| | | ExcelSheetPO orderSheet = new ExcelSheetPO(); |
| | | String title = "订单列表"; |
| | | orderSheet.setSheetName(title); |
| | | orderSheet.setTitle(title); |
| | | String[] header = {"订单ID", "订单编号", "收货姓名", "收货电话", "收货地址", "商品详情", "备注", "物流单号", "物流公司", "物流公司码"}; |
| | | orderSheet.setHeaders(header); |
| | | |
| | | QueryRequest request = new QueryRequest(); |
| | | request.setPageNum(1); |
| | | request.setPageSize(9999); |
| | | List<ClothesOrder> dataList = clothesOrderMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesOrder.class) |
| | | .in(ClothesOrder::getId, orderIds) |
| | | .eq(ClothesOrder::getDelFlag, 0) |
| | | .eq(ClothesOrder::getStatus, ClothesOrderStatusEnum.WAIT_SHIPPING.getValue())); |
| | | Map<Long, ClothesType> longClothesTypeHashMap = new HashMap<>(); |
| | | if(CollUtil.isNotEmpty(dataList)){ |
| | | Set<Long> typeIds = dataList.stream().map(ClothesOrder::getTypeId).collect(Collectors.toSet()); |
| | | List<ClothesType> clothesTypes = clothesTypeMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesType.class) |
| | | .in(ClothesType::getId, typeIds) |
| | | ); |
| | | if(CollUtil.isNotEmpty(clothesTypes)){ |
| | | //stream操作clothesTypes,返回一个HashMap<Long, ClothesType>, key为clothesType.id, value为clothesType |
| | | longClothesTypeHashMap = clothesTypes.stream().collect(Collectors.toMap(ClothesType::getId, clothesType -> clothesType)); |
| | | } |
| | | } |
| | | |
| | | List<List<Object>> list = new ArrayList<>(); |
| | | |
| | | if (dataList.size() > 0) { |
| | | for (ClothesOrder item : dataList) { |
| | | List<Object> temp = new ArrayList<>(); |
| | | temp.add(item.getId()); |
| | | temp.add(item.getOrderNo()); |
| | | temp.add(item.getName()); |
| | | temp.add(item.getPhone()); |
| | | temp.add(item.getAddress()); |
| | | temp.add(longClothesTypeHashMap.get(item.getTypeId()).getName()); |
| | | temp.add(item.getRemark()); |
| | | list.add(temp); |
| | | } |
| | | } |
| | | orderSheet.setDataList(list); |
| | | res.add(orderSheet); |
| | | response = ResponseHeadUtil.setExcelHead(response); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode(title + DateUtil.format(new Date(), "yyyyMMDDHHmmss") + ".xlsx".trim(), "UTF-8")); |
| | | OutputStream os = response.getOutputStream(); |
| | | ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true); |
| | | } |
| | | |
| | | @Override |
| | | public void deliverGoodsImport(AdminClothesDeliverGoodsDto dto) { |
| | | ClothesOrder clothesOrder = clothesOrderMapper.selectById(dto.getId()); |
| | | |
| | | if(ObjectUtil.isNull(clothesOrder)){ |
| | | return; |
| | | } |
| | | Integer status = clothesOrder.getStatus(); |
| | | if(ClothesOrderStatusEnum.WAIT_SHIPPING.getValue() != status){ |
| | | return; |
| | | } |
| | | String expressNo = dto.getExpressNo(); |
| | | if(StrUtil.isEmpty(expressNo)){ |
| | | return; |
| | | } |
| | | String expressCom = dto.getExpressCom(); |
| | | if(StrUtil.isEmpty(expressCom)){ |
| | | return; |
| | | } |
| | | mallExpressInfoMapper.update( |
| | | null, |
| | | Wrappers.lambdaUpdate(MallExpressInfo.class) |
| | | .set(MallExpressInfo::getExpressNo, expressNo) |
| | | .set(MallExpressInfo::getExpressCom, expressCom) |
| | | .eq(MallExpressInfo::getOrderId, clothesOrder.getId()) |
| | | .eq(MallExpressInfo::getOrderNo, clothesOrder.getOrderNo()) |
| | | ); |
| | | |
| | | clothesOrderMapper.update( |
| | | null, |
| | | Wrappers.lambdaUpdate(ClothesOrder.class) |
| | | .set(ClothesOrder::getStatus, ClothesOrderStatusEnum.WAIT_FINISH.getValue()) |
| | | .set(ClothesOrder::getUpdatedTime, new Date()) |
| | | .set(ClothesOrder::getDeliveryState, OrderDeliveryStateEnum.DELIVERY_ING.getValue()) |
| | | .eq(ClothesOrder::getId, clothesOrder.getId()) |
| | | ); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo.clothes; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AdminClothesDeliverGoodsVo { |
| | | |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | private String phone; |
| | | |
| | | private String address; |
| | | |
| | | private String expressCom; |
| | | |
| | | private String expressNo; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo.clothes; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class AdminClothesOrderListVo { |
| | | |
| | | private Long id; |
| | | private Long typeId; |
| | | |
| | | private String memberName; |
| | | private String typeName; |
| | | private String typeImage; |
| | | |
| | | private String orderNo; |
| | | private Date orderTime; |
| | | private Integer goodsCnt; |
| | | private Integer status; |
| | | private String remark; |
| | | |
| | | |
| | | private Date payTime; |
| | | private String payMethod; |
| | | private String payOrderNo; |
| | | private Integer payResult; |
| | | |
| | | private Integer deliveryState; |
| | | |
| | | private BigDecimal amount; |
| | | private BigDecimal discountAmount; |
| | | private BigDecimal carriage; |
| | | private BigDecimal realAmount; |
| | | |
| | | private Integer commentState; |
| | | } |
| | |
| | | b.name as typeName, |
| | | b.image as typeImage, |
| | | a.goods_cnt as goodsCnt |
| | | from clothes_order_graft a |
| | | from clothes_order a |
| | | left join clothes_type b on a.type_id = b.id |
| | | <where> |
| | | and a.member_id = #{record.memberId} |
| | |
| | | order by a.CREATED_TIME desc |
| | | </select> |
| | | |
| | | <select id="selectOrderListInPage" resultType="cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo"> |
| | | select |
| | | a.id as id, |
| | | a.type_id as typeId, |
| | | |
| | | c.name as memberName, |
| | | b.name as typeName, |
| | | b.image as typeImage, |
| | | |
| | | a.order_no as orderNo, |
| | | a.order_time as orderTime, |
| | | a.goods_cnt as goodsCnt, |
| | | a.status as status, |
| | | a.remark as remark, |
| | | |
| | | a.pay_time as payTime, |
| | | a.pay_method as payMethod, |
| | | a.pay_order_no as payOrderNo, |
| | | a.pay_result as payResult, |
| | | |
| | | a.delivery_state as deliveryState, |
| | | |
| | | a.amount as amount, |
| | | a.discount_amount as discountAmount, |
| | | a.carriage as carriage, |
| | | a.real_amount as realAmount, |
| | | a.comment_state as commentState |
| | | from clothes_order a |
| | | left join clothes_type b on a.type_id = b.id |
| | | left join mall_member c on a.member_id = c.id |
| | | |
| | | <where> |
| | | <if test="record != null"> |
| | | <if test="record.payResult != null"> |
| | | and a.pay_result = #{record.payResult} |
| | | </if> |
| | | <if test="record.status != null"> |
| | | and a.status = #{record.status} |
| | | </if> |
| | | <if test="record.orderNo != null and record.orderNo != ''"> |
| | | and a.order_no like CONCAT('%', CONCAT(#{record.orderNo}, '%')) |
| | | </if> |
| | | <if test="record.name != null and record.name != ''"> |
| | | and c.name like CONCAT('%', CONCAT(#{record.name}, '%')) |
| | | </if> |
| | | <if test="record.startTime != null and record.startTime != ''"> |
| | | and a.order_time >= #{record.startTime} |
| | | </if> |
| | | <if test="record.endTime != null and record.endTime != ''"> |
| | | and a.order_time <= #{record.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by a.created_time desc |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <style> |
| | | #deliver-update-clothes { |
| | | padding: 20px 25px 25px 0; |
| | | } |
| | | |
| | | #deliver-update-clothes .layui-treeSelect .ztree li a, .ztree li span { |
| | | margin: 0 0 2px 3px !important; |
| | | } |
| | | #deliver-update-clothes #data-permission-tree-block { |
| | | border: 1px solid #eee; |
| | | border-radius: 2px; |
| | | padding: 3px 0; |
| | | } |
| | | #deliver-update-clothes .layui-treeSelect .ztree li span.button.switch { |
| | | top: 1px; |
| | | left: 3px; |
| | | } |
| | | |
| | | </style> |
| | | <div class="layui-fluid" id="deliver-update-clothes"> |
| | | <form class="layui-form" action="" lay-filter="deliver-update-clothes-form"> |
| | | <div class="layui-form-item febs-hide"> |
| | | <label class="layui-form-label febs-form-item-require">id:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="id"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">收货人:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" |
| | | 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"> |
| | | <input type="text" name="phone" |
| | | 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"> |
| | | <input type="text" name="address" |
| | | 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"> |
| | | <input type="text" name="expressNo" lay-verify="required" |
| | | autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">物流公司:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="expressCom" lay-verify="required" |
| | | autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="deliver-update-clothes-form-submit" id="submit"></button> |
| | | <button class="layui-btn" lay-submit="" lay-filter="deliverInfo-update-clothes-form-submit" id="deliverInfoSubmit"></button> |
| | | </div> |
| | | </form> |
| | | </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, |
| | | deliverInfo = [[${deliverInfo}]], |
| | | $view = $('#deliver-update-clothes'), |
| | | validate = layui.validate, |
| | | _deptTree; |
| | | |
| | | form.render(); |
| | | |
| | | initUserValue(); |
| | | |
| | | function initUserValue() { |
| | | form.val("deliver-update-clothes-form", { |
| | | "id": deliverInfo.id, |
| | | "name": deliverInfo.name, |
| | | "phone": deliverInfo.phone, |
| | | "expressCom": deliverInfo.expressCom, |
| | | "expressNo": deliverInfo.expressNo, |
| | | "address": deliverInfo.address |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(deliver-update-clothes-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/clothesType/deliverGoods', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('操作成功'); |
| | | $('#febs-clothes-order').find('#query').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | form.on('submit(deliverInfo-update-clothes-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/clothesType/deliverGoodsUpdate', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('操作成功'); |
| | | $('#febs-clothes-order').find('#query').click(); |
| | | }); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
New file |
| | |
| | | <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="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 === '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 != 1){ |
| | | febs.alert.warn('请选择待发货的订单'); |
| | | return; |
| | | } |
| | | } |
| | | if(ids == null || ids == ""){ |
| | | febs.alert.warn('请选择订单'); |
| | | return; |
| | | } |
| | | febs.modal.open('发货', 'modules/clothesType/deliverGoods/' + data.id, { |
| | | 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; |
| | | } |
| | | } |
| | | if(ids == null || ids == ""){ |
| | | febs.alert.warn('请选择订单'); |
| | | return; |
| | | } |
| | | febs.modal.open('修改物流信息', 'modules/clothesType/deliverGoods/' + data.id, { |
| | | 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='+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/order/exportOrderList?ids="+ids; |
| | | } |
| | | |
| | | }); |
| | | |
| | | 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: '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: 'goodsName', title: '商品', minWidth: 160,align:'left'}, |
| | | {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(), |
| | | isHome: $searchForm.find("select[name='isHome']").val(), |
| | | uniqueCode: $searchForm.find("select[name='uniqueCode']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |