|
@@ -187,71 +187,83 @@ const giftRules = reactive<FormRules>({
|
|
|
quantity: [{ required: true, message: "请输入赠送数量", trigger: "blur" }]
|
|
quantity: [{ required: true, message: "请输入赠送数量", trigger: "blur" }]
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 好友留言表格列配置
|
|
|
|
|
|
|
+// 好友赠我表格列配置(与截图一致:店铺名称、类型、数量、结束时间、操作)
|
|
|
const friendMessageColumns = reactive<ColumnProps<any>[]>([
|
|
const friendMessageColumns = reactive<ColumnProps<any>[]>([
|
|
|
{
|
|
{
|
|
|
prop: "storeName",
|
|
prop: "storeName",
|
|
|
label: "店铺名称",
|
|
label: "店铺名称",
|
|
|
search: {
|
|
search: {
|
|
|
- el: "input"
|
|
|
|
|
|
|
+ el: "input",
|
|
|
|
|
+ props: { placeholder: "请输入" }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: "couponName",
|
|
|
|
|
- label: "优惠券名称"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: "nominalValue",
|
|
|
|
|
- label: "优惠券额",
|
|
|
|
|
|
|
+ prop: "couponType",
|
|
|
|
|
+ label: "类型",
|
|
|
|
|
+ search: {
|
|
|
|
|
+ el: "select",
|
|
|
|
|
+ props: { placeholder: "请选择" }
|
|
|
|
|
+ },
|
|
|
|
|
+ enum: [
|
|
|
|
|
+ { label: "满减券", value: 1 },
|
|
|
|
|
+ { label: "折扣券", value: 2 }
|
|
|
|
|
+ ],
|
|
|
render: (scope: any) => {
|
|
render: (scope: any) => {
|
|
|
- return `¥${scope.row.nominalValue || 0}`;
|
|
|
|
|
|
|
+ const typeMap: Record<number, string> = { 1: "满减券", 2: "折扣券" };
|
|
|
|
|
+ return typeMap[scope.row.type] ?? scope.row.couponTypeName ?? "--";
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
|
|
+ prop: "couponNum",
|
|
|
|
|
+ label: "数量"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
prop: "endDate",
|
|
prop: "endDate",
|
|
|
- label: "有效期至",
|
|
|
|
|
|
|
+ label: "结束时间",
|
|
|
render: (scope: any) => {
|
|
render: (scope: any) => {
|
|
|
return scope.row.endDate?.replace(/-/g, "/") || "--";
|
|
return scope.row.endDate?.replace(/-/g, "/") || "--";
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- prop: "couponNum",
|
|
|
|
|
- label: "优惠券数量"
|
|
|
|
|
- },
|
|
|
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
-// 我赠好友表格列配置
|
|
|
|
|
|
|
+// 我赠好友表格列配置(与好友赠我保持一致)
|
|
|
const myGiftColumns = reactive<ColumnProps<any>[]>([
|
|
const myGiftColumns = reactive<ColumnProps<any>[]>([
|
|
|
{
|
|
{
|
|
|
prop: "storeName",
|
|
prop: "storeName",
|
|
|
label: "店铺名称",
|
|
label: "店铺名称",
|
|
|
search: {
|
|
search: {
|
|
|
- el: "input"
|
|
|
|
|
|
|
+ el: "input",
|
|
|
|
|
+ props: { placeholder: "请输入" }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: "couponName",
|
|
|
|
|
- label: "优惠券名称"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: "nominalValue",
|
|
|
|
|
- label: "优惠券额",
|
|
|
|
|
|
|
+ prop: "couponType",
|
|
|
|
|
+ label: "类型",
|
|
|
|
|
+ search: {
|
|
|
|
|
+ el: "select",
|
|
|
|
|
+ props: { placeholder: "请选择" }
|
|
|
|
|
+ },
|
|
|
|
|
+ enum: [
|
|
|
|
|
+ { label: "满减券", value: 1 },
|
|
|
|
|
+ { label: "折扣券", value: 2 }
|
|
|
|
|
+ ],
|
|
|
render: (scope: any) => {
|
|
render: (scope: any) => {
|
|
|
- return `¥${scope.row.nominalValue || 0}`;
|
|
|
|
|
|
|
+ const typeMap: Record<number, string> = { 1: "满减券", 2: "折扣券" };
|
|
|
|
|
+ return typeMap[scope.row.type] ?? scope.row.couponTypeName ?? "--";
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
|
|
+ prop: "couponNum",
|
|
|
|
|
+ label: "数量"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
prop: "endDate",
|
|
prop: "endDate",
|
|
|
- label: "有效期至",
|
|
|
|
|
|
|
+ label: "结束时间",
|
|
|
render: (scope: any) => {
|
|
render: (scope: any) => {
|
|
|
return scope.row.endDate?.replace(/-/g, "/") || "--";
|
|
return scope.row.endDate?.replace(/-/g, "/") || "--";
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- prop: "couponNum",
|
|
|
|
|
- label: "优惠券数量"
|
|
|
|
|
- },
|
|
|
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
@@ -259,46 +271,43 @@ const myGiftColumns = reactive<ColumnProps<any>[]>([
|
|
|
const columns = computed(() => {
|
|
const columns = computed(() => {
|
|
|
return activeName.value === "friendMessage" ? friendMessageColumns : myGiftColumns;
|
|
return activeName.value === "friendMessage" ? friendMessageColumns : myGiftColumns;
|
|
|
});
|
|
});
|
|
|
-// 初始化请求参数 - 好友赠我传 storeUserId
|
|
|
|
|
-const initParam = reactive({
|
|
|
|
|
- storeUserId: localGet("createdId"), // 好友赠我:当前店铺ID(接收方)
|
|
|
|
|
- friendStoreUserId: undefined as number | undefined // 我赠好友:当前用户ID(赠送方)
|
|
|
|
|
- // type: activeName.value
|
|
|
|
|
|
|
+// 初始化请求参数:列表接口格式 storeUserId、storeName、type、queryType(queryType 1=好友赠我 2=我赠好友)
|
|
|
|
|
+const initParam = reactive<Record<string, any>>({
|
|
|
|
|
+ storeUserId: localGet("createdId") ?? "",
|
|
|
|
|
+ queryType: 1
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// Tab切换处理
|
|
|
|
|
|
|
+// Tab 切换处理:queryType 1=好友赠我,2=我赠好友
|
|
|
const handleTabClick = () => {
|
|
const handleTabClick = () => {
|
|
|
- // initParam.type = activeName.value;
|
|
|
|
|
-
|
|
|
|
|
- // 根据当前 tab 设置正确的参数
|
|
|
|
|
- if (activeName.value === "myGift") {
|
|
|
|
|
- // 好友赠我:传 storeUserId
|
|
|
|
|
- initParam.storeUserId = localGet("createdId");
|
|
|
|
|
- initParam.friendStoreUserId = undefined;
|
|
|
|
|
- } else {
|
|
|
|
|
- // 我赠好友:传 friendStoreUserId
|
|
|
|
|
- initParam.storeUserId = undefined;
|
|
|
|
|
- initParam.friendStoreUserId = localGet("geeker-user").userInfo.id;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ initParam.queryType = activeName.value === "friendMessage" ? 1 : 2;
|
|
|
proTable.value?.getTableList();
|
|
proTable.value?.getTableList();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// dataCallback 是对于返回的表格数据做处理
|
|
|
|
|
|
|
+// dataCallback:兼容后端返回格式——data 直接为数组 或 { records/list, total },统一为 { list, total }
|
|
|
const dataCallback = (data: any) => {
|
|
const dataCallback = (data: any) => {
|
|
|
- return {
|
|
|
|
|
- list: data || [],
|
|
|
|
|
- total: data?.length || 0
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ if (!data) return { list: [], total: 0 };
|
|
|
|
|
+ if (Array.isArray(data)) {
|
|
|
|
|
+ return { list: data, total: data.length };
|
|
|
|
|
+ }
|
|
|
|
|
+ const list = data.records ?? data.list ?? [];
|
|
|
|
|
+ const total = data.total ?? list.length;
|
|
|
|
|
+ return { list, total };
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 获取表格列表
|
|
|
|
|
|
|
+// 获取表格列表:接口参数 storeUserId、storeName、couponType、queryType(1=好友赠我 2=我赠好友)、分页
|
|
|
const getTableList = (params: any) => {
|
|
const getTableList = (params: any) => {
|
|
|
- const newParams = {
|
|
|
|
|
- ...params
|
|
|
|
|
- //type: activeName.value === "friendMessage" ? 0 : 1 // 0-好友赠我,1-我赠好友
|
|
|
|
|
|
|
+ const newParams: any = {
|
|
|
|
|
+ storeUserId: "386",
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }
|
|
|
return getFriendCouponList(newParams);
|
|
return getFriendCouponList(newParams);
|
|
|
};
|
|
};
|
|
|
|
|
|