Browse Source

用户中心:充值输入0或者负数,未有加限制,可以跳转到支付类型页面了

mydq 5 năm trước cách đây
mục cha
commit
c349ceb120
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      src/main/webapp/pages/open/myAccount/recharge.jsp

+ 8 - 2
src/main/webapp/pages/open/myAccount/recharge.jsp

@@ -35,7 +35,7 @@
                 <div class="cz00">
                     <form id="fromRecharge">
                         <span class="cz-font"><span class="xinghao" >*</span>充值金额:</span>
-                        <input type="text" name="orderAmount" placeholder="" class="cz">
+                        <input type="number" name="orderAmount" id="orderAmount" placeholder="" class="cz">
                         <button type="button"  onclick="toRecharge()" class="cz-but">充值</button>
                     </form>
 
@@ -51,11 +51,17 @@
 </body>
 <script>
 function toRecharge() {
+    var amount = $("#orderAmount").val();
+    if (isNaN(amount) || amount <= 0){
+        $("#orderAmount").val(0);
+        swal("请输入正确的金额!");
+        return
+    }
     $.post("<%=basePath%>/open/myAccount/toRecharge.action",$("#fromRecharge").serialize(),function (ret) {
         if(ret.stateCode==200) {
             location.href="<%=basePath%>/open/myAccount/payment.htm?orderNumber="+ret.data.orderNumber+"&orderAmount="+ret.data.orderAmount;
         }else {
-            alert("充值失败")
+            swal("充值失败")
         }
     })
 }