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

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