index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="advanced-role-application-container">
  3. <JHeader
  4. :dark="false" title="" width="50" height="50"
  5. style="padding: 24upx 40upx 210upx;background-color: transparent;"
  6. ></JHeader>
  7. <view class="main-area">
  8. <view class="title">
  9. <text v-if="form.relationshipLevelId === 4">加盟商</text>
  10. <text v-else-if="form.relationshipLevelId === 5">区代理</text>
  11. <text v-else>未知角色</text>
  12. 申请
  13. </view>
  14. <view class="item">
  15. <view class="item-title">区域</view>
  16. <view class="field-wrapper">
  17. <JArea style="flex: 1;" :text="regionName" @confirm="handleSelectRegionArea"></JArea>
  18. <tui-icon name="arrowdown" :size="24"></tui-icon>
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="item-title">详细地址</view>
  23. <view class="field-wrapper">
  24. <input v-model.trim="form.address" type="text" placeholder="请填写您的详细地址" />
  25. </view>
  26. </view>
  27. <view class="item">
  28. <view class="item-title">姓名</view>
  29. <view class="field-wrapper">
  30. <input v-model.trim="form.name" type="text" placeholder="请填写您的姓名" />
  31. </view>
  32. </view>
  33. <view class="item">
  34. <view class="item-title">手机号</view>
  35. <view class="field-wrapper">
  36. <input v-model.trim="form.phone" type="number" placeholder="请填写您的手机号" />
  37. </view>
  38. </view>
  39. <button class="uni-btn" @click="submit">确定申请</button>
  40. </view>
  41. <tui-toast ref="toast"></tui-toast>
  42. </view>
  43. </template>
  44. <script>
  45. import { T_STORAGE_KEY } from '../../../constant'
  46. import { addPlatformRelationshipApplyApi, getSelectApplyPlatformRelationApi } from '../../../api/anotherTFInterface'
  47. export default {
  48. name: 'AdvancedRoleApplication',
  49. data() {
  50. return {
  51. userInfo: {},
  52. form: {
  53. relationshipLevelId: '',
  54. region: '',
  55. address: '',
  56. name: '',
  57. phone: ''
  58. },
  59. regionName: ''
  60. }
  61. },
  62. onLoad(options) {
  63. this.userInfo = uni.getStorageSync(T_STORAGE_KEY) || {}
  64. this.form.phone = this.userInfo.phone || ''
  65. this.form.relationshipLevelId = Number(options.type)
  66. if (this.form.relationshipLevelId) this.getPlatformRelationApplyMsg()
  67. },
  68. methods: {
  69. handleSelectRegionArea(e) {
  70. this.regionName = e.area
  71. this.form.region = e.county.id || e.city.id || e.province.id
  72. },
  73. // 提交申请
  74. submit() {
  75. if (!this.form.region) {
  76. this.$showToast('请选择所在区域')
  77. return
  78. }
  79. if (!this.form.relationshipLevelId) {
  80. this.$showToast('缺少升级的角色类型')
  81. return
  82. }
  83. if (!this.form.name) {
  84. this.$showToast('请填写姓名')
  85. return
  86. }
  87. if (
  88. !/^1[3456789]\d{9}$/.test(this.form.phone)
  89. ) {
  90. this.$showToast('手机号码格式错误')
  91. return
  92. }
  93. if (!this.form.address) {
  94. this.$showToast('请填写详细地址')
  95. return
  96. }
  97. uni.showModal({
  98. title: '提示',
  99. content: '确认提交申请?',
  100. success: (res) => {
  101. if (res.confirm) {
  102. addPlatformRelationshipApplyApi(this.form).then((res) => {
  103. this.$showToast('提交成功')
  104. setTimeout(() => {
  105. this.$switchTab('/')
  106. }, 3000)
  107. })
  108. }
  109. }
  110. })
  111. },
  112. getPlatformRelationApplyMsg() {
  113. getSelectApplyPlatformRelationApi({})
  114. .then((res) => {
  115. if (res.data && res.data.applyId) {
  116. // this.$showToast('已存在申请')
  117. this.form.region = res.data.region
  118. this.form.address = res.data.address
  119. this.form.name = res.data.name
  120. this.form.phone = res.data.phone
  121. }
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="less" scoped>
  128. .advanced-role-application-container {
  129. position: relative;
  130. width: 100%;
  131. min-height: 100vh;
  132. background-color: #ffdb52;
  133. background: url('../../../static/images/user/daili/bg.png') no-repeat;
  134. background-size: cover;
  135. box-sizing: border-box;
  136. .main-area {
  137. position: relative;
  138. width: 622upx;
  139. min-height: 500px;
  140. background-color: #fff;
  141. margin: 0 auto;
  142. padding: 112upx 32upx 40upx;
  143. box-sizing: border-box;
  144. border-radius: 24upx;
  145. .title {
  146. position: absolute;
  147. color: #fff;
  148. width: 502upx;
  149. height: 112upx;
  150. background: url('../../../static/images/user/daili/title-wrapper.png') no-repeat;
  151. background-size: cover;
  152. top: -26upx;
  153. left: 50%;
  154. transform: translateX(-50%);
  155. font-size: 42upx;
  156. font-weight: bold;
  157. text-align: center;
  158. line-height: 112upx;
  159. }
  160. .item {
  161. margin-bottom: 30upx;
  162. .item-title {
  163. color: #3a3629;
  164. font-size: 28upx;
  165. margin-bottom: 18upx;
  166. }
  167. .field-wrapper {
  168. width: 100%;
  169. background-color: #f6f6f5;
  170. height: 96upx;
  171. border-radius: 16upx;
  172. padding: 27upx 24upx;
  173. box-sizing: border-box;
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. input {
  178. flex: 1;
  179. font-size: 28upx;
  180. }
  181. }
  182. }
  183. .uni-btn {
  184. border-radius: 100px;
  185. height: 96upx;
  186. background-color: #ffd152;
  187. margin-top: 68upx;
  188. font-size: 28upx;
  189. color: #fff;
  190. line-height: 96upx;
  191. font-weight: 500;
  192. }
  193. }
  194. }
  195. </style>