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

228 lines
5.3 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. formItemStyle: { padding: 0 },
  90. }
  91. },
  92. onLoad(arg) {
  93. const { id } = arg
  94. this.id = id
  95. },
  96. methods: {
  97. async onSubmit() {
  98. try {
  99. await this.$refs.form.validate()
  100. const {
  101. } = this.form
  102. const params = {
  103. }
  104. // todo: fetch
  105. // await this.$fetch('updateAddress', params)
  106. uni.showToast({
  107. icon: 'success',
  108. title: '提交成功',
  109. });
  110. setTimeout(() => {
  111. this.$utils.navigateBack()
  112. }, 800)
  113. } catch (err) {
  114. console.log('onSave err', err)
  115. }
  116. },
  117. },
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .page__view {
  122. width: 100vw;
  123. height: 100vh;
  124. position: relative;
  125. background: linear-gradient(to right, #21FEEC, #019AF9);
  126. /deep/ .nav-bar__view {
  127. position: fixed;
  128. top: 0;
  129. left: 0;
  130. }
  131. .icon-nav {
  132. width: 392rpx;
  133. height: auto;
  134. }
  135. }
  136. .main {
  137. height: 100%;
  138. padding-top: calc(var(--status-bar-height) + 142rpx);
  139. box-sizing: border-box;
  140. }
  141. .card {
  142. width: 100%;
  143. height: 100%;
  144. padding: 40rpx;
  145. box-sizing: border-box;
  146. font-family: PingFang SC;
  147. font-weight: 400;
  148. line-height: 1.4;
  149. background: linear-gradient(#DAF3FF, #FBFEFF 90rpx, #FBFEFF);
  150. border: 2rpx solid #FFFFFF;
  151. border-radius: 48rpx;
  152. &-header {
  153. font-family: PingFang SC;
  154. font-weight: 500;
  155. font-size: 36rpx;
  156. line-height: 1.4;
  157. color: #191919;
  158. }
  159. }
  160. .form {
  161. &-item {
  162. margin-top: 32rpx;
  163. border-bottom: 2rpx solid #EEEEEE;
  164. &-label {
  165. font-family: PingFang SC;
  166. font-weight: 400;
  167. font-size: 26rpx;
  168. line-height: 1.4;
  169. color: #181818;
  170. .icon {
  171. margin-right: 8rpx;
  172. width: 16rpx;
  173. height: auto;
  174. }
  175. }
  176. &-content {
  177. }
  178. }
  179. }
  180. .bottom {
  181. position: fixed;
  182. left: 0;
  183. bottom: 0;
  184. width: 100vw;
  185. background: #FFFFFF;
  186. box-sizing: border-box;
  187. padding: 32rpx 40rpx;
  188. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  189. box-sizing: border-box;
  190. .btn {
  191. width: 100%;
  192. padding: 14rpx 0;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. font-size: 36rpx;
  196. line-height: 1;
  197. color: #FFFFFF;
  198. background: linear-gradient(to right, #21FEEC, #019AF9);
  199. border: 2rpx solid #00A9FF;
  200. border-radius: 41rpx;
  201. }
  202. }
  203. </style>