金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.9 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="确认报名" :showIcon="true"></lf-nav>
  4. <view class="content">
  5. <view class="title">联系人信息</view>
  6. <view class="list">
  7. <view class="label">姓名</view>
  8. <input v-model="name" class="input" placeholder="请输入您的姓名" />
  9. </view>
  10. <view class="list">
  11. <view class="label">手机号</view>
  12. <input v-model="phone" class="input" placeholder="请输入您的手机号" maxlength="11" />
  13. </view>
  14. </view>
  15. <view class="fixed-btn" hover-class="lf-opacity" @click="confirm">确认报名免费</view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data(){
  21. return {
  22. name: '',
  23. phone: '',
  24. activity_id: 0
  25. }
  26. },
  27. onLoad(e){
  28. this.activity_id = e.activity_id;
  29. console.log('接受的id',this.activity_id)
  30. },
  31. methods: {
  32. confirm(){
  33. if(!this.name || !this.phone) return this.$msg('请将信息补充完整');
  34. this.$http
  35. .post({
  36. api: 'api/activity/apply',
  37. data: {
  38. activity_id: this.activity_id,
  39. name: this.name,
  40. phone: this.phone
  41. },
  42. header: {
  43. Authorization: this.$cookieStorage.get('user_token')
  44. },
  45. })
  46. .then(res => {
  47. if (res.data.code == 200) {
  48. if (res.data.status) {
  49. this.$msg('报名成功').then(() => {
  50. this.$toBack();
  51. })
  52. } else {
  53. wx.showModal({
  54. content: res.data.message || '人数爆满,请稍后重试!',
  55. showCancel: false,
  56. success: (res) => {
  57. this.$toBack();
  58. }
  59. });
  60. }
  61. } else {
  62. wx.showModal({
  63. content: res.data.message || '人数爆满,请稍后重试!',
  64. showCancel: false,
  65. success: (res) => {
  66. this.$toBack();
  67. }
  68. });
  69. }
  70. wx.hideLoading();
  71. })
  72. .catch(() => {
  73. wx.hideLoading();
  74. wx.showModal({
  75. content: '请求失败',
  76. showCancel: false
  77. });
  78. });
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped="scoped">
  84. .content{
  85. width: 750rpx;
  86. height: max-content;
  87. padding: 40rpx 32rpx;
  88. box-sizing: border-box;
  89. .title{
  90. font-size: 32rpx;
  91. color: #222222;
  92. font-weight: bold;
  93. margin-bottom: 20rpx;
  94. }
  95. .list{
  96. width: 100%;
  97. height: 100rpx;
  98. border-bottom: 1rpx solid #e5e5e5;
  99. display: flex;
  100. align-items: center;
  101. margin-top: 10rpx;
  102. .label{
  103. width: 130rpx;
  104. font-size: 28rpx;
  105. color: #777777;
  106. }
  107. .input{
  108. width: 554rpx;
  109. font-size: 28rpx;
  110. }
  111. }
  112. }
  113. .fixed-btn{
  114. position: fixed;
  115. bottom: 10vh;
  116. left: calc(50% - 275rpx);
  117. width: 550rpx;
  118. height: 100rpx;
  119. background-color: #15716E;
  120. color: #FFFFFF;
  121. text-align: center;
  122. line-height: 100rpx;
  123. font-size: 32rpx;
  124. border-radius: 50rpx;
  125. }
  126. </style>