鸿宇研学生前端代码
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.

226 lines
5.2 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar leftClick @leftClick="$utils.navigateBack" >
  4. <image class="icon-nav" src="@/pages_order/static/activity/icon-nav.png" mode="widthFix"></image>
  5. </navbar>
  6. <view class="main">
  7. <view class="card">
  8. <view class="card-header">申请邮寄纸质版</view>
  9. <view class="form">
  10. <uv-form
  11. ref="form"
  12. :model="form"
  13. :rules="rules"
  14. errorType="toast"
  15. >
  16. <view class="form-item">
  17. <uv-form-item prop="name" :customStyle="formItemStyle">
  18. <view class="form-item-label">
  19. <image class="icon" src="@/static/image/icon-require.png" mode="widthFix"></image>
  20. 姓名
  21. </view>
  22. <view class="form-item-content">
  23. <formInput v-model="form.name"></formInput>
  24. </view>
  25. </uv-form-item>
  26. </view>
  27. <view class="form-item">
  28. <uv-form-item prop="phone" :customStyle="formItemStyle">
  29. <view class="form-item-label">
  30. <image class="icon" src="@/static/image/icon-require.png" mode="widthFix"></image>
  31. 电话
  32. </view>
  33. <view class="form-item-content">
  34. <formInput v-model="form.phone"></formInput>
  35. </view>
  36. </uv-form-item>
  37. </view>
  38. <view class="form-item">
  39. <uv-form-item prop="address" :customStyle="formItemStyle">
  40. <view class="form-item-label">
  41. <image class="icon" src="@/static/image/icon-require.png" mode="widthFix"></image>
  42. 邮寄地址
  43. </view>
  44. <view class="form-item-content">
  45. <formInput v-model="form.address"></formInput>
  46. </view>
  47. </uv-form-item>
  48. </view>
  49. </uv-form>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="bottom">
  54. <view class="flex btn" @click="onSubmit">提交</view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import formInput from '@/pages_order/components/formInput.vue'
  60. export default {
  61. components: {
  62. formInput,
  63. },
  64. data() {
  65. return {
  66. id: null,
  67. form: {
  68. name: null,
  69. phone: null,
  70. address: null,
  71. },
  72. rules: {
  73. 'name': {
  74. type: 'string',
  75. required: true,
  76. message: '请输入姓名',
  77. },
  78. 'phone': {
  79. type: 'string',
  80. required: true,
  81. message: '请输入电话',
  82. },
  83. 'address': {
  84. type: 'string',
  85. required: true,
  86. message: '请输入邮寄地址',
  87. },
  88. },
  89. }
  90. },
  91. onLoad(arg) {
  92. const { id } = arg
  93. this.id = id
  94. },
  95. methods: {
  96. async onSubmit() {
  97. try {
  98. await this.$refs.form.validate()
  99. const {
  100. } = this.form
  101. const params = {
  102. }
  103. // todo: fetch
  104. // await this.$fetch('updateAddress', params)
  105. uni.showToast({
  106. icon: 'success',
  107. title: '提交成功',
  108. });
  109. setTimeout(() => {
  110. this.$utils.navigateBack()
  111. }, 800)
  112. } catch (err) {
  113. console.log('onSave err', err)
  114. }
  115. },
  116. },
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .page__view {
  121. width: 100vw;
  122. height: 100vh;
  123. position: relative;
  124. background: linear-gradient(to right, #21FEEC, #019AF9);
  125. /deep/ .nav-bar__view {
  126. position: fixed;
  127. top: 0;
  128. left: 0;
  129. }
  130. .icon-nav {
  131. width: 392rpx;
  132. height: auto;
  133. }
  134. }
  135. .main {
  136. height: 100%;
  137. padding-top: calc(var(--status-bar-height) + 142rpx);
  138. box-sizing: border-box;
  139. }
  140. .card {
  141. width: 100%;
  142. height: 100%;
  143. padding: 40rpx;
  144. box-sizing: border-box;
  145. font-family: PingFang SC;
  146. font-weight: 400;
  147. line-height: 1.4;
  148. background: linear-gradient(#DAF3FF, #FBFEFF 90rpx, #FBFEFF);
  149. border: 2rpx solid #FFFFFF;
  150. border-radius: 48rpx;
  151. &-header {
  152. font-family: PingFang SC;
  153. font-weight: 500;
  154. font-size: 36rpx;
  155. line-height: 1.4;
  156. color: #191919;
  157. }
  158. }
  159. .form {
  160. &-item {
  161. margin-top: 32rpx;
  162. border-bottom: 2rpx solid #EEEEEE;
  163. &-label {
  164. font-family: PingFang SC;
  165. font-weight: 400;
  166. font-size: 26rpx;
  167. line-height: 1.4;
  168. color: #181818;
  169. .icon {
  170. margin-right: 8rpx;
  171. width: 16rpx;
  172. height: auto;
  173. }
  174. }
  175. &-content {
  176. }
  177. }
  178. }
  179. .bottom {
  180. position: fixed;
  181. left: 0;
  182. bottom: 0;
  183. width: 100vw;
  184. background: #FFFFFF;
  185. box-sizing: border-box;
  186. padding: 32rpx 40rpx;
  187. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  188. box-sizing: border-box;
  189. .btn {
  190. width: 100%;
  191. padding: 14rpx 0;
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. font-size: 36rpx;
  195. line-height: 1;
  196. color: #FFFFFF;
  197. background: linear-gradient(to right, #21FEEC, #019AF9);
  198. border: 2rpx solid #00A9FF;
  199. border-radius: 41rpx;
  200. }
  201. }
  202. </style>