index.vue 4.6 KB

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