From 52db6449374a35cb9e6f687019f6bb7cad7ea19e Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Mon, 16 Mar 2026 15:51:25 +0800
Subject: [PATCH] 充值列表增加动态获取充值类型选择

---
 src/page/user/recharge.vue |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/page/user/recharge.vue b/src/page/user/recharge.vue
index 6fbf787..728a68d 100644
--- a/src/page/user/recharge.vue
+++ b/src/page/user/recharge.vue
@@ -38,11 +38,14 @@
           <div style="font-size: 12px;">
             If you encounter any deposit problems, please contact online customer service
           </div>
-          <div style="display: flex;justify-content: space-between;align-items: center;margin-top: 20px;">
-            <div class="payclass" @click="paytype=0" :style="paytype==0?'border: 1px solid #1989FA;':'border: 1px solid  #e5e8ed;'">Pay</div>
-            <div class="payclass" @click="paytype=2" :style="paytype==2?'border: 1px solid #1989FA;':'border: 1px solid  #e5e8ed;'">Pay 1</div>
-            <div class="payclass" @click="paytype=1"  :style="paytype==1?'border: 1px solid #1989FA;':'border: 1px solid  #e5e8ed;'">Pay 2</div>
-            <!-- <div class="payclass" @click="paytype=3"  :style="paytype==3?'border: 1px solid #1989FA;':'border: 1px solid  #e5e8ed;'">Pay 3</div> -->
+          <div style="display: flex;justify-content: space-between;align-items: center;margin-top: 20px;flex-wrap: wrap;gap: 10px;">
+            <div
+              v-for="(item, index) in payOptionList"
+              :key="index"
+              class="payclass"
+              @click="paytype = item.param"
+              :style="paytype === item.param ? 'border: 1px solid #1989FA;' : 'border: 1px solid #e5e8ed;'"
+            >{{ item.name }}</div>
           </div>
           <van-button class="but" type="primary" style="margin-top: 1.04rem; margin-bottom: 1.04rem"
             @click="selCzFns">{{ $t("hj172") }}</van-button>
@@ -60,6 +63,7 @@
   import apiUrl from "@/axios/api.url.js";
   import {
     siteGetPayInfo,
+    getPayOptionList,
     selCzFn,
     thirdPartyRecharge
   } from "../../axios/api";
@@ -77,6 +81,7 @@
     },
     mounted() {
       this.getPayInfos();
+      this.fetchPayOptionList();
     },
     // getPayInfo
     data() {
@@ -99,7 +104,8 @@
         rechargeAccountActions: rechargeAccountActions,
         showBtn: true,
         imgStatus: false,
-        paytype: 0,
+        payOptionList: [],
+        paytype: null,
         form: {
           img1key: "",
         },
@@ -119,9 +125,12 @@
         this.judgeValue();
       },
       async selCzFns() {
+        if (this.paytype === null || this.paytype === undefined) {
+          return Notify(this.$t("請選擇充值金額") || "Please select a payment method");
+        }
         const res = await thirdPartyRecharge({
           tradeAmoun: this.value,
-          type:this.paytype
+          type: this.paytype
         });
         console.log(res);
         if (res.status == 0) {
@@ -148,6 +157,15 @@
         // }
         //  Notify("请上传文件");
       },
+      async fetchPayOptionList() {
+        const res = await getPayOptionList();
+        if (res.status === 0 && res.data && Array.isArray(res.data)) {
+          this.payOptionList = res.data;
+          if (this.payOptionList.length > 0 && this.paytype === null) {
+            this.paytype = this.payOptionList[0].param;
+          }
+        }
+      },
       async getPayInfos() {
         const res = await siteGetPayInfo();
         if (res.status === 0) {

--
Gitblit v1.9.3