activitySave.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view style="height: 100%; background: #F8F9FA;">
  3. <view class="huodong-ccontent" >
  4. <view style=" height:144rpx;width:224rpx">
  5. <van-image
  6. height="144rpx"
  7. :src="activityInfo.pic"
  8. width="224rpx"
  9. />
  10. </view>
  11. <view class="activity-content">
  12. <view class="activity-title">{{activityInfo.name}}</view>
  13. <view class="activity-date">
  14. <span >{{activityInfo.start_time}}</span>
  15. </view>
  16. <view class="activity-price">
  17. <span ><span style="font-size: 32rpx;color: #C29556">¥{{activityInfo.fee}}</span></span>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="activity-content-title">
  22. 活动介绍
  23. </view>
  24. <van-cell-group>
  25. <van-field
  26. v-model="formData.username"
  27. label="姓名"
  28. placeholder="请填写联系人姓名"
  29. input-align="right"
  30. @input="val => formData.username = val.detail"
  31. />
  32. <van-field
  33. v-model="formData.mobile"
  34. label="联系电话"
  35. type="number"
  36. placeholder="请填写电话号码"
  37. input-align="right"
  38. @input="val => formData.mobile = val.detail"
  39. />
  40. <van-cell title="报名人数" >
  41. <template #default>
  42. <van-stepper v-model="formData.num" @change="onChangeStepper"/>
  43. </template>
  44. </van-cell>
  45. </van-cell-group>
  46. <van-toast id="van-toast"/>
  47. <view class="bottom-navigation">
  48. <view class="bottom-navigation-div">
  49. 应付款: <span>¥<span style="font-size: 40rpx;">{{ activityInfo.fee * formData.num}}</span></span>
  50. </view>
  51. <button class="activity-button" @click="handleRegister">立即报名</button>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import tabbarCom from "@/components/tabbar/tabbar.vue";
  57. import Toast from "../../wxcomponents/vant/dist/toast/toast";
  58. import {getActivityDetail} from "../../common/api/activity";
  59. export default {
  60. components: {
  61. tabbarCom,
  62. },
  63. data() {
  64. return {
  65. data: [],
  66. activityId: 0,
  67. activityInfo:{},
  68. formData:{
  69. mobile:"",
  70. username:'',
  71. num:1,
  72. }
  73. };
  74. },
  75. onLoad: function (option) {
  76. this.activityId = option.activityId
  77. this.getActivityDetail()
  78. },
  79. onShow() {
  80. this.$nextTick(() => {
  81. });
  82. },
  83. onReachBottom() {
  84. },
  85. onShareAppMessage(res) {
  86. let params = {};
  87. params = {
  88. activityId: this.activityId
  89. };
  90. let configs = uni.getStorageSync('configs') || {};
  91. return {
  92. title: configs.shop_share_title,
  93. imageUrl: configs.shop_share_img,
  94. path: `/subPages/activityDetail/activityDetail${this.$stringPageOptions(params)}`
  95. };
  96. },
  97. onShareTimeline(res) {
  98. let params = {};
  99. params = {
  100. activityId: this.activityId
  101. };
  102. let configs = uni.getStorageSync('configs') || {};
  103. return {
  104. title: configs.shop_share_title,
  105. imageUrl: configs.shop_share_img,
  106. path: `/subPages/activityDetail/activityDetail${this.$stringPageOptions(params)}`
  107. };
  108. },
  109. computed: {},
  110. watch: {},
  111. methods: {
  112. getActivityDetail() {
  113. getActivityDetail({id: this.activityId}).then(({data}) => {
  114. this.activityInfo = data
  115. console.log(this.activityId)
  116. console.log(data)
  117. });
  118. },
  119. handleRegister() {
  120. if (!this.formData.username){
  121. Toast('请输入姓名');
  122. }
  123. if (!this.formData.mobile){
  124. Toast('请输入手机号');
  125. }
  126. },
  127. onChangeStepper(event){
  128. this.formData.num=event.detail
  129. }
  130. },
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. .common-page {
  135. height: 100%;
  136. padding: 30rpx;
  137. }
  138. .bottom-navigation{
  139. position: fixed;
  140. // 文字垂直居中
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. bottom: 0;
  145. height: 100rpx;
  146. width: calc(100% - 40rpx);
  147. background: #FFFFFF;
  148. box-shadow: 0rpx -2rpx 0rpx 0rpx #F1F3F6;
  149. border-radius: 24rpx 24rpx 0rpx 0rpx;
  150. border: 0rpx solid #979797;
  151. padding: 20rpx 20rpx 68rpx 20rpx ;
  152. &-div{
  153. height: 76rpx;
  154. width: 404rpx;
  155. // 文字垂直居中
  156. font-family: PingFang SC, PingFang SC;
  157. font-weight: 400;
  158. font-size: 28rpx;
  159. color: #333333;
  160. line-height: 40rpx;
  161. text-align: left;
  162. font-style: normal;
  163. text-transform: none;
  164. display: flex;
  165. align-items: center;
  166. span{
  167. font-family: PingFang SC, PingFang SC;
  168. font-weight: 400;
  169. font-size: 24rpx;
  170. color: #C29556;
  171. line-height: 32rpx;
  172. text-align: left;
  173. font-style: normal;
  174. text-transform: none;
  175. }
  176. }
  177. .activity-button {
  178. width: 264rpx;
  179. height: 80rpx;
  180. background: linear-gradient(315deg, #CA9359 0%, #E2B98E 100%);
  181. border-radius: 292rpx 292rpx 292rpx 292rpx;
  182. font-family: PingFang SC, PingFang SC;
  183. font-weight: 400;
  184. font-size: 28rpx;
  185. color: #FFFFFF;
  186. line-height: 36rpx;
  187. text-align: center;
  188. font-style: normal;
  189. text-transform: none;
  190. // 文字垂直居中
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. }
  195. }
  196. .activity-content-title {
  197. margin: 30rpx auto;
  198. width: 680rpx;
  199. // 垂直居中
  200. font-family: PingFang SC, PingFang SC;
  201. font-weight: 400;
  202. font-size: 32rpx;
  203. color: #333333;
  204. line-height: 40rpx;
  205. text-align: left;
  206. font-style: normal;
  207. text-transform: none;
  208. }
  209. .huodong-ccontent {
  210. position: relative; /* 相对定位 */
  211. width: 650rpx;
  212. padding: 0rpx;
  213. margin: 30rpx auto;
  214. margin-bottom: 0;
  215. padding: 30rpx;
  216. background: #FFFFFF;
  217. border-radius: 16rpx 16rpx 16rpx 16rpx;
  218. display: flex;
  219. align-items: center;
  220. .activity-content {
  221. margin: 30rpx 0rpx 0rpx 30rpx;
  222. .activity-title {
  223. font-family: PingFang SC, PingFang SC;
  224. font-weight: 400;
  225. font-size: 28rpx;
  226. color: #333333;
  227. line-height: 40rpx;
  228. text-align: left;
  229. font-style: normal;
  230. text-transform: none;
  231. font-weight: bold;
  232. margin-bottom: 10rpx;
  233. }
  234. .activity-date {
  235. font-weight: 400;
  236. font-size: 24rpx;
  237. color: #666666;
  238. line-height: 36rpx;
  239. text-align: left;
  240. font-style: normal;
  241. text-transform: none;
  242. margin-bottom: 10rpx;
  243. display: flex;
  244. align-items: center;
  245. }
  246. .activity-price {
  247. height: 44rpx;
  248. font-weight: 400;
  249. font-size: 22rpx;
  250. color: #666666;
  251. line-height: 40rpx;
  252. text-align: left;
  253. font-style: normal;
  254. text-transform: none;
  255. margin-bottom: 24rpx;
  256. display: flex;
  257. align-items: center;
  258. }
  259. }
  260. }
  261. </style>