lxr 1 miesiąc temu
rodzic
commit
63cdc10221
1 zmienionych plików z 16 dodań i 12 usunięć
  1. 16 12
      src/views/dynamicManagement/friendCoupon.vue

+ 16 - 12
src/views/dynamicManagement/friendCoupon.vue

@@ -205,12 +205,13 @@ const friendMessageColumns = reactive<ColumnProps<any>[]>([
       props: { placeholder: "请选择" }
     },
     enum: [
-      { label: "满减券", value: 1 },
-      { label: "折扣券", value: 2 }
+      { label: "满减券", value: "1" },
+      { label: "折扣券", value: "2" }
     ],
     render: (scope: any) => {
-      const typeMap: Record<number, string> = { 1: "满减券", 2: "折扣券" };
-      return typeMap[scope.row.type] ?? scope.row.couponTypeName ?? "--";
+      const typeMap: Record<string, string> = { "1": "满减券", "2": "折扣券" };
+      const val = scope.row.couponType ?? scope.row.type;
+      return typeMap[String(val)] ?? scope.row.couponTypeName ?? "--";
     }
   },
   {
@@ -245,12 +246,13 @@ const myGiftColumns = reactive<ColumnProps<any>[]>([
       props: { placeholder: "请选择" }
     },
     enum: [
-      { label: "满减券", value: 1 },
-      { label: "折扣券", value: 2 }
+      { label: "满减券", value: "1" },
+      { label: "折扣券", value: "2" }
     ],
     render: (scope: any) => {
-      const typeMap: Record<number, string> = { 1: "满减券", 2: "折扣券" };
-      return typeMap[scope.row.type] ?? scope.row.couponTypeName ?? "--";
+      const typeMap: Record<string, string> = { "1": "满减券", "2": "折扣券" };
+      const val = scope.row.couponType ?? scope.row.type;
+      return typeMap[String(val)] ?? scope.row.couponTypeName ?? "--";
     }
   },
   {
@@ -296,17 +298,19 @@ const dataCallback = (data: any) => {
 
 // 获取表格列表:接口参数 storeUserId、storeName、couponType、queryType(1=好友赠我 2=我赠好友)、分页
 const getTableList = (params: any) => {
+  let storeUserId = localGet("geeker-user")?.userInfo?.id;
   const newParams: any = {
-    storeUserId: "386",
+    storeUserId: storeUserId,
     storeName: params.storeName ?? "",
     type: 1,
     queryType: activeName.value === "friendMessage" ? 1 : 2,
     page: params.pageNum ?? 1,
     size: params.pageSize ?? 10
   };
-  // 优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券
-  if (params.couponType === 1 || params.couponType === 2) {
-    newParams.couponType = params.couponType;
+  // 优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券(搜索框可能传字符串 '1'/'2')
+  const couponType = params.couponType != null && params.couponType !== "" ? Number(params.couponType) : undefined;
+  if (couponType === 1 || couponType === 2) {
+    newParams.couponType = couponType;
   }
   return getFriendCouponList(newParams);
 };