goodsList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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.images" 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.productName}}</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.price&&item.price.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. import { getJumpStoreAppId } from "../api/courseAuto.js"
  33. export default {
  34. props:['treatmentPackage','urlOption','source'],
  35. data() {
  36. return {
  37. list: []
  38. }
  39. },
  40. computed: {
  41. fontSize() {
  42. return size=>{
  43. const value = uni.upx2px(size)
  44. const scale = uni.getStorageSync('fontScale') || 1;
  45. if(scale<1){
  46. return value + 'px';
  47. }else {
  48. return value * scale + 'px';
  49. }
  50. }
  51. }
  52. },
  53. methods: {
  54. goBuy(item) {
  55. uni.navigateTo({
  56. url: '/pages/shopping/productDetails?productId='+item.productId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId
  57. })
  58. },
  59. goBuy2(item) {
  60. if(item.type==3) {
  61. // 跳转商城
  62. const param = {
  63. type: item.type
  64. }
  65. getJumpStoreAppId(param,this.source).then(res=>{
  66. if(res.code==200) {
  67. if(getApp().globalData.appId == res.msg) {
  68. uni.navigateTo({
  69. url: '/pages/shopping/productDetails?productId='+item.packageId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId
  70. })
  71. } else {
  72. uni.navigateToMiniProgram({
  73. appId: res.msg,
  74. path: '/pages/shopping/productDetails?productId='+item.packageId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId
  75. })
  76. }
  77. }
  78. })
  79. } else {
  80. uni.navigateTo({
  81. url: '/pages_index/packageDetails?packageId='+item.packageId+'&companyId='+this.urlOption.companyId+ '&companyUserId='+this.urlOption.companyUserId
  82. })
  83. }
  84. },
  85. }
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .empty {
  90. padding: 40rpx 24rpx;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. color: #999;
  95. &-btn {
  96. margin-top: 24rpx;
  97. padding: 20rpx 60rpx;
  98. border-radius: 44rpx 44rpx 44rpx 44rpx;
  99. border: 2rpx solid #FF5C03;
  100. font-family: PingFang SC, PingFang SC;
  101. font-weight: 400;
  102. color: #FF5C03;
  103. }
  104. }
  105. .empty-btn-min {
  106. flex-direction: column;
  107. padding: 8rpx 15rpx !important;
  108. font-size: 28rpx !important;
  109. }
  110. .goodsitem {
  111. display: flex;
  112. padding: 24rpx;
  113. overflow: hidden;
  114. min-height: 200rpx;
  115. &-img {
  116. overflow: hidden;
  117. flex-shrink: 0;
  118. width: 200rpx;
  119. height: 200rpx;
  120. border-radius: 14rpx;
  121. position: relative;
  122. }
  123. &-status {
  124. position: absolute;
  125. left: 0;
  126. top: 0;
  127. padding: 8rpx 15rpx;
  128. background: #FF5C03;
  129. border-radius: 14rpx 0 14rpx 0;
  130. font-size: 20rpx;
  131. color: #fff;
  132. box-sizing: border-box;
  133. text-align: center;
  134. }
  135. &-r {
  136. flex: 1;
  137. overflow: hidden;
  138. margin-left: 16rpx;
  139. display: flex;
  140. flex-direction: column;
  141. justify-content: space-between;
  142. }
  143. &-title {
  144. font-weight: bold;
  145. // font-size: 32rpx;
  146. color: #191A1B;
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. display: -webkit-box;
  150. -webkit-line-clamp: 1;
  151. -webkit-box-orient: vertical;
  152. }
  153. &-desc {
  154. font-family: PingFang SC, PingFang SC;
  155. font-weight: 400;
  156. // font-size: 30rpx;
  157. color: #939599;
  158. margin-top: 20rpx;
  159. }
  160. &-btnbox {
  161. display: flex;
  162. align-items: center;
  163. justify-content: space-between;
  164. .btn {
  165. display: inline-block;
  166. padding: 10rpx 38rpx;
  167. border-radius: 12rpx;
  168. border: 3rpx solid #FF5C03;
  169. font-weight: bold;
  170. // font-size: 30rpx;
  171. color: #FF5C03;
  172. text-align: center;
  173. }
  174. }
  175. .unit {
  176. font-size: 32rpx;
  177. }
  178. &-price {
  179. font-family: Roboto, Roboto;
  180. font-weight: bold;
  181. font-size: 40rpx;
  182. color: #FF5C03;
  183. display: flex;
  184. align-items: flex-end;
  185. }
  186. }
  187. </style>