|
|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<div class="table-box button-table">
|
|
|
- <ProTable ref="proTable" :columns="columns" :request-api="getTableList" :init-param="initParam" :data-callback="dataCallback">
|
|
|
+ <ProTable
|
|
|
+ ref="proTable"
|
|
|
+ :columns="columns"
|
|
|
+ :request-api="getTableList"
|
|
|
+ :init-param="initParam"
|
|
|
+ :data-callback="dataCallback"
|
|
|
+ :refresh-reset-page="true"
|
|
|
+ >
|
|
|
<template #tableHeader="scope">
|
|
|
<div class="action-buttons">
|
|
|
<el-button :icon="Plus" class="button" type="primary" @click="newActivity" v-if="type"> 新建活动 </el-button>
|
|
|
@@ -163,7 +170,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="tsx" name="activityList">
|
|
|
-import { reactive, ref, onMounted, computed } from "vue";
|
|
|
+import { reactive, ref, onMounted, computed, nextTick } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import { Plus } from "@element-plus/icons-vue";
|
|
|
@@ -368,10 +375,13 @@ const getTableList = (params: any) => {
|
|
|
pageNum: params.pageNum ? String(params.pageNum) : undefined,
|
|
|
pageSize: params.pageSize ? String(params.pageSize) : undefined,
|
|
|
status: params.status !== undefined && params.status !== null && params.status !== "" ? Number(params.status) : undefined,
|
|
|
- storeId: params.storeId ? String(params.storeId) : undefined
|
|
|
+ storeId: params.storeId ? String(params.storeId) : undefined,
|
|
|
+ // 处理 activityType:如果存在且不为空,转换为 number 类型
|
|
|
+ activityType:
|
|
|
+ params.activityType !== undefined && params.activityType !== null && params.activityType !== ""
|
|
|
+ ? Number(params.activityType)
|
|
|
+ : undefined
|
|
|
};
|
|
|
- // 移除 activityType 参数(如果存在),因为新接口不支持此参数
|
|
|
- delete newParams.activityType;
|
|
|
return getActivityList(newParams);
|
|
|
};
|
|
|
|
|
|
@@ -414,8 +424,8 @@ const deleteRow = (row: any) => {
|
|
|
|
|
|
// 修改状态(上架/下架)
|
|
|
const changeStatus = async (row: any, status: number) => {
|
|
|
- const res = await updateActivityStatus({ id: row.id, status: status });
|
|
|
- if (res && res.code == 200) {
|
|
|
+ const res: any = await updateActivityStatus({ id: row.id, status: status });
|
|
|
+ if (res && (res.code === 200 || res.code === "200")) {
|
|
|
ElMessage.success("操作成功");
|
|
|
proTable.value?.getTableList();
|
|
|
}
|
|
|
@@ -518,7 +528,8 @@ const handleResultImageExceed: UploadProps["onExceed"] = () => {
|
|
|
|
|
|
// 预览活动结果图片
|
|
|
const handleResultImagePreview: UploadProps["onPreview"] = (uploadFile: UploadFile) => {
|
|
|
- const url = uploadFile.url || uploadFile.response?.url || uploadFile.response?.data?.[0];
|
|
|
+ const response = uploadFile.response as any;
|
|
|
+ const url = uploadFile.url || response?.url || (Array.isArray(response?.data) ? response.data[0] : null);
|
|
|
if (url) {
|
|
|
resultImageViewerUrlList.value = [url];
|
|
|
resultImageViewerInitialIndex.value = 0;
|