Просмотр исходного кода

cps:流水列表、详情、钱包提现

panyong 3 лет назад
Родитель
Сommit
4413659961

+ 0 - 1
htmldev/cps/src/main.js

@@ -33,4 +33,3 @@ new Vue({
     window.SITE_CONFIG.storeState = cloneDeep(store.state)
   }
 }).$mount('#app')
-// TODO 生成支付二维码

+ 3 - 3
htmldev/cps/src/store/modules/common.js

@@ -5,9 +5,9 @@ const state = {
     user_head_img_url: '', // 用户头像
     user_nickname: '', // 用户昵称
     user_sex: '', // 用户性别
-    user_balance: '', // 用户可提现余额(单位为分)
-    user_crash_balance: '', // 累计提现(单位为分)
-    user_unreceive_balance: '', // 用户未结算金额(单位为分
+    user_balance: 0, // 用户可提现余额(单位为分)
+    user_crash_balance: 0, // 累计提现(单位为分)
+    user_unreceive_balance: 0, // 用户未结算金额(单位为分)
     created_at: '' // 注册时间
   },
   orderType: [] // 订单类型

+ 7 - 5
htmldev/cps/src/views/bill/child/main.vue

@@ -18,19 +18,21 @@
             class="van-loading__text">下拉刷新</span>
         </div>
       </li>
-      <!--TODO 提现有状态-->
+      <!--TODO 流水ID-->
       <li
         v-for="(item, index) in list"
         :key="index"
-        class="list-item border-bottom-1px">
+        class="list-item border-bottom-1px"
+        @click="$emit('fetchBillDetail', item.finance_number)">
         <div class="wrap">
-          <p class="label">{{ ['', '收入', '支出'][item.finance_type] }}金额</p>
-          <p class="money">{{ item.finance_type === 1 ? '+' : '-'}}¥{{ item.finance_balance | fen2Yuan}}</p>
+          <p class="label">{{ ['', '收入', '支出'][item.finance_type] }}金额</p>
+          <p class="money">{{ item.finance_type === 1 ? '+' : '-' }}¥{{ item.finance_balance | fen2Yuan }}</p>
         </div>
         <div class="wrap">
-          <p class="label">提现状态</p>
+          <p class="label">提现状态</p>
           <p class="money">{{ ['提现中', '已到账', '提现失败'][item.cash_status] }}</p>
         </div>
+        <p class="date">流水编号:{{ item.finance_number }}</p>
         <p class="date">创建时间:{{ item.created_at }}</p>
       </li>
       <li class="pullup-wrapper">

+ 3 - 0
htmldev/cps/src/views/bill/index.vue

@@ -16,14 +16,17 @@
     <Main
       :financeType="0"
       v-show="numActiveTab === 0"
+      @fetchBillDetail="fetchBillDetail"
       ref="all"/>
     <Main
       :financeType="1"
       v-show="numActiveTab === 1"
+      @fetchBillDetail="fetchBillDetail"
       ref="income"/>
     <Main
       :financeType="2"
       v-show="numActiveTab === 2"
+      @fetchBillDetail="fetchBillDetail"
       ref="withdrawCash"/>
     <van-popup
       class="fbt-van-popup"

+ 20 - 5
htmldev/cps/src/views/withdrawCash/index.vue

@@ -15,8 +15,9 @@
         @input="amount = amount.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0\d*/, '0').replace(/^\./, '0.')">
       </van-field>
       <p class="help">
-        <span>可提现金额 736.28元</span>
-        <a href="javascript:;">全部提现></a>
+        <span>可提现金额 ¥{{ userinfo.user_balance | fen2Yuan }}元</span>
+        <a href="javascript:;"
+           @click="allWithdrawCash">全部提现></a>
       </p>
       <van-button
         class="btn-withdraw-cash"
@@ -31,8 +32,8 @@
 <script>
 import { Field, Button, Toast } from 'vant'
 import { apiUserCash } from './api/api'
-import { yuan2Fen } from '@/utils'
-// todo 点击全部提现把钱包余额的值传过来,提现接口调用成功,刷新用户信息接口
+import { fen2Yuan, yuan2Fen } from '@/utils'
+
 export default {
   name: 'index',
   components: {
@@ -45,7 +46,20 @@ export default {
       booLock: false
     }
   },
+  computed: {
+    userinfo () {
+      return this.$store.state.common.userinfo
+    }
+  },
   methods: {
+    // 全部提现
+    allWithdrawCash () {
+      const amount = this.userinfo.user_balance
+      if (amount <= 0) {
+        return
+      }
+      this.amount = fen2Yuan(amount)
+    },
     async withdrawCash () {
       const amount = yuan2Fen(this.amount)
       if (amount <= 0) {
@@ -56,7 +70,8 @@ export default {
         const { status, msg } = await apiUserCash(amount)
         this.booLock = false
         if (status) {
-
+          // 更新用户信息
+          this.$store.dispatch('common/getUserInfo')
         } else {
           Toast(msg)
         }