exchange.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="content">
  3. <!-- <scroll-view scroll-y="true" style="height: 100%;" @click="loadData()"> -->
  4. <empty v-if="integral.loaded === true && integral.list.length === 0"></empty>
  5. <view class="exchange-wrapper">
  6. <!-- <view class="exgood-wrapper" v-for="item in integral.list" :key="item.id" @click="navTo('/pages/product/product?id=' + item.id + '&type=3')" style="height: 500rpx;"> -->
  7. <view class="exgood-wrapper" v-for="item in integral.list" :key="item.id" @click="navTo('/pages/product/exchangeDetail?id=' + item.id + '&type=3')" style="height: 500rpx;">
  8. <image src="https://zccy.liuniu946.com/static/img/bg3.png" mode="" class="bg3" style="height: 500rpx;"></image>
  9. <view class="ex-img-wrapper"><image :src="item.image" mode=""></image></view>
  10. <view class="exgood-title">{{item.title}}</view>
  11. <view class="ex-price">
  12. ¥{{item.price*1}}
  13. </view>
  14. </view>
  15. </view>
  16. <uni-load-more :status="integral.loadingType"></uni-load-more>
  17. <!-- </scroll-view> -->
  18. </view>
  19. </template>
  20. <script>
  21. import empty from '@/components/empty';
  22. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  23. import { getCombinationList, getProductslist, getProductHot ,getIntegralList, getProductList ,getExchangeLists} from '@/api/product.js';
  24. import { mapMutations,mapState } from 'vuex';
  25. export default {
  26. components: {
  27. empty,
  28. uniLoadMore
  29. },
  30. data() {
  31. return {
  32. integral: {
  33. page: 1,
  34. limit: 10,
  35. list: [],
  36. loadingType: 'more',
  37. loaded: ''
  38. }
  39. }
  40. },
  41. computed: {
  42. ...mapState('user', ['userInfo', 'checkedStore', 'des', 'latlng']),
  43. },
  44. onLoad() {
  45. this.loadData()
  46. },
  47. onReachBottom() {
  48. this.loadData()
  49. console.log('到底了')
  50. },
  51. methods:{
  52. navTo(url) {
  53. uni.navigateTo({
  54. url: url
  55. })
  56. },
  57. loadData() {
  58. let obj = this
  59. if (obj.integral.loadingType === 'loading') {
  60. //防止重复加载
  61. return;
  62. }
  63. if (obj.integral.loadingType === 'noMore') {
  64. //防止重复加载
  65. return;
  66. }
  67. // 修改当前对象状态为加载中
  68. obj.integral.loadingType = 'loading';
  69. getExchangeLists({
  70. page: obj.integral.page,
  71. limit: obj.integral.limit,
  72. }).then(({data}) => {
  73. // console.log(data)
  74. obj.integral.list = obj.integral.list.concat(data)
  75. obj.integral.page++
  76. console.log(obj.integral.list)
  77. if (obj.integral.limit == data.length) {
  78. //判断是否还有数据, 有改为 more, 没有改为noMore
  79. obj.integral.loadingType = 'more';
  80. } else {
  81. //判断是否还有数据, 有改为 more, 没有改为noMore
  82. obj.integral.loadingType = 'noMore';
  83. }
  84. uni.hideLoading();
  85. this.$set(obj.integral, 'loaded', true);
  86. })
  87. // getProductList({
  88. // cid: 3,
  89. // page: obj.integral.page,
  90. // limit: obj.integral.limit,
  91. // }).then( ({data}) => {
  92. // console.log(data)
  93. // obj.integral.list = obj.integral.list.concat(data)
  94. // console.log(obj.integral.list)
  95. // if (obj.integral.limit == data.length) {
  96. // //判断是否还有数据, 有改为 more, 没有改为noMore
  97. // obj.integral.loadingType = 'more';
  98. // return;
  99. // } else {
  100. // //判断是否还有数据, 有改为 more, 没有改为noMore
  101. // obj.integral.loadingType = 'noMore';
  102. // }
  103. // uni.hideLoading();
  104. // this.$set(obj.integral, 'loaded', true);
  105. // })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. page {
  112. height: 100%;
  113. }
  114. .content {
  115. height: 100%;
  116. }
  117. .exchange-wrapper {
  118. // background-color: #fff;
  119. width: 696rpx;
  120. // height: 100rpx;
  121. padding-top: 28rpx;
  122. margin: 0 auto 39rpx;
  123. // padding: 0 27rpx;
  124. display: flex;
  125. justify-content: space-between;
  126. position: relative;
  127. flex-wrap: wrap;
  128. .exgood-wrapper {
  129. width: 342rpx;
  130. height: 540rpx;
  131. box-shadow: 0px 4px 18px 0px rgba(144, 27, 33, 0.13);
  132. margin-bottom: 20rpx;
  133. position: relative;
  134. .ex-img-wrapper {
  135. width: 342rpx;
  136. height: 338rpx;
  137. image {
  138. width: 100%;
  139. height: 100%;
  140. }
  141. }
  142. .exgood-title {
  143. margin-top: 33rpx;
  144. padding-left: 21rpx;
  145. font-size: 30rpx;
  146. font-weight: bold;
  147. color: #333333;
  148. white-space: nowrap;
  149. overflow: hidden;
  150. text-overflow: ellipsis;
  151. }
  152. .ex-addr {
  153. margin-top: 16rpx;
  154. padding-left: 22rpx;
  155. height: 22rpx;
  156. font-size: 22rpx;
  157. font-weight: 500;
  158. color: #dcb876;
  159. image {
  160. height: 22rpx;
  161. }
  162. .name-img {
  163. width: 26rpx;
  164. margin: 0 4rpx -3rpx 0;
  165. }
  166. .point-img {
  167. width: 16rpx;
  168. margin: 0 4rpx -3rpx 14rpx;
  169. }
  170. }
  171. .ex-price {
  172. margin-top: 17rpx;
  173. padding-left: 22rpx;
  174. font-size: 36rpx;
  175. font-weight: bold;
  176. color: #901b21;
  177. vertical-align: bottom;
  178. .tx1 {
  179. font-size: 24rpx;
  180. vertical-align: baseline;
  181. position: relative;
  182. top: -2rpx;
  183. }
  184. .tx2 {
  185. margin-left: 9rpx;
  186. font-size: 26rpx;
  187. font-weight: 500;
  188. text-decoration: line-through;
  189. color: #9d9d9d;
  190. line-height: 35rpx;
  191. }
  192. }
  193. .bg {
  194. position: absolute;
  195. top: 0;
  196. width: 342rpx;
  197. height: 540rpx;
  198. background-size: 100% 100%;
  199. }
  200. }
  201. }
  202. .bg3 {
  203. z-index: 3;
  204. width: 342rpx;
  205. height: 540rpx;
  206. position: absolute;
  207. top: 0;
  208. left: 0;
  209. }
  210. </style>