金诚优选前端代码
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.

137 lines
3.2 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. clickContinue: true
  26. }
  27. },
  28. onLoad(e){
  29. this.activity_id = e.activity_id;
  30. console.log('接受的id',this.activity_id)
  31. },
  32. methods: {
  33. confirm(){
  34. if(this.clickContinue == true) {
  35. this.clickContinue = false;
  36. if(!this.name || !this.phone) return this.$msg('请将信息补充完整');
  37. this.$http
  38. .post({
  39. api: 'api/activity/apply',
  40. data: {
  41. activity_id: this.activity_id,
  42. name: this.name,
  43. phone: this.phone
  44. },
  45. header: {
  46. Authorization: this.$cookieStorage.get('user_token')
  47. },
  48. })
  49. .then(res => {
  50. if (res.data.code == 200) {
  51. if (res.data.status) {
  52. this.clickContinue = true;
  53. this.$msg('报名成功').then(() => {
  54. this.$toBack();
  55. })
  56. } else {
  57. this.clickContinue = true;
  58. wx.showModal({
  59. content: res.data.message || '人数爆满,请稍后重试!',
  60. showCancel: false,
  61. success: (res) => {
  62. this.$toBack();
  63. }
  64. });
  65. }
  66. } else {
  67. this.clickContinue = true;
  68. wx.showModal({
  69. content: res.data.message || '人数爆满,请稍后重试!',
  70. showCancel: false,
  71. success: (res) => {
  72. this.$toBack();
  73. }
  74. });
  75. }
  76. wx.hideLoading();
  77. })
  78. .catch(() => {
  79. this.clickContinue = true;
  80. wx.hideLoading();
  81. wx.showModal({
  82. content: '请求失败',
  83. showCancel: false
  84. });
  85. });
  86. }
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped="scoped">
  92. .content{
  93. width: 750rpx;
  94. height: max-content;
  95. padding: 40rpx 32rpx;
  96. box-sizing: border-box;
  97. .title{
  98. font-size: 32rpx;
  99. color: #222222;
  100. font-weight: bold;
  101. margin-bottom: 20rpx;
  102. }
  103. .list{
  104. width: 100%;
  105. height: 100rpx;
  106. border-bottom: 1rpx solid #e5e5e5;
  107. display: flex;
  108. align-items: center;
  109. margin-top: 10rpx;
  110. .label{
  111. width: 130rpx;
  112. font-size: 28rpx;
  113. color: #777777;
  114. }
  115. .input{
  116. width: 554rpx;
  117. font-size: 28rpx;
  118. }
  119. }
  120. }
  121. .fixed-btn{
  122. position: fixed;
  123. bottom: 10vh;
  124. left: calc(50% - 275rpx);
  125. width: 550rpx;
  126. height: 100rpx;
  127. background-color: #15716E;
  128. color: #FFFFFF;
  129. text-align: center;
  130. line-height: 100rpx;
  131. font-size: 32rpx;
  132. border-radius: 50rpx;
  133. }
  134. </style>