group.vue 4.3 KB

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