绿满眶商城微信小程序-uniapp
xiangpei
6 天以前 70738d032bd80f5b13075f8a13045ff4de57c2c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<template>
  <view class="wap">
    <u-navbar  title="预存款列表">
    </u-navbar>
    <view class="wrapper-show-money">
      <view class="money-view">
        <h3>预存款金额 </h3>
        <view class="money">¥{{walletNum | unitPrice }}</view>
 
      </view>
    </view>
    <view class="wrapper-tabs">
 
      <swiper class="swiper-box"  :current="swiperCurrent">
        <swiper-item class="swiper-item" v-for="index in list.length" :key="index">
          <scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
            <view v-if="depositData.length!=0" class="view-item" v-for="(logItem, logIndex) in depositData" :key="logIndex">
              <view class="view-item-detail">
                <view class="-title">{{logItem.detail}}</view>
                <!-- <view class="-number">{{logItem.detail}}</view> -->
              </view>
              <view class="view-item-change">
                <view class="-money green" v-if="logItem.serviceType == 'WALLET_PAY' || logItem.serviceType == 'WALLET_WITHDRAWAL'"> {{logItem.money | unitPrice}} </view>
                <view class="-money" v-if="logItem.serviceType == 'WALLET_REFUND' || logItem.serviceType == 'WALLET_RECHARGE' || logItem.serviceType == 'WALLET_COMMISSION' ">
                  +{{logItem.money | unitPrice}} </view>
                <view class="-time">{{logItem.createTime}}</view>
              </view>
            </view>
 
            <u-empty v-if="depositData.length==0" mode="history" text="暂无记录" />
      
          </scroll-view>
 
        </swiper-item>
 
      </swiper>
    </view>
  </view>
</template>
 
<script>
import '@/components/uview-components/uview-ui'
import { getUserRecharge, getWalletLog } from "@/api/members";
import { getUserWallet } from "@/api/members";
export default {
  data() {
    return {
      walletNum: 0,
      current: 0,
      swiperCurrent: 0,
      userInfo: "", //用户详情信息
      params: {
        pageNumber: 1,
        pageSize: 10,
        order: "desc",
      },
      depositData: [], //遍历的数据集合
      rechargeList: "", //充值明细列表
      walletLogList: "", //钱包变动列表
      list: [
        // {
        //   name: "充值明细",
        // },
        {
          name: "预存款变动明细",
        },
      ],
    };
  },
  watch: {
    swiperCurrent(index) {
      this.swiperCurrent = index;
    },
  },
  async mounted() {
    this.getWallet();
    let result = await getUserWallet(); //预存款
 
    this.walletNum = result.data.result.memberWallet;
  },
  methods: {
   
    /**分页获取预存款充值记录 */
    getRecharge() {
      getUserRecharge(this.params).then((res) => {
        if (res.data.success) {
          if (res.data.result.records.length != 0) {
            this.depositData.push(...res.data.result.records);
          }
        }
      });
    },
 
    getWallet() {
    
      getWalletLog(this.params).then((res) => {
        if (res.data.success) {
          if (res.data.result.records.length != 0) {
            this.depositData.push(...res.data.result.records);
          }
        }
      });
    },
 
  
    changed(index) {
      this.depositData = [];
      this.swiperCurrent = index;
      this.params.pageNumber = 1;
      if (index == 0) {
        // this.getRecharge();
        this.getWallet();
      } else {
        this.getWallet();
      }
    },
 
    loadMore() {
      this.params.pageNumber++;
      this.getWallet();
    },
  },
};
</script>
 
<style lang="scss" scoped>
.green {
    color: $aider-color-green !important;
  }
  .view-item {
    padding: 32rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .view-item-change {
    text-align: right;
    > .-money {
      font-size: 36rpx;
      color: $main-color;
      font-weight: bold;
    }
    > .-time {
      font-size: 22rpx;
      color: #999;
    }
  }
  .view-item-detail {
    line-height: 1.75;
    > .-title {
      font-size: 28rpx;
    }
    > .-number {
      font-size: 22rpx;
      color: #999;
    }
  }
  .submit-btn {
    line-height: 90rpx;
    text-align: center;
  
    color: #fff;
    background: $main-color;
  
    margin: 0 auto;
    height: 90rpx;
  }
  
  .operation {
    font-size: 32rpx;
    margin-right: 24rpx;
    color: rgb(96, 98, 102);
  }
  .money {
    font-size: 40rpx;
    font-weight: bold;
  }
  
  .money-view {
    height: 100%;
    width: 100%;
    padding: 0 32rpx;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    background-image: linear-gradient(
      25deg,
      $main-color,
      $light-color,
      $aider-light-color
    );
  }
  
  .swiper-item,
  .scroll-v {
    height: 100%;
  }
  
  .swiper-box {
    /* #ifndef H5 */
    height: calc(100vh - 200rpx);
    /* #endif */
  
    /* #ifdef H5 */
    height: calc(100vh - 288rpx);
    /* #endif */
  }
  
  .wap {
    width: 100%;
    height: calc(100vh - 44px);
  }
  
  .wrapper-show-money {
    height: 200rpx;
    // background-image: url('/static/img/main-bg.jpg');
  }
</style>