Commit b8bb7d4e699fb70ae3fccfc8150264275f1f0596
1 parent
4d3d7875
add 余额明细 接口联调
Showing
1 changed file
with
60 additions
and
110 deletions
pages/rechargeDetail/rechargeDetail.vue
| @@ -58,77 +58,30 @@ | @@ -58,77 +58,30 @@ | ||
| 58 | 58 | ||
| 59 | <view class="" v-if="orderList.length > 0"> | 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 | <view class="recordCon uni-list-cell-pd"> | 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 | </view> | 65 | </view> |
| 66 | <view class="recordCon uni-list-cell-pd"> | 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 | </view> | 69 | </view> |
| 106 | </uni-list> | 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 | </view> | 81 | </view> |
| 128 | 82 | ||
| 129 | 83 | ||
| 130 | 84 | ||
| 131 | - | ||
| 132 | </view> | 85 | </view> |
| 133 | </template> | 86 | </template> |
| 134 | 87 | ||
| @@ -146,19 +99,16 @@ | @@ -146,19 +99,16 @@ | ||
| 146 | arrayWay: [], | 99 | arrayWay: [], |
| 147 | index: 0, | 100 | index: 0, |
| 148 | indexWay: 0, | 101 | indexWay: 0, |
| 149 | - kind:'', | ||
| 150 | - type:'', | 102 | + kind: '', |
| 103 | + type: '', | ||
| 151 | beginDate: currentDate, | 104 | beginDate: currentDate, |
| 152 | overDate: currentDate, | 105 | overDate: currentDate, |
| 153 | orderList: [], | 106 | orderList: [], |
| 107 | + isLoadAll: false, | ||
| 108 | + totalPages: 1, // 总页数 | ||
| 154 | page: 1, | 109 | page: 1, |
| 155 | - pageSize: 10, | ||
| 156 | - status: 'more', // 默认展示上拉显示更多 | ||
| 157 | - contentText: { | ||
| 158 | - contentdown: "上拉显示更多", | ||
| 159 | - contentrefresh: "正在加载...", | ||
| 160 | - contentnomore: "没有更多数据了" | ||
| 161 | - } | 110 | + pageSize: 5, |
| 111 | + loadingTxt: '加载中...', | ||
| 162 | 112 | ||
| 163 | } | 113 | } |
| 164 | }, | 114 | }, |
| @@ -167,54 +117,38 @@ | @@ -167,54 +117,38 @@ | ||
| 167 | withShareTicket: true | 117 | withShareTicket: true |
| 168 | }); | 118 | }); |
| 169 | this.getKindType(); | 119 | this.getKindType(); |
| 170 | - // 页码归为第1页 | ||
| 171 | this.page = 1 | 120 | this.page = 1 |
| 172 | - // 初始化获取列表数据 | ||
| 173 | - this.fetchData() | ||
| 174 | - | 121 | + this.pageSize = 5 |
| 122 | + this.totalPages = 1 | ||
| 123 | + this.orderList = [] | ||
| 175 | }, | 124 | }, |
| 176 | onShow() { | 125 | onShow() { |
| 177 | - this.getDetailSummary(); | ||
| 178 | this.page = 1 | 126 | this.page = 1 |
| 179 | - this.pageSize = 10 | 127 | + this.pageSize = 5 |
| 128 | + this.totalPages = 1 | ||
| 180 | this.orderList = [] | 129 | this.orderList = [] |
| 181 | - this.fetchData() | ||
| 182 | }, | 130 | }, |
| 183 | // 下拉刷新触发 | 131 | // 下拉刷新触发 |
| 184 | onPullDownRefresh(val) { | 132 | onPullDownRefresh(val) { |
| 185 | this.page = 1 | 133 | this.page = 1 |
| 186 | - this.pageSize = 10 | 134 | + this.pageSize = 5 |
| 135 | + this.totalPages = 1 | ||
| 187 | console.log('下拉刷新', val) | 136 | console.log('下拉刷新', val) |
| 188 | - this.fetchData().then(() => { | ||
| 189 | - uni.stopPullDownRefresh(); | ||
| 190 | - }).catch(err => { | ||
| 191 | - uni.stopPullDownRefresh(); | ||
| 192 | - // 弹窗提示 | ||
| 193 | - uni.showToast({ | ||
| 194 | - title: '请求出错了', | ||
| 195 | - icon: 'none' | ||
| 196 | - }) | ||
| 197 | - }) | 137 | + this.fetchData() |
| 198 | }, | 138 | }, |
| 199 | // 上拉加载触发 | 139 | // 上拉加载触发 |
| 200 | onReachBottom() { | 140 | onReachBottom() { |
| 201 | - // 改变状态为加载中 | ||
| 202 | - this.status = 'loading' | ||
| 203 | - // 页码发生变化 | ||
| 204 | - ++this.page | ||
| 205 | - // 加载更多 | ||
| 206 | - this.fetchData('loadMore').then(resArray => { | ||
| 207 | - // 此时判断当前有没有请求到数据 | ||
| 208 | - if (resArray.length) { | ||
| 209 | - this.status = 'more' | ||
| 210 | - | ||
| 211 | - } else { | ||
| 212 | - this.status = 'noMore'; | ||
| 213 | - --this.page; | ||
| 214 | - } | ||
| 215 | - }).catch(err => { | ||
| 216 | - console.log('网络请求失败') | ||
| 217 | - }) | 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 | + | ||
| 218 | }, | 152 | }, |
| 219 | 153 | ||
| 220 | computed: { | 154 | computed: { |
| @@ -240,7 +174,12 @@ | @@ -240,7 +174,12 @@ | ||
| 240 | that.arrayWay = data[0].typeList; | 174 | that.arrayWay = data[0].typeList; |
| 241 | that.type = data[0].typeList[0].type; | 175 | that.type = data[0].typeList[0].type; |
| 242 | console.log(data) | 176 | console.log(data) |
| 243 | - | 177 | + console.log(that.kind, that.type) |
| 178 | + that.getDetailSummary(); | ||
| 179 | + that.page = 1 | ||
| 180 | + that.pageSize = 5 | ||
| 181 | + that.orderList = [] | ||
| 182 | + that.fetchData() | ||
| 244 | }) | 183 | }) |
| 245 | }, | 184 | }, |
| 246 | bindPickerChange: function(e) { | 185 | bindPickerChange: function(e) { |
| @@ -249,20 +188,26 @@ | @@ -249,20 +188,26 @@ | ||
| 249 | that.kind = that.kindArray[that.index].kind; | 188 | that.kind = that.kindArray[that.index].kind; |
| 250 | that.arrayWay = that.kindArray[that.index].typeList; | 189 | that.arrayWay = that.kindArray[that.index].typeList; |
| 251 | that.type = that.kindArray[that.index].typeList[0].type; | 190 | that.type = that.kindArray[that.index].typeList[0].type; |
| 191 | + console.log(that.kind, that.type) | ||
| 192 | + that.getDetailSummary(); | ||
| 252 | that.fetchData() | 193 | that.fetchData() |
| 253 | }, | 194 | }, |
| 254 | bindPickerChangeWay: function(e) { | 195 | bindPickerChangeWay: function(e) { |
| 255 | console.log('picker发送选择改变,携带值为', e.detail.value) | 196 | console.log('picker发送选择改变,携带值为', e.detail.value) |
| 256 | this.indexWay = e.detail.value; | 197 | this.indexWay = e.detail.value; |
| 257 | - this.type = that.arrayWay[this.indexWay].type; | 198 | + this.type = this.arrayWay[this.indexWay].type; |
| 199 | + console.log(this.kind, this.type) | ||
| 200 | + this.getDetailSummary(); | ||
| 258 | this.fetchData() | 201 | this.fetchData() |
| 259 | }, | 202 | }, |
| 260 | bindStartDateChange: function(e) { | 203 | bindStartDateChange: function(e) { |
| 261 | this.beginDate = e.detail.value | 204 | this.beginDate = e.detail.value |
| 205 | + this.getDetailSummary(); | ||
| 262 | this.fetchData() | 206 | this.fetchData() |
| 263 | }, | 207 | }, |
| 264 | bindEndDateChange: function(e) { | 208 | bindEndDateChange: function(e) { |
| 265 | this.overDate = e.detail.value | 209 | this.overDate = e.detail.value |
| 210 | + this.getDetailSummary(); | ||
| 266 | this.fetchData() | 211 | this.fetchData() |
| 267 | }, | 212 | }, |
| 268 | getDate(type) { | 213 | getDate(type) { |
| @@ -306,7 +251,7 @@ | @@ -306,7 +251,7 @@ | ||
| 306 | 251 | ||
| 307 | }, | 252 | }, |
| 308 | 253 | ||
| 309 | - fetchData(way) { | 254 | + fetchData() { |
| 310 | let that = this | 255 | let that = this |
| 311 | let paramsData = { | 256 | let paramsData = { |
| 312 | pageNum: that.page, | 257 | pageNum: that.page, |
| @@ -323,14 +268,19 @@ | @@ -323,14 +268,19 @@ | ||
| 323 | data: that.$common.requestSign(paramsData) | 268 | data: that.$common.requestSign(paramsData) |
| 324 | }).then(res => { | 269 | }).then(res => { |
| 325 | 270 | ||
| 326 | - // 当页的数据 | ||
| 327 | - const resDataArray = res.data | ||
| 328 | - if (way === 'loadMore') { | ||
| 329 | - 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; | ||
| 330 | } else { | 276 | } else { |
| 277 | + that.totalPages = res.data.pageTotals; | ||
| 278 | + that.isLoadAll = true; | ||
| 279 | + that.loadingTxt = '上拉加载更多数据'; | ||
| 331 | that.orderList = resDataArray | 280 | that.orderList = resDataArray |
| 332 | } | 281 | } |
| 333 | 282 | ||
| 283 | + | ||
| 334 | }) | 284 | }) |
| 335 | 285 | ||
| 336 | 286 |