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

500 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. <timeOptionsSelect v-model="selectTime" :options="detail.dateList"></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. tagList() {
  136. // todo: check key
  137. const { tagDetails } = this.detail || {}
  138. return tagDetails?.length ? tagDetails.split('、') : []
  139. },
  140. priceInt() {
  141. return Math.floor(this.detail.priceDiscount)
  142. },
  143. priceFrac() {
  144. let frac = this.detail.priceDiscount % this.priceInt
  145. return frac > 0 ? frac.toFixed(2).slice(1) : ''
  146. },
  147. displayContent() {
  148. const {
  149. special,
  150. target,
  151. process,
  152. } = this.detail
  153. if (this.current == 0) {
  154. return special
  155. } else if (this.current == 1) {
  156. return target
  157. } else if (this.current == 2) {
  158. return process
  159. }
  160. return ''
  161. }
  162. },
  163. onLoad(arg) {
  164. const { id } = arg
  165. this.id = id
  166. this.fetchDetail(id)
  167. this.fetchComment(id)
  168. },
  169. methods: {
  170. async fetchDetail(activityId) {
  171. try {
  172. const result = await this.$fetch('queryActivityById', { activityId })
  173. // todo: init options
  174. this.detail = result
  175. } catch (err) {
  176. }
  177. return
  178. // todo: delete
  179. this.detail = {
  180. id: '001',
  181. image: new Array(6).fill('/static/image/temp-20.png').join(','),
  182. title: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  183. brief: '每天车程4小时内,含一程高铁丨喀拉峻草原、夏塔古道、昭苏天马、赛里木湖、昭苏油菜花、伊犁薰衣草丨吐鲁番坎儿井&火焰山',
  184. tagDetails: ['坝上草原', '自然探索', '户外探索', '亲子游玩'],
  185. priceDiscount: 688.99,
  186. priceOrigin: 1200,
  187. applyNum: 4168,
  188. timeOptions: [
  189. {
  190. id: '0011',
  191. startDate: '08/25',
  192. endDate: '09/01',
  193. priceDiscount: 1200.99,
  194. priceOrigin: 2300,
  195. adultsPrice: 2400,
  196. teenagerPrice: 1800,
  197. childPrice: 1200.99,
  198. },
  199. {
  200. id: '0012',
  201. startDate: '09/02',
  202. endDate: '09/11',
  203. priceDiscount: 1200.99,
  204. priceOrigin: 2300,
  205. adultsPrice: 2400,
  206. teenagerPrice: 1800,
  207. childPrice: 1200.99,
  208. },
  209. {
  210. id: '0013',
  211. startDate: '09/12',
  212. endDate: '09/19',
  213. priceDiscount: 1200.99,
  214. priceOrigin: 2300,
  215. adultsPrice: 2400,
  216. teenagerPrice: 1800,
  217. childPrice: 1200.99,
  218. },
  219. ],
  220. special: `
  221. <p style="font-size: 36rpx;">
  222. 行程亮点
  223. </p>
  224. `,
  225. target: `
  226. <p style="font-size: 36rpx;">
  227. 课程目标
  228. <p>
  229. `,
  230. process: `
  231. <p style="font-size: 36rpx;">
  232. 详细行程
  233. <p>
  234. `,
  235. }
  236. },
  237. async fetchComment(id) {
  238. // todo: fetch by activity id
  239. this.commentList = [
  240. {
  241. avatar: '/pages_order/static/temp-30.png',
  242. name: '战斗世界',
  243. createTime: '2025-07-12',
  244. content: '凌玉姐姐很温柔很耐心很负责我很喜欢她龙哥知识渊博很幽默给我们讲解很多内容行程很有趣我学到了很多东西最难忘的就是库木塔格沙漠我们爬到了很高的顶端看夕阳绝美还有我也很喜欢夏塔古道我们爬到了第四个卡拉房子的最远端看到了壮观的雪山下次还想参加活动去南疆',
  245. image: '/pages_order/static/temp-38.png',
  246. },
  247. {
  248. avatar: '/pages_order/static/temp-30.png',
  249. name: '战斗世界',
  250. createTime: '2025-07-12',
  251. content: '凌玉姐姐很温柔很耐心很负责我很喜欢她龙哥知识渊博很幽默给我们讲解很多内容行程很有趣我学到了很多东西最难忘的就是库木塔格沙漠我们爬到了很高的顶端看夕阳绝美还有我也很喜欢夏塔古道我们爬到了第四个卡拉房子的最远端看到了壮观的雪山下次还想参加活动去南疆',
  252. image: '/pages_order/static/temp-38.png',
  253. },
  254. ]
  255. },
  256. onCollect() {
  257. this.$store.dispatch('collect', this.id)
  258. // todo: set collectd and change btn to cancel collect?
  259. },
  260. onBuy() {
  261. this.$refs.orderInfoPopup.open({ selectTime: this.selectTime })
  262. },
  263. jumpToCommentRecords() {
  264. this.$utils.navigateTo(`/pages_order/comment/commentRecordsOfProduct?productId=${this.id}`)
  265. },
  266. //点击tab栏
  267. clickTabs({ index }) {
  268. this.current = index
  269. },
  270. },
  271. }
  272. </script>
  273. <style scoped lang="scss">
  274. .page__view {
  275. width: 100vw;
  276. min-height: 100vh;
  277. background: linear-gradient(#DAF3FF, #F3F3F3 500rpx, #F3F3F3);
  278. position: relative;
  279. }
  280. .main {
  281. width: 100vw;
  282. // padding: calc(var(--status-bar-height) + 120rpx) 0 198rpx 0;
  283. padding-bottom: 198rpx;
  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. white-space: pre-wrap;
  323. color: #8B8B8B;
  324. }
  325. .tags {
  326. margin-top: 16rpx;
  327. justify-content: flex-start;
  328. flex-wrap: wrap;
  329. gap: 16rpx;
  330. .tag {
  331. padding: 2rpx 14rpx;
  332. font-family: PingFang SC;
  333. font-weight: 400;
  334. font-size: 24rpx;
  335. line-height: 1.4;
  336. color: #00A9FF;
  337. background: #E9F8FF;
  338. border: 2rpx solid #00A9FF;
  339. border-radius: 8rpx;
  340. }
  341. }
  342. .data {
  343. margin-top: 16rpx;
  344. justify-content: space-between;
  345. }
  346. .price {
  347. justify-content: flex-start;
  348. align-items: baseline;
  349. column-gap: 6rpx;
  350. &-val {
  351. font-size: 24rpx;
  352. font-weight: 500;
  353. color: #FF4800;
  354. .highlight {
  355. font-size: 48rpx;
  356. }
  357. }
  358. &-bef {
  359. text-decoration: line-through;
  360. font-size: 24rpx;
  361. color: #8B8B8B;
  362. }
  363. }
  364. .registered {
  365. padding: 2rpx 10rpx;
  366. font-weight: 500;
  367. font-size: 30rpx;
  368. color: #FF4800;
  369. border: 2rpx solid #FF4800;
  370. border-radius: 4rpx;
  371. }
  372. }
  373. &.comment {
  374. .card-header {
  375. justify-content: space-between;
  376. }
  377. .btn {
  378. column-gap: 4rpx;
  379. font-size: 24rpx;
  380. color: #8B8B8B;
  381. .img {
  382. width: 32rpx;
  383. height: auto;
  384. }
  385. }
  386. }
  387. }
  388. .detail {
  389. font-size: 0;
  390. }
  391. .bottom {
  392. position: fixed;
  393. left: 0;
  394. bottom: 0;
  395. z-index: 999;
  396. justify-content: space-between;
  397. column-gap: 16rpx;
  398. width: 100vw;
  399. // height: 198rpx;
  400. padding: 24rpx 40rpx 0 40rpx;
  401. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  402. background: #FFFFFF;
  403. box-sizing: border-box;
  404. .btn-simple {
  405. border: none;
  406. font-family: PingFang SC;
  407. font-weight: 400;
  408. font-size: 22rpx;
  409. line-height: 1.1;
  410. color: #999999;
  411. .icon {
  412. width: 52rpx;
  413. height: auto;
  414. margin-bottom: 4rpx;
  415. }
  416. }
  417. .operate {
  418. justify-content: flex-end;
  419. column-gap: 16rpx;
  420. .btn {
  421. font-size: 36rpx;
  422. font-weight: 500;
  423. border-radius: 41rpx;
  424. line-height: 1.4;
  425. &-palin {
  426. padding: 14rpx 46rpx;
  427. color: #252545;
  428. border: 2rpx solid #252545;
  429. }
  430. &-primary {
  431. padding: 14rpx 62rpx;
  432. color: #FFFFFF;
  433. background: linear-gradient(to right, #21FEEC, #019AF9);
  434. border: 2rpx solid #00A9FF;
  435. }
  436. }
  437. }
  438. }
  439. </style>