group.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 p-24">
  6. <view class="box-card box-border-box p-24 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-36 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. .jd-f{
  90. position: relative;
  91. width: 434rpx;
  92. height: 18rpx;
  93. .jd-1{
  94. position: absolute;
  95. top: 0;
  96. left: 0;
  97. width: 434rpx;
  98. height: 18rpx;
  99. background: #FEE0E0;
  100. border-radius: 200rpx 200rpx 200rpx 200rpx;
  101. z-index: 10;
  102. }
  103. .jd-2{
  104. position: absolute;
  105. top: 0;
  106. left: 0;
  107. height: 18rpx;
  108. // background: linear-gradient( 90deg, #3FF9F9 0%, #E0FEA4 100%);
  109. background-color: #FF2652;
  110. border-radius: 200rpx 200rpx 200rpx 200rpx;
  111. z-index: 12;
  112. }
  113. }
  114. .group-box{
  115. background-color: #EF2864;
  116. min-height: 100vh;
  117. .head-img{
  118. width: 100%;
  119. height: 422rpx;
  120. }
  121. .box-card{
  122. width: 100%;
  123. min-height: 100rpx;
  124. background: #FFFFFF;
  125. box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(51,51,51,0.1);
  126. border-radius: 20rpx;
  127. .goods-img{
  128. width: 100%;
  129. height: 452rpx;
  130. border-radius: 20rpx;
  131. }
  132. .info-box{
  133. width: 100%;
  134. height: 72rpx;
  135. background: #FEE0E0;
  136. border-radius: 20rpx;
  137. line-height: 72rpx;
  138. padding-left: 14rpx;
  139. box-sizing: border-box;
  140. .info-box-qiang{
  141. width: 148rpx;
  142. height: 72rpx;
  143. background: #F63E36;
  144. border-radius: 0rpx 20rpx 20rpx 0rpx;
  145. position: relative;
  146. .qiang-img{
  147. width: 60rpx;
  148. height: 60rpx;
  149. margin: 6rpx 22rpx 0 auto;
  150. }
  151. .jiang-box{
  152. position: absolute;
  153. top: -30rpx;
  154. left: -22rpx;
  155. z-index: 20;
  156. }
  157. .jiang-box-1{
  158. position: absolute;
  159. top: 0rpx;
  160. left: -30rpx;
  161. z-index: 20;
  162. }
  163. .jiang-img{
  164. position: absolute;
  165. width: 120rpx;
  166. height: 90rpx;
  167. left: -60rpx;
  168. bottom: 0;
  169. z-index: 11;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>