Selaa lähdekoodia

:art: 首页标签切换问题;:bug: 获取剩余可卖出股票数量

Ritchie 1 vuosi sitten
vanhempi
commit
be2f7687d7
3 muutettua tiedostoa jossa 26 lisäystä ja 10 poistoa
  1. 6 1
      src/service/user.js
  2. 1 1
      src/views/home/HomeIndex.vue
  3. 19 8
      src/views/user/UserIndex.vue

+ 6 - 1
src/service/user.js

@@ -1,6 +1,11 @@
-import axios from '../utils/axios';
+import axios from "../utils/axios";
 
 // 添加公告
 export function addNotice(params) {
   return axios.post(`/notificationInfo/addNotification`, params);
 }
+
+// 查询用户可挂单数量(买、卖) 
+export function queryAllowNum() {
+  return axios.get(`/tradeOrder/queryAllowPendNum`)
+}

+ 1 - 1
src/views/home/HomeIndex.vue

@@ -27,7 +27,7 @@
       </div>
 
       <div style="width: 30%; margin: 0 auto;">
-        <van-tabs v-model:active="active" type="card" swipeable @click-tab="onClickTab" color="#39a6fe">
+        <van-tabs type="card" swipeable @click-tab="onClickTab" color="#39a6fe">
           <van-tab title="日K"></van-tab>
           <van-tab title="月K"></van-tab>
         </van-tabs>

+ 19 - 8
src/views/user/UserIndex.vue

@@ -14,7 +14,7 @@
           <!-- 初始份额 stockNum -->
           <div class="userId">
             <!-- <p class="userText">{{ accountDetail.stockNum }}</p> -->
-            <p class="userText">5000</p>
+            <p class="userText">{{ stockShares }}</p>
             <p class="userText">剩余份额</p>
           </div>
           <!-- 竖线 -->
@@ -43,7 +43,7 @@
             <div>
               <van-field class="relationClass" v-model="cofficentForm.phone" :placeholder="$t('user.phoneNumberPlace')">
                 <template #button>
-                  <van-button  type="primary" @click="mailboxChg(cofficentForm.phone, 1)" size="small" >确定
+                  <van-button type="primary" @click="mailboxChg(cofficentForm.phone, 1)" size="small">确定
                   </van-button>
                 </template>
               </van-field>
@@ -62,7 +62,8 @@
               <van-field class="relationClass" v-model="cofficentForm.mailBox" :placeholder="$t('user.mailboxPlace')">
                 <!-- 邮箱修改按钮 -->
                 <template #button>
-                  <van-button type="primary" @click="mailboxChg(cofficentForm.mailBox, 2)" size="small">{{ $t("user.confirmLog") }}
+                  <van-button type="primary" @click="mailboxChg(cofficentForm.mailBox, 2)" size="small">{{
+                    $t("user.confirmLog") }}
                   </van-button>
                 </template>
               </van-field>
@@ -197,6 +198,7 @@ import { useRouter } from "vue-router";
 import { showToast } from 'vant';
 import { useI18n } from "vue-i18n";
 import { styleUrl } from "@/common/js/utils";
+import { queryAllowNum } from "@/service/user.js";
 
 export default {
   components: { sHeader, kDialog },
@@ -236,9 +238,6 @@ export default {
     const cardNo = ref('');
     cardNo.value = user.cardNo;
 
-    // TODO: userInfo
-    console.log("user >>>", user.value);
-
     const starsCount = ref(Math.floor(level.value % 5));
     const moonsCount = ref(Math.floor(level.value / 5));
 
@@ -373,6 +372,16 @@ export default {
       }
     };
 
+    // 剩余份额-allowSellNum 允许售卖的数量
+    const stockShares = ref(0)
+
+    async function getStockShares() {
+      const { data } = await queryAllowNum()
+      if (data.code === '00000') {
+        stockShares.value = data.data.allowSellNum;
+      }
+    }
+
     // 初始化页面获取列表
     onMounted(async () => {
       // 加载样式
@@ -383,8 +392,9 @@ export default {
       // }
 
       // 获取账户
-      getAcccountDetail();
+      getAcccountDetail()
       checkIsAdmin()
+      getStockShares()
     });
 
 
@@ -457,7 +467,8 @@ export default {
       clickEye,
       eyeOpen,
       cardNo,
-      isAdmin
+      isAdmin,
+      stockShares
     };
   }
 };