exchangeRecord.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="box">
  3. <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
  4. <view class="carPlate">
  5. <view class="time">{{item.createTime}}</view>
  6. <view class="stateBox">
  7. <view class="gray" v-if="item.hState==0">已取消</view>
  8. <view class="red" v-if="item.hState==1">未兑换</view>
  9. <view class="green" v-if="item.hState==2">已兑换</view>
  10. <image src="../../static/img/little_rightArrow.png" mode="" style="width: 24rpx;height: 24rpx;">
  11. </image>
  12. </view>
  13. </view>
  14. <view class="goodsBox">
  15. <image :src="item.url" mode="" style="width: 120rpx;height: 120rpx;"></image>
  16. <view class="goodsRight">
  17. <view class="goodsName">{{item.goodsName}}</view>
  18. <view class="goodsCount">
  19. <view class="jifen">{{item.integral/item.qty}}<span
  20. style="font-size: 24rpx; color: #333333; margin-left: 5rpx;">积分</span>
  21. </view>
  22. <view class="count">x{{item.qty}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="sum">
  27. <span style="font-size: 24rpx; color: #666666; margin-right: 10rpx;">总计</span>
  28. <span style="font-size: 32rpx; color: #FF0000; font-weight: 500; margin-right: 5rpx;">{{item.integral}}</span>
  29. <span style=" font-size: 24rpx; color: #FF0000;">积分</span>
  30. </view>
  31. </view>
  32. <!-- 上拉 加载更多 -->
  33. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  34. <!-- 无数据空白页 -->
  35. <nodata v-if="itemData.length==0"></nodata>
  36. </view>
  37. </template>
  38. <script>
  39. import nodata from '../../components/nodata/nodata.vue'
  40. export default {
  41. components: {
  42. nodata,
  43. },
  44. data() {
  45. return {
  46. page: 1,
  47. itemData: [],
  48. noMoreShow: false,
  49. avaIntegral: '',
  50. }
  51. },
  52. onLoad(opt) {
  53. this.avaIntegral = opt.avaIntegral
  54. this.page = 1
  55. this.myOrderCoupon()
  56. },
  57. methods: {
  58. goDetail(id) {
  59. uni.navigateTo({
  60. url: 'recordDetail?id=' + id
  61. })
  62. },
  63. myOrderCoupon() {
  64. uni.showLoading({
  65. title: '加载中'
  66. })
  67. this.$http('openIntegralMall/exchangeRecord', {
  68. page: this.page,
  69. limit: 10,
  70. }, 'GET').then(res => {
  71. uni.hideLoading();
  72. // var list = res.data.Items
  73. var list = res.data.Items
  74. // 处理 undefined和null转为空白字符串
  75. // list.forEach((item, index) => {
  76. // for (const key in item) {
  77. // item[key] = this.$praseStrEmpty(item[key])
  78. // }
  79. // })
  80. if (this.page == 1) {
  81. this.itemData = list
  82. } else {
  83. this.itemData = this.itemData.concat(list)
  84. }
  85. if (list.length < 10) {
  86. this.noMoreShow = true
  87. } else {
  88. this.noMoreShow = false
  89. }
  90. })
  91. },
  92. },
  93. // 下拉刷新 上拉加载更多
  94. onPullDownRefresh() {
  95. this.page = 1
  96. this.myOrderCoupon()
  97. setTimeout(function() {
  98. uni.stopPullDownRefresh();
  99. }, 1000);
  100. },
  101. onReachBottom() {
  102. this.page++;
  103. this.myOrderCoupon()
  104. },
  105. }
  106. </script>
  107. <style>
  108. .box {
  109. min-height: 100vh;
  110. background-color: #F4F5F7;
  111. padding: 20rpx 24rpx;
  112. }
  113. .itemHistory {
  114. padding: 30rpx 20rpx;
  115. background-color: #FFFFFF;
  116. border-radius: 10rpx;
  117. margin-bottom: 20rpx;
  118. }
  119. .time {
  120. font-size: 24rpx;
  121. color: #999999;
  122. }
  123. .stateBox {
  124. display: flex;
  125. align-items: center;
  126. }
  127. .carPlate {
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. }
  132. .plate {
  133. font-size: 30rpx;
  134. color: #3C3C3C;
  135. }
  136. .gray {
  137. font-size: 24rpx;
  138. color: #999999;
  139. }
  140. .green {
  141. font-size: 24rpx;
  142. color: #00A040;
  143. }
  144. .red {
  145. font-size: 24rpx;
  146. color: #FF0000;
  147. }
  148. .goodsBox {
  149. display: flex;
  150. padding: 30rpx 0;
  151. border-bottom: 1rpx solid #EEEEEE;
  152. }
  153. .goodsRight {
  154. margin-left: 20rpx;
  155. display: flex;
  156. flex-direction: column;
  157. justify-content: space-between;
  158. }
  159. .goodsName {
  160. width: 522rpx;
  161. font-size: 26rpx;
  162. font-weight: 400;
  163. color: #3C3C3C;
  164. line-height: 37rpx;
  165. margin-bottom: 15rpx;
  166. }
  167. .goodsCount {
  168. display: flex;
  169. justify-content: space-between;
  170. align-items: center;
  171. }
  172. .jifen {
  173. height: 45rpx;
  174. font-size: 32rpx;
  175. font-weight: 500;
  176. color: #333333;
  177. line-height: 45rpx;
  178. }
  179. .count {
  180. height: 33rpx;
  181. font-size: 24rpx;
  182. font-weight: 400;
  183. color: #999999;
  184. line-height: 33rpx;
  185. }
  186. .sum {
  187. margin-top: 34rpx;
  188. display: flex;
  189. justify-content: flex-end;
  190. align-items: center;
  191. }
  192. .noMore {
  193. text-align: center;
  194. line-height: 50rpx;
  195. color: #999999;
  196. font-size: 28rpx;
  197. }
  198. </style>