apply.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. <picker mode="selector" :range="vendorTypes" range-key="label" @change="onTypeChange">
  11. <view class="picker">
  12. <text v-if="formData.vendorType">{{ getTypeLabel(formData.vendorType) }}</text>
  13. <text v-else class="placeholder">请选择服务商类型</text>
  14. <text class="arrow">›</text>
  15. </view>
  16. </picker>
  17. </view>
  18. <view class="form-item">
  19. <text class="label">资质说明</text>
  20. <textarea
  21. class="textarea"
  22. v-model="formData.vendorInfo"
  23. placeholder="请填写您的资质信息、服务经验等"
  24. maxlength="500"
  25. />
  26. <text class="counter">{{ formData.vendorInfo.length }}/500</text>
  27. </view>
  28. <button class="btn-submit" :disabled="!formData.vendorType || submitting" @click="handleSubmit">
  29. {{ submitting ? '提交中...' : '提交申请' }}
  30. </button>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import { vendorApply } from '../../utils/api'
  36. import fontScaleMixin from '@/mixins/font-scale.js'
  37. export default {
  38. mixins: [fontScaleMixin],
  39. onLoad() {
  40. uni.redirectTo({ url: '/pages/profile/service-role-apply' })
  41. },
  42. data() {
  43. return {
  44. vendorTypes: [
  45. { value: 'planner', label: '成长规划师' },
  46. { value: 'activity_provider', label: '活动提供商' },
  47. { value: 'product_supplier', label: '商品供应商' }
  48. ],
  49. formData: {
  50. vendorType: '',
  51. vendorInfo: ''
  52. },
  53. submitting: false
  54. }
  55. },
  56. methods: {
  57. onTypeChange(e) {
  58. this.formData.vendorType = this.vendorTypes[e.detail.value].value
  59. },
  60. getTypeLabel(value) {
  61. const item = this.vendorTypes.find(t => t.value === value)
  62. return item ? item.label : value
  63. },
  64. async handleSubmit() {
  65. this.submitting = true
  66. try {
  67. const res = await vendorApply({
  68. vendorType: this.formData.vendorType,
  69. vendorInfo: this.formData.vendorInfo
  70. })
  71. uni.showToast({ title: '提交成功', icon: 'success' })
  72. setTimeout(() => {
  73. uni.navigateBack()
  74. }, 1500)
  75. } catch (e) {
  76. // api.js already shows error toast
  77. } finally {
  78. this.submitting = false
  79. }
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .container {
  86. padding: $uni-space-page;
  87. background: $facade-fill-page;
  88. min-height: 100vh;
  89. }
  90. .header {
  91. text-align: center;
  92. padding: 40rpx 0;
  93. }
  94. .title {
  95. font-size: calc(40rpx * var(--font-scale, 1));
  96. font-weight: bold;
  97. color: $facade-text-strong;
  98. }
  99. .subtitle {
  100. font-size: calc(26rpx * var(--font-scale, 1));
  101. color: $facade-text-muted;
  102. margin-top: 10rpx;
  103. display: block;
  104. }
  105. .form {
  106. background: $app-surface;
  107. border-radius: 24rpx;
  108. padding: $uni-space-lg;
  109. }
  110. .form-item {
  111. margin-bottom: $uni-space-lg;
  112. }
  113. .label {
  114. font-size: calc(28rpx * var(--font-scale, 1));
  115. color: $facade-text-strong;
  116. font-weight: bold;
  117. display: block;
  118. margin-bottom: 15rpx;
  119. }
  120. .picker {
  121. display: flex;
  122. justify-content: space-between;
  123. align-items: center;
  124. padding: 20rpx 0;
  125. border-bottom: 2rpx solid $facade-hairline-2;
  126. }
  127. .placeholder {
  128. color: $facade-text-ghost;
  129. }
  130. .arrow {
  131. color: $facade-text-ghost;
  132. font-size: calc(36rpx * var(--font-scale, 1));
  133. }
  134. .textarea {
  135. width: 100%;
  136. height: 200rpx;
  137. padding: 20rpx;
  138. border: 2rpx solid $facade-hairline-2;
  139. border-radius: 8rpx;
  140. font-size: calc(28rpx * var(--font-scale, 1));
  141. box-sizing: border-box;
  142. }
  143. .counter {
  144. display: block;
  145. text-align: right;
  146. font-size: calc(24rpx * var(--font-scale, 1));
  147. color: $facade-text-ghost;
  148. margin-top: 10rpx;
  149. }
  150. .btn-submit {
  151. width: 100%;
  152. height: 88rpx;
  153. line-height: 88rpx;
  154. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  155. color: $app-surface;
  156. border-radius: 24rpx;
  157. font-size: calc(32rpx * var(--font-scale, 1));
  158. margin-top: 40rpx;
  159. }
  160. .btn-submit[disabled] {
  161. opacity: 0.5;
  162. }
  163. </style>