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

501 lines
13 KiB

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