goodsTopic.vue 16 KB

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