apply.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. <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. export default {
  37. onLoad() {
  38. uni.redirectTo({ url: '/pages/profile/service-role-apply' })
  39. },
  40. data() {
  41. return {
  42. vendorTypes: [
  43. { value: 'planner', label: '成长规划师' },
  44. { value: 'activity_provider', label: '活动提供商' },
  45. { value: 'product_supplier', label: '商品供应商' }
  46. ],
  47. formData: {
  48. vendorType: '',
  49. vendorInfo: ''
  50. },
  51. submitting: false
  52. }
  53. },
  54. methods: {
  55. onTypeChange(e) {
  56. this.formData.vendorType = this.vendorTypes[e.detail.value].value
  57. },
  58. getTypeLabel(value) {
  59. const item = this.vendorTypes.find(t => t.value === value)
  60. return item ? item.label : value
  61. },
  62. async handleSubmit() {
  63. this.submitting = true
  64. try {
  65. const res = await vendorApply({
  66. vendorType: this.formData.vendorType,
  67. vendorInfo: this.formData.vendorInfo
  68. })
  69. uni.showToast({ title: '提交成功', icon: 'success' })
  70. setTimeout(() => {
  71. uni.navigateBack()
  72. }, 1500)
  73. } catch (e) {
  74. // api.js already shows error toast
  75. } finally {
  76. this.submitting = false
  77. }
  78. }
  79. }
  80. }
  81. </script>
  82. <style>
  83. .container {
  84. padding: 30rpx;
  85. background: #f8f8f8;
  86. min-height: 100vh;
  87. }
  88. .header {
  89. text-align: center;
  90. padding: 40rpx 0;
  91. }
  92. .title {
  93. font-size: 40rpx;
  94. font-weight: bold;
  95. color: #333;
  96. }
  97. .subtitle {
  98. font-size: 26rpx;
  99. color: #999;
  100. margin-top: 10rpx;
  101. display: block;
  102. }
  103. .form {
  104. background: #fff;
  105. border-radius: 20rpx;
  106. padding: 30rpx;
  107. }
  108. .form-item {
  109. margin-bottom: 30rpx;
  110. }
  111. .label {
  112. font-size: 28rpx;
  113. color: #333;
  114. font-weight: bold;
  115. display: block;
  116. margin-bottom: 15rpx;
  117. }
  118. .picker {
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. padding: 20rpx 0;
  123. border-bottom: 2rpx solid #eee;
  124. }
  125. .placeholder {
  126. color: #ccc;
  127. }
  128. .arrow {
  129. color: #ccc;
  130. font-size: 36rpx;
  131. }
  132. .textarea {
  133. width: 100%;
  134. height: 200rpx;
  135. padding: 20rpx;
  136. border: 2rpx solid #eee;
  137. border-radius: 10rpx;
  138. font-size: 28rpx;
  139. box-sizing: border-box;
  140. }
  141. .counter {
  142. display: block;
  143. text-align: right;
  144. font-size: 24rpx;
  145. color: #ccc;
  146. margin-top: 10rpx;
  147. }
  148. .btn-submit {
  149. width: 100%;
  150. height: 88rpx;
  151. line-height: 88rpx;
  152. background: linear-gradient(135deg, #F97316, #FB923C);
  153. color: #fff;
  154. border-radius: 44rpx;
  155. font-size: 32rpx;
  156. margin-top: 40rpx;
  157. }
  158. .btn-submit[disabled] {
  159. opacity: 0.5;
  160. }
  161. </style>