Quellcode durchsuchen

兑换remove 自定义金额

mht vor 1 Woche
Ursprung
Commit
39568938fc
2 geänderte Dateien mit 40 neuen und 29 gelöschten Zeilen
  1. 21 15
      src/views/Recharge.vue
  2. 19 14
      src/views/Search.vue

+ 21 - 15
src/views/Recharge.vue

@@ -51,20 +51,23 @@
           <div class="diamond-icon">
             <img src="@/assets/images/recharge_zuanshi.png" alt="钻石" class="diamond-img" />
           </div>
-          <template v-if="!item.isCustom">
+          <!-- 注释掉自定义金额相关显示 -->
+          <!-- <template v-if="!item.isCustom"> -->
             <div class="recharge-amount">{{ item.amount }}</div>
             <div class="recharge-price">¥{{ item.price }}</div>
-          </template>
+          <!-- </template>
           <template v-else>
             <div class="recharge-amount">自定义金额</div>
             <div class="recharge-price">点击输入</div>
-          </template>
+          </template> -->
         </div>
       </div>
 
+      <!-- 注释掉自定义金额输入框
       <div v-if="isCustomSelected" class="custom-input">
         <van-field v-model="customAmount" type="number" input-align="center" placeholder="请输入自定义金额(元)" clearable />
       </div>
+      -->
     </div>
 
     <!-- 支付方式 -->
@@ -152,8 +155,8 @@ export default {
       isLoading: false,
       agreementChecked: false,
       agreementVisible: false,
-      // 自定义金额
-      customAmount: '',
+      // 自定义金额 - 已注释功能
+      // customAmount: '',
       // 支付方式类型
       paymentType: PAYMENT_TYPE,
       // 金币兑换权限
@@ -166,15 +169,18 @@ export default {
     },
     // 显示列表 = 产品列表 + 自定义
     rechargeOptionsWithCustom() {
-      if (ALI_CUSTOM && this.paymentType === 'alipay') {
+      // 注释掉自定义金额功能
+      /* if (ALI_CUSTOM && this.paymentType === 'alipay') {
         return [...(this.rechargeOptions || []), { isCustom: true }]
-      } else {
+      } else { */
         return [...(this.rechargeOptions || [])]
-      }
+      // }
     },
     // 是否选择了自定义
     isCustomSelected() {
-      return this.selectedRecharge === this.rechargeOptionsWithCustom.length - 1
+      // 注释掉自定义金额功能
+      // return this.selectedRecharge === this.rechargeOptionsWithCustom.length - 1
+      return false
     }
   },
   created() {
@@ -297,13 +303,13 @@ export default {
       }
 
       // 自定义金额校验
-      if (this.isCustomSelected) {
+      /* if (this.isCustomSelected) {
         const amountNumber = Number(this.customAmount)
         if (!this.customAmount || Number.isNaN(amountNumber) || amountNumber <= 0) {
           this.$toast('请输入有效的自定义金额')
           return
         }
-      }
+      } */
 
       const selectedOption = this.selectedRechargeOption
 
@@ -356,13 +362,13 @@ export default {
         // 构建支付参数
         const payData = {
           userId: this.userInfo.id,
-          productId: product && product.isCustom ? 1018 : product.id
+          productId: product ? product.id : null
         }
 
-        // 自定义金额时追加 amount
-        if (product && product.isCustom) {
+        // 自定义金额时追加 amount - 注释掉自定义金额功能
+        /* if (product && product.isCustom) {
           payData.amount = Number(this.customAmount)
-        }
+        } */
 
         // 调用支付宝H5支付接口
         const res = await aliPayH5(payData, platform)

+ 19 - 14
src/views/Search.vue

@@ -40,21 +40,24 @@
           <div class="diamond-icon">
             <img src="@/assets/images/recharge_zuanshi.png" alt="钻石" class="diamond-img" />
           </div>
-          <template v-if="!item.isCustom">
+          <!-- 注释掉自定义金额相关显示 -->
+          <!-- <template v-if="!item.isCustom"> -->
             <div class="recharge-amount">{{ item.amount }}</div>
             <div class="recharge-price">¥{{ item.price }}</div>
-          </template>
+          <!-- </template>
           <template v-else>
             <div class="recharge-amount">自定义金额</div>
             <div class="recharge-price">点击输入</div>
-          </template>
+          </template> -->
         </div>
       </div>
 
+      <!-- 注释掉自定义金额输入框
       <div v-if="isCustomSelected" class="custom-input">
         <van-field v-model="customAmount" type="number" input-align="center" placeholder="请输入自定义金额(元)" clearable
           :disabled="!isLoggedIn" />
       </div>
+      -->
     </div>
 
     <!-- 支付方式 -->
@@ -132,8 +135,8 @@ export default {
       paymentMethod: 'alipay',
       agreementChecked: false,
       agreementVisible: false,
-      // 自定义金额
-      customAmount: '',
+      // 自定义金额 - 已注释功能
+      // customAmount: '',
       // 支付方式类型
       paymentType: PAYMENT_TYPE,
       // 登录状态
@@ -153,15 +156,18 @@ export default {
     },
     // 显示列表 = 产品列表 + 自定义
     coinOptionsWithCustom() {
-      if (ALI_CUSTOM) {
+      // 注释掉自定义金额功能
+      /* if (ALI_CUSTOM) {
         return [...(this.coinOptions || []), { isCustom: true }]
-      } else {
+      } else { */
         return [...(this.coinOptions || [])]
-      }
+      // }
     },
     // 是否选择了自定义
     isCustomSelected() {
-      return this.selectedRecharge === this.coinOptionsWithCustom.length - 1
+      // 注释掉自定义金额功能
+      // return this.selectedRecharge === this.coinOptionsWithCustom.length - 1
+      return false
     }
   },
   methods: {
@@ -291,18 +297,17 @@ export default {
       }
 
       // 自定义金额校验
-      if (this.isCustomSelected) {
+      /* if (this.isCustomSelected) {
         const amountNumber = Number(this.customAmount)
         if (!this.customAmount || Number.isNaN(amountNumber) || amountNumber <= 0) {
           this.$toast('请输入有效的自定义金额')
           return
         }
-      }
+      } */
 
       const selectedOption = this.selectedRechargeOption
-      const priceToShow = selectedOption && selectedOption.isCustom
-        ? (Number(this.customAmount) || 0)
-        : (selectedOption?.price || 0)
+      // 自定义金额已注释,直接显示产品价格
+      const priceToShow = selectedOption?.price || 0
 
       // 使用二次确认弹窗
       this.$dialog.confirm({