Просмотр исходного кода

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

cgp 4 недель назад
Родитель
Сommit
7200b4ea72
2 измененных файлов с 30 добавлено и 7 удалено
  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) {
 export function addCompanySms(data) {
   return request({
   return request({
@@ -48,7 +56,7 @@ export function sendPackageOrderMsg(data) {
     data: data
     data: data
   })
   })
 }
 }
-                                
+
 export function sendCustomerBatchMsg(data) {
 export function sendCustomerBatchMsg(data) {
   return request({
   return request({
     url: '/company/companySms/sendCustomerBatchMsg',
     url: '/company/companySms/sendCustomerBatchMsg',
@@ -94,4 +102,4 @@ export function exportCompanySms(query) {
     method: 'get',
     method: 'get',
     params: query
     params: query
   })
   })
-}
+}

+ 20 - 5
src/views/index.vue

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