apply.vue 3.6 KB

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