From c1fd6952f42461bc7e83c97f594a52fc1af934eb Mon Sep 17 00:00:00 2001
From: liubp <1535785116@qq.com>
Date: 星期四, 25 十二月 2025 18:15:43 +0800
Subject: [PATCH] 费用明细表,查询,编辑,删除,添加接口对接,公益金表接口对接,页面样式优化

---
 public/pages/property/costDetail/more/more.js |  133 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 127 insertions(+), 6 deletions(-)

diff --git a/public/pages/property/costDetail/more/more.js b/public/pages/property/costDetail/more/more.js
index 47ebaa5..1e3e719 100644
--- a/public/pages/property/costDetail/more/more.js
+++ b/public/pages/property/costDetail/more/more.js
@@ -32,9 +32,13 @@
         },
         _initMethod: function () {
             $that = vc.component;
-            $that._injectStyles();
             $that._initDate();
-            $that._listData(DEFAULT_PAGE, DEFAULT_ROWS);
+            // 杩涘叆椤甸潰鏃剁珛鍗宠皟鐢ㄦ帴鍙�
+            $that._loadPublicIncomeData(DEFAULT_PAGE, DEFAULT_ROWS);
+            // 鏍规嵁褰撳墠鏍囩椤靛姞杞芥暟鎹�
+            if ($that.moreInfo.currentTab !== 'publicIncome') {
+                $that._listData(DEFAULT_PAGE, DEFAULT_ROWS);
+            }
         },
         _initEvent: function () {
         },
@@ -113,7 +117,112 @@
             changeTab: function (_tab) {
                 $that.moreInfo.currentTab = _tab;
                 // 鏍规嵁鏍囩椤靛姞杞戒笉鍚屾暟鎹�
-                $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                if (_tab === 'publicIncome') {
+                    // 鍏叡鏀剁泭閲戞爣绛撅紝璋冪敤鐗规畩鎺ュ彛
+                    $that._loadPublicIncomeData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                } else {
+                    $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                }
+            },
+            _loadPublicIncomeData: function (_page, _rows) {
+                // 鑾峰彇URL鍙傛暟涓殑costDetailId
+                var costDetailId = vc.getParam('costDetailId');
+                if (!costDetailId) {
+                    // 灏濊瘯浠巋ash涓幏鍙�
+                    var hash = location.hash;
+                    if (hash && hash.indexOf('?') !== -1) {
+                        var hashParams = hash.substring(hash.indexOf('?') + 1);
+                        var params = hashParams.split('&');
+                        for (var i = 0; i < params.length; i++) {
+                            var param = params[i].split('=');
+                            if (param[0] === 'costDetailId') {
+                                costDetailId = decodeURIComponent(param[1] || '');
+                                break;
+                            }
+                        }
+                    }
+                }
+                
+                if (!costDetailId) {
+                    vc.toast('缂哄皯costDetailId鍙傛暟');
+                    return;
+                }
+                
+                var param = {
+                    params: {
+                        mpId: costDetailId,
+                        page: _page,
+                        row: _rows
+                    }
+                };
+                
+                // 璋冪敤鍏叡鏀剁泭閲戞帴鍙�
+                vc.http.apiGet('/announcementTimeRange/queryAnnouncementTimeRangeInfo',
+                    param,
+                    function (json, res) {
+                        try {
+                            var _json = JSON.parse(json);
+                            if (_json.code === "0000") {
+                                var total = _json.total || 0;
+                                var rows = _rows || DEFAULT_ROWS;
+                                // 璁$畻鎬婚〉鏁�
+                                var totalPages = Math.ceil(total / rows);
+                                if (totalPages === 0) {
+                                    totalPages = 1;
+                                }
+                                
+                                $that.moreInfo.paginationInfo.dataCount = total;
+                                $that.moreInfo.paginationInfo.total = totalPages;
+                                
+                                // 鏄犲皠鏁版嵁瀛楁
+                                var dataList = [];
+                                if (_json.data && Array.isArray(_json.data)) {
+                                    dataList = _json.data.map(function(item) {
+                                        return {
+                                            id: item.id,
+                                            mpId: item.mpId,
+                                            proposedStartDate: item.plannedAnnouncementStart || '-',
+                                            proposedEndDate: item.plannedAnnouncementEnd || '-',
+                                            publishedStartDate: item.publishedAnnouncementStart || '-',
+                                            publishedEndDate: item.publishedAnnouncementEnd || '-',
+                                            createTime: item.createTime || '',
+                                            updateTime: item.updateTime || '',
+                                            _originalData: item
+                                        };
+                                    });
+                                }
+                                
+                                $that.moreInfo.dataList = dataList;
+                                $that.moreInfo.paginationInfo.currentPage = _page;
+                                $that._freshPageList();
+                            } else {
+                                vc.toast(_json.msg || '鏌ヨ澶辫触');
+                                $that.moreInfo.dataList = [];
+                                $that.moreInfo.paginationInfo.dataCount = 0;
+                                $that.moreInfo.paginationInfo.total = 1;
+                                $that.moreInfo.paginationInfo.currentPage = _page;
+                                $that._freshPageList();
+                            }
+                        } catch (e) {
+                            console.error('鏁版嵁瑙f瀽澶辫触:', e);
+                            vc.toast('鏁版嵁瑙f瀽澶辫触');
+                            $that.moreInfo.dataList = [];
+                            $that.moreInfo.paginationInfo.dataCount = 0;
+                            $that.moreInfo.paginationInfo.total = 1;
+                            $that.moreInfo.paginationInfo.currentPage = _page;
+                            $that._freshPageList();
+                        }
+                    },
+                    function (errInfo, error) {
+                        console.error('璇锋眰澶辫触:', errInfo, error);
+                        vc.toast(errInfo || '璇锋眰澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�');
+                        $that.moreInfo.dataList = [];
+                        $that.moreInfo.paginationInfo.dataCount = 0;
+                        $that.moreInfo.paginationInfo.total = 1;
+                        $that.moreInfo.paginationInfo.currentPage = _page;
+                        $that._freshPageList();
+                    }
+                );
             },
             _listData: function (_page, _rows) {
                 $that.moreInfo.conditions.page = _page;
@@ -240,13 +349,21 @@
                 $that.moreInfo.paginationInfo.pageList = pageList;
             },
             _changePageSize: function () {
-                $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                if ($that.moreInfo.currentTab === 'publicIncome') {
+                    $that._loadPublicIncomeData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                } else {
+                    $that._listData(DEFAULT_PAGE, $that.moreInfo.paginationInfo.rows);
+                }
             },
             _goToPage: function (_page) {
                 if (!_page || _page < 1 || _page > $that.moreInfo.paginationInfo.total) {
                     return;
                 }
-                $that._listData(_page, $that.moreInfo.paginationInfo.rows);
+                if ($that.moreInfo.currentTab === 'publicIncome') {
+                    $that._loadPublicIncomeData(_page, $that.moreInfo.paginationInfo.rows);
+                } else {
+                    $that._listData(_page, $that.moreInfo.paginationInfo.rows);
+                }
             },
             _jumpToPage: function () {
                 var page = parseInt($that.moreInfo.jumpPage);
@@ -256,7 +373,11 @@
                 if (page > $that.moreInfo.paginationInfo.total) {
                     page = $that.moreInfo.paginationInfo.total;
                 }
-                $that._listData(page, $that.moreInfo.paginationInfo.rows);
+                if ($that.moreInfo.currentTab === 'publicIncome') {
+                    $that._loadPublicIncomeData(page, $that.moreInfo.paginationInfo.rows);
+                } else {
+                    $that._listData(page, $that.moreInfo.paginationInfo.rows);
+                }
             },
             _add: function () {
                 // 娣诲姞鍔熻兘

--
Gitblit v1.8.0