From bbd23caefff0291b6395a68ed0664d7728ef1285 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Sun, 31 Mar 2019 13:22:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=94=B6=E4=BB=B6=E4=BA=BA=E4=BF=A1=E6=81=AF=20-=20=E5=88=86?= =?UTF-8?q?=E7=A6=BB=E8=AE=A2=E5=8D=95=E7=89=A9=E6=B5=81=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/mall/order/api/OrderService.java | 8 ++ .../cn/iocoder/mall/order/api/bo/OrderBO.java | 12 +- .../mall/order/api/bo/OrderRecipientBO.java | 103 +++++++++++++++ .../order/api/constant/LogisticsEnum.java | 41 ++++++ .../mall/order/api/dto/OrderDeliveryDTO.java | 122 ++++++++++++++++++ .../biz/convert/OrderRecipientConvert.java | 28 ++++ .../order/biz/dao/OrderRecipientMapper.java | 36 ++++++ .../biz/dataobject/OrderRecipientDO.java | 103 +++++++++++++++ .../order/biz/service/OrderServiceImpl.java | 54 ++++---- .../resources/mapper/OrderRecipientMapper.xml | 35 +++++ 10 files changed, 508 insertions(+), 34 deletions(-) create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java create mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java create mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java create mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java create mode 100644 order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java index 046d84c77..e3075366f 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java @@ -56,6 +56,14 @@ public interface OrderService { */ CommonResult cancelOrder(Integer orderId, Integer reasons, String otherReasons); + /** + * 订单发货 + * + * @param orderDelivery + * @return + */ + CommonResult orderDelivery(OrderDeliveryDTO orderDelivery); + /** * 更新订单 - 备注 * diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java index 4b2d3a8d6..b483ab3b5 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderBO.java @@ -90,7 +90,7 @@ public class OrderBO implements Serializable { /** * 订单物流信息 */ - private OrderLogisticsBO orderLogistics; + private OrderRecipientBO orderRecipient; @Override public String toString() { @@ -108,7 +108,7 @@ public class OrderBO implements Serializable { ", status=" + status + ", remark='" + remark + '\'' + ", orderItems=" + orderItems + - ", orderLogistics=" + orderLogistics + + ", orderRecipient=" + orderRecipient + '}'; } @@ -229,12 +229,12 @@ public class OrderBO implements Serializable { return this; } - public OrderLogisticsBO getOrderLogistics() { - return orderLogistics; + public OrderRecipientBO getOrderRecipient() { + return orderRecipient; } - public OrderBO setOrderLogistics(OrderLogisticsBO orderLogistics) { - this.orderLogistics = orderLogistics; + public OrderBO setOrderRecipient(OrderRecipientBO orderRecipient) { + this.orderRecipient = orderRecipient; return this; } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java new file mode 100644 index 000000000..eb0a6ba4c --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderRecipientBO.java @@ -0,0 +1,103 @@ +package cn.iocoder.mall.order.api.bo; + +import cn.iocoder.common.framework.dataobject.BaseDO; + +/** + * 订单收件人信息 order_recipient + * + * @author Sin + * @time 2019-03-31 11:37 + */ +public class OrderRecipientBO extends BaseDO { + + /** + * 编号 + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + + @Override + public String toString() { + return "OrderRecipientBO{" + + "id=" + id + + ", orderId=" + orderId + + ", areaNo='" + areaNo + '\'' + + ", name='" + name + '\'' + + ", mobile='" + mobile + '\'' + + ", address='" + address + '\'' + + '}'; + } + + public Integer getId() { + return id; + } + + public OrderRecipientBO setId(Integer id) { + this.id = id; + return this; + } + + public Integer getOrderId() { + return orderId; + } + + public OrderRecipientBO setOrderId(Integer orderId) { + this.orderId = orderId; + return this; + } + + public String getAreaNo() { + return areaNo; + } + + public OrderRecipientBO setAreaNo(String areaNo) { + this.areaNo = areaNo; + return this; + } + + public String getName() { + return name; + } + + public OrderRecipientBO setName(String name) { + this.name = name; + return this; + } + + public String getMobile() { + return mobile; + } + + public OrderRecipientBO setMobile(String mobile) { + this.mobile = mobile; + return this; + } + + public String getAddress() { + return address; + } + + public OrderRecipientBO setAddress(String address) { + this.address = address; + return this; + } +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java new file mode 100644 index 000000000..d9b7332aa --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/LogisticsEnum.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.api.constant; + +/** + * 物流信息 + * + * @author Sin + * @time 2019-03-30 22:33 + */ +public enum LogisticsEnum { + + LOGISTICS_1(1, "顺丰快递"), + LOGISTICS_2(2, "圆通快递"), + LOGISTICS_3(3, "申通快递"), + LOGISTICS_4(4, "韵答快递"), + LOGISTICS_5(5, "天天快递"), + LOGISTICS_6(6, "EMS中国邮政"), + + ; + + /** + * 状态值 + */ + private Integer value; + /** + * 状态名 + */ + private String name; + + LogisticsEnum(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + public String getName() { + return name; + } +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java new file mode 100644 index 000000000..7b1b59cf3 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/OrderDeliveryDTO.java @@ -0,0 +1,122 @@ +package cn.iocoder.mall.order.api.dto; + +import java.io.Serializable; +import java.util.List; + +/** + * 订单发货 + * + * @author Sin + * @time 2019-03-30 22:31 + */ +public class OrderDeliveryDTO implements Serializable { + + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + /** + * 物流 (字典) + */ + private Integer logistics; + /** + * 物流编号 + */ + private String logisticsNo; + + /// + /// 物理信息是跟 orderItem 走 + + /** + * 订单 orderItemId + */ + private List orderItemIds; + + @Override + public String toString() { + return "OrderDeliverGoodsDTO{" + + "areaNo='" + areaNo + '\'' + + ", name='" + name + '\'' + + ", mobile='" + mobile + '\'' + + ", address='" + address + '\'' + + ", logistics=" + logistics + + ", logisticsNo='" + logisticsNo + '\'' + + ", orderItemIds=" + orderItemIds + + '}'; + } + + public String getAreaNo() { + return areaNo; + } + + public OrderDeliveryDTO setAreaNo(String areaNo) { + this.areaNo = areaNo; + return this; + } + + public String getName() { + return name; + } + + public OrderDeliveryDTO setName(String name) { + this.name = name; + return this; + } + + public String getMobile() { + return mobile; + } + + public OrderDeliveryDTO setMobile(String mobile) { + this.mobile = mobile; + return this; + } + + public String getAddress() { + return address; + } + + public OrderDeliveryDTO setAddress(String address) { + this.address = address; + return this; + } + + public Integer getLogistics() { + return logistics; + } + + public OrderDeliveryDTO setLogistics(Integer logistics) { + this.logistics = logistics; + return this; + } + + public String getLogisticsNo() { + return logisticsNo; + } + + public OrderDeliveryDTO setLogisticsNo(String logisticsNo) { + this.logisticsNo = logisticsNo; + return this; + } + + public List getOrderItemIds() { + return orderItemIds; + } + + public OrderDeliveryDTO setOrderItemIds(List orderItemIds) { + this.orderItemIds = orderItemIds; + return this; + } +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java new file mode 100644 index 000000000..8a40c914a --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderRecipientConvert.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.order.biz.convert; + +import cn.iocoder.mall.order.api.bo.OrderRecipientBO; +import cn.iocoder.mall.order.api.dto.OrderCreateDTO; +import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO; +import org.mapstruct.Mapper; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 订单收件人信息 + * + * @author Sin + * @time 2019-03-31 12:50 + */ +@Mapper +public interface OrderRecipientConvert { + + OrderRecipientConvert INSTANCE = Mappers.getMapper(OrderRecipientConvert.class); + + @Mappings({}) + OrderRecipientDO convert(OrderCreateDTO orderCreateDTO); + + @Mappings({}) + List convert(List orderRecipientDOList); +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java new file mode 100644 index 000000000..a529013ce --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderRecipientMapper.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.order.biz.dao; + +import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; + +/** + * 订单收件人 信息 + * + * @author Sin + * @time 2019-03-31 12:16 + */ +@Repository +public interface OrderRecipientMapper { + + /** + * 插入 - 订单收件人 + * + * @param orderRecipient + * @return + */ + int insert(OrderRecipientDO orderRecipient); + + /** + * 查询 - 根据 orderIds + * + * @param orderIds + * @return + */ + List selectByOrderIds( + @Param("orderIds")Collection orderIds + ); +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java new file mode 100644 index 000000000..27d27ada2 --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderRecipientDO.java @@ -0,0 +1,103 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.common.framework.dataobject.BaseDO; + +/** + * 订单收件人信息 order_recipient + * + * @author Sin + * @time 2019-03-31 11:37 + */ +public class OrderRecipientDO extends BaseDO { + + /** + * 编号 + */ + private Integer id; + /** + * 订单id + */ + private Integer orderId; + /** + * 收件区域编号 + */ + private String areaNo; + /** + * 收件人名称 + */ + private String name; + /** + * 收件手机号 + */ + private String mobile; + /** + * 收件详细地址 + */ + private String address; + + @Override + public String toString() { + return "OrderRecipientDO{" + + "id=" + id + + ", orderId=" + orderId + + ", areaNo='" + areaNo + '\'' + + ", name='" + name + '\'' + + ", mobile='" + mobile + '\'' + + ", address='" + address + '\'' + + '}'; + } + + public Integer getId() { + return id; + } + + public OrderRecipientDO setId(Integer id) { + this.id = id; + return this; + } + + public Integer getOrderId() { + return orderId; + } + + public OrderRecipientDO setOrderId(Integer orderId) { + this.orderId = orderId; + return this; + } + + public String getAreaNo() { + return areaNo; + } + + public OrderRecipientDO setAreaNo(String areaNo) { + this.areaNo = areaNo; + return this; + } + + public String getName() { + return name; + } + + public OrderRecipientDO setName(String name) { + this.name = name; + return this; + } + + public String getMobile() { + return mobile; + } + + public OrderRecipientDO setMobile(String mobile) { + this.mobile = mobile; + return this; + } + + public String getAddress() { + return address; + } + + public OrderRecipientDO setAddress(String address) { + this.address = address; + return this; + } +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java index d7e6f3ed9..909b3471e 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderServiceImpl.java @@ -13,14 +13,9 @@ import cn.iocoder.mall.order.biz.OrderCommon; import cn.iocoder.mall.order.biz.convert.OrderConvert; import cn.iocoder.mall.order.biz.convert.OrderItemConvert; import cn.iocoder.mall.order.biz.convert.OrderLogisticsConvert; -import cn.iocoder.mall.order.biz.dao.OrderCancelMapper; -import cn.iocoder.mall.order.biz.dao.OrderItemMapper; -import cn.iocoder.mall.order.biz.dao.OrderLogisticsMapper; -import cn.iocoder.mall.order.biz.dao.OrderMapper; -import cn.iocoder.mall.order.biz.dataobject.OrderCancelDO; -import cn.iocoder.mall.order.biz.dataobject.OrderDO; -import cn.iocoder.mall.order.biz.dataobject.OrderItemDO; -import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO; +import cn.iocoder.mall.order.biz.convert.OrderRecipientConvert; +import cn.iocoder.mall.order.biz.dao.*; +import cn.iocoder.mall.order.biz.dataobject.*; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -47,6 +42,8 @@ public class OrderServiceImpl implements OrderService { @Autowired private OrderLogisticsMapper orderLogisticsMapper; @Autowired + private OrderRecipientMapper orderRecipientMapper; + @Autowired private OrderCancelMapper orderCancelMapper; @Autowired private OrderCommon orderCommon; @@ -67,16 +64,11 @@ public class OrderServiceImpl implements OrderService { .map(orderDO -> orderDO.getId()) .collect(Collectors.toSet()); - Set orderLogisticsIds = orderDOList.stream() - .map(orderDO -> orderDO.getOrderLogisticsId()) - .collect(Collectors.toSet()); - // 获取物流信息 - List orderLogisticsDOList = orderLogisticsMapper.selectByIds(orderLogisticsIds); - List orderLogisticsBOList - = OrderLogisticsConvert.INSTANCE.convertOrderLogisticsBO(orderLogisticsDOList); - Map orderLogisticsDOMap - = orderLogisticsBOList.stream().collect(Collectors.toMap(OrderLogisticsBO::getId, obj -> obj)); + List orderRecipientDOList = orderRecipientMapper.selectByOrderIds(orderIds); + List orderRecipientBOList = OrderRecipientConvert.INSTANCE.convert(orderRecipientDOList); + Map orderRecipientBOMap + = orderRecipientBOList.stream().collect(Collectors.toMap(OrderRecipientBO::getOrderId, obj -> obj)); // 获取 订单的 items List orderItemDOList = orderItemMapper @@ -100,8 +92,8 @@ public class OrderServiceImpl implements OrderService { if (orderItemBOMultimap.containsKey(orderBO.getId())) { orderBO.setOrderItems(orderItemBOMultimap.get(orderBO.getId())); } - if (orderLogisticsDOMap.containsKey(orderBO.getOrderLogisticsId())) { - orderBO.setOrderLogistics(orderLogisticsDOMap.get(orderBO.getOrderLogisticsId())); + if (orderRecipientBOMap.containsKey(orderBO.getId())) { + orderBO.setOrderRecipient(orderRecipientBOMap.get(orderBO.getId())); } return orderBO; }).collect(Collectors.toList()); @@ -117,7 +109,7 @@ public class OrderServiceImpl implements OrderService { @Transactional public CommonResult createOrder(Integer userId, OrderCreateDTO orderCreateDTO) { List orderItemDTOList = orderCreateDTO.getOrderItems(); - OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderCreateDTO); + OrderRecipientDO orderRecipientDO = OrderRecipientConvert.INSTANCE.convert(orderCreateDTO); List orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList); // TODO: 2019-03-24 sin 校验商品是否存在 @@ -137,17 +129,10 @@ public class OrderServiceImpl implements OrderService { // orderItemDO.setPrice(1000); // } - // 物流信息 - orderLogisticsDO - .setLogisticsNo("") - .setCreateTime(new Date()) - .setUpdateTime(null); - orderLogisticsMapper.insert(orderLogisticsDO); - // order OrderDO orderDO = new OrderDO() .setUserId(userId) - .setOrderLogisticsId(orderLogisticsDO.getId()) + .setOrderLogisticsId(null) .setOrderNo(UUID.randomUUID().toString().replace("-", "")) .setPayAmount(-1) // 先设置一个默认值,金额在下面计算 .setClosingTime(null) @@ -162,6 +147,14 @@ public class OrderServiceImpl implements OrderService { orderDO.setUpdateTime(null); orderMapper.insert(orderDO); + // 收件人信息 + orderRecipientDO + .setOrderId(orderDO.getId()) + .setCreateTime(new Date()) + .setUpdateTime(null); + + orderRecipientMapper.insert(orderRecipientDO); + // order item orderItemDOList.forEach(orderItemDO -> { int goodsPrice = 1000; // 商品单价 @@ -271,6 +264,11 @@ public class OrderServiceImpl implements OrderService { return CommonResult.success(null); } + @Override + public CommonResult orderDelivery(OrderDeliveryDTO orderDelivery) { + return null; + } + @Override public CommonResult updateOrderRemake(Integer orderId, String remake) { // 此处不做订单校验,直接设置备注即可 diff --git a/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml new file mode 100644 index 000000000..b2d9f675b --- /dev/null +++ b/order/order-service-impl/src/main/resources/mapper/OrderRecipientMapper.xml @@ -0,0 +1,35 @@ + + + + + + id, order_id, `area_no`, `name`, mobile, address, + create_time, update_time + + + + + INSERT INTO `order_recipient` ( + order_id, `area_no`, `name`, mobile, address, + create_time, update_time + ) VALUES ( + #{orderId}, #{areaNo}, #{name}, #{mobile}, #{address}, + #{createTime}, #{updateTime} + ) + + + + + From 5b51d529ded79dd4c52a52fe28cc5f178770756f Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Sun, 31 Mar 2019 14:46:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=96=E6=B6=88=20-=20=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20-=20=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-web/config/config.js | 2 +- admin-web/config/router.config.js | 5 + admin-web/src/components/OrderTable/index.js | 8 + admin-web/src/locales/zh-CN/menu.js | 3 +- admin-web/src/models/order/orderDelivery.js | 25 + admin-web/src/models/order/orderList.js | 66 +- admin-web/src/pages/Order/OrderCancel.js | 84 +++ admin-web/src/pages/Order/OrderDelivery.js | 5 + admin-web/src/pages/Order/OrderDetails.js | 691 ++++++++++++++++++ admin-web/src/pages/Order/OrderDetails.less | 49 ++ admin-web/src/pages/Order/OrderList.js | 109 ++- admin-web/src/pages/Order/OrderList.less | 29 +- admin-web/src/pages/Order/OrderRefunds.js | 321 ++++++++ admin-web/src/pages/Order/OrderRemark.js | 56 ++ .../src/pages/Order/OrderUpdatePayAmount.js | 4 +- admin-web/src/services/order.js | 21 + admin-web/src/utils/dictionary.js | 1 + admin-web/src/utils/request.qs.js | 8 +- 18 files changed, 1438 insertions(+), 49 deletions(-) create mode 100644 admin-web/src/components/OrderTable/index.js create mode 100644 admin-web/src/models/order/orderDelivery.js create mode 100644 admin-web/src/pages/Order/OrderCancel.js create mode 100644 admin-web/src/pages/Order/OrderDelivery.js create mode 100644 admin-web/src/pages/Order/OrderDetails.js create mode 100644 admin-web/src/pages/Order/OrderDetails.less create mode 100644 admin-web/src/pages/Order/OrderRefunds.js create mode 100644 admin-web/src/pages/Order/OrderRemark.js diff --git a/admin-web/config/config.js b/admin-web/config/config.js index 95c640a50..0e63fb05c 100644 --- a/admin-web/config/config.js +++ b/admin-web/config/config.js @@ -65,7 +65,7 @@ if (APP_TYPE === 'site') { export default { // add for transfer to umi base: basePath, - publicPath: basePath, + // publicPath: basePath, plugins, define: { APP_TYPE: APP_TYPE || '', diff --git a/admin-web/config/router.config.js b/admin-web/config/router.config.js index 920467940..932f5bee0 100644 --- a/admin-web/config/router.config.js +++ b/admin-web/config/router.config.js @@ -69,6 +69,11 @@ export default [ name: 'order-list', component: './Order/OrderList', }, + { + path: '/order/order-refunds', + name: 'order-refunds', + component: './Order/OrderRefunds', + }, ], }, // product diff --git a/admin-web/src/components/OrderTable/index.js b/admin-web/src/components/OrderTable/index.js new file mode 100644 index 000000000..2c74867eb --- /dev/null +++ b/admin-web/src/components/OrderTable/index.js @@ -0,0 +1,8 @@ +// import React, { PureComponent } from 'react'; +// import {} from 'antd'; +// +// export default class OrderTable extends PureComponent { +// render() { +// return
cc
; +// } +// } diff --git a/admin-web/src/locales/zh-CN/menu.js b/admin-web/src/locales/zh-CN/menu.js index 111932c6a..9695fe996 100644 --- a/admin-web/src/locales/zh-CN/menu.js +++ b/admin-web/src/locales/zh-CN/menu.js @@ -52,6 +52,7 @@ export default { // 订单 'menu.order': '订单管理', 'menu.order.order-list': '订单管理', + 'menu.order.order-refunds': '退货维权', // 营销相关 - 'menu.promotion.promotion-banner-list': 'Banner 管理' + 'menu.promotion.promotion-banner-list': 'Banner 管理', }; diff --git a/admin-web/src/models/order/orderDelivery.js b/admin-web/src/models/order/orderDelivery.js new file mode 100644 index 000000000..6aa33ebb4 --- /dev/null +++ b/admin-web/src/models/order/orderDelivery.js @@ -0,0 +1,25 @@ +// import { cancelOrder } from '../../services/order'; +// +// export default { +// namespace: 'orderDelivery', +// +// state: { +// orderId: 0, +// visible: false, +// }, +// +// effects: { +// *getLogistics({ payload }, { call, put }) {}, +// }, +// +// reducers: { +// changeVisible(state, { payload }) { +// const { orderId, visible } = payload; +// return { +// ...state, +// orderId, +// visible, +// }; +// }, +// }, +// }; diff --git a/admin-web/src/models/order/orderList.js b/admin-web/src/models/order/orderList.js index babef4370..4a3468e93 100644 --- a/admin-web/src/models/order/orderList.js +++ b/admin-web/src/models/order/orderList.js @@ -1,5 +1,11 @@ import { message } from 'antd'; -import { orderPage, updateOrderItem, updateOrderItemPayAmount } from '../../services/order'; +import { + orderPage, + updateOrderItem, + updateOrderItemPayAmount, + updateRemark, + cancelOrder, +} from '../../services/order'; export default { namespace: 'orderList', @@ -18,6 +24,12 @@ export default { orderId: 0, orderItemId: 0, searchParams: {}, + + remarkVisible: false, + remark: '', + + orderCancelVisible: false, + orderCancelShowOther: false, }, effects: { @@ -70,6 +82,40 @@ export default { }, }); + yield put({ + type: 'queryPage', + payload: { + ...searchParams, + }, + }); + }, + *updateRemake({ payload }, { call, put }) { + const { searchParams, params } = payload; + yield call(updateRemark, params); + yield put({ + type: 'changeRemakeVisible', + payload: { + remarkVisible: false, + }, + }); + + yield put({ + type: 'queryPage', + payload: { + ...searchParams, + }, + }); + }, + *cancelOrder({ payload }, { call, put }) { + const { searchParams, params } = payload; + yield call(cancelOrder, params); + yield put({ + type: 'changeOrderCancelVisible', + payload: { + orderCancelVisible: false, + }, + }); + yield put({ type: 'queryPage', payload: { @@ -99,5 +145,23 @@ export default { ...payload, }; }, + changeRemakeVisible(state, { payload }) { + return { + ...state, + ...payload, + }; + }, + changeOrderCancelVisible(state, { payload }) { + return { + ...state, + ...payload, + }; + }, + changeOrderCancelShowOther(state, { payload }) { + return { + ...state, + ...payload, + }; + }, }, }; diff --git a/admin-web/src/pages/Order/OrderCancel.js b/admin-web/src/pages/Order/OrderCancel.js new file mode 100644 index 000000000..5a58df109 --- /dev/null +++ b/admin-web/src/pages/Order/OrderCancel.js @@ -0,0 +1,84 @@ +import React from 'react'; +import { Form, Input, Modal } from 'antd'; +import DictionarySelect from '@/components/Dictionary/DictionarySelect'; +import dictionary from '@/utils/dictionary'; + +const FormItem = Form.Item; + +// 订单 - 更新支付金额 +const OrderCancel = Form.create()(props => { + const { form, dispatch, loading } = props; + const { orderId, orderCancelVisible, orderCancelShowOther, searchParams } = props.orderList; + const { getFieldDecorator } = props.form; + + const handleOk = e => { + e.preventDefault(); + form.validateFields((err, fields) => { + if (err) return; + dispatch({ + type: 'orderList/cancelOrder', + payload: { + params: { + orderId, + reasons: fields.reasons, + otherReasons: fields.otherReasons, + }, + searchParams, + }, + }); + }); + }; + + const handleCancel = () => { + dispatch({ + type: 'orderList/changeRemakeVisible', + payload: { + remarkVisible: false, + }, + }); + }; + + const handleReasonsChange = key => { + dispatch({ + type: 'orderList/changeOrderCancelShowOther', + payload: { + orderCancelShowOther: key === '20', + }, + }); + }; + + return ( + + + {getFieldDecorator('reasons', { + rules: [{ required: true, message: '请选择取消原因!' }], + })( + + )} + + {orderCancelShowOther ? ( + + {getFieldDecorator('otherReasons', { + rules: [{ required: true, message: '请输填写退款原因!' }], + })()} + + ) : ( + '' + )} + + ); +}); + +export default OrderCancel; diff --git a/admin-web/src/pages/Order/OrderDelivery.js b/admin-web/src/pages/Order/OrderDelivery.js new file mode 100644 index 000000000..f03e59668 --- /dev/null +++ b/admin-web/src/pages/Order/OrderDelivery.js @@ -0,0 +1,5 @@ +// import React, { PureComponent } from 'react'; +// +// class OrderDelivery extends PureComponent {} +// +// export default OrderDelivery; diff --git a/admin-web/src/pages/Order/OrderDetails.js b/admin-web/src/pages/Order/OrderDetails.js new file mode 100644 index 000000000..f1635f53a --- /dev/null +++ b/admin-web/src/pages/Order/OrderDetails.js @@ -0,0 +1,691 @@ +import React, { PureComponent, Fragment } from 'react'; +import { connect } from 'dva'; +import moment from 'moment'; +import router from 'umi/router'; +import { + Row, + Col, + Card, + Form, + Input, + Select, + Icon, + Button, + Dropdown, + Menu, + InputNumber, + DatePicker, + Modal, + message, + Badge, + Divider, + Steps, + Radio, +} from 'antd'; +import StandardTable from '@/components/StandardTable'; +import PageHeaderWrapper from '@/components/PageHeaderWrapper'; + +import styles from './OrderDetails.less'; + +const FormItem = Form.Item; +const { Step } = Steps; +const { TextArea } = Input; +const { Option } = Select; +const RadioGroup = Radio.Group; +const getValue = obj => + Object.keys(obj) + .map(key => obj[key]) + .join(','); +const statusMap = ['default', 'processing', 'success', 'error']; +const status = ['关闭', '运行中', '已上线', '异常']; + +const CreateForm = Form.create()(props => { + const { modalVisible, form, handleAdd, handleModalVisible } = props; + const okHandle = () => { + form.validateFields((err, fieldsValue) => { + if (err) return; + form.resetFields(); + handleAdd(fieldsValue); + }); + }; + return ( + handleModalVisible()} + > + + {form.getFieldDecorator('desc', { + rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }], + })()} + + + ); +}); + +@Form.create() +class UpdateForm extends PureComponent { + static defaultProps = { + handleUpdate: () => {}, + handleUpdateModalVisible: () => {}, + values: {}, + }; + + constructor(props) { + super(props); + + this.state = { + formVals: { + name: props.values.name, + desc: props.values.desc, + key: props.values.key, + target: '0', + template: '0', + type: '1', + time: '', + frequency: 'month', + }, + currentStep: 0, + }; + + this.formLayout = { + labelCol: { span: 7 }, + wrapperCol: { span: 13 }, + }; + } + + handleNext = currentStep => { + const { form, handleUpdate } = this.props; + const { formVals: oldValue } = this.state; + form.validateFields((err, fieldsValue) => { + if (err) return; + const formVals = { ...oldValue, ...fieldsValue }; + this.setState( + { + formVals, + }, + () => { + if (currentStep < 2) { + this.forward(); + } else { + handleUpdate(formVals); + } + } + ); + }); + }; + + backward = () => { + const { currentStep } = this.state; + this.setState({ + currentStep: currentStep - 1, + }); + }; + + forward = () => { + const { currentStep } = this.state; + this.setState({ + currentStep: currentStep + 1, + }); + }; + + renderContent = (currentStep, formVals) => { + const { form } = this.props; + if (currentStep === 1) { + return [ + + {form.getFieldDecorator('target', { + initialValue: formVals.target, + })( + + )} + , + + {form.getFieldDecorator('template', { + initialValue: formVals.template, + })( + + )} + , + + {form.getFieldDecorator('type', { + initialValue: formVals.type, + })( + + + + + )} + , + ]; + } + if (currentStep === 2) { + return [ + + {form.getFieldDecorator('time', { + rules: [{ required: true, message: '请选择开始时间!' }], + })( + + )} + , + + {form.getFieldDecorator('frequency', { + initialValue: formVals.frequency, + })( + + )} + , + ]; + } + return [ + + {form.getFieldDecorator('name', { + rules: [{ required: true, message: '请输入规则名称!' }], + initialValue: formVals.name, + })()} + , + + {form.getFieldDecorator('desc', { + rules: [{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 }], + initialValue: formVals.desc, + })(