goodsTopic.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <view class="goods_topic">
  3. <nav-bar title="选课中心"></nav-bar>
  4. <view class="banner_header">
  5. <image class="ban_img" src="../static/topic/banner_bg.png"></image>
  6. <view class="selects" @click="back()">
  7. <view class="titles">
  8. 考前培训:二级建造师
  9. </view>
  10. <view class="icons">
  11. <u-icon name="arrow-right" color="#3E4055" size="26"></u-icon>
  12. </view>
  13. </view>
  14. <view class="imgs">
  15. <image class="banner" src="../static/topic/banner.png"></image>
  16. </view>
  17. </view>
  18. <view class="mains">
  19. <view class="titles">
  20. <image class="code" src="@/static/learn/act_icon.png" ></image>
  21. <text class="title">免费试听</text>
  22. </view>
  23. <view class="pictures" @click="toDetail()">
  24. <view class="pic_imgs">
  25. <image v-if="goodsInfo.goodsCoverUrl" :src="$method.splitImgHost(goodsInfo.goodsCoverUrl, true)" class="basic_img"></image>
  26. <image v-else class="basic_img" src="../static/topic/basic.png" ></image>
  27. </view>
  28. <view class="pic_title">{{ goodsInfo.goodsName }}</view>
  29. </view>
  30. <view class="titles">
  31. <image class="code" src="@/static/learn/act_icon.png" ></image>
  32. <text class="title">推荐课程</text>
  33. </view>
  34. <view class="courses">
  35. <view v-for="(item, index) in courseName" :key="index" class="cou_items"
  36. :class="{nactive: courseNum == index}" @click="tochangeCourse(item, index)">{{ item.name }}</view>
  37. </view>
  38. <view class="lines"></view>
  39. <view class="course_list">
  40. <view class="clist_item">
  41. <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_one.png" ></image>
  42. <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_two.png" ></image>
  43. <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_three.png" ></image>
  44. <view class="type_right">
  45. <view class="type_title">全科</view>
  46. <view class="type_down">
  47. <view class="prices">¥980</view>
  48. <view class="tobuy" @click="togoBuy(1)">立即购买</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="clist_item">
  53. <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_one.png" ></image>
  54. <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_two.png" ></image>
  55. <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_three.png" ></image>
  56. <view class="type_right">
  57. <view class="type_title">公共单科</view>
  58. <view class="type_down">
  59. <view class="prices">¥350</view>
  60. <view class="tobuy" @click="togoBuy(2)">立即购买</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="clist_item">
  65. <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_one.png" ></image>
  66. <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_two.png" ></image>
  67. <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_three.png" ></image>
  68. <view class="type_right">
  69. <view class="type_title">实务单科</view>
  70. <view class="type_down">
  71. <view class="prices">¥500</view>
  72. <view class="tobuy" @click="togoBuy(3)">立即购买</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="titles">
  78. <image class="code" src="@/static/learn/act_icon.png" ></image>
  79. <text class="title">详情</text>
  80. </view>
  81. <view class="details">
  82. <image v-if="courseNum == 0" class="detail_img" src="../static/topic/type1_detail.png" ></image>
  83. <image v-if="courseNum == 1" class="detail_img" src="../static/topic/type2_detail.png" ></image>
  84. <image v-if="courseNum == 2" class="detail_img" src="../static/topic/type3_detail.png" ></image>
  85. </view>
  86. </view>
  87. <!-- 弹窗 -->
  88. <u-popup v-model="toggleCourseShow" mode="bottom" border-radius="40">
  89. <view class="popup_box">
  90. <view class="check_head">
  91. <view class="headers">
  92. <view class="grade">选择课程</view>
  93. <u-icon name="close" color="#9C9C9C" size="40" @click="closePop()"></u-icon>
  94. </view>
  95. </view>
  96. <view class="pop_prices">
  97. <text class="price">¥ {{ skuItem.standPrice || 0 }}</text>
  98. <text v-if="skuItem.linePrice" class="lin_price">{{ skuItem.linePrice }}</text>
  99. </view>
  100. <view class="check_con">
  101. <scroll-view scroll-y="true" style="height: 550rpx;">
  102. <view class="course_items" v-for="(item, index) in courseSku" :key="index" :class="{nactive: skuIndex == index}" @click="selectSku(item, index)">
  103. {{ item.goodsName }}
  104. </view>
  105. </scroll-view>
  106. </view>
  107. <view class="right_now" @click="rightNowBuy()">立即购买</view>
  108. </view>
  109. </u-popup>
  110. </view>
  111. </template>
  112. <script>
  113. export default {
  114. name: 'goodsTopic',
  115. data() {
  116. return {
  117. courseName: [
  118. {
  119. name: '黄金基础班',
  120. type: 1
  121. },
  122. {
  123. name: '钻石强化班',
  124. type: 2
  125. },
  126. {
  127. name: '至尊私塾班',
  128. type: 3
  129. }
  130. ],
  131. courseNum: 0,
  132. topicId: '',
  133. goodsInfo: {},
  134. toggleCourseShow: true,
  135. courseSku: [1],
  136. skuItem: {},
  137. skuIndex: -1,
  138. }
  139. },
  140. onLoad(option) {
  141. if (option.scene) {
  142. let tid = decodeURIComponent(option.scene)
  143. this.topicId = tid.split('=')[1]
  144. console.log('topicId: ', this.topicId)
  145. } else {
  146. this.topicId = option.topicId
  147. }
  148. this.getgoodsInfo()
  149. },
  150. methods: {
  151. getgoodsInfo() {
  152. this.$http({
  153. url: `/course/topicPage/get/goodsInfo/${this.topicId}`,
  154. method: 'get',
  155. }).then((res) => {
  156. if (res.data.code == 200) {
  157. this.goodsInfo = res.data.data
  158. }
  159. })
  160. },
  161. tochangeCourse(item, index) {
  162. console.log(item, index)
  163. this.courseNum = index
  164. },
  165. back() {
  166. uni.navigateBack()
  167. },
  168. toDetail() {
  169. if (this.goodsInfo.goodsType == 1) {
  170. uni.navigateTo({
  171. url: '/pages3/course/detail?id='+this.goodsInfo.goodsId
  172. })
  173. } else if (this.goodsInfo.goodsType == 2) {
  174. uni.navigateTo({
  175. url: '/pages2/bank/detail?id='+this.goodsInfo.goodsId
  176. })
  177. } else {
  178. uni.navigateTo({
  179. url: '/pages5/liveDetail/index?id='+this.goodsInfo.goodsId
  180. })
  181. }
  182. },
  183. closePop() {
  184. this.toggleCourseShow = false
  185. },
  186. togoBuy(subjectType) {
  187. this.skuItem = {}
  188. this.skuIndex = -1
  189. this.$http({
  190. url: '/course/topicPage/get/goodsList',
  191. method: 'get',
  192. data: {
  193. subjectType: subjectType,
  194. topicId: this.topicId,
  195. type: this.courseNum + 1
  196. }
  197. }).then((res) => {
  198. if (res.data.code == 200) {
  199. this.toggleCourseShow = true
  200. this.courseSku = res.data.data || []
  201. } else {
  202. this.$u.toast(res.data.msg)
  203. }
  204. })
  205. },
  206. selectSku(item, index) {
  207. this.skuItem = item
  208. this.skuIndex = index
  209. },
  210. rightNowBuy() {
  211. if (Object.keys(this.skuItem).length == 0) {
  212. this.$u.toast('请选择科目')
  213. return
  214. }
  215. if(this.$method.isGoLogin()){
  216. return
  217. }
  218. this.$navTo.togo('/pages2/order/confirm_list?id='+this.skuItem.goodsId)
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. @mixin dis_center {
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. }
  229. @mixin dis_around {
  230. display: flex;
  231. align-items: center;
  232. justify-content: space-around;
  233. }
  234. .goods_topic {
  235. width: 100%;
  236. height: 100%;
  237. background: linear-gradient(180deg, rgba(223,236,253,0) 0%, #DFECFD 100%);
  238. .banner_header {
  239. height: 378rpx;
  240. position: relative;
  241. top: 0rpx;
  242. left: 0rpx;
  243. .ban_img {
  244. width: 100%;
  245. height: 378rpx;
  246. position: absolute;
  247. top: 0rpx;
  248. left: 0rpx;
  249. z-index: 99;
  250. }
  251. .selects {
  252. margin: 32rpx 0rpx 0rpx 40rpx;
  253. width: 370rpx;
  254. height: 64rpx;
  255. background: rgba(255,255,255,0.6);
  256. border-radius: 160rpx;
  257. // opacity: 0.6;
  258. @include dis_around();
  259. position: absolute;
  260. top: 0rpx;
  261. left: 0rpx;
  262. z-index: 100;
  263. .icons {
  264. width: 36rpx;
  265. height: 36rpx;
  266. background: #FFFFFF;
  267. border-radius: 50%;
  268. @include dis_center();
  269. }
  270. }
  271. .imgs {
  272. position: absolute;
  273. bottom: 0rpx;
  274. left: 0rpx;
  275. z-index: 100;
  276. margin-left: 40rpx;
  277. }
  278. .banner {
  279. width: 670rpx;
  280. height: 250rpx;
  281. border-radius: 20rpx;
  282. }
  283. }
  284. .mains {
  285. padding: 0rpx 40rpx 40rpx 40rpx;
  286. .titles {
  287. margin: 72rpx 0rpx 0rpx 10rpx;
  288. .code {
  289. width: 38rpx;
  290. height: 24rpx;
  291. }
  292. .title {
  293. font-size: 40rpx;
  294. font-family: OPPOSans-Bold, OPPOSans;
  295. font-weight: bold;
  296. color: #222222;
  297. margin-left: 14rpx;
  298. }
  299. }
  300. .pictures {
  301. width: 100%;
  302. height: 522rpx;
  303. margin-top: 32rpx;
  304. .pic_imgs {
  305. width: 100%;
  306. height: 374rpx;
  307. .basic_img {
  308. width: 100%;
  309. height: 374rpx;
  310. }
  311. }
  312. .pic_title {
  313. width: 100%;
  314. height: 148rpx;
  315. background: #FFFFFF;
  316. border-radius: 0rpx 0rpx 24rpx 24rpx;
  317. font-size: 32rpx;
  318. font-family: OPPOSans-Bold, OPPOSans;
  319. font-weight: bold;
  320. color: #222222;
  321. padding: 32rpx;
  322. }
  323. }
  324. .courses {
  325. margin-top: 44rpx;
  326. display: flex;
  327. align-items: center;
  328. height: 78rpx;
  329. .cou_items {
  330. font-size: 28rpx;
  331. color: #969696;
  332. margin-right: 48rpx;
  333. position: relative;
  334. top: 0rpx;
  335. left: 0rpx;
  336. &:nth-child(1) {
  337. margin-left: 16rpx;
  338. }
  339. &.nactive {
  340. font-size: 32rpx;
  341. font-weight: bold;
  342. color: #498AFE;
  343. &::after {
  344. content: '';
  345. position: absolute;
  346. bottom: -18rpx;
  347. left: 60rpx;
  348. width: 32rpx;
  349. height: 8rpx;
  350. background: #498AFE;
  351. border-radius: 180rpx;
  352. }
  353. }
  354. }
  355. }
  356. .lines {
  357. width: 100%;
  358. height: 2rpx;
  359. background: #FFFFFF;
  360. }
  361. .course_list {
  362. width: 100%;
  363. padding: 40rpx 32rpx;
  364. background: #fff;
  365. border-radius: 14rpx;
  366. margin-top: 40rpx;
  367. .clist_item {
  368. height: 120rpx;
  369. margin-bottom: 48rpx;
  370. display: flex;
  371. &:last-child {
  372. margin-bottom: 0rpx;
  373. }
  374. .type_img {
  375. width: 212rpx;
  376. height: 120rpx;
  377. margin-right: 24rpx;
  378. }
  379. .type_title {
  380. font-size: 32rpx;
  381. font-weight: 500;
  382. color: #222222;
  383. }
  384. .type_down {
  385. width: 370rpx;
  386. margin-top: 24rpx;
  387. @include dis_center();
  388. justify-content: space-between;
  389. }
  390. .prices {
  391. font-size: 36rpx;
  392. font-weight: 500;
  393. color: #F67205;
  394. }
  395. .tobuy {
  396. width: 144rpx;
  397. height: 52rpx;
  398. line-height: 52rpx;
  399. text-align: center;
  400. background: #FFB102;
  401. border-radius: 16rpx;
  402. font-size: 26rpx;
  403. font-weight: 500;
  404. color: #FFFFFF;
  405. }
  406. }
  407. }
  408. .details {
  409. width: 100%;
  410. height: 5035rpx;
  411. margin-top: 32rpx;
  412. .detail_img {
  413. width: 100%;
  414. height: 100%;
  415. display: block;
  416. }
  417. }
  418. }
  419. // 弹窗
  420. .popup_box {
  421. width: 100%;
  422. height: 938rpx;
  423. padding: 56rpx 56rpx 0rpx;
  424. .pop_prices {
  425. margin-top: 50rpx;
  426. margin-bottom: 40rpx;
  427. .types {
  428. font-size: 32rpx;
  429. font-weight: bold;
  430. color: #222222;
  431. margin-right: 24rpx;
  432. }
  433. .price {
  434. font-size: 36rpx;
  435. font-weight: 500;
  436. color: #F67205;
  437. }
  438. .lin_price {
  439. color: #999999;
  440. font-size: 30rpx;
  441. text-decoration:line-through;
  442. }
  443. }
  444. .headers {
  445. width: 100%;
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. .grade {
  450. font-size: 40rpx;
  451. font-weight: bold;
  452. color: #222222;
  453. }
  454. }
  455. .course_items {
  456. width: 100%;
  457. height: 96rpx;
  458. background: #F8F8F8;
  459. border-radius: 24rpx;
  460. padding: 30rpx 32rpx;
  461. font-size: 28rpx;
  462. color: #222222;
  463. margin-bottom: 32rpx;
  464. &.nactive {
  465. background: #D5E4FF;
  466. color: #3F8DFD;
  467. }
  468. &:last-child {
  469. margin-bottom: 0rpx;
  470. }
  471. }
  472. .right_now {
  473. width: 100%;
  474. height: 92rpx;
  475. line-height: 92rpx;
  476. text-align: center;
  477. background: #3F8DFD;
  478. border-radius: 120rpx;
  479. font-size: 32rpx;
  480. font-weight: 500;
  481. color: #FFFFFF;
  482. }
  483. }
  484. }
  485. </style>