apply.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. realName: this.formData.realName,
  83. tier: this.formData.tier,
  84. description: this.formData.description
  85. })
  86. if (res.code === 200) {
  87. uni.showModal({
  88. title: '申请成功',
  89. content: '您的管家申请已提交,请等待审核',
  90. showCancel: false,
  91. success: () => uni.navigateBack()
  92. })
  93. } else {
  94. uni.showToast({ title: res.message || '提交失败', icon: 'none' })
  95. }
  96. } catch (e) {
  97. uni.showToast({ title: '提交失败', icon: 'none' })
  98. } finally {
  99. this.submitting = false
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .container {
  107. padding: $uni-space-page;
  108. background: $facade-fill-page;
  109. min-height: 100vh;
  110. }
  111. .header {
  112. text-align: center;
  113. padding: 40rpx 0;
  114. }
  115. .title {
  116. font-size: calc(40rpx * var(--font-scale, 1));
  117. font-weight: bold;
  118. color: $facade-text-strong;
  119. }
  120. .subtitle {
  121. font-size: calc(28rpx * var(--font-scale, 1));
  122. color: $facade-text-body;
  123. margin-top: 16rpx;
  124. display: block;
  125. }
  126. .form {
  127. background: $app-surface;
  128. border-radius: 24rpx;
  129. padding: 40rpx;
  130. }
  131. .form-item {
  132. margin-bottom: 40rpx;
  133. }
  134. .label {
  135. font-size: calc(28rpx * var(--font-scale, 1));
  136. color: $facade-text-strong;
  137. display: block;
  138. margin-bottom: 20rpx;
  139. font-weight: bold;
  140. }
  141. .input {
  142. width: 100%;
  143. height: 80rpx;
  144. border: 1rpx solid $facade-hairline;
  145. border-radius: 8rpx;
  146. padding: 0 20rpx;
  147. font-size: calc(28rpx * var(--font-scale, 1));
  148. box-sizing: border-box;
  149. }
  150. .picker {
  151. width: 100%;
  152. height: 80rpx;
  153. border: 1rpx solid $facade-hairline;
  154. border-radius: 8rpx;
  155. padding: 0 20rpx;
  156. font-size: calc(28rpx * var(--font-scale, 1));
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-between;
  160. box-sizing: border-box;
  161. }
  162. .placeholder {
  163. color: $facade-text-muted;
  164. }
  165. .arrow {
  166. font-size: calc(32rpx * var(--font-scale, 1));
  167. color: $facade-text-muted;
  168. }
  169. .textarea {
  170. width: 100%;
  171. height: 200rpx;
  172. border: 1rpx solid $facade-hairline;
  173. border-radius: 8rpx;
  174. padding: 20rpx;
  175. font-size: calc(28rpx * var(--font-scale, 1));
  176. box-sizing: border-box;
  177. }
  178. .counter {
  179. font-size: calc(24rpx * var(--font-scale, 1));
  180. color: $facade-text-muted;
  181. text-align: right;
  182. display: block;
  183. margin-top: 10rpx;
  184. }
  185. .btn-submit {
  186. width: 100%;
  187. height: 90rpx;
  188. background: linear-gradient(135deg, $accent-indigo 0%, $accent-indigo-deep 100%);
  189. color: $app-surface;
  190. border-radius: 24rpx;
  191. font-size: calc(32rpx * var(--font-scale, 1));
  192. font-weight: bold;
  193. margin-top: 40rpx;
  194. }
  195. .btn-submit[disabled] {
  196. opacity: 0.6;
  197. }
  198. </style>