From 268dc896a47206d2070f54aaadc53542382e0663 Mon Sep 17 00:00:00 2001 From: "925116093-qq.com" <925116093@qq.com> Date: Thu, 29 May 2025 17:40:34 +0800 Subject: [PATCH] 202505291740 --- .../system/controller/CouponsController.java | 40 +- .../java/com/ruoyi/system/domain/Coupons.java | 2 + .../com/ruoyi/system/mapper/UsersMapper.java | 7 + .../ruoyi/system/service/IUsersService.java | 9 + .../system/service/impl/UsersServiceImpl.java | 6 + .../resources/mapper/system/UsersMapper.xml | 9 + ruoyi-ui/src/api/system/Coupons.js | 33 + ruoyi-ui/src/views/system/Coupons/index.vue | 1072 ++++++++++++----- .../src/views/system/IntegralOrder/index.vue | 115 +- .../src/views/system/WorkerApply/index.vue | 4 +- ruoyi-ui/src/views/system/transfer/index.vue | 4 +- 11 files changed, 976 insertions(+), 325 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/CouponsController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/CouponsController.java index 5c1b2c5..e85f80f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/CouponsController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/CouponsController.java @@ -155,6 +155,44 @@ public class CouponsController extends BaseController return toAjax(couponsService.deleteCouponsByIds(ids)); } - + /** + * 根据优惠券ID查询userIds对应的用户列表,只返回name、phone、userId字段 + */ + @PreAuthorize("@ss.hasPermi('system:Coupons:query')") + @GetMapping("/userListByCoupon/{id}") + public AjaxResult getUserListByCoupon(@PathVariable("id") Long id) { + Coupons coupon = couponsService.selectCouponsById(id); + if (coupon == null || coupon.getUserIds() == null) { + return error("优惠券不存在"); + } + List userIdList; + try { + // 假设userIds存储为JSON数组字符串 + userIdList = com.alibaba.fastjson2.JSON.parseArray(coupon.getUserIds(), Long.class); + } catch (Exception e) { + // 如果不是JSON格式,尝试逗号分隔 + userIdList = new java.util.ArrayList<>(); + for (String s : coupon.getUserIds().split(",")) { + try { + userIdList.add(Long.parseLong(s.trim())); + } catch (Exception ignore) {} + } + } + if (userIdList.isEmpty()) { + return error("优惠券不存在"); + } + // 查询用户列表 + List usersList = usersService.selectUsersByIds(userIdList); + // 只返回name、phone、userId字段 + List> simpleList = new java.util.ArrayList<>(); + for (Users user : usersList) { + java.util.Map map = new java.util.HashMap<>(); + map.put("userId", user.getId()); + map.put("name", user.getName()); + map.put("phone", user.getPhone()); + simpleList.add(map); + } + return success(simpleList); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Coupons.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Coupons.java index 429ce27..578fc3a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Coupons.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Coupons.java @@ -30,6 +30,8 @@ public class Coupons extends BaseEntity @Excel(name = "面值") private BigDecimal price; + + /** 最低消费 */ @Excel(name = "最低消费") private BigDecimal minPrice; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsersMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsersMapper.java index f2bb619..1a48414 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsersMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UsersMapper.java @@ -58,4 +58,11 @@ public interface UsersMapper * @return 结果 */ public int deleteUsersByIds(Long[] ids); + + /** + * 批量根据ID查询用户 + * @param ids 用户ID列表 + * @return 用户对象列表 + */ + public List selectUsersByIds(List ids); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsersService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsersService.java index c9082af..2b5c727 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsersService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUsersService.java @@ -58,4 +58,13 @@ public interface IUsersService * @return 结果 */ public int deleteUsersById(Long id); + + + + /** + * 批量根据ID查询用户 + * @param ids 用户ID列表 + * @return 用户对象列表 + */ + public List selectUsersByIds(List ids); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsersServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsersServiceImpl.java index 0a7e361..1fc383f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsersServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsersServiceImpl.java @@ -90,4 +90,10 @@ public class UsersServiceImpl implements IUsersService { return usersMapper.deleteUsersById(id); } + + @Override + public List selectUsersByIds(List ids) { + if (ids == null || ids.isEmpty()) return java.util.Collections.emptyList(); + return usersMapper.selectUsersByIds(ids); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/UsersMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UsersMapper.xml index 9dc9c05..24c7916 100644 --- a/ruoyi-system/src/main/resources/mapper/system/UsersMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/UsersMapper.xml @@ -216,4 +216,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/Coupons.js b/ruoyi-ui/src/api/system/Coupons.js index 304117a..2342b0a 100644 --- a/ruoyi-ui/src/api/system/Coupons.js +++ b/ruoyi-ui/src/api/system/Coupons.js @@ -17,6 +17,31 @@ export function getCoupons(id) { }) } +export function getGoodsDataList() { + return request({ + url: '/system/QuoteType/goodsDataList', + method: 'get' + }) +} +// 查询用户列表列表 +export function getUserDataList(query) { + return request({ + url: '/system/users/list', + method: 'get', + params: query + }) +} + + + +// // 获取接单记录列表 +// export function getUserDataList(type) { +// return request({ +// url: '/system/transfer/getUsersDataList/'+type, +// method: 'get' +// }) +// } + // 查询优惠券详细 export function getTypeList() { return request({ @@ -25,6 +50,14 @@ export function getTypeList() { }) } +export function getUserListByCoupon(id) { + return request({ + url: '/system/Coupons/userListByCoupon/'+id, + method: 'get' + }) +} + + // 任务状态修改 export function changetypeStatus(id, status) { diff --git a/ruoyi-ui/src/views/system/Coupons/index.vue b/ruoyi-ui/src/views/system/Coupons/index.vue index d8e615a..560a5af 100644 --- a/ruoyi-ui/src/views/system/Coupons/index.vue +++ b/ruoyi-ui/src/views/system/Coupons/index.vue @@ -1,6 +1,9 @@ @@ -235,111 +276,251 @@ icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:Coupons:edit']" - >修改 + class="edit-button" + title="修改" + > 删除 + class="delete-button" + title="删除" + > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + {{ selectedUsers.length > 0 ? `已选择 ${selectedUsers.length} 个用户` : '选择赠送用户' }} + +
+ + + {{ user.name || '未命名用户' }} + {{ user.phone || '无手机号' }} + + +
+
- + + diff --git a/ruoyi-ui/src/views/system/IntegralOrder/index.vue b/ruoyi-ui/src/views/system/IntegralOrder/index.vue index 5b388e9..9807dbb 100644 --- a/ruoyi-ui/src/views/system/IntegralOrder/index.vue +++ b/ruoyi-ui/src/views/system/IntegralOrder/index.vue @@ -77,7 +77,7 @@ v-hasPermi="['system:IntegralOrder:edit']" >修改 - + @@ -154,13 +154,13 @@ /> - + - + @@ -174,40 +174,69 @@ - + - - - - + - + - - - - - - - - - - - + + - - - + + 待发货 + 发货 + 完成 + + + + + + @@ -260,7 +289,7 @@ export default { { required: true, message: "订单号不能为空", trigger: "blur" } ], uid: [ - { required: true, message: "用户不能为空", trigger: "blur" } + { required: true, message: "用户不能为空", trigger: "change" } ], userName: [ { required: true, message: "姓名不能为空", trigger: "blur" } @@ -272,10 +301,7 @@ export default { { required: true, message: "地址不能为空", trigger: "blur" } ], productId: [ - { required: true, message: "商品不能为空", trigger: "blur" } - ], - sku: [ - { required: true, message: "规格不能为空", trigger: "blur" } + { required: true, message: "商品不能为空", trigger: "change" } ], num: [ { required: true, message: "数量不能为空", trigger: "blur" } @@ -284,10 +310,34 @@ export default { { required: true, message: "单价不能为空", trigger: "blur" } ], totalPrice: [ - { required: true, message: "总积分不能为空", trigger: "blur" } + { required: true, message: "支付积分不能为空", trigger: "blur" } ], status: [ - { required: true, message: "1:待发货 2:待收货 3:已完成不能为空", trigger: "change" } + { required: true, message: "状态不能为空", trigger: "change" } + ], + deliveryId: [ + { + validator: (rule, value, callback) => { + if (this.form.status === 2 && (!value || value.trim() === '')) { + callback(new Error('快递公司不能为空')); + } else { + callback(); + } + }, + trigger: "blur" + } + ], + deliveryNum: [ + { + validator: (rule, value, callback) => { + if (this.form.status === 2 && (!value || value.trim() === '')) { + callback(new Error('快递单号不能为空')); + } else { + callback(); + } + }, + trigger: "blur" + } ], }, users: [], @@ -329,7 +379,6 @@ export default { userPhone: null, userAddress: null, productId: null, - sku: null, num: null, price: null, totalPrice: null, diff --git a/ruoyi-ui/src/views/system/WorkerApply/index.vue b/ruoyi-ui/src/views/system/WorkerApply/index.vue index 313fb2e..1f06dfb 100644 --- a/ruoyi-ui/src/views/system/WorkerApply/index.vue +++ b/ruoyi-ui/src/views/system/WorkerApply/index.vue @@ -49,7 +49,7 @@ - + diff --git a/ruoyi-ui/src/views/system/transfer/index.vue b/ruoyi-ui/src/views/system/transfer/index.vue index 4226d90..9e591ee 100644 --- a/ruoyi-ui/src/views/system/transfer/index.vue +++ b/ruoyi-ui/src/views/system/transfer/index.vue @@ -50,7 +50,7 @@ - +