recommen.vue 5.2 KB

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