Browse Source

刷新笔数

shish 18 hours ago
parent
commit
07611c7098
2 changed files with 42 additions and 12 deletions
  1. 8 0
      ghsApp/src/api/ghs/index.js
  2. 34 12
      ghsApp/src/pagesPurchase/supplier.vue

+ 8 - 0
ghsApp/src/api/ghs/index.js

@@ -12,6 +12,14 @@ export const changeGhsName = data => {
 	return https.get('/ghs/modify-name', data)
 }
 
+/**
+ * 按采购挂账单重算并回写供货商待结笔数
+ * @param {{ id: number }} data 供货商 id
+ */
+export const refreshDebtNum = data => {
+	return https.get('/ghs/refresh-debt-num', data)
+}
+
 /** *
  * 供货商列表 姜枫 2021.04.01  ghs/add
  */

+ 34 - 12
ghsApp/src/pagesPurchase/supplier.vue

@@ -57,11 +57,12 @@
               <!-- 下拉菜单内容 -->
               <view class="more-dropdown" v-if="activeMenuId === item.id">
                 <view class="dropdown-item" hover-class="none" @click.stop="handleDebtChangeFromMenu(item)">
-                  <text class="dropdown-icon">📋</text>
                   <text class="dropdown-text">挂账变动明细(废弃)</text>
                 </view>
-                <view class="dropdown-item" hover-class="none" @click.stop="handleDeleteFromMenu(item)">
-                  <text class="dropdown-icon">🗑</text>
+                <view class="dropdown-item" hover-class="none" @click.stop="handleRefreshDebtNum(item)">
+                  <text class="dropdown-text">待结笔数刷新</text>
+                </view>
+                <view class="dropdown-item dropdown-item-danger" hover-class="none" @click.stop="handleDeleteFromMenu(item)">
                   <text class="dropdown-text">删除供货商</text>
                 </view>
               </view>
@@ -174,7 +175,7 @@
 <script>
 import Tabs from "@/components/plugin/tabs";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
-import { getList, changeGhsName, changeLocationFn, changeDelStatus } from "@/api/ghs";
+import { getList, changeGhsName, changeLocationFn, changeDelStatus, refreshDebtNum } from "@/api/ghs";
 import AppSearchModule from "@/components/module/app-search";
 import ModalModule from "@/components/plugin/modal";
 import { list } from "@/mixins";
@@ -326,6 +327,29 @@ export default {
       this.activeMenuId = null
       this.getDebtList(item)
     },
+    /**
+     * 更多菜单:按采购挂账单重算该供货商待结笔数并更新列表展示
+     */
+    handleRefreshDebtNum(item) {
+      this.activeMenuId = null
+      if (!item || !item.id) {
+        return
+      }
+      const oldNum = parseInt(item.debtNum || 0, 10) || 0
+      refreshDebtNum({ id: item.id }).then(res => {
+        if (res.code != 1) {
+          return
+        }
+        const debtNum = parseInt((res.data && res.data.debtNum) || 0, 10) || 0
+        this.$set(item, 'debtNum', debtNum)
+        // 页头总笔数仅统计有待结金额的供货商,本行无待结金额时不改总笔数
+        if (this.info && this.isNormalList && this.hasSupplierPending(item)) {
+          const total = parseInt(this.info.totalDebtNum || 0, 10) || 0
+          this.$set(this.info, 'totalDebtNum', Math.max(0, total + (debtNum - oldNum)))
+        }
+        this.$msg('已刷新')
+      })
+    },
     init() {
       this.getGhsList()
     },
@@ -711,20 +735,18 @@ export default {
               transition: background-color 0.2s ease;
               
               &:active {
+                background-color: #f5f7fa;
+              }
+
+              // 删除项按压反馈用红色,与普通菜单项区分
+              &.dropdown-item-danger:active {
                 background-color: #ffeef0;
                 
-                .dropdown-text, .dropdown-icon {
+                .dropdown-text {
                   color: #ff4d4f;
                 }
               }
               
-              .dropdown-icon {
-                font-size: 26upx;
-                color: #999;
-                margin-right: 12upx;
-                flex-shrink: 0;
-              }
-              
               .dropdown-text {
                 font-size: 26upx;
                 color: #555;