Browse Source

个人-新增提现接口

panyong 4 years ago
parent
commit
20d6dec8ac

+ 5 - 0
htmldev/loan/src/views/partner/wallet/api/index.js

@@ -8,3 +8,8 @@ export const walletList = (page = 1, pageNum = 20) => request({
     pageNum
   }
 })
+
+export const postCashOut = () => request({
+  method: 'POST',
+  url: '/partner/cashOut'
+})

+ 24 - 6
htmldev/loan/src/views/partner/wallet/index.vue

@@ -3,17 +3,18 @@
     <div class="header">
       <h2 class="title">余额(元)</h2>
       <p class="count">{{ totalPrice.toFixed(2) }}</p>
-      <button class="cashing">提现</button>
+      <button class="cashing" @click="funCashOut">提现</button>
     </div>
     <p class="balance">余额明细</p>
     <div class="better-scroll wrapper" ref="wrapper">
       <ul>
         <li class="list" v-for="(item, index) in listData" :key="index">
           <p class="amount">
-            <span>奖励(元):</span>
-            <span>+{{ item.item.toFixed(2) }}</span>
+            <!--logType: 类型,0-收入 1-提现-->
+            <span>{{ item.logType === 0 ? '奖励' : '提现' }}(元):</span>
+            <span>{{ item.logType === 0 ? '+' : '-' }}{{ item.balance.toFixed(2) }}</span>
           </p>
-          <p class="description">推广奖励</p>
+          <p class="description">{{ item.logContent }}</p>
           <p class="create-time">{{ item.createdAt }}</p>
         </li>
         <li class="load-status" v-if="listData.length && booFetchData">
@@ -30,7 +31,7 @@
 <script>
   import BScroll from 'better-scroll'
   import { Toast } from 'vant'
-  import { walletList } from './api'
+  import { walletList, postCashOut } from './api'
 
   const PAGESIZE = 20
   export default {
@@ -48,7 +49,8 @@
         numFetchStatus: 0,
         arrFetchStatus: ['正在加载,请稍后~', '到底了'],
         booFetchData: false,
-        numPositionY: 0
+        numPositionY: 0,
+        booSubmit: false
       }
     },
     activated () {
@@ -62,6 +64,7 @@
         this.numFetchStatus = 0
         this.booFetchData = false
         this.numPositionY = 0
+        this.booSubmit = false
         this.funFetch()
       } else {
         this.$nextTick(() => {
@@ -124,6 +127,21 @@
           Toast('出错啦')
           vm.numFetchStatus = 3
         })
+      },
+      // 提现
+      funCashOut () {
+        if (this.booSubmit) {
+          return
+        }
+        this.booSubmit = true
+        postCashOut().then(res => {
+          this.booSubmit = false
+          if (res.status) {}
+          Toast(res.msg)
+        }).catch(err => {
+          this.booSubmit = false
+          Toast(err)
+        })
       }
     }
   }