seckill.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box seckill-box">
  3. <Nav title="限时秒杀" bgckgroundBox='transparent' leftColor='#fff' titleColor='#fff'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css p-24 box-border-box" @scrolltolower="scrolltolower">
  5. <view class="head-box b-rad-20 bgc-f mb-18 align-items-center flex-justify-center">
  6. <view class="fc-213C45 fs-40 fw-b mr-14 fs-i l-s-2">
  7. 限时秒杀
  8. </view>
  9. <view class="fc-213C45 fs-40 fw-b fs-i l-s-2">
  10. 疯狂<text class="fc-FF6320 fs-40 fw-b fs-i l-s-2">抢购</text>
  11. </view>
  12. </view>
  13. <view class="b-rad-20 bgc-f mb-10 p-24 box-border-box align-items-flex-start"
  14. v-for="(item,index) in goodsData" :key="index" @click="goToUrl(item)">
  15. <image class="goods-img flex-shrink0 mr-20 b-rad-12" :src="item.goods_image" mode="aspectFill"></image>
  16. <view class="flex-1 right-h flex-direction flex-justify-space">
  17. <view class="">
  18. <view class="fs-30 fw-600 fc-0 mb-10 text-overflow-ellipsis">
  19. {{item.goods_name}}
  20. </view>
  21. <view class="align-items-center">
  22. <uni-icons type="shop" size="15" color="#666" class="mr-4"></uni-icons>
  23. <view class="fs-26 fc-6">
  24. {{item.shop_name}}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="item-but align-items-center flex-justify-space bgc-FDF3EC box-border-box">
  29. <view class="align-items-center">
  30. <view class="fs-28 fw-600 fc-F43D04 mr-14">
  31. ¥ <text class="fs-30 fw-600 fc-F43D04">{{Number(item.seckill_money).toFixed(2)}}</text>
  32. </view>
  33. <view class="fs-24 fc-a text-line-through">
  34. ¥{{Number(item.line_price).toFixed(2)}}
  35. </view>
  36. </view>
  37. <view class="fs-28 fc-f msq-but plr-24 box-border-box bgc-EB5127 b-rad-20">
  38. 马上抢
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. seckillAllGoods
  49. } from "@/api/seckill.js"
  50. import {
  51. shopInfo,
  52. } from "@/api/shop.js"
  53. export default {
  54. components: {},
  55. data() {
  56. return {
  57. goodsData: [],
  58. page: 1,
  59. total: 0
  60. };
  61. },
  62. onLoad(data) {},
  63. mounted() {
  64. this.seckillAllGoods()
  65. },
  66. methods: {
  67. goToUrl(item) {
  68. shopInfo({
  69. shop_id: item.shop_id
  70. }).then((res) => {
  71. if (res.code == 1) {
  72. uni.navigateTo({
  73. url: '/pages-takeout/shop?shop_id=' + item.shop_id + '&category_id=' + item
  74. .category_id + '&goods_id=' + item.goods_id
  75. })
  76. } else {
  77. tools.error(res.msg)
  78. }
  79. })
  80. },
  81. scrolltolower() {
  82. if (this.total > this.goodsData.length) {
  83. ++this.page
  84. this.scrolltolower()
  85. }
  86. },
  87. seckillAllGoods() {
  88. seckillAllGoods({
  89. page: this.page
  90. }).then((res) => {
  91. if (res.code === 1) {
  92. this.goodsData.push(...res.data.items)
  93. this.total = res.data.total
  94. }
  95. })
  96. }
  97. },
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .seckill-box {
  102. background: linear-gradient(to bottom, rgba(0, 170, 255, 0.6), #F5F5F5, #F5F5F5);
  103. }
  104. .head-box {
  105. width: 100%;
  106. height: 100rpx;
  107. line-height: 100rpx;
  108. }
  109. .goods-img {
  110. width: 200rpx;
  111. height: 200rpx;
  112. }
  113. .right-h {
  114. height: 200rpx;
  115. }
  116. .item-but {
  117. width: 100%;
  118. height: 70rpx;
  119. line-height: 70rpx;
  120. border-radius: 5rpx 20rpx 20rpx 5rpx;
  121. padding: 0 0 0 24rpx;
  122. }
  123. .msq-but {}
  124. </style>