Przeglądaj źródła

销售端主页新增短信余额显示

cgp 4 tygodni temu
rodzic
commit
7200b4ea72
2 zmienionych plików z 30 dodań i 7 usunięć
  1. 10 2
      src/api/company/companySms.js
  2. 20 5
      src/views/index.vue

+ 10 - 2
src/api/company/companySms.js

@@ -17,6 +17,14 @@ export function getCompanySms(smsId) {
   })
 }
 
+// 查询公司剩余短信条数
+export function getRemainingSMSCount() {
+  return request({
+    url: '/company/companySms/getRemainingSMSCount',
+    method: 'get'
+  })
+}
+
 // 新增公司短信
 export function addCompanySms(data) {
   return request({
@@ -48,7 +56,7 @@ export function sendPackageOrderMsg(data) {
     data: data
   })
 }
-                                
+
 export function sendCustomerBatchMsg(data) {
   return request({
     url: '/company/companySms/sendCustomerBatchMsg',
@@ -94,4 +102,4 @@ export function exportCompanySms(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 20 - 5
src/views/index.vue

@@ -196,7 +196,7 @@
                 </span>
               </div>
               <div class="internet-number">
-                0
+                {{ smsRemainCount !== null && smsRemainCount !== undefined ? formatNumberWithCommas(smsRemainCount) : 0 }}
               </div>
             </div>
           </div>
@@ -511,6 +511,7 @@ import {
   smsBalance, thisMonthOrderCount, thisMonthRecvCount, trafficLog,
   watchCourseTopTen, watchEndPlayTrend
 } from "@/api/statistics/statistics";
+import { getRemainingSMSCount } from "@/api/company/companySms";
 import dayjs from 'dayjs';
 
 
@@ -1112,15 +1113,29 @@ export default {
           this.watchRate = res.data.watchRate;
         }
       })
-      smsBalance().then(res=>{
-        if(res.code === 200){
-          if(res.data == null) {
+      getRemainingSMSCount().then(res => {
+        if (res.code === 200) {
+          // 接口返回的是 { code: 200, data: count }
+          if (res.data == null) {
             this.smsRemainCount = 0;
           } else {
             this.smsRemainCount = res.data;
           }
+        } else {
+          this.smsRemainCount = 0;
         }
-      })
+      }).catch(() => {
+        this.smsRemainCount = 0;
+      });
+      // smsBalance().then(res=>{
+      //   if(res.code === 200){
+      //     if(res.data == null) {
+      //       this.smsRemainCount = 0;
+      //     } else {
+      //       this.smsRemainCount = res.data;
+      //     }
+      //   }
+      // })
       authorizationInfo().then(res=>{
         if(res.code === 200){
           this.todayWatchUserCount = res.data.todayWatchUserCount;