Commit c1de8bf3d503ebad5a279ffc258458ba4e25567d
Merge branch 'branch' of http://gitlab1.renniting.cn/web_developers/jy_parkingOS into branch
Showing
1 changed file
with
72 additions
and
115 deletions
pages/rechargeDetail/rechargeDetail.vue
... | ... | @@ -58,77 +58,30 @@ |
58 | 58 | |
59 | 59 | <view class="" v-if="orderList.length > 0"> |
60 | 60 | |
61 | - <uni-list class="rechargeWrap"> | |
61 | + <uni-list class="rechargeWrap" v-for="(item, index) in orderList" :key="index"> | |
62 | 62 | <view class="recordCon uni-list-cell-pd"> |
63 | - <text>+66</text> | |
64 | - <text>充值成功</text> | |
63 | + <text class="color-black">{{item.changeFeeDetail}}</text> | |
64 | + <text>{{item.payStateDesc}}</text> | |
65 | 65 | </view> |
66 | 66 | <view class="recordCon uni-list-cell-pd"> |
67 | - <text class="color-green">微信充值</text> | |
68 | - <text>2020-10-01 01:01:01</text> | |
69 | - </view> | |
70 | - </uni-list> | |
71 | - | |
72 | - <uni-list class="rechargeWrap"> | |
73 | - <view class="recordCon uni-list-cell-pd"> | |
74 | - <text>+66</text> | |
75 | - <text>充值成功</text> | |
76 | - </view> | |
77 | - <view class="recordCon uni-list-cell-pd"> | |
78 | - <text class="color-blue">支付宝充值</text> | |
79 | - <text>2020-10-01 01:01:01</text> | |
80 | - </view> | |
81 | - </uni-list> | |
82 | - | |
83 | - <uni-list class="rechargeWrap"> | |
84 | - <view class="recordCon uni-list-cell-pd"> | |
85 | - <text>+66</text> | |
86 | - <text>充值成功</text> | |
87 | - </view> | |
88 | - <view class="recordCon uni-list-cell-pd"> | |
89 | - <text class="color-red">线下公对公充值</text> | |
90 | - <text>2020-10-01 01:01:01</text> | |
91 | - </view> | |
92 | - </uni-list> | |
93 | - | |
94 | - <uni-list class="rechargeWrap"> | |
95 | - <view class="recordCon uni-list-cell-pd"> | |
96 | - <text>-66</text> | |
97 | - <text>支付成功</text> | |
98 | - </view> | |
99 | - <view class="recordCon uni-list-cell-pd"> | |
100 | - <text class="color-green">购买卡券</text> | |
101 | - <text>2020-10-01 01:01:01</text> | |
102 | - </view> | |
103 | - <view class="rechargeArrow"> | |
104 | - > | |
67 | + <text class="color-green">{{item.typeName}}</text> | |
68 | + <text>{{item.opTime}}</text> | |
105 | 69 | </view> |
106 | 70 | </uni-list> |
71 | + <view class="grace-loading text-center jy-fix-height34" v-if="isLoadAll">{{ loadingTxt }}</view> | |
107 | 72 | |
73 | + </view> | |
108 | 74 | |
75 | + <view v-else class="margin-top-30"> | |
76 | + <image class="marginAuto" src="../../static/vipcard/novipcard.png" mode="aspectFit"></image> | |
77 | + <view class="text-center"> | |
78 | + 暂无记录 | |
79 | + </view> | |
109 | 80 | |
110 | - <uni-list class="rechargeWrap"> | |
111 | - <view class="recordCon uni-list-cell-pd"> | |
112 | - <text>-66</text> | |
113 | - <text>支付成功</text> | |
114 | - </view> | |
115 | - <view class="recordCon uni-list-cell-pd"> | |
116 | - <text class="">停车支付</text> | |
117 | - <text>2020-10-01 01:01:01</text> | |
118 | - </view> | |
119 | - <view class="rechargeArrow"> | |
120 | - > | |
121 | - </view> | |
122 | - </uni-list> | |
123 | - </view> | |
124 | - <!-- 底部文案 --> | |
125 | - <view class=""> | |
126 | - <text>{{status === 'more' ? contentText.contentdown : (status === 'loading' ? contentText.contentrefresh : contentText.contentnomore)}}</text> | |
127 | 81 | </view> |
128 | 82 | |
129 | 83 | |
130 | 84 | |
131 | - | |
132 | 85 | </view> |
133 | 86 | </template> |
134 | 87 | |
... | ... | @@ -146,17 +99,16 @@ |
146 | 99 | arrayWay: [], |
147 | 100 | index: 0, |
148 | 101 | indexWay: 0, |
102 | + kind: '', | |
103 | + type: '', | |
149 | 104 | beginDate: currentDate, |
150 | 105 | overDate: currentDate, |
151 | 106 | orderList: [], |
107 | + isLoadAll: false, | |
108 | + totalPages: 1, // 总页数 | |
152 | 109 | page: 1, |
153 | - pageSize: 10, | |
154 | - status: 'more', // 默认展示上拉显示更多 | |
155 | - contentText: { | |
156 | - contentdown: "上拉显示更多", | |
157 | - contentrefresh: "正在加载...", | |
158 | - contentnomore: "没有更多数据了" | |
159 | - } | |
110 | + pageSize: 5, | |
111 | + loadingTxt: '加载中...', | |
160 | 112 | |
161 | 113 | } |
162 | 114 | }, |
... | ... | @@ -165,54 +117,38 @@ |
165 | 117 | withShareTicket: true |
166 | 118 | }); |
167 | 119 | this.getKindType(); |
168 | - // 页码归为第1页 | |
169 | 120 | this.page = 1 |
170 | - // 初始化获取列表数据 | |
171 | - this.fetchData() | |
172 | - | |
121 | + this.pageSize = 5 | |
122 | + this.totalPages = 1 | |
123 | + this.orderList = [] | |
173 | 124 | }, |
174 | 125 | onShow() { |
175 | - this.getDetailSummary(); | |
176 | 126 | this.page = 1 |
177 | - this.pageSize = 10 | |
127 | + this.pageSize = 5 | |
128 | + this.totalPages = 1 | |
178 | 129 | this.orderList = [] |
179 | - this.fetchData() | |
180 | 130 | }, |
181 | 131 | // 下拉刷新触发 |
182 | 132 | onPullDownRefresh(val) { |
183 | 133 | this.page = 1 |
184 | - this.pageSize = 10 | |
134 | + this.pageSize = 5 | |
135 | + this.totalPages = 1 | |
185 | 136 | console.log('下拉刷新', val) |
186 | - this.fetchData().then(() => { | |
187 | - uni.stopPullDownRefresh(); | |
188 | - }).catch(err => { | |
189 | - uni.stopPullDownRefresh(); | |
190 | - // 弹窗提示 | |
191 | - uni.showToast({ | |
192 | - title: '请求出错了', | |
193 | - icon: 'none' | |
194 | - }) | |
195 | - }) | |
137 | + this.fetchData() | |
196 | 138 | }, |
197 | 139 | // 上拉加载触发 |
198 | 140 | onReachBottom() { |
199 | - // 改变状态为加载中 | |
200 | - this.status = 'loading' | |
201 | - // 页码发生变化 | |
202 | - ++this.page | |
203 | - // 加载更多 | |
204 | - this.fetchData('loadMore').then(resArray => { | |
205 | - // 此时判断当前有没有请求到数据 | |
206 | - if (resArray.length) { | |
207 | - this.status = 'more' | |
208 | - | |
209 | - } else { | |
210 | - this.status = 'noMore'; | |
211 | - --this.page; | |
212 | - } | |
213 | - }).catch(err => { | |
214 | - console.log('网络请求失败') | |
215 | - }) | |
141 | + // 判断当前页是否大于等于总页数 | |
142 | + if (this.totalPages <= this.page) { | |
143 | + this.isLoadAll = true; | |
144 | + this.loadingTxt = '没有更多数据啦~'; | |
145 | + } else { | |
146 | + this.page++; | |
147 | + this.isLoadAll = true; | |
148 | + this.loadingTxt = '加载中...'; | |
149 | + this.fetchData(); // 每次滑动请求接口,实现上拉加载更多数据 | |
150 | + } | |
151 | + | |
216 | 152 | }, |
217 | 153 | |
218 | 154 | computed: { |
... | ... | @@ -234,29 +170,45 @@ |
234 | 170 | |
235 | 171 | let data = res.data; |
236 | 172 | that.kindArray = data; |
173 | + that.kind = data[0].kind; | |
237 | 174 | that.arrayWay = data[0].typeList; |
175 | + that.type = data[0].typeList[0].type; | |
238 | 176 | console.log(data) |
239 | - | |
177 | + console.log(that.kind, that.type) | |
178 | + that.getDetailSummary(); | |
179 | + that.page = 1 | |
180 | + that.pageSize = 5 | |
181 | + that.orderList = [] | |
182 | + that.fetchData() | |
240 | 183 | }) |
241 | 184 | }, |
242 | 185 | bindPickerChange: function(e) { |
243 | 186 | let that = this; |
244 | 187 | that.index = e.detail.value |
188 | + that.kind = that.kindArray[that.index].kind; | |
245 | 189 | that.arrayWay = that.kindArray[that.index].typeList; |
190 | + that.type = that.kindArray[that.index].typeList[0].type; | |
191 | + console.log(that.kind, that.type) | |
192 | + that.getDetailSummary(); | |
246 | 193 | that.fetchData() |
247 | 194 | }, |
248 | 195 | bindPickerChangeWay: function(e) { |
249 | 196 | console.log('picker发送选择改变,携带值为', e.detail.value) |
250 | - this.indexWay = e.detail.value | |
251 | - that.fetchData() | |
197 | + this.indexWay = e.detail.value; | |
198 | + this.type = this.arrayWay[this.indexWay].type; | |
199 | + console.log(this.kind, this.type) | |
200 | + this.getDetailSummary(); | |
201 | + this.fetchData() | |
252 | 202 | }, |
253 | 203 | bindStartDateChange: function(e) { |
254 | 204 | this.beginDate = e.detail.value |
255 | - that.fetchData() | |
205 | + this.getDetailSummary(); | |
206 | + this.fetchData() | |
256 | 207 | }, |
257 | 208 | bindEndDateChange: function(e) { |
258 | 209 | this.overDate = e.detail.value |
259 | - that.fetchData() | |
210 | + this.getDetailSummary(); | |
211 | + this.fetchData() | |
260 | 212 | }, |
261 | 213 | getDate(type) { |
262 | 214 | const date = new Date(); |
... | ... | @@ -275,8 +227,8 @@ |
275 | 227 | getDetailSummary() { |
276 | 228 | let that = this; |
277 | 229 | let data = { |
278 | - kind: '1', | |
279 | - type: '1', | |
230 | + kind: that.kind, | |
231 | + type: that.type, | |
280 | 232 | beginDate: new Date(that.beginDate + " 00:00:00"), |
281 | 233 | endDate: new Date(that.overDate + " 23:59:59") |
282 | 234 | }; |
... | ... | @@ -299,13 +251,13 @@ |
299 | 251 | |
300 | 252 | }, |
301 | 253 | |
302 | - fetchData(way) { | |
254 | + fetchData() { | |
303 | 255 | let that = this |
304 | 256 | let paramsData = { |
305 | 257 | pageNum: that.page, |
306 | 258 | pageSize: that.pageSize, |
307 | - kind: '1', | |
308 | - type: '1', | |
259 | + kind: that.kind, | |
260 | + type: that.type, | |
309 | 261 | beginDate: new Date(that.beginDate + " 00:00:00"), |
310 | 262 | endDate: new Date(that.overDate + " 23:59:59") |
311 | 263 | } |
... | ... | @@ -316,14 +268,19 @@ |
316 | 268 | data: that.$common.requestSign(paramsData) |
317 | 269 | }).then(res => { |
318 | 270 | |
319 | - // 当页的数据 | |
320 | - const resDataArray = res.data | |
321 | - if (way === 'loadMore') { | |
322 | - that.orderList = that.orderList.concat(resDataArray) | |
271 | + const resDataArray = res.data.dataList; | |
272 | + if (that.totalPages === res.data.pageTotals) { | |
273 | + that.isLoadAll = true; | |
274 | + that.loadingTxt = '没有更多数据啦~'; | |
275 | + that.orderList = resDataArray; | |
323 | 276 | } else { |
277 | + that.totalPages = res.data.pageTotals; | |
278 | + that.isLoadAll = true; | |
279 | + that.loadingTxt = '上拉加载更多数据'; | |
324 | 280 | that.orderList = resDataArray |
325 | 281 | } |
326 | 282 | |
283 | + | |
327 | 284 | }) |
328 | 285 | |
329 | 286 | ... | ... |