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

432 lines
10 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">{{ isCollected ? '移除收藏' : '收藏' }}</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. const { tagDetails } = this.detail || {}
  137. return tagDetails?.length ? tagDetails.split('、') : []
  138. },
  139. priceInt() {
  140. return Math.floor(this.detail.priceDiscount)
  141. },
  142. priceFrac() {
  143. let frac = this.detail.priceDiscount % this.priceInt
  144. return frac > 0 ? frac.toFixed(2).slice(1) : ''
  145. },
  146. displayContent() {
  147. const {
  148. special,
  149. target,
  150. process,
  151. } = this.detail
  152. if (this.current == 0) {
  153. return special
  154. } else if (this.current == 1) {
  155. return target
  156. } else if (this.current == 2) {
  157. return process
  158. }
  159. return ''
  160. },
  161. isCollected() {
  162. return this.detail.isCollection == '1'
  163. },
  164. },
  165. onLoad(arg) {
  166. const { id } = arg
  167. this.id = id
  168. this.fetchDetail(id)
  169. this.fetchComment(id)
  170. },
  171. methods: {
  172. async fetchDetail(activityId) {
  173. try {
  174. const result = await this.$fetch('queryActivityById', { activityId })
  175. this.detail = result
  176. } catch (err) {
  177. }
  178. },
  179. async fetchComment(activityId) {
  180. try {
  181. const queryParams = {
  182. pageNo: 1,
  183. pageSize: 2,
  184. activityId,
  185. }
  186. this.commentList = (await this.$fetch('queryCommentList', queryParams, true, null, true))?.records
  187. } catch (err) {
  188. console.log('fetchComment', err)
  189. }
  190. },
  191. async onCollect() {
  192. let succ = await this.$store.dispatch('collect', this.id)
  193. succ && this.fetchDetail(this.id)
  194. },
  195. onBuy() {
  196. this.$refs.orderInfoPopup.open({ selectTime: this.selectTime })
  197. },
  198. jumpToCommentRecords() {
  199. this.$utils.navigateTo(`/pages_order/comment/commentRecordsOfProduct?id=${this.id}`)
  200. },
  201. //点击tab栏
  202. clickTabs({ index }) {
  203. this.current = index
  204. },
  205. },
  206. }
  207. </script>
  208. <style scoped lang="scss">
  209. .page__view {
  210. width: 100vw;
  211. min-height: 100vh;
  212. background: linear-gradient(#DAF3FF, #F3F3F3 500rpx, #F3F3F3);
  213. position: relative;
  214. }
  215. .main {
  216. width: 100vw;
  217. // padding: calc(var(--status-bar-height) + 120rpx) 0 198rpx 0;
  218. padding-bottom: 198rpx;
  219. box-sizing: border-box;
  220. }
  221. .swiper {
  222. /deep/ .uv-swiper-indicator__wrapper__dot,
  223. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  224. width: 30rpx;
  225. }
  226. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  227. background: linear-gradient(to right, #21FEEC, #019AF9);
  228. }
  229. }
  230. .summary {
  231. width: 100%;
  232. padding: 40rpx 32rpx;
  233. box-sizing: border-box;
  234. }
  235. .card {
  236. width: 100%;
  237. padding: 32rpx;
  238. box-sizing: border-box;
  239. background: #FFFFFF;
  240. border-radius: 24rpx;
  241. & + & {
  242. margin-top: 40rpx;
  243. }
  244. &-header {
  245. font-family: PingFang SC;
  246. font-weight: 500;
  247. font-size: 32rpx;
  248. line-height: 1.4;
  249. color: #181818;
  250. }
  251. &-content {
  252. margin-top: 16rpx;
  253. }
  254. &.info {
  255. .desc {
  256. font-size: 26rpx;
  257. white-space: pre-wrap;
  258. color: #8B8B8B;
  259. }
  260. .tags {
  261. margin-top: 16rpx;
  262. justify-content: flex-start;
  263. flex-wrap: wrap;
  264. gap: 16rpx;
  265. .tag {
  266. padding: 2rpx 14rpx;
  267. font-family: PingFang SC;
  268. font-weight: 400;
  269. font-size: 24rpx;
  270. line-height: 1.4;
  271. color: #00A9FF;
  272. background: #E9F8FF;
  273. border: 2rpx solid #00A9FF;
  274. border-radius: 8rpx;
  275. }
  276. }
  277. .data {
  278. margin-top: 16rpx;
  279. justify-content: space-between;
  280. }
  281. .price {
  282. justify-content: flex-start;
  283. align-items: baseline;
  284. column-gap: 6rpx;
  285. &-val {
  286. font-size: 24rpx;
  287. font-weight: 500;
  288. color: #FF4800;
  289. .highlight {
  290. font-size: 48rpx;
  291. }
  292. }
  293. &-bef {
  294. text-decoration: line-through;
  295. font-size: 24rpx;
  296. color: #8B8B8B;
  297. }
  298. }
  299. .registered {
  300. padding: 2rpx 10rpx;
  301. font-weight: 500;
  302. font-size: 30rpx;
  303. color: #FF4800;
  304. border: 2rpx solid #FF4800;
  305. border-radius: 4rpx;
  306. }
  307. }
  308. &.comment {
  309. .card-header {
  310. justify-content: space-between;
  311. }
  312. .btn {
  313. column-gap: 4rpx;
  314. font-size: 24rpx;
  315. color: #8B8B8B;
  316. .img {
  317. width: 32rpx;
  318. height: auto;
  319. }
  320. }
  321. }
  322. }
  323. .detail {
  324. // font-size: 0;
  325. }
  326. .bottom {
  327. position: fixed;
  328. left: 0;
  329. bottom: 0;
  330. z-index: 999;
  331. justify-content: space-between;
  332. column-gap: 16rpx;
  333. width: 100vw;
  334. // height: 198rpx;
  335. padding: 24rpx 40rpx 0 40rpx;
  336. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  337. background: #FFFFFF;
  338. box-sizing: border-box;
  339. .btn-simple {
  340. border: none;
  341. font-family: PingFang SC;
  342. font-weight: 400;
  343. font-size: 22rpx;
  344. line-height: 1.1;
  345. color: #999999;
  346. .icon {
  347. width: 52rpx;
  348. height: auto;
  349. margin-bottom: 4rpx;
  350. }
  351. }
  352. .operate {
  353. justify-content: flex-end;
  354. column-gap: 16rpx;
  355. .btn {
  356. font-size: 36rpx;
  357. font-weight: 500;
  358. border-radius: 41rpx;
  359. line-height: 1.4;
  360. &-palin {
  361. padding: 14rpx 46rpx;
  362. color: #252545;
  363. border: 2rpx solid #252545;
  364. }
  365. &-primary {
  366. padding: 14rpx 62rpx;
  367. color: #FFFFFF;
  368. background: linear-gradient(to right, #21FEEC, #019AF9);
  369. border: 2rpx solid #00A9FF;
  370. }
  371. }
  372. }
  373. }
  374. </style>