recommen.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="scan_course">
  3. <nav-bar title="商品列表" class="navbar"></nav-bar>
  4. <view class="list_item" v-for="(item, index) in courseList" :key="index">
  5. <view class="course_content">
  6. <view class="c_title">{{ item.goodsName }}</view>
  7. <view class="c_downs">
  8. <view class="img">
  9. <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
  10. <view class="time" v-if="item.year">{{
  11. item.year ? item.year : ""
  12. }}</view>
  13. </view>
  14. <view class="text">
  15. <view class="desc">
  16. <view class="left">
  17. <text class="mon_t">¥ {{ item.standPrice }}</text>
  18. <text v-if="item.linePrice" class="sale"> ¥ </text>
  19. <text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
  20. </view>
  21. <view class="right">
  22. <view class="regiser_row" @click="toBuy(item)">立即购买</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. courseList: []
  36. };
  37. },
  38. onLoad({
  39. scene
  40. }) {
  41. this.courseList = [];
  42. if (scene) {
  43. let optObj = {};
  44. let arrs = decodeURIComponent(scene).split("&");
  45. for (let i = 0; i < arrs.length; i++) {
  46. optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
  47. }
  48. this.getCourseList(optObj.sharekey);
  49. }
  50. },
  51. methods: {
  52. getCourseList(id) {
  53. this.$api.actGoodsList(id).then((res) => {
  54. if (res.data.code == 200) {
  55. this.courseList = res.data.data;
  56. } else {
  57. uni.showToast({
  58. title: res.data.msg,
  59. icon: "error",
  60. });
  61. }
  62. })
  63. },
  64. toBuy(item) {
  65. if (item.goodsType == 2) {
  66. uni.navigateTo({
  67. url: "/pages2/bank/detail?id=" + item.goodsId,
  68. });
  69. } else {
  70. uni.navigateTo({
  71. url: "/pages3/course/detail?id=" +
  72. item.goodsId +
  73. "&goodsType=" +
  74. item.goodsType,
  75. });
  76. }
  77. },
  78. },
  79. };
  80. </script>
  81. <style lang="scss" scoped>
  82. .scan_course {
  83. padding: 32rpx 32rpx 0;
  84. .list_item {
  85. padding: 24rpx;
  86. // height: 278rpx;
  87. background: #ffffff;
  88. box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
  89. border-radius: 24rpx;
  90. background: #fff;
  91. margin-bottom: 32rpx;
  92. display: flex;
  93. align-items: center;
  94. .c_title {
  95. font-size: 32rpx;
  96. font-weight: bold;
  97. margin-bottom: 24rpx;
  98. font-weight: bold;
  99. color: #222222;
  100. }
  101. .c_downs {
  102. display: flex;
  103. }
  104. .img {
  105. position: relative;
  106. margin-right: 24rpx;
  107. border-radius: 16rpx;
  108. overflow: hidden;
  109. width: 204rpx;
  110. height: 120rpx;
  111. image {
  112. width: 100%;
  113. height: 100%;
  114. }
  115. .time {
  116. position: absolute;
  117. bottom: 0;
  118. right: 0;
  119. width: 80rpx;
  120. height: 32rpx;
  121. background: rgba(1, 25, 45, 0.4);
  122. color: #fff;
  123. text-align: center;
  124. line-height: 32rpx;
  125. font-size: 24rpx;
  126. border-radius: 10rpx 0px 10rpx 0px;
  127. }
  128. }
  129. .text {
  130. width: 440rpx;
  131. position: relative;
  132. display: flex;
  133. flex-direction: column;
  134. justify-content: space-between;
  135. height: 120rpx;
  136. .desc {
  137. margin-top: 10rpx;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. width: 100%;
  142. .left {
  143. flex: 1;
  144. color: #333;
  145. font-size: 26rpx;
  146. .mon_t {
  147. font-weight: bold;
  148. color: #fc3f3f;
  149. font-size: 36rpx;
  150. }
  151. .sale {
  152. color: #999999;
  153. font-size: 24rpx;
  154. margin-left: 8rpx;
  155. }
  156. .price_line {
  157. color: #999999;
  158. font-size: 24rpx;
  159. text-decoration: line-through;
  160. font-weight: 400;
  161. }
  162. }
  163. .right {
  164. font-size: 24rpx;
  165. font-weight: bold;
  166. padding-right: 20rpx;
  167. .regiser_row {
  168. width: 144rpx;
  169. height: 52rpx;
  170. line-height: 52rpx;
  171. text-align: center;
  172. border-radius: 16rpx;
  173. background-color: #fc3f3f;
  174. color: #fff;
  175. font-weight: 500;
  176. font-size: 26rpx;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. }
  183. </style>