202506041835

This commit is contained in:
张潘 2025-06-04 18:36:04 +08:00
parent cf60fc57a5
commit fb692a6936
8 changed files with 1237 additions and 123 deletions

View File

@ -1,8 +1,10 @@
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.controllerUtil.orderUtil; import com.ruoyi.system.controllerUtil.orderUtil;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
@ -35,8 +37,7 @@ import com.ruoyi.system.domain.ServiceGoods;
*/ */
@RestController @RestController
@RequestMapping("/system/Order") @RequestMapping("/system/Order")
public class OrderController extends BaseController public class OrderController extends BaseController {
{
@Autowired @Autowired
private IOrderService orderService; private IOrderService orderService;
@Autowired @Autowired
@ -58,13 +59,13 @@ public class OrderController extends BaseController
INotifyOrderService notifyOrderService; INotifyOrderService notifyOrderService;
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
/** /**
* 查询服务订单列表 * 查询服务订单列表
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:list')") @PreAuthorize("@ss.hasPermi('system:Order:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Order order) public TableDataInfo list(Order order) {
{
startPage(); startPage();
List<Order> list = orderService.selectOrderList(order); List<Order> list = orderService.selectOrderList(order);
for (Order orderdata : list) { for (Order orderdata : list) {
@ -93,8 +94,7 @@ public class OrderController extends BaseController
@PreAuthorize("@ss.hasPermi('system:Order:export')") @PreAuthorize("@ss.hasPermi('system:Order:export')")
@Log(title = "服务订单", businessType = BusinessType.EXPORT) @Log(title = "服务订单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Order order) public void export(HttpServletResponse response, Order order) {
{
List<Order> list = orderService.selectOrderList(order); List<Order> list = orderService.selectOrderList(order);
ExcelUtil<Order> util = new ExcelUtil<Order>(Order.class); ExcelUtil<Order> util = new ExcelUtil<Order>(Order.class);
util.exportExcel(response, list, "服务订单数据"); util.exportExcel(response, list, "服务订单数据");
@ -106,9 +106,14 @@ public class OrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id) {
{ Order order = orderService.selectOrderById(id);
return success(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')") @PreAuthorize("@ss.hasPermi('system:Order:add')")
@Log(title = "服务订单", businessType = BusinessType.INSERT) @Log(title = "服务订单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Order order) public AjaxResult add(@RequestBody Order order) {
{
orderUtil orderUtil = new orderUtil(); orderUtil orderUtil = new orderUtil();
//1,根据用户手机号判断用户不存在 //1,根据用户手机号和地址判断用户的数据数据和地址数据
int fig=orderUtil.isUser(order.getPhone()); //如果用户数据不存在则添加用户数据
if (fig==0){ //如果用户地址不存在则添加用户地址数据
System.out.println("用户XINZE"); 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')") @PreAuthorize("@ss.hasPermi('system:Order:edit')")
@Log(title = "服务订单", businessType = BusinessType.UPDATE) @Log(title = "服务订单", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Order order) public AjaxResult edit(@RequestBody Order order) {
{ //插入订单日志记录
return toAjax(orderService.updateOrder(order)); orderUtil orderUtil = new orderUtil();
orderUtil.SaveOrderLog(order);
return toAjax(orderService.updateOrder(order)
);
} }
/** /**
@ -146,20 +200,17 @@ public class OrderController extends BaseController
@PreAuthorize("@ss.hasPermi('system:Order:remove')") @PreAuthorize("@ss.hasPermi('system:Order:remove')")
@Log(title = "服务订单", businessType = BusinessType.DELETE) @Log(title = "服务订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids) {
{
return toAjax(orderService.deleteOrderByIds(ids)); return toAjax(orderService.deleteOrderByIds(ids));
} }
/** /**
* 获取订单接单记录 * 获取订单接单记录
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping("/receive-records/{orderId}") @GetMapping("/receive-records/{orderId}")
public AjaxResult getReceiveRecords(@PathVariable("orderId") String orderId) public AjaxResult getReceiveRecords(@PathVariable("orderId") String orderId) {
{
List<OrderLog> list = orderLogService.selectOrderLogByOrderId(orderId); List<OrderLog> list = orderLogService.selectOrderLogByOrderId(orderId);
for (OrderLog orderLogdata : list) { for (OrderLog orderLogdata : list) {
Users users = usersService.selectUsersById(orderLogdata.getWorkerId()); Users users = usersService.selectUsersById(orderLogdata.getWorkerId());
@ -175,9 +226,9 @@ public class OrderController extends BaseController
// */ // */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping("/call-records/{orderId}") @GetMapping("/call-records/{orderId}")
public AjaxResult getCallRecords(@PathVariable("orderId") String orderId) public AjaxResult getCallRecords(@PathVariable("orderId") String orderId) {
{ Order data = orderService.selectOrderByOrderId(orderId);
Order data=orderService.selectOrderByOrderId(orderId);; ;
if (data != null) { if (data != null) {
return success(orderCallService.selectOrderCallByOid(data.getId())); return success(orderCallService.selectOrderCallByOid(data.getId()));
} else { } else {
@ -191,9 +242,9 @@ public class OrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping("/audio-records/{orderId}") @GetMapping("/audio-records/{orderId}")
public AjaxResult getAudioRecords(@PathVariable("orderId") String orderId) public AjaxResult getAudioRecords(@PathVariable("orderId") String orderId) {
{ Order data = orderService.selectOrderByOrderId(orderId);
Order data=orderService.selectOrderByOrderId(orderId);; ;
if (data != null) { if (data != null) {
List<OrderSound> list = orderSoundService.selectOrderSoundByOid(data.getId()); List<OrderSound> list = orderSoundService.selectOrderSoundByOid(data.getId());
for (OrderSound orderSounddata : list) { for (OrderSound orderSounddata : list) {
@ -219,9 +270,9 @@ public class OrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping("/notify-records/{orderId}") @GetMapping("/notify-records/{orderId}")
public AjaxResult getNotifyRecords(@PathVariable("orderId") String orderId) public AjaxResult getNotifyRecords(@PathVariable("orderId") String orderId) {
{ Order data = orderService.selectOrderByOrderId(orderId);
Order data=orderService.selectOrderByOrderId(orderId);; ;
if (data != null) { if (data != null) {
return success(notifyOrderService.selectNotifyOrderByOid(data.getId())); return success(notifyOrderService.selectNotifyOrderByOid(data.getId()));
} else { } else {
@ -234,9 +285,9 @@ public class OrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:Order:query')") @PreAuthorize("@ss.hasPermi('system:Order:query')")
@GetMapping("/comment-records/{orderId}") @GetMapping("/comment-records/{orderId}")
public AjaxResult getCommentRecords(@PathVariable("orderId") String orderId) public AjaxResult getCommentRecords(@PathVariable("orderId") String orderId) {
{ Order data = orderService.selectOrderByOrderId(orderId);
Order data=orderService.selectOrderByOrderId(orderId);; ;
if (data != null) { if (data != null) {
List<OrderComment> list = orderCommentService.selectOrderCommentByOid(data.getId()); List<OrderComment> list = orderCommentService.selectOrderCommentByOid(data.getId());
for (OrderComment orderCommentdata : list) { for (OrderComment orderCommentdata : list) {

View File

@ -84,6 +84,21 @@ public class QuoteCraftController extends BaseController
return success(quoteType); return success(quoteType);
} }
/**
* 获取服务内容详细信息
* QuoteCraft quoteCraft
*/
@PreAuthorize("@ss.hasPermi('system:QuoteCraft:query')")
@GetMapping(value = "/selectQuoteCraftList")
public AjaxResult selectQuoteCraftList()
{
return success(quoteCraftService.selectQuoteCraftList(new QuoteCraft()));
}
// /** // /**
// * 获取工艺分类下拉list用来进行多选 // * 获取工艺分类下拉list用来进行多选
// */ // */

View File

@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.ruoyi.system.domain.QuoteCraft;
import com.ruoyi.system.domain.QuoteType; import com.ruoyi.system.domain.QuoteType;
import com.ruoyi.system.service.IQuoteMaterialTypeService; import com.ruoyi.system.service.IQuoteMaterialTypeService;
import com.ruoyi.system.service.IServiceGoodsService; import com.ruoyi.system.service.IServiceGoodsService;
@ -82,6 +83,21 @@ public class QuoteMaterialController extends BaseController
util.exportExcel(response, list, "项目报价--物料信息数据"); 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); String json = JSON.toJSONString(strList);
quoteMaterial.setGoodId(json.replaceAll("\",\"", "\", \"")); quoteMaterial.setGoodId(json.replaceAll("\",\"", "\", \""));
//String withSpace = compact.replaceAll("\",\"", "\", \""); //String withSpace = compact.replaceAll("\",\"", "\", \"");
System.out.println("#########################"+json.replaceAll("\",\"", "\", \""));
} }
return toAjax(quoteMaterialService.updateQuoteMaterial(quoteMaterial)); return toAjax(quoteMaterialService.updateQuoteMaterial(quoteMaterial));

View File

@ -1,40 +1,223 @@
package com.ruoyi.system.controllerUtil; package com.ruoyi.system.controllerUtil;
import com.ruoyi.common.core.domain.AjaxResult; import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.redis.RedisCache; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.AmapUtils;
import com.ruoyi.common.utils.spring.SpringUtils; 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.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.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 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工具类
*
*/ */
@Controller @Controller
public class orderUtil { 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如果不存在就要新增一个用户数据 //1,根据用户手机号判断用户不存在,4如果不存在就要新增一个用户数据
public int isUser(String phone) { 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) { if (SpringUtils.getBean(IUsersService.class).selectUsersByPhone(phone) == null) {
//1,用户不存在添加用户
Users users = new Users(); Users users = new Users();
users.setName("微信用户"); users.setName("微信用户");
users.setType("1"); users.setType("1");
users.setStatus(1); users.setStatus(1);
users.setPhone(phone); users.setPhone(phone);
SpringUtils.getBean(IUsersService.class).insertUsers(users); if (SpringUtils.getBean(IUsersService.class).insertUsers(users) > 0) {
return 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);
} }
} }

View File

@ -193,6 +193,9 @@ public class Order extends BaseEntity
private int fwpj; private int fwpj;
private OrderLog orderLog;
private BigDecimal totalPriceMin; private BigDecimal totalPriceMin;
private BigDecimal totalPriceMax; private BigDecimal totalPriceMax;
private BigDecimal payPriceMin; private BigDecimal payPriceMin;
@ -823,6 +826,15 @@ public class Order extends BaseEntity
this.paystartdate = paystartdate; this.paystartdate = paystartdate;
} }
public OrderLog getOrderLog() {
return orderLog;
}
public void setOrderLog(OrderLog orderLog) {
this.orderLog = orderLog;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -80,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(*) from order_log where order_id = #{orderId} select count(*) from order_log where order_id = #{orderId}
</select> </select>
<select id="selectOrderLogByOrderId" parameterType="String" resultMap="OrderLogResult"> <select id="selectOrderLogByOrderId" parameterType="String" resultMap="OrderLogResult">
select * from order_log where order_id = #{orderId} select * from order_log where order_id = #{orderId}
</select> </select>

View File

@ -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'
})
}
// 获取录音文件列表 // 获取录音文件列表

View File

@ -428,20 +428,380 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="订单状态" prop="status"> <el-form-item label="订单状态" prop="status">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status" @change="handleStatusChange">
<el-radio :label="1">支付</el-radio> <el-radio :label="1">接单</el-radio>
<el-radio :label="2">已支付</el-radio> <el-radio :label="2">待服务</el-radio>
<el-radio :label="3">待发货</el-radio> <el-radio :label="3">服务中</el-radio>
<el-radio :label="4">待收货</el-radio> <el-radio :label="4">已结束</el-radio>
<el-radio :label="5">完成</el-radio> <el-radio :label="5">取消</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </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-col :span="24">
<el-form-item label="备注" prop="mark"> <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-form-item>
</el-col> </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> </el-row>
<div class="dialog-footer" style="text-align:left;margin-top:20px;"> <div class="dialog-footer" style="text-align:left;margin-top:20px;">
<el-button @click="reset">重置</el-button> <el-button @click="reset">重置</el-button>
@ -499,7 +859,7 @@
<script> <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 { getuserAddressList } from "@/api/system/UserAddress"
import CallRecord from './components/CallRecord' import CallRecord from './components/CallRecord'
import AudioRecord from './components/AudioRecord' import AudioRecord from './components/AudioRecord'
@ -533,6 +893,12 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
//
quoteCraftList: [],
//
quoteMaterialList: [],
baseProjectList: [],
userDataList: [], userDataList: [],
@ -572,7 +938,51 @@ export default {
mark: null, 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: { rules: {
orderId: [ orderId: [
@ -611,6 +1021,15 @@ export default {
], ],
status: [ status: [
{ required: true, message: "请选择订单状态", trigger: "change" } { 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, // commentDialogVisible: false, //
@ -641,6 +1060,8 @@ export default {
this.getuserGongRenList() this.getuserGongRenList()
this.getGoodsDataListList(); this.getGoodsDataListList();
this.getAddressList(); this.getAddressList();
this.getQuoteCraftList()
this.getQuoteMaterialList()
}, },
methods: { methods: {
/** 查询服务订单列表 */ /** 查询服务订单列表 */
@ -688,7 +1109,24 @@ export default {
deduction: null, deduction: null,
payTime: null, payTime: null,
status: 1, // 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") this.resetForm("form")
}, },
@ -730,15 +1168,153 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() 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.open = true
this.title = "添加服务订单" 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
// basicDataJSON
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) { handleUpdate(row) {
this.reset() this.reset()
const id = row.id || this.ids const id = row.id || this.ids
this.getBaseProjectList(row.id)
getOrder(id).then(response => { getOrder(id).then(response => {
this.form = response.data 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.open = true
this.title = "修改服务订单" this.title = "修改服务订单"
}) })
@ -952,6 +1528,189 @@ export default {
this.queryParams.createdAt = value; this.queryParams.createdAt = value;
this.handleQuery(); 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
};
// JSONorderLog.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 => {
// 使responseurl
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> </script>
@ -1218,4 +1977,56 @@ export default {
padding: 10px 5px 0 5px; 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> </style>