group.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. .head-img{
  117. width: 100%;
  118. height: 422rpx;
  119. }
  120. .box-card{
  121. width: 100%;
  122. min-height: 100rpx;
  123. background: #FFFFFF;
  124. box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(51,51,51,0.1);
  125. border-radius: 20rpx;
  126. .goods-img{
  127. width: 100%;
  128. height: 452rpx;
  129. border-radius: 20rpx;
  130. }
  131. .info-box{
  132. width: 100%;
  133. height: 72rpx;
  134. background: #FEE0E0;
  135. border-radius: 20rpx;
  136. line-height: 72rpx;
  137. padding-left: 14rpx;
  138. box-sizing: border-box;
  139. .info-box-qiang{
  140. width: 148rpx;
  141. height: 72rpx;
  142. background: #F63E36;
  143. border-radius: 0rpx 20rpx 20rpx 0rpx;
  144. position: relative;
  145. .qiang-img{
  146. width: 60rpx;
  147. height: 60rpx;
  148. margin: 6rpx 22rpx 0 auto;
  149. }
  150. .jiang-box{
  151. position: absolute;
  152. top: -30rpx;
  153. left: -22rpx;
  154. z-index: 20;
  155. }
  156. .jiang-box-1{
  157. position: absolute;
  158. top: 0rpx;
  159. left: -30rpx;
  160. z-index: 20;
  161. }
  162. .jiang-img{
  163. position: absolute;
  164. width: 120rpx;
  165. height: 90rpx;
  166. left: -60rpx;
  167. bottom: 0;
  168. z-index: 11;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>