list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="prodcut-list-wrap">
  3. <view class="point_top">
  4. <image src="../../../../static/point_bg.png" mode=""></image>
  5. <view class="tc pr">
  6. <view class="f60 fb white">{{my_points}}</view>
  7. <view class="f26 white">我的积分</view>
  8. </view>
  9. </view>
  10. <view class="p-0-20 bg-white f32 gray3 fb ponit_title">好物兑换</view>
  11. <view class="list">
  12. <view class="item" v-for="(item, index) in listData" :key="index" @click="gotoList(item.point_product_id)">
  13. <view class="product-cover">
  14. <image :src="item.product_image" mode="aspectFit"></image>
  15. </view>
  16. <view class="product-info flex-1">
  17. <view class="product-title">{{ item.product.product_name }}</view>
  18. <view class="already-sale d-b-c">
  19. <text>还剩{{ item.stock }}件</text>
  20. </view>
  21. <view class="price">
  22. <template v-if="item.sku[0].point_money!=0">
  23. ¥
  24. <text class="num">{{ item.sku[0].point_money }}</text>
  25. <text class="f30">+</text>
  26. </template>
  27. <text class="num">{{ item.sku[0].point_num }}</text>
  28. <text class="f26">积分</text>
  29. </view>
  30. </view>
  31. <view class="d-c-e">
  32. <view class="point_btn">兑换</view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 没有记录 -->
  37. <view class="d-c-c p30" v-if="listData.length == 0 && !loading">
  38. <text class="iconfont icon-wushuju"></text>
  39. <text class="cont">亲,暂无相关记录哦</text>
  40. </view>
  41. <uni-load-more v-else :loadingType="loadingType"></uni-load-more>
  42. </view>
  43. </template>
  44. <script>
  45. import uniLoadMore from '@/components/uni-load-more.vue';
  46. export default {
  47. components: {
  48. uniLoadMore
  49. },
  50. data() {
  51. return {
  52. /*是否加载完成*/
  53. loading: true,
  54. /*数据列表*/
  55. listData: [],
  56. /*最后一页码数*/
  57. last_page: 0,
  58. /*当前页面*/
  59. page: 1,
  60. /*每页条数*/
  61. list_rows: 10,
  62. no_more: false,
  63. my_points: 0
  64. };
  65. },
  66. onShow() {
  67. this.page=1;
  68. this.listData=[];
  69. this.getData();
  70. },
  71. computed: {
  72. /*加载中状态*/
  73. loadingType() {
  74. if (this.loading) {
  75. return 1;
  76. } else {
  77. if (this.listData.length != 0 && this.no_more) {
  78. return 2;
  79. } else {
  80. return 0;
  81. }
  82. }
  83. }
  84. },
  85. onReachBottom() {
  86. let self = this;
  87. if (self.page < self.last_page) {
  88. self.page++;
  89. self.getData();
  90. }
  91. self.no_more = true;
  92. },
  93. methods: {
  94. /*获取数据*/
  95. getData() {
  96. let self = this;
  97. self.loading = true;
  98. self._get(
  99. 'plus.points.product/index', {
  100. page: self.page || 1,
  101. list_rows: self.list_rows
  102. },
  103. function(res) {
  104. self.loading = false;
  105. self.listData = self.listData.concat(res.data.list.data);
  106. self.my_points = res.data.points;
  107. self.last_page = res.data.list.last_page;
  108. if (res.data.list.last_page <= 1) {
  109. self.no_more = true;
  110. }
  111. }
  112. );
  113. },
  114. /*跳转产品列表*/
  115. gotoList(e) {
  116. this.gotoPage('/pages/plus/points/detail/detail?point_product_id=' + e);
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="scss">
  122. page {
  123. background-color: #FFFFFF;
  124. }
  125. .point_top {
  126. position: relative;
  127. width: 750rpx;
  128. height: 240rpx;
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. }
  133. .point_top image {
  134. position: absolute;
  135. width: 750rpx;
  136. height: 240rpx;
  137. z-index: 0;
  138. }
  139. .prodcut-list-wrap .list {
  140. background: #ffffff;
  141. padding-left: 20rpx;
  142. }
  143. .ponit_title {
  144. padding-top: 40rpx;
  145. }
  146. .prodcut-list-wrap .list .item {
  147. padding: 30rpx 0;
  148. display: flex;
  149. border-bottom: 1px solid #dddddd;
  150. }
  151. .prodcut-list-wrap .product-cover,
  152. .prodcut-list-wrap .product-cover image {
  153. width: 150rpx;
  154. height: 150rpx;
  155. border-radius: 12rpx;
  156. }
  157. .prodcut-list-wrap .product-info {
  158. flex: 1;
  159. margin-left: 26rpx;
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: space-between;
  163. }
  164. .prodcut-list-wrap .product-title {
  165. display: -webkit-box;
  166. overflow: hidden;
  167. -webkit-line-clamp: 1;
  168. -webkit-box-orient: vertical;
  169. font-size: 32rpx;
  170. width: 380rpx;
  171. }
  172. .prodcut-list-wrap .price {
  173. color: #F6220C;
  174. font-size: 20rpx;
  175. line-height: 28rpx;
  176. }
  177. .prodcut-list-wrap .price .num {
  178. padding: 0 4rpx;
  179. font-size: 36rpx;
  180. }
  181. .prodcut-list-wrap .already-sale {
  182. color: #999;
  183. font-size: 26rpx;
  184. margin-bottom: 18rpx;
  185. }
  186. .prodcut-list-wrap .already-sale .btn-red {
  187. line-height: 2;
  188. font-size: 28rpx;
  189. }
  190. .point_btn {
  191. width: 120rpx;
  192. height: 50rpx;
  193. background: linear-gradient(90deg, #7B45FF 0%, #961EFF 100%);
  194. border-radius: 25rpx;
  195. font-size: 26rpx;
  196. color: #FFFFFF;
  197. line-height: 50rpx;
  198. text-align: center;
  199. margin-right: 30rpx;
  200. }
  201. </style>