index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="pointsMall" :class="['qn-page-' + theme]">
  3. <view class="top-view primary-bg clearfix">
  4. <view class="float_left user-avatar"><image :src="userInfo.avatar || 'https://onlineimg.qianniao.vip/user-re.png'" mode="aspectFill"></image></view>
  5. <view class="float_left info-view">
  6. <view class="points-num">{{ userInfo.integral || 0 }}</view>
  7. <view class="label">我的股权</view>
  8. </view>
  9. </view>
  10. <view class="btn-view">
  11. <view class="btn-li" @click="goPage('/pagesT/pointsMall/ExchangeLog')">
  12. <view class="btn-tit">我的兑换</view>
  13. <view class="btn-val">立即查看</view>
  14. <view class="icon-view"><text class="custom-icon custom-icon-jifen"></text></view>
  15. </view>
  16. <view class="btn-li" @click="goPage('/pagesT/pointsMall/PointsDetail')">
  17. <view class="btn-tit">股权收支</view>
  18. <view class="btn-val">立即查看</view>
  19. <view class="icon-view"><text class="custom-icon custom-icon-qiandao"></text></view>
  20. </view>
  21. </view>
  22. <view class="wrap">
  23. <view class="demo-warter" v-for="(item, index) in flowList" :key="index" @click="goPage(`/pagesT/pointsMall/IntegralGoodsDetail?id=${item.id}`)">
  24. <!-- 警告:微信小程序中需要hx2.8.11版本才支持在template中结合其他组件,比如下方的lazy-load组件 -->
  25. <image class="goods-img" :src="item.images[0]" mode="aspectFill"></image>
  26. <view class="demo-title ellipsis">{{ item.name }}</view>
  27. <view class="demo-price">{{ item.integral }}股权</view>
  28. <view class="demo-shop">{{ item.changeNum }}件已兑换</view>
  29. <view class="dh-btn primary-btn" @click.stop="goPage('/pagesT/pointsMall/ExchangeOrder?id=' + item.id)">立即兑换</view>
  30. </view>
  31. <!-- 空白页 -->
  32. <Aempty text="暂无商品" v-if="flowList.length === 0" src="https://onlineimg.qianniao.vip/data.png"></Aempty>
  33. <u-loadmore v-if="flowList.length" :status="loading_status"></u-loadmore>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. loading_status: 'nomore',
  42. flowList: [],
  43. list: [],
  44. page: 1,
  45. pageSize: 10,
  46. total: 0
  47. };
  48. },
  49. onLoad() {
  50. // this.addRandomData();
  51. this.getAllIntegralGoods();
  52. },
  53. onReachBottom() {
  54. if (this.total / this.pageSize > this.page) {
  55. this.page += 1;
  56. this.getAllIntegralGoods();
  57. }
  58. },
  59. onPullDownRefresh() {
  60. this.page = 1;
  61. this.getAllIntegralGoods();
  62. },
  63. computed: {
  64. userInfo() {
  65. return this.$store.state.userStatus;
  66. }
  67. },
  68. methods: {
  69. getAllIntegralGoods() {
  70. this.loading_status = 'loading';
  71. this.$u.api
  72. .getAllIntegralGoods({
  73. search: '',
  74. page: this.page,
  75. pageSize: this.pageSize
  76. })
  77. .then(res => {
  78. uni.stopPullDownRefresh();
  79. if (this.page === 1) {
  80. this.flowList = res.data;
  81. } else {
  82. this.flowList = this.flowList.concat(res.data);
  83. }
  84. this.total = res.pageTotal;
  85. this.loading_status = this.$_utils.loadStatus(this.page, this.pageSize, this.total);
  86. })
  87. .catch(res => {
  88. this.loading_status = 'nomore';
  89. uni.stopPullDownRefresh();
  90. });
  91. }
  92. }
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. .wrap {
  97. padding: 0 10rpx;
  98. transform: translateY(-50rpx);
  99. }
  100. .demo-warter {
  101. border-radius: 10rpx;
  102. margin: 20rpx 10rpx;
  103. background-color: #ffffff;
  104. padding: 20rpx;
  105. position: relative;
  106. width: calc(50% - 20rpx);
  107. display: inline-block;
  108. .goods-img {
  109. width: 100%;
  110. height: 304rpx;
  111. border-radius: 10rpx;
  112. }
  113. .dh-btn {
  114. line-height: 50rpx;
  115. color: #ffffff;
  116. font-size: 24rpx;
  117. margin-top: 20rpx;
  118. text-align: center;
  119. border-radius: 50rpx;
  120. }
  121. }
  122. .demo-title {
  123. font-size: 30rpx;
  124. height: 72rpx;
  125. line-height: 36rpx;
  126. margin-top: 5px;
  127. color: $u-main-color;
  128. }
  129. .demo-tag {
  130. display: flex;
  131. margin-top: 5px;
  132. }
  133. .demo-price {
  134. font-size: 30rpx;
  135. color: $u-type-error;
  136. margin-top: 5px;
  137. font-family: DIN-Medium;
  138. }
  139. .demo-shop {
  140. font-size: 20rpx;
  141. color: $u-tips-color;
  142. margin-top: 5px;
  143. font-family: DIN-Medium;
  144. }
  145. .top-view {
  146. background-color: $uni-color-primary;
  147. color: #ffffff;
  148. padding: 30rpx 24rpx 80rpx;
  149. .user-avatar {
  150. padding-right: 30rpx;
  151. image {
  152. display: block;
  153. width: 100rpx;
  154. height: 100rpx;
  155. border-radius: 100%;
  156. }
  157. }
  158. .info-view {
  159. .points-num {
  160. font-size: 36rpx;
  161. font-weight: 600;
  162. padding-bottom: 6rpx;
  163. font-family: DIN-Medium;
  164. }
  165. .label {
  166. font-size: 24rpx;
  167. opacity: 0.8;
  168. }
  169. }
  170. }
  171. .btn-view {
  172. display: flex;
  173. width: 700rpx;
  174. margin: 0 auto;
  175. border-radius: 12rpx;
  176. background-color: #ffffff;
  177. transform: translateY(-50rpx);
  178. padding: 20rpx 0;
  179. .btn-li {
  180. flex: 2;
  181. position: relative;
  182. padding: 0 30rpx;
  183. .btn-val {
  184. font-size: 24rpx;
  185. color: #999999;
  186. padding-top: 6rpx;
  187. }
  188. .icon-view {
  189. color: #ff9900;
  190. position: absolute;
  191. right: 30rpx;
  192. top: 50%;
  193. transform: translateY(-50%);
  194. .custom-icon {
  195. font-size: 48rpx;
  196. }
  197. }
  198. &:first-child {
  199. border-right: 1px solid #f5f5f5;
  200. }
  201. }
  202. }
  203. </style>