apply.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. onLoad() {
  41. uni.redirectTo({ url: '/pages/profile/service-role-apply' })
  42. },
  43. data() {
  44. return {
  45. tiers: [
  46. { value: 'bronze', label: '青铜管家' },
  47. { value: 'silver', label: '白银管家' },
  48. { value: 'gold', label: '黄金管家' },
  49. { value: 'platinum', label: '铂金管家' }
  50. ],
  51. formData: {
  52. realName: '',
  53. phone: '',
  54. tier: '',
  55. description: ''
  56. },
  57. submitting: false
  58. }
  59. },
  60. methods: {
  61. onTierChange(e) {
  62. this.formData.tier = this.tiers[e.detail.value].value
  63. },
  64. getTierLabel(value) {
  65. const item = this.tiers.find(t => t.value === value)
  66. return item ? item.label : value
  67. },
  68. async handleSubmit() {
  69. if (!this.formData.realName) {
  70. uni.showToast({ title: '请输入真实姓名', icon: 'none' })
  71. return
  72. }
  73. if (!this.formData.phone) {
  74. uni.showToast({ title: '请输入手机号', icon: 'none' })
  75. return
  76. }
  77. this.submitting = true
  78. try {
  79. const res = await butlerApply({
  80. tier: this.formData.tier,
  81. description: this.formData.description
  82. })
  83. if (res.code === 200) {
  84. uni.showModal({
  85. title: '申请成功',
  86. content: '您的管家申请已提交,请等待审核',
  87. showCancel: false,
  88. success: () => uni.navigateBack()
  89. })
  90. } else {
  91. uni.showToast({ title: res.message || '提交失败', icon: 'none' })
  92. }
  93. } catch (e) {
  94. uni.showToast({ title: '提交失败', icon: 'none' })
  95. } finally {
  96. this.submitting = false
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style>
  103. .container {
  104. padding: 30rpx;
  105. background: #f8f8f8;
  106. min-height: 100vh;
  107. }
  108. .header {
  109. text-align: center;
  110. padding: 40rpx 0;
  111. }
  112. .title {
  113. font-size: 40rpx;
  114. font-weight: bold;
  115. color: #333;
  116. }
  117. .subtitle {
  118. font-size: 28rpx;
  119. color: #666;
  120. margin-top: 16rpx;
  121. display: block;
  122. }
  123. .form {
  124. background: #fff;
  125. border-radius: 20rpx;
  126. padding: 40rpx;
  127. }
  128. .form-item {
  129. margin-bottom: 40rpx;
  130. }
  131. .label {
  132. font-size: 28rpx;
  133. color: #333;
  134. display: block;
  135. margin-bottom: 20rpx;
  136. font-weight: bold;
  137. }
  138. .input {
  139. width: 100%;
  140. height: 80rpx;
  141. border: 1rpx solid #e0e0e0;
  142. border-radius: 10rpx;
  143. padding: 0 20rpx;
  144. font-size: 28rpx;
  145. box-sizing: border-box;
  146. }
  147. .picker {
  148. width: 100%;
  149. height: 80rpx;
  150. border: 1rpx solid #e0e0e0;
  151. border-radius: 10rpx;
  152. padding: 0 20rpx;
  153. font-size: 28rpx;
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-between;
  157. box-sizing: border-box;
  158. }
  159. .placeholder {
  160. color: #999;
  161. }
  162. .arrow {
  163. font-size: 32rpx;
  164. color: #999;
  165. }
  166. .textarea {
  167. width: 100%;
  168. height: 200rpx;
  169. border: 1rpx solid #e0e0e0;
  170. border-radius: 10rpx;
  171. padding: 20rpx;
  172. font-size: 28rpx;
  173. box-sizing: border-box;
  174. }
  175. .counter {
  176. font-size: 24rpx;
  177. color: #999;
  178. text-align: right;
  179. display: block;
  180. margin-top: 10rpx;
  181. }
  182. .btn-submit {
  183. width: 100%;
  184. height: 90rpx;
  185. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  186. color: #fff;
  187. border-radius: 45rpx;
  188. font-size: 32rpx;
  189. font-weight: bold;
  190. margin-top: 40rpx;
  191. }
  192. .btn-submit[disabled] {
  193. opacity: 0.6;
  194. }
  195. </style>