普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

268 lines
5.7 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="填写个人信息" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <view class="card">
  6. <view class="card-header">申请信息</view>
  7. <view class="form">
  8. <uv-form
  9. ref="form"
  10. :model="form"
  11. :rules="rules"
  12. errorType="toast"
  13. >
  14. <view class="form-item">
  15. <uv-form-item prop="name" :customStyle="formItemStyle">
  16. <view class="form-item-label">联系人</view>
  17. <view class="form-item-content">
  18. <formInput v-model="form.name"></formInput>
  19. </view>
  20. </uv-form-item>
  21. </view>
  22. <view class="form-item">
  23. <uv-form-item prop="phone" :customStyle="formItemStyle">
  24. <view class="form-item-label">手机号</view>
  25. <view class="form-item-content">
  26. <formInput v-model="form.phone"></formInput>
  27. </view>
  28. </uv-form-item>
  29. </view>
  30. <view class="form-item">
  31. <uv-form-item prop="phone" :customStyle="formItemStyle">
  32. <view class="form-item-label">所在地区</view>
  33. <view class="form-item-content">
  34. <picker mode="region" @change="onAreaChange" :value="form.area">
  35. <view class="flex region">
  36. <view v-if="form.area">{{ form.area.join('') }}</view>
  37. <view v-else class="placeholder">选择省市区街道</view>
  38. </view>
  39. </picker>
  40. </view>
  41. </uv-form-item>
  42. </view>
  43. <view class="form-item">
  44. <uv-form-item prop="address" :customStyle="formItemStyle">
  45. <view class="form-item-label">详细地址</view>
  46. <view class="form-item-content">
  47. <formInput v-model="form.address" placeholder="小区楼栋、门牌号、村等"></formInput>
  48. </view>
  49. </uv-form-item>
  50. </view>
  51. </uv-form>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="bottom">
  56. <button class="btn" @click="onConfirm">确认</button>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import { mapState } from 'vuex'
  62. import util from '@/utils/utils.js'
  63. import formInput from '@/pages_order/components/formInput.vue'
  64. export default {
  65. components: {
  66. formInput,
  67. },
  68. data() {
  69. return {
  70. form: {
  71. name: null,
  72. phone: null,
  73. area: null,
  74. address: null,
  75. },
  76. rules: {
  77. 'name': {
  78. type: 'string',
  79. required: true,
  80. message: '请输入联系人',
  81. },
  82. 'phone': {
  83. type: 'string',
  84. required: true,
  85. message: '请输入正确的手机号',
  86. validator: (rule, value, callback) => {
  87. return util.validatePhone(value)
  88. },
  89. },
  90. 'area': {
  91. type: 'array',
  92. required: true,
  93. message: '请选择省市区',
  94. },
  95. 'address': {
  96. type: 'string',
  97. required: true,
  98. message: '请输入详细地址',
  99. },
  100. },
  101. formItemStyle: { padding: 0 },
  102. }
  103. },
  104. onReady() {
  105. this.$refs.form.setRules(this.rules)
  106. },
  107. methods: {
  108. onAreaChange(e) {
  109. this.form.area = e.detail.value
  110. },
  111. async onConfirm() {
  112. try {
  113. const res = await this.$refs.form.validate()
  114. console.log('onSave res', res)
  115. // todo: save
  116. this.$utils.redirectTo(`/pages_order/order/userInfo/idUpload`)
  117. } catch (err) {
  118. console.log('onSave err', err)
  119. }
  120. },
  121. },
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .page__view {
  126. width: 100vw;
  127. min-height: 100vh;
  128. background-color: $uni-bg-color;
  129. position: relative;
  130. /deep/ .nav-bar__view {
  131. position: fixed;
  132. top: 0;
  133. left: 0;
  134. }
  135. }
  136. .main {
  137. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 224rpx 32rpx;
  138. }
  139. .card {
  140. padding: 32rpx;
  141. background: #FAFAFF;
  142. border: 2rpx solid #FFFFFF;
  143. border-radius: 32rpx;
  144. & + & {
  145. margin-top: 40rpx;
  146. }
  147. &-header {
  148. font-family: PingFang SC;
  149. font-weight: 500;
  150. font-size: 36rpx;
  151. line-height: 1.4;
  152. color: #252545;
  153. margin-bottom: 32rpx;
  154. }
  155. }
  156. .row {
  157. justify-content: space-between;
  158. font-family: PingFang SC;
  159. font-weight: 400;
  160. line-height: 1.4;
  161. column-gap: 24rpx;
  162. & + & {
  163. margin-top: 32rpx;
  164. }
  165. &-label {
  166. flex: none;
  167. font-size: 26rpx;
  168. color: #8B8B8B;
  169. }
  170. &-content {
  171. font-size: 32rpx;
  172. color: #181818;
  173. }
  174. }
  175. .form {
  176. padding: 8rpx 0 0 0;
  177. &-item {
  178. border-bottom: 2rpx solid #EEEEEE;
  179. &:last-child {
  180. border: none;
  181. }
  182. & + & {
  183. margin-top: 40rpx;
  184. }
  185. &-label {
  186. font-family: PingFang SC;
  187. font-weight: 400;
  188. font-size: 26rpx;
  189. line-height: 1.4;
  190. color: #181818;
  191. }
  192. &-content {
  193. margin-top: 14rpx;
  194. padding: 6rpx 0;
  195. .placeholder {
  196. color: #C6C6C6;
  197. font-size: 32rpx;
  198. font-weight: 400;
  199. }
  200. .region {
  201. min-height: 44rpx;
  202. justify-content: flex-start;
  203. }
  204. }
  205. }
  206. }
  207. .bottom {
  208. position: fixed;
  209. left: 0;
  210. bottom: 0;
  211. width: 100vw;
  212. height: 200rpx;
  213. padding: 24rpx 40rpx;
  214. background: #FFFFFF;
  215. box-sizing: border-box;
  216. .btn {
  217. width: 100%;
  218. padding: 16rpx 0;
  219. box-sizing: border-box;
  220. font-family: PingFang SC;
  221. font-weight: 500;
  222. font-size: 36rpx;
  223. line-height: 1;
  224. color: #FFFFFF;
  225. background-image: linear-gradient(to right, #4B348F, #845CFA);
  226. border-radius: 41rpx;
  227. }
  228. }
  229. </style>