goods.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="community">
  3. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  4. <view class="left">
  5. <view class="store-item" v-for="(item, index) in list" :key="index" @click="goGoodsDetail(item.goodsId)">
  6. <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
  7. <view class="info">
  8. <view class="title">
  9. {{ item.goodsName }}
  10. </view>
  11. <view class="user-info">
  12. <!-- <image class="head" :src="item.goodsPath"></image> -->
  13. <view class="user-name">
  14. {{ item.goodsDescribe }}
  15. </view>
  16. </view>
  17. <view class="price-box">
  18. <view class="left">
  19. <view class="unit">
  20. </view>
  21. <view class="price">
  22. {{ item.realPrice }}
  23. </view>
  24. <view class="old-price">
  25. ¥{{ item.marketPrice }}
  26. </view>
  27. </view>
  28. <view class="right">
  29. {{ item.saleNum }}人已购
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="right">
  36. <view class="store-item" v-for="(item, index) in list1" :key="index" @click="goGoodsDetail(item.goodsId)">
  37. <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
  38. <view class="info">
  39. <view class="title">
  40. {{ item.goodsName }}
  41. </view>
  42. <view class="user-info">
  43. <!-- <image class="head" :src="item.goodsPath" mode=""></image> -->
  44. <view class="user-name">
  45. {{ item.goodsDescribe }}
  46. </view>
  47. </view>
  48. <view class="price-box">
  49. <view class="left">
  50. <view class="unit">
  51. </view>
  52. <view class="price">
  53. {{ item.realPrice }}
  54. </view>
  55. <view class="old-price">
  56. ¥{{ item.marketPrice }}
  57. </view>
  58. </view>
  59. <view class="right">
  60. {{ item.saleNum }}人已购
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </zs-list>
  67. </view>
  68. </template>
  69. <script>
  70. import { studyGoodsByUser } from '@/api/study.js';
  71. export default {
  72. data() {
  73. return {
  74. status: 'more',
  75. id: 0,
  76. list: [
  77. ],
  78. list1: [
  79. ],
  80. query: {
  81. columnId: 0,
  82. }
  83. }
  84. },
  85. methods: {
  86. loadMore() {
  87. this.studyGoodsByUser()
  88. },
  89. // 去商品详情
  90. goGoodsDetail(id) {
  91. uni.navigateTo({
  92. url: '/study/studyGoodsDetail?id=' + id
  93. })
  94. },
  95. studyGoodsByUser() {
  96. this.status = 'loading'
  97. studyGoodsByUser(this.query).then(res => {
  98. if (res.state == 'Success') {
  99. let list = []
  100. let list1 = []
  101. res.content.records.map((item, index) => {
  102. if (index % 2) {
  103. list1.push(item)
  104. } else {
  105. list.push(item)
  106. }
  107. })
  108. this.list = this.list.concat(list)
  109. this.list1 = this.list1.concat(list1)
  110. let total = this.list.length + this.list1.length
  111. if (total >= res.content.total) {
  112. this.status = 'noMore'
  113. } else {
  114. this.status = 'more'
  115. this.query.currentPage++
  116. }
  117. }
  118. })
  119. },
  120. },
  121. onLoad(options) {
  122. this.query.columnId = options.columnId
  123. // console.log(options.id);
  124. // this.id = options.id
  125. // this.getItem()
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. .community {
  131. background: #FFFFFF;
  132. padding: 20rpx;
  133. .zs-list {
  134. display: flex;
  135. flex-wrap: wrap;
  136. justify-content: space-between;
  137. .left {}
  138. .right {}
  139. .store-item {
  140. box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
  141. border-radius: 16rpx;
  142. width: 344rpx;
  143. height: 566rpx;
  144. margin-top: 20rpx;
  145. display: flex;
  146. flex-direction: column;
  147. .info {
  148. padding: 20rpx;
  149. flex: 1;
  150. display: flex;
  151. flex-direction: column;
  152. justify-content: space-between;
  153. .title {
  154. color: #222222;
  155. font-size: 28rpx;
  156. height: 76rpx;
  157. width: 100%;
  158. font-weight: bold;
  159. display: -webkit-box;
  160. -webkit-box-orient: vertical;
  161. -webkit-line-clamp: 2;
  162. /* 显示的最大行数 */
  163. overflow: hidden;
  164. }
  165. .user-info {
  166. display: flex;
  167. align-items: center;
  168. margin-top: 20rpx;
  169. .head {
  170. width: 40rpx;
  171. height: 40rpx;
  172. border-radius: 50%;
  173. }
  174. .user-name {
  175. color: #AAAAAA;
  176. font-size: 24rpx;
  177. display: -webkit-box;
  178. -webkit-box-orient: vertical;
  179. -webkit-line-clamp: 1;
  180. overflow: hidden;
  181. text-overflow: ellipsis;
  182. // margin-left: 12rpx;
  183. }
  184. }
  185. .price-box {
  186. display: flex;
  187. justify-content: space-between;
  188. align-items: center;
  189. margin-top: 12rpx;
  190. .left {
  191. display: flex;
  192. align-items: flex-end;
  193. .unit {
  194. font-size: 24rpx;
  195. color: $uni-color-primary;
  196. font-weight: bold;
  197. }
  198. .price {
  199. font-size: 32rpx;
  200. color: $uni-color-primary;
  201. font-weight: bold;
  202. }
  203. .old-price {
  204. font-size: 20rpx;
  205. color: #AAAAAA;
  206. text-decoration: line-through;
  207. margin-left: 10rpx;
  208. }
  209. }
  210. .right {
  211. font-size: 20rpx;
  212. color: #AAAAAA;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. </style>