From 5596ea666d2b2b69ab4d18740c4074ad4cc53dd6 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 22 十月 2025 16:29:10 +0800
Subject: [PATCH] 用户行为分析调整

---
 manager/src/views/userAction/userActionRecord.vue |  776 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 manager/src/api/userAction.js                     |    7 
 2 files changed, 783 insertions(+), 0 deletions(-)

diff --git a/manager/src/api/userAction.js b/manager/src/api/userAction.js
index f1103bc..08b8323 100644
--- a/manager/src/api/userAction.js
+++ b/manager/src/api/userAction.js
@@ -18,4 +18,11 @@
     method: "GET",
     params: params
   })
+}//鑾峰彇鐢ㄦ埛鍒嗕韩椤甸潰
+export const userStayListRecord = (params) =>{
+  return service({
+    url: "/lmk/action-record/userStayListRecord",
+    method: "GET",
+    params: params
+  })
 }
diff --git a/manager/src/views/userAction/userActionRecord.vue b/manager/src/views/userAction/userActionRecord.vue
new file mode 100644
index 0000000..85a6a68
--- /dev/null
+++ b/manager/src/views/userAction/userActionRecord.vue
@@ -0,0 +1,776 @@
+<template>
+  <div class="wrapper">
+    <Card class="user-action-card">
+      <Row @keydown.enter.native="handleSearch">
+        <Form ref="searchForm" :model="searchForm" inline :label-width="80" style="width: 100%" class="search-form">
+          <Form-item label="鐢ㄦ埛鏄电О" prop="userName">
+            <Input type="text" v-model="searchForm.userName" placeholder="璇疯緭鍏ョ敤鎴锋樀绉�" clearable style="width: 200px" />
+          </Form-item>
+<!--          <Form-item label="椤甸潰绫诲瀷" prop="pageCode">-->
+<!--            <Select-->
+<!--              v-model="searchForm.pageCode"-->
+<!--              clearable-->
+<!--              filterable-->
+<!--              style="width: 200px"-->
+<!--              placeholder="璇烽�夋嫨椤甸潰绫诲瀷">-->
+<!--              <Option-->
+<!--                v-for="item in pageTypeOptions"-->
+<!--                :key="item.value"-->
+<!--                :value="item.value"-->
+<!--                :label="item.label">-->
+<!--                {{ item.label }}-->
+<!--              </Option>-->
+<!--            </Select>-->
+<!--          </Form-item>-->
+          <Form-item label="寮�濮嬫椂闂�" prop="beginDate">
+            <DatePicker
+              v-model="searchForm.beginDate"
+              type="datetime"
+              placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
+              style="width: 200px">
+            </DatePicker>
+          </Form-item>
+          <Form-item label="缁撴潫鏃堕棿" prop="endDate">
+            <DatePicker
+              v-model="searchForm.endDate"
+              type="datetime"
+              placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
+              style="width: 200px">
+            </DatePicker>
+          </Form-item>
+          <Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">鎼滅储</Button>
+          <Button @click="handleReset" type="default" class="search-btn">閲嶇疆</Button>
+        </Form>
+      </Row>
+      <div class="table-container">
+        <Table
+          :loading="loading"
+          border
+          :columns="columns"
+          :data="data"
+          ref="table">
+        </Table>
+      </div>
+      <Row type="flex" justify="end" class="mt_10">
+        <Page
+          :current="searchForm.pageNumber"
+          :total="total"
+          :page-size="searchForm.pageSize"
+          @on-change="changePage"
+          @on-page-size-change="changePageSize"
+          :page-size-opts="[10, 20, 50]"
+          size="small"
+          show-total
+          show-elevator
+          show-sizer>
+        </Page>
+      </Row>
+    </Card>
+    
+    <!-- 鐢ㄦ埛琛屼负璇︽儏寮圭獥 -->
+    <Modal
+      v-model="detailModalVisible"
+      title="鐢ㄦ埛琛屼负璇︽儏"
+      width="80%"
+      :loading="detailLoading"
+      :footer-hide="true">
+      <Spin size="large" fix v-if="detailLoading"></Spin>
+      <div v-else>
+        <!-- 璇︽儏绛涢�夋潯浠� -->
+        <Row @keydown.enter.native="handleDetailSearch">
+          <Form ref="detailSearchForm" :model="detailSearchForm" inline :label-width="80" style="width: 100%" class="search-form">
+            <Form-item label="鐢ㄦ埛鏄电О" prop="userName">
+              <Input type="text" v-model="detailSearchForm.userName" placeholder="璇疯緭鍏ョ敤鎴锋樀绉�" clearable style="width: 200px" />
+            </Form-item>
+            <Form-item label="椤甸潰绫诲瀷" prop="pageCode">
+              <Select 
+                v-model="detailSearchForm.pageCode" 
+                clearable 
+                filterable
+                style="width: 200px"
+                placeholder="璇烽�夋嫨椤甸潰绫诲瀷">
+                <Option 
+                  v-for="item in pageTypeOptions" 
+                  :key="item.value" 
+                  :value="item.value"
+                  :label="item.label">
+                  {{ item.label }}
+                </Option>
+              </Select>
+            </Form-item>
+            <Form-item label="寮�濮嬫椂闂�" prop="beginDate">
+              <DatePicker
+                v-model="detailSearchForm.beginDate"
+                type="datetime"
+                placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
+                style="width: 200px">
+              </DatePicker>
+            </Form-item>
+            <Form-item label="缁撴潫鏃堕棿" prop="endDate">
+              <DatePicker
+                v-model="detailSearchForm.endDate"
+                type="datetime"
+                placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
+                style="width: 200px">
+              </DatePicker>
+            </Form-item>
+            <Button @click="handleDetailSearch" type="primary" icon="ios-search" class="search-btn">鎼滅储</Button>
+            <Button @click="handleDetailReset" type="default" class="search-btn">閲嶇疆</Button>
+          </Form>
+        </Row>
+        <div class="table-container">
+          <Table
+            :loading="detailTableLoading"
+            border
+            :columns="detailColumns"
+            :data="detailData"
+            ref="detailTable">
+          </Table>
+        </div>
+        <Row type="flex" justify="end" class="mt_10">
+          <Page
+            :current="detailSearchForm.pageNumber"
+            :total="detailTotal"
+            :page-size="detailSearchForm.pageSize"
+            @on-change="changeDetailPage"
+            @on-page-size-change="changeDetailPageSize"
+            :page-size-opts="[10, 20, 50]"
+            size="small"
+            show-total
+            show-elevator
+            show-sizer>
+          </Page>
+        </Row>
+      </div>
+    </Modal>
+  </div>
+</template>
+
+<script>
+import { userStayList, userStayListRecord } from "@/api/userAction";
+import { formatDate } from "@/utils/filters";
+
+export default {
+  name: "userAction",
+  data() {
+    // 璁剧疆榛樿鏃堕棿鏀逛负鏈�杩�7澶�
+    const now = new Date();
+    const endTime = new Date(now);
+    endTime.setHours(23, 59, 59, 999);
+
+    // 寮�濮嬫椂闂翠负7澶╁墠锛堝寘鍚粖澶╋紝鎬诲叡7澶╋級
+    const startTime = new Date(now);
+    startTime.setDate(startTime.getDate() - 6);
+    startTime.setHours(0, 0, 0, 0);
+
+    console.log("榛樿寮�濮嬫椂闂�(鏈�杩�7澶�):", startTime);
+    console.log("榛樿缁撴潫鏃堕棿:", endTime);
+    console.log("寮�濮嬫椂闂寸被鍨�:", typeof startTime);
+    console.log("缁撴潫鏃堕棿绫诲瀷:", typeof endTime);
+
+    // 楠岃瘉鏃ユ湡鏍煎紡鍖栨槸鍚︽甯稿伐浣�
+    try {
+      const formattedStart = formatDate(startTime, 'yyyy-MM-dd hh:mm:ss');
+      const formattedEnd = formatDate(endTime, 'yyyy-MM-dd hh:mm:ss');
+      console.log("榛樿寮�濮嬫椂闂存牸寮忓寲缁撴灉:", formattedStart);
+      console.log("榛樿缁撴潫鏃堕棿鏍煎紡鍖栫粨鏋�:", formattedEnd);
+    } catch (e) {
+      console.error("鍒濆鍖栨椂鏃ユ湡鏍煎紡鍖栧嚭閿�:", e);
+    }
+
+    return {
+      loading: false, // 榛樿涓嶅姞杞�
+      searchForm: {
+        pageNumber: 1,
+        pageSize: 10,
+        userName: "",
+        pageCode: "",
+        beginDate: startTime,
+        endDate: endTime
+      },
+      // 椤甸潰绫诲瀷閫夐」锛堢敤浜庝笅鎷夋锛�
+      pageTypeOptions: [
+        { value: "RECOMMEND_VIDEO", label: "棣栭〉鎺ㄨ崘瑙嗛" },
+        { value: "HEALTH_VIDEO", label: "澶у仴搴疯棰�" },
+        { value: "KITCHEN_VIDEO", label: "绁炲帹瑙嗛" },
+        { value: "RECOMMEND_VIDEO_GOODS", label: "瑙嗛鎺ㄨ崘鍟嗗搧椤甸潰" },
+        { value: "RECOMMEND_VIDEO_LEFT_GOODS", label: "宸︽粦鎺ㄨ崘鍟嗗搧" },
+        { value: "RECOMMEND_VIDEO_RIGHT_VIDEO", label: "鍙虫粦瑙嗛椤甸潰" },
+        { value: "FILL_ORDER", label: "濉啓璁㈠崟" },
+        { value: "PAY_ORDER", label: "鏀粯璁㈠崟" },
+        { value: "PAY_SUCCESS", label: "鏀粯鎴愬姛" },
+        { value: "ORDER_LIST", label: "璁㈠崟鍒楄〃" },
+        { value: "ORDER_DETAIL", label: "璁㈠崟璇︽儏" },
+        { value: "PRIZE_DETAIL", label: "鎶藉娲诲姩" },
+        { value: "CART_LIST", label: "璐墿杞�" },
+        { value: "TBA_BAR_MY", label: "鎴戠殑椤甸潰" },
+        { value: "SHOPPING_SQUARE", label: "鍟嗗搧骞垮満" },
+        { value: "ACTIVITY_LIST", label: "娲诲姩鍒楄〃" },
+        { value: "ACTIVITY_DETAIL", label: "娲诲姩璇︽儏" },
+        { value: "PUBLISH_VIDEO", label: "瑙嗛鍙戝竷" },
+        { value: "SWIPER_GOODS", label: "婊戝姩鍟嗗搧" },
+        { value: "COUPON_CENTER", label: "棰嗗嵎涓績" },
+        { value: "MY_COUPON", label: "鎴戠殑浼樻儬鍗�" },
+        { value: "AFTER_SALE", label: "鍞悗鍒楄〃" },
+        { value: "APPLY_SALE", label: "鐢宠鍞悗" },
+        { value: "REFUND_ORDER", label: "閫�娆�/閫�璐�" },
+        { value: "GOODS_DETAILS", label: "鍟嗗搧璇︽儏椤甸潰" }
+      ],
+      columns: [
+        {
+          title: "鐢ㄦ埛鍚嶇О",
+          key: "userId",
+          minWidth: 120
+        },
+        {
+          title: "鐢ㄦ埛鏄电О",
+          key: "nickName",
+          minWidth: 100
+        },
+        {
+          title: "椤甸潰绫诲瀷",
+          key: "pageCode",
+          minWidth: 150,
+          render: (h, params) => {
+            const pageCodes = {
+              "RECOMMEND_VIDEO": "棣栭〉鎺ㄨ崘瑙嗛",
+              "HEALTH_VIDEO": "澶у仴搴疯棰�",
+              "KITCHEN_VIDEO": "绁炲帹瑙嗛",
+              "RECOMMEND_VIDEO_GOODS": "瑙嗛鎺ㄨ崘鍟嗗搧椤甸潰",
+              "RECOMMEND_VIDEO_LEFT_GOODS": "宸︽粦鎺ㄨ崘鍟嗗搧",
+              "RECOMMEND_VIDEO_RIGHT_VIDEO": "鍙虫粦瑙嗛椤甸潰",
+              "FILL_ORDER": "濉啓璁㈠崟",
+              "PAY_ORDER": "鏀粯璁㈠崟",
+              "PAY_SUCCESS": "鏀粯鎴愬姛",
+              "ORDER_LIST": "璁㈠崟鍒楄〃",
+              "ORDER_DETAIL": "璁㈠崟璇︽儏",
+              "PRIZE_DETAIL": "鎶藉娲诲姩",
+              "CART_LIST": "璐墿杞�",
+              "TBA_BAR_MY": "鎴戠殑椤甸潰",
+              "SHOPPING_SQUARE": "鍟嗗搧骞垮満",
+              "ACTIVITY_LIST": "娲诲姩鍒楄〃",
+              "ACTIVITY_DETAIL": "娲诲姩璇︽儏",
+              "PUBLISH_VIDEO": "瑙嗛鍙戝竷",
+              "SWIPER_GOODS": "婊戝姩鍟嗗搧",
+              "COUPON_CENTER": "棰嗗嵎涓績",
+              "MY_COUPON": "鎴戠殑浼樻儬鍗�",
+              "AFTER_SALE": "鍞悗鍒楄〃",
+              "APPLY_SALE": "鐢宠鍞悗",
+              "REFUND_ORDER": "閫�娆�/閫�璐�",
+              "GOODS_DETAILS": "鍟嗗搧璇︽儏椤甸潰"
+            };
+            return h('span', pageCodes[params.row.pageCode] || params.row.pageCode);
+          }
+        },
+        {
+          title: "杩涘叆鏃堕棿",
+          key: "startTime",
+          minWidth: 160
+        },
+        {
+          title: "鎿嶄綔",
+          key: "action",
+          width: 150,
+          align: "center",
+          render: (h, params) => {
+            // 娣诲姞鏌ョ湅璇︽儏鎸夐挳
+            return h('div', [
+              h('Button', {
+                props: {
+                  type: 'primary',
+                  size: 'small'
+                },
+                on: {
+                  click: () => {
+                    this.showDetailModal(params.row.userId);
+                  }
+                }
+              }, '鏌ョ湅'),
+              // 鍙湁褰撻〉闈㈢被鍨嬫槸鍟嗗搧璇︽儏椤甸潰鏃舵墠鏄剧ず璺宠浆鎸夐挳
+              params.row.pageCode === "GOODS_DETAILS" && params.row.pageParams ? h('Button', {
+                props: {
+                  type: 'primary',
+                  size: 'small',
+                  style: { marginLeft: '5px' }
+                },
+                on: {
+                  click: () => {
+                    this.goToGoodsDetail(params.row.pageParams);
+                  }
+                }
+              }, '鏌ョ湅鍟嗗搧璇︽儏') : null,
+              // 褰撻〉闈㈢被鍨嬫槸璁㈠崟璇︽儏椤甸潰鏃舵樉绀鸿烦杞寜閽�
+              params.row.pageCode === "ORDER_DETAIL" && params.row.pageParams ? h('Button', {
+                props: {
+                  type: 'primary',
+                  size: 'small',
+                  style: { marginLeft: '5px' }
+                },
+                on: {
+                  click: () => {
+                    this.goToOrderDetail(params.row.pageParams);
+                  }
+                }
+              }, '鏌ョ湅璁㈠崟璇︽儏') : null
+            ].filter(item => item !== null));
+          }
+        }
+      ],
+      data: [],
+      total: 0,
+      // 璇︽儏寮圭獥鐩稿叧鏁版嵁
+      detailModalVisible: false,
+      detailLoading: false,
+      detailTableLoading: false,
+      detailSearchForm: {
+        pageNumber: 1,
+        pageSize: 10,
+        userId: "",
+        userName: "",
+        pageCode: "",
+        beginDate: startTime,
+        endDate: endTime
+      },
+      detailColumns: [
+        {
+          title: "鐢ㄦ埛鍚嶇О",
+          key: "userId",
+          minWidth: 120
+        },
+        {
+          title: "鐢ㄦ埛鏄电О",
+          key: "nickName",
+          minWidth: 100
+        },
+        {
+          title: "浼氳瘽ID",
+          key: "sessionId",
+          minWidth: 150
+        },
+        {
+          title: "椤甸潰绫诲瀷",
+          key: "pageCode",
+          minWidth: 150,
+          render: (h, params) => {
+            const pageCodes = {
+              "RECOMMEND_VIDEO": "棣栭〉鎺ㄨ崘瑙嗛",
+              "HEALTH_VIDEO": "澶у仴搴疯棰�",
+              "KITCHEN_VIDEO": "绁炲帹瑙嗛",
+              "RECOMMEND_VIDEO_GOODS": "瑙嗛鎺ㄨ崘鍟嗗搧椤甸潰",
+              "RECOMMEND_VIDEO_LEFT_GOODS": "宸︽粦鎺ㄨ崘鍟嗗搧",
+              "RECOMMEND_VIDEO_RIGHT_VIDEO": "鍙虫粦瑙嗛椤甸潰",
+              "FILL_ORDER": "濉啓璁㈠崟",
+              "PAY_ORDER": "鏀粯璁㈠崟",
+              "PAY_SUCCESS": "鏀粯鎴愬姛",
+              "ORDER_LIST": "璁㈠崟鍒楄〃",
+              "ORDER_DETAIL": "璁㈠崟璇︽儏",
+              "PRIZE_DETAIL": "鎶藉娲诲姩",
+              "CART_LIST": "璐墿杞�",
+              "TBA_BAR_MY": "鎴戠殑椤甸潰",
+              "SHOPPING_SQUARE": "鍟嗗搧骞垮満",
+              "ACTIVITY_LIST": "娲诲姩鍒楄〃",
+              "ACTIVITY_DETAIL": "娲诲姩璇︽儏",
+              "PUBLISH_VIDEO": "瑙嗛鍙戝竷",
+              "SWIPER_GOODS": "婊戝姩鍟嗗搧",
+              "COUPON_CENTER": "棰嗗嵎涓績",
+              "MY_COUPON": "鎴戠殑浼樻儬鍗�",
+              "AFTER_SALE": "鍞悗鍒楄〃",
+              "APPLY_SALE": "鐢宠鍞悗",
+              "REFUND_ORDER": "閫�娆�/閫�璐�",
+              "GOODS_DETAILS": "鍟嗗搧璇︽儏椤甸潰"
+            };
+            return h('span', pageCodes[params.row.pageCode] || params.row.pageCode);
+          }
+        },
+        {
+          title: "椤甸潰鍚嶇О",
+          key: "pageNameCn",
+          minWidth: 150
+        },
+        {
+          title: "杩涘叆鏃堕棿",
+          key: "enterTime",
+          minWidth: 160
+        },
+        {
+          title: "绂诲紑鏃堕棿",
+          key: "leaveTime",
+          minWidth: 160
+        },
+        {
+          title: "鍋滅暀鏃堕暱(绉�)",
+          key: "staySeconds",
+          minWidth: 120
+        },
+        {
+          title: "鎿嶄綔",
+          key: "action",
+          width: 150,
+          align: "center",
+          render: (h, params) => {
+            // 鍙湁褰撻〉闈㈢被鍨嬫槸鍟嗗搧璇︽儏椤甸潰鏃舵墠鏄剧ず璺宠浆鎸夐挳
+            if (params.row.pageCode === "GOODS_DETAILS" && params.row.pageParams) {
+              return h('div', [
+                h('Button', {
+                  props: {
+                    type: 'primary',
+                    size: 'small'
+                  },
+                  on: {
+                    click: () => {
+                      this.goToGoodsDetail(params.row.pageParams);
+                    }
+                  }
+                }, '鏌ョ湅鍟嗗搧璇︽儏')
+              ]);
+            }
+            // 褰撻〉闈㈢被鍨嬫槸璁㈠崟璇︽儏椤甸潰鏃舵樉绀鸿烦杞寜閽�
+            if (params.row.pageCode === "ORDER_DETAIL" && params.row.pageParams) {
+              return h('div', [
+                h('Button', {
+                  props: {
+                    type: 'primary',
+                    size: 'small'
+                  },
+                  on: {
+                    click: () => {
+                      this.goToOrderDetail(params.row.pageParams);
+                    }
+                  }
+                }, '鏌ョ湅璁㈠崟璇︽儏')
+              ]);
+            }
+            return h('span', '-');
+          }
+        }
+      ],
+      detailData: [],
+      detailTotal: 0
+    };
+  },
+  methods: {
+    // 鍒濆鍖栨暟鎹�
+    init() {
+      console.log("鎵цinit鏂规硶锛屽噯澶囧姞杞芥暟鎹�");
+      // 椤甸潰鍒濆鍖栨椂鐩存帴璋冪敤锛屾鏌ユ椂闂村弬鏁�
+      this.$nextTick(() => {
+        console.log("init鏂规硶涓殑nextTick鍥炶皟锛岃皟鐢╣etDataListWithoutValidation");
+        this.getDataListWithoutValidation();
+      });
+    },
+    // 鑾峰彇鏈�杩�7澶╃殑寮�濮嬫椂闂达紙鍖呭惈浠婂ぉ锛屾�诲叡7澶╋級
+    getDefaultBeginDate() {
+      const now = new Date();
+      const startTime = new Date(now);
+      startTime.setDate(startTime.getDate() - 6); // 7澶╁墠锛屽寘鍚粖澶�
+      startTime.setHours(0, 0, 0, 0);
+      return startTime;
+    },
+    // 鑾峰彇褰撳ぉ缁撴潫鏃堕棿
+    getDefaultEndDate() {
+      const now = new Date();
+      now.setHours(23, 59, 59, 999);
+      return now;
+    },
+    // 涓嶈繘琛岃〃鍗曢獙璇佺殑鏁版嵁鑾峰彇
+    getDataListWithoutValidation() {
+      this.loading = true;
+      console.log("寮�濮嬭姹傛暟鎹�:", this.searchForm);
+      console.log("寮�濮嬫椂闂村��:", this.searchForm.beginDate);
+      console.log("缁撴潫鏃堕棿鍊�:", this.searchForm.endDate);
+      console.log("寮�濮嬫椂闂寸被鍨�:", typeof this.searchForm.beginDate);
+      console.log("缁撴潫鏃堕棿绫诲瀷:", typeof this.searchForm.endDate);
+
+      // 妫�鏌ユ椂闂村弬鏁版槸鍚︿负绌�
+      if (!this.searchForm.beginDate) {
+        console.log("寮�濮嬫椂闂翠负绌�");
+      }
+      if (!this.searchForm.endDate) {
+        console.log("缁撴潫鏃堕棿涓虹┖");
+      }
+
+      // 澶勭悊鏃堕棿鏍煎紡锛屼娇鐢ㄦ纭殑鍙傛暟鍚嶇ОbeginDate鍜宔ndDate
+      const params = { ...this.searchForm };
+      if (params.beginDate) {
+        params.beginDate = this.formatDate(params.beginDate);
+        console.log("鏍煎紡鍖栧悗鐨勫紑濮嬫椂闂�:", params.beginDate);
+      } else {
+        this.loading = false;
+        this.$Message.error("寮�濮嬫椂闂翠笉鑳戒负绌�");
+        return;
+      }
+      if (params.endDate) {
+        params.endDate = this.formatDate(params.endDate);
+        console.log("鏍煎紡鍖栧悗鐨勭粨鏉熸椂闂�:", params.endDate);
+      } else {
+        this.loading = false;
+        this.$Message.error("缁撴潫鏃堕棿涓嶈兘涓虹┖");
+        return;
+      }
+
+      console.log("鏈�缁堣姹傚弬鏁�:", params);
+
+      userStayListRecord(params).then(res => {
+        console.log("璇锋眰鎴愬姛:", res);
+        if (res.code === 200) {
+          this.data = res.data.records || [];
+          this.total = res.data.total || 0;
+          console.log("鏁版嵁鍔犺浇瀹屾垚锛岃褰曟暟:", this.data.length);
+        } else {
+          this.$Message.error(res.msg || "鑾峰彇鏁版嵁澶辫触");
+          console.error("鑾峰彇鏁版嵁澶辫触:", res.msg || "鏈煡閿欒");
+        }
+      }).catch(err => {
+        console.error("璇锋眰澶辫触:", err);
+        this.$Message.error("璇锋眰寮傚父: " + (err.message || "鏈煡閿欒"));
+      }).finally(() => {
+        // 纭繚鍦ㄤ换浣曟儏鍐典笅閮藉叧闂璴oading鐘舵��
+        this.loading = false;
+        console.log("璇锋眰瀹屾垚锛宭oading鐘舵�佸凡鍏抽棴");
+      });
+    },
+    // 甯﹁〃鍗曢獙璇佺殑鏁版嵁鑾峰彇
+    getDataList() {
+      this.$refs.searchForm.validate((valid) => {
+        if (valid) {
+          this.getDataListWithoutValidation();
+        } else {
+          this.loading = false; // 楠岃瘉澶辫触鏃朵篃瑕佸叧闂璴oading
+          this.$Message.error("璇锋鏌ヨ〃鍗曡緭鍏ユ槸鍚︽纭�");
+        }
+      });
+    },
+    // 鏍煎紡鍖栨棩鏈熸椂闂�
+    formatDate(date) {
+      if (!date) {
+        console.warn("鏃ユ湡鏍煎紡鍖栨椂浼犲叆浜嗙┖鍊�");
+        return "";
+      }
+      try {
+        const formattedDate = formatDate(new Date(date), 'yyyy-MM-dd hh:mm:ss');
+        console.log("鏃ユ湡鏍煎紡鍖栫粨鏋�:", formattedDate);
+        return formattedDate;
+      } catch (error) {
+        console.error("鏃ユ湡鏍煎紡鍖栧嚭閿�:", error);
+        // 濡傛灉鏍煎紡鍖栧嚭閿欙紝灏濊瘯浣跨敤鍙︿竴绉嶆柟寮�
+        try {
+          const d = new Date(date);
+          const year = d.getFullYear();
+          const month = ('0' + (d.getMonth() + 1)).slice(-2);
+          const day = ('0' + d.getDate()).slice(-2);
+          const hours = ('0' + d.getHours()).slice(-2);
+          const minutes = ('0' + d.getMinutes()).slice(-2);
+          const seconds = ('0' + d.getSeconds()).slice(-2);
+          const formatted = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+          console.log("澶囩敤鏃ユ湡鏍煎紡鍖栫粨鏋�:", formatted);
+          return formatted;
+        } catch (backupError) {
+          console.error("澶囩敤鏃ユ湡鏍煎紡鍖栦篃鍑洪敊:", backupError);
+          return "";
+        }
+      }
+    },
+    // 鏀瑰彉椤垫暟
+    changePage(page) {
+      this.searchForm.pageNumber = page;
+      this.getDataListWithoutValidation();
+    },
+    // 鏀瑰彉椤电爜
+    changePageSize(pageSize) {
+      this.searchForm.pageNumber = 1;
+      this.searchForm.pageSize = pageSize;
+      this.getDataListWithoutValidation();
+    },
+    // 鎼滅储
+    handleSearch() {
+      console.log("鎼滅储鎸夐挳琚偣鍑�");
+      this.searchForm.pageNumber = 1;
+      // 鐩存帴妫�鏌ユ椂闂村弬鏁帮紝涓嶄娇鐢ㄨ〃鍗曢獙璇�
+      console.log("寮�濮嬫悳绱紝妫�鏌ユ椂闂村弬鏁�");
+      // 妫�鏌ユ椂闂村弬鏁版槸鍚︿负绌�
+      if (!this.searchForm.beginDate || !this.searchForm.endDate) {
+        this.$Message.error("寮�濮嬫椂闂村拰缁撴潫鏃堕棿涓嶈兘涓虹┖");
+        return;
+      }
+      this.getDataListWithoutValidation();
+    },
+    // 閲嶇疆
+    handleReset() {
+      this.searchForm.pageNumber = 1;
+      this.searchForm.pageSize = 10;
+      this.searchForm.userName = "";
+      this.searchForm.pageCode = "";
+      // 浣跨敤姝g‘鐨勫弬鏁板悕绉板拰鏂规硶
+      this.searchForm.beginDate = this.getDefaultBeginDate();
+      this.searchForm.endDate = this.getDefaultEndDate();
+      // 閲嶇疆鍚庨噸鏂板姞杞芥暟鎹�
+      this.$nextTick(() => {
+        this.getDataListWithoutValidation();
+      });
+    },
+    // 璺宠浆鍒板晢鍝佽鎯呴〉闈�
+    goToGoodsDetail(pageParams) {
+      try {
+        // 瑙f瀽pageParams JSON瀛楃涓�
+        const params = JSON.parse(pageParams);
+        console.log("瑙f瀽鍚庣殑鍙傛暟:", params);
+
+        // 妫�鏌ュ繀瑕佸弬鏁�
+        if (!params.id || !params.goodsId) {
+          this.$Message.error("鍟嗗搧鍙傛暟涓嶅畬鏁�");
+          return;
+        }
+
+        // 璺宠浆鍒板晢鍝佽鎯呴〉闈紝浼犻�掑弬鏁�
+        this.$router.push({
+          name: "goods-detail",
+          query: {
+            id: params.goodsId
+          }
+        });
+      } catch (error) {
+        console.error("瑙f瀽pageParams鍑洪敊:", error);
+        this.$Message.error("鍙傛暟瑙f瀽澶辫触");
+      }
+    },
+    // 璺宠浆鍒拌鍗曡鎯呴〉闈�
+    goToOrderDetail(pageParams) {
+      try {
+        // 瑙f瀽pageParams JSON瀛楃涓�
+        const params = JSON.parse(pageParams);
+        console.log("瑙f瀽鍚庣殑鍙傛暟:", params);
+
+        // 妫�鏌ュ繀瑕佸弬鏁�
+        if (!params.sn) {
+          this.$Message.error("璁㈠崟鍙傛暟涓嶅畬鏁�");
+          return;
+        }
+
+        // 璺宠浆鍒拌鍗曡鎯呴〉闈紝浼犻�掕鍗曞彿鍙傛暟
+        this.$router.push({
+          name: "order-detail",
+          query: {
+            sn: params.sn
+          }
+        });
+      } catch (error) {
+        console.error("瑙f瀽pageParams鍑洪敊:", error);
+        this.$Message.error("鍙傛暟瑙f瀽澶辫触");
+      }
+    },
+    // 鏄剧ず璇︽儏寮圭獥
+    showDetailModal(userId) {
+      this.detailSearchForm.userId = userId;
+      this.detailSearchForm.pageNumber = 1;
+      this.detailSearchForm.userName = "";
+      this.detailSearchForm.pageCode = "";
+      this.detailSearchForm.beginDate = this.getDefaultBeginDate();
+      this.detailSearchForm.endDate = this.getDefaultEndDate();
+      this.detailModalVisible = true;
+      this.getDetailData();
+    },
+    // 鑾峰彇璇︽儏鏁版嵁
+    getDetailData() {
+      this.detailTableLoading = true;
+      
+      // 澶勭悊鏃堕棿鏍煎紡
+      const params = { ...this.detailSearchForm };
+      if (params.beginDate) {
+        params.beginDate = this.formatDate(params.beginDate);
+      }
+      if (params.endDate) {
+        params.endDate = this.formatDate(params.endDate);
+      }
+      
+      // 璋冪敤涓巙serAction.vue鐩稿悓鐨勬帴鍙o紝浣嗗鍔爑serId鍙傛暟
+      userStayList(params).then(res => {
+        if (res.code === 200) {
+          this.detailData = res.data.records || [];
+          this.detailTotal = res.data.total || 0;
+        } else {
+          this.$Message.error(res.msg || "鑾峰彇璇︽儏鏁版嵁澶辫触");
+        }
+      }).catch(err => {
+        console.error("璇锋眰璇︽儏鏁版嵁澶辫触:", err);
+        this.$Message.error("璇锋眰寮傚父: " + (err.message || "鏈煡閿欒"));
+      }).finally(() => {
+        this.detailTableLoading = false;
+      });
+    },
+    // 鏀瑰彉璇︽儏椤垫暟
+    changeDetailPage(page) {
+      this.detailSearchForm.pageNumber = page;
+      this.getDetailData();
+    },
+    // 鏀瑰彉璇︽儏椤电爜
+    changeDetailPageSize(pageSize) {
+      this.detailSearchForm.pageNumber = 1;
+      this.detailSearchForm.pageSize = pageSize;
+      this.getDetailData();
+    },
+    // 璇︽儏鎼滅储
+    handleDetailSearch() {
+      this.detailSearchForm.pageNumber = 1;
+      this.getDetailData();
+    },
+    // 璇︽儏閲嶇疆
+    handleDetailReset() {
+      this.detailSearchForm.pageNumber = 1;
+      this.detailSearchForm.pageSize = 10;
+      this.detailSearchForm.userName = "";
+      this.detailSearchForm.pageCode = "";
+      this.detailSearchForm.beginDate = this.getDefaultBeginDate();
+      this.detailSearchForm.endDate = this.getDefaultEndDate();
+      this.getDetailData();
+    }
+  },
+  mounted() {
+    console.log("缁勪欢宸叉寕杞斤紝寮�濮嬪垵濮嬪寲鏁版嵁");
+    this.$nextTick(() => {
+      console.log("nextTick鍥炶皟锛岃皟鐢╥nit鏂规硶");
+      this.init();
+    });
+  }
+};
+</script>
+
+<style scoped>
+.search-btn {
+  margin-right: 10px;
+}
+.mt_10 {
+  margin-top: 10px;
+}
+
+/* 鐢ㄦ埛琛屼负鍗$墖鏍峰紡 */
+.user-action-card {
+  height: calc(100vh - 100px);
+  display: flex;
+  flex-direction: column;
+}
+
+/* 琛ㄦ牸瀹瑰櫒鏍峰紡 */
+.table-container {
+  flex: 1;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
+}
+
+/* 琛ㄦ牸鏍峰紡 */
+.table-container /deep/ .ivu-table-wrapper {
+  flex: 1;
+  overflow-y: auto;
+  height: 100%;
+}
+
+/* 鎼滅储琛ㄥ崟鏍峰紡 */
+.search-form {
+  padding: 16px 0;
+}
+
+/* 鍒嗛〉鏍峰紡 */
+.mt_10 {
+  padding: 10px 0;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.8.0