2025008071805

This commit is contained in:
张潘 2025-08-12 17:26:10 +08:00
parent e4de44f977
commit 04a7dd0bd6
25 changed files with 2695 additions and 783 deletions

View File

@ -600,7 +600,7 @@ public class AppleMemberController extends BaseController {
}
// 5. 检查是否已经评价过
int count = orderCommentService.selectCountOrderCommentByOid(order.getId());
int count = orderCommentService.selectCountOrderCommentByOid(order.getOrderId());
if (count > 0) {
return AppletControllerUtil.appletWarning("请勿重复提交");
}
@ -679,7 +679,7 @@ public class AppleMemberController extends BaseController {
}
// 5. 检查是否已经评价过
int count = orderCommentService.selectCountOrderCommentByOid(goodsOrder.getId());
int count = orderCommentService.selectCountOrderCommentByOid(goodsOrder.getMainOrderId());
if (count > 0) {
return AppletControllerUtil.appletWarning("请勿重复提交");
}
@ -697,7 +697,7 @@ public class AppleMemberController extends BaseController {
// 7. 构建评价数据
OrderComment comment = new OrderComment();
comment.setOid(goodsOrder.getId());
comment.setOrderId(goodsOrder.getOrderId());
comment.setOrderId(goodsOrder.getMainOrderId());
comment.setProductId(goodsOrder.getProductId());
comment.setContent(content);
comment.setNum(Long.valueOf(num));
@ -720,7 +720,7 @@ public class AppleMemberController extends BaseController {
if (result > 0) {
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("name", "用户已评价");
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getOrderId(), "已评价", "4", jsonObject, 2L);
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getMainOrderId(), "已评价", "4", jsonObject, 2L);
com.alibaba.fastjson.JSONObject jsonObject1 = new com.alibaba.fastjson.JSONObject();
Map<String, Object> logContent1 = new HashMap<>();
logContent1.put("text", content);
@ -728,7 +728,7 @@ public class AppleMemberController extends BaseController {
logContent1.put("labels", params.get("labels"));
logContent1.put("num", num);
jsonObject1= com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(logContent1));
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getOrderId(), "已完成", "5", jsonObject1, 2L);
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getMainOrderId(), "已完成", "5", jsonObject1, 2L);
goodsOrder.setStatus(5L); // 订单状态改为已收货
goodsOrderService.updateGoodsOrder(goodsOrder);
return AjaxResult.success();

View File

@ -2233,6 +2233,17 @@ public class AppleOrderController extends BaseController {
orderMap.put("orcerCrateTime", sdf.format(order.getCreatedAt()));
orderMap.put("num", order.getNum());
orderMap.put("statusText", getOrderStatusText(order.getStatus()));
String firstOrderId = OrderUtil.findUserFirstOrderId(order.getUid());
if (firstOrderId != null){
if (firstOrderId.equals(order.getOrderId())){
orderMap.put("isFirst", true);
}else{
orderMap.put("isFirst", false);
}
}else{
orderMap.put("isFirst", false);
}
// 订单类型
orderMap.put("bigtype", getOrderBigType(order.getBigtype()));
orderMap.put("bigtypeText", getOrderBigTypeText(order.getBigtype()));
@ -2351,6 +2362,7 @@ public class AppleOrderController extends BaseController {
@RequestParam(value = "limit", defaultValue = "10") int limit,
@RequestParam(value = "dayDate", required = false) String dayDate,
@RequestParam(value = "day", required = false) String day,
@RequestParam(value = "orderid", required = false) String orderid,
HttpServletRequest request) {
try {
int pageNum=page;
@ -2373,6 +2385,10 @@ public class AppleOrderController extends BaseController {
// 3. 构建查询条件
Order queryOrder = new Order();
queryOrder.setWorkerdel(2L);
if (StringUtils.isNotBlank(orderid)) {
queryOrder.setOrderId(orderid);
}
// 直接用dayDate字符串查
if (StringUtils.isNotBlank(dayDate)) {
queryOrder.setDayDate(dayDate);
@ -2438,6 +2454,17 @@ public class AppleOrderController extends BaseController {
orderMap.put("orcerCrateTime", sdf.format(order.getCreatedAt()));
orderMap.put("num", order.getNum());
orderMap.put("statusText", getOrderStatusText(order.getStatus()));
String firstOrderId = OrderUtil.findUserFirstOrderId(order.getUid());
if (firstOrderId != null){
if (order.getOrderId().equals(firstOrderId)){
orderMap.put("isFirst", true);
} else{
orderMap.put("isFirst", false);
}
}else{
orderMap.put("isFirst", false);
}
// 订单类型
orderMap.put("bigtype", getOrderBigType(order.getBigtype()));
orderMap.put("bigtypeText", getOrderBigTypeText(order.getBigtype()));
@ -2798,6 +2825,11 @@ public class AppleOrderController extends BaseController {
commentData.put("numType", comment.getNumType());
commentData.put("content", comment.getContent());
commentData.put("createdAt",comment.getCreatedAt() != null ? sdf.format(comment.getCreatedAt()) : "");
if (org.apache.commons.lang3.StringUtils.isNotBlank(comment.getAdminhf())){
commentData.put("admin",comment.getAdminhf());
}else{
commentData.put("admin",null);
}
if (comment.getImages()!=null){
commentData.put("image",JSONArray.parseArray(comment.getImages()));
}else{
@ -3642,6 +3674,28 @@ public class AppleOrderController extends BaseController {
return AppletControllerUtil.appletSuccess("评论删除成功");
}
/**
* 评论删除接口
* @param id 评论ID
* @return 操作结果
*/
@GetMapping("/api/worker/order/del/{id}")
public AjaxResult apiworkerorderdel(@PathVariable("id") Long id) {
try {
Order order = orderService.selectOrderById(id);
if (order != null){
order.setWorkerdel(2L);
orderService.updateOrder(order);
}
} catch (Exception e) {
logger.error("评论失败:", e);
return AppletControllerUtil.appletError("评论失败:" + e.getMessage());
}
return AppletControllerUtil.appletSuccess("评论成功");
}
/**
* 拼团预约接口
* @param params {id, address_id, make_time}
@ -4229,7 +4283,7 @@ public class AppleOrderController extends BaseController {
// 7. 添加订单日志
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("name", "用户确认收货");
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getOrderId(), "确认收货", "3", jsonObject, 2L);
OrderUtil.addgoodsorderlog(goodsOrder.getId(), goodsOrder.getMainOrderId(), "确认收货", "3", jsonObject, 2L);
Map<String, Object> result = new HashMap<>();
result.put("message", "确认收货成功");
@ -4323,6 +4377,12 @@ public class AppleOrderController extends BaseController {
jsonObject.put("num",commentDATA.getNum());
jsonObject.put("status",commentDATA.getStatus());
jsonObject.put("text",commentDATA.getContent());
if (StringUtils.isNotBlank(commentDATA.getAdminhf())){
jsonObject.put("admin",commentDATA.getAdminhf());
}else{
jsonObject.put("admin",null);
}
if (commentDATA.getImages()!=null){
jsonObject.put("image",JSONArray.parseArray(commentDATA.getImages()));
}
@ -5373,9 +5433,32 @@ public class AppleOrderController extends BaseController {
return AppletControllerUtil.appletError("获取文章失败:" + e.getMessage());
}
}
//根据经纬度获取当前位置
// public static String getAddressByLocation(double longitude, double latitude) {
@PostMapping("/api/public/get/adressname")
public AjaxResult getArticleByadressname(@RequestBody Map<String, Object> params) {
logger.info("=== 开始获取分类文章 ===");
logger.info("请求参数: {}", params);
// 获取参数
String longitude = null;
if (params.get("longitude") != null) {
longitude = params.get("longitude").toString();
}
// 获取参数
String latitude = null;
if (params.get("latitude") != null) {
latitude = params.get("latitude").toString();
}
// GaoDeMapUtil.getAddressByLocation(Double.parseDouble(longitude), Double.parseDouble(latitude));
String result = GaoDeMapUtil.getAddressByLocation(Double.parseDouble(longitude), Double.parseDouble(latitude));
return AppletControllerUtil.appletSuccess(result);
}
@PostMapping("/api/service/order/rework/lst")
public AjaxResult getReworkList(@RequestBody Map<String, Object> params, HttpServletRequest request) {
try {

View File

@ -2092,7 +2092,7 @@ public class AppletController extends BaseController {
}
goodsOrder = orderList.get(0);
}
int count = orderCommentService.selectCountOrderCommentByOid(goodsOrder.getId());
int count = orderCommentService.selectCountOrderCommentByOid(goodsOrder.getOrderId());
if (count > 0) {
return AppletControllerUtil.appletWarning("请勿重复提交");
}
@ -4450,6 +4450,11 @@ public class AppletController extends BaseController {
jsonObject.put("num",commentDATA.getNum());
jsonObject.put("status",commentDATA.getStatus());
jsonObject.put("text",commentDATA.getContent());
if (org.apache.commons.lang3.StringUtils.isNotBlank(commentDATA.getAdminhf())){
jsonObject.put("admin",commentDATA.getAdminhf());
}else{
jsonObject.put("admin",null);
}
if (commentDATA.getImages()!=null){
jsonObject.put("image",JSONArray.parseArray(commentDATA.getImages()));
}
@ -4576,7 +4581,7 @@ public class AppletController extends BaseController {
orderdata.put("goodsid", order.getProductId());
orderdata.put("xiadanshijian",order.getCreatedAt() != null ? dateFormat.format(order.getCreatedAt()) : null);
Map<String, Object> shifuMap = new HashMap<>();
if (order.getWorkerId() != null){
if (order.getWorkerId() != null&&order.getIsAccept()==1){
Users workerInfo = usersService.selectUsersById(order.getWorkerId());
shifuMap.put("worker_image", AppletControllerUtil.buildImageUrl(workerInfo.getAvatar()));
shifuMap.put("worker_name", workerInfo.getName());
@ -4700,6 +4705,11 @@ public class AppletController extends BaseController {
jsonObject.put("num",commentDATA.getNum());
jsonObject.put("status",commentDATA.getStatus());
jsonObject.put("text",commentDATA.getContent());
if (org.apache.commons.lang3.StringUtils.isNotBlank(commentDATA.getAdminhf())){
jsonObject.put("admin",commentDATA.getAdminhf());
}else{
jsonObject.put("admin",null);
}
if (commentDATA.getImages()!=null){
jsonObject.put("image",JSONArray.parseArray(commentDATA.getImages()));
}
@ -5862,7 +5872,9 @@ public class AppletController extends BaseController {
if (phoneTwo.length() != 2) {
return AppletControllerUtil.appletWarning("请输入手机号后两位");
}
String latitude = params.get("latitude").toString();
String longitude = params.get("longitude").toString();
String addressName = params.get("addressName").toString();
// 2. 获取当前登录师傅IDtoken在header
String token = request.getHeader("token");
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
@ -5915,6 +5927,9 @@ public class AppletController extends BaseController {
orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setWorkerId(workerId);
orderLog.setLatitude(latitude);
orderLog.setLongitude(longitude);
orderLog.setAddressName(addressName);
orderLog.setWorkerLogId(workerId);
orderLog.setTitle("师傅到达");
orderLog.setType(new BigDecimal("5.0"));
@ -6264,6 +6279,7 @@ public class AppletController extends BaseController {
}
BigDecimal reductionPrice = BigDecimal.ZERO;
String reduction = params.get("reduction").toString();
String reamk = params.get("reamk").toString();
if (reduction != null && !reduction.trim().isEmpty()) {
reductionPrice = new BigDecimal(reduction);
// totalPrice = totalPrice.subtract(reductionPrice);
@ -6286,6 +6302,9 @@ public class AppletController extends BaseController {
resultJson.put("deposit", depositproject);
// basic
resultJson.put("basic", params.get("basic"));
if (StringUtils.isNotBlank(reamk)){
resultJson.put("reamk", reamk);
}
// craft
List<Map<String, Object>> craftListNew = new ArrayList<>();
@ -6622,6 +6641,10 @@ public class AppletController extends BaseController {
if (order == null) {
return AppletControllerUtil.appletError("订单不存在");
}
String reamk = params.get("reamk").toString();
String latitude = params.get("latitude").toString();
String longitude = params.get("longitude").toString();
String addressName = params.get("addressName").toString();
PayBeforeUtil payBeforeUtil = new PayBeforeUtil();
String priceDifferenceprice= params.get("priceDifferenceprice").toString();
// int paynum=usersPayBeforService.countByLastOrderIdAndStatus(order.getOrderId());
@ -6636,7 +6659,12 @@ public class AppletController extends BaseController {
// }
// 2. 组装日志内容
Map<String, Object> logContent = new LinkedHashMap<>();
logContent.put("name", "师傅服务完成");
if (StringUtils.isNotBlank(reamk)) {
logContent.put("name","师傅服务完成--"+ reamk);
}else{
logContent.put("name", "师傅服务完成");
}
logContent.put("image", params.get("image"));
String contentStr = com.alibaba.fastjson2.JSONObject.toJSONString(logContent);
// 3. 写入订单日志
@ -6645,6 +6673,9 @@ public class AppletController extends BaseController {
log.setOrderId(order.getOrderId());
log.setLogOrderId(GenerateCustomCode.generCreateOrder("DSB"));
log.setTitle("服务完成");
log.setLatitude(latitude);
log.setLongitude(longitude);
log.setAddressName(addressName);
log.setType(new java.math.BigDecimal(7));
log.setContent(contentStr);
log.setWorkerId(order.getWorkerId());

View File

@ -79,10 +79,18 @@ public class GoodsOrderController extends BaseController
if(serviceGoods!=null){
goodsOrderdata.setProductName(serviceGoods.getTitle());
}
if(goodsOrderdata.getAddressId()!=null){
UserAddress userAddress=userAddressService.selectUserAddressById(goodsOrderdata.getAddressId());
if (userAddress != null){
goodsOrderdata.setLatitude(userAddress.getLatitude());
goodsOrderdata.setLongitude(userAddress.getLongitude());
goodsOrderdata.setAdressinfo(userAddress.getAddressInfo()+userAddress.getInfo());
}
}
Users users=usersService.selectUsersById(goodsOrderdata.getUid());
if(users !=null){
goodsOrderdata.setUname(users.getName());
goodsOrderdata.setUphone(users.getPhone());
}
@ -194,7 +202,30 @@ public class GoodsOrderController extends BaseController
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(goodsOrderService.selectGoodsOrderById(id));
GoodsOrder goodsOrderdata =goodsOrderService.selectGoodsOrderById(id);
if(goodsOrderdata.getAddressId()!=null){
UserAddress userAddress=userAddressService.selectUserAddressById(goodsOrderdata.getAddressId());
if (userAddress != null){
goodsOrderdata.setLatitude(userAddress.getLatitude());
goodsOrderdata.setLongitude(userAddress.getLongitude());
goodsOrderdata.setAdressinfo(userAddress.getAddressInfo()+userAddress.getInfo());
}
//ISiteDeliveryService siteDeliveryService;
if (goodsOrderdata.getDeliveryId()!=null){
SiteDelivery siteDelivery=siteDeliveryService.selectSiteDeliveryById(goodsOrderdata.getDeliveryId());
if(siteDelivery!=null){
goodsOrderdata.setDeliveryName(siteDelivery.getTitle());
}
}
Users users=usersService.selectUsersById(goodsOrderdata.getUid());
if(users !=null){
goodsOrderdata.setUname(users.getName());
goodsOrderdata.setUphone(users.getPhone());
}
}
return success(goodsOrderdata);
}
/**
@ -210,8 +241,10 @@ public class GoodsOrderController extends BaseController
if (userAddress!=null){
goodsOrder.setName(userAddress.getName());
goodsOrder.setPhone(userAddress.getPhone());
goodsOrder.setAddress(userAddress.getAddressName());
}
}
if (goodsOrder.getProductId()!=null){
ServiceGoods serviceGoods=serviceGoodsService.selectServiceGoodsById(goodsOrder.getProductId());
@ -476,6 +509,7 @@ public class GoodsOrderController extends BaseController
goodsOrderdata.setDeliveryId(goodsOrder.getDeliveryId());
goodsOrderdata.setDeliveryNum(goodsOrder.getDeliveryNum());
goodsOrderdata.setSendTime(goodsOrder.getSendTime());
goodsOrderdata.setMark(goodsOrder.getMark());
goodsOrderdata.setStatus(3L); // 设置为已发货状态
count+= goodsOrderService.updateGoodsOrder(goodsOrderdata);
}

View File

@ -80,7 +80,7 @@ public class OrderController extends BaseController {
orderdata.setUname(users.getName());
}
orderdata.setThjl(orderCallService.selectCountOrderCallByOid(orderdata.getId()));
orderdata.setFwpj(orderCommentService.selectCountOrderCommentByOid(orderdata.getId()));
orderdata.setFwpj(orderCommentService.selectCountOrderCommentByOid(orderdata.getOrderId()));
orderdata.setLywj(orderSoundService.selectCountOrderSoundByOid(orderdata.getId()));
orderdata.setJdjl(orderLogService.selectCountOrderLogByOrderId(orderdata.getOrderId()));
orderdata.setTzjl(notifyOrderService.selectNotifyOrderCountByOid(orderdata.getId()));
@ -240,7 +240,7 @@ public class OrderController extends BaseController {
System.out.println("=== 获取接单记录 ===");
System.out.println("订单ID: " + orderId);
List<OrderLog> list = orderLogService.selectOrderLogByOrderId(orderId);
List<OrderLog> list = orderLogService.selectOrderLogByOrderIdASC(orderId);
System.out.println("查询到的日志记录数量: " + (list != null ? list.size() : "null"));
if (list != null && !list.isEmpty()) {
@ -334,7 +334,7 @@ public class OrderController extends BaseController {
Order data = orderService.selectOrderByOrderId(orderId);
;
if (data != null) {
List<OrderComment> list = orderCommentService.selectOrderCommentByOid(data.getId());
List<OrderComment> list = orderCommentService.selectOrderCommentByOid(data.getOrderId());
for (OrderComment orderCommentdata : list) {
Users users = usersService.selectUsersById(orderCommentdata.getUid());
if (users != null) {
@ -438,4 +438,118 @@ public class OrderController extends BaseController {
List<Users> list = usersService.selectUsersList(users);
return AjaxResult.success(list);
}
/**
* 更换师傅接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "更换师傅", businessType = BusinessType.UPDATE)
@PostMapping("/change-worker")
public AjaxResult changeWorker(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如调用DispatchUtil进行重新派单
return success("更换师傅成功");
} catch (Exception e) {
return error("更换师傅失败:" + e.getMessage());
}
}
/**
* 出发上门接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "出发上门", businessType = BusinessType.UPDATE)
@PostMapping("/departure")
public AjaxResult departure(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如更新订单状态为出发上门记录出发时间等
return success("出发上门成功");
} catch (Exception e) {
return error("出发上门失败:" + e.getMessage());
}
}
/**
* 确认到达接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "确认到达", businessType = BusinessType.UPDATE)
@PostMapping("/confirm-arrival")
public AjaxResult confirmArrival(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如更新订单状态为已到达记录到达时间等
return success("确认到达成功");
} catch (Exception e) {
return error("确认到达失败:" + e.getMessage());
}
}
/**
* 结束订单接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "结束订单", businessType = BusinessType.UPDATE)
@PostMapping("/end-order")
public AjaxResult endOrder(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如更新订单状态为已结束记录结束时间等
return success("订单已结束");
} catch (Exception e) {
return error("结束订单失败:" + e.getMessage());
}
}
/**
* 开始服务接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "开始服务", businessType = BusinessType.UPDATE)
@PostMapping("/start-service")
public AjaxResult startService(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如更新订单状态为服务中记录开始时间等
return success("开始服务成功");
} catch (Exception e) {
return error("开始服务失败:" + e.getMessage());
}
}
/**
* 项目报价接口
*/
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "项目报价", businessType = BusinessType.UPDATE)
@PostMapping("/project-quote")
public AjaxResult projectQuote(@RequestBody Map<String, Object> params) {
try {
String orderId = params.get("orderId").toString();
// 这里调用具体的业务逻辑您来实现
// 例如创建项目报价更新订单状态等
return success("项目报价成功");
} catch (Exception e) {
return error("项目报价失败:" + e.getMessage());
}
}
}

View File

@ -148,8 +148,14 @@ public class GoodsOrder extends BaseEntity
/** 多规格产品 */
@Excel(name = "多规格产品")
private String sku;
private String deliveryName;
/** 纬度 */
private String latitude;
private String uphone;
private String adressinfo;
/** 经度 */
private String longitude;
private BigDecimal payPriceMin;
private BigDecimal payPriceMax;
private BigDecimal returnrealmoney;
@ -677,6 +683,46 @@ public class GoodsOrder extends BaseEntity
this.ismany = ismany;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getAdressinfo() {
return adressinfo;
}
public void setAdressinfo(String adressinfo) {
this.adressinfo = adressinfo;
}
public String getUphone() {
return uphone;
}
public void setUphone(String uphone) {
this.uphone = uphone;
}
public String getDeliveryName() {
return deliveryName;
}
public void setDeliveryName(String deliveryName) {
this.deliveryName = deliveryName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -211,6 +211,8 @@ public class Order extends BaseEntity
private Long baojiayh;
private Long workerdel;
private List<String> ids;
/** 录音文件 */
@Excel(name = "订单类别 1预约 2报价 3一口价 4拼团 5普通订单")
@ -967,6 +969,14 @@ public class Order extends BaseEntity
this.qiangdan = qiangdan;
}
public Long getWorkerdel() {
return workerdel;
}
public void setWorkerdel(Long workerdel) {
this.workerdel = workerdel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -52,7 +52,7 @@ public class OrderComment extends BaseEntity
/** 评价内容 */
@Excel(name = "评价内容")
private String content;
private String adminhf;
/** 评分 */
@Excel(name = "评分")
private Long num;
@ -225,6 +225,14 @@ public class OrderComment extends BaseEntity
this.labels = labels;
}
public String getAdminhf() {
return adminhf;
}
public void setAdminhf(String adminhf) {
this.adminhf = adminhf;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -133,6 +133,14 @@ public class OrderLog extends BaseEntity
private Long ordertype;
/** 纬度 */
private String latitude;
/** 经度 */
private String longitude;
/** 地图点选地址名称 */
private String addressName;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@ -449,6 +457,31 @@ public class OrderLog extends BaseEntity
this.ordertype = ordertype;
}
public String getAddressName() {
return addressName;
}
public void setAddressName(String addressName) {
this.addressName = addressName;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -20,11 +20,11 @@ public interface OrderCommentMapper
public OrderComment selectOrderCommentById(Long id);
public int selectCountOrderCommentByOid(Long id);
public int selectCountOrderCommentByOid(String orderId);
public List<OrderComment> selectOrderCommentByOid(Long id);
public List<OrderComment> selectOrderCommentByOid(String orderId);
/**
* 查询订单评价列表
*

View File

@ -31,6 +31,10 @@ public interface OrderLogMapper
public int updateOrderLogEnd(Long id);
public List<OrderLog> selectOrderLogByOrderId(String orderId);
public List<OrderLog> selectOrderLogByOrderIdASC(String orderId);
/**
* 查询订单服务记录列表
*
@ -39,6 +43,8 @@ public interface OrderLogMapper
*/
public List<OrderLog> selectOrderLogList(OrderLog orderLog);
/**
* 新增订单服务记录
*

View File

@ -180,4 +180,12 @@ public interface OrderMapper
* @return 预约用户列表
*/
public List<Map<String, Object>> selectOrderUsersByMakeTimeAndHour(Map<String, Object> params);
/**
* 查找用户首次下单的订单ID
*
* @param userId 用户ID
* @return 首次下单的订单ID如果没有找到返回null
*/
public String selectUserFirstOrderId(@Param("userId") Long userId);
}

View File

@ -18,8 +18,8 @@ public interface IOrderCommentService
* @return 订单评价
*/
public OrderComment selectOrderCommentById(Long id);
public int selectCountOrderCommentByOid(Long id);
public List<OrderComment> selectOrderCommentByOid(Long id);
public int selectCountOrderCommentByOid(String orderId);
public List<OrderComment> selectOrderCommentByOid(String orderId);
/**
* 查询订单评价列表
*

View File

@ -45,7 +45,7 @@ public interface IOrderLogService
* @return 订单服务记录列表
*/
public List<OrderLog> selectOrderLogByOrderId(String orderId);
public List<OrderLog> selectOrderLogByOrderIdASC(String orderId);
/**
* 查询订单服务记录列表
*

View File

@ -178,4 +178,12 @@ public interface IOrderService
* @return 预约用户列表
*/
public List<Map<String, Object>> selectOrderUsersByMakeTimeAndHour(Map<String, Object> params);
/**
* 查找用户首次下单的订单ID
*
* @param userId 用户ID
* @return 首次下单的订单ID如果没有找到返回null
*/
public String selectUserFirstOrderId(Long userId);
}

View File

@ -31,12 +31,12 @@ public class OrderCommentServiceImpl implements IOrderCommentService
return orderCommentMapper.selectOrderCommentById(id);
}
public List<OrderComment> selectOrderCommentByOid(Long id){
return orderCommentMapper.selectOrderCommentByOid(id);
public List<OrderComment> selectOrderCommentByOid(String orderId){
return orderCommentMapper.selectOrderCommentByOid(orderId);
}
public int selectCountOrderCommentByOid(Long id){
return orderCommentMapper.selectCountOrderCommentByOid(id);
public int selectCountOrderCommentByOid(String orderId){
return orderCommentMapper.selectCountOrderCommentByOid(orderId);
}
/**

View File

@ -71,7 +71,10 @@ public class OrderLogServiceImpl implements IOrderLogService
}
public List<OrderLog> selectOrderLogByOrderIdASC(String orderId) {
return orderLogMapper.selectOrderLogByOrderIdASC(orderId);
}
/**
* 查询订单服务记录列表
*

View File

@ -217,4 +217,12 @@ public class OrderServiceImpl implements IOrderService
public List<Map<String, Object>> selectOrderUsersByMakeTimeAndHour(Map<String, Object> params) {
return orderMapper.selectOrderUsersByMakeTimeAndHour(params);
}
/**
* 查找用户首次下单的订单ID
*/
@Override
public String selectUserFirstOrderId(Long userId) {
return orderMapper.selectUserFirstOrderId(userId);
}
}

View File

@ -82,9 +82,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uid != null "> and uid = #{uid}</if>
<if test="status != null "> and status = #{status}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
<if test="mainOrderId != null and mainOrderId != ''"> and main_order_id = #{mainOrderId}</if>
<if test="orderId != null and orderId != ''"> and order_id like concat('%', #{orderId}, '%') </if>
<if test="mainOrderId != null and mainOrderId != ''"> and main_order_id like concat('%', #{mainOrderId}, '%') </if>
</where>
ORDER BY
CASE
@ -115,9 +116,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uid != null "> and uid = #{uid}</if>
<if test="status != null "> and status = #{status}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
<if test="mainOrderId != null and mainOrderId != ''"> and main_order_id = #{mainOrderId}</if>
<if test="orderId != null and orderId != ''"> and order_id like concat('%', #{orderId}, '%') </if>
<if test="mainOrderId != null and mainOrderId != ''"> and main_order_id like concat('%', #{mainOrderId}, '%') </if>
</where>
GROUP BY
main_order_id

View File

@ -17,19 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="workerId" column="worker_id" />
<result property="labels" column="labels" />
<result property="adminhf" column="adminhf" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectOrderCommentVo">
select id, oid, order_id, product_id, uid, images, content, num, num_type, status,labels, worker_id, created_at, updated_at from order_comment
select id, oid, order_id, adminhf,product_id, uid, images, content, num, num_type, status,labels, worker_id, created_at, updated_at from order_comment
</sql>
<select id="selectCountOrderCommentByOid" parameterType="Long" resultType="Integer">
select count(0) from order_comment where oid= #{oid}
<select id="selectCountOrderCommentByOid" parameterType="String" resultType="Integer">
select count(0) from order_comment where order_id= #{orderId}
</select>
<select id="selectOrderCommentByOid" parameterType="long" resultMap="OrderCommentResult">
select * from order_comment where oid= #{oid}
<select id="selectOrderCommentByOid" parameterType="String" resultMap="OrderCommentResult">
select * from order_comment where order_id= #{orderId}
</select>
<select id="selectOrderCommentList" parameterType="OrderComment" resultMap="OrderCommentResult">
@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if>
<if test="workerId != null">worker_id,</if>
<if test="labels != null">labels,</if>
<if test="adminhf != null">adminhf,</if>
created_at,
updated_at
@ -86,6 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if>
<if test="workerId != null">#{workerId},</if>
<if test="labels != null">#{labels},</if>
<if test="adminhf != null">#{adminhf},</if>
NOW(),
NOW()
</trim>
@ -102,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="content != null and content != ''">content = #{content},</if>
<if test="num != null">num = #{num},</if>
<if test="labels != null">labels = #{labels},</if>
<if test="adminhf != null">adminhf = #{adminhf},</if>
<if test="numType != null">num_type = #{numType},</if>
<if test="status != null">status = #{status},</if>
<if test="workerId != null">worker_id = #{workerId},</if>

View File

@ -20,7 +20,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="cjMoney" column="cj_money" />
<result property="cjPaid" column="cj_paid" />
<result property="ordertype" column="ordertype" />
<result property="latitude" column="latitude" />
<result property="longitude" column="longitude" />
<result property="addressName" column="address_name" />
<result property="paid" column="paid" />
<result property="payTime" column="pay_time" />
@ -40,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectOrderLogVo">
select id, oid, order_id, log_order_id,cj_money,cj_paid,ordertype, title, type, content, deposit, dep_paid, dep_pay_time, dep_log_id, price, paid, pay_time, log_id, worker_id, first_worker_id, give_up, worker_cost, reduction_price, is_pause, coupon_id, deduction, worker_log_id, created_at, updated_at, deleted_at from order_log
select id, oid, order_id, log_order_id,latitude, longitude, address_name,cj_money,cj_paid,ordertype, title, type, content, deposit, dep_paid, dep_pay_time, dep_log_id, price, paid, pay_time, log_id, worker_id, first_worker_id, give_up, worker_cost, reduction_price, is_pause, coupon_id, deduction, worker_log_id, created_at, updated_at, deleted_at from order_log
</sql>
<select id="selectOrderLogList" parameterType="OrderLog" resultMap="OrderLogResult">
@ -120,6 +122,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from order_log where order_id = #{orderId} order by id DESC
</select>
<select id="selectOrderLogByOrderIdASC" parameterType="String" resultMap="OrderLogResult">
select * from order_log where order_id = #{orderId} order by id ASC
</select>
<select id="selectOidListByWorkerId" parameterType="java.lang.Long" resultType="java.lang.Long">
select DISTINCT oid from order_log where worker_id = #{workerId}
</select>
@ -154,7 +160,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cjMoney != null">cj_money,</if>
<if test="cjPaid != null">cj_paid,</if>
<if test="ordertype != null">ordertype,</if>
<if test="latitude != null">latitude,</if>
<if test="longitude != null">longitude,</if>
<if test="addressName != null">address_name,</if>
created_at,
updated_at
@ -187,7 +195,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cjMoney != null">#{cjMoney},</if>
<if test="cjPaid != null">#{cjPaid},</if>
<if test="ordertype != null">#{ordertype},</if>
<if test="latitude != null">#{latitude},</if>
<if test="longitude != null">#{longitude},</if>
<if test="addressName != null">#{addressName},</if>
NOW(),
NOW()
@ -234,7 +244,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cjMoney != null">cj_money = #{cjMoney},</if>
<if test="cjPaid != null">cj_paid = #{cjPaid},</if>
<if test="ordertype != null">ordertype = #{ordertype},</if>
<if test="latitude != null and latitude != ''">latitude = #{latitude},</if>
<if test="longitude != null and longitude != ''">longitude = #{longitude},</if>
<if test="addressName != null">address_name = #{addressName},</if>
updated_at = NOW()

View File

@ -22,6 +22,7 @@
<result property="num" column="num"/>
<result property="cartid" column="cartid"/>
<result property="bigtype" column="bigtype"/>
<result property="workerdel" column="workerdel"/>
<result property="totalPrice" column="total_price"/>
@ -78,6 +79,7 @@
<result property="sku" column="sku"/>
<result property="cartid" column="cartid"/>
<result property="bigtype" column="bigtype"/>
<result property="workerdel" column="workerdel"/>
<result property="status" column="status"/>
<result property="total_price" column="total_price"/>
@ -95,6 +97,7 @@
create_type,
create_phone,
uid,
workerdel,
cartid,
odertype,
product_id,
@ -237,6 +240,11 @@
<if test="cartid != null">
and cartid = #{cartid}
</if>
<if test="workerdel != null">
and workerdel IS NULL
</if>
<!-- 新增ispay逻辑存在users_pay_befor表status=1的lastorderid则排除 -->
<!-- <if test="ispay != null and ispay != ''">-->
<!-- AND (SELECT COUNT(1) FROM users_pay_befor upb WHERE upb.lastorderid = order_id AND upb.STATUS = 1)=0-->
@ -284,6 +292,29 @@
and uid = #{uid}
</select>
<select id="selectOrderUsersByMakeTimeAndHour" parameterType="Map" resultType="Map">
SELECT
o.uid,
u.name as userName,
u.phone as userPhone,
COUNT(o.id) as orderCount
FROM order_data o
LEFT JOIN users u ON o.uid = u.id
WHERE o.make_time = #{makeTime}
AND o.make_hour = #{makeHour}
GROUP BY o.uid, u.name, u.phone
ORDER BY orderCount DESC
</select>
<!-- 查找用户首次下单的订单ID -->
<select id="selectUserFirstOrderId" parameterType="Long" resultType="String">
SELECT order_id
FROM order_data
WHERE uid = #{userId}
ORDER BY created_at ASC
LIMIT 1
</select>
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into order_data
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -431,6 +462,9 @@
<if test="bigtype != null">
bigtype,
</if>
<if test="workerdel != null">
workerdel,
</if>
created_at,
updated_at
@ -580,6 +614,10 @@
<if test="bigtype != null">
#{bigtype},
</if>
<if test="workerdel != null">
#{workerdel},
</if>
NOW(),
NOW()
</trim>
@ -733,6 +771,10 @@
<if test="cartid != null">
cartid = #{cartid},
</if>
<if test="workerdel != null">
workerdel = #{workerdel},
</if>
updated_at = NOW()
</trim>
where id = #{id}

View File

@ -203,3 +203,57 @@ export function getCanDoWorkerList(params) {
params: params
})
}
// 更换师傅
export function changeWorker(orderId) {
return request({
url: '/system/Order/change-worker',
method: 'post',
data: { orderId: orderId }
})
}
// 出发上门
export function departureService(orderId) {
return request({
url: '/system/Order/departure',
method: 'post',
data: { orderId: orderId }
})
}
// 确认到达
export function confirmArrival(orderId) {
return request({
url: '/system/Order/confirm-arrival',
method: 'post',
data: { orderId: orderId }
})
}
// 结束订单
export function endOrder(orderId) {
return request({
url: '/system/Order/end-order',
method: 'post',
data: { orderId: orderId }
})
}
// 开始服务
export function startService(orderId) {
return request({
url: '/system/Order/start-service',
method: 'post',
data: { orderId: orderId }
})
}
// 项目报价
export function projectQuote(orderId) {
return request({
url: '/system/Order/project-quote',
method: 'post',
data: { orderId: orderId }
})
}

View File

@ -457,178 +457,144 @@
<!-- 添加或修改商品订单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body @close="handleMainDialogClose">
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<!-- 主订单信息 -->
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- 基本信息 -->
<el-card shadow="hover" style="margin-bottom: 20px;">
<div slot="header" class="clearfix">
<span style="font-weight: bold; color: #409EFF;">
<i class="el-icon-s-order"></i>
主订单信息
基本信息
</span>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主订单号" prop="mainOrderId">
<el-input v-model="form.mainOrderId" placeholder="系统自动生成" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户" prop="uid" required>
<user-select
v-model="form.uid"
placeholder="请选择用户"
user-type="1"
dialog-title="选择用户"
@change="handleUserSelectChange"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="服务商品" prop="productId" required>
<el-select
v-model="form.productId"
placeholder="请选择服务商品"
clearable
filterable
style="width: 100%"
@change="handleProductSelectChange"
>
<el-option
v-for="item in goodsDataList"
:key="item.id"
:label="item.title"
:value="item.id"
>
<span style="float: left">{{ item.title }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.price }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预约时间" prop="appointmentTime" required>
<el-date-picker
v-model="form.appointmentTime"
type="datetime"
placeholder="请选择预约时间"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
:picker-options="pickerOptions"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num" required>
<el-input-number
v-model="form.num"
:min="1"
:max="999"
style="width: 100%"
@change="calculateTotalPrice"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="goodPrice">
<el-input v-model="form.goodPrice" placeholder="系统自动获取" disabled>
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<!-- 收货信息 -->
<el-card shadow="hover" style="margin-bottom: 20px;">
<div slot="header" class="clearfix">
<span style="font-weight: bold; color: #67C23A;">
<i class="el-icon-location"></i>
收货信息
</span>
<el-button
style="float: right; padding: 3px 0"
type="text"
icon="el-icon-refresh"
@click="refreshUserAddress"
v-if="form.uid"
>
刷新地址
</el-button>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主订单号" prop="mainOrderId">
<el-input v-model="form.mainOrderId" placeholder="请输入主订单号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户" prop="uid">
<user-select
v-model="form.uid"
placeholder="请选择用户"
user-type="1"
dialog-title="选择用户"
@change="handleUserSelectChange"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="收货人" prop="name">
<el-form-item label="收货人" prop="name" required>
<el-input v-model="form.name" placeholder="请输入收货人姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-form-item label="联系电话" prop="phone" required>
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="收货地址" prop="address">
<el-input v-model="form.address" type="textarea" placeholder="请输入收货地址" />
</el-form-item>
</el-col>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注" prop="mark">
<el-input v-model="form.mark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-row>
</el-card>
<!-- 子订单列表 -->
<el-card shadow="hover" style="margin-bottom: 20px;">
<div slot="header" class="clearfix">
<span style="font-weight: bold; color: #67C23A;">
<i class="el-icon-goods"></i>
商品信息列表
</span>
<!-- <el-button-->
<!-- style="float: right; padding: 3px 0"-->
<!-- type="text"-->
<!-- icon="el-icon-plus"-->
<!-- @click="handleAddSubOrder"-->
<!-- v-hasPermi="['system:GoodsOrder:add']"-->
<!-- >-->
<!-- 添加子订单-->
<!-- </el-button>-->
</div>
<el-table :data="subOrdersList" border style="width: 100%">
<el-table-column label="序号" type="index" width="60" align="center" />
<!-- <el-table-column label="订单号" prop="orderId" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.orderId" placeholder="请输入订单号" size="mini" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="微信支付单号" prop="transactionId" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.transactionId" placeholder="请输入微信支付单号" size="mini" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="小计" prop="totalPrice" width="120" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <span class="price">{{ scope.row.totalPrice ? scope.row.totalPrice.toFixed(2) : '0.00' }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="商品" prop="productId" min-width="200">
<template slot-scope="scope">
<el-col :span="24">
<el-form-item label="收货地址" prop="addressId" required>
<el-select
v-model="scope.row.productId"
placeholder="请选择商品"
v-model="form.addressId"
placeholder="请选择收货地址"
clearable
:disabled="true"
filterable
size="mini"
style="width: 100%"
style="width: 100%"
@change="handleAddressSelectChange"
v-loading="addressLoading"
>
<el-option
v-for="item in goodsDataList"
v-for="item in userAddressList"
:key="item.id"
:label="item.title"
:label="`${item.name} - ${item.phone} - ${item.addressName}`"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="数量" prop="num" width="120" align="center"> </el-table-column>
<el-table-column label="金额" prop="num" width="120" align="center">
<template slot-scope="scope">
<span class="num">{{ scope.row.totalPrice ? scope.row.totalPrice.toFixed(2) : '0.00' }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="数量" prop="num" width="100" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number-->
<!-- v-model="scope.row.num"-->
<!-- :min="1"-->
<!-- size="mini"-->
<!-- @change="handleSubOrderChange(scope.row)"-->
<!-- style="width: 80px;"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="单价" prop="goodPrice" width="120" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number-->
<!-- v-model="scope.row.goodPrice"-->
<!-- placeholder="单价"-->
<!-- :min="0"-->
<!-- :precision="2"-->
<!-- :step="0.01"-->
<!-- size="mini"-->
<!-- @change="handleSubOrderChange(scope.row)"-->
<!-- style="width: 100px;"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="总金额" prop="totalPrice" width="120" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <span class="price">{{ scope.row.totalPrice ? scope.row.totalPrice.toFixed(2) : '0.00' }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="订单状态" prop="status" width="180" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-select v-model="scope.row.status" size="mini" style="width: 100px;">-->
<!-- <el-option label="待支付" :value="1" />-->
<!-- <el-option label="已支付待发货" :value="2" />-->
<!-- <el-option label="已发货" :value="3" />-->
<!-- <el-option label="待评价" :value="4" />-->
<!-- <el-option label="已完成" :value="5" />-->
<!-- <el-option label="已取消" :value="6" />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作" width="120" align="center" fixed="right">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDeleteSubOrder(scope.$index)"-->
<!-- style="color: #F56C6C;"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="详细地址" prop="address">
<el-input v-model="form.address" type="textarea" placeholder="详细地址信息" />
</el-form-item>
</el-col>
</el-row>
</el-card>
<!-- 订单汇总信息 -->
<!-- 订单汇总 -->
<el-card shadow="hover" style="margin-bottom: 20px;">
<div slot="header" class="clearfix">
<span style="font-weight: bold; color: #E6A23C;">
@ -637,63 +603,43 @@
</span>
</div>
<el-row :gutter="20">
<!-- <el-col :span="6">-->
<!-- <div class="summary-item">-->
<!-- <label>子订单数量</label>-->
<!-- <span class="value">{{ subOrdersList.length }}</span>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :span="6">-->
<!-- <div class="summary-item">-->
<!-- <label>总数量</label>-->
<!-- <span class="value highlight">{{ totalSubOrdersNum }}</span>-->
<!-- </div>-->
<!-- </el-col>-->
<el-col :span="6">
<div class="summary-item">
<label>总金额</label>
<span class="value price">{{ totalSubOrdersPrice.toFixed(2) }}</span>
<label>商品数量</label>
<span class="value highlight">{{ form.num || 0 }}</span>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<label>商品单价</label>
<span class="value price">{{ form.goodPrice ? form.goodPrice.toFixed(2) : '0.00' }}</span>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<label>支付金额</label>
<span class="value price">{{ form.payPrice ? form.payPrice.toFixed(2) : '0.00' }}</span>
<label>总金额</label>
<span class="value price total">{{ form.totalPrice ? form.totalPrice.toFixed(2) : '0.00' }}</span>
</div>
</el-col>
<el-col :span="6">
<div class="summary-item">
<label>订单状态</label>
<el-tag type="info">待支付</el-tag>
</div>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-top: 15px;">
<!-- <el-col :span="12">-->
<!-- <el-form-item label="抵扣金额" prop="deduction">-->
<!-- <el-input-number-->
<!-- v-model="form.deduction"-->
<!-- placeholder="请输入抵扣金额"-->
<!-- :min="0"-->
<!-- :precision="2"-->
<!-- :step="0.01"-->
<!-- style="width: 100%"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="支付时间" prop="payTime">-->
<!-- <el-date-picker-->
<!-- clearable-->
<!-- v-model="form.payTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择支付时间"-->
<!-- style="width:100%"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
<el-col :span="24">
<el-form-item label="备注" prop="mark">
<el-input v-model="form.mark" type="textarea" placeholder="请输入备注信息" />
</el-form-item>
</el-col>
</el-row>
</el-card>
<div class="dialog-footer" style="text-align:left;margin-top:20px;">
<el-button @click="reset">重置</el-button>
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button type="primary" @click="submitForm" :loading="submitLoading">提交订单</el-button>
</div>
</el-form>
</el-dialog>
@ -955,49 +901,49 @@
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="快递公司" prop="deliveryId">
<el-select
v-model="shipForm.deliveryId"
placeholder="请选择快递公司"
style="width: 100%"
filterable
>
<el-option
v-for="item in deliveryList"
:key="item.id"
:label="item.title"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递单号" prop="deliveryNum">
<el-input
v-model="shipForm.deliveryNum"
placeholder="请输入快递单号"
style="width: 100%"
<el-form-item label="快递公司" prop="deliveryId">
<el-select
v-model="shipForm.deliveryId"
placeholder="请选择快递公司"
style="width: 100%"
filterable
>
<el-option
v-for="item in deliveryList"
:key="item.id"
:label="item.title"
:value="item.id"
/>
</el-form-item>
</el-col>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发货时间" prop="sendTime">
<el-date-picker
v-model="shipForm.sendTime"
type="datetime"
placeholder="请选择发货时间"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-form-item label="快递单号" prop="deliveryNum">
<el-input
v-model="shipForm.deliveryNum"
placeholder="请输入快递单号"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发货时间" prop="sendTime">
<el-date-picker
v-model="shipForm.sendTime"
type="datetime"
placeholder="请选择发货时间"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="备注" prop="mark">-->
<!-- <el-input v-model="shipForm.mark" placeholder="请输入备注" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
</el-form>
</el-row>
</el-form>
</el-card>
<!-- 批量发货表单 -->
@ -1666,16 +1612,22 @@ export default {
{ required: true, message: "用户不能为空", trigger: "blur" }
],
productId: [
{ required: true, message: "商品不能为空", trigger: "blur" }
{ required: true, message: "服务商品不能为空", trigger: "change" }
],
appointmentTime: [
{ required: true, message: "预约时间不能为空", trigger: "change" }
],
name: [
{ required: true, message: "姓名不能为空", trigger: "blur" }
{ required: true, message: "收货人姓名不能为空", trigger: "blur" }
],
phone: [
{ required: true, message: "电话不能为空", trigger: "blur" }
{ required: true, message: "联系电话不能为空", trigger: "blur" }
],
addressId: [
{ required: true, message: "收货地址不能为空", trigger: "change" }
],
address: [
{ required: true, message: "地址不能为空", trigger: "blur" }
{ required: true, message: "详细地址不能为空", trigger: "blur" }
],
num: [
{ required: true, message: "数量不能为空", trigger: "blur" }
@ -1689,9 +1641,6 @@ export default {
status: [
{ required: true, message: "订单状态 1:待支付 2已支付待发货3待收货 4待评价 5已收货 6取消 20申请退款 21同意退款 22驳回退款不能为空", trigger: "change" }
],
addressId: [
{ required: true, message: "关联地址不能为空", trigger: "blur" }
],
deliveryId: [
{
validator: (rule, value, callback) => {
@ -1861,7 +1810,14 @@ export default {
{ required: true, message: '请选择发货时间', trigger: 'change' }
]
},
batchShipProducts: []
batchShipProducts: [],
//
submitLoading: false,
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7; //
}
},
}
},
created() {
@ -2001,15 +1957,17 @@ export default {
reset() {
this.form = {
id: null,
type: 2,
type: 1, //
mainOrderId: null,
orderId: null,
transactionId: null,
uid: null,
productId: null,
productName: null,
name: null,
phone: null,
address: null,
addressId: null,
num: 1,
totalPrice: 0,
goodPrice: 0,
@ -2018,13 +1976,13 @@ export default {
deduction: 0,
postage: 0,
payTime: null,
status: null,
status: 1, //
deliveryId: null,
deliveryNum: null,
sendTime: null,
mark: null,
addressId: null,
sku: null,
appointmentTime: null, //
createdAt: null,
updatedAt: null,
deletedAt: null
@ -2088,7 +2046,8 @@ export default {
//
generateCode(){
generateCode().then(response => {
this.form.orderId=response.msg;
this.form.mainOrderId = response.msg;
this.form.orderId = response.msg;
})
},
/** 新增按钮操作 */
@ -2096,13 +2055,13 @@ export default {
//
this.closeAllDialogs()
this.generateCode()
this.reset()
this.generateCode()
//
this.$nextTick(() => {
this.open = true
this.title = "添加商品订单"
this.title = "新增服务订单"
this.ensureDialogState()
})
},
@ -2119,52 +2078,80 @@ export default {
this.loadMainOrderData(row);
} else {
//
getGoodsOrder(id).then(response => {
this.form = response.data
getGoodsOrder(id).then(response => {
this.form = response.data
this.subOrdersList = [{
...response.data,
totalPrice: response.data.totalPrice || 0
}];
this.calculateSubOrdersSummary();
// ID
if (this.form.uid) {
this.getUserAddressList(this.form.uid)
}
// ID
if (this.form.uid) {
this.getUserAddressList(this.form.uid)
}
//
this.$nextTick(() => {
this.open = true
this.title = "修改商品订单"
this.ensureDialogState()
})
}).catch(error => {
console.error('获取订单详情失败:', error)
this.$modal.msgError('获取订单详情失败')
//
this.$nextTick(() => {
this.open = true
this.title = "修改商品订单"
this.ensureDialogState()
})
}).catch(error => {
console.error('获取订单详情失败:', error)
this.$modal.msgError('获取订单详情失败')
})
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.form.id != null) {
//
updateGoodsOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.reset()
this.getList()
})
this.$modal.msgSuccess("修改成功");
this.open = false;
this.reset();
this.getList();
}).catch(error => {
console.error('修改订单失败:', error);
this.$modal.msgError('修改失败,请重试');
}).finally(() => {
this.submitLoading = false;
});
} else {
addGoodsOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.reset()
this.getList()
})
// -
const newOrder = {
...this.form,
type: 1, // 1:
status: 1, // 1:
orderId: this.form.mainOrderId, // 使
transactionId: '', //
servicePrice: 0, //
postage: 0, //
payPrice: this.form.totalPrice, //
deduction: 0, //
createdAt: new Date().toISOString().slice(0, 19).replace('T', ' '), //
updatedAt: new Date().toISOString().slice(0, 19).replace('T', ' ') //
};
addGoodsOrder(newOrder).then(response => {
this.$modal.msgSuccess("新增订单成功");
this.open = false;
this.reset();
this.getList();
}).catch(error => {
console.error('新增订单失败:', error);
this.$modal.msgError('新增订单失败,请重试');
}).finally(() => {
this.submitLoading = false;
});
}
}
})
});
},
/** 删除按钮操作 */
handleDelete(row) {
@ -2414,20 +2401,20 @@ export default {
}
//
this.shipForm = {
id: row.id,
orderId: row.orderId,
productName: row.productName,
name: row.name,
phone: row.phone,
address: row.address,
deliveryId: null,
deliveryNum: '',
sendTime: '',
mark: ''
};
this.shipForm = {
id: row.id,
orderId: row.orderId,
productName: row.productName,
name: row.name,
phone: row.phone,
address: row.address,
deliveryId: null,
deliveryNum: '',
sendTime: '',
mark: ''
};
this.shipDialogVisible = true;
this.shipDialogVisible = true;
} catch (error) {
console.error('获取发货数据失败:', error);
@ -2578,7 +2565,7 @@ export default {
}
// API
getPrePaymentByOrderId(row.orderId).then(response => {
getPrePaymentByOrderId(row.mainOrderId).then(response => {
if (response.code === 200) {
this.prePaymentData = response.data;
this.prePaymentDialogVisible = true;
@ -2946,7 +2933,7 @@ export default {
/** 获取商品图片 */
async getProductImage(productId) {
if (!productId) {
return '';
return '';
}
try {
@ -3119,8 +3106,8 @@ export default {
if (subOrders.length === 0) {
this.$modal.msgError('未找到主订单下的子订单数据');
return;
}
return;
}
// 使
const firstOrder = subOrders[0];
@ -3279,7 +3266,7 @@ export default {
if (!productId) {
return null;
}
try {
const response = await getProductInfo(productId);
return response.data || null;
@ -3288,6 +3275,57 @@ export default {
return null;
}
},
/** 处理商品选择变化 */
handleProductSelectChange(productId) {
if (productId) {
//
const selectedProduct = this.goodsDataList.find(item => item.id === productId);
if (selectedProduct) {
this.form.goodPrice = selectedProduct.price;
this.form.productName = selectedProduct.title;
this.calculateTotalPrice();
}
} else {
//
this.form.goodPrice = 0;
this.form.productName = '';
this.form.totalPrice = 0;
}
},
/** 计算总价格 */
calculateTotalPrice() {
if (this.form.goodPrice && this.form.num) {
this.form.totalPrice = this.form.goodPrice * this.form.num;
} else {
this.form.totalPrice = 0;
}
},
/** 处理地址选择变化 */
handleAddressSelectChange(addressId) {
if (addressId) {
const selectedAddress = this.userAddressList.find(item => item.id === addressId);
if (selectedAddress) {
this.form.name = selectedAddress.name;
this.form.phone = selectedAddress.phone;
this.form.address = selectedAddress.addressName;
}
} else {
//
this.form.name = '';
this.form.phone = '';
this.form.address = '';
}
},
/** 刷新用户地址列表 */
refreshUserAddress() {
if (this.form.uid) {
this.getUserAddressList(this.form.uid);
}
},
},
watch: {
'form.status'(newVal, oldVal) {
@ -3799,4 +3837,31 @@ export default {
.product-image {
text-align: center;
}
/* 新增订单样式 */
.el-form-item.is-required .el-form-item__label:before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
.el-form-item.is-required .el-form-item__label {
font-weight: 500;
}
.appointment-time-picker {
width: 100%;
}
.user-select-wrapper {
width: 100%;
}
.product-select-wrapper {
width: 100%;
}
.address-select-wrapper {
width: 100%;
}
</style>

File diff suppressed because it is too large Load Diff