three.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="content">
  3. <!-- <view class="status_bar"></view> -->
  4. <view class="hotgoods">
  5. <view class="hotgoods-item" v-for="jfitem in list" :key="jfitem.id"
  6. @click="navto('/pages/product/product?id=' + jfitem.id )" style="height: 520rpx;">
  7. <view class="image-wrapper">
  8. <image class="image" :src="jfitem.image" mode="scaleToFill"></image>
  9. </view>
  10. <view class="flex" style="flex-direction: column;justify-content: space-between;align-items: flex-start;height: 170rpx;">
  11. <view class="title clamp2">{{jfitem.store_name}}</view>
  12. <view class="hot-price">
  13. <view class="price">
  14. <text>¥{{ jfitem.price * 1 }}</text>
  15. <text class="ot-pirce" >销量:{{jfitem.sales}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <empty v-if="loaded && list.length == 0"></empty>
  22. <uni-load-more :status="loadingType" v-if="!(loaded && list.length == 0)"></uni-load-more>
  23. </view>
  24. </template>
  25. <script>
  26. import empty from '@/components/empty.vue'
  27. import { getCate,getGoodList} from '@/api/three.js'
  28. import { getProducts } from '@/api/product.js'
  29. export default {
  30. components: {
  31. empty
  32. },
  33. data() {
  34. return {
  35. list: [],
  36. page:1,
  37. limit: 10,
  38. loaded:false,
  39. loadingType: 'more',
  40. keyword: ''
  41. }
  42. },
  43. onLoad() {
  44. },
  45. onShow() {
  46. this.getGoodList()
  47. },
  48. onReachBottom() {
  49. this.getGoodList()
  50. },
  51. onReady() {
  52. },
  53. methods: {
  54. navto(url) {
  55. uni.navigateTo({
  56. url,
  57. fail() {
  58. uni.switchTab({
  59. url
  60. })
  61. }
  62. })
  63. },
  64. goIndex() {
  65. uni.switchTab({
  66. url:'/pages/index/index'
  67. })
  68. },
  69. clickSearch() {
  70. },
  71. getCate() {
  72. getCate({
  73. id: 0
  74. }).then(res => {
  75. })
  76. },
  77. getGoodList(type) {
  78. let that = this
  79. if(type == 're') {
  80. that.list = []
  81. that.page = 1
  82. that.loadingType = 'more'
  83. }
  84. if(that.loadingType == 'loading' || that.loadingType == 'noMore') {
  85. return
  86. }
  87. that.loadingType = 'loading'
  88. getProducts({
  89. is_level: 1,
  90. page: that.page,
  91. limit: that.limit
  92. }).then(res => {
  93. console.log(res)
  94. let arr =res.data
  95. if(arr) {
  96. that.list = that.list.concat(arr)
  97. if(arr.length == that.limit) {
  98. that.loadingType = 'more'
  99. that.page++
  100. }else {
  101. that.loadingType = 'noMore'
  102. }
  103. }else {
  104. that.loadingType = 'noMore'
  105. }
  106. that.loaded = true
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .hotgoods {
  114. // margin-top: 38rpx;
  115. width: 100%;
  116. display: flex;
  117. flex-wrap: wrap;
  118. padding: 20rpx 20rpx 30rpx;
  119. justify-content: space-between;
  120. .hotgoods-item {
  121. width: 345rpx;
  122. background-color: #ffffff;
  123. border-radius: 12rpx;
  124. box-shadow: 0 0 15rpx rgba(0, 0, 0, 0.2);
  125. margin-bottom: 15rpx;
  126. .image-wrapper {
  127. width: 345rpx;
  128. height: 345rpx;
  129. border-radius: 3px;
  130. overflow: hidden;
  131. position: relative;
  132. .image-bg {
  133. position: absolute;
  134. top: 0;
  135. left: 0;
  136. right: 0;
  137. bottom: 0;
  138. width: 100%;
  139. height: 100%;
  140. opacity: 1;
  141. border-radius: 12rpx 12rpx 0 0;
  142. z-index: 2;
  143. }
  144. .image {
  145. width: 100%;
  146. height: 100%;
  147. opacity: 1;
  148. border-radius: 12rpx 12rpx 0 0;
  149. }
  150. }
  151. .title {
  152. margin-top: 24rpx;
  153. padding: 0 20rpx;
  154. font-size: 32rpx;
  155. font-weight: 500;
  156. color: #333333;
  157. }
  158. .hot-price {
  159. display: flex;
  160. justify-content: flex-start;
  161. align-items: center;
  162. width: 100%;
  163. padding: 0 10rpx;
  164. // padding: 14rpx 0 30rpx;
  165. .hotPrice-box {
  166. padding: 2rpx 6rpx;
  167. background: linear-gradient(90deg, #c79a4c, #f9df7f);
  168. border-radius: 5rpx;
  169. text-align: center;
  170. line-height: 28rpx;
  171. font-size: 20rpx;
  172. font-family: Source Han Sans CN;
  173. font-weight: 400;
  174. color: #ffffff;
  175. }
  176. .price {
  177. margin-left: 10rpx;
  178. font-size: 36rpx;
  179. color: #ff0000;
  180. font-weight: 500;
  181. display: flex;
  182. width: 100%;
  183. justify-content: space-between !important;
  184. align-items: center;
  185. .jf {
  186. font-size: 20rpx;
  187. }
  188. .give-jf {
  189. display: inline-block;
  190. padding: 8rpx;
  191. background: linear-gradient(90deg, #FF834D, #FF2600);
  192. border-radius: 12rpx 0px 12rpx 0px;
  193. font-size: 22rpx;
  194. font-weight: 500;
  195. color: #FFFFFF;
  196. margin-left: 22rpx;
  197. }
  198. .ot-pirce {
  199. margin-left: 7rpx;
  200. font-size: 26rpx;
  201. font-weight: 500;
  202. // text-decoration: line-through;
  203. color: #999999;
  204. align-self: flex-end;
  205. }
  206. }
  207. .yuanPrice {
  208. margin-left: 10rpx;
  209. font-size: 20rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. text-decoration: line-through;
  213. color: #999999;
  214. }
  215. .cart-icon {
  216. image {
  217. width: 44rpx;
  218. height: 44rpx;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. .status_bar {
  225. height: var(--status-bar-height);
  226. background-color: #fff;
  227. width: 100%;
  228. position: fixed;
  229. top: 0;
  230. z-index: 999;
  231. }
  232. </style>