鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

506 lines
13 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="活动详情" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="transparent" />
  4. <view class="main">
  5. <view class="swiper">
  6. <uv-swiper
  7. :list="bannerList"
  8. keyName="image"
  9. indicator
  10. indicatorMode="dot"
  11. indicatorInactiveColor="rgba(255, 255, 255, 0.7)"
  12. height="680rpx"
  13. ></uv-swiper>
  14. </view>
  15. <view class="summary">
  16. <view class="card info">
  17. <view class="card-header">{{ detail.name }}</view>
  18. <view class="card-content">
  19. <view class="desc">{{ detail.desc }}</view>
  20. <view class="flex tags" v-if="detail.tags">
  21. <view class="tag" v-for="(tag, tIdx) in detail.tags" :key="tIdx">
  22. {{ tag }}
  23. </view>
  24. </view>
  25. <view class="flex data">
  26. <view class="flex price">
  27. <view class="price-val">
  28. <text>¥</text>
  29. <text class="highlight">{{ priceInt }}</text>
  30. <text>{{ `${priceFrac}` }}</text>
  31. </view>
  32. <view class="price-bef" v-if="detail.originalPrice">¥<text>{{ detail.originalPrice }}</text></view>
  33. </view>
  34. <view class="registered" v-if="detail.registered">
  35. {{ `${detail.registered}人已报名` }}
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="card">
  41. <view class="card-header">选择团期</view>
  42. <view class="card-content">
  43. <timeOptionsSelect v-model="selectTime" :options="detail.timeOptions"></timeOptionsSelect>
  44. </view>
  45. </view>
  46. <view class="card comment">
  47. <view class="flex card-header">
  48. <view>评论</view>
  49. <button class="flex btn" @click="jumpToCommentRecords">
  50. <view>查看全部</view>
  51. <image class="img" src="@/static/image/icon-arrow-right.png" mode="widthFix"></image>
  52. </button>
  53. </view>
  54. <view class="card-content">
  55. <commentList :list="commentList"></commentList>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- <uv-sticky bgColor="#F3F3F3"> -->
  60. <view class="tabs">
  61. <uv-tabs
  62. :list="tabs"
  63. :scrollable="false"
  64. lineColor="#00A9FF"
  65. lineWidth="48rpx"
  66. lineHeight="4rpx"
  67. :activeStyle="{
  68. 'font-family': 'PingFang SC',
  69. 'font-weight': 500,
  70. 'font-size': '32rpx',
  71. 'line-height': 1.4,
  72. 'color': '#00A9FF',
  73. }"
  74. :inactiveStyle="{
  75. 'font-family': 'PingFang SC',
  76. 'font-weight': 400,
  77. 'font-size': '32rpx',
  78. 'line-height': 1.4,
  79. 'color': '#191919',
  80. }"
  81. @click="clickTabs"
  82. ></uv-tabs>
  83. </view>
  84. <!-- </uv-sticky> -->
  85. <view class="detail" v-if="displayContent">
  86. <uv-parse :content="displayContent"></uv-parse>
  87. </view>
  88. </view>
  89. <view class="flex bottom">
  90. <button plain class="flex flex-column btn btn-simple" open-type="contact">
  91. <image class="icon" src="@/pages_order/static/product/icon-service.png" mode="widthFix"></image>
  92. <view>客服</view>
  93. </button>
  94. <view class="flex operate">
  95. <button class="flex btn btn-palin" @click="onCollect">收藏</button>
  96. <button class="flex btn btn-primary" @click="onBuy">立即购买</button>
  97. </view>
  98. </view>
  99. <orderInfoPopup ref="orderInfoPopup" :data="detail" @timeChange="selectTime = $event"></orderInfoPopup>
  100. </view>
  101. </template>
  102. <script>
  103. import timeOptionsSelect from '@/pages_order/order/orderConfirm/timeOptionsSelect.vue'
  104. import commentList from './commentList.vue'
  105. import orderInfoPopup from '@/pages_order/order/orderConfirm/infoPopup.vue'
  106. export default {
  107. components: {
  108. timeOptionsSelect,
  109. commentList,
  110. orderInfoPopup,
  111. },
  112. data() {
  113. return {
  114. id: null,
  115. detail: {},
  116. next: 'createOrder', // createOrder | addCart
  117. commentList: [],
  118. tabs: [
  119. { name: '行程亮点' },
  120. { name: '课程目标' },
  121. { name: '详细行程' },
  122. ],
  123. current: 0,
  124. selectTime: null,
  125. }
  126. },
  127. computed: {
  128. bannerList() {
  129. const { image } = this.detail
  130. if (!image) {
  131. return []
  132. }
  133. return Array.isArray(image) ? image : image.split(',')
  134. },
  135. priceInt() {
  136. return parseInt(this.detail.currentPrice)
  137. },
  138. priceFrac() {
  139. return (this.detail.currentPrice % this.priceInt).toFixed(2).slice(1)
  140. },
  141. displayContent() {
  142. const {
  143. itineraryHighlights,
  144. courseObjectives,
  145. itineraryDetail,
  146. } = this.detail
  147. if (this.current == 0) {
  148. return itineraryHighlights
  149. } else if (this.current == 1) {
  150. return courseObjectives
  151. } else if (this.current == 2) {
  152. return itineraryDetail
  153. }
  154. return ''
  155. }
  156. },
  157. onLoad(arg) {
  158. const { id } = arg
  159. this.id = id
  160. this.fetchDetail(id)
  161. this.fetchComment(id)
  162. },
  163. methods: {
  164. async fetchDetail(id) {
  165. this.detail = {
  166. id: '001',
  167. image: new Array(6).fill('/static/image/temp-20.png').join(','),
  168. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  169. desc: '每天车程4小时内,含一程高铁丨喀拉峻草原、夏塔古道、昭苏天马、赛里木湖、昭苏油菜花、伊犁薰衣草丨吐鲁番坎儿井&火焰山',
  170. tags: ['坝上草原', '自然探索', '户外探索', '亲子游玩'],
  171. currentPrice: 688.99,
  172. originalPrice: 1200,
  173. registered: 4168,
  174. timeOptions: [
  175. {
  176. id: '0011',
  177. startDate: '08/25',
  178. endDate: '09/01',
  179. currentPrice: 1200.99,
  180. originalPrice: 2300,
  181. adultsPrice: 2400,
  182. teenagerPrice: 1800,
  183. childPrice: 1200.99,
  184. },
  185. {
  186. id: '0012',
  187. startDate: '09/02',
  188. endDate: '09/11',
  189. currentPrice: 1200.99,
  190. originalPrice: 2300,
  191. adultsPrice: 2400,
  192. teenagerPrice: 1800,
  193. childPrice: 1200.99,
  194. },
  195. {
  196. id: '0013',
  197. startDate: '09/12',
  198. endDate: '09/19',
  199. currentPrice: 1200.99,
  200. originalPrice: 2300,
  201. adultsPrice: 2400,
  202. teenagerPrice: 1800,
  203. childPrice: 1200.99,
  204. },
  205. ],
  206. itineraryHighlights: `
  207. <p>
  208. <img style="width: 100%;" src="/static/image/temp-31.png" mode="widthFix"/>
  209. <img style="width: 100%;" src="/static/image/temp-32.png" mode="widthFix"/>
  210. <img style="width: 100%;" src="/static/image/temp-33.png" mode="widthFix"/>
  211. <img style="width: 100%;" src="/static/image/temp-34.png" mode="widthFix"/>
  212. <img style="width: 100%;" src="/static/image/temp-35.png" mode="widthFix"/>
  213. </p>
  214. `,
  215. courseObjectives: `
  216. <p style="font-size: 36rpx;">
  217. 课程目标
  218. <p>
  219. `,
  220. itineraryDetail: `
  221. <p style="font-size: 36rpx;">
  222. 详细行程
  223. <p>
  224. `,
  225. }
  226. return
  227. try {
  228. const result = await this.$fetch('getProductDetail', { id })
  229. const { specs } = result
  230. let arr = specs
  231. arr?.sort?.((a, b) => a.sortOrder - b.sortOrder)
  232. const spec = arr?.[0]
  233. this.detail = {
  234. ...result,
  235. specId: spec?.id || null,
  236. specName: spec?.specName || null,
  237. }
  238. } catch (err) {
  239. }
  240. },
  241. async fetchComment(id) {
  242. this.commentList = [
  243. {
  244. avatar: '/static/image/temp-30.png',
  245. name: '战斗世界',
  246. createTime: '2025-07-12',
  247. content: '凌玉姐姐很温柔很耐心很负责我很喜欢她龙哥知识渊博很幽默给我们讲解很多内容行程很有趣我学到了很多东西最难忘的就是库木塔格沙漠我们爬到了很高的顶端看夕阳绝美还有我也很喜欢夏塔古道我们爬到了第四个卡拉房子的最远端看到了壮观的雪山下次还想参加活动去南疆',
  248. image: '/static/image/temp-36.png',
  249. },
  250. {
  251. avatar: '/static/image/temp-30.png',
  252. name: '战斗世界',
  253. createTime: '2025-07-12',
  254. content: '凌玉姐姐很温柔很耐心很负责我很喜欢她龙哥知识渊博很幽默给我们讲解很多内容行程很有趣我学到了很多东西最难忘的就是库木塔格沙漠我们爬到了很高的顶端看夕阳绝美还有我也很喜欢夏塔古道我们爬到了第四个卡拉房子的最远端看到了壮观的雪山下次还想参加活动去南疆',
  255. image: '/static/image/temp-36.png',
  256. },
  257. ]
  258. // todo: fetch
  259. },
  260. onCollect() {
  261. this.$store.dispatch('collect', this.id)
  262. },
  263. onBuy() {
  264. this.$refs.orderInfoPopup.open({ selectTime: this.selectTime })
  265. },
  266. jumpToCommentRecords() {
  267. // todo
  268. return
  269. this.$utils.navigateTo(`/pages_order/comment/commentRecordsOfProduct?productId=${this.id}`)
  270. },
  271. //点击tab栏
  272. clickTabs({ index }) {
  273. this.current = index
  274. },
  275. },
  276. }
  277. </script>
  278. <style scoped lang="scss">
  279. .page__view {
  280. width: 100vw;
  281. min-height: 100vh;
  282. background: linear-gradient(#DAF3FF, #F3F3F3 500rpx, #F3F3F3);
  283. position: relative;
  284. /deep/ .nav-bar__view {
  285. position: fixed;
  286. top: 0;
  287. left: 0;
  288. }
  289. }
  290. .main {
  291. width: 100vw;
  292. padding: calc(var(--status-bar-height) + 120rpx) 0 198rpx 0;
  293. box-sizing: border-box;
  294. }
  295. .swiper {
  296. /deep/ .uv-swiper-indicator__wrapper__dot,
  297. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  298. width: 30rpx;
  299. }
  300. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  301. background: linear-gradient(to right, #21FEEC, #019AF9);
  302. }
  303. }
  304. .summary {
  305. width: 100%;
  306. padding: 40rpx 32rpx;
  307. box-sizing: border-box;
  308. }
  309. .card {
  310. width: 100%;
  311. padding: 32rpx;
  312. box-sizing: border-box;
  313. background: #FFFFFF;
  314. border-radius: 24rpx;
  315. & + & {
  316. margin-top: 40rpx;
  317. }
  318. &-header {
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. font-size: 32rpx;
  322. line-height: 1.4;
  323. color: #181818;
  324. }
  325. &-content {
  326. margin-top: 16rpx;
  327. }
  328. &.info {
  329. .desc {
  330. font-size: 26rpx;
  331. color: #8B8B8B;
  332. }
  333. .tags {
  334. margin-top: 16rpx;
  335. justify-content: flex-start;
  336. flex-wrap: wrap;
  337. gap: 16rpx;
  338. .tag {
  339. padding: 2rpx 14rpx;
  340. font-family: PingFang SC;
  341. font-weight: 400;
  342. font-size: 24rpx;
  343. line-height: 1.4;
  344. color: #00A9FF;
  345. background: #E9F8FF;
  346. border: 2rpx solid #00A9FF;
  347. border-radius: 8rpx;
  348. }
  349. }
  350. .data {
  351. margin-top: 16rpx;
  352. justify-content: space-between;
  353. }
  354. .price {
  355. justify-content: flex-start;
  356. align-items: baseline;
  357. column-gap: 6rpx;
  358. &-val {
  359. font-size: 24rpx;
  360. font-weight: 500;
  361. color: #FF4800;
  362. .highlight {
  363. font-size: 48rpx;
  364. }
  365. }
  366. &-bef {
  367. text-decoration: line-through;
  368. font-size: 24rpx;
  369. color: #8B8B8B;
  370. }
  371. }
  372. .registered {
  373. padding: 2rpx 10rpx;
  374. font-weight: 500;
  375. font-size: 30rpx;
  376. color: #FF4800;
  377. border: 2rpx solid #FF4800;
  378. border-radius: 4rpx;
  379. }
  380. }
  381. &.comment {
  382. .card-header {
  383. justify-content: space-between;
  384. }
  385. .btn {
  386. column-gap: 4rpx;
  387. font-size: 24rpx;
  388. color: #8B8B8B;
  389. .img {
  390. width: 32rpx;
  391. height: auto;
  392. }
  393. }
  394. }
  395. }
  396. .detail {
  397. font-size: 0;
  398. }
  399. .bottom {
  400. position: fixed;
  401. left: 0;
  402. bottom: 0;
  403. z-index: 999;
  404. justify-content: space-between;
  405. column-gap: 16rpx;
  406. width: 100vw;
  407. // height: 198rpx;
  408. padding: 24rpx 40rpx 0 40rpx;
  409. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  410. background: #FFFFFF;
  411. box-sizing: border-box;
  412. .btn-simple {
  413. border: none;
  414. font-family: PingFang SC;
  415. font-weight: 400;
  416. font-size: 22rpx;
  417. line-height: 1.1;
  418. color: #999999;
  419. .icon {
  420. width: 52rpx;
  421. height: auto;
  422. margin-bottom: 4rpx;
  423. }
  424. }
  425. .operate {
  426. justify-content: flex-end;
  427. column-gap: 16rpx;
  428. .btn {
  429. font-size: 36rpx;
  430. font-weight: 500;
  431. border-radius: 41rpx;
  432. line-height: 1.4;
  433. &-palin {
  434. padding: 14rpx 46rpx;
  435. color: #252545;
  436. border: 2rpx solid #252545;
  437. }
  438. &-primary {
  439. padding: 14rpx 62rpx;
  440. color: #FFFFFF;
  441. background: linear-gradient(to right, #21FEEC, #019AF9);
  442. border: 2rpx solid #00A9FF;
  443. }
  444. }
  445. }
  446. }
  447. </style>