goodsTopic.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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.jpg" ></image>
  42. <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_one.png" ></image>
  43. <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_one.png" ></image>
  44. <view class="type_right">
  45. <view class="type_title">全科</view>
  46. <view class="type_down">
  47. <view class="prices">{{ ['¥980', '¥1280', '¥1980'][courseNum]}}</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_two.jpg" ></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_two.png" ></image>
  56. <view class="type_right">
  57. <view class="type_title">公共单科</view>
  58. <view class="type_down">
  59. <view class="prices">{{ ['¥350', '¥450', '¥700'][courseNum]}}</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_three.jpg" ></image>
  66. <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_three.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', '¥700', '¥900'][courseNum]}}</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.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 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
  177. if (this.goodsInfo.goodsType == 2) {
  178. uni.navigateTo({
  179. url: '/pages2/bank/detail?id='+this.goodsInfo.goodsId
  180. })
  181. } else {
  182. // /pages5/liveDetail/index
  183. uni.navigateTo({
  184. url: '/pages3/course/detail?id='+ this.goodsInfo.goodsId + '&goodsType=' + this.goodsInfo.goodsType
  185. })
  186. }
  187. },
  188. closePop() {
  189. this.toggleCourseShow = false
  190. },
  191. togoBuy(subjectType) {
  192. this.skuItem = {}
  193. this.skuIndex = -1
  194. this.$http({
  195. url: '/app/common/get/goodsList',
  196. method: 'get',
  197. noToken: true,
  198. data: {
  199. subjectType: subjectType,
  200. topicId: this.topicId,
  201. type: this.courseNum + 1
  202. }
  203. }).then((res) => {
  204. if (res.data.code == 200) {
  205. this.toggleCourseShow = true
  206. this.courseSku = res.data.data || []
  207. } else {
  208. this.$u.toast(res.data.msg)
  209. }
  210. })
  211. },
  212. selectSku(item, index) {
  213. console.log('defhd', item, index)
  214. this.skuItem = item
  215. this.skuIndex = index
  216. },
  217. rightNowBuy() {
  218. if (Object.keys(this.skuItem).length == 0) {
  219. this.$u.toast('请选择科目')
  220. return
  221. }
  222. if(this.$method.isGoLogin()){
  223. return
  224. }
  225. this.$navTo.togo('/pages2/order/confirm_list?id='+this.skuItem.goodsId)
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. @mixin dis_center {
  232. display: flex;
  233. align-items: center;
  234. justify-content: center;
  235. }
  236. @mixin dis_around {
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-around;
  240. }
  241. .goods_topic {
  242. width: 100%;
  243. height: 100%;
  244. background: linear-gradient(180deg, #f1f4f9 0%, #DFECFD 100%);
  245. .banner_header {
  246. height: 378rpx;
  247. position: relative;
  248. top: 0rpx;
  249. left: 0rpx;
  250. .ban_img {
  251. width: 100%;
  252. height: 378rpx;
  253. position: absolute;
  254. top: 0rpx;
  255. left: 0rpx;
  256. z-index: 99;
  257. }
  258. .selects {
  259. margin: 32rpx 0rpx 0rpx 40rpx;
  260. width: 370rpx;
  261. height: 64rpx;
  262. background: rgba(255,255,255,0.6);
  263. border-radius: 160rpx;
  264. // opacity: 0.6;
  265. @include dis_around();
  266. position: absolute;
  267. top: 0rpx;
  268. left: 0rpx;
  269. z-index: 100;
  270. .icons {
  271. width: 36rpx;
  272. height: 36rpx;
  273. background: #FFFFFF;
  274. border-radius: 50%;
  275. @include dis_center();
  276. }
  277. }
  278. .imgs {
  279. position: absolute;
  280. bottom: 0rpx;
  281. left: 0rpx;
  282. z-index: 100;
  283. margin-left: 40rpx;
  284. }
  285. .banner {
  286. width: 670rpx;
  287. height: 250rpx;
  288. display: block;
  289. border-radius: 20rpx;
  290. }
  291. }
  292. .mains {
  293. padding: 0rpx 40rpx 40rpx 40rpx;
  294. .titles {
  295. margin: 72rpx 0rpx 0rpx 10rpx;
  296. .code {
  297. width: 38rpx;
  298. height: 24rpx;
  299. }
  300. .title {
  301. font-size: 40rpx;
  302. font-family: OPPOSans-Bold, OPPOSans;
  303. font-weight: bold;
  304. color: #222222;
  305. margin-left: 14rpx;
  306. }
  307. }
  308. .pictures {
  309. width: 100%;
  310. height: 522rpx;
  311. margin-top: 32rpx;
  312. .pic_imgs {
  313. width: 100%;
  314. height: 374rpx;
  315. border-radius: 24rpx 24rpx 0rpx 0rpx;
  316. .basic_img {
  317. width: 100%;
  318. height: 374rpx;
  319. border-radius: 24rpx 24rpx 0rpx 0rpx;
  320. }
  321. }
  322. .pic_title {
  323. width: 100%;
  324. height: 148rpx;
  325. background: #FFFFFF;
  326. border-radius: 0rpx 0rpx 24rpx 24rpx;
  327. font-size: 32rpx;
  328. font-family: OPPOSans-Bold, OPPOSans;
  329. font-weight: bold;
  330. color: #222222;
  331. padding: 32rpx;
  332. }
  333. }
  334. .courses {
  335. margin-top: 44rpx;
  336. display: flex;
  337. align-items: center;
  338. height: 78rpx;
  339. .cou_items {
  340. font-size: 28rpx;
  341. color: #969696;
  342. margin-right: 48rpx;
  343. position: relative;
  344. top: 0rpx;
  345. left: 0rpx;
  346. &:nth-child(1) {
  347. margin-left: 16rpx;
  348. }
  349. &.nactive {
  350. font-size: 32rpx;
  351. font-weight: bold;
  352. color: #498AFE;
  353. &::after {
  354. content: '';
  355. position: absolute;
  356. bottom: -18rpx;
  357. left: 60rpx;
  358. width: 32rpx;
  359. height: 8rpx;
  360. background: #498AFE;
  361. border-radius: 180rpx;
  362. }
  363. }
  364. }
  365. }
  366. .lines {
  367. width: 100%;
  368. height: 2rpx;
  369. background: #FFFFFF;
  370. }
  371. .course_list {
  372. width: 100%;
  373. padding: 40rpx 32rpx;
  374. background: #fff;
  375. border-radius: 14rpx;
  376. margin-top: 40rpx;
  377. .clist_item {
  378. height: 120rpx;
  379. margin-bottom: 48rpx;
  380. display: flex;
  381. &:last-child {
  382. margin-bottom: 0rpx;
  383. }
  384. .type_img {
  385. width: 212rpx;
  386. height: 120rpx;
  387. margin-right: 24rpx;
  388. border-radius: 18rpx;
  389. }
  390. .type_title {
  391. font-size: 32rpx;
  392. font-weight: 500;
  393. color: #222222;
  394. }
  395. .type_down {
  396. width: 370rpx;
  397. margin-top: 24rpx;
  398. @include dis_center();
  399. justify-content: space-between;
  400. }
  401. .prices {
  402. font-size: 36rpx;
  403. font-weight: 500;
  404. color: #F67205;
  405. }
  406. .tobuy {
  407. width: 144rpx;
  408. height: 52rpx;
  409. line-height: 52rpx;
  410. text-align: center;
  411. background: #FFB102;
  412. border-radius: 16rpx;
  413. font-size: 26rpx;
  414. font-weight: 500;
  415. color: #FFFFFF;
  416. }
  417. }
  418. }
  419. .details {
  420. width: 100%;
  421. height: 5035rpx;
  422. margin-top: 32rpx;
  423. .detail_img {
  424. width: 100%;
  425. height: 100%;
  426. display: block;
  427. }
  428. }
  429. }
  430. // 弹窗
  431. .popup_box {
  432. width: 100%;
  433. height: 938rpx;
  434. padding: 56rpx 56rpx 0rpx;
  435. .pop_prices {
  436. margin-top: 50rpx;
  437. margin-bottom: 40rpx;
  438. .types {
  439. font-size: 32rpx;
  440. font-weight: bold;
  441. color: #222222;
  442. margin-right: 24rpx;
  443. }
  444. .price {
  445. font-size: 36rpx;
  446. font-weight: 500;
  447. color: #F67205;
  448. }
  449. .lin_price {
  450. color: #999999;
  451. font-size: 30rpx;
  452. text-decoration:line-through;
  453. margin-left: 10rpx;
  454. }
  455. }
  456. .headers {
  457. width: 100%;
  458. display: flex;
  459. align-items: center;
  460. justify-content: space-between;
  461. .grade {
  462. font-size: 40rpx;
  463. font-weight: bold;
  464. color: #222222;
  465. }
  466. }
  467. .course_items {
  468. width: 100%;
  469. height: 96rpx;
  470. background: #F8F8F8;
  471. border-radius: 24rpx;
  472. padding: 30rpx 32rpx;
  473. font-size: 28rpx;
  474. color: #222222;
  475. margin-bottom: 32rpx;
  476. &.nactive {
  477. background: #D5E4FF;
  478. color: #3F8DFD;
  479. }
  480. &:last-child {
  481. margin-bottom: 0rpx;
  482. }
  483. }
  484. .right_now {
  485. width: 100%;
  486. height: 92rpx;
  487. line-height: 92rpx;
  488. text-align: center;
  489. background: #3F8DFD;
  490. border-radius: 120rpx;
  491. font-size: 32rpx;
  492. font-weight: 500;
  493. color: #FFFFFF;
  494. }
  495. }
  496. }
  497. </style>