gift.vue 5.6 KB

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