apply.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <text class="title">成为管家</text>
  5. <text class="subtitle">提交您的管家资质,为更多家庭提供专业服务</text>
  6. </view>
  7. <view class="form">
  8. <view class="form-item">
  9. <text class="label">真实姓名</text>
  10. <input class="input" v-model="formData.realName" placeholder="请输入真实姓名" />
  11. </view>
  12. <view class="form-item">
  13. <text class="label">手机号</text>
  14. <input class="input" v-model="formData.phone" type="number" placeholder="请输入手机号" maxlength="11" />
  15. </view>
  16. <view class="form-item">
  17. <text class="label">管家等级</text>
  18. <picker mode="selector" :range="tiers" range-key="label" @change="onTierChange">
  19. <view class="picker">
  20. <text v-if="formData.tier">{{ getTierLabel(formData.tier) }}</text>
  21. <text v-else class="placeholder">请选择管家等级</text>
  22. <text class="arrow">›</text>
  23. </view>
  24. </picker>
  25. </view>
  26. <view class="form-item">
  27. <text class="label">资质说明</text>
  28. <textarea class="textarea" v-model="formData.description" placeholder="请说明您的管家资质、从业经验等" maxlength="500" />
  29. <text class="counter">{{ formData.description.length }}/500</text>
  30. </view>
  31. <button class="btn-submit" :disabled="submitting" @click="handleSubmit">
  32. {{ submitting ? '提交中...' : '提交申请' }}
  33. </button>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { butlerApply } from '@/utils/api'
  39. export default {
  40. data() {
  41. return {
  42. tiers: [
  43. { value: 'bronze', label: '青铜管家' },
  44. { value: 'silver', label: '白银管家' },
  45. { value: 'gold', label: '黄金管家' },
  46. { value: 'platinum', label: '铂金管家' }
  47. ],
  48. formData: {
  49. realName: '',
  50. phone: '',
  51. tier: '',
  52. description: ''
  53. },
  54. submitting: false
  55. }
  56. },
  57. methods: {
  58. onTierChange(e) {
  59. this.formData.tier = this.tiers[e.detail.value].value
  60. },
  61. getTierLabel(value) {
  62. const item = this.tiers.find(t => t.value === value)
  63. return item ? item.label : value
  64. },
  65. async handleSubmit() {
  66. if (!this.formData.realName) {
  67. uni.showToast({ title: '请输入真实姓名', icon: 'none' })
  68. return
  69. }
  70. if (!this.formData.phone) {
  71. uni.showToast({ title: '请输入手机号', icon: 'none' })
  72. return
  73. }
  74. this.submitting = true
  75. try {
  76. const res = await butlerApply({
  77. tier: this.formData.tier,
  78. description: this.formData.description
  79. })
  80. if (res.code === 200) {
  81. uni.showModal({
  82. title: '申请成功',
  83. content: '您的管家申请已提交,请等待审核',
  84. showCancel: false,
  85. success: () => uni.navigateBack()
  86. })
  87. } else {
  88. uni.showToast({ title: res.message || '提交失败', icon: 'none' })
  89. }
  90. } catch (e) {
  91. uni.showToast({ title: '提交失败', icon: 'none' })
  92. } finally {
  93. this.submitting = false
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style>
  100. .container {
  101. padding: 30rpx;
  102. background: #f8f8f8;
  103. min-height: 100vh;
  104. }
  105. .header {
  106. text-align: center;
  107. padding: 40rpx 0;
  108. }
  109. .title {
  110. font-size: 40rpx;
  111. font-weight: bold;
  112. color: #333;
  113. }
  114. .subtitle {
  115. font-size: 28rpx;
  116. color: #666;
  117. margin-top: 16rpx;
  118. display: block;
  119. }
  120. .form {
  121. background: #fff;
  122. border-radius: 20rpx;
  123. padding: 40rpx;
  124. }
  125. .form-item {
  126. margin-bottom: 40rpx;
  127. }
  128. .label {
  129. font-size: 28rpx;
  130. color: #333;
  131. display: block;
  132. margin-bottom: 20rpx;
  133. font-weight: bold;
  134. }
  135. .input {
  136. width: 100%;
  137. height: 80rpx;
  138. border: 1rpx solid #e0e0e0;
  139. border-radius: 10rpx;
  140. padding: 0 20rpx;
  141. font-size: 28rpx;
  142. box-sizing: border-box;
  143. }
  144. .picker {
  145. width: 100%;
  146. height: 80rpx;
  147. border: 1rpx solid #e0e0e0;
  148. border-radius: 10rpx;
  149. padding: 0 20rpx;
  150. font-size: 28rpx;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. box-sizing: border-box;
  155. }
  156. .placeholder {
  157. color: #999;
  158. }
  159. .arrow {
  160. font-size: 32rpx;
  161. color: #999;
  162. }
  163. .textarea {
  164. width: 100%;
  165. height: 200rpx;
  166. border: 1rpx solid #e0e0e0;
  167. border-radius: 10rpx;
  168. padding: 20rpx;
  169. font-size: 28rpx;
  170. box-sizing: border-box;
  171. }
  172. .counter {
  173. font-size: 24rpx;
  174. color: #999;
  175. text-align: right;
  176. display: block;
  177. margin-top: 10rpx;
  178. }
  179. .btn-submit {
  180. width: 100%;
  181. height: 90rpx;
  182. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  183. color: #fff;
  184. border-radius: 45rpx;
  185. font-size: 32rpx;
  186. font-weight: bold;
  187. margin-top: 40rpx;
  188. }
  189. .btn-submit[disabled] {
  190. opacity: 0.6;
  191. }
  192. </style>