Răsfoiți Sursa

花卉宝-bug-充值记录总条数都是显示0

ouyang 2 zile în urmă
părinte
comite
c13d861ffa
2 a modificat fișierele cu 20 adăugiri și 1 ștergeri
  1. 4 1
      mallApp/src/api/recharge/index.js
  2. 16 0
      mallApp/src/pages/recharge/list.vue

+ 4 - 1
mallApp/src/api/recharge/index.js

@@ -16,7 +16,10 @@ export const updateShop = data => {
     return https.post('/shop/update', data)
 }
 
-//充值记录列表
+/**
+ * 充值记录列表
+ * 返回分页 list,并附带 Tab 数量:all / waitPay / recharged / cancelled
+ */
 export const getRechargeList = data => {
     return https.get('/recharge/list', data)
 }

+ 16 - 0
mallApp/src/pages/recharge/list.vue

@@ -135,9 +135,25 @@ export default {
       }
       this.getMyRecharge()
     },
+    /**
+     * 用接口返回的各状态数量刷新顶部 Tab。
+     * 与 app-mall /recharge/list 约定:all / waitPay / recharged / cancelled。
+     */
+    applyTabCounts(data) {
+      if (!data) {
+        return
+      }
+      this.tabs[0].value = Number(data.all) || 0
+      this.tabs[1].value = Number(data.waitPay) || 0
+      this.tabs[2].value = Number(data.recharged) || 0
+      this.tabs[3].value = Number(data.cancelled) || 0
+    },
     getMyRecharge () {
       return getRechargeList({ status: this.status,page: this.list.page,searchTime: this.searchTime,startTime: this.startTime,endTime: this.endTime,hdId:this.hdId}).then(res => {
         this.completes(res)
+        if (res && res.code == 1) {
+          this.applyTabCounts(res.data)
+        }
         if (this.$util.isEmpty(res.data)){
           return false
         }