Ver Fonte

提现金额限制

谢杰标 há 2 anos atrás
pai
commit
5f4ff5b44d
1 ficheiros alterados com 48 adições e 29 exclusões
  1. 48 29
      pages/cashout/index.vue

+ 48 - 29
pages/cashout/index.vue

@@ -9,9 +9,8 @@
     <view class="cash-ward-tips">
       <view>提现注意事项:</view>
       <view>1.当佣金被结算时有一定的冻结期,被解冻的佣金方可提现 </view>
-      <view
-        >2.微信打款当日单笔金额最多500元,当日最多20000元2.通常在1-3个工作日内可到账</view
-      >
+      <view>2.微信打款当日单笔金额1元到200元,当日最多1000元 </view>
+      <view>3.通常在1-3个工作日内可到账</view>
     </view>
     <view class="bg_f3"></view>
     <view class="cash-ward-bom fl_b u-border-bottom" @click="toRecord">
@@ -29,17 +28,20 @@
         <view class="popup-main-title u-border-bottom">确认提现</view>
         <view class="popup-main-money u-border-bottom">
           <text>提现金额</text>
-          <u--input
-            placeholder="请输入提现金额"
-            v-model.number="money"
-            type="number"
-            border="node"
-            placeholderStyle="fontSize:36rpx"
-            inputAlign="center"
-            color="#24263D"
-            fontSize="36px"
-            @blur="changeMoney"
-          ></u--input>
+          <u--form :model="form" errorType="toast" ref="uForm" :rules="rules">
+            <u-form-item label=" " prop="cash" label-width="0">
+              <u--input
+                placeholder="请输入提现金额"
+                v-model.number="form.cash"
+                type="number"
+                border="node"
+                placeholderStyle="fontSize:36rpx"
+                inputAlign="center"
+                color="#24263D"
+                fontSize="36px"
+              ></u--input>
+            </u-form-item>
+          </u--form>
         </view>
         <view class="popup-main-mode fl_b u-border-bottom">
           <view class="fl"
@@ -67,8 +69,20 @@ export default {
   data() {
     return {
       show: false,
-      money: 0,
       options: {},
+      form: {
+        cash: 0,
+      },
+      rules: {
+        cash: [
+          {
+            validator: (rule, value, callback) => {
+              return value >= 1 && value <= 200;
+            },
+            message: "提现金额需在1至200元之间",
+          },
+        ],
+      },
     };
   },
   onShow() {
@@ -86,10 +100,10 @@ export default {
   methods: {
     changeMoney(val) {
       val *= 1;
-      if (val < 0) {
-        this.money = 0;
+      if (val < 1) {
+        this.form.cash = 0;
       } else if (val >= this.userInfo.cash) {
-        this.money = this.userInfo.cash;
+        this.form.cash = this.userInfo.cash >= 200 ? 200 : this.userInfo.cash;
       }
     },
     close() {
@@ -99,7 +113,7 @@ export default {
       checkBindGzh().then((res) => {
         if (res || process.env.NODE_ENV == "development") {
           this.show = true;
-          this.money = this.userInfo.cash;
+          this.form.cash = this.userInfo.cash >= 200 ? 200 : this.userInfo.cash;
         } else {
           authorize();
         }
@@ -111,16 +125,16 @@ export default {
       });
     },
     withdrawal() {
-      if (!this.money) {
-        this.$u.toast("请输入提现金额");
-        return;
-      }
-
-      withdrawal({ cash: this.money }).then((res) => {
-        this.show = false;
-        this.$u.toast("提现成功");
-        this.$store.dispatch("getUserInfo");
-      });
+      this.$refs.uForm
+        .validate()
+        .then((res) => {
+          withdrawal(this.form).then((res) => {
+            this.$u.toast("提现成功", 2000);
+            this.show = false;
+            this.$store.dispatch("getUserInfo");
+          });
+        })
+        .catch((errors) => {});
     },
   },
   computed: {
@@ -228,6 +242,11 @@ page {
       border-radius: 136rpx;
       margin-top: 70rpx;
     }
+    /deep/ .u-form {
+      .u-form-item__body {
+        padding: 0;
+      }
+    }
   }
 }
 </style>