Zhangbw vor 3 Monaten
Ursprung
Commit
b663519363

+ 16 - 3
dist/dev/mp-weixin/pages/mine/mine.js

@@ -1,7 +1,7 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
 const utils_auth = require("../../utils/auth.js");
-require("../../utils/api.js");
+const utils_api = require("../../utils/api.js");
 const _sfc_main = {
   __name: "mine",
   setup(__props) {
@@ -12,14 +12,14 @@ const _sfc_main = {
       avatar: "",
       phone: ""
     });
-    const points = common_vendor.ref(900);
+    const points = common_vendor.ref(0);
     common_vendor.onMounted(() => {
       loadUserInfo();
     });
     common_vendor.onShow(() => {
       loadUserInfo();
     });
-    const loadUserInfo = () => {
+    const loadUserInfo = async () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
       console.log("[个人中心] 登录状态:", isLoggedIn.value);
       if (isLoggedIn.value) {
@@ -28,6 +28,19 @@ const _sfc_main = {
           userInfo.value = storedInfo;
           console.log("[个人中心] 加载用户信息:", userInfo.value);
         }
+        await loadUserPoints();
+      }
+    };
+    const loadUserPoints = async () => {
+      try {
+        const res = await utils_api.getUserPointsApi();
+        if (res.code === 200 && res.data) {
+          points.value = res.data.totalPoints || 0;
+          console.log("[个人中心] 用户积分:", points.value);
+        }
+      } catch (e) {
+        console.error("获取积分失败:", e);
+        points.value = 0;
       }
     };
     const handleUserCardClick = () => {

+ 27 - 50
dist/dev/mp-weixin/pages/points/points.js

@@ -1,9 +1,12 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
+const utils_api = require("../../utils/api.js");
+const utils_auth = require("../../utils/auth.js");
 const _sfc_main = {
   __name: "points",
   setup(__props) {
     const records = common_vendor.ref([]);
+    const loading = common_vendor.ref(false);
     const handleBack = () => {
       const pages = getCurrentPages();
       if (pages.length > 1) {
@@ -17,7 +20,7 @@ const _sfc_main = {
     const groupedRecords = common_vendor.computed(() => {
       const groups = {};
       records.value.forEach((item) => {
-        const dateKey = formatDate(item.timestamp);
+        const dateKey = formatDate(item.createTime);
         if (!groups[dateKey]) {
           groups[dateKey] = [];
         }
@@ -59,56 +62,30 @@ const _sfc_main = {
       const minutes = String(date.getMinutes()).padStart(2, "0");
       return `${hours}:${minutes}`;
     };
-    const loadRecords = () => {
+    const getTitle = (item) => {
+      return item.bizTypeName || item.remark || "积分变动";
+    };
+    const loadRecords = async () => {
+      if (!utils_auth.isLoggedIn()) {
+        console.log("未登录,无法获取积分记录");
+        return;
+      }
+      loading.value = true;
       try {
-        const storedRecords = common_vendor.index.getStorageSync("points_records") || [];
-        records.value = storedRecords.sort((a, b) => b.timestamp - a.timestamp);
+        const res = await utils_api.getPointsRecordsApi();
+        if (res.code === 200 && res.data) {
+          records.value = res.data;
+          console.log("[积分记录] 加载成功,共", records.value.length, "条");
+        }
       } catch (e) {
         console.error("加载积分记录失败:", e);
         records.value = [];
-      }
-    };
-    const initMockData = () => {
-      const mockRecords = [
-        {
-          title: "每日签到",
-          points: 10,
-          type: "add",
-          timestamp: Date.now() - 1e3 * 60 * 30
-        },
-        {
-          title: "完成交易",
-          points: 5,
-          type: "add",
-          timestamp: Date.now() - 1e3 * 60 * 60 * 2
-        },
-        {
-          title: "查询股票",
-          points: 2,
-          type: "use",
-          timestamp: Date.now() - 1e3 * 60 * 60 * 5
-        },
-        {
-          title: "邀请好友",
-          points: 20,
-          type: "add",
-          timestamp: Date.now() - 1e3 * 60 * 60 * 24
-        },
-        {
-          title: "解锁超短池",
-          points: 18,
-          type: "use",
-          timestamp: Date.now() - 1e3 * 60 * 60 * 24 * 2
-        }
-      ];
-      if (records.value.length === 0) {
-        records.value = mockRecords;
-        common_vendor.index.setStorageSync("points_records", mockRecords);
+      } finally {
+        loading.value = false;
       }
     };
     common_vendor.onMounted(() => {
       loadRecords();
-      initMockData();
     });
     return (_ctx, _cache) => {
       return common_vendor.e({
@@ -118,13 +95,13 @@ const _sfc_main = {
             a: common_vendor.t(dateKey),
             b: common_vendor.f(group, (item, index, i1) => {
               return {
-                a: common_vendor.t(item.title),
-                b: common_vendor.t(formatTime(item.timestamp)),
-                c: common_vendor.t(item.type === "add" ? "+" : "-"),
-                d: common_vendor.t(item.points),
-                e: common_vendor.n(item.type === "add" ? "amount-sell" : "amount-buy"),
-                f: common_vendor.t(item.type === "add" ? "获得" : "消耗"),
-                g: common_vendor.n(item.type === "add" ? "status-sell" : "status-buy"),
+                a: common_vendor.t(getTitle(item)),
+                b: common_vendor.t(formatTime(item.createTime)),
+                c: common_vendor.t(item.type === 1 ? "+" : "-"),
+                d: common_vendor.t(item.amount),
+                e: common_vendor.n(item.type === 1 ? "amount-sell" : "amount-buy"),
+                f: common_vendor.t(item.type === 1 ? "获得" : "消耗"),
+                g: common_vendor.n(item.type === 1 ? "status-sell" : "status-buy"),
                 h: index
               };
             }),

+ 47 - 7
dist/dev/mp-weixin/pages/pool/pool.js

@@ -11,11 +11,22 @@ const _sfc_main = {
     const selectedPlan = common_vendor.ref("daily");
     const selectedDate = common_vendor.ref("2025年11月20日");
     const isLoggedIn = common_vendor.ref(false);
+    const paymentMethod = common_vendor.ref("wechat");
+    const userPoints = common_vendor.ref(0);
     const checkLogin = () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
       console.log("[超短池] 登录状态:", isLoggedIn.value);
       return isLoggedIn.value;
     };
+    const getUserPoints = () => {
+      try {
+        const points = common_vendor.index.getStorageSync("user_points") || 0;
+        userPoints.value = points;
+      } catch (e) {
+        console.error("获取积分失败:", e);
+        userPoints.value = 0;
+      }
+    };
     const checkPurchaseStatus = () => {
       try {
         const purchaseInfo = common_vendor.index.getStorageSync("pool_purchase");
@@ -56,6 +67,7 @@ const _sfc_main = {
         return;
       }
       console.log("已登录,显示购买弹窗");
+      getUserPoints();
       showModal.value = true;
     };
     const closePurchaseModal = () => {
@@ -69,6 +81,19 @@ const _sfc_main = {
         });
         return;
       }
+      if (paymentMethod.value === "points") {
+        const requiredPoints = selectedPlan.value === "daily" ? 180 : 980;
+        if (userPoints.value < requiredPoints) {
+          common_vendor.index.showToast({
+            title: "积分不足,请充值或选择微信支付",
+            icon: "none"
+          });
+          return;
+        }
+        const newPoints = userPoints.value - requiredPoints;
+        common_vendor.index.setStorageSync("user_points", newPoints);
+        userPoints.value = newPoints;
+      }
       const now = Date.now();
       let expireTime = now;
       if (selectedPlan.value === "daily") {
@@ -81,13 +106,14 @@ const _sfc_main = {
       const purchaseInfo = {
         plan: selectedPlan.value,
         purchaseTime: now,
-        expireTime
+        expireTime,
+        paymentMethod: paymentMethod.value
       };
       common_vendor.index.setStorageSync("pool_purchase", purchaseInfo);
       isPurchased.value = true;
       closePurchaseModal();
       common_vendor.index.showToast({
-        title: "解锁成功",
+        title: paymentMethod.value === "points" ? "积分支付成功" : "解锁成功",
         icon: "success"
       });
     };
@@ -100,10 +126,12 @@ const _sfc_main = {
     common_vendor.onLoad(() => {
       checkLogin();
       checkPurchaseStatus();
+      getUserPoints();
     });
     common_vendor.onShow(() => {
       checkLogin();
       checkPurchaseStatus();
+      getUserPoints();
     });
     return (_ctx, _cache) => {
       return common_vendor.e({
@@ -122,17 +150,29 @@ const _sfc_main = {
         i: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args))
       } : {}, {
         j: showModal.value
-      }, showModal.value ? {
+      }, showModal.value ? common_vendor.e({
         k: common_vendor.o(closePurchaseModal),
         l: selectedPlan.value === "daily" ? 1 : "",
         m: common_vendor.o(($event) => selectedPlan.value = "daily"),
         n: selectedPlan.value === "weekly" ? 1 : "",
         o: common_vendor.o(($event) => selectedPlan.value = "weekly"),
-        p: common_vendor.o(handlePurchase),
-        q: common_vendor.o(() => {
+        p: paymentMethod.value === "wechat"
+      }, paymentMethod.value === "wechat" ? {} : {}, {
+        q: paymentMethod.value === "wechat" ? 1 : "",
+        r: common_vendor.o(($event) => paymentMethod.value = "wechat"),
+        s: common_vendor.t(userPoints.value),
+        t: common_vendor.t(selectedPlan.value === "daily" ? 180 : 980),
+        v: paymentMethod.value === "points"
+      }, paymentMethod.value === "points" ? {} : {}, {
+        w: paymentMethod.value === "points" ? 1 : "",
+        x: common_vendor.o(($event) => paymentMethod.value = "points"),
+        y: common_vendor.t(paymentMethod.value === "points" ? "确认积分支付" : "确认支付并解锁"),
+        z: paymentMethod.value === "points" ? 1 : "",
+        A: common_vendor.o(handlePurchase),
+        B: common_vendor.o(() => {
         }),
-        r: common_vendor.o(closePurchaseModal)
-      } : {});
+        C: common_vendor.o(closePurchaseModal)
+      }) : {});
     };
   }
 };

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/dev/mp-weixin/pages/pool/pool.wxml


+ 81 - 0
dist/dev/mp-weixin/pages/pool/pool.wxss

@@ -300,6 +300,87 @@
   font-size: 22rpx;
   color: #9ca2b5;
 }
+
+/* 支付方式选择 */
+.payment-method-section {
+  margin-bottom: 32rpx;
+  padding-top: 24rpx;
+  border-top: 1rpx solid #f1f2f6;
+}
+.payment-method-title {
+  display: block;
+  font-size: 26rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 20rpx;
+}
+.payment-methods {
+  display: flex;
+  flex-direction: column;
+  gap: 16rpx;
+}
+.payment-method-item {
+  display: flex;
+  align-items: center;
+  padding: 24rpx 20rpx;
+  border: 2rpx solid #e5e7eb;
+  border-radius: 12rpx;
+  transition: all 0.3s;
+  position: relative;
+}
+.payment-method-item.active {
+  border-color: #5d55e8;
+  background: #f7f5ff;
+}
+.payment-icon {
+  font-size: 36rpx;
+  margin-right: 16rpx;
+}
+.payment-name {
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #222222;
+  flex: 1;
+}
+.payment-info {
+  display: flex;
+  flex-direction: column;
+  flex: 1;
+}
+.points-balance {
+  font-size: 22rpx;
+  color: #9ca2b5;
+  margin-top: 4rpx;
+}
+.points-cost {
+  display: flex;
+  align-items: baseline;
+  margin-right: 16rpx;
+}
+.points-amount {
+  font-size: 32rpx;
+  font-weight: 700;
+  color: #ff9500;
+}
+.points-unit {
+  font-size: 22rpx;
+  color: #ff9500;
+  margin-left: 4rpx;
+}
+.payment-check {
+  width: 36rpx;
+  height: 36rpx;
+  background: #5d55e8;
+  border-radius: 50%;
+  color: #ffffff;
+  font-size: 24rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.pay-button.points-pay {
+  background: linear-gradient(135deg, #ff9500, #ffb347);
+}
 .bottom-safe-area {
   height: 80rpx;
 }

+ 16 - 12
dist/dev/mp-weixin/pages/strong/strong.js

@@ -22,6 +22,10 @@ const _sfc_main = {
     ]);
     const selectedDate = common_vendor.ref("2025年11月20日");
     const showBuyModalFlag = common_vendor.ref(false);
+    const showSellModalFlag = common_vendor.ref(false);
+    const currentStock = common_vendor.ref({});
+    const buyQuantity = common_vendor.ref("100");
+    const sellQuantity = common_vendor.ref("100");
     const checkLogin = () => {
       isLoggedIn.value = utils_auth.isLoggedIn();
       console.log("[强势池] 登录状态:", isLoggedIn.value);
@@ -182,25 +186,25 @@ const _sfc_main = {
         i: showBuyModalFlag.value
       }, showBuyModalFlag.value ? {
         j: common_vendor.o(closeBuyModal),
-        k: common_vendor.t(_ctx.currentStock.name),
-        l: common_vendor.t(_ctx.currentStock.code),
-        m: common_vendor.t(_ctx.currentStock.price),
-        n: common_vendor.o([($event) => _ctx.buyQuantity = $event.detail.value, onBuyQuantityChange]),
-        o: _ctx.buyQuantity,
+        k: common_vendor.t(currentStock.value.name),
+        l: common_vendor.t(currentStock.value.code),
+        m: common_vendor.t(currentStock.value.price),
+        n: common_vendor.o([($event) => buyQuantity.value = $event.detail.value, onBuyQuantityChange]),
+        o: buyQuantity.value,
         p: common_vendor.t(common_vendor.unref(buyTotalAmount).toFixed(2)),
         q: common_vendor.o(handleBuy),
         r: common_vendor.o(() => {
         }),
         s: common_vendor.o(closeBuyModal)
       } : {}, {
-        t: _ctx.showSellModalFlag
-      }, _ctx.showSellModalFlag ? {
+        t: showSellModalFlag.value
+      }, showSellModalFlag.value ? {
         v: common_vendor.o(closeSellModal),
-        w: common_vendor.t(_ctx.currentStock.name),
-        x: common_vendor.t(_ctx.currentStock.code),
-        y: common_vendor.t(_ctx.currentStock.price),
-        z: common_vendor.o([($event) => _ctx.sellQuantity = $event.detail.value, onSellQuantityChange]),
-        A: _ctx.sellQuantity,
+        w: common_vendor.t(currentStock.value.name),
+        x: common_vendor.t(currentStock.value.code),
+        y: common_vendor.t(currentStock.value.price),
+        z: common_vendor.o([($event) => sellQuantity.value = $event.detail.value, onSellQuantityChange]),
+        A: sellQuantity.value,
         B: common_vendor.t(common_vendor.unref(sellTotalAmount).toFixed(2)),
         C: common_vendor.o(handleSell),
         D: common_vendor.o(() => {

+ 14 - 0
dist/dev/mp-weixin/utils/api.js

@@ -132,9 +132,23 @@ const getLeaderboard = () => {
     method: "GET"
   });
 };
+const getUserPointsApi = () => {
+  return request({
+    url: "/v1/points/balance",
+    method: "GET"
+  });
+};
+const getPointsRecordsApi = () => {
+  return request({
+    url: "/v1/points/records",
+    method: "GET"
+  });
+};
 exports.getLeaderboard = getLeaderboard;
+exports.getPointsRecordsApi = getPointsRecordsApi;
 exports.getSuggestions = getSuggestions;
 exports.getUserInfoApi = getUserInfoApi;
+exports.getUserPointsApi = getUserPointsApi;
 exports.getUserPortfolio = getUserPortfolio;
 exports.searchStocks = searchStocks;
 exports.updateUserProfile = updateUserProfile;

+ 21 - 2
src/pages/mine/mine.vue

@@ -78,6 +78,7 @@
 import { ref, onMounted } from 'vue'
 import { onShow } from '@dcloudio/uni-app'
 import { isLoggedIn as checkLogin, getUserInfo as getStoredUserInfo, logout, checkLogin as requireLogin } from '@/utils/auth.js'
+import { getUserPointsApi } from '@/utils/api.js'
 
 const isLoggedIn = ref(false)
 const showPhoneAuth = ref(false)
@@ -86,7 +87,7 @@ const userInfo = ref({
   avatar: '',
   phone: ''
 })
-const points = ref(900)
+const points = ref(0)
 
 /**
  * 页面加载时检查登录状态
@@ -105,7 +106,7 @@ onShow(() => {
 /**
  * 加载用户信息
  */
-const loadUserInfo = () => {
+const loadUserInfo = async () => {
   isLoggedIn.value = checkLogin()
   console.log('[个人中心] 登录状态:', isLoggedIn.value)
   if (isLoggedIn.value) {
@@ -114,6 +115,24 @@ const loadUserInfo = () => {
       userInfo.value = storedInfo
       console.log('[个人中心] 加载用户信息:', userInfo.value)
     }
+    // 获取用户积分
+    await loadUserPoints()
+  }
+}
+
+/**
+ * 加载用户积分
+ */
+const loadUserPoints = async () => {
+  try {
+    const res = await getUserPointsApi()
+    if (res.code === 200 && res.data) {
+      points.value = res.data.totalPoints || 0
+      console.log('[个人中心] 用户积分:', points.value)
+    }
+  } catch (e) {
+    console.error('获取积分失败:', e)
+    points.value = 0
   }
 }
 

+ 29 - 57
src/pages/points/points.vue

@@ -27,17 +27,17 @@
           >
             <view class="item-left">
               <view class="stock-info">
-                <text class="stock-name">{{ item.title }}</text>
+                <text class="stock-name">{{ getTitle(item) }}</text>
               </view>
-              <text class="transaction-time">{{ formatTime(item.timestamp) }}</text>
+              <text class="transaction-time">{{ formatTime(item.createTime) }}</text>
             </view>
             
             <view class="item-right">
-              <text :class="['amount-text', item.type === 'add' ? 'amount-sell' : 'amount-buy']">
-                {{ item.type === 'add' ? '+' : '-' }}{{ item.points }}积分
+              <text :class="['amount-text', item.type === 1 ? 'amount-sell' : 'amount-buy']">
+                {{ item.type === 1 ? '+' : '-' }}{{ item.amount }}积分
               </text>
-              <view :class="['status-badge', item.type === 'add' ? 'status-sell' : 'status-buy']">
-                <text class="status-text">{{ item.type === 'add' ? '获得' : '消耗' }}</text>
+              <view :class="['status-badge', item.type === 1 ? 'status-sell' : 'status-buy']">
+                <text class="status-text">{{ item.type === 1 ? '获得' : '消耗' }}</text>
               </view>
             </view>
           </view>
@@ -59,17 +59,18 @@
 
 <script setup>
 import { ref, computed, onMounted } from 'vue'
+import { getPointsRecordsApi } from '@/utils/api.js'
+import { isLoggedIn as checkLoginStatus } from '@/utils/auth.js'
 
 const records = ref([])
+const loading = ref(false)
 
 // 返回上一页
 const handleBack = () => {
   const pages = getCurrentPages()
   if (pages.length > 1) {
-    // 有上一页,返回
     uni.navigateBack()
   } else {
-    // 没有上一页,跳转到个人中心
     uni.switchTab({
       url: '/pages/mine/mine'
     })
@@ -81,7 +82,7 @@ const groupedRecords = computed(() => {
   const groups = {}
   
   records.value.forEach(item => {
-    const dateKey = formatDate(item.timestamp)
+    const dateKey = formatDate(item.createTime)
     if (!groups[dateKey]) {
       groups[dateKey] = []
     }
@@ -130,67 +131,38 @@ const formatTime = (timestamp) => {
   const date = new Date(timestamp)
   const hours = String(date.getHours()).padStart(2, '0')
   const minutes = String(date.getMinutes()).padStart(2, '0')
-  
   return `${hours}:${minutes}`
 }
 
+// 获取显示标题(优先用后端返回的bizTypeName,其次用remark)
+const getTitle = (item) => {
+  return item.bizTypeName || item.remark || '积分变动'
+}
+
 // 加载积分记录
-const loadRecords = () => {
+const loadRecords = async () => {
+  if (!checkLoginStatus()) {
+    console.log('未登录,无法获取积分记录')
+    return
+  }
+  
+  loading.value = true
   try {
-    const storedRecords = uni.getStorageSync('points_records') || []
-    // 按时间倒序排列
-    records.value = storedRecords.sort((a, b) => b.timestamp - a.timestamp)
+    const res = await getPointsRecordsApi()
+    if (res.code === 200 && res.data) {
+      records.value = res.data
+      console.log('[积分记录] 加载成功,共', records.value.length, '条')
+    }
   } catch (e) {
     console.error('加载积分记录失败:', e)
     records.value = []
-  }
-}
-
-// 初始化模拟数据(仅用于演示)
-const initMockData = () => {
-  const mockRecords = [
-    {
-      title: '每日签到',
-      points: 10,
-      type: 'add',
-      timestamp: Date.now() - 1000 * 60 * 30
-    },
-    {
-      title: '完成交易',
-      points: 5,
-      type: 'add',
-      timestamp: Date.now() - 1000 * 60 * 60 * 2
-    },
-    {
-      title: '查询股票',
-      points: 2,
-      type: 'use',
-      timestamp: Date.now() - 1000 * 60 * 60 * 5
-    },
-    {
-      title: '邀请好友',
-      points: 20,
-      type: 'add',
-      timestamp: Date.now() - 1000 * 60 * 60 * 24
-    },
-    {
-      title: '解锁超短池',
-      points: 18,
-      type: 'use',
-      timestamp: Date.now() - 1000 * 60 * 60 * 24 * 2
-    }
-  ]
-  
-  // 如果没有记录,使用模拟数据
-  if (records.value.length === 0) {
-    records.value = mockRecords
-    uni.setStorageSync('points_records', mockRecords)
+  } finally {
+    loading.value = false
   }
 }
 
 onMounted(() => {
   loadRecords()
-  initMockData()
 })
 </script>
 

+ 164 - 4
src/pages/pool/pool.vue

@@ -128,9 +128,41 @@
           </view>
         </view>
 
+        <!-- 支付方式选择 -->
+        <view class="payment-method-section">
+          <text class="payment-method-title">支付方式</text>
+          <view class="payment-methods">
+            <view 
+              class="payment-method-item" 
+              :class="{ active: paymentMethod === 'wechat' }"
+              @click="paymentMethod = 'wechat'"
+            >
+              <text class="payment-icon">💳</text>
+              <text class="payment-name">微信支付</text>
+              <view class="payment-check" v-if="paymentMethod === 'wechat'">✓</view>
+            </view>
+            <view 
+              class="payment-method-item" 
+              :class="{ active: paymentMethod === 'points' }"
+              @click="paymentMethod = 'points'"
+            >
+              <text class="payment-icon">🪙</text>
+              <view class="payment-info">
+                <text class="payment-name">积分支付</text>
+                <text class="points-balance">余额: {{ userPoints }} 积分</text>
+              </view>
+              <view class="points-cost">
+                <text class="points-amount">{{ selectedPlan === 'daily' ? 180 : 980 }}</text>
+                <text class="points-unit">积分</text>
+              </view>
+              <view class="payment-check" v-if="paymentMethod === 'points'">✓</view>
+            </view>
+          </view>
+        </view>
+
         <view class="modal-footer">
-          <view class="pay-button" @click="handlePurchase">
-            <text class="pay-button-text">确认支付并解锁</text>
+          <view class="pay-button" :class="{ 'points-pay': paymentMethod === 'points' }" @click="handlePurchase">
+            <text class="pay-button-text">{{ paymentMethod === 'points' ? '确认积分支付' : '确认支付并解锁' }}</text>
           </view>
           <text class="agreement-text">点击即表示同意《用户订阅协议》</text>
         </view>
@@ -150,6 +182,8 @@ const showPhoneAuth = ref(false)  // 是否显示手机号授权按钮
 const selectedPlan = ref('daily')
 const selectedDate = ref('2025年11月20日')
 const isLoggedIn = ref(false)
+const paymentMethod = ref('wechat')  // 支付方式: wechat / points
+const userPoints = ref(0)  // 用户积分余额
 
 // 检查登录状态
 const checkLogin = () => {
@@ -158,6 +192,17 @@ const checkLogin = () => {
   return isLoggedIn.value
 }
 
+// 获取用户积分
+const getUserPoints = () => {
+  try {
+    const points = uni.getStorageSync('user_points') || 0
+    userPoints.value = points
+  } catch (e) {
+    console.error('获取积分失败:', e)
+    userPoints.value = 0
+  }
+}
+
 // 检查购买状态
 const checkPurchaseStatus = () => {
   try {
@@ -205,6 +250,7 @@ const showPurchaseModal = () => {
   }
   
   console.log('已登录,显示购买弹窗')
+  getUserPoints()  // 获取最新积分
   showModal.value = true
 }
 
@@ -223,6 +269,23 @@ const handlePurchase = () => {
     return
   }
 
+  // 积分支付逻辑
+  if (paymentMethod.value === 'points') {
+    const requiredPoints = selectedPlan.value === 'daily' ? 180 : 980
+    if (userPoints.value < requiredPoints) {
+      uni.showToast({
+        title: '积分不足,请充值或选择微信支付',
+        icon: 'none'
+      })
+      return
+    }
+    
+    // 扣除积分
+    const newPoints = userPoints.value - requiredPoints
+    uni.setStorageSync('user_points', newPoints)
+    userPoints.value = newPoints
+  }
+
   // 计算过期时间
   const now = Date.now()
   let expireTime = now
@@ -241,7 +304,8 @@ const handlePurchase = () => {
   const purchaseInfo = {
     plan: selectedPlan.value,
     purchaseTime: now,
-    expireTime: expireTime
+    expireTime: expireTime,
+    paymentMethod: paymentMethod.value
   }
   uni.setStorageSync('pool_purchase', purchaseInfo)
 
@@ -253,7 +317,7 @@ const handlePurchase = () => {
 
   // 显示成功提示
   uni.showToast({
-    title: '解锁成功',
+    title: paymentMethod.value === 'points' ? '积分支付成功' : '解锁成功',
     icon: 'success'
   })
 }
@@ -270,12 +334,14 @@ const onHistorySearch = () => {
 onLoad(() => {
   checkLogin()
   checkPurchaseStatus()
+  getUserPoints()
 })
 
 onShow(() => {
   // 每次页面显示时都检查登录状态和购买状态
   checkLogin()
   checkPurchaseStatus()
+  getUserPoints()
 })
 </script>
 
@@ -628,6 +694,100 @@ onShow(() => {
   color: #9ca2b5;
 }
 
+/* 支付方式选择 */
+.payment-method-section {
+  margin-bottom: 32rpx;
+  padding-top: 24rpx;
+  border-top: 1rpx solid #f1f2f6;
+}
+
+.payment-method-title {
+  display: block;
+  font-size: 26rpx;
+  font-weight: 600;
+  color: #222222;
+  margin-bottom: 20rpx;
+}
+
+.payment-methods {
+  display: flex;
+  flex-direction: column;
+  gap: 16rpx;
+}
+
+.payment-method-item {
+  display: flex;
+  align-items: center;
+  padding: 24rpx 20rpx;
+  border: 2rpx solid #e5e7eb;
+  border-radius: 12rpx;
+  transition: all 0.3s;
+  position: relative;
+}
+
+.payment-method-item.active {
+  border-color: #5d55e8;
+  background: #f7f5ff;
+}
+
+.payment-icon {
+  font-size: 36rpx;
+  margin-right: 16rpx;
+}
+
+.payment-name {
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #222222;
+  flex: 1;
+}
+
+.payment-info {
+  display: flex;
+  flex-direction: column;
+  flex: 1;
+}
+
+.points-balance {
+  font-size: 22rpx;
+  color: #9ca2b5;
+  margin-top: 4rpx;
+}
+
+.points-cost {
+  display: flex;
+  align-items: baseline;
+  margin-right: 16rpx;
+}
+
+.points-amount {
+  font-size: 32rpx;
+  font-weight: 700;
+  color: #ff9500;
+}
+
+.points-unit {
+  font-size: 22rpx;
+  color: #ff9500;
+  margin-left: 4rpx;
+}
+
+.payment-check {
+  width: 36rpx;
+  height: 36rpx;
+  background: #5d55e8;
+  border-radius: 50%;
+  color: #ffffff;
+  font-size: 24rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.pay-button.points-pay {
+  background: linear-gradient(135deg, #ff9500, #ffb347);
+}
+
 .bottom-safe-area {
   height: 80rpx;
 }

+ 4 - 0
src/pages/strong/strong.vue

@@ -218,6 +218,10 @@ const stockList = ref([
 
 const selectedDate = ref('2025年11月20日')
 const showBuyModalFlag = ref(false)
+const showSellModalFlag = ref(false)
+const currentStock = ref({})
+const buyQuantity = ref('100')
+const sellQuantity = ref('100')
 
 // 检查登录状态(不弹窗提示)
 const checkLogin = () => {

+ 22 - 0
src/utils/api.js

@@ -222,3 +222,25 @@ export const getLeaderboard = () => {
     method: 'GET'
   })
 }
+
+/**
+ * 获取用户积分余额
+ * @returns {Promise} 返回积分信息 { totalPoints }
+ */
+export const getUserPointsApi = () => {
+  return request({
+    url: '/v1/points/balance',
+    method: 'GET'
+  })
+}
+
+/**
+ * 获取积分记录列表
+ * @returns {Promise} 返回积分记录列表
+ */
+export const getPointsRecordsApi = () => {
+  return request({
+    url: '/v1/points/records',
+    method: 'GET'
+  })
+}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.