group.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="group-box iPhone-bottom box-border-box flex-common-css">
  3. <Nav title='团购专区'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css">
  5. <image class="head-img" src="@/static/img/buy/group-bg.png" mode="scaleToFill"></image>
  6. <view class="box-border-box content-b">
  7. <view class="box-card box-border-box mb-20" v-for="(item,i) in list" :key="i" @click="todet(item)">
  8. <image class="goods-img mb-16" :src="item.cover_img" mode="aspectFill"></image>
  9. <view class="text-overflow-ellipsis fs-32 fw-600 mb-20 w-100100">
  10. {{item.title}}
  11. </view>
  12. <view class="mb-40 flex-justify-space align-items-center">
  13. <view class="jd-f">
  14. <view class="jd-1"></view>
  15. <view class="jd-2" :style="{width:setWidth(item.number,item.sales)+'rpx'}"></view>
  16. </view>
  17. <view class="">
  18. <span class="fs-24 fc-9">已团</span>
  19. <span class="fs-24 ">{{item.sales}}件</span>
  20. <span class="fs-24 fc-9">/剩</span>
  21. <span class="fs-24 ">{{item.number - item.sales}}</span>
  22. </view>
  23. </view>
  24. <view class="info-box display-flex">
  25. <view class="flex-1">
  26. <span class="fs-28 fc-FB3D03 fw-400">团购价¥</span>
  27. <span class="fs-40 fc-FB3D03 fw-600">{{item.price}}</span>
  28. </view>
  29. <view class="info-box-qiang">
  30. <image class="qiang-img" src="@/static/img/buy/qiang.png" mode="scaleToFill"></image>
  31. <view class="jiang-box fc-65420c fs-24 fw-600">直降</view>
  32. <view class="jiang-box-1 fs-24 fc-65420c fw-600">¥{{item.line_price - item.price}}</view>
  33. <image class="jiang-img" src="@/static/img/buy/x-jt.png" mode="scaleToFill"></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. groupList
  44. } from '@/api/groupOrder.js';
  45. import tools from "@/service/tools";
  46. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  47. export default {
  48. components: {
  49. EnBlank
  50. },
  51. data() {
  52. return {
  53. page: 1,
  54. total: 0,
  55. list: [],
  56. }
  57. },
  58. onReachBottom() {
  59. if (this.list.length < this.total) {
  60. this.page += 1;
  61. this.getList();
  62. }
  63. },
  64. onShow() {
  65. this.page = 1;
  66. this.list = [];
  67. this.getList();
  68. },
  69. mounted() {},
  70. methods: {
  71. getList() {
  72. let school_id = uni.getStorageSync('school_id');
  73. groupList({
  74. school_id: school_id,
  75. page: this.page
  76. }).then((res) => {
  77. if (res.code === 1) {
  78. this.list = [...this.list, ...res.data.items];
  79. this.total = res.data.total;
  80. }
  81. })
  82. },
  83. setWidth(total, num) {
  84. let w = 0
  85. let tH = 434;
  86. w = (tH / total * num).toFixed(0)
  87. console.log(w);
  88. return w
  89. },
  90. todet(item) {
  91. uni.navigateTo({
  92. url: '/pages-buy/group-det?id=' + item.id
  93. })
  94. },
  95. },
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .content-b {
  100. padding: 0 24rpx 24rpx;
  101. }
  102. .jd-f {
  103. position: relative;
  104. width: 434rpx;
  105. height: 18rpx;
  106. .jd-1 {
  107. position: absolute;
  108. top: 0;
  109. left: 0;
  110. width: 434rpx;
  111. height: 18rpx;
  112. background: #FEE0E0;
  113. border-radius: 200rpx 200rpx 200rpx 200rpx;
  114. z-index: 10;
  115. }
  116. .jd-2 {
  117. position: absolute;
  118. top: 0;
  119. left: 0;
  120. height: 18rpx;
  121. background: linear-gradient(90deg, #FF545D 0%, #FF4B84 100%);
  122. // background-color: #FF2652;
  123. border-radius: 200rpx 200rpx 200rpx 200rpx;
  124. z-index: 12;
  125. }
  126. }
  127. .group-box {
  128. background-color: #EF2864;
  129. height: 100vh;
  130. .head-img {
  131. width: 100%;
  132. height: 422rpx;
  133. }
  134. .box-card {
  135. width: 100%;
  136. min-height: 100rpx;
  137. background: #FFFFFF;
  138. padding: 16rpx;
  139. box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(51, 51, 51, 0.1);
  140. border-radius: 20rpx;
  141. .goods-img {
  142. width: 100%;
  143. height: 452rpx;
  144. border-radius: 20rpx;
  145. // margin-top: 24rpx;
  146. }
  147. .info-box {
  148. width: 100%;
  149. height: 72rpx;
  150. background: #FEE0E0;
  151. border-radius: 20rpx;
  152. line-height: 72rpx;
  153. padding-left: 14rpx;
  154. box-sizing: border-box;
  155. .info-box-qiang {
  156. width: 148rpx;
  157. height: 72rpx;
  158. background: #F63E36;
  159. border-radius: 0rpx 20rpx 20rpx 0rpx;
  160. position: relative;
  161. .qiang-img {
  162. width: 60rpx;
  163. height: 60rpx;
  164. margin: 6rpx 22rpx 0 auto;
  165. }
  166. .jiang-box {
  167. position: absolute;
  168. top: -30rpx;
  169. left: -22rpx;
  170. z-index: 20;
  171. }
  172. .jiang-box-1 {
  173. position: absolute;
  174. top: 0rpx;
  175. left: -30rpx;
  176. z-index: 20;
  177. }
  178. .jiang-img {
  179. position: absolute;
  180. width: 120rpx;
  181. height: 90rpx;
  182. left: -60rpx;
  183. bottom: 0;
  184. z-index: 11;
  185. }
  186. }
  187. }
  188. }
  189. }
  190. </style>