wkw 1 week ago
parent
commit
dd1149c1d4
2 changed files with 24 additions and 14 deletions
  1. 22 12
      src/pages/trade/index.vue
  2. 2 2
      src/utils/web.js

+ 22 - 12
src/pages/trade/index.vue

@@ -117,14 +117,14 @@
               <view class="game-order-num">
                 <view class="game-num-txt">
                   <view>{{`${item.address.slice(0, 4)}...${item.address.slice(-4)}` }}</view>
-                  <view class="game-num-num">{{ gameDetail?.title }}</view>
+                  <view class="game-num-num">{{ gameDetail?.title }} - {{ (Number(item.prize) || 0).toFixed(7) }}</view>
                 </view>
                 <view class="game-num-txt" v-if="item.is_self && item.is_prize && gameCheck == 0">
                   <view class="game-item-btn" @click="awardFun(item)">{{item.is_receive?'已领取':'领取'}}</view>
                 </view>
                 <view class="game-num-txt" v-else>
                   <view>排名赢局</view>
-                  <view class="game-num-num">{{ item.score }}</view>
+                  <view class="game-num-num">{{ item.net_wins }}</view>
                 </view>
               </view>
             </view>
@@ -362,8 +362,13 @@ const changeSign = async () =>{
   }
 }
 // 报名
-const getMatchEnroll = async () =>{
-  let res = await matchEnroll({dapp_id:15,match_id:gameList.value[gameCheck.value]?.id,address:walletAddress.value});
+const getMatchEnroll = async (hash) =>{
+  let res = await matchEnroll({
+    dapp_id:15,
+    match_id:gameList.value[gameCheck.value]?.id,
+    address:walletAddress.value,
+    entry_hash:hash
+  });
   if (res.status == 200) {
     uni.hideLoading()
     uni.showToast({
@@ -394,7 +399,7 @@ const handleTokenSignUp = async (signUpFn, price) => {
   try {
     const result = await signUpFn(privateKey.value, price);
     if (result.status === "success") {
-      await getMatchEnroll();
+      await getMatchEnroll(result.hash);
     } else {
       uni.hideLoading();
       uni.showToast({
@@ -430,8 +435,13 @@ const awardFun = async (item) => {
   }
 };
 // 领取用户奖金
-const getClaimPrize = async () =>{
-  let res = await claimPrize({dapp_id:15,match_id:gameDetail.value?.id,address:walletAddress.value});
+const getClaimPrize = async (hash) =>{
+  let res = await claimPrize({
+    dapp_id:15,
+    match_id:gameDetail.value?.id,
+    address:walletAddress.value,
+    receive_hash:hash
+  });
   if (res.status == 200) {
     uni.hideLoading();
     uni.showToast({
@@ -451,7 +461,7 @@ const getsendSingleReward = async (prize_money) =>{
   try {
     const result = await sendSingleReward(privateKey.value,prize_money);
     if (result.status === "success") {
-      await getClaimPrize();
+      await getClaimPrize(result.hash);
     }else{
       uni.hideLoading();
       uni.showToast({
@@ -491,7 +501,6 @@ const onRefresh = () => {
   }
 .home {
   height: 1100px;
-  overflow: hidden;
   // position: absolute;
   // top: 0;
   // bottom: 0;
@@ -516,7 +525,7 @@ const onRefresh = () => {
   }
 }
 .content {
-   height: 1100px;
+  height: 1100px;
   display: flex;
   flex-direction: column;
   align-items: center;
@@ -776,8 +785,9 @@ const onRefresh = () => {
   }
   .game-list {
     width: 100%;
-    height: 600px;
-    overflow: auto;
+    // height: 600px;
+    // overflow: auto;
+    padding-bottom: 50px;
     .game-list-item {
       display: flex;
       justify-content: space-between;

+ 2 - 2
src/utils/web.js

@@ -69,7 +69,7 @@ async function sendSingleReward(privateKey, amount) {
         const signed = await web3.eth.accounts.signTransaction(tx, privateKey);
         const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
 
-        return { status: "success", receipt };
+        return { status: "success", hash: receipt.transactionHash };
 
     } catch (error) {
         const errMsg = error.message || "奖励发放失败,未知错误";
@@ -145,7 +145,7 @@ async function tokenSignUp(privateKey, amount, type) {
         }, privateKey);
 
         const receipt = await web3.eth.sendSignedTransaction(depositTx.rawTransaction);
-        return { status: "success", receipt };
+        return { status: "success", hash: receipt.transactionHash };
 
     } catch (error) {
         console.error("❌ 报名流程出错:", JSON.stringify(error, Object.getOwnPropertyNames(error), 2));