guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 1 | <template> |
| 2 | <view class="integralQuery"> |
| 3 | <!-- #ifndef H5 --> |
| 4 | <view class="bgColor"></view> |
| 5 | <!-- #endif --> |
| 6 | <view class="integralQuery-item" v-for="(v,i) in list" :key="i"> |
| 7 | <view class="integralQuery-item-left"> |
| 8 | <text class="integralQuery-item-left-name">{{v.typename}}</text> |
| 9 | <text class="integralQuery-item-left-date">{{v.date}}</text> |
| 10 | </view> |
| 11 | <view class="integralQuery-item-right" :style="{color:v.pointStatus=='add'?'#2FA7E0':'#F95A3D'}"> |
| 12 | {{v.points}} |
| 13 | </view> |
| 14 | </view> |
| 15 | <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="30" /> |
| 16 | </view> |
| 17 | </template> |
| 18 | |
| 19 | <script> |
| 20 | export default { |
| 21 | data() { |
| 22 | return { |
| 23 | isAdd: false, |
| 24 | list: [], |
| 25 | pageno: 1, |
| 26 | status: "loading", |
| 27 | iconType: 'circle', |
| 28 | loadText: { |
| 29 | loadmore: '轻轻上拉', |
| 30 | loading: '努力加载中', |
| 31 | nomore: '暂无更多' |
| 32 | }, |
| 33 | } |
| 34 | }, |
| 35 | methods: { |
| 36 | getIntegralList(e) { |
| 37 | let that = this |
| 38 | let params = { |
| 39 | pageno: e, |
| 40 | pagesize: 10 |
| 41 | } |
| 42 | that.pageno = e |
| 43 | that.$u.get("/v1/point/flow", params).then(res => { |
| 44 | let totals = res.data.count |
| 45 | let list = res.data.data |
| 46 | if (list.length > 0) { |
| 47 | list.forEach(item => { |
| 48 | item.date = item.transdate.substr(0, 4) + '-' + item.transdate.substr(4, 2) + '-' + item.transdate.substr(6, |
| 49 | 2) + ' ' + item.transtime.substr(0, 2) + ':' + item.transtime.substr(2, 2) + ':' + item.transtime.substr(4, |
| 50 | 2) |
| 51 | item.pointStatus = item.points.indexOf("+") != -1 ? 'add' : 'mins' |
| 52 | }) |
| 53 | that.list = that.list.concat(list) |
| 54 | that.status = 'loadmore' |
| 55 | //console.log(that.list) |
| 56 | } else { |
| 57 | that.status = 'nomore' |
| 58 | } |
| 59 | }).catch(res=>{ |
| 60 | that.status = 'nomore' |
| 61 | }) |
| 62 | } |
| 63 | }, |
| 64 | onLoad() { |
| 65 | let that = this |
| 66 | that.getIntegralList(1) |
| 67 | }, |
| 68 | onReachBottom() { |
| 69 | let that = this |
| 70 | let pageno = ++that.pageno |
| 71 | let status = that.status |
| 72 | if (status != 'nomore') { |
| 73 | that.getIntegralList(pageno) |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | </script> |
| 78 | |
| 79 | <style lang="scss" scoped> |
| 80 | /* #ifndef H5 */ |
| 81 | .bgColor { |
| 82 | position: fixed; |
| 83 | top: 0; |
| 84 | left: 0; |
| 85 | right: 0; |
| 86 | bottom: 0; |
| 87 | background: #FFFFFF; |
| 88 | z-index: -1; |
| 89 | } |
| 90 | /* #endif */ |
| 91 | page{ |
| 92 | background-color: #FFFFFF; |
| 93 | } |
| 94 | .integralQuery { |
| 95 | padding: 20rpx 30rpx; |
| 96 | background-color: #FFFFFF; |
| 97 | width: 100vw; |
| 98 | // height: 100vh; |
| 99 | font-family: "PingFang-SC-Medium"; |
| 100 | |
| 101 | &-item { |
| 102 | display: flex; |
| 103 | justify-content: space-between; |
| 104 | align-items: center; |
| 105 | border-bottom: 2rpx rgba(203, 203, 203, 1) solid; |
| 106 | padding: 20rpx 0; |
| 107 | |
| 108 | &-left { |
| 109 | display: flex; |
| 110 | flex-direction: column; |
| 111 | |
| 112 | text { |
| 113 | margin: 5rpx; |
| 114 | } |
| 115 | |
| 116 | &-name { |
| 117 | font-size: 31rpx; |
| 118 | color: #333333; |
| 119 | } |
| 120 | |
| 121 | &-date { |
| 122 | color: #999999; |
| 123 | font-size: 25rpx; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | &-right { |
| 128 | font-size: 32rpx; |
| 129 | // color: #2FA7E0; |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | </style> |