zweizhao 7 lat temu
rodzic
commit
00f6ad8ca6
1 zmienionych plików z 84 dodań i 10 usunięć
  1. 84 10
      pages/wo/cash.vue

+ 84 - 10
pages/wo/cash.vue

@@ -2,9 +2,9 @@
   <div class="cash">
     <inner-header title="资金提现"></inner-header>
     <section class="content">
-      <h2>提现到支付宝({{userinfo.alipay}})</h2>
+      <h2>提现到支付宝({{userInfo.alipay}})</h2>
       <div class="input-box">
-        <el-input class="cash-input" placeholder="最少提现1元,每日上限3万元"></el-input>
+        <el-input class="cash-input" placeholder="最少提现1元,每日上限3万元" v-model="coins"></el-input>
         <span class="input-icon">¥</span>
         <el-button type="text" class="get-all" @click="doGetAll">全部提现</el-button>
       </div>
@@ -12,7 +12,7 @@
         可用余额
         <span>¥{{coinInfo.balance}}</span>元
       </div>
-      <el-button class="get-btn" type="primary">提现</el-button>
+      <el-button @click="doGet" class="get-btn" type="primary">提现</el-button>
       <p class="remind-time">预计1~3个工作日到账</p>
       <p>提现说明</p>
       <div class="reminds">
@@ -28,22 +28,37 @@
         </div>
       </div>
     </section>
-    <!-- <script>
-      var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1261469621'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1261469621' type='text/javascript'%3E%3C/script%3E"));
-    </script>-->
+    <el-dialog title="手机验证码确认" :visible.sync="dialogShow">
+      <h1 class="dialog-h1">已向您的手机{{userinfo.mobile}}发送验证码</h1>
+      <div class="ver-input">
+        请输入验证码
+        <el-input v-model="ver"></el-input>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogShow = false">取 消</el-button>
+        <el-button type="primary" @click="doDialogConfirm">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import InnerHeader from '@/components/inner_header.vue'
+import InputVer from '@/components/input/ver'
+import InnerHeader from '@/components/inner_header'
 
 export default {
   components: {
+    InputVer,
     InnerHeader,
   },
   data() {
     return {
-      alipayInfo: {}
+      alipayInfo: {},
+      dialogShow: false,
+      // 提现金额
+      coins: '',
+      // 验证码
+      ver: '',
     }
   },
   computed: {
@@ -55,15 +70,15 @@ export default {
     }
   },
   mounted() {
-    // document.write(unescape("%3Cspan id='cnzz_stat_icon_1261469621'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1261469621' type='text/javascript'%3E%3C/script%3E"))
     this.getAlipayInfo()
+    console.log(this.userinfo)
   },
   methods: {
     /**
      * 全部提现
      */
     doGetAll() {
-
+      this.coins = this.coinInfo.balance
     },
     /**
      * 获取支付宝信息
@@ -74,6 +89,52 @@ export default {
       if(res) {
         this.alipayInfo = res.data
       }
+    },
+    /**
+     * 点击提现
+     */
+    async doGet() {
+      if(!this.coins.trim()) {
+        this.$message('请输入提现金额')
+        return
+      }
+      let res = await this.$post('/api/user/send_mobile_auth_code', {
+        mobile: this.userinfo.mobile,
+        type: 3
+      })
+      if(res) {
+        this.dialogShow = true
+      }
+    },
+    /**
+     * 点击验证码
+     */
+    doDialogConfirm() {
+      if(!this.ver.trim()) {
+        this.$message('请输入验证码')
+        return
+      }
+      this.$confirm('确定要进行取现操作吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        let res = await this.$post('/api/account/take_coins_to_alipay', {
+          coins: +this.coins,
+          payee_real_name: this.userinfo.realname,
+          alipay_account: this.userInfo.alipay,
+          auth_code: this.ver,
+        })
+        if(res) {
+          this.$message({
+            type: 'success',
+            message: '提现成功'
+          })
+          setTimeout(() => {
+            location.reload()
+          }, 1000)
+        }
+      })
     }
   }
 }
@@ -133,4 +194,17 @@ h2 {
   margin-top: 6px;
   line-height: 32px;
 }
+.ver-input {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.ver-input .el-input {
+  margin-left: 10px;
+  width: 280px;
+}
+.dialog-h1 {
+  margin: 10px 0;
+  text-align: center;
+}
 </style>