From 84424caa3902fee8ffe974892a097dd79fd71dee Mon Sep 17 00:00:00 2001
From: lzhizhao <790086754@qq.com>
Date: Sat, 9 Aug 2025 23:55:26 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=9A=E5=91=98=E5=BC=B9=E6=A1=86?=
=?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/modules/marketing.js | 24 ++
src/views/modules/marketing/user/index.vue | 11 +-
.../marketing/user/popup/view-details.vue | 367 +++++++++---------
3 files changed, 211 insertions(+), 191 deletions(-)
diff --git a/src/api/modules/marketing.js b/src/api/modules/marketing.js
index b6c805a..c76760a 100644
--- a/src/api/modules/marketing.js
+++ b/src/api/modules/marketing.js
@@ -161,5 +161,29 @@ export const marketing = {
method: "post",
data
});
+ },
+ //积分明细分页查询
+ pointsChangePage: data => {
+ return $http.request({
+ url: `/merchant-api/membershipUser/pointsChangePage`,
+ method: "post",
+ data
+ });
+ },
+ //成长值变化分页查询
+ growthValueChangePage: data => {
+ return $http.request({
+ url: `/merchant-api/membershipUser/growthValueChangePage`,
+ method: "post",
+ data
+ });
+ },
+ //获取会员优惠券列表
+ memberCouponPage: params => {
+ return $http.request({
+ url: `/merchant-api/coupon/user/page`,
+ method: "get",
+ params
+ });
}
};
diff --git a/src/views/modules/marketing/user/index.vue b/src/views/modules/marketing/user/index.vue
index abc7762..739db63 100644
--- a/src/views/modules/marketing/user/index.vue
+++ b/src/views/modules/marketing/user/index.vue
@@ -379,15 +379,8 @@ export default {
width: "100px",
render: ({ row }) => {
let viewDetails = () => {
- this.$api.marketing
- .memberUnitUserDetail({
- ...this.formInline,
- userId: row.userId
- })
- .then(res => {
- console.log(res);
- this.$refs.viewDetails.toggle(res.data.data).add();
- });
+ // 直接使用列表数据,不再调用memberUnitUserDetail接口
+ this.$refs.viewDetails.toggle(row).add();
};
return (
diff --git a/src/views/modules/marketing/user/popup/view-details.vue b/src/views/modules/marketing/user/popup/view-details.vue
index da34112..c940456 100644
--- a/src/views/modules/marketing/user/popup/view-details.vue
+++ b/src/views/modules/marketing/user/popup/view-details.vue
@@ -39,11 +39,13 @@
会员成长值
-
{{ modalData.memberPoints || 0 }}
+
+ {{ modalData.availablePoints || 0 }}
+
会员积分
-
{{ couponCount }}
+
{{ modalData.couponCount || 0 }}
会员优惠券
@@ -67,7 +69,14 @@
>
+
+
- {{ scope.row.growthChange > 0 ? "+" : ""
- }}{{ scope.row.growthChange }}
+ {{ scope.row.changeValue > 0 ? "+" : ""
+ }}{{ scope.row.changeValue }}
+
+
-
-
-
- {{ scope.row.pointsChange > 0 ? "+" : ""
- }}{{ scope.row.pointsChange }}
-
-
-
+
+
+ {{ scope.row.changeValue > 0 ? "+" : ""
+ }}{{ scope.row.changeValue }}
+
+
+
+
+
+
+
+
-
+
-
+
- {{ scope.row.faceValue }}折
- ¥{{ scope.row.faceValue }}
+
+ {{ scope.row.discount }}折
+
+ ¥{{ scope.row.money }}
+
+
+ 满{{ scope.row.minPrice }}元可用
+
+ 无门槛
+
-
+
+
+ {{ scope.row.useStartTime }} 至 {{ scope.row.useEndTime }}
+
- {{ scope.row.useStatus }}
+ {{ getCouponStatusText(scope.row.status) }}
@@ -391,145 +414,99 @@ export default {
// 加载成长值明细数据
loadGrowthData() {
this.growthLoading = true;
- // 模拟数据,实际应该调用API
- setTimeout(() => {
- this.growthList = [
- {
- changeTime: "2025-07-24 17:20",
- growthChange: 35,
- relatedOrder: "ORD9296",
- changeReason: "订单消费",
- orderAmount: "89.99",
- orderTime: "2025-07-24 17:20",
- shopName: "美食餐厅"
- },
- {
- changeTime: "2025-07-12 17:20",
- growthChange: 100,
- relatedOrder: "-",
- changeReason: "活动奖励",
- description: "参与平台活动获得的成长值奖励"
- },
- {
- changeTime: "2024-01-05 16:45:33",
- growthChange: 30,
- relatedOrder: "ORDER202401503",
- changeReason: "订单消费",
- orderAmount: "65.50",
- orderTime: "2024-01-05 16:45:33",
- shopName: "便利超市"
+
+ const params = {
+ membershipId: this.modalData.id || 0,
+ pageNumber: this.growthPagination.currentPage,
+ pageSize: this.growthPagination.pageSize
+ };
+
+ this.$api.marketing
+ .growthValueChangePage(params)
+ .then(res => {
+ if (res.data.code === "200") {
+ this.growthList = res.data.data.data || [];
+ this.growthPagination.total = res.data.data.total || 0;
+ } else {
+ this.growthList = [];
+ this.growthPagination.total = 0;
+ this.$message.error(res.data.message || "获取成长值明细失败");
}
- ];
- this.growthPagination.total = 3;
- this.growthLoading = false;
- }, 500);
+ })
+ .catch(error => {
+ console.error("获取成长值明细失败:", error);
+ this.growthList = [];
+ this.growthPagination.total = 0;
+ this.$message.error("获取成长值明细失败");
+ })
+ .finally(() => {
+ this.growthLoading = false;
+ });
},
// 加载积分明细数据
loadPointsData() {
this.pointsLoading = true;
- // 模拟数据,实际应该调用API
- setTimeout(() => {
- this.pointsList = [
- {
- changeTime: "2025-07-24 17:20",
- pointsChange: 25,
- changeType: "订单消费",
- relatedOrder: "ORD9296",
- changeReason: "订单消费",
- orderAmount: "78.30",
- orderTime: "2025-07-24 17:20",
- shopName: "运动健身店"
- },
- {
- changeTime: "2025-07-20 15:30",
- pointsChange: -50,
- changeType: "兑换商品",
- relatedOrder: "-",
- changeReason: "兑换商品",
- exchangeProduct: "精美水杯",
- exchangeQuantity: "1个",
- usageDescription:
- "使用50积分兑换商品,兑换成功后积分将被扣除且不可退还。"
- },
- {
- changeTime: "2025-07-12 17:20",
- pointsChange: 80,
- changeType: "完成任务",
- relatedOrder: "-",
- changeReason: "完成任务",
- description: "完成平台指定任务获得的积分奖励"
- },
- {
- changeTime: "2024-01-08 15:45:30",
- pointsChange: 10,
- changeType: "签到奖励",
- relatedOrder: "-",
- changeReason: "签到奖励",
- description: "每日签到获得的积分奖励"
+
+ const params = {
+ membershipId: this.modalData.id || 0,
+ pageNumber: this.pointsPagination.currentPage,
+ pageSize: this.pointsPagination.pageSize
+ };
+
+ this.$api.marketing
+ .pointsChangePage(params)
+ .then(res => {
+ if (res.data.code === "200") {
+ this.pointsList = res.data.data.data || [];
+ this.pointsPagination.total = res.data.data.total || 0;
+ } else {
+ this.pointsList = [];
+ this.pointsPagination.total = 0;
+ this.$message.error(res.data.message || "获取积分明细失败");
}
- ];
- this.pointsPagination.total = 4;
- this.pointsLoading = false;
- }, 500);
+ })
+ .catch(error => {
+ console.error("获取积分明细失败:", error);
+ this.pointsList = [];
+ this.pointsPagination.total = 0;
+ this.$message.error("获取积分明细失败");
+ })
+ .finally(() => {
+ this.pointsLoading = false;
+ });
},
// 加载优惠券数据
loadCouponsData() {
this.couponsLoading = true;
- // 模拟数据,实际应该调用API
- setTimeout(() => {
- this.couponsList = [
- {
- couponName: "新用户专享券",
- couponType: "满减券",
- faceValue: 20,
- useCondition: "满100元可用",
- receiveTime: "2024-01-01 10:00:00",
- validPeriod: "2024-02-01",
- useStatus: "可使用"
- },
- {
- couponName: "生日特惠券",
- couponType: "折扣券",
- faceValue: 9,
- useCondition: "全品类可用",
- receiveTime: "2024-01-05 12:30:15",
- validPeriod: "2024-02-05",
- useStatus: "可使用"
- },
- {
- couponName: "积分兑换券",
- couponType: "满减券",
- faceValue: 50,
- useCondition: "满300元可用",
- receiveTime: "2024-01-10 16:20:30",
- validPeriod: "2024-03-10",
- useStatus: "可使用"
- },
- {
- couponName: "限时抢购券",
- couponType: "满减券",
- faceValue: 10,
- useCondition: "满50元可用",
- receiveTime: "2023-12-20 14:15:20",
- validPeriod: "2024-01-20",
- useStatus: "已过期"
- },
- {
- couponName: "会员专属券",
- couponType: "满减券",
- faceValue: 30,
- useCondition: "满200元可用",
- receiveTime: "2023-12-15 09:45:10",
- validPeriod: "2024-01-15",
- useStatus: "已使用"
+
+ const params = {
+ shopId: this.modalData.shopId || 0,
+ userId: this.modalData.userId || 0,
+ pageNumber: this.couponsPagination.currentPage,
+ pageSize: this.couponsPagination.pageSize
+ };
+
+ this.$api.marketing
+ .memberCouponPage(params)
+ .then(res => {
+ if (res.data.code === "200") {
+ this.couponsList = res.data.data.data || [];
+ this.couponsPagination.total = res.data.data.total || 0;
+ } else {
+ this.couponsList = [];
+ this.couponsPagination.total = 0;
+ this.$message.error(res.data.message || "获取优惠券列表失败");
}
- ];
- this.couponsPagination.total = 5;
- this.couponCount = this.couponsList.filter(
- item => item.useStatus === "可使用"
- ).length;
- this.couponsLoading = false;
- }, 500);
+ })
+ .catch(error => {
+ console.error("获取优惠券列表失败:", error);
+ this.couponsList = [];
+ this.couponsPagination.total = 0;
+ this.$message.error("获取优惠券列表失败");
+ })
+ .finally(() => {
+ this.couponsLoading = false;
+ });
},
// 成长值分页处理
handleGrowthSizeChange(val) {
@@ -565,7 +542,7 @@ export default {
viewPointsDetail(row) {
this.$refs.pointsDetail.show(row);
},
- // 获取状态标签类型
+ // 获取状态标签类型(保留原有方法,用于兼容)
getStatusTagType(status) {
switch (status) {
case "可使用":
@@ -577,6 +554,32 @@ export default {
default:
return "";
}
+ },
+ // 获取优惠券状态标签类型
+ getCouponStatusTagType(status) {
+ switch (status) {
+ case 0: // 可使用
+ return "success";
+ case 1: // 已使用
+ return "info";
+ case 2: // 已过期
+ return "danger";
+ default:
+ return "";
+ }
+ },
+ // 获取优惠券状态文本
+ getCouponStatusText(status) {
+ switch (status) {
+ case 0:
+ return "可使用";
+ case 1:
+ return "已使用";
+ case 2:
+ return "已过期";
+ default:
+ return "未知";
+ }
}
},
computed: {