From 1f72f53ed3cab6bdb0d63ed4c2f0fd740f68d575 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Thu, 24 Apr 2025 21:14:38 +0800
Subject: [PATCH] feat: 充值

---
 src/page/user/recharge.vue |   64 ++++++++++++++++++++++++--------
 1 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/src/page/user/recharge.vue b/src/page/user/recharge.vue
index 7edccc9..b157201 100644
--- a/src/page/user/recharge.vue
+++ b/src/page/user/recharge.vue
@@ -16,14 +16,30 @@
       </template>
     </van-nav-bar>
     <main>
-      <div>
+      <div class="form-block">
+        <mt-field
+          :label="$t('充值')"
+          :placeholder="$t('请输入充值金额')"
+          type="text"
+          v-model="rechargeMoney"
+        >
+        </mt-field>
+      </div>
+      <div class="btnbox">
+        <span class="text-center btnok loginout" @click="tosubmit">{{
+          $t("确认")
+        }}</span>
+        <span class="text-center btnok loginout" @click="goOnline">{{
+          $t("kf")
+        }}</span>
+      </div>
+      <!-- <div>
         <div class="main-title">{{ $t("支持得支付渠道") }}</div>
         <van-cell
           is-link
           :title="paymentSelectData.channelAccount || $t('請選擇')"
           @click="paymentShow = true"
         />
-        <!-- paymentSelectData.channelMinLimit -->
         <van-action-sheet
           v-model="paymentShow"
           :actions="paymentActions"
@@ -62,14 +78,11 @@
             is-link
             :title="$t(rechargeAccountData.key) || $t('請選擇')"
           />
-          <!-- @click="rechargeAccountShow = true" -->
           <van-action-sheet
             v-model="rechargeAccountShow"
             :actions="rechargeAccountActions"
             :cancel-text="$t('qx')"
           />
-          <!-- close-on-click-action -->
-          <!-- @select="rechargeAccountSelect" -->
           <div class="main-title">{{ $t("請選擇充值金額") }}</div>
           <div class="white-input">
             <input type="number" :value="value" @input="inputValue" />
@@ -112,7 +125,6 @@
               </el-upload>
             </div>
           </div>
-          <!--  :disabled="butFlg" -->
           <van-button
             class="but"
             type="primary"
@@ -121,7 +133,7 @@
             >{{ $t("hj172") }}</van-button
           >
         </template>
-      </div>
+      </div> -->
     </main>
   </div>
 </template>
@@ -130,7 +142,7 @@
 import { ActionSheet } from "vant";
 import ClipboardJS from "clipboard";
 import apiUrl from "@/axios/api.url.js";
-import { siteGetPayInfo, selCzFn } from "../../axios/api";
+import { siteGetPayInfo, selCzFn, saveUserRecharge } from "../../axios/api";
 import { Notify } from "vant";
 import { rechargeAccountActions } from "@/utils/rechargeActions";
 // baseURL
@@ -158,11 +170,24 @@
       showBtn: true,
       imgStatus: false,
       form: {
-        img1key: "",
+        img1key: ""
       },
+      rechargeMoney: null
     };
   },
   methods: {
+    async tosubmit() {
+      const data = await saveUserRecharge({ amt: this.rechargeMoney });
+      if (data.status === 0) {
+        Toast(data.msg);
+        this.$router.push("/user");
+      } else {
+        Toast(data.msg);
+      }
+    },
+    goOnline() {
+      this.$router.push("/service");
+    },
     judgeValue() {
       console.log(this.form.img1key, this.value);
       if (this.form.img1key && this.value) {
@@ -185,7 +210,7 @@
       const res = await selCzFn({
         payTypeId: this.paymentSelectData.id,
         payAmt: this.value,
-        img: this.form.img1key,
+        img: this.form.img1key
       });
       if (res.status === 0) {
         Notify({ type: "success", message: this.$t("hj182") });
@@ -198,7 +223,7 @@
     async getPayInfos() {
       const res = await siteGetPayInfo();
       if (res.status === 0) {
-        res.data.map((item) => {
+        res.data.map(item => {
           item.name = item.channelAccount;
         });
         this.paymentActions = res.data;
@@ -230,7 +255,7 @@
     },
     copyText(e, data) {
       var clipboard = new ClipboardJS(".copy-button", {
-        text: () => data,
+        text: () => data
       });
 
       clipboard.on("success", () => {
@@ -250,13 +275,13 @@
     },
     paymentSelect(e) {
       this.paymentSelectData = e;
-      this.rechargeAccountActions.map((item) => {
+      this.rechargeAccountActions.map(item => {
         if (item.key === e.assetsType) {
           this.rechargeAccountData = item;
         }
       });
-    },
-  },
+    }
+  }
 };
 </script>
 
@@ -389,4 +414,11 @@
   width: 2.740741rem;
   height: 2.740741rem;
 }
-</style>
\ No newline at end of file
+
+.btnbox {
+  display: flex;
+  .loginout {
+    margin-right: 0.6rem;
+  }
+}
+</style>

--
Gitblit v1.9.3