index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
  82. uni.setStorageSync('activity',JSON.stringify(obj) )
  83. uni.navigateTo({
  84. url:'/signUp/makeOut?id='+this.info.dataCollectId
  85. })
  86. }else{
  87. uni.showModal({
  88. title:'此商品需要开通会员才能购买',
  89. cancelText:'下次再说',
  90. confirmText:'立即开通',
  91. success(res) {
  92. if(res.confirm){
  93. uni.navigateTo({
  94. url:'/my/memberCenter/index'
  95. })
  96. }
  97. }
  98. })
  99. }
  100. } else {
  101. uni.showModal({
  102. title:'请登录',
  103. confirmText:'去登录',
  104. success(res){
  105. console.log(res);
  106. if(res.confirm){
  107. uni.navigateTo({
  108. url:`/login/login/login?redirect=/signUp/index&scene=${that.id}`
  109. })
  110. }
  111. }
  112. })
  113. }
  114. },
  115. getActivityDetail(id){
  116. getActivityDetail({id}).then(res=>{
  117. if (res.state == 'Success') {
  118. this.info = res.content
  119. this.info.activityDetail = res.content.activityDetail.replace(/<img/gi, '<img class="img_class" ')
  120. uni.setNavigationBarTitle({
  121. title:this.info.activityName
  122. })
  123. if(new Date(this.info.activityEndTime).getTime()< new Date().getTime() ){//活动结束
  124. this.isEnd = true
  125. }
  126. }
  127. })
  128. }
  129. },
  130. onLoad(options) {
  131. this.id = decodeURIComponent(options.scene)
  132. this.getActivityDetail(this.id)
  133. },
  134. onShareTimeline() {
  135. return {
  136. title: "慧研学惠生活-"+this.info.activityName,
  137. query: "scene="+this.id,
  138. };
  139. },
  140. onShareAppMessage() {
  141. return {
  142. title: "慧研学惠生活-"+this.info.activityName,
  143. path: "/signUp/index?scene="+this.id,
  144. };
  145. },
  146. }
  147. </script>
  148. <style lang="scss" >
  149. .signUp{
  150. background: #F9F9F9;
  151. padding-bottom: 200rpx;
  152. min-height: 100vh;
  153. .good-img{
  154. width: 100%;
  155. height: 750rpx;
  156. vertical-align: bottom;
  157. }
  158. .goods-info{
  159. padding: 24rpx;
  160. margin-bottom: 20rpx;
  161. background: #fff;
  162. .price-box{
  163. display: flex;
  164. justify-content: space-between;
  165. align-items: center;
  166. margin-top: 20rpx;
  167. .left{
  168. display: flex;
  169. align-items: flex-end;
  170. .unit{
  171. font-size: 20rpx;
  172. color: $uni-color-primary;
  173. font-weight: bold;
  174. }
  175. .price{
  176. font-size: 36rpx;
  177. color: $uni-color-primary;
  178. font-weight: bold;
  179. }
  180. }
  181. }
  182. .goods-name{
  183. font-size: 32rpx;
  184. color: #222222;
  185. font-weight: bold;
  186. }
  187. }
  188. .sub-title{
  189. font-weight: 600;
  190. font-size: 28rpx;
  191. color: #222222;
  192. padding: 24rpx;
  193. border-radius: 16rpx 16rpx 0 0;
  194. background: #fff;
  195. }
  196. .desc-box{
  197. .goods-desc{
  198. color: #222222;
  199. font-size: 24rpx;
  200. .img_class{
  201. max-width: 100%!important;
  202. vertical-align: bottom;
  203. }
  204. }
  205. }
  206. .list{
  207. background: #fff;
  208. margin-bottom: 20rpx;
  209. .item{
  210. padding: 24rpx;
  211. border-top:1rpx solid #F0F0F0;
  212. .label{
  213. font-weight: 600;
  214. font-size: 28rpx;
  215. color: #222222;
  216. }
  217. .value{
  218. font-weight: 300;
  219. font-size: 24rpx;
  220. color: #AAAAAA;
  221. margin-top: 16rpx;
  222. line-height: 40rpx;
  223. }
  224. }
  225. }
  226. .buy-box{
  227. position: fixed;
  228. bottom: 0%;
  229. left: 0%;
  230. width: 100%;
  231. background: #fff;
  232. padding: 10rpx 24rpx env(safe-area-inset-bottom);
  233. border-top: 1rpx solid #EEEEEE;
  234. box-sizing: border-box;
  235. .buy-btn{
  236. width: 702rpx;
  237. height: 80rpx;
  238. line-height: 80rpx;
  239. text-align: center;
  240. background: $uni-color-primary;
  241. border-radius: 40rpx;
  242. font-weight: 600;
  243. font-size: 28rpx;
  244. color: #FFFFFF;
  245. }
  246. }
  247. }
  248. </style>