recommen.vue 5.4 KB

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