From f14ea940fb32105de8b592992e3f53c62f31d84d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 22 一月 2026 16:42:51 +0800
Subject: [PATCH] 2026.1.22

---
 pages/mLedger/behaviors/bUploadLedger.js |  141 ++++++++++++++++++++++++++++++----------------
 1 files changed, 91 insertions(+), 50 deletions(-)

diff --git a/pages/mLedger/behaviors/bUploadLedger.js b/pages/mLedger/behaviors/bUploadLedger.js
index 21f2c97..3335aca 100644
--- a/pages/mLedger/behaviors/bUploadLedger.js
+++ b/pages/mLedger/behaviors/bUploadLedger.js
@@ -1,9 +1,9 @@
-import bUpload from "../../../base/behaviors/bUpload"
-import ledgerservice from"../../../service/ledgerservice"
-import bLoadingStatus from '../../../base/behaviors/bLoadingStatus'
-import moment from '../../../utils/moment.min'
+import bUpload from '../../../base/behaviors/bUpload';
+import ledgerservice from '../../../service/ledgerservice';
+import bLoadingStatus from '../../../base/behaviors/bLoadingStatus';
+import moment from '../../../utils/moment.min';
 
-const app = getApp()
+const app = getApp();
 
 /**
  * 鍙拌处涓婁紶绠$悊
@@ -11,65 +11,106 @@
 module.exports = Behavior({
   behaviors: [bUpload, bLoadingStatus],
   data: {
+    // 鍙拌处绫诲瀷
     ledger: {},
+    // 鍙拌处璇︽儏
+    detail: undefined,
     remark: '',
   },
   methods: {
     _uploadLedger() {
-      if (this.data.imgFiles.length == 0) return
-      
-      var that = this
-      let path = []
-      this.data.imgFiles.forEach(f => {
-        path.push(f.url)
-      });
-      let ledger = this.data.ledger
-      ledger.remark1 = this.data.remark
+      if (this.data.imgFiles.length == 0) return;
 
-      this.setData({loading: true})
-      ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, {
-        success (res) {
-          that.setData({loading: false})
-          if (typeof that._success === 'function') {
-            that._success(res)
-          }
-        },
-        fail(err) {
-          that.setData({loading: false})
-          // wx.showToast({
-          //   title: '涓婁紶澶辫触',
-          //   duration: 1000,
-          //   icon: 'none',
-          //   mask: true,
-          // })
-        },
-        complete (res) {
+      var that = this;
+      let path = [];
+      this.data.imgFiles.forEach(f => {
+        path.push(f.url);
+      });
+      let ledger = this.data.ledger;
+      let namePairs = []
+      this.data.imgFiles.forEach(f=>{
+        // 闄や簡鍥剧墖澶栫殑鏂囨。闇�瑕佷紶杈撳師濮嬪悕瀛�
+        if (f.name) {
+          const ulist = f.url.split('/')
+          namePairs.push({
+            first: ulist[ulist.length - 1], // 涓婁紶鐨勪复鏃舵枃浠跺悕瀛�
+            second: f.name // 鏂囦欢鍘熷鍚嶅瓧
+          })
         }
       })
+      ledger.remark1 = this.data.remark;
+      if (this.data.detail) {
+        ledger.id = this.data.detail.id
+      }
+
+      this.setData({ loading: true });
+      ledgerservice.uploadLedger(
+        app.globalData.accessToken.userId, ledger,
+        namePairs, path,
+        {
+          success(res) {
+            that.setData({ loading: false });
+            if (typeof that._success === 'function') {
+              that._success(res);
+            }
+          },
+          fail(err) {
+            that.setData({ loading: false });
+            // wx.showToast({
+            //   title: '涓婁紶澶辫触',
+            //   duration: 1000,
+            //   icon: 'none',
+            //   mask: true,
+            // })
+          },
+          complete(res) {},
+        },
+      );
     },
 
     _uploadNoLedger() {
-      var that = this
-      const time = moment().format('YYYY-MM-DD')
-      const idList = [this.data.ledger.ledgerSubTypeId]
-      this.setData({loading: true})
-      ledgerservice.uploadNoLedger(app.globalData.accessToken.userId, time, idList, {
-        success (res) {
-          that.setData({loading: false})
-          if (typeof that._success === 'function') {
-            that._success(res)
+      var that = this;
+      const time = moment().format('YYYY-MM-DD');
+      const idList = [this.data.ledger.ledgerSubTypeId];
+      this.setData({ loading: true });
+      ledgerservice.uploadNoLedger(
+        app.globalData.accessToken.userId,
+        time,
+        this.data.remark,
+        idList,
+        {
+          success(res) {
+            that.setData({ loading: false });
+            if (typeof that._success === 'function') {
+              that._success(res);
+            }
+          },
+          fail(err) {
+            that.setData({ loading: false });
+            // wx.showToast({
+            //   title: '涓婁紶澶辫触',
+            //   duration: 1000,
+            //   icon: 'none',
+            //   mask: true,
+            // })
+          },
+        },
+      );
+    },
+
+    _uploadCopyLedger(copyLedgerList) {
+      const time = moment().format('YYYY-MM');
+      ledgerservice.copyLedger(app.globalData.accessToken.userId, time,copyLedgerList, {
+        success:res=>{
+          this.setData({ loading: false });
+          if (typeof this._success === 'function') {
+            this._success(res);
           }
         },
         fail(err) {
-          that.setData({loading: false})
-          // wx.showToast({
-          //   title: '涓婁紶澶辫触',
-          //   duration: 1000,
-          //   icon: 'none',
-          //   mask: true,
-          // })
+          this.setData({ loading: false });
         },
       })
     }
-  }
-})
\ No newline at end of file
+  },
+});

--
Gitblit v1.9.3