Compare commits
2 Commits
4e9db1b5a9
...
2892ce9efc
| Author | SHA1 | Date |
|---|---|---|
|
|
2892ce9efc | |
|
|
50216a1806 |
|
|
@ -5342,69 +5342,48 @@ public class AppleOrderController extends BaseController {
|
|||
return AppletControllerUtil.appletWarning("订单状态不正确,无法接单");
|
||||
}
|
||||
|
||||
// // 获取当前登录用户(师傅)
|
||||
// String token = request.getHeader("token");
|
||||
// if (StringUtils.isEmpty(token)) {
|
||||
// return AppletControllerUtil.appletdengluWarning("用户未登录");
|
||||
// }
|
||||
//
|
||||
//// Users currentUser = AppletLoginUtil.getUserByToken(token);
|
||||
//// if (currentUser == null) {
|
||||
//// return AppletControllerUtil.appletdengluWarning("用户未登录或token无效");
|
||||
//// }
|
||||
// Users currentUser = (Users) userValidation.get("user");
|
||||
// if (currentUser == null) {
|
||||
// return AppletControllerUtil.appletdengluWarning("用户信息获取失败");
|
||||
// }
|
||||
|
||||
|
||||
// // 检查用户是否为师傅
|
||||
// if (!"2".equals(currentUser.getType()) || currentUser.getIsWork() != 1) {
|
||||
// return AppletControllerUtil.appletWarning("只有师傅才能接单");
|
||||
// }
|
||||
|
||||
// 检查订单是否已被其他师傅接单
|
||||
if (order.getWorkerId() != null && order.getWorkerId() > 0) {
|
||||
return AppletControllerUtil.appletWarning("该订单已被其他师傅接单");
|
||||
}
|
||||
|
||||
// 更新订单状态为2(待服务)并分配师傅
|
||||
order.setStatus(2L);
|
||||
order.setWorkerId(currentUser.getId());
|
||||
order.setReceiveTime(new Date());
|
||||
order.setReceiveType(1L); // 1:自由抢单
|
||||
order.setIsAccept(1); // 1:已经接单
|
||||
|
||||
// 如果是第一次接单,设置firstWorkerId
|
||||
if (order.getFirstWorkerId() == null) {
|
||||
order.setFirstWorkerId(currentUser.getId());
|
||||
}
|
||||
|
||||
// 更新订单
|
||||
int updateResult = orderService.updateOrder(order);
|
||||
if (updateResult <= 0) {
|
||||
return AppletControllerUtil.appletError("订单状态更新失败");
|
||||
}
|
||||
|
||||
// 添加订单日志
|
||||
OrderLog orderLog = new OrderLog();
|
||||
orderLog.setOid(orderId);
|
||||
orderLog.setOrderId(order.getOrderId());
|
||||
orderLog.setLogOrderId(order.getOrderId());
|
||||
orderLog.setTitle("师傅接单");
|
||||
orderLog.setType(new BigDecimal("2")); // 2:接单
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("name", "师傅" + currentUser.getName() + "接单成功");
|
||||
orderLog.setContent(content.toJSONString());
|
||||
orderLog.setWorkerId(currentUser.getId());
|
||||
orderLog.setWorkerName(currentUser.getName());
|
||||
orderLog.setFirstWorkerId(currentUser.getId());
|
||||
orderLog.setOrdertype(1L);
|
||||
|
||||
int logResult = orderLogService.insertOrderLog(orderLog);
|
||||
if (logResult <= 0) {
|
||||
logger.warn("订单日志添加失败,订单ID:{}", orderId);
|
||||
}
|
||||
DispatchUtil.creatWorkerForOrder(order, currentUser);
|
||||
// // 更新订单状态为2(待服务)并分配师傅
|
||||
// order.setStatus(2L);
|
||||
// order.setWorkerId(currentUser.getId());
|
||||
// order.setReceiveTime(new Date());
|
||||
// order.setReceiveType(1L); // 1:自由抢单
|
||||
// order.setIsAccept(1); // 1:已经接单
|
||||
//
|
||||
// // 如果是第一次接单,设置firstWorkerId
|
||||
// if (order.getFirstWorkerId() == null) {
|
||||
// order.setFirstWorkerId(currentUser.getId());
|
||||
// }
|
||||
//
|
||||
// // 更新订单
|
||||
// int updateResult = orderService.updateOrder(order);
|
||||
// if (updateResult <= 0) {
|
||||
// return AppletControllerUtil.appletError("订单状态更新失败");
|
||||
// }
|
||||
//
|
||||
// // 添加订单日志
|
||||
// OrderLog orderLog = new OrderLog();
|
||||
// orderLog.setOid(orderId);
|
||||
// orderLog.setOrderId(order.getOrderId());
|
||||
// orderLog.setLogOrderId(order.getOrderId());
|
||||
// orderLog.setTitle("师傅接单");
|
||||
// orderLog.setType(new BigDecimal("2")); // 2:接单
|
||||
// JSONObject content = new JSONObject();
|
||||
// content.put("name", "师傅" + currentUser.getName() + "接单成功");
|
||||
// orderLog.setContent(content.toJSONString());
|
||||
// orderLog.setWorkerId(currentUser.getId());
|
||||
// orderLog.setWorkerName(currentUser.getName());
|
||||
// orderLog.setFirstWorkerId(currentUser.getId());
|
||||
// orderLog.setOrdertype(1L);
|
||||
//
|
||||
// int logResult = orderLogService.insertOrderLog(orderLog);
|
||||
// if (logResult <= 0) {
|
||||
// logger.warn("订单日志添加失败,订单ID:{}", orderId);
|
||||
// }
|
||||
|
||||
return AppletControllerUtil.appletSuccess("接单成功");
|
||||
|
||||
|
|
|
|||
|
|
@ -2726,7 +2726,7 @@ public class AppletController extends BaseController {
|
|||
|
||||
// 10. 记录积分变动日志
|
||||
IntegralLog integralLog = AppletControllerUtil.buildIntegralLog(
|
||||
user, -totalIntegral, order.getOrderId(), product.getTitle());
|
||||
user, totalIntegral, order.getOrderId(), product.getTitle());
|
||||
integralLogService.insertIntegralLog(integralLog);
|
||||
|
||||
// 11. 更新商品库存(如果有库存管理)
|
||||
|
|
@ -7120,6 +7120,7 @@ public class AppletController extends BaseController {
|
|||
// 3. 查询状态为1(待接单)的订单
|
||||
Order orderQuery = new Order();
|
||||
orderQuery.setStatus(1L); // 待接单状态
|
||||
// orderQuery.setWorkerId(Long.parseLong(request.getHeader("userId")));
|
||||
orderQuery.setQiangdan("1");
|
||||
List<Order> orderList = orderService.selectOrderList(orderQuery);
|
||||
PageInfo<Order> pageInfo = new PageInfo<>(orderList);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import com.ruoyi.system.service.IDiyCityService;
|
|||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import java.util.Objects;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 自定义地区Controller
|
||||
|
|
@ -37,6 +39,8 @@ import java.util.Objects;
|
|||
@RequestMapping("/system/DiyCity")
|
||||
public class DiyCityController extends BaseController
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(DiyCityController.class);
|
||||
|
||||
@Autowired
|
||||
private IDiyCityService diyCityService;
|
||||
|
||||
|
|
@ -70,36 +74,61 @@ public class DiyCityController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:DiyCity:query')")
|
||||
@GetMapping("/getTreeData")
|
||||
public AjaxResult getTreeData() {
|
||||
try {
|
||||
List<DiyCity> list = diyCityService.selectDiyCityList(new DiyCity());
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 使用Map优化查找性能
|
||||
Map<Long, Map<String, Object>> nodeMap = new HashMap<>();
|
||||
List<Map<String, Object>> rootList = new ArrayList<>();
|
||||
|
||||
// 第一步:创建所有节点
|
||||
for (DiyCity city : list) {
|
||||
Map<String, Object> node = toMap(city);
|
||||
node.put("children", new ArrayList<>());
|
||||
nodeMap.put(city.getId().longValue(), node);
|
||||
}
|
||||
|
||||
// 第二步:构建树形结构
|
||||
for (DiyCity city : list) {
|
||||
Long parentId = city.getParentId();
|
||||
Long id = Long.valueOf(city.getId());
|
||||
// 一级节点
|
||||
Long id = city.getId().longValue();
|
||||
|
||||
if (parentId == null || parentId == 0L) {
|
||||
Map<String, Object> node = toMap(city);
|
||||
// 组装children
|
||||
List<Map<String, Object>> children = new ArrayList<>();
|
||||
for (DiyCity child : list) {
|
||||
Long childParentId = child.getParentId();
|
||||
if (id != null && Objects.equals(id, childParentId)) {
|
||||
children.add(toMap(child));
|
||||
// 根节点
|
||||
rootList.add(nodeMap.get(id));
|
||||
} else {
|
||||
// 子节点,添加到父节点的children中
|
||||
Map<String, Object> parentNode = nodeMap.get(parentId);
|
||||
if (parentNode != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) parentNode.get("children");
|
||||
children.add(nodeMap.get(id));
|
||||
}
|
||||
}
|
||||
node.put("children", children);
|
||||
rootList.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
return success(rootList);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取树形数据失败", e);
|
||||
return error("获取树形数据失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> toMap(DiyCity city) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", city.getId());
|
||||
map.put("label", city.getTitle());
|
||||
map.put("title", city.getTitle()); // 兼容前端
|
||||
map.put("parentId", city.getParentId());
|
||||
// 其他字段按需添加
|
||||
map.put("order", city.getOrder());
|
||||
map.put("lat", city.getLat());
|
||||
map.put("lng", city.getLng());
|
||||
map.put("createdAt", city.getCreatedAt());
|
||||
map.put("updatedAt", city.getUpdatedAt());
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
|
|
@ -122,7 +151,34 @@ public class DiyCityController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
||||
{
|
||||
return success(diyCityService.selectDiyCityById(id));
|
||||
try {
|
||||
DiyCity diyCity = diyCityService.selectDiyCityById(id);
|
||||
if (diyCity == null) {
|
||||
return error("地区不存在");
|
||||
}
|
||||
return success(diyCity);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取地区详情失败", e);
|
||||
return error("获取地区详情失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定地区的子地区列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:DiyCity:query')")
|
||||
@GetMapping("/children/{parentId}")
|
||||
public AjaxResult getChildren(@PathVariable("parentId") Long parentId)
|
||||
{
|
||||
try {
|
||||
DiyCity query = new DiyCity();
|
||||
query.setParentId(parentId);
|
||||
List<DiyCity> children = diyCityService.selectDiyCityList(query);
|
||||
return success(children);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取子地区列表失败", e);
|
||||
return error("获取子地区列表失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +189,26 @@ public class DiyCityController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DiyCity diyCity)
|
||||
{
|
||||
try {
|
||||
// 验证必填字段
|
||||
if (diyCity.getTitle() == null || diyCity.getTitle().trim().isEmpty()) {
|
||||
return error("地区名称不能为空");
|
||||
}
|
||||
|
||||
// 检查同级下是否有重名
|
||||
DiyCity query = new DiyCity();
|
||||
query.setParentId(diyCity.getParentId());
|
||||
query.setTitle(diyCity.getTitle());
|
||||
List<DiyCity> existing = diyCityService.selectDiyCityList(query);
|
||||
if (existing != null && !existing.isEmpty()) {
|
||||
return error("同级下已存在相同名称的地区");
|
||||
}
|
||||
|
||||
return toAjax(diyCityService.insertDiyCity(diyCity));
|
||||
} catch (Exception e) {
|
||||
logger.error("新增自定义地区失败", e);
|
||||
return error("新增失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +219,38 @@ public class DiyCityController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DiyCity diyCity)
|
||||
{
|
||||
try {
|
||||
// 验证必填字段
|
||||
if (diyCity.getId() == null) {
|
||||
return error("地区ID不能为空");
|
||||
}
|
||||
if (diyCity.getTitle() == null || diyCity.getTitle().trim().isEmpty()) {
|
||||
return error("地区名称不能为空");
|
||||
}
|
||||
|
||||
// 检查是否将父级设置为自己或自己的子级(防止循环引用)
|
||||
if (diyCity.getParentId() != null && diyCity.getParentId().equals(diyCity.getId().longValue())) {
|
||||
return error("不能将父级设置为自己");
|
||||
}
|
||||
|
||||
// 检查同级下是否有重名(排除自己)
|
||||
DiyCity query = new DiyCity();
|
||||
query.setParentId(diyCity.getParentId());
|
||||
query.setTitle(diyCity.getTitle());
|
||||
List<DiyCity> existing = diyCityService.selectDiyCityList(query);
|
||||
if (existing != null && !existing.isEmpty()) {
|
||||
for (DiyCity item : existing) {
|
||||
if (!item.getId().equals(diyCity.getId())) {
|
||||
return error("同级下已存在相同名称的地区");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return toAjax(diyCityService.updateDiyCity(diyCity));
|
||||
} catch (Exception e) {
|
||||
logger.error("修改自定义地区失败", e);
|
||||
return error("修改失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -155,7 +261,20 @@ public class DiyCityController extends BaseController
|
|||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Integer[] ids)
|
||||
{
|
||||
try {
|
||||
// 检查是否有子节点
|
||||
for (Integer id : ids) {
|
||||
List<DiyCity> children = diyCityService.selectDiyCityList(new DiyCity() {{ setParentId(id.longValue()); }});
|
||||
if (children != null && !children.isEmpty()) {
|
||||
return error("无法删除地区ID " + id + ",该地区下还有子地区,请先删除子地区");
|
||||
}
|
||||
}
|
||||
|
||||
return toAjax(diyCityService.deleteDiyCityByIds(ids));
|
||||
} catch (Exception e) {
|
||||
logger.error("删除自定义地区失败", e);
|
||||
return error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -113,6 +113,15 @@ public class GoodsOrderController extends BaseController {
|
|||
for (GoodsOrder order : orders) {
|
||||
if (order.getProductId() != null) {
|
||||
try {
|
||||
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(order.getMainOrderId());
|
||||
if (usersPayBefor != null) {
|
||||
order.setWxmoney(usersPayBefor.getWxmoney());
|
||||
order.setYemoney(usersPayBefor.getYemoney());
|
||||
order.setMembermoney(usersPayBefor.getMembermoney());
|
||||
order.setCouponmoney(usersPayBefor.getCouponmoney());
|
||||
order.setReturnmoney(usersPayBefor.getReturnmoney());
|
||||
}
|
||||
|
||||
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
||||
if (serviceGoods != null) {
|
||||
// 补充商品详细信息
|
||||
|
|
@ -227,7 +236,14 @@ public class GoodsOrderController extends BaseController {
|
|||
goodsOrderdata.setDeliveryName(siteDelivery.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(goodsOrderdata.getMainOrderId());
|
||||
if (usersPayBefor != null) {
|
||||
goodsOrderdata.setWxmoney(usersPayBefor.getWxmoney());
|
||||
goodsOrderdata.setYemoney(usersPayBefor.getYemoney());
|
||||
goodsOrderdata.setMembermoney(usersPayBefor.getMembermoney());
|
||||
goodsOrderdata.setCouponmoney(usersPayBefor.getCouponmoney());
|
||||
goodsOrderdata.setReturnmoney(usersPayBefor.getReturnmoney());
|
||||
}
|
||||
Users users = usersService.selectUsersById(goodsOrderdata.getUid());
|
||||
if (users != null) {
|
||||
goodsOrderdata.setUname(users.getName());
|
||||
|
|
|
|||
|
|
@ -409,7 +409,10 @@ public class OrderController extends BaseController {
|
|||
logJson.put("type",9);
|
||||
orderdata.setLogJson(logJson.toJSONString());
|
||||
orderdata.setJsonStatus(0);
|
||||
orderdata.setFileData(order.getFileData());
|
||||
if(StringUtils.isNotBlank(order.getFileData())){
|
||||
orderdata.setFileData(AppletControllerUtil.convertToJSONArray(order.getFileData()).toJSONString());
|
||||
}
|
||||
//orderdata.setFileData(order.getFileData());
|
||||
orderdata.setOdertype(0);
|
||||
orderdata.setReamk(order.getReamk());
|
||||
orderdata.setBigtype(1);
|
||||
|
|
|
|||
|
|
@ -313,10 +313,10 @@ public class UsersController extends BaseController
|
|||
|
||||
Users newUsers = usersService.selectUsersById(users.getId());
|
||||
System.out.println("###############"+newUsers.getType());
|
||||
if (newUsers.getType().equals("2")&&users.getStatus()==0){
|
||||
newUsers.setType("1");
|
||||
newUsers.setIsWork(0);
|
||||
}
|
||||
// if (newUsers!=null){
|
||||
// // newUsers.setType("1");
|
||||
// newUsers.setIsWork(0);
|
||||
// }
|
||||
newUsers.setStatus(users.getStatus());
|
||||
return toAjax(usersService.updateUsers(newUsers));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.ruoyi.system.controller;
|
|||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
|
@ -129,7 +129,7 @@ public class WorkerMoneyLogController extends BaseController
|
|||
|
||||
/**
|
||||
* 批量锁住收益
|
||||
* @param params {ids:[], lockType:'forever'|'timed', lockday:int}
|
||||
* @param params {ids:[], lockType:'forever'|'days', lockday:int, remark:string}
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:workerMoneyLog:lock')")
|
||||
|
|
@ -137,34 +137,48 @@ public class WorkerMoneyLogController extends BaseController
|
|||
public AjaxResult lockMoney(@RequestBody Map<String, Object> params) {
|
||||
Object idsObj = params.get("ids");
|
||||
if (idsObj == null) return AjaxResult.error("未选择数据");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Integer> ids = (List<Integer>) idsObj;
|
||||
String lockType = (String) params.get("lockType");
|
||||
Integer lockday = params.get("lockday") == null ? null : Integer.parseInt(params.get("lockday").toString());
|
||||
String remark = (String) params.get("remark");
|
||||
|
||||
Date now = new Date();
|
||||
Date end = null;
|
||||
if ("timed".equals(lockType) && lockday != null && lockday > 0) {
|
||||
|
||||
// 如果是按天锁住,计算结束时间
|
||||
if ("days".equals(lockType) && lockday != null && lockday > 0) {
|
||||
LocalDateTime ldt = LocalDateTime.now().plusDays(lockday);
|
||||
end = Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
// 如果是永久锁住,结束时间设置为null
|
||||
|
||||
for (Integer id : ids) {
|
||||
WorkerMoneyLog log = workerMoneyLogService.selectWorkerMoneyLogById(id);
|
||||
if (log == null) continue;
|
||||
|
||||
// 检查是否已经锁定
|
||||
if (log.getStatus() != null && log.getStatus() == 1) {
|
||||
continue; // 跳过已锁定的数据
|
||||
}
|
||||
|
||||
log.setStatus(1); // 锁定
|
||||
log.setStatusType(1); // 后台锁定
|
||||
log.setBeginlook(now);
|
||||
if ("timed".equals(lockType) && end != null) {
|
||||
log.setLookMoney(log.getPrice());
|
||||
log.setAdminUpReamk(remark); // 设置锁住原因
|
||||
|
||||
if ("days".equals(lockType) && end != null) {
|
||||
// 按天锁住:设置结束时间和锁住天数
|
||||
log.setEndlook(end);
|
||||
log.setLookday(lockday);
|
||||
} else if ("forever".equals(lockType)) {
|
||||
// 永久锁住:结束时间设置为null,锁住天数设置为null
|
||||
log.setEndlook(null);
|
||||
log.setLookday(null);
|
||||
}
|
||||
// else {
|
||||
// // 永久锁住
|
||||
//
|
||||
// }
|
||||
log.setLookMoney(log.getPrice());
|
||||
|
||||
workerMoneyLogService.updateWorkerMoneyLog(log);
|
||||
if ("forever".equals(lockType)){
|
||||
workerMoneyLogService.updateWorkerMoneyLogforever(log);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("锁住收益成功");
|
||||
}
|
||||
|
|
@ -179,6 +193,7 @@ public class WorkerMoneyLogController extends BaseController
|
|||
public AjaxResult unlockMoney(@RequestBody Map<String, Object> params) {
|
||||
Object idsObj = params.get("ids");
|
||||
if (idsObj == null) return AjaxResult.error("未选择数据");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Integer> ids = (List<Integer>) idsObj;
|
||||
for (Integer id : ids) {
|
||||
WorkerMoneyLog log = workerMoneyLogService.selectWorkerMoneyLogById(id);
|
||||
|
|
@ -193,7 +208,7 @@ public class WorkerMoneyLogController extends BaseController
|
|||
|
||||
/**
|
||||
* 调整收益(奖励/扣除)
|
||||
* @param params {id, amount, remark}
|
||||
* @param params {id, type:'reward'|'deduct', amount, remark}
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:workerMoneyLog:adjust')")
|
||||
|
|
@ -203,10 +218,36 @@ public class WorkerMoneyLogController extends BaseController
|
|||
WorkerMoneyLog log = workerMoneyLogService.selectWorkerMoneyLogById(id);
|
||||
if (log == null) return AjaxResult.error("数据不存在");
|
||||
if (log.getStatus() == null || log.getStatus() != 1) return AjaxResult.error("只能调整锁定状态的数据");
|
||||
|
||||
String type = (String) params.get("type");
|
||||
BigDecimal amount = new BigDecimal(params.get("amount").toString());
|
||||
String remark = (String) params.get("remark");
|
||||
log.setAdminUpPrice(amount);
|
||||
|
||||
// 获取当前金额
|
||||
BigDecimal currentPrice = log.getPrice() != null ? log.getPrice() : BigDecimal.ZERO;
|
||||
BigDecimal newPrice;
|
||||
|
||||
if ("reward".equals(type)) {
|
||||
// 奖励:增加金额
|
||||
newPrice = currentPrice.add(amount);
|
||||
log.setAdminUpPrice(amount); // 记录调整金额(正数)
|
||||
} else if ("deduct".equals(type)) {
|
||||
// 扣除:减少金额
|
||||
newPrice = currentPrice.subtract(amount);
|
||||
// 确保金额不为负数
|
||||
if (newPrice.compareTo(BigDecimal.ZERO) < 0) {
|
||||
return AjaxResult.error("扣除金额不能超过当前金额");
|
||||
}
|
||||
log.setAdminUpPrice(amount.negate()); // 记录调整金额(负数)
|
||||
} else {
|
||||
return AjaxResult.error("调整类型参数错误");
|
||||
}
|
||||
|
||||
// 更新价格和备注
|
||||
log.setPrice(newPrice);
|
||||
log.setLookMoney(newPrice); // 同时更新锁单金额
|
||||
log.setAdminUpReamk(remark);
|
||||
|
||||
workerMoneyLogService.updateWorkerMoneyLog(log);
|
||||
return AjaxResult.success("调整收益成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2577,7 +2577,7 @@ public class AppletControllerUtil {
|
|||
log.setTitle("积分商品兑换");
|
||||
log.setMark("兑换商品:" + productTitle + ",订单号:" + orderId); // 使用mark字段
|
||||
log.setType(2L); // 类型:2-减少
|
||||
|
||||
log.setOrderId(orderId);
|
||||
Date now = new Date();
|
||||
log.setCreatedAt(now);
|
||||
log.setUpdatedAt(now);
|
||||
|
|
|
|||
|
|
@ -2975,4 +2975,55 @@ public class DispatchUtil {
|
|||
return worker;
|
||||
}
|
||||
|
||||
|
||||
//抢单的时候处理有不同的处理逻辑
|
||||
public static Users creatWorkerForOrderQiangDan(Order order,Users worker) throws Exception {
|
||||
|
||||
order.setWorkerId(worker.getId());
|
||||
order.setStatus(1L);
|
||||
order.setIsPause(1);
|
||||
order.setReceiveTime(new Date());
|
||||
order.setWorkerPhone(worker.getPhone());
|
||||
UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId());
|
||||
if (userAddress != null){
|
||||
order.setUserPhone(userAddress.getPhone());
|
||||
}
|
||||
// order.setMiddlePhone("18339212639");
|
||||
order.setReceiveType(3l);
|
||||
order.setLogStatus(9);
|
||||
com.alibaba.fastjson2.JSONObject jSONObject = new com.alibaba.fastjson2.JSONObject();
|
||||
jSONObject.put("type", 9);
|
||||
order.setLogJson(jSONObject.toJSONString());
|
||||
orderService.updateOrder(order);
|
||||
|
||||
|
||||
OrderLog orderLognew = new OrderLog();
|
||||
orderLognew.setOid(order.getId());
|
||||
orderLognew.setOrderId(order.getOrderId());
|
||||
orderLognew.setTitle("系统派单");
|
||||
orderLognew.setType(new BigDecimal(1.1));
|
||||
com.alibaba.fastjson2.JSONObject jSONObject1 = new com.alibaba.fastjson2.JSONObject();
|
||||
jSONObject1.put("name", "师傅收到派单信息");
|
||||
orderLognew.setContent(jSONObject1.toJSONString());
|
||||
orderLognew.setWorkerId(worker.getId());
|
||||
orderLognew.setWorkerLogId(worker.getId());
|
||||
orderLogService.insertOrderLog(orderLognew);
|
||||
//绑定虚拟号码
|
||||
//微信推送
|
||||
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
||||
//给师傅派单的时候的推送
|
||||
WXsendMsgUtil.sendMsgForWorkerInfo(worker.getOpenid(), order, serviceGoods);
|
||||
//派单的时候需要绑定虚拟号码
|
||||
Map<String, Object> map= OrderBindWorkerUtil.getOrderBindWorkerQiangDan(order.getId());
|
||||
//电话通知师傅接单
|
||||
YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone(), order.getId());
|
||||
// if (map.get("code").equals("200")) {
|
||||
// //电话通知
|
||||
// YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone());
|
||||
// }
|
||||
|
||||
|
||||
return worker;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,100 @@ public class OrderBindWorkerUtil {
|
|||
private static final IAreaService areaService= SpringUtils.getBean(IAreaService.class);
|
||||
|
||||
|
||||
/**
|
||||
* 订单绑定师傅电话号码操作
|
||||
* @param orderId 订单ID
|
||||
* @return 绑定结果Map,包含code和msg
|
||||
*/
|
||||
public static Map<String, Object> getOrderBindWorkerQiangDan(long orderId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 查询订单
|
||||
Order order = orderService.selectOrderById(orderId);
|
||||
if (order == null) {
|
||||
result.put("code", 404);
|
||||
result.put("msg", "订单不存在");
|
||||
return result;
|
||||
}
|
||||
// 2. 查询师傅信息
|
||||
Users workerUser = usersService.selectUsersById(order.getWorkerId());
|
||||
if (workerUser == null) {
|
||||
result.put("code", 404);
|
||||
result.put("msg", "师傅信息不存在");
|
||||
return result;
|
||||
}
|
||||
// 3. 查询订单地址
|
||||
UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId());
|
||||
if (userAddress == null) {
|
||||
result.put("code", 404);
|
||||
result.put("msg", "订单地址不存在");
|
||||
return result;
|
||||
}
|
||||
// 4. 经纬度转城市
|
||||
double lng = Double.parseDouble(userAddress.getLongitude());
|
||||
double lat = Double.parseDouble(userAddress.getLatitude());
|
||||
String city = GaoDeMapUtil.getCityByLocation(lng, lat);
|
||||
if (city == null || city.isEmpty()) {
|
||||
result.put("code", 500);
|
||||
result.put("msg", "无法根据经纬度获取城市信息");
|
||||
return result;
|
||||
}
|
||||
// 5. 查询城市编码
|
||||
Area area = new Area();
|
||||
area.setTitle(city);
|
||||
List<Area> areaList = areaService.selectAreaList(area);
|
||||
if (areaList == null || areaList.isEmpty()) {
|
||||
areaList=areaService.selectAreaList(new Area());
|
||||
// result.put("code", 404);
|
||||
// result.put("msg", "未找到城市编码");
|
||||
// return result;
|
||||
}
|
||||
Long cityCode = areaList.get(0).getId();
|
||||
// 6. 查询可用中间号
|
||||
MobileMiddle mobileMiddleQuery = new MobileMiddle();
|
||||
mobileMiddleQuery.setCityId(cityCode);
|
||||
List<MobileMiddle> mobileMiddleList = mobileMiddleService.selectMobileMiddleList(mobileMiddleQuery);
|
||||
if (mobileMiddleList == null || mobileMiddleList.isEmpty()) {
|
||||
mobileMiddleList=mobileMiddleService.selectMobileMiddleList(new MobileMiddle());
|
||||
// result.put("code", 404);
|
||||
// result.put("msg", "该城市暂无可用中间号");
|
||||
// return result;
|
||||
}
|
||||
// 7. 获取用户和师傅手机号
|
||||
String userPhone = userAddress.getPhone();
|
||||
String workerPhone = workerUser.getPhone();
|
||||
if (userPhone == null || workerPhone == null) {
|
||||
result.put("code", 400);
|
||||
result.put("msg", "用户或师傅手机号为空");
|
||||
return result;
|
||||
}
|
||||
// 8. 绑定中间号,直到成功
|
||||
for (MobileMiddle middle : mobileMiddleList) {
|
||||
VoiceResponseResult bindResult = YunXinPhoneUtilAPI.httpsPrivacyBindAxb(middle.getPhone(), userPhone, workerPhone);
|
||||
System.out.println(middle.getPhone()+"__________"+userPhone+"__________"+workerPhone);
|
||||
if ("000000".equals(bindResult.getResult())) {
|
||||
// 绑定成功,更新订单
|
||||
order.setMiddlePhone(middle.getPhone());
|
||||
order.setUserPhone(userPhone);
|
||||
order.setWorkerPhone(workerPhone);
|
||||
orderService.updateOrder(order);
|
||||
result.put("code", 200);
|
||||
result.put("msg", "绑定成功");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// 9. 所有中间号都绑定失败
|
||||
result.put("code", 500);
|
||||
result.put("msg", "所有中间号均绑定失败");
|
||||
} catch (Exception e) {
|
||||
result.put("code", 500);
|
||||
result.put("msg", "绑定异常: " + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单绑定师傅电话号码操作
|
||||
* @param orderId 订单ID
|
||||
|
|
@ -123,4 +217,5 @@ public class OrderBindWorkerUtil {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
|||
cleanupSystemData();
|
||||
healthCheck();
|
||||
updateWorkerMoneyLook();
|
||||
DispatchWorkerForOrder();
|
||||
autoResumeWorkerOrderStatus(); // 添加师傅暂停状态自动恢复任务
|
||||
log.info("定时任务自动执行完成");
|
||||
}
|
||||
|
|
@ -139,7 +140,7 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
|||
* 师傅收益7天定时冻结的解冻
|
||||
* 每10分钟执行一次
|
||||
*/
|
||||
@Scheduled(fixedRate = 10 * 60 * 1000) // 每10分钟执行一次
|
||||
@Scheduled(fixedRate = 20 * 60 * 1000) // 每10分钟执行一次
|
||||
public void updateWorkerMoneyLook() {
|
||||
String taskName = "订单状态超时检查";
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
|
@ -156,6 +157,32 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 派单10分钟一次对没有派单的进行派单
|
||||
* 每10分钟执行一次
|
||||
*/
|
||||
@Scheduled(fixedRate = 10 * 60 * 1000) // 每10分钟执行一次
|
||||
public void DispatchWorkerForOrder() {
|
||||
String taskName = "订单派单检查并重新派单";
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
Order order = new Order();
|
||||
order.setStatus(1L);
|
||||
order.setIsAccept(0);
|
||||
order.setQiangdan("1");
|
||||
List<Order> orders = orderService.selectOrderList(order);
|
||||
for (Order orderdata : orders) {
|
||||
DispatchUtil.dispatchOrder(orderdata.getId());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("{}任务执行失败", taskName, e);
|
||||
updateTaskStatistics(taskName, false, System.currentTimeMillis() - startTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单派单超时处理任务
|
||||
* 每5分钟执行一次,检查派单超过20分钟的订单
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ public class WorkerCommissionUtil {
|
|||
BigDecimal newCommission = currentCommission.add(finalCommissionWithDoorFee);
|
||||
worker.setCommission(newCommission);
|
||||
//累计分佣
|
||||
worker.setTotalComm(worker.getTotalComm().add(newCommission));
|
||||
worker.setTotalComm(worker.getTotalComm().add(finalCommissionWithDoorFee));
|
||||
|
||||
// 5. 更新师傅信息
|
||||
int updateResult = usersService.updateUsers(worker);
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ public class GoodsOrder extends BaseEntity
|
|||
/** 排序 */
|
||||
private Integer forserviceid;
|
||||
|
||||
private BigDecimal wxmoney;
|
||||
private BigDecimal yemoney;
|
||||
private BigDecimal membermoney;
|
||||
private BigDecimal couponmoney;
|
||||
|
||||
/** 支付时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
|
@ -753,6 +757,38 @@ public class GoodsOrder extends BaseEntity
|
|||
this.deliveryName = deliveryName;
|
||||
}
|
||||
|
||||
public BigDecimal getCouponmoney() {
|
||||
return couponmoney;
|
||||
}
|
||||
|
||||
public void setCouponmoney(BigDecimal couponmoney) {
|
||||
this.couponmoney = couponmoney;
|
||||
}
|
||||
|
||||
public BigDecimal getMembermoney() {
|
||||
return membermoney;
|
||||
}
|
||||
|
||||
public void setMembermoney(BigDecimal membermoney) {
|
||||
this.membermoney = membermoney;
|
||||
}
|
||||
|
||||
public BigDecimal getYemoney() {
|
||||
return yemoney;
|
||||
}
|
||||
|
||||
public void setYemoney(BigDecimal yemoney) {
|
||||
this.yemoney = yemoney;
|
||||
}
|
||||
|
||||
public BigDecimal getWxmoney() {
|
||||
return wxmoney;
|
||||
}
|
||||
|
||||
public void setWxmoney(BigDecimal wxmoney) {
|
||||
this.wxmoney = wxmoney;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -209,6 +209,9 @@
|
|||
<if test="dayDate != null and dayDate != ''">
|
||||
AND FROM_UNIXTIME(make_time, '%Y-%m-%d') = #{dayDate}
|
||||
</if>
|
||||
<if test="qiangdan != null and qiangdan != ''">
|
||||
AND worker_id is null
|
||||
</if>
|
||||
|
||||
<if test="baojiasf != null and baojiasf != null">
|
||||
and id in (select oid from user_demand_quotation b where b.workerid=#{baojiasf} and b.status=1)
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="parentId != null"> and parent_id=#{parentId}</if>
|
||||
<if test="city != null and city != ''"> and JSON_CONTAINS(city, #{city})</if>
|
||||
</where>
|
||||
order by parent_id ASC, sort ASC
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
<select id="selectServiceCateCiKaList" resultMap="ServiceCateResult">
|
||||
<include refid="selectServiceCateVo"/>
|
||||
where id in (select card.type from user_secondary_card card where card.status='1' )
|
||||
order by parent_id ASC, sort ASC
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -46,21 +46,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectServiceCatepintuanList" resultMap="ServiceCateResult">
|
||||
<include refid="selectServiceCateVo"/>
|
||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isgroup='1' )
|
||||
order by parent_id ASC, sort ASC
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectServiceCateMiaoshaList" resultMap="ServiceCateResult">
|
||||
<include refid="selectServiceCateVo"/>
|
||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isfixed='1' )
|
||||
order by parent_id ASC, sort ASC
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectServiceCateBaojiaList" resultMap="ServiceCateResult">
|
||||
<include refid="selectServiceCateVo"/>
|
||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.servicetype='2' )
|
||||
order by parent_id ASC, sort ASC
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="isgroup != null "> and isgroup = #{isgroup}</if>
|
||||
|
||||
</where>
|
||||
order by id desc
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by created_at desc
|
||||
order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export function delDiyCity(id) {
|
|||
// 查询城市树结构
|
||||
export function getDiyCityTree() {
|
||||
return request({
|
||||
url: '/system/DiyCity/tree',
|
||||
url: '/system/DiyCity/getTreeData',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ export default {
|
|||
},
|
||||
handlefenleiStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changefenleiStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -829,7 +829,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changetypeStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listDiyCity, getDiyCity, delDiyCity, addDiyCity, updateDiyCity,getTreeDataList } from "@/api/system/DiyCity"
|
||||
import { listDiyCity, getDiyCity, delDiyCity, addDiyCity, updateDiyCity, getDiyCityTree } from "@/api/system/DiyCity"
|
||||
|
||||
export default {
|
||||
name: "DiyCity",
|
||||
|
|
@ -152,6 +152,7 @@ export default {
|
|||
amap: null,
|
||||
marker: null,
|
||||
geocoder: null,
|
||||
mapInited: false,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
|
|
@ -207,10 +208,19 @@ export default {
|
|||
},
|
||||
|
||||
gettreeDataList(){
|
||||
getTreeDataList().then(response => {
|
||||
// 使用后端的树形数据接口
|
||||
getDiyCityTree().then(response => {
|
||||
if (response.data && response.data.length > 0) {
|
||||
this.treeDataList = response.data
|
||||
} else {
|
||||
this.treeDataList = []
|
||||
}
|
||||
// 初始化时不展开任何节点
|
||||
this.expandedKeys = []
|
||||
}).catch(error => {
|
||||
console.error('获取树数据失败:', error)
|
||||
// 如果树形接口失败,回退到列表接口构建树形结构
|
||||
this.fallbackToBuildTree()
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -255,12 +265,16 @@ export default {
|
|||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
this.gettreeDataList() // 刷新树结构
|
||||
this.loadParentOptions() // 刷新父级选项
|
||||
})
|
||||
} else {
|
||||
addDiyCity(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
this.gettreeDataList() // 刷新树结构
|
||||
this.loadParentOptions() // 刷新父级选项
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -269,10 +283,12 @@ export default {
|
|||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除自定义地区编号为"' + ids + '"的数据项?').then(function() {
|
||||
this.$modal.confirm('是否确认删除自定义地区编号为"' + ids + '"的数据项?').then(() => {
|
||||
return delDiyCity(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.gettreeDataList() // 刷新树结构
|
||||
this.loadParentOptions() // 刷新父级选项
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
|
@ -378,6 +394,61 @@ export default {
|
|||
this.gettreeDataList(); // 重新获取数据
|
||||
},
|
||||
|
||||
/** 处理节点点击事件 */
|
||||
handleNodeClick(data, node) {
|
||||
// 可以在这里添加节点点击的逻辑
|
||||
console.log('点击节点:', data, node);
|
||||
},
|
||||
|
||||
/** 回退到构建树形结构的方法 */
|
||||
fallbackToBuildTree() {
|
||||
listDiyCity({pageSize: 1000}).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
this.treeDataList = this.buildTreeData(response.rows)
|
||||
} else {
|
||||
this.treeDataList = []
|
||||
}
|
||||
this.expandedKeys = []
|
||||
}).catch(error => {
|
||||
console.error('回退构建树形结构也失败:', error)
|
||||
this.treeDataList = []
|
||||
this.expandedKeys = []
|
||||
})
|
||||
},
|
||||
|
||||
/** 构建树形结构数据 */
|
||||
buildTreeData(dataList) {
|
||||
const treeData = []
|
||||
const dataMap = new Map()
|
||||
|
||||
// 先建立ID映射
|
||||
dataList.forEach(item => {
|
||||
dataMap.set(item.id, {
|
||||
id: item.id,
|
||||
label: item.title,
|
||||
parentId: item.parentId,
|
||||
children: []
|
||||
})
|
||||
})
|
||||
|
||||
// 构建树形结构
|
||||
dataList.forEach(item => {
|
||||
const node = dataMap.get(item.id)
|
||||
if (item.parentId === null || item.parentId === 0) {
|
||||
// 根节点
|
||||
treeData.push(node)
|
||||
} else {
|
||||
// 子节点
|
||||
const parent = dataMap.get(item.parentId)
|
||||
if (parent) {
|
||||
parent.children.push(node)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return treeData
|
||||
},
|
||||
|
||||
decreaseOrder() {
|
||||
if (this.form.order > 0) {
|
||||
this.form.order--
|
||||
|
|
@ -393,23 +464,23 @@ export default {
|
|||
},
|
||||
initMap() {
|
||||
// 销毁旧地图和事件,防止重复绑定
|
||||
if (this.map) {
|
||||
this.map.destroy()
|
||||
this.map = null
|
||||
if (this.amap) {
|
||||
this.amap.destroy()
|
||||
this.amap = null
|
||||
this.marker = null
|
||||
this.geocoder = null
|
||||
this.mapInited = false
|
||||
}
|
||||
this.map = new AMap.Map('map', {
|
||||
this.amap = new AMap.Map('map', {
|
||||
zoom: 16,
|
||||
center: [this.form.longitude || 108.94141, this.form.latitude || 34.209883],
|
||||
})
|
||||
this.geocoder = new AMap.Geocoder()
|
||||
// if (this.form.longitude && this.form.latitude) {
|
||||
// this.setMapMarker([this.form.longitude, this.form.latitude]);
|
||||
// this.map.setCenter([this.form.longitude, this.form.latitude]);
|
||||
// this.amap.setCenter([this.form.longitude, this.form.latitude]);
|
||||
// }
|
||||
this.map.on('click', (e) => {
|
||||
this.amap.on('click', (e) => {
|
||||
const lnglat = [e.lnglat.lng, e.lnglat.lat]
|
||||
this.setMapMarker(lnglat)
|
||||
this.form.longitude = e.lnglat.lng
|
||||
|
|
@ -429,7 +500,7 @@ export default {
|
|||
}
|
||||
this.marker = new AMap.Marker({
|
||||
position: lnglat,
|
||||
map: this.map,
|
||||
map: this.amap,
|
||||
})
|
||||
},
|
||||
searchMapAddress() {
|
||||
|
|
@ -445,7 +516,7 @@ export default {
|
|||
if (status === 'complete' && result.geocodes.length) {
|
||||
const lnglat = result.geocodes[0].location
|
||||
this.setMapMarker([lnglat.lng, lnglat.lat])
|
||||
this.map.setCenter([lnglat.lng, lnglat.lat])
|
||||
this.amap.setCenter([lnglat.lng, lnglat.lat])
|
||||
this.form.longitude = lnglat.lng
|
||||
this.form.latitude = lnglat.lat
|
||||
this.latlng = `${lnglat.lng},${lnglat.lat}`
|
||||
|
|
@ -462,9 +533,12 @@ export default {
|
|||
})
|
||||
},
|
||||
loadParentOptions() {
|
||||
// 这里假设用listDiyCity获取所有可选父级
|
||||
listDiyCity({parentId:0}).then(res => {
|
||||
// 获取所有可选父级
|
||||
listDiyCity({parentId: 0, pageSize: 1000}).then(res => {
|
||||
this.parentOptions = res.rows || []
|
||||
}).catch(error => {
|
||||
console.error('加载父级选项失败:', error)
|
||||
this.parentOptions = []
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,18 @@
|
|||
<label>用户电话:</label>
|
||||
<span class="value">{{ orderData.uphone || "未知" }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>订单单号:</label>
|
||||
<span class="value">{{ orderData.mainOrderId || "未知" }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>下单时间:</label>
|
||||
<span class="value">{{ orderData.createdAt || "未知" }}</span>
|
||||
</div>
|
||||
<!-- <div class="info-item">-->
|
||||
<!-- <label>下单商品:</label>-->
|
||||
<!-- <span class="value">{{ orderData.productName || "未知" }}</span>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- 基础金额信息 -->
|
||||
|
|
@ -91,6 +103,16 @@
|
|||
}}</span
|
||||
>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>商品数量:</label>
|
||||
<span class="value amount-good"
|
||||
>¥{{
|
||||
orderData.num
|
||||
? orderData.num.toFixed(2)
|
||||
: "0.00"
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
|
|
@ -138,7 +160,16 @@
|
|||
}}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="info-item">
|
||||
<label>退款金额:</label>
|
||||
<span class="value amount-coupon"
|
||||
>¥{{
|
||||
orderData.returnmoney
|
||||
? orderData.returnmoney.toFixed(2)
|
||||
: "0.00"
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changetypeStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -661,7 +661,7 @@ export default {
|
|||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$modal
|
||||
.confirm('确认要"' + text + '""' + row.title + '"状态吗?')
|
||||
.confirm('确认要操作' + row.title + '状态吗?')
|
||||
.then(function () {
|
||||
return changetypeStatus(row.id, row.status);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12,6 +12,27 @@
|
|||
@close="handleClose"
|
||||
>
|
||||
<div class="order-detail-container">
|
||||
<!-- 顶部操作栏 -->
|
||||
<!-- <div class="top-actions">-->
|
||||
<!-- <div class="left-section">-->
|
||||
<!-- <el-button -->
|
||||
<!-- type="primary" -->
|
||||
<!-- size="small" -->
|
||||
<!-- icon="el-icon-refresh"-->
|
||||
<!-- @click="refreshOrderData"-->
|
||||
<!-- :loading="refreshing"-->
|
||||
<!-- >-->
|
||||
<!-- 刷新数据-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <span class="refresh-tip">-->
|
||||
<!-- 💡 操作完成后数据会自动刷新,页面不会关闭-->
|
||||
<!-- </span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <span class="last-refresh-time" v-if="lastRefreshTime">-->
|
||||
<!-- 最后刷新: {{ lastRefreshTime }}-->
|
||||
<!-- </span>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane
|
||||
label="基本信息"
|
||||
|
|
@ -283,6 +304,24 @@
|
|||
</el-row>
|
||||
</div>
|
||||
<div class="detailright" v-if="activeName == 'third'">
|
||||
<!-- 当前订单状态提示 -->
|
||||
<!-- <div class="order-status-banner">-->
|
||||
<!-- <el-alert-->
|
||||
<!-- :title="`当前订单状态: ${getStatusLabel(info.status)}`"-->
|
||||
<!-- :type="getStatusTagType(info.status)"-->
|
||||
<!-- :closable="false"-->
|
||||
<!-- show-icon-->
|
||||
<!-- >-->
|
||||
<!-- <template slot="default">-->
|
||||
<!-- <div class="status-details">-->
|
||||
<!-- <span>订单号: {{ info.orderId }}</span>-->
|
||||
<!-- <span v-if="orderInfo.workerName">| 师傅: {{ orderInfo.workerName }}</span>-->
|
||||
<!-- <span v-if="orderInfo.receiveTime">| 接单时间: {{ orderInfo.receiveTime }}</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-alert>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<el-row :gutter="20" class="boxcontent">
|
||||
<el-col :span="24">
|
||||
<el-card class="box-card" shadow="hover">
|
||||
|
|
@ -319,9 +358,9 @@
|
|||
}}</span>
|
||||
</div>
|
||||
<div class="timeline-body">
|
||||
<!-- <div class="timeline-description">-->
|
||||
<!-- {{ getContentDescription(record.content) }}-->
|
||||
<!-- </div>-->
|
||||
<div class="timeline-description">
|
||||
{{ getTimelineDescription(record) }}
|
||||
</div>
|
||||
|
||||
<!-- 显示报价数据 -->
|
||||
<div
|
||||
|
|
@ -1064,6 +1103,10 @@ export default {
|
|||
startServiceImages: [],
|
||||
startServiceSubmitting: false,
|
||||
info: {}, //订单详情
|
||||
|
||||
// 刷新相关状态
|
||||
refreshing: false,
|
||||
lastRefreshTime: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -1091,17 +1134,25 @@ export default {
|
|||
},
|
||||
},
|
||||
},
|
||||
method() {},
|
||||
mounted() {
|
||||
// 页面挂载后自动刷新一次数据
|
||||
this.$nextTick(() => {
|
||||
if (this.orderInfo.id) {
|
||||
this.refreshOrderData();
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 获取订单详情
|
||||
getinfo() {
|
||||
if (this.orderInfo.id) {
|
||||
getOrder(this.orderInfo.id).then((r) => {
|
||||
return getOrder(this.orderInfo.id).then((r) => {
|
||||
r.data.adressjson = JSON.parse(r.data.adressjson);
|
||||
this.info = r.data;
|
||||
this.getOrderlogDataFrist()
|
||||
return this.getOrderlogDataFrist();
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
/** 关闭对话框 */
|
||||
|
|
@ -1232,22 +1283,159 @@ export default {
|
|||
return date.toLocaleString();
|
||||
},
|
||||
|
||||
/** 获取时间线描述(智能处理不同类型记录) */
|
||||
getTimelineDescription(record) {
|
||||
if (!record) return "无记录信息";
|
||||
|
||||
const title = record.title || "";
|
||||
const content = record.content;
|
||||
|
||||
// 根据标题类型智能生成描述
|
||||
if (title.includes("订单生成") || title.includes("创建")) {
|
||||
return content ? `订单已创建,${this.getContentDescription(content)}` : "订单已创建,等待用户支付";
|
||||
}
|
||||
|
||||
if (title.includes("支付成功")) {
|
||||
return content ? `支付完成,${this.getContentDescription(content)}` : "订单支付成功,等待派单";
|
||||
}
|
||||
|
||||
if (title.includes("派单")) {
|
||||
return content ? `订单已派发给师傅,${this.getContentDescription(content)}` : "订单已派发给师傅";
|
||||
}
|
||||
|
||||
if (title.includes("接单")) {
|
||||
return content ? `师傅已接单,${this.getContentDescription(content)}` : "师傅已接单,准备服务";
|
||||
}
|
||||
|
||||
if (title.includes("出发")) {
|
||||
return content ? `师傅已出发,${this.getContentDescription(content)}` : "师傅已出发前往服务地点";
|
||||
}
|
||||
|
||||
if (title.includes("到达")) {
|
||||
return content ? `师傅已到达,${this.getContentDescription(content)}` : "师傅已到达服务地点";
|
||||
}
|
||||
|
||||
if (title.includes("开始服务")) {
|
||||
return content ? `服务已开始,${this.getContentDescription(content)}` : "师傅开始提供服务";
|
||||
}
|
||||
|
||||
if (title.includes("服务完成") || title.includes("完成")) {
|
||||
return content ? `服务已完成,${this.getContentDescription(content)}` : "服务已完成";
|
||||
}
|
||||
|
||||
if (title.includes("报价")) {
|
||||
return content ? `已生成报价,${this.getContentDescription(content)}` : "已生成服务报价";
|
||||
}
|
||||
|
||||
if (title.includes("更换师傅")) {
|
||||
return content ? `已更换师傅,${this.getContentDescription(content)}` : "订单已更换给新师傅";
|
||||
}
|
||||
|
||||
// 如果有具体内容,使用内容描述
|
||||
if (content) {
|
||||
return this.getContentDescription(content);
|
||||
}
|
||||
|
||||
// 兜底返回
|
||||
return "操作记录";
|
||||
},
|
||||
|
||||
/** 获取内容描述 */
|
||||
getContentDescription(content) {
|
||||
if (!content) return "无描述信息";
|
||||
|
||||
try {
|
||||
// 尝试解析JSON内容
|
||||
const contentData = JSON.parse(content);
|
||||
|
||||
// 如果是数组类型
|
||||
if (Array.isArray(contentData)) {
|
||||
return contentData[0]?.name || content;
|
||||
} else if (typeof contentData === "object") {
|
||||
return contentData.name || content;
|
||||
if (contentData.length > 0) {
|
||||
const firstItem = contentData[0];
|
||||
if (typeof firstItem === 'string') {
|
||||
return firstItem;
|
||||
} else if (typeof firstItem === 'object') {
|
||||
return firstItem.name || firstItem.title || firstItem.description || '数组内容';
|
||||
}
|
||||
} catch (e) {
|
||||
// 如果解析失败,直接返回原始内容
|
||||
}
|
||||
return '数组内容';
|
||||
}
|
||||
// 如果是对象类型
|
||||
else if (typeof contentData === "object") {
|
||||
// 优先显示描述字段
|
||||
if (contentData.description) {
|
||||
return contentData.description;
|
||||
}
|
||||
if (contentData.name) {
|
||||
return contentData.name;
|
||||
}
|
||||
if (contentData.title) {
|
||||
return contentData.title;
|
||||
}
|
||||
if (contentData.content) {
|
||||
return contentData.content;
|
||||
}
|
||||
if (contentData.remark) {
|
||||
return contentData.remark;
|
||||
}
|
||||
if (contentData.message) {
|
||||
return contentData.message;
|
||||
}
|
||||
if (contentData.msg) {
|
||||
return contentData.msg;
|
||||
}
|
||||
|
||||
// 特殊处理:如果是报价数据,显示简要信息
|
||||
if (contentData.basic || contentData.craft || contentData.material || contentData.project) {
|
||||
let summary = [];
|
||||
if (contentData.basic && Array.isArray(contentData.basic)) {
|
||||
const basicCount = contentData.basic.filter(item => item.select === true).length;
|
||||
if (basicCount > 0) {
|
||||
summary.push(`基检项目: ${basicCount}项`);
|
||||
}
|
||||
}
|
||||
if (contentData.craft && Array.isArray(contentData.craft)) {
|
||||
summary.push(`服务项目: ${contentData.craft.length}项`);
|
||||
}
|
||||
if (contentData.material && Array.isArray(contentData.material)) {
|
||||
summary.push(`物料项目: ${contentData.material.length}项`);
|
||||
}
|
||||
if (contentData.project && contentData.project.price) {
|
||||
summary.push(`总价: ¥${parseFloat(contentData.project.price).toFixed(2)}`);
|
||||
}
|
||||
return summary.length > 0 ? summary.join(' | ') : '报价详情';
|
||||
}
|
||||
|
||||
// 如果没有找到合适的字段,尝试显示其他有用信息
|
||||
const keys = Object.keys(contentData);
|
||||
if (keys.length > 0) {
|
||||
const firstKey = keys[0];
|
||||
const firstValue = contentData[firstKey];
|
||||
if (typeof firstValue === 'string' && firstValue.length < 100) {
|
||||
return `${firstKey}: ${firstValue}`;
|
||||
}
|
||||
}
|
||||
return '对象内容';
|
||||
}
|
||||
} catch (e) {
|
||||
// 如果JSON解析失败,检查是否为纯文本
|
||||
if (typeof content === 'string') {
|
||||
// 如果内容长度合理,直接显示
|
||||
if (content.length <= 200) {
|
||||
return content;
|
||||
} else {
|
||||
// 如果内容太长,截取前100个字符
|
||||
return content.substring(0, 100) + '...';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 兜底返回
|
||||
if (typeof content === 'string') {
|
||||
return content.length > 200 ? content.substring(0, 200) + '...' : content;
|
||||
}
|
||||
|
||||
return '未知内容格式';
|
||||
},
|
||||
|
||||
/** 判断是否为JSON字符串 */
|
||||
|
|
@ -1407,8 +1595,8 @@ export default {
|
|||
this.$message.success("完成服务成功!");
|
||||
this.completeServiceDialogVisible = false;
|
||||
this.completeServiceImages = [];
|
||||
this.$emit("refresh-order");
|
||||
this.handleClose();
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} else {
|
||||
this.$message.error("完成服务失败:" + (response.msg || "未知错误"));
|
||||
}
|
||||
|
|
@ -1443,11 +1631,8 @@ export default {
|
|||
if (response.code === 200) {
|
||||
this.$message.success("接单成功!");
|
||||
|
||||
// 刷新订单信息
|
||||
this.$emit("refresh-order");
|
||||
|
||||
// 关闭订单明细弹窗
|
||||
this.handleClose();
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} else {
|
||||
this.$message.error("接单失败:" + response.msg);
|
||||
}
|
||||
|
|
@ -1478,10 +1663,8 @@ export default {
|
|||
|
||||
if (response.code === 200) {
|
||||
this.$message.success("确认到达成功!");
|
||||
// 刷新订单信息
|
||||
this.$emit("refresh-order");
|
||||
// 关闭订单明细弹窗
|
||||
this.handleClose();
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} else {
|
||||
this.$message.error("确认到达失败:" + response.msg);
|
||||
}
|
||||
|
|
@ -1526,7 +1709,8 @@ export default {
|
|||
this.$message.success("开始服务成功!");
|
||||
this.startServiceDialogVisible = false;
|
||||
this.startServiceImages = [];
|
||||
this.$emit("refresh-order");
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} else {
|
||||
this.$message.error("开始服务失败:" + (response.msg || "未知错误"));
|
||||
}
|
||||
|
|
@ -1628,10 +1812,10 @@ export default {
|
|||
});
|
||||
if (response.code === 200) {
|
||||
this.$message.success("订单已结束");
|
||||
this.$emit("refresh-order");
|
||||
this.endOrderDialogVisible = false;
|
||||
this.resetEndOrderForm();
|
||||
this.handleClose();
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} else {
|
||||
this.$message.error(
|
||||
"结束订单失败:" + (response.msg || "未知错误")
|
||||
|
|
@ -1765,8 +1949,8 @@ export default {
|
|||
this.loadWorkerInfo();
|
||||
}
|
||||
|
||||
// 通知父组件刷新数据
|
||||
this.$emit("refresh-order");
|
||||
// 不关闭页面,刷新数据
|
||||
await this.refreshOrderData();
|
||||
} catch (error) {
|
||||
console.error("更换师傅失败:", error);
|
||||
this.$message.error("更换师傅失败:" + (error.message || "未知错误"));
|
||||
|
|
@ -1983,6 +2167,38 @@ export default {
|
|||
return '清洗剂 ¥35.00*1、其他辅料面议项 ¥1.00*1';
|
||||
}
|
||||
},
|
||||
|
||||
/** 刷新订单数据(不关闭页面) */
|
||||
async refreshOrderData() {
|
||||
try {
|
||||
this.refreshing = true;
|
||||
|
||||
// 重新获取订单详情
|
||||
await this.getinfo();
|
||||
|
||||
// 重新获取日志数据
|
||||
await this.getOrderlogDataFrist();
|
||||
|
||||
// 如果当前有师傅ID,重新加载师傅信息
|
||||
if (this.orderInfo.workerId) {
|
||||
await this.loadWorkerInfo();
|
||||
}
|
||||
|
||||
// 更新最后刷新时间
|
||||
this.lastRefreshTime = new Date().toLocaleString();
|
||||
|
||||
// 自动切换到流程管理标签页,让用户看到最新状态
|
||||
this.activeName = "third";
|
||||
|
||||
this.$message.success("数据刷新完成!");
|
||||
|
||||
} catch (error) {
|
||||
console.error("刷新订单数据失败:", error);
|
||||
this.$message.error("刷新数据失败:" + (error.message || "网络错误"));
|
||||
} finally {
|
||||
this.refreshing = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1996,6 +2212,25 @@ export default {
|
|||
.detailright {
|
||||
height: calc(100% - 54px);
|
||||
|
||||
// 订单状态提示栏
|
||||
.order-status-banner {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.status-details {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
|
||||
span {
|
||||
margin-right: 15px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.boxcontent {
|
||||
height: calc(100% - 60px);
|
||||
overflow-y: auto;
|
||||
|
|
@ -2034,6 +2269,39 @@ export default {
|
|||
// 确保三个卡片在同一行时高度一致
|
||||
height: 100%;
|
||||
|
||||
// 顶部操作栏样式
|
||||
.top-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 15px 20px;
|
||||
background: #f8f9fa;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 8px 8px 0 0;
|
||||
|
||||
.left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
|
||||
.refresh-tip {
|
||||
font-size: 13px;
|
||||
color: #67c23a;
|
||||
background: #f0f9ff;
|
||||
padding: 6px 12px;
|
||||
border-radius: 15px;
|
||||
border: 1px solid #b3d8ff;
|
||||
}
|
||||
}
|
||||
|
||||
.last-refresh-time {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
.el-col {
|
||||
display: flex;
|
||||
|
||||
|
|
@ -2258,6 +2526,128 @@ export default {
|
|||
.timeline-description {
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 1.6;
|
||||
padding: 10px 14px;
|
||||
background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
|
||||
border-radius: 8px;
|
||||
border-left: 4px solid #409eff;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
position: relative;
|
||||
|
||||
// 添加一个小图标
|
||||
&::before {
|
||||
content: "📝";
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: #409eff;
|
||||
color: white;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 8px;
|
||||
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
|
||||
}
|
||||
|
||||
// 特殊样式:报价相关
|
||||
&:contains("报价") {
|
||||
border-left-color: #67c23a;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #67c23a;
|
||||
content: "💰";
|
||||
}
|
||||
}
|
||||
|
||||
// 特殊样式:服务相关
|
||||
&:contains("服务") {
|
||||
border-left-color: #e6a23c;
|
||||
background: linear-gradient(135deg, #fef9f0 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #e6a23c;
|
||||
content: "🔧";
|
||||
}
|
||||
}
|
||||
|
||||
// 特殊样式:状态变更
|
||||
&:contains("订单生成") {
|
||||
border-left-color: #409eff;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #409eff;
|
||||
content: "📋";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("支付") {
|
||||
border-left-color: #67c23a;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #67c23a;
|
||||
content: "💳";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("派单") {
|
||||
border-left-color: #e6a23c;
|
||||
background: linear-gradient(135deg, #fef9f0 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #e6a23c;
|
||||
content: "📤";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("接单") {
|
||||
border-left-color: #67c23a;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #67c23a;
|
||||
content: "✅";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("出发") {
|
||||
border-left-color: #e6a23c;
|
||||
background: linear-gradient(135deg, #fef9f0 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #e6a23c;
|
||||
content: "🚗";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("到达") {
|
||||
border-left-color: #67c23a;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #67c23a;
|
||||
content: "📍";
|
||||
}
|
||||
}
|
||||
|
||||
&:contains("完成") {
|
||||
border-left-color: #f56c6c;
|
||||
background: linear-gradient(135deg, #fef0f0 0%, #ffffff 100%);
|
||||
|
||||
&::before {
|
||||
background: #f56c6c;
|
||||
content: "🎉";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 时间轴图片 */
|
||||
|
|
@ -2622,6 +3012,33 @@ export default {
|
|||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.timeline-description {
|
||||
padding: 8px 10px;
|
||||
font-size: 13px;
|
||||
|
||||
&::before {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 7px;
|
||||
left: -7px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.timeline-description {
|
||||
padding: 6px 8px;
|
||||
font-size: 12px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
&::before {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
font-size: 6px;
|
||||
left: -6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 更换师傅弹窗样式 */
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changetypeStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changetypeStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@
|
|||
<el-form :model="timeForm" label-width="120px" class="tab-form">
|
||||
<el-form-item label="每月提现时间">
|
||||
<el-select v-model="timeForm.withdrawDays" multiple placeholder="请选择日期" style="width: 300px">
|
||||
<el-option v-for="d in 31" :key="d" :label="d + '号'" :value="d + '号'" />
|
||||
<el-option v-for="d in 31" :key="d" :label="d + '号'" :value="d.toString()" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="定时接单时长">
|
||||
|
|
@ -1051,7 +1051,7 @@ export default {
|
|||
this.$message.success('提交成功(模拟)')
|
||||
},
|
||||
resetTime() {
|
||||
this.timeForm = { withdrawDays: ['8号', '18号', '28号'], autoOrderMinutes: 10, cancelOrderDays: 7 }
|
||||
this.timeForm = { withdrawDays: ['8', '18', '28'], autoOrderMinutes: 10, cancelOrderDays: 7 }
|
||||
},
|
||||
resetMember() {
|
||||
this.memberForm = { member: '', memberRule: '', recharge: '' }
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handlefenleiStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changefenleiStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ export default {
|
|||
// 任务状态修改
|
||||
handlefenleiStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
||||
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||
return changefenleiStatus(row.id, row.status)
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
|
|
|
|||
|
|
@ -373,6 +373,7 @@
|
|||
<el-dialog :title="'师傅质保金明细'" :visible.sync="workerMarginLogDialogVisible" width="70%" top="5vh" append-to-body>
|
||||
<worker-margin-log-detail-table
|
||||
:worker-id="currentWorkerId"
|
||||
:worker-margin="currentWorkerMargin"
|
||||
@close="workerMarginLogDialogVisible = false"
|
||||
@margin-changed="handleMarginChanged"
|
||||
v-if="workerMarginLogDialogVisible"
|
||||
|
|
@ -505,6 +506,7 @@ export default {
|
|||
workerMoneyLogDialogVisible: false,
|
||||
currentWorkerId: null,
|
||||
workerMarginLogDialogVisible: false,
|
||||
currentWorkerMargin: 0, // 当前师傅质保金余额
|
||||
workerLevelDialogVisible: false,
|
||||
workerLevelUserId: null,
|
||||
workerLevelUserName: '',
|
||||
|
|
@ -673,14 +675,30 @@ export default {
|
|||
},
|
||||
// 状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.name + '"状态吗?').then(function() {
|
||||
return changetypeStatus(row.id, row.status)
|
||||
// 获取当前的新状态
|
||||
const newStatus = row.status;
|
||||
|
||||
// 根据新状态判断操作类型:1表示启用,0表示停用
|
||||
const operation = newStatus === "1" ? "启用" : "停用";
|
||||
|
||||
console.log("-------------------------新状态: " + newStatus);
|
||||
console.log("-------------------------操作类型: " + operation);
|
||||
|
||||
// 显示确认对话框
|
||||
this.$modal.confirm(`确认要操作${row.name}的状态吗?`).then(() => {
|
||||
// 调用API更新状态
|
||||
return changetypeStatus(row.id, newStatus);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功")
|
||||
}).catch(function() {
|
||||
row.status = row.status === "0" ? "1" : "0"
|
||||
})
|
||||
// 成功提示
|
||||
this.$modal.msgSuccess(`${operation}成功`);
|
||||
// 刷新列表以获取最新数据
|
||||
this.getList();
|
||||
}).catch((error) => {
|
||||
console.error('状态更新失败:', error);
|
||||
// 如果更新失败,恢复原状态
|
||||
row.status = newStatus === "1" ? "0" : "1";
|
||||
this.$message.error(`${operation}失败,请重试`);
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
|
|
@ -751,6 +769,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
this.currentWorkerId = row.id;
|
||||
this.currentWorkerMargin = parseFloat(row.margin) || 0;
|
||||
this.workerMarginLogDialogVisible = true;
|
||||
},
|
||||
showWorkerLevelDialog(row) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button type="info" icon="el-icon-view" size="mini" @click="handleViewPending">查看待审核</el-button>
|
||||
<!-- <el-button type="info" icon="el-icon-view" size="mini" @click="handleViewPending">查看待审核</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -136,20 +136,20 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row> -->
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleBatchAudit"
|
||||
v-hasPermi="['system:WorkerApply:audit']"
|
||||
>批量审核</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<!-- <el-row :gutter="10" class="mb8">-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-check"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- @click="handleBatchAudit"-->
|
||||
<!-- v-hasPermi="['system:WorkerApply:audit']"-->
|
||||
<!-- >批量审核</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
<el-table v-loading="loading" :data="WorkerApplyList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
plain
|
||||
icon="el-icon-lock"
|
||||
size="mini"
|
||||
:disabled="!canLock"
|
||||
@click="handleLockMoney"
|
||||
v-hasPermi="['system:workerMoneyLog:lock']"
|
||||
>锁住收益</el-button>
|
||||
|
|
@ -51,6 +52,7 @@
|
|||
plain
|
||||
icon="el-icon-unlock"
|
||||
size="mini"
|
||||
:disabled="!canLock"
|
||||
@click="handleUnlockMoney"
|
||||
v-hasPermi="['system:workerMoneyLog:unlock']"
|
||||
>解锁收益</el-button>
|
||||
|
|
@ -61,6 +63,7 @@
|
|||
plain
|
||||
icon="el-icon-edit-outline"
|
||||
size="mini"
|
||||
:disabled="!canAdjust"
|
||||
@click="handleAdjustMoney"
|
||||
v-hasPermi="['system:workerMoneyLog:adjust']"
|
||||
>调整收益</el-button>
|
||||
|
|
@ -163,8 +166,119 @@
|
|||
<p>暂无师傅佣金明细数据</p>
|
||||
<p v-if="queryParams.workerId">师傅ID: {{ queryParams.workerId }}</p>
|
||||
</div>
|
||||
<!-- 锁住收益、解锁收益、调整收益弹窗可复用index.vue逻辑 -->
|
||||
<!-- 这里省略弹窗代码,实际实现时可直接复制index.vue相关弹窗和方法 -->
|
||||
|
||||
<!-- 操作提示 -->
|
||||
<div v-if="!loading && workerMoneyLogList.length > 0 && ids.length === 0" style="text-align: center; padding: 20px; color: #909399; background: #f8f9fa; border-radius: 4px; margin-bottom: 20px;">
|
||||
<i class="el-icon-info" style="margin-right: 8px;"></i>
|
||||
请选择一条记录进行操作。锁住收益:未锁定状态 | 解锁收益:已锁定状态 | 调整收益:已锁定状态
|
||||
</div>
|
||||
|
||||
<!-- 锁住收益弹窗 -->
|
||||
<el-dialog title="锁住收益" :visible.sync="lockDialogVisible" width="500px" append-to-body>
|
||||
<el-form ref="lockForm" :model="lockForm" :rules="lockRules" label-width="100px">
|
||||
<el-form-item label="锁住金额">
|
||||
<el-input v-model="lockForm.price" disabled>
|
||||
<template slot="prepend">¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="锁住类型" prop="lockType">
|
||||
<el-radio-group v-model="lockForm.lockType">
|
||||
<el-radio label="forever">永久锁住</el-radio>
|
||||
<el-radio label="days">按天数锁住</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="lockForm.lockType === 'days'" label="锁住天数" prop="lockday">
|
||||
<el-input-number v-model="lockForm.lockday" :min="1" :max="365" />
|
||||
</el-form-item>
|
||||
<el-form-item label="锁住原因" prop="remark">
|
||||
<el-input
|
||||
v-model="lockForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入锁住原因"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="color: #909399; font-size: 12px;">
|
||||
将锁住 {{ lockForm.count }} 条记录,总金额 ¥{{ formatMoney(lockForm.total) }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelLockDialog">取消</el-button>
|
||||
<el-button type="primary" @click="confirmLockMoney" :loading="lockLoading">确认锁住</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 解锁收益弹窗 -->
|
||||
<el-dialog title="解锁收益" :visible.sync="unlockDialogVisible" width="500px" append-to-body>
|
||||
<el-form ref="unlockForm" :model="unlockForm" :rules="unlockRules" label-width="100px">
|
||||
<el-form-item label="解锁原因" prop="remark">
|
||||
<el-input
|
||||
v-model="unlockForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入解锁原因"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="color: #909399; font-size: 12px;">
|
||||
将解锁 {{ unlockForm.count }} 条记录,总金额 ¥{{ formatMoney(unlockForm.total) }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelUnlockDialog">取消</el-button>
|
||||
<el-button type="primary" @click="confirmUnlockMoney" :loading="unlockLoading">确认解锁</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 调整收益弹窗 -->
|
||||
<el-dialog title="调整收益" :visible.sync="adjustDialogVisible" width="500px" append-to-body>
|
||||
<el-form ref="adjustForm" :model="adjustForm" :rules="adjustRules" label-width="100px">
|
||||
<el-form-item label="调整类型" prop="type">
|
||||
<el-radio-group v-model="adjustForm.type">
|
||||
<el-radio label="reward">奖励</el-radio>
|
||||
<el-radio label="deduct">扣除</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整金额" prop="amount">
|
||||
<el-input-number
|
||||
v-model="adjustForm.amount"
|
||||
:min="0.01"
|
||||
:max="adjustForm.type === 'deduct' ? adjustForm.maxPrice : 99999"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
placeholder="请输入调整金额"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<div v-if="adjustForm.type === 'deduct'" style="color: #909399; font-size: 12px; margin-top: 5px;">
|
||||
当前金额: ¥{{ formatMoney(adjustForm.maxPrice) }},最大可扣除: ¥{{ formatMoney(adjustForm.maxPrice) }}
|
||||
</div>
|
||||
<div v-else style="color: #909399; font-size: 12px; margin-top: 5px;">
|
||||
当前金额: ¥{{ formatMoney(adjustForm.maxPrice) }},奖励后金额: ¥{{ formatMoney(adjustForm.maxPrice + (adjustForm.amount || 0)) }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整原因" prop="remark">
|
||||
<el-input
|
||||
v-model="adjustForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入调整原因"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelAdjustDialog">取消</el-button>
|
||||
<el-button type="primary" @click="confirmAdjustMoney" :loading="adjustLoading">确认调整</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -205,13 +319,15 @@ export default {
|
|||
lockday: 1,
|
||||
ids: [],
|
||||
count: 0,
|
||||
total: 0
|
||||
total: 0,
|
||||
remark: ''
|
||||
},
|
||||
unlockDialogVisible: false,
|
||||
unlockForm: {
|
||||
count: 0,
|
||||
total: 0,
|
||||
ids: []
|
||||
ids: [],
|
||||
remark: ''
|
||||
},
|
||||
adjustDialogVisible: false,
|
||||
adjustForm: {
|
||||
|
|
@ -221,6 +337,45 @@ export default {
|
|||
remark: '',
|
||||
maxPrice: 0
|
||||
},
|
||||
lockLoading: false,
|
||||
unlockLoading: false,
|
||||
adjustLoading: false,
|
||||
lockRules: {
|
||||
lockType: [
|
||||
{ required: true, message: '请选择锁住类型', trigger: 'change' }
|
||||
],
|
||||
lockday: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.lockForm.lockType === 'days' && (!value || value < 1)) {
|
||||
callback(new Error('按天锁住时必须输入锁住天数'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
remark: [
|
||||
{ required: true, message: '请输入锁住原因', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
unlockRules: {
|
||||
remark: [
|
||||
{ required: true, message: '请输入解锁原因', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
adjustRules: {
|
||||
type: [
|
||||
{ required: true, message: '请选择调整类型', trigger: 'change' }
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: '请输入调整金额', trigger: 'blur' }
|
||||
],
|
||||
remark: [
|
||||
{ required: true, message: '请输入调整原因', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -285,9 +440,20 @@ export default {
|
|||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
this.canAdjust = selection.length === 1 && selection[0].status === 1;
|
||||
this.canLock = selection.length === 1 && selection[0].status === 1;
|
||||
this.canUnlock = selection.length === 1 && selection[0].status === 1;
|
||||
|
||||
if (selection.length === 1) {
|
||||
const selectedItem = selection[0];
|
||||
// 调整收益:只能操作已锁定的数据(status === 1)
|
||||
this.canAdjust = selectedItem.status === 1;
|
||||
// 锁住收益:只能操作未锁定的数据(status !== 1)
|
||||
this.canLock = selectedItem.status !== 1;
|
||||
// 解锁收益:只能操作已锁定的数据(status === 1)
|
||||
this.canUnlock = selectedItem.status === 1;
|
||||
} else {
|
||||
this.canAdjust = false;
|
||||
this.canLock = false;
|
||||
this.canUnlock = false;
|
||||
}
|
||||
},
|
||||
handleLockMoney() {
|
||||
if (this.ids.length !== 1) {
|
||||
|
|
@ -295,8 +461,8 @@ export default {
|
|||
return;
|
||||
}
|
||||
const row = this.workerMoneyLogList.find(item => item.id === this.ids[0]);
|
||||
if (!row || row.status !== 1) {
|
||||
this.$message.warning('只能操作冻结中的数据');
|
||||
if (!row || row.status === 1) {
|
||||
this.$message.warning('只能锁住未锁定状态的数据');
|
||||
return;
|
||||
}
|
||||
this.lockForm.count = 1;
|
||||
|
|
@ -305,6 +471,7 @@ export default {
|
|||
this.lockForm.lockType = 'forever';
|
||||
this.lockForm.lockday = 1;
|
||||
this.lockForm.ids = [row.id];
|
||||
this.lockForm.remark = '';
|
||||
this.lockDialogVisible = true;
|
||||
},
|
||||
handleUnlockMoney() {
|
||||
|
|
@ -312,14 +479,17 @@ export default {
|
|||
this.$message.warning('请选择一条要解锁收益的数据');
|
||||
return;
|
||||
}
|
||||
console.log('开始解锁收益数据,ids:', this.ids)
|
||||
const row = this.workerMoneyLogList.find(item => item.id === this.ids[0]);
|
||||
if (!row || row.status !== 1) {
|
||||
console.log('开始解锁收益数据,ids:', row.status)
|
||||
if (!row || row.status === 1) {
|
||||
this.$message.warning('只能操作冻结中的数据');
|
||||
return;
|
||||
}
|
||||
this.unlockForm.count = 1;
|
||||
this.unlockForm.total = row.price;
|
||||
this.unlockForm.ids = [row.id];
|
||||
this.unlockForm.remark = '';
|
||||
this.unlockDialogVisible = true;
|
||||
},
|
||||
handleAdjustMoney() {
|
||||
|
|
@ -338,6 +508,124 @@ export default {
|
|||
this.adjustForm.remark = '';
|
||||
this.adjustForm.maxPrice = parseFloat(row.price) || 0;
|
||||
this.adjustDialogVisible = true;
|
||||
},
|
||||
// 确认锁住收益
|
||||
confirmLockMoney() {
|
||||
this.$refs.lockForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.lockLoading = true;
|
||||
const lockData = {
|
||||
ids: this.lockForm.ids,
|
||||
lockType: this.lockForm.lockType,
|
||||
lockday: this.lockForm.lockType === 'days' ? this.lockForm.lockday : null,
|
||||
remark: this.lockForm.remark
|
||||
};
|
||||
|
||||
lockWorkerMoney(lockData).then(response => {
|
||||
this.$message.success('锁住收益成功');
|
||||
this.lockDialogVisible = false;
|
||||
this.getList(); // 刷新列表
|
||||
// 重置表单
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.lockForm) {
|
||||
this.$refs.lockForm.resetFields();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('锁住收益失败:', error);
|
||||
this.$message.error('锁住收益失败: ' + (error.message || '未知错误'));
|
||||
}).finally(() => {
|
||||
this.lockLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 确认解锁收益
|
||||
confirmUnlockMoney() {
|
||||
this.$refs.unlockForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.unlockLoading = true;
|
||||
const unlockData = {
|
||||
ids: this.unlockForm.ids,
|
||||
remark: this.unlockForm.remark
|
||||
};
|
||||
|
||||
unlockWorkerMoney(unlockData).then(response => {
|
||||
this.$message.success('解锁收益成功');
|
||||
this.unlockDialogVisible = false;
|
||||
this.getList(); // 刷新列表
|
||||
// 重置表单
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.unlockForm) {
|
||||
this.$refs.unlockForm.resetFields();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('解锁收益失败:', error);
|
||||
this.$message.error('解锁收益失败: ' + (error.message || '未知错误'));
|
||||
}).finally(() => {
|
||||
this.unlockLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 确认调整收益
|
||||
confirmAdjustMoney() {
|
||||
this.$refs.adjustForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.adjustLoading = true;
|
||||
const adjustData = {
|
||||
id: this.adjustForm.id,
|
||||
type: this.adjustForm.type,
|
||||
amount: this.adjustForm.amount,
|
||||
remark: this.adjustForm.remark
|
||||
};
|
||||
|
||||
adjustWorkerMoney(adjustData).then(response => {
|
||||
this.$message.success('调整收益成功');
|
||||
this.adjustDialogVisible = false;
|
||||
this.getList(); // 刷新列表
|
||||
// 重置表单
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.adjustForm) {
|
||||
this.$refs.adjustForm.resetFields();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('调整收益失败:', error);
|
||||
this.$message.error('调整收益失败: ' + (error.message || '未知错误'));
|
||||
}).finally(() => {
|
||||
this.adjustLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消锁住收益弹窗
|
||||
cancelLockDialog() {
|
||||
this.lockDialogVisible = false;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.lockForm) {
|
||||
this.$refs.lockForm.resetFields();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消解锁收益弹窗
|
||||
cancelUnlockDialog() {
|
||||
this.unlockDialogVisible = false;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.unlockForm) {
|
||||
this.$refs.unlockForm.resetFields();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消调整收益弹窗
|
||||
cancelAdjustDialog() {
|
||||
this.adjustDialogVisible = false;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.adjustForm) {
|
||||
this.$refs.adjustForm.resetFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue