goodsList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <view v-for="(item,index) in treatmentPackage" :key="index">
  4. <view class="goodsitem">
  5. <view class="goodsitem-img">
  6. <image :src="item.imgUrl" mode="aspectFill" style="height: 100%;width: 100%"></image>
  7. <!-- <view class="goodsitem-status">讲解中</view> -->
  8. </view>
  9. <view class="goodsitem-r">
  10. <view>
  11. <view class="goodsitem-title" :style="{ fontSize: fontSize(32)}">{{item.packageName}}</view>
  12. <view class="goodsitem-desc ellipsis2" :style="{ fontSize: fontSize(30)}">{{item.secondName}}</view>
  13. </view>
  14. <view class="goodsitem-btnbox" @click="goBuy(item)">
  15. <view class="goodsitem-price">
  16. <view class="unit">¥</view>
  17. <text class="price">{{item.totalPrice&&item.totalPrice.toFixed(2)}}</text>
  18. </view>
  19. <view class="btn">去购买</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view v-if="treatmentPackage.length==0">
  25. <view class="empty">
  26. <text>暂未上新活动</text>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. props:['treatmentPackage','urlOption'],
  34. data() {
  35. return {
  36. list: []
  37. }
  38. },
  39. computed: {
  40. fontSize() {
  41. return size=>{
  42. const value = uni.upx2px(size)
  43. const scale = uni.getStorageSync('fontScale') || 1;
  44. if(scale<1){
  45. return value + 'px';
  46. }else {
  47. return value * scale + 'px';
  48. }
  49. }
  50. }
  51. },
  52. methods: {
  53. goBuy(item) {
  54. if(getApp().globalData.appId == 'wxc3f0a952b7bc2b94') {
  55. uni.navigateTo({
  56. url: '/pages_index/packageDetails?packageId='+item.packageId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId,
  57. })
  58. } else {
  59. uni.navigateToMiniProgram({
  60. appId: 'wxc3f0a952b7bc2b94',
  61. path: '/pages_index/packageDetails?packageId='+item.packageId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId,
  62. })
  63. }
  64. }
  65. }
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .empty {
  70. padding: 40rpx 24rpx;
  71. display: flex;
  72. flex-direction: column;
  73. align-items: center;
  74. color: #999;
  75. &-btn {
  76. margin-top: 24rpx;
  77. padding: 20rpx 60rpx;
  78. border-radius: 44rpx 44rpx 44rpx 44rpx;
  79. border: 2rpx solid #FF5C03;
  80. font-family: PingFang SC, PingFang SC;
  81. font-weight: 400;
  82. color: #FF5C03;
  83. }
  84. }
  85. .empty-btn-min {
  86. flex-direction: column;
  87. padding: 8rpx 15rpx !important;
  88. font-size: 28rpx !important;
  89. }
  90. .goodsitem {
  91. display: flex;
  92. padding: 24rpx;
  93. overflow: hidden;
  94. min-height: 200rpx;
  95. &-img {
  96. overflow: hidden;
  97. flex-shrink: 0;
  98. width: 200rpx;
  99. height: 200rpx;
  100. border-radius: 14rpx;
  101. position: relative;
  102. }
  103. &-status {
  104. position: absolute;
  105. left: 0;
  106. top: 0;
  107. padding: 8rpx 15rpx;
  108. background: #FF5C03;
  109. border-radius: 14rpx 0 14rpx 0;
  110. font-size: 20rpx;
  111. color: #fff;
  112. box-sizing: border-box;
  113. text-align: center;
  114. }
  115. &-r {
  116. flex: 1;
  117. overflow: hidden;
  118. margin-left: 16rpx;
  119. display: flex;
  120. flex-direction: column;
  121. justify-content: space-between;
  122. }
  123. &-title {
  124. font-weight: bold;
  125. // font-size: 32rpx;
  126. color: #191A1B;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. display: -webkit-box;
  130. -webkit-line-clamp: 1;
  131. -webkit-box-orient: vertical;
  132. }
  133. &-desc {
  134. font-family: PingFang SC, PingFang SC;
  135. font-weight: 400;
  136. // font-size: 30rpx;
  137. color: #939599;
  138. margin-top: 20rpx;
  139. }
  140. &-btnbox {
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-between;
  144. .btn {
  145. display: inline-block;
  146. padding: 10rpx 38rpx;
  147. border-radius: 12rpx;
  148. border: 3rpx solid #FF5C03;
  149. font-weight: bold;
  150. // font-size: 30rpx;
  151. color: #FF5C03;
  152. text-align: center;
  153. }
  154. }
  155. .unit {
  156. font-size: 32rpx;
  157. }
  158. &-price {
  159. font-family: Roboto, Roboto;
  160. font-weight: bold;
  161. font-size: 40rpx;
  162. color: #FF5C03;
  163. display: flex;
  164. align-items: flex-end;
  165. }
  166. }
  167. </style>