apply.vue 5.3 KB

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