recommen.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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"
  20. >&nbsp;{{ item.linePrice }}</text
  21. >
  22. </view>
  23. <view class="right">
  24. <view class="regiser_row" @click="toBuy(item)">立即购买</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- <view class="tip"
  32. >温馨提示:在线课程属虚拟商品,活动期间购买不予退款,请按需购买</view
  33. > -->
  34. </view>
  35. </template>
  36. <script>
  37. import { tenantId, BASE_URL } from "@/common/request.js";
  38. export default {
  39. data() {
  40. return {
  41. courseList: [],
  42. };
  43. },
  44. onLoad({ scene }) {
  45. this.courseList = [];
  46. if (scene) {
  47. let optObj = {};
  48. let arrs = decodeURIComponent(scene).split("&");
  49. for (let i = 0; i < arrs.length; i++) {
  50. optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
  51. }
  52. this.$store.commit("setSac", optObj.sac);
  53. this.getCourseList(optObj.sharekey);
  54. this.shareActivityCode(optObj.sac);
  55. }
  56. },
  57. methods: {
  58. getCourseList(id) {
  59. this.$api.actGoodsList(id).then((res) => {
  60. if (res.data.code == 200) {
  61. this.courseList = res.data.data;
  62. } else {
  63. uni.showToast({
  64. title: res.data.msg,
  65. icon: "error",
  66. });
  67. }
  68. });
  69. },
  70. toBuy(item) {
  71. if (item.goodsType == 2) {
  72. uni.navigateTo({
  73. url: "/pages2/bank/detail?id=" + item.goodsId,
  74. });
  75. } else {
  76. uni.navigateTo({
  77. url:
  78. "/pages3/course/detail?id=" +
  79. item.goodsId +
  80. "&goodsType=" +
  81. item.goodsType,
  82. });
  83. }
  84. },
  85. shareActivityCode(sac) {
  86. let token = uni.getStorageSync("token");
  87. token &&
  88. uni.request({
  89. url: BASE_URL + "/app/user/edit/shareActivityCode",
  90. method: "POST",
  91. data: {
  92. shareActivityCode: sac,
  93. },
  94. header: {
  95. AuthorizationToken: "WX " + token,
  96. TenantId: tenantId,
  97. },
  98. success: (res) => {},
  99. fail: (err) => {},
  100. });
  101. },
  102. },
  103. };
  104. </script>
  105. <style lang="scss" scoped>
  106. .scan_course {
  107. padding: 32rpx 32rpx 0;
  108. .list_item {
  109. padding: 24rpx;
  110. // height: 278rpx;
  111. background: #ffffff;
  112. box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
  113. border-radius: 24rpx;
  114. background: #fff;
  115. margin-bottom: 32rpx;
  116. display: flex;
  117. align-items: center;
  118. .c_title {
  119. font-size: 32rpx;
  120. font-weight: bold;
  121. margin-bottom: 24rpx;
  122. font-weight: bold;
  123. color: #222222;
  124. }
  125. .c_downs {
  126. display: flex;
  127. }
  128. .img {
  129. position: relative;
  130. margin-right: 24rpx;
  131. border-radius: 16rpx;
  132. overflow: hidden;
  133. width: 204rpx;
  134. height: 120rpx;
  135. image {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. .time {
  140. position: absolute;
  141. bottom: 0;
  142. right: 0;
  143. width: 80rpx;
  144. height: 32rpx;
  145. background: rgba(1, 25, 45, 0.4);
  146. color: #fff;
  147. text-align: center;
  148. line-height: 32rpx;
  149. font-size: 24rpx;
  150. border-radius: 10rpx 0px 10rpx 0px;
  151. }
  152. }
  153. .text {
  154. width: 440rpx;
  155. position: relative;
  156. display: flex;
  157. flex-direction: column;
  158. justify-content: space-between;
  159. height: 120rpx;
  160. .desc {
  161. margin-top: 10rpx;
  162. display: flex;
  163. align-items: center;
  164. justify-content: space-between;
  165. width: 100%;
  166. .left {
  167. flex: 1;
  168. color: #333;
  169. font-size: 26rpx;
  170. .mon_t {
  171. font-weight: bold;
  172. color: #fc3f3f;
  173. font-size: 36rpx;
  174. }
  175. .sale {
  176. color: #999999;
  177. font-size: 24rpx;
  178. margin-left: 8rpx;
  179. }
  180. .price_line {
  181. color: #999999;
  182. font-size: 24rpx;
  183. text-decoration: line-through;
  184. font-weight: 400;
  185. }
  186. }
  187. .right {
  188. font-size: 24rpx;
  189. font-weight: bold;
  190. padding-right: 20rpx;
  191. .regiser_row {
  192. width: 144rpx;
  193. height: 52rpx;
  194. line-height: 52rpx;
  195. text-align: center;
  196. border-radius: 16rpx;
  197. background-color: #fc3f3f;
  198. color: #fff;
  199. font-weight: 500;
  200. font-size: 26rpx;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. .tip {
  207. text-align: center;
  208. color: #a7b0b8;
  209. padding: 16rpx 30rpx 0;
  210. }
  211. }
  212. </style>