index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="signUp">
  3. <template v-if="info.activityType != 1">
  4. <image class="good-img" :src="info.activityMain" mode="aspectFit"></image>
  5. <view class="goods-info">
  6. <view class="goods-name">
  7. {{info.activityName}}
  8. </view>
  9. <view class="price-box" v-if="info.activityEnable == 1">
  10. <view class="left">
  11. <view class="unit">
  12. </view>
  13. <view class="price">
  14. {{info.price}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="list">
  20. <view class="item">
  21. <view class="label">
  22. 活动时间
  23. </view>
  24. <view class="value">
  25. {{info.activityStartTime}} 至 {{info.activityEndTime}}
  26. </view>
  27. </view>
  28. <view class="item" v-if="info.activityEnable == 1">
  29. <view class="label">
  30. 报名时间
  31. </view>
  32. <view class="value">
  33. {{info.signupStartTime}} 至 {{info.signupEndTime}}
  34. </view>
  35. </view>
  36. <view class="item" v-if="info.address">
  37. <view class="label">
  38. 活动地址
  39. </view>
  40. <view class="value">
  41. {{info.address}}
  42. </view>
  43. </view>
  44. </view>
  45. <view class="sub-title">
  46. 活动详情
  47. </view>
  48. </template>
  49. <view class="desc-box">
  50. <rich-text class="goods-desc" :nodes="info.activityDetail"></rich-text>
  51. </view>
  52. <view class="buy-box" v-if="info.activityEnable == 1&&!isEnd">
  53. <button class="buy-btn" type="default" @click="handleSignUp">报名</button>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {getActivityDetail} from '@/api/activity.js'
  59. export default {
  60. data() {
  61. return {
  62. id:0,
  63. info: {},
  64. isEnd:false
  65. }
  66. },
  67. methods: {
  68. handleSignUp(){
  69. let that = this
  70. let {activityStartTime,activityEndTime,limited,activityName,id,price,shopId} = this.info
  71. let obj = {
  72. activityStartTime,
  73. activityEndTime,
  74. limited,
  75. activityName,
  76. id,
  77. price,
  78. shopId
  79. }
  80. if (uni.getStorageSync('token')) {
  81. uni.setStorageSync('activity',JSON.stringify(obj) )
  82. uni.navigateTo({
  83. url:'/signUp/makeOut?id='+this.info.dataCollectId
  84. })
  85. } else {
  86. uni.showModal({
  87. title:'请登录',
  88. confirmText:'去登录',
  89. success(res){
  90. console.log(res);
  91. if(res.confirm){
  92. uni.navigateTo({
  93. url:`/login/login/login?redirect=/signUp/index&scene=${that.id}`
  94. })
  95. }
  96. }
  97. })
  98. }
  99. },
  100. getActivityDetail(id){
  101. getActivityDetail({id}).then(res=>{
  102. if (res.state == 'Success') {
  103. this.info = res.content
  104. this.info.activityDetail = res.content.activityDetail.replace(/<img/gi, '<img class="img_class" ')
  105. uni.setNavigationBarTitle({
  106. title:this.info.activityName
  107. })
  108. if(new Date(this.info.activityEndTime).getTime()< new Date().getTime() ){//活动结束
  109. this.isEnd = true
  110. }
  111. }
  112. })
  113. }
  114. },
  115. onLoad(options) {
  116. this.id = decodeURIComponent(options.scene)
  117. this.getActivityDetail(this.id)
  118. },
  119. onShareTimeline() {
  120. return {
  121. title: "慧研学惠生活-"+this.info.activityName,
  122. query: "scene="+this.id,
  123. };
  124. },
  125. onShareAppMessage() {
  126. return {
  127. title: "慧研学惠生活-"+this.info.activityName,
  128. path: "/signUp/index?scene="+this.id,
  129. };
  130. },
  131. }
  132. </script>
  133. <style lang="scss" >
  134. .signUp{
  135. background: #F9F9F9;
  136. padding-bottom: 200rpx;
  137. min-height: 100vh;
  138. .good-img{
  139. width: 100%;
  140. height: 750rpx;
  141. vertical-align: bottom;
  142. }
  143. .goods-info{
  144. padding: 24rpx;
  145. margin-bottom: 20rpx;
  146. background: #fff;
  147. .price-box{
  148. display: flex;
  149. justify-content: space-between;
  150. align-items: center;
  151. margin-top: 20rpx;
  152. .left{
  153. display: flex;
  154. align-items: flex-end;
  155. .unit{
  156. font-size: 20rpx;
  157. color: $uni-color-primary;
  158. font-weight: bold;
  159. }
  160. .price{
  161. font-size: 36rpx;
  162. color: $uni-color-primary;
  163. font-weight: bold;
  164. }
  165. }
  166. }
  167. .goods-name{
  168. font-size: 32rpx;
  169. color: #222222;
  170. font-weight: bold;
  171. }
  172. }
  173. .sub-title{
  174. font-weight: 600;
  175. font-size: 28rpx;
  176. color: #222222;
  177. padding: 24rpx;
  178. border-radius: 16rpx 16rpx 0 0;
  179. background: #fff;
  180. }
  181. .desc-box{
  182. .goods-desc{
  183. color: #222222;
  184. font-size: 24rpx;
  185. .img_class{
  186. max-width: 100%!important;
  187. vertical-align: bottom;
  188. }
  189. }
  190. }
  191. .list{
  192. background: #fff;
  193. margin-bottom: 20rpx;
  194. .item{
  195. padding: 24rpx;
  196. border-top:1rpx solid #F0F0F0;
  197. .label{
  198. font-weight: 600;
  199. font-size: 28rpx;
  200. color: #222222;
  201. }
  202. .value{
  203. font-weight: 300;
  204. font-size: 24rpx;
  205. color: #AAAAAA;
  206. margin-top: 16rpx;
  207. line-height: 40rpx;
  208. }
  209. }
  210. }
  211. .buy-box{
  212. position: fixed;
  213. bottom: 0%;
  214. left: 0%;
  215. width: 100%;
  216. background: #fff;
  217. padding: 10rpx 24rpx env(safe-area-inset-bottom);
  218. border-top: 1rpx solid #EEEEEE;
  219. box-sizing: border-box;
  220. .buy-btn{
  221. width: 702rpx;
  222. height: 80rpx;
  223. line-height: 80rpx;
  224. text-align: center;
  225. background: $uni-color-primary;
  226. border-radius: 40rpx;
  227. font-weight: 600;
  228. font-size: 28rpx;
  229. color: #FFFFFF;
  230. }
  231. }
  232. }
  233. </style>