202506041835
This commit is contained in:
parent
cf60fc57a5
commit
fb692a6936
|
|
@ -1,8 +1,10 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.system.controllerUtil.orderUtil;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.service.*;
|
||||
|
|
@ -35,8 +37,7 @@ import com.ruoyi.system.domain.ServiceGoods;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/Order")
|
||||
public class OrderController extends BaseController
|
||||
{
|
||||
public class OrderController extends BaseController {
|
||||
@Autowired
|
||||
private IOrderService orderService;
|
||||
@Autowired
|
||||
|
|
@ -58,23 +59,23 @@ public class OrderController extends BaseController
|
|||
INotifyOrderService notifyOrderService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 查询服务订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Order order)
|
||||
{
|
||||
public TableDataInfo list(Order order) {
|
||||
startPage();
|
||||
List<Order> list = orderService.selectOrderList(order);
|
||||
for(Order orderdata:list){
|
||||
for (Order orderdata : list) {
|
||||
|
||||
ServiceGoods serviceGoods=serviceGoodsService.selectServiceGoodsById(orderdata.getProductId());
|
||||
if(serviceGoods!=null){
|
||||
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(orderdata.getProductId());
|
||||
if (serviceGoods != null) {
|
||||
orderdata.setProductName(serviceGoods.getTitle());
|
||||
}
|
||||
Users users=usersService.selectUsersById(orderdata.getUid());
|
||||
if (users!=null){
|
||||
Users users = usersService.selectUsersById(orderdata.getUid());
|
||||
if (users != null) {
|
||||
orderdata.setUname(users.getName());
|
||||
}
|
||||
orderdata.setThjl(orderCallService.selectCountOrderCallByOid(orderdata.getId()));
|
||||
|
|
@ -93,8 +94,7 @@ public class OrderController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:Order:export')")
|
||||
@Log(title = "服务订单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Order order)
|
||||
{
|
||||
public void export(HttpServletResponse response, Order order) {
|
||||
List<Order> list = orderService.selectOrderList(order);
|
||||
ExcelUtil<Order> util = new ExcelUtil<Order>(Order.class);
|
||||
util.exportExcel(response, list, "服务订单数据");
|
||||
|
|
@ -106,9 +106,14 @@ public class OrderController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(orderService.selectOrderById(id));
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
Order order = orderService.selectOrderById(id);
|
||||
if (order != null){
|
||||
order.setOrderLog(new OrderLog());
|
||||
}
|
||||
|
||||
return success(order);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -117,27 +122,76 @@ public class OrderController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:Order:add')")
|
||||
@Log(title = "服务订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Order order)
|
||||
{
|
||||
orderUtil orderUtil=new orderUtil();
|
||||
//1,根据用户手机号判断用户不存在
|
||||
int fig=orderUtil.isUser(order.getPhone());
|
||||
if (fig==0){
|
||||
System.out.println("用户XINZE");
|
||||
public AjaxResult add(@RequestBody Order order) {
|
||||
orderUtil orderUtil = new orderUtil();
|
||||
//1,根据用户手机号和地址判断用户的数据数据和地址数据
|
||||
//如果用户数据不存在,则添加用户数据
|
||||
//如果用户地址不存在,则添加用户地址数据
|
||||
if (order.getType() == 1) {
|
||||
Map<String, Object> map = orderUtil.isUser(order.getPhone(), order.getAddress());
|
||||
if (map.get("code").equals("1")) {
|
||||
Users usersdata = (Users) map.get("users");
|
||||
UserAddress userAddressdata = (UserAddress) map.get("UserAddress");
|
||||
if (userAddressdata != null) {
|
||||
order.setAddressId(userAddressdata.getId());
|
||||
}
|
||||
return toAjax(orderService.insertOrder(order)
|
||||
);
|
||||
if (usersdata != null) {
|
||||
order.setUid(usersdata.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//添加订单日志记录
|
||||
int flg= orderService.insertOrder(order);
|
||||
if (flg>0){
|
||||
return toAjax(orderUtil.SaveOrderLog(order));
|
||||
}else{
|
||||
return error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取服务订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping(value = "/selectBaseProjectList/{id}")
|
||||
public AjaxResult selectBaseProjectList(@PathVariable("id") Long id) {
|
||||
Order order = orderService.selectOrderById(id);
|
||||
if (order != null){
|
||||
ServiceGoods serviceGoods=serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
||||
if(serviceGoods!=null){
|
||||
return success(serviceGoods);
|
||||
}else{
|
||||
return error();
|
||||
}
|
||||
}else{
|
||||
return error();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改服务订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:edit')")
|
||||
@Log(title = "服务订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Order order)
|
||||
{
|
||||
return toAjax(orderService.updateOrder(order));
|
||||
public AjaxResult edit(@RequestBody Order order) {
|
||||
//插入订单日志记录
|
||||
orderUtil orderUtil = new orderUtil();
|
||||
orderUtil.SaveOrderLog(order);
|
||||
return toAjax(orderService.updateOrder(order)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -146,24 +200,21 @@ public class OrderController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:Order:remove')")
|
||||
@Log(title = "服务订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(orderService.deleteOrderByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单接单记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping("/receive-records/{orderId}")
|
||||
public AjaxResult getReceiveRecords(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
List<OrderLog> list =orderLogService.selectOrderLogByOrderId(orderId);
|
||||
for(OrderLog orderLogdata:list){
|
||||
Users users=usersService.selectUsersById(orderLogdata.getWorkerId());
|
||||
if(users!=null){
|
||||
public AjaxResult getReceiveRecords(@PathVariable("orderId") String orderId) {
|
||||
List<OrderLog> list = orderLogService.selectOrderLogByOrderId(orderId);
|
||||
for (OrderLog orderLogdata : list) {
|
||||
Users users = usersService.selectUsersById(orderLogdata.getWorkerId());
|
||||
if (users != null) {
|
||||
orderLogdata.setWorkerName(users.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -175,12 +226,12 @@ public class OrderController extends BaseController
|
|||
// */
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping("/call-records/{orderId}")
|
||||
public AjaxResult getCallRecords(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
Order data=orderService.selectOrderByOrderId(orderId);;
|
||||
if(data!=null){
|
||||
public AjaxResult getCallRecords(@PathVariable("orderId") String orderId) {
|
||||
Order data = orderService.selectOrderByOrderId(orderId);
|
||||
;
|
||||
if (data != null) {
|
||||
return success(orderCallService.selectOrderCallByOid(data.getId()));
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
|
||||
|
|
@ -191,25 +242,25 @@ public class OrderController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping("/audio-records/{orderId}")
|
||||
public AjaxResult getAudioRecords(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
Order data=orderService.selectOrderByOrderId(orderId);;
|
||||
if(data!=null){
|
||||
List<OrderSound> list =orderSoundService.selectOrderSoundByOid(data.getId());
|
||||
for(OrderSound orderSounddata:list){
|
||||
orderSounddata.setFile("https://img.huafurenjia.cn/"+orderSounddata.getFile());
|
||||
public AjaxResult getAudioRecords(@PathVariable("orderId") String orderId) {
|
||||
Order data = orderService.selectOrderByOrderId(orderId);
|
||||
;
|
||||
if (data != null) {
|
||||
List<OrderSound> list = orderSoundService.selectOrderSoundByOid(data.getId());
|
||||
for (OrderSound orderSounddata : list) {
|
||||
orderSounddata.setFile("https://img.huafurenjia.cn/" + orderSounddata.getFile());
|
||||
// https://img.huafurenjia.cn/
|
||||
Users users=usersService.selectUsersById(orderSounddata.getWorkerUid()) ;
|
||||
Order order=orderService.selectOrderById(orderSounddata.getOid());
|
||||
if(users!=null){
|
||||
Users users = usersService.selectUsersById(orderSounddata.getWorkerUid());
|
||||
Order order = orderService.selectOrderById(orderSounddata.getOid());
|
||||
if (users != null) {
|
||||
orderSounddata.setWorkerName(users.getName());
|
||||
}
|
||||
if(order!=null){
|
||||
if (order != null) {
|
||||
orderSounddata.setOcode(order.getOrderId());
|
||||
}
|
||||
}
|
||||
return success(list);
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
}
|
||||
|
|
@ -219,12 +270,12 @@ public class OrderController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping("/notify-records/{orderId}")
|
||||
public AjaxResult getNotifyRecords(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
Order data=orderService.selectOrderByOrderId(orderId);;
|
||||
if(data!=null){
|
||||
public AjaxResult getNotifyRecords(@PathVariable("orderId") String orderId) {
|
||||
Order data = orderService.selectOrderByOrderId(orderId);
|
||||
;
|
||||
if (data != null) {
|
||||
return success(notifyOrderService.selectNotifyOrderByOid(data.getId()));
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
}
|
||||
|
|
@ -234,19 +285,19 @@ public class OrderController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:Order:query')")
|
||||
@GetMapping("/comment-records/{orderId}")
|
||||
public AjaxResult getCommentRecords(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
Order data=orderService.selectOrderByOrderId(orderId);;
|
||||
if(data!=null){
|
||||
List<OrderComment> list =orderCommentService.selectOrderCommentByOid(data.getId());
|
||||
for(OrderComment orderCommentdata:list){
|
||||
Users users=usersService.selectUsersById(orderCommentdata.getUid());
|
||||
if(users!=null){
|
||||
public AjaxResult getCommentRecords(@PathVariable("orderId") String orderId) {
|
||||
Order data = orderService.selectOrderByOrderId(orderId);
|
||||
;
|
||||
if (data != null) {
|
||||
List<OrderComment> list = orderCommentService.selectOrderCommentByOid(data.getId());
|
||||
for (OrderComment orderCommentdata : list) {
|
||||
Users users = usersService.selectUsersById(orderCommentdata.getUid());
|
||||
if (users != null) {
|
||||
orderCommentdata.setUname(users.getName());
|
||||
}
|
||||
}
|
||||
return success(list);
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,21 @@ public class QuoteCraftController extends BaseController
|
|||
return success(quoteType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取服务内容详细信息
|
||||
* QuoteCraft quoteCraft
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:QuoteCraft:query')")
|
||||
@GetMapping(value = "/selectQuoteCraftList")
|
||||
public AjaxResult selectQuoteCraftList()
|
||||
{
|
||||
return success(quoteCraftService.selectQuoteCraftList(new QuoteCraft()));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取工艺分类下拉list用来进行多选
|
||||
// */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.util.stream.Collectors;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.system.domain.QuoteCraft;
|
||||
import com.ruoyi.system.domain.QuoteType;
|
||||
import com.ruoyi.system.service.IQuoteMaterialTypeService;
|
||||
import com.ruoyi.system.service.IServiceGoodsService;
|
||||
|
|
@ -82,6 +83,21 @@ public class QuoteMaterialController extends BaseController
|
|||
util.exportExcel(response, list, "项目报价--物料信息数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取服务内容详细信息
|
||||
* QuoteCraft quoteCraft
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:QuoteMaterial:query')")
|
||||
@GetMapping(value = "/selectQuoteMaterialList")
|
||||
public AjaxResult selectQuoteMaterialList()
|
||||
{
|
||||
return success(quoteMaterialService.selectQuoteMaterialList(new QuoteMaterial()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取项目报价--物料信息详细信息
|
||||
*/
|
||||
|
|
@ -136,7 +152,7 @@ public class QuoteMaterialController extends BaseController
|
|||
String json = JSON.toJSONString(strList);
|
||||
quoteMaterial.setGoodId(json.replaceAll("\",\"", "\", \""));
|
||||
//String withSpace = compact.replaceAll("\",\"", "\", \"");
|
||||
System.out.println("#########################"+json.replaceAll("\",\"", "\", \""));
|
||||
|
||||
|
||||
}
|
||||
return toAjax(quoteMaterialService.updateQuoteMaterial(quoteMaterial));
|
||||
|
|
|
|||
|
|
@ -1,40 +1,223 @@
|
|||
package com.ruoyi.system.controllerUtil;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.utils.AmapUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.Order;
|
||||
import com.ruoyi.system.domain.OrderLog;
|
||||
import com.ruoyi.system.domain.UserAddress;
|
||||
import com.ruoyi.system.domain.Users;
|
||||
import com.ruoyi.system.service.IOrderLogService;
|
||||
import com.ruoyi.system.service.IUserAddressService;
|
||||
import com.ruoyi.system.service.IUsersService;
|
||||
import com.ruoyi.system.service.impl.UsersServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 服务订单Controller工具类
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class orderUtil {
|
||||
private static IUsersService usersService = SpringUtils.getBean(IUsersService.class);
|
||||
private static IOrderLogService orderLogService = SpringUtils.getBean(IOrderLogService.class);
|
||||
//新增订单状态
|
||||
private static final String TITLE_1 = "订单生成";
|
||||
private static final String TITLE_1_CONTENT_TYPE1 = "管理人员生成订单";
|
||||
private static final String TITLE_1_CONTENT_TYPE2 = "预约成功,将尽快为主人派单";
|
||||
//派单订单状态
|
||||
private static final String TITLE_2 = "平台派单";
|
||||
private static final String TITLE_2_1 = "系统派单";
|
||||
private static final String TITLE_2_CONTENT_TYPE2 = "师傅收到派单信息";
|
||||
//师傅接单
|
||||
private static final String TITLE_3 = "师傅接单";
|
||||
private static final String TITLE_3_CONTENT_TYPE3 = "同意系统配单";
|
||||
//设置上门费
|
||||
|
||||
//出发上门
|
||||
private static final String TITLE_4 = "出发上门";
|
||||
private static final String TITLE_4_CONTENT_TYPE4 = "师傅收到派单信息准备出发";
|
||||
|
||||
//设置上门费
|
||||
private static final String TITLE_5 = "师傅到达";
|
||||
private static final String TITLE_5_CONTENT_TYPE5 = "师傅到达服务地点";
|
||||
//项目报价
|
||||
private static final String TITLE_6 = "已检查评估报价";
|
||||
//开始服务
|
||||
private static final String TITLE_7 = "进行服务";
|
||||
//暂停服务
|
||||
private static final String TITLE_8 = "暂停服务";
|
||||
//暂停服务
|
||||
private static final String TITLE_9 = "服务完成";
|
||||
|
||||
|
||||
|
||||
//1,根据用户手机号判断用户不存在,4如果不存在就要新增一个用户数据
|
||||
public int isUser(String phone) {
|
||||
if (SpringUtils.getBean(IUsersService.class).selectUsersByPhone(phone) == null){
|
||||
public Map<String, Object> isUser(String phone, String adressName) {
|
||||
AmapUtils amapUtils = new AmapUtils();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
if (SpringUtils.getBean(IUsersService.class).selectUsersByPhone(phone) == null) {
|
||||
//1,用户不存在添加用户
|
||||
Users users = new Users();
|
||||
users.setName("微信用户");
|
||||
users.setType("1");
|
||||
users.setStatus(1);
|
||||
users.setPhone(phone);
|
||||
SpringUtils.getBean(IUsersService.class).insertUsers(users);
|
||||
return 0;
|
||||
if (SpringUtils.getBean(IUsersService.class).insertUsers(users) > 0) {
|
||||
//添加成功用户后添加用户地址
|
||||
return isAddAdressUser(users, adressName);
|
||||
} else {
|
||||
map.put("code", "0");
|
||||
return map;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return isAddAdressUser(SpringUtils.getBean(IUsersService.class).selectUsersByPhone(phone), adressName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//2根据用户地址获取经纬度,然后存地址数据
|
||||
public Map<String, Object> isAddAdressUser(Users users, String adressName) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
UserAddress selectuserAddress = new UserAddress();
|
||||
selectuserAddress.setUid(users.getId());
|
||||
selectuserAddress.setAddressName(adressName);
|
||||
List<UserAddress> userAddresslist = SpringUtils.getBean(IUserAddressService.class).selectUserAddressList(selectuserAddress);
|
||||
//判断用户地址是否存在
|
||||
if (!userAddresslist.isEmpty()) {
|
||||
map.put("code", "1");
|
||||
map.put("users", users);
|
||||
map.put("UserAddress", userAddresslist.get(0));
|
||||
return map;
|
||||
} else {
|
||||
//如果用户地址不存在就添加地址
|
||||
AmapUtils amapUtils = new AmapUtils();
|
||||
JSONObject jsonObject = amapUtils.geocode(adressName);
|
||||
UserAddress userAddress = new UserAddress();
|
||||
userAddress.setUid(users.getId());
|
||||
userAddress.setName(users.getName());
|
||||
userAddress.setPhone(users.getPhone());
|
||||
userAddress.setAddressName(adressName);
|
||||
userAddress.setAddressInfo(adressName);
|
||||
userAddress.setInfo(adressName);
|
||||
if (jsonObject.get("info").equals("OK")) {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("geocodes");
|
||||
if (!jsonArray.isEmpty()) {
|
||||
JSONObject jsonObject1 = (JSONObject) jsonArray.get(0);
|
||||
String itude = jsonObject1.get("location").toString();
|
||||
String[] latitude = itude.split(",");
|
||||
userAddress.setLatitude(latitude[1]);
|
||||
userAddress.setLongitude(latitude[0]);
|
||||
}
|
||||
}
|
||||
userAddress.setIsDefault(Long.valueOf(1));
|
||||
if (SpringUtils.getBean(IUserAddressService.class).insertUserAddress(userAddress) > 0) {
|
||||
map.put("code", "1");
|
||||
map.put("users", users);
|
||||
map.put("UserAddress", userAddress);
|
||||
return map;
|
||||
} else {
|
||||
map.put("code", "0");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//新增订单后添加订单记录
|
||||
public int SaveOrderLog(Order order) {
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
OrderLog orderLog = new OrderLog();
|
||||
if (Objects.equals(order.getStatus(), 1L)){
|
||||
if (order.getCreateType()==2){
|
||||
jsonObject.put("name",TITLE_1_CONTENT_TYPE1);
|
||||
}else{
|
||||
jsonObject.put("name",TITLE_1_CONTENT_TYPE2);
|
||||
}
|
||||
orderLog.setTitle(TITLE_1);
|
||||
orderLog.setType(new BigDecimal(1.0));
|
||||
}
|
||||
if (Objects.equals(order.getStatus(), 2L)){
|
||||
//分配师傅待接单
|
||||
if (order.getJsonStatus()==1){
|
||||
if(order.getOrderLog()!=null){
|
||||
if (order.getOrderLog().getWorkerId()!=null){
|
||||
Users users=usersService.selectUsersById(order.getOrderLog().getWorkerId());
|
||||
if (users!=null){
|
||||
orderLog.setWorkerName(users.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
orderLog.setTitle(TITLE_2);
|
||||
jsonObject.put("name",TITLE_2_CONTENT_TYPE2);
|
||||
orderLog.setType(new BigDecimal(1.1));
|
||||
}
|
||||
//师傅同意接单
|
||||
if (order.getJsonStatus()==2){
|
||||
orderLog.setTitle(TITLE_3);
|
||||
jsonObject.put("name",TITLE_3_CONTENT_TYPE3);
|
||||
orderLog.setType(new BigDecimal(2.0));
|
||||
}
|
||||
//设置上门费
|
||||
if (order.getJsonStatus()==3){
|
||||
orderLog.setPrice(order.getOrderLog().getPrice());
|
||||
orderLog.setTitle(TITLE_4);
|
||||
jsonObject.put("name",TITLE_4_CONTENT_TYPE4);
|
||||
orderLog.setType(new BigDecimal(3.0));
|
||||
}
|
||||
//出发上门
|
||||
if (order.getJsonStatus()==4){
|
||||
orderLog.setTitle(TITLE_4);
|
||||
jsonObject.put("name",TITLE_4_CONTENT_TYPE4);
|
||||
orderLog.setType(new BigDecimal(3.0));
|
||||
}
|
||||
//确认到达
|
||||
if (order.getJsonStatus()==5){
|
||||
orderLog.setTitle(TITLE_5);
|
||||
jsonObject.put("name",TITLE_5_CONTENT_TYPE5);
|
||||
orderLog.setType(new BigDecimal(4.0));
|
||||
}
|
||||
//项目报价
|
||||
if (order.getJsonStatus()==6){
|
||||
orderLog.setTitle(TITLE_6);
|
||||
jsonObject=JSONObject.parseObject(order.getOrderLog().getContent());
|
||||
orderLog.setType(new BigDecimal(5.0));
|
||||
}
|
||||
}
|
||||
if (Objects.equals(order.getStatus(), 3L)){
|
||||
//开始服务
|
||||
if(order.getJsonStatus()==7){
|
||||
orderLog.setTitle(TITLE_7);
|
||||
jsonObject=JSONObject.parseObject(order.getOrderLog().getContent());
|
||||
orderLog.setType(new BigDecimal(6.0));
|
||||
|
||||
}
|
||||
//暂停服务
|
||||
if(order.getJsonStatus()==8){
|
||||
orderLog.setTitle(TITLE_8);
|
||||
jsonObject=JSONObject.parseObject(order.getOrderLog().getContent());
|
||||
orderLog.setType(new BigDecimal(7.0));
|
||||
}
|
||||
//完成服务
|
||||
if(order.getJsonStatus()==9){
|
||||
orderLog.setTitle(TITLE_9);
|
||||
jsonObject=JSONObject.parseObject(order.getOrderLog().getContent());
|
||||
orderLog.setType(new BigDecimal(8.0));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
orderLog.setRemark(order.getRemark());
|
||||
orderLog.setOid(order.getId());
|
||||
orderLog.setOrderId(order.getOrderId());
|
||||
orderLog.setContent(jsonObject.toJSONString());
|
||||
return orderLogService.insertOrderLog(orderLog);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ public class Order extends BaseEntity
|
|||
private int fwpj;
|
||||
|
||||
|
||||
|
||||
private OrderLog orderLog;
|
||||
|
||||
private BigDecimal totalPriceMin;
|
||||
private BigDecimal totalPriceMax;
|
||||
private BigDecimal payPriceMin;
|
||||
|
|
@ -823,6 +826,15 @@ public class Order extends BaseEntity
|
|||
this.paystartdate = paystartdate;
|
||||
}
|
||||
|
||||
|
||||
public OrderLog getOrderLog() {
|
||||
return orderLog;
|
||||
}
|
||||
|
||||
public void setOrderLog(OrderLog orderLog) {
|
||||
this.orderLog = orderLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select count(*) from order_log where order_id = #{orderId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderLogByOrderId" parameterType="String" resultMap="OrderLogResult">
|
||||
select * from order_log where order_id = #{orderId}
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,30 @@ export function getCommentRecords(orderId) {
|
|||
})
|
||||
}
|
||||
|
||||
// 获取基础项目列表
|
||||
export function selectBaseProjectList(id) {
|
||||
return request({
|
||||
url: '/system/Order/selectBaseProjectList/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取报价工艺列表
|
||||
export function selectQuoteCraftList() {
|
||||
return request({
|
||||
url: '/system/QuoteCraft/selectQuoteCraftList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取报价材料列表
|
||||
export function selectQuoteMaterialList() {
|
||||
return request({
|
||||
url: '/system/QuoteMaterial/selectQuoteMaterialList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取录音文件列表
|
||||
|
|
|
|||
|
|
@ -428,20 +428,380 @@
|
|||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="订单状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="1">待支付</el-radio>
|
||||
<el-radio :label="2">已支付</el-radio>
|
||||
<el-radio :label="3">待发货</el-radio>
|
||||
<el-radio :label="4">待收货</el-radio>
|
||||
<el-radio :label="5">已完成</el-radio>
|
||||
<el-radio-group v-model="form.status" @change="handleStatusChange">
|
||||
<el-radio :label="1">待接单</el-radio>
|
||||
<el-radio :label="2">待服务</el-radio>
|
||||
<el-radio :label="3">服务中</el-radio>
|
||||
<el-radio :label="4">已结束</el-radio>
|
||||
<el-radio :label="5">已取消</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 服务进度选项 - 待服务状态 -->
|
||||
<el-col :span="24" v-if="form.status === 2">
|
||||
<el-form-item label="服务进度" prop="jsonStatus">
|
||||
<el-radio-group v-model="form.jsonStatus" @change="handlejsonStatusChange">
|
||||
<el-radio :label="1">派单</el-radio>
|
||||
<el-radio :label="2">接单</el-radio>
|
||||
<el-radio :label="3">设置上门</el-radio>
|
||||
<el-radio :label="4">出发上门</el-radio>
|
||||
<el-radio :label="5">确认到达</el-radio>
|
||||
<el-radio :label="6">项目报价</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 服务进度选项 - 服务中状态 -->
|
||||
<el-col :span="24" v-if="form.status === 3">
|
||||
<el-form-item label="服务进度" prop="jsonStatus">
|
||||
<el-radio-group v-model="form.jsonStatus" @change="handlejsonStatusChange">
|
||||
<el-radio :label="7">开始服务</el-radio>
|
||||
<el-radio :label="8">暂停</el-radio>
|
||||
<el-radio :label="9">完成服务</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 设置上门费内容 -->
|
||||
<template v-if="form.jsonStatus === 3">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上门费" prop="orderLog.price">
|
||||
<el-input v-model="form.orderLog.price" type="number" placeholder="请输入上门费" prefix-icon="el-icon-money">
|
||||
<template slot="prepend">¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="orderLog.remark">
|
||||
<el-input
|
||||
v-model="form.orderLog.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="预约时间" prop="appointmentDate">
|
||||
<el-date-picker
|
||||
v-model="form.appointmentDate"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 派单内容 -->
|
||||
<template v-if="form.jsonStatus === 1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="师傅" prop="orderLog.workerId">
|
||||
<el-select v-model="form.orderLog.workerId" placeholder="请选择师傅" clearable filterable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in userGongRenList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="orderLog.remark">
|
||||
<el-input v-model="form.orderLog.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 接单内容 -->
|
||||
<template v-if="form.jsonStatus === 2">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="orderLog.remark">
|
||||
<el-input
|
||||
v-model="form.orderLog.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 设置上门内容 -->
|
||||
|
||||
|
||||
<!-- 出发上门内容 -->
|
||||
<template v-if="form.jsonStatus === 4">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="orderLog.remark">
|
||||
<el-input
|
||||
v-model="form.orderLog.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
<!-- 出发上门内容 -->
|
||||
<template v-if="form.jsonStatus === 5">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="mark">
|
||||
<el-input
|
||||
v-model="form.mark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 项目报价内容 -->
|
||||
<template v-if="form.jsonStatus === 6">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目费用" prop="price">
|
||||
<el-input
|
||||
v-model="form.price"
|
||||
type="number"
|
||||
placeholder="请输入项目费用"
|
||||
@change="handlePriceChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="基础项目" prop="baseProject">
|
||||
<el-select
|
||||
v-model="form.baseProject"
|
||||
multiple
|
||||
collapse-tags
|
||||
placeholder="请选择基础项目"
|
||||
style="width: 100%"
|
||||
@change="handleBaseProjectChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in baseProjectList"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="服务项目" prop="serviceItems">
|
||||
<div class="service-items">
|
||||
<div v-for="(item, index) in form.serviceItems" :key="index" class="service-item">
|
||||
<el-select
|
||||
v-model="item.id"
|
||||
placeholder="选择项目"
|
||||
style="width: 40%; margin-right: 10px;"
|
||||
@change="(val) => handleServiceItemChange(val, index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in quoteCraftList"
|
||||
:key="option.id"
|
||||
:label="option.title+'--('+option.price+'元/'+option.unit+')'"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input-number
|
||||
v-model="item.quantity"
|
||||
:min="1"
|
||||
placeholder="数量"
|
||||
style="width: 25%; margin-right: 10px;"
|
||||
@change="handleQuantityChange"
|
||||
/>
|
||||
<el-button type="danger" icon="el-icon-delete" circle @click="removeServiceItem(index)" />
|
||||
</div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addServiceItem">新增服务项目</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="物料" prop="materials">
|
||||
<div class="materials">
|
||||
<div v-for="(item, index) in form.materials" :key="index" class="material-item">
|
||||
<el-select
|
||||
v-model="item.id"
|
||||
placeholder="选择物料"
|
||||
style="width: 40%; margin-right: 10px;"
|
||||
@change="(val) => handleMaterialChange(val, index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in quoteMaterialList"
|
||||
:key="option.id"
|
||||
:label="option.title+'--('+option.price+'元/'+option.unit+')'"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input-number
|
||||
v-model="item.quantity"
|
||||
:min="1"
|
||||
placeholder="数量"
|
||||
style="width: 25%; margin-right: 10px;"
|
||||
@change="handleQuantityChange"
|
||||
/>
|
||||
<el-button type="danger" icon="el-icon-delete" circle @click="removeMaterial(index)" />
|
||||
</div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addMaterial">新增物料</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="付款方式" prop="paymentMethod">
|
||||
<el-radio-group v-model="form.paymentMethod" @change="handlePaymentMethodChange">
|
||||
<el-radio :label="1">定金+尾款</el-radio>
|
||||
<el-radio :label="2">一次性付清</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 只在选择定金+尾款时显示定金输入框 -->
|
||||
<el-col :span="24" v-if="form.paymentMethod === 1">
|
||||
<el-form-item label="定金" prop="orderLog.deposit">
|
||||
<el-input
|
||||
v-model="form.orderLog.deposit"
|
||||
type="number"
|
||||
placeholder="请输入定金金额"
|
||||
@change="handleDepositChange"
|
||||
>
|
||||
<template slot="prepend">¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 开始服务内容 -->
|
||||
<template v-if="form.jsonStatus === 7">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="服务照片" prop="servicePhotos">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
:on-change="handlePhotoChange"
|
||||
:file-list="form.servicePhotos"
|
||||
list-type="picture-card"
|
||||
multiple
|
||||
>
|
||||
<i class="el-icon-plus"></i>
|
||||
<div slot="tip" class="el-upload__tip">可将文件拖到这里</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="mark">
|
||||
<el-input v-model="form.mark" type="textarea" placeholder="请输入备注" />
|
||||
<el-input
|
||||
v-model="form.mark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 暂停内容 -->
|
||||
<template v-if="form.jsonStatus === 8">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="服务照片" prop="servicePhotos">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
:on-change="handlePhotoChange"
|
||||
:file-list="form.servicePhotos"
|
||||
list-type="picture-card"
|
||||
multiple
|
||||
>
|
||||
<i class="el-icon-plus"></i>
|
||||
<div slot="tip" class="el-upload__tip">可将文件拖到这里</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="暂停原因" prop="pauseReason">
|
||||
<el-input
|
||||
v-model="form.pauseReason"
|
||||
type="textarea"
|
||||
placeholder="请输入暂停原因"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="下次服务时间" prop="nextServiceTime">
|
||||
<el-date-picker
|
||||
v-model="form.nextServiceTime"
|
||||
type="datetime"
|
||||
placeholder="选择下次服务时间"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="mark">
|
||||
<el-input
|
||||
v-model="form.mark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<!-- 完成服务内容 -->
|
||||
<template v-if="form.jsonStatus === 9">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="服务照片" prop="servicePhotos">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
:on-change="handlePhotoChange"
|
||||
:file-list="form.servicePhotos"
|
||||
list-type="picture-card"
|
||||
multiple
|
||||
>
|
||||
<i class="el-icon-plus"></i>
|
||||
<div slot="tip" class="el-upload__tip">可将文件拖到这里</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="mark">
|
||||
<el-input
|
||||
v-model="form.mark"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="预约时间" prop="makeTime">
|
||||
<el-date-picker
|
||||
v-model="form.makeTime"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="选择时间段" prop="makeHour">
|
||||
<el-select v-model="form.makeHour" placeholder="请选择时间段" style="width: 100%">
|
||||
<el-option label="8:00-10:00" value="8:00-10:00" />
|
||||
<el-option label="10:00-12:00" value="10:00-12:00" />
|
||||
<el-option label="12:00-14:00" value="12:00-14:00" />
|
||||
<el-option label="14:00-16:00" value="14:00-16:00" />
|
||||
<el-option label="16:00-18:00" value="16:00-18:00" />
|
||||
<el-option label="18:00-20:00" value="18:00-20:00" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
<div class="dialog-footer" style="text-align:left;margin-top:20px;">
|
||||
<el-button @click="reset">重置</el-button>
|
||||
|
|
@ -499,7 +859,7 @@
|
|||
|
||||
<script>
|
||||
|
||||
import { listOrder, getOrder, delOrder, addOrder, updateOrder,getUserDataList,getGoodsDataList} from "@/api/system/Order"
|
||||
import { listOrder, getOrder, delOrder, addOrder, updateOrder,getUserDataList,getGoodsDataList,selectQuoteCraftList,selectQuoteMaterialList,selectBaseProjectList} from "@/api/system/Order"
|
||||
import { getuserAddressList } from "@/api/system/UserAddress"
|
||||
import CallRecord from './components/CallRecord'
|
||||
import AudioRecord from './components/AudioRecord'
|
||||
|
|
@ -533,6 +893,12 @@ export default {
|
|||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 报价工艺列表
|
||||
quoteCraftList: [],
|
||||
// 报价材料列表
|
||||
quoteMaterialList: [],
|
||||
|
||||
baseProjectList: [],
|
||||
|
||||
userDataList: [],
|
||||
|
||||
|
|
@ -572,7 +938,51 @@ export default {
|
|||
mark: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
form: {
|
||||
id: null,
|
||||
orderId: null,
|
||||
transactionId: null,
|
||||
createType: 1, // 默认自主下单
|
||||
uid: null,
|
||||
addressId: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
address: null,
|
||||
productId: null,
|
||||
type: 1,
|
||||
num: 1,
|
||||
totalPrice: null,
|
||||
payPrice: null,
|
||||
deduction: null,
|
||||
payTime: null,
|
||||
status: 1, // 默认待支付
|
||||
jsonStatus: null,
|
||||
workerId: null,
|
||||
departureTime: null,
|
||||
arrivalTime: null,
|
||||
projectCost: null,
|
||||
baseProject: [], // 改为数组以支持多选
|
||||
serviceItems: [],
|
||||
materials: [],
|
||||
paymentMethod: 2, // 默认为一次性付清
|
||||
deposit: 0, // 定金金额
|
||||
startTime: null,
|
||||
pauseTime: null,
|
||||
pauseReason: null,
|
||||
completeTime: null,
|
||||
mark: null,
|
||||
doorFee: null, // 添加上门费字段
|
||||
servicePhotos: [], // 添加服务照片字段
|
||||
nextServiceTime: null, // 添加下次服务时间字段
|
||||
orderLog:{
|
||||
workerId:1,
|
||||
workerName:null,
|
||||
price:0,
|
||||
deposit:0,
|
||||
content:"",
|
||||
remark:null
|
||||
},
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
orderId: [
|
||||
|
|
@ -611,6 +1021,15 @@ export default {
|
|||
],
|
||||
status: [
|
||||
{ required: true, message: "请选择订单状态", trigger: "change" }
|
||||
],
|
||||
jsonStatus: [
|
||||
{ required: true, message: "请选择服务进度", trigger: "change" }
|
||||
],
|
||||
appointmentDate: [
|
||||
{ required: true, message: "请选择预约日期", trigger: "change" }
|
||||
],
|
||||
timeSlot: [
|
||||
{ required: true, message: "请选择时间段", trigger: "change" }
|
||||
]
|
||||
},
|
||||
commentDialogVisible: false, // 评价详情对话框可见性
|
||||
|
|
@ -641,6 +1060,8 @@ export default {
|
|||
this.getuserGongRenList()
|
||||
this.getGoodsDataListList();
|
||||
this.getAddressList();
|
||||
this.getQuoteCraftList()
|
||||
this.getQuoteMaterialList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询服务订单列表 */
|
||||
|
|
@ -688,7 +1109,24 @@ export default {
|
|||
deduction: null,
|
||||
payTime: null,
|
||||
status: 1, // 默认待支付
|
||||
mark: null
|
||||
jsonStatus: null,
|
||||
workerId: null,
|
||||
departureTime: null,
|
||||
arrivalTime: null,
|
||||
projectCost: null,
|
||||
baseProject: [], // 重置为空数组
|
||||
serviceItems: [],
|
||||
materials: [],
|
||||
paymentMethod: 2, // 重置为一次性付清
|
||||
deposit: 0, // 重置定金
|
||||
startTime: null,
|
||||
pauseTime: null,
|
||||
pauseReason: null,
|
||||
completeTime: null,
|
||||
mark: null,
|
||||
doorFee: null, // 重置上门费
|
||||
servicePhotos: [], // 重置服务照片
|
||||
nextServiceTime: null, // 重置下次服务时间
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
|
|
@ -730,15 +1168,153 @@ export default {
|
|||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
// 初始化必要的数组
|
||||
this.form.serviceItems = []
|
||||
this.form.materials = []
|
||||
this.form.price = 0
|
||||
this.form.baseProject = [] // 初始化为空数组
|
||||
this.form.orderLog = {
|
||||
workerId: 1,
|
||||
workerName: null,
|
||||
price: 0,
|
||||
deposit: 0,
|
||||
content: "",
|
||||
remark: null
|
||||
}
|
||||
this.open = true
|
||||
this.title = "添加服务订单"
|
||||
},
|
||||
|
||||
|
||||
// 获取报价工艺列表
|
||||
getQuoteCraftList(){
|
||||
selectQuoteCraftList().then(response => {
|
||||
this.quoteCraftList = response.data
|
||||
})
|
||||
},
|
||||
|
||||
// 获取报价材料列表
|
||||
getQuoteMaterialList(){
|
||||
selectQuoteMaterialList().then(response => {
|
||||
this.quoteMaterialList = response.data
|
||||
})
|
||||
},
|
||||
getBaseProjectList(id){
|
||||
selectBaseProjectList(id).then(response => {
|
||||
// 将接收到的数据转换为数组
|
||||
let basicData = response.data.basic
|
||||
|
||||
// 如果basicData是字符串,尝试解析为JSON
|
||||
if (typeof basicData === 'string') {
|
||||
try {
|
||||
basicData = JSON.parse(basicData)
|
||||
} catch (e) {
|
||||
console.error('解析基础项目数据失败:', e)
|
||||
basicData = []
|
||||
}
|
||||
}
|
||||
|
||||
// 确保最终结果是数组
|
||||
if (Array.isArray(basicData)) {
|
||||
this.baseProjectList = basicData
|
||||
} else if (basicData && typeof basicData === 'object') {
|
||||
// 如果是对象,尝试提取值或转换为数组
|
||||
this.baseProjectList = Object.values(basicData)
|
||||
} else {
|
||||
// 如果都不是,设置为空数组
|
||||
this.baseProjectList = []
|
||||
}
|
||||
|
||||
console.log("转换后的baseProjectList:", this.baseProjectList)
|
||||
}).catch(error => {
|
||||
console.error('获取基础项目列表失败:', error)
|
||||
this.baseProjectList = []
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
this.getBaseProjectList(row.id)
|
||||
getOrder(id).then(response => {
|
||||
this.form = response.data
|
||||
|
||||
// 确保必要的数组和对象被初始化
|
||||
if (!this.form.serviceItems) {
|
||||
this.$set(this.form, 'serviceItems', [])
|
||||
}
|
||||
if (!this.form.materials) {
|
||||
this.$set(this.form, 'materials', [])
|
||||
}
|
||||
if (!this.form.orderLog) {
|
||||
this.$set(this.form, 'orderLog', {
|
||||
workerId: 1,
|
||||
workerName: null,
|
||||
price: 0,
|
||||
content: "",
|
||||
remark: null
|
||||
})
|
||||
}
|
||||
// 如果存在content,尝试解析它
|
||||
if (this.form.orderLog && this.form.orderLog.content) {
|
||||
try {
|
||||
const content = JSON.parse(this.form.orderLog.content)
|
||||
|
||||
// 解析项目报价相关数据(jsonStatus === 6)
|
||||
if (content.craft) {
|
||||
this.form.serviceItems = content.craft.map(item => ({
|
||||
name: item.name,
|
||||
price: item.price,
|
||||
quantity: item.count,
|
||||
id: null
|
||||
}))
|
||||
}
|
||||
if (content.material) {
|
||||
this.form.materials = content.material.map(item => ({
|
||||
name: item.name,
|
||||
price: item.price,
|
||||
quantity: item.count,
|
||||
id: null
|
||||
}))
|
||||
}
|
||||
if (content.basic) {
|
||||
this.form.baseProject = content.basic.map(item => item.name)
|
||||
}
|
||||
if (content.project) {
|
||||
this.form.price = content.project.price
|
||||
}
|
||||
|
||||
// 解析开始服务状态的图片数据(jsonStatus === 7)
|
||||
if (content.name === "师傅开始服务" && content.image && Array.isArray(content.image)) {
|
||||
// 将图片地址转换为文件列表格式
|
||||
this.form.servicePhotos = content.image.map((url, index) => ({
|
||||
name: `image_${index + 1}`,
|
||||
url: url,
|
||||
uid: Date.now() + index // 生成唯一的uid
|
||||
}))
|
||||
}
|
||||
|
||||
// 解析暂停状态的图片数据(jsonStatus === 8)
|
||||
if (content.name === "服务暂停" && content.image && Array.isArray(content.image)) {
|
||||
this.form.servicePhotos = content.image.map((url, index) => ({
|
||||
name: `pause_image_${index + 1}`,
|
||||
url: url,
|
||||
uid: Date.now() + index
|
||||
}))
|
||||
}
|
||||
|
||||
// 解析完成服务状态的图片数据(jsonStatus === 9)
|
||||
if (content.name === "服务完成" && content.image && Array.isArray(content.image)) {
|
||||
this.form.servicePhotos = content.image.map((url, index) => ({
|
||||
name: `complete_image_${index + 1}`,
|
||||
url: url,
|
||||
uid: Date.now() + index
|
||||
}))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析orderLog.content失败:', e)
|
||||
}
|
||||
}
|
||||
this.open = true
|
||||
this.title = "修改服务订单"
|
||||
})
|
||||
|
|
@ -952,6 +1528,189 @@ export default {
|
|||
this.queryParams.createdAt = value;
|
||||
this.handleQuery();
|
||||
},
|
||||
// 状态变更时重置服务进度
|
||||
handleStatusChange(value) {
|
||||
this.form.jsonStatus = null;
|
||||
},
|
||||
handlejsonStatusChange(value) {
|
||||
// 重置相关字段
|
||||
this.form.workerId = null;
|
||||
this.form.departureTime = null;
|
||||
this.form.arrivalTime = null;
|
||||
this.form.projectCost = null;
|
||||
this.form.baseProject = null;
|
||||
this.form.serviceItems = [];
|
||||
this.form.materials = [];
|
||||
this.form.paymentMethod = 2;
|
||||
this.form.deposit = 0;
|
||||
this.form.startTime = null;
|
||||
this.form.pauseTime = null;
|
||||
this.form.pauseReason = null;
|
||||
this.form.completeTime = null;
|
||||
this.form.doorFee = null;
|
||||
this.form.servicePhotos = [];
|
||||
this.form.nextServiceTime = null; // 重置下次服务时间
|
||||
},
|
||||
addServiceItem() {
|
||||
this.form.serviceItems.push({
|
||||
id: null,
|
||||
name: '',
|
||||
price: '0',
|
||||
unit: '',
|
||||
quantity: 1
|
||||
});
|
||||
},
|
||||
removeServiceItem(index) {
|
||||
this.form.serviceItems.splice(index, 1);
|
||||
},
|
||||
handleServiceItemChange(val, index) {
|
||||
const selectedItem = this.quoteCraftList.find(item => item.id === val);
|
||||
if (selectedItem) {
|
||||
this.form.serviceItems[index].name = selectedItem.title;
|
||||
this.form.serviceItems[index].price = selectedItem.price;
|
||||
this.form.serviceItems[index].unit = selectedItem.unit;
|
||||
this.updateQuoteContent();
|
||||
}
|
||||
},
|
||||
addMaterial() {
|
||||
this.form.materials.push({
|
||||
id: null,
|
||||
name: '',
|
||||
price: '0',
|
||||
unit: '',
|
||||
quantity: 1
|
||||
});
|
||||
},
|
||||
removeMaterial(index) {
|
||||
this.form.materials.splice(index, 1);
|
||||
},
|
||||
handleMaterialChange(val, index) {
|
||||
const selectedItem = this.quoteMaterialList.find(item => item.id === val);
|
||||
if (selectedItem) {
|
||||
this.form.materials[index].name = selectedItem.title;
|
||||
this.form.materials[index].price = selectedItem.price;
|
||||
this.form.materials[index].unit = selectedItem.unit;
|
||||
this.updateQuoteContent();
|
||||
}
|
||||
},
|
||||
// 更新数量时也需要更新JSON内容
|
||||
handleQuantityChange() {
|
||||
this.updateQuoteContent();
|
||||
},
|
||||
// 更新基础项目时也需要更新JSON内容
|
||||
handleBaseProjectChange() {
|
||||
this.updateQuoteContent();
|
||||
},
|
||||
// 更新项目费用时也需要更新JSON内容
|
||||
handlePriceChange() {
|
||||
this.updateQuoteContent();
|
||||
},
|
||||
// 更新报价内容JSON
|
||||
updateQuoteContent() {
|
||||
// 计算服务项目总价
|
||||
const craftTotal = this.form.serviceItems.reduce((total, item) => {
|
||||
return total + (parseFloat(item.price || 0) * (parseInt(item.quantity || 0)));
|
||||
}, 0);
|
||||
|
||||
// 计算物料总价
|
||||
const materialTotal = this.form.materials.reduce((total, item) => {
|
||||
return total + (parseFloat(item.price || 0) * (parseInt(item.quantity || 0)));
|
||||
}, 0);
|
||||
|
||||
// 总价 = 项目费用 + 服务项目总价 + 物料总价
|
||||
const totalPrice = parseFloat(this.form.price || 0) + craftTotal + materialTotal;
|
||||
|
||||
// 构建基础项目数组
|
||||
const basicItems = this.form.baseProject.map(item => ({ name: item }));
|
||||
|
||||
// 构建服务项目数组
|
||||
const craftItems = this.form.serviceItems.map(item => ({
|
||||
name: item.name,
|
||||
price: item.price,
|
||||
count: item.quantity
|
||||
}));
|
||||
|
||||
// 构建物料数组
|
||||
const materialItems = this.form.materials.map(item => ({
|
||||
name: item.name,
|
||||
price: item.price,
|
||||
count: item.quantity
|
||||
}));
|
||||
|
||||
// 组合JSON
|
||||
const quoteContent = {
|
||||
project: {
|
||||
name: "项目费用",
|
||||
price: totalPrice,
|
||||
paymentMethod: this.form.paymentMethod === 1 ? "定金+尾款" : "一次性付清",
|
||||
deposit: this.form.paymentMethod === 1 ? this.form.deposit : 0
|
||||
},
|
||||
basic: basicItems,
|
||||
craft: craftItems,
|
||||
material: materialItems
|
||||
};
|
||||
|
||||
// 将JSON字符串赋值给orderLog.content
|
||||
this.form.orderLog.content = JSON.stringify(quoteContent);
|
||||
// 同时更新orderLog.price为总价
|
||||
this.form.orderLog.price = totalPrice;
|
||||
},
|
||||
// 处理照片变更
|
||||
handlePhotoChange(file, fileList) {
|
||||
this.form.servicePhotos = fileList;
|
||||
|
||||
// 提取图片地址数组
|
||||
const imageUrls = fileList.map(file => {
|
||||
// 如果是新上传的文件,使用response中的url
|
||||
if (file.response && file.response.url) {
|
||||
return file.response.url;
|
||||
}
|
||||
// 如果是已存在的文件,使用url属性
|
||||
if (file.url) {
|
||||
return file.url;
|
||||
}
|
||||
// 如果都没有,返回空字符串
|
||||
return '';
|
||||
}).filter(url => url); // 过滤掉空字符串
|
||||
|
||||
// 根据不同的服务进度状态封装不同的JSON格式
|
||||
if (this.form.jsonStatus === 7) {
|
||||
// 开始服务状态
|
||||
const serviceImageJson = {
|
||||
name: "师傅开始服务",
|
||||
image: imageUrls
|
||||
};
|
||||
this.form.orderLog.content = JSON.stringify(serviceImageJson);
|
||||
console.log('开始服务图片JSON:', this.form.orderLog.content);
|
||||
|
||||
} else if (this.form.jsonStatus === 8) {
|
||||
// 暂停状态
|
||||
const pauseImageJson = {
|
||||
name: "服务暂停",
|
||||
image: imageUrls
|
||||
};
|
||||
this.form.orderLog.content = JSON.stringify(pauseImageJson);
|
||||
console.log('暂停服务图片JSON:', this.form.orderLog.content);
|
||||
|
||||
} else if (this.form.jsonStatus === 9) {
|
||||
// 完成服务状态
|
||||
const completeImageJson = {
|
||||
name: "服务完成",
|
||||
image: imageUrls
|
||||
};
|
||||
this.form.orderLog.content = JSON.stringify(completeImageJson);
|
||||
console.log('完成服务图片JSON:', this.form.orderLog.content);
|
||||
}
|
||||
},
|
||||
handlePaymentMethodChange(value) {
|
||||
if (value === 2) { // 如果选择一次性付清
|
||||
this.form.orderLog.deposit = 0; // 清空定金
|
||||
}
|
||||
this.updateQuoteContent();
|
||||
},
|
||||
handleDepositChange() {
|
||||
this.updateQuoteContent();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1218,4 +1977,56 @@ export default {
|
|||
padding: 10px 5px 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.service-items,
|
||||
.materials {
|
||||
.service-item,
|
||||
.material-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.el-select {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.upload-demo {
|
||||
.el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
}
|
||||
|
||||
.el-upload__tip {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
margin-top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 100%;
|
||||
|
||||
&.el-select--multiple {
|
||||
.el-select__tags {
|
||||
max-width: calc(100% - 30px);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue