Kaynağa Gözat

cps:收支明细

panyong 3 yıl önce
ebeveyn
işleme
c2524d5bfc

+ 1 - 1
htmldev/cps/src/api/request.js

@@ -53,7 +53,7 @@ request.interceptors.request.use(request => {
 
   // 因为微信开发者工具重复授权,本地开发时写死
   if (/^(0|192|10|localhost)/.test(domain)) {
-    request.headers.wechatToken = '9ea3cae20b9a7f02de19ad0c02d02349'
+    request.headers.wechatToken = '25e4dc52bab5d5726fc7c14cf7dfdfec'
   } else {
     request.headers.wechatToken = getCookieValue('fanbutingwechatToken')
   }

+ 11 - 1
htmldev/cps/src/views/bill/child/main.vue

@@ -53,6 +53,12 @@ export default {
   components: {
     'van-loading': Loading
   },
+  props: {
+    financeType: {
+      type: Number,
+      default: 0
+    }
+  },
   data () {
     return {
       finished: false, // 所有数据是否加载完
@@ -98,7 +104,11 @@ export default {
       this.isFetchLock = true
       this.pagenum++
       try {
-        const { status, data, msg } = await apiOrderList({ page: this.pagenum, page_size: this.pagesize })
+        const { status, data, msg } = await apiOrderList({
+          page: this.pagenum,
+          page_size: this.pagesize,
+          finance_type: this.financeType // 流水类型 0全部 1收入 2支出
+        })
         if (status) {
           const { list } = data
           // 下拉刷新数据清空

+ 23 - 2
htmldev/cps/src/views/bill/index.vue

@@ -7,12 +7,24 @@
       :color="'#FA4A4A'"
       :title-active-color="'rgba(51, 51, 51, 1)'"
       :title-inactive-color="'#666666'"
-      ref="myTabs">
+      ref="myTabs"
+      @change="handleTabChange">
       <van-tab title="全部"></van-tab>
       <van-tab title="收入"></van-tab>
       <van-tab title="提现"></van-tab>
     </van-tabs>
-    <Main/>
+    <Main
+      :financeType="0"
+      v-show="numActiveTab === 0"
+      ref="all"/>
+    <Main
+      :financeType="1"
+      v-show="numActiveTab === 1"
+      ref="income"/>
+    <Main
+      :financeType="2"
+      v-show="numActiveTab === 2"
+      ref="withdrawCash"/>
     <van-popup
       class="fbt-van-popup"
       v-model="showDetail"
@@ -69,6 +81,15 @@ export default {
     setTimeout(() => {
       this.$refs.myTabs.resize()
     }, 500)
+  },
+  methods: {
+    handleTabChange (val) {
+      const allScrolls = ['all', 'income', 'withdrawCash']
+      this.$nextTick(() => {
+        const scroll = this.$refs[allScrolls[val]].scroll
+        scroll && scroll.refresh()
+      })
+    }
   }
 }
 </script>

+ 12 - 0
htmldev/cps/src/views/withdrawCash/api/api.js

@@ -0,0 +1,12 @@
+import request from '@/api/request'
+
+/**
+ * 提现
+ */
+export const apiUserCash = (amount) => request({
+  method: 'GET',
+  url: '/api/user/cash',
+  params: {
+    amount
+  }
+})

+ 29 - 4
htmldev/cps/src/views/withdrawCash/index.vue

@@ -8,7 +8,7 @@
       <p class="explain">每日可提现一次,最低提现金额1元</p>
       <van-field
         class="fbt-van-cell"
-        v-model="amount"
+        v-model.trim="amount"
         :border="false"
         label="¥"
         placeholder="请输入"
@@ -20,14 +20,18 @@
       </p>
       <van-button
         class="btn-withdraw-cash"
-        type="default">提现
+        type="default"
+        :disabled="booLock"
+        @click="withdrawCash">提现
       </van-button>
     </div>
   </div>
 </template>
 
 <script>
-import { Field, Button } from 'vant'
+import { Field, Button, Toast } from 'vant'
+import { apiUserCash } from './api/api'
+import { yuan2Fen } from '@/utils'
 
 export default {
   name: 'index',
@@ -37,7 +41,28 @@ export default {
   },
   data () {
     return {
-      amount: ''
+      amount: '',
+      booLock: false
+    }
+  },
+  methods: {
+    async withdrawCash () {
+      const amount = yuan2Fen(this.amount)
+      if (amount <= 0) {
+        return
+      }
+      try {
+        this.booLock = true
+        const { status, msg } = await apiUserCash(amount)
+        this.booLock = false
+        if (status) {
+
+        } else {
+          Toast(msg)
+        }
+      } catch (err) {
+        this.booLock = false
+      }
     }
   }
 }