鸿宇研学生前端代码
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.

504 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. this.$utils.navigateTo(`/pages_order/comment/commentRecordsOfProduct?productId=${this.id}`)
  268. },
  269. //点击tab栏
  270. clickTabs({ index }) {
  271. this.current = index
  272. },
  273. },
  274. }
  275. </script>
  276. <style scoped lang="scss">
  277. .page__view {
  278. width: 100vw;
  279. min-height: 100vh;
  280. background: linear-gradient(#DAF3FF, #F3F3F3 500rpx, #F3F3F3);
  281. position: relative;
  282. /deep/ .nav-bar__view {
  283. position: fixed;
  284. top: 0;
  285. left: 0;
  286. }
  287. }
  288. .main {
  289. width: 100vw;
  290. padding: calc(var(--status-bar-height) + 120rpx) 0 198rpx 0;
  291. box-sizing: border-box;
  292. }
  293. .swiper {
  294. /deep/ .uv-swiper-indicator__wrapper__dot,
  295. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  296. width: 30rpx;
  297. }
  298. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  299. background: linear-gradient(to right, #21FEEC, #019AF9);
  300. }
  301. }
  302. .summary {
  303. width: 100%;
  304. padding: 40rpx 32rpx;
  305. box-sizing: border-box;
  306. }
  307. .card {
  308. width: 100%;
  309. padding: 32rpx;
  310. box-sizing: border-box;
  311. background: #FFFFFF;
  312. border-radius: 24rpx;
  313. & + & {
  314. margin-top: 40rpx;
  315. }
  316. &-header {
  317. font-family: PingFang SC;
  318. font-weight: 500;
  319. font-size: 32rpx;
  320. line-height: 1.4;
  321. color: #181818;
  322. }
  323. &-content {
  324. margin-top: 16rpx;
  325. }
  326. &.info {
  327. .desc {
  328. font-size: 26rpx;
  329. color: #8B8B8B;
  330. }
  331. .tags {
  332. margin-top: 16rpx;
  333. justify-content: flex-start;
  334. flex-wrap: wrap;
  335. gap: 16rpx;
  336. .tag {
  337. padding: 2rpx 14rpx;
  338. font-family: PingFang SC;
  339. font-weight: 400;
  340. font-size: 24rpx;
  341. line-height: 1.4;
  342. color: #00A9FF;
  343. background: #E9F8FF;
  344. border: 2rpx solid #00A9FF;
  345. border-radius: 8rpx;
  346. }
  347. }
  348. .data {
  349. margin-top: 16rpx;
  350. justify-content: space-between;
  351. }
  352. .price {
  353. justify-content: flex-start;
  354. align-items: baseline;
  355. column-gap: 6rpx;
  356. &-val {
  357. font-size: 24rpx;
  358. font-weight: 500;
  359. color: #FF4800;
  360. .highlight {
  361. font-size: 48rpx;
  362. }
  363. }
  364. &-bef {
  365. text-decoration: line-through;
  366. font-size: 24rpx;
  367. color: #8B8B8B;
  368. }
  369. }
  370. .registered {
  371. padding: 2rpx 10rpx;
  372. font-weight: 500;
  373. font-size: 30rpx;
  374. color: #FF4800;
  375. border: 2rpx solid #FF4800;
  376. border-radius: 4rpx;
  377. }
  378. }
  379. &.comment {
  380. .card-header {
  381. justify-content: space-between;
  382. }
  383. .btn {
  384. column-gap: 4rpx;
  385. font-size: 24rpx;
  386. color: #8B8B8B;
  387. .img {
  388. width: 32rpx;
  389. height: auto;
  390. }
  391. }
  392. }
  393. }
  394. .detail {
  395. font-size: 0;
  396. }
  397. .bottom {
  398. position: fixed;
  399. left: 0;
  400. bottom: 0;
  401. z-index: 999;
  402. justify-content: space-between;
  403. column-gap: 16rpx;
  404. width: 100vw;
  405. // height: 198rpx;
  406. padding: 24rpx 40rpx 0 40rpx;
  407. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  408. background: #FFFFFF;
  409. box-sizing: border-box;
  410. .btn-simple {
  411. border: none;
  412. font-family: PingFang SC;
  413. font-weight: 400;
  414. font-size: 22rpx;
  415. line-height: 1.1;
  416. color: #999999;
  417. .icon {
  418. width: 52rpx;
  419. height: auto;
  420. margin-bottom: 4rpx;
  421. }
  422. }
  423. .operate {
  424. justify-content: flex-end;
  425. column-gap: 16rpx;
  426. .btn {
  427. font-size: 36rpx;
  428. font-weight: 500;
  429. border-radius: 41rpx;
  430. line-height: 1.4;
  431. &-palin {
  432. padding: 14rpx 46rpx;
  433. color: #252545;
  434. border: 2rpx solid #252545;
  435. }
  436. &-primary {
  437. padding: 14rpx 62rpx;
  438. color: #FFFFFF;
  439. background: linear-gradient(to right, #21FEEC, #019AF9);
  440. border: 2rpx solid #00A9FF;
  441. }
  442. }
  443. }
  444. }
  445. </style>