index.vue 6.3 KB

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