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

235 lines
4.8 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="userName" :customStyle="formItemStyle">
  16. <view class="form-item-label">真实姓名</view>
  17. <view class="form-item-content">
  18. <formInput v-model="form.userName"></formInput>
  19. </view>
  20. </uv-form-item>
  21. </view>
  22. <view class="form-item">
  23. <uv-form-item prop="transferAmount" :customStyle="formItemStyle">
  24. <view class="form-item-label">提现金额</view>
  25. <view class="form-item-content">
  26. <formInput v-model="form.transferAmount"></formInput>
  27. </view>
  28. </uv-form-item>
  29. </view>
  30. </uv-form>
  31. </view>
  32. </view>
  33. <view class="notice">
  34. 请仔细检查并确认相关信息因用户个人疏忽导致的充值错误需由用户自行承担
  35. <!-- todo: 替换配置项key -->
  36. <text class="highlight" @click="$refs.modal.open('user_ys', '提现须知')">提现须知</text>
  37. </view>
  38. <agreementModal ref="modal"></agreementModal>
  39. </view>
  40. <view class="bottom">
  41. <button class="btn" @click="onSubmit">提现</button>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import formInput from '@/pages_order/components/formInput.vue'
  47. import agreementModal from '@/pages_order/components/agreementModal.vue'
  48. export default {
  49. components: {
  50. formInput,
  51. agreementModal,
  52. },
  53. data() {
  54. return {
  55. form: {
  56. userName: null,
  57. transferAmount: null,
  58. },
  59. rules: {
  60. 'userName': {
  61. type: 'string',
  62. required: true,
  63. message: '请输入真实姓名',
  64. },
  65. 'transferAmount': {
  66. type: 'string',
  67. required: true,
  68. message: '请输入提现金额',
  69. },
  70. },
  71. formItemStyle: { padding: 0 },
  72. }
  73. },
  74. methods: {
  75. async onSubmit() {
  76. try {
  77. await this.$refs.form.validate()
  78. const {
  79. userName,
  80. transferAmount,
  81. } = this.form
  82. const params = {
  83. userName,
  84. transferAmount,
  85. }
  86. await this.$fetch('cashout', params)
  87. uni.showToast({
  88. icon: 'success',
  89. title: '提交成功',
  90. });
  91. setTimeout(() => {
  92. this.$utils.navigateBack()
  93. }, 800)
  94. } catch (err) {
  95. console.log('onSave err', err)
  96. }
  97. },
  98. },
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .page__view {
  103. width: 100vw;
  104. min-height: 100vh;
  105. background: $uni-bg-color;
  106. position: relative;
  107. /deep/ .nav-bar__view {
  108. position: fixed;
  109. top: 0;
  110. left: 0;
  111. }
  112. }
  113. .main {
  114. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 224rpx 32rpx;
  115. }
  116. .card {
  117. padding: 32rpx;
  118. background: #FFFFFF;
  119. border: 2rpx solid #FFFFFF;
  120. border-radius: 32rpx;
  121. & + & {
  122. margin-top: 40rpx;
  123. }
  124. &-header {
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. font-size: 36rpx;
  128. line-height: 1.4;
  129. color: #252545;
  130. margin-bottom: 32rpx;
  131. }
  132. }
  133. .form {
  134. padding: 8rpx 0 0 0;
  135. &-item {
  136. border-bottom: 2rpx solid #EEEEEE;
  137. &:last-child {
  138. border: none;
  139. }
  140. & + & {
  141. margin-top: 40rpx;
  142. }
  143. &-label {
  144. font-family: PingFang SC;
  145. font-weight: 400;
  146. font-size: 26rpx;
  147. line-height: 1.4;
  148. color: #181818;
  149. }
  150. &-content {
  151. margin-top: 14rpx;
  152. padding: 6rpx 0;
  153. .text {
  154. padding: 2rpx 0;
  155. font-family: PingFang SC;
  156. font-weight: 400;
  157. font-size: 32rpx;
  158. line-height: 1.4;
  159. &.placeholder {
  160. color: #C6C6C6;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. .notice {
  167. margin-top: 40rpx;
  168. font-size: 24rpx;
  169. line-height: 1.4;
  170. color: #BABABA;
  171. .highlight {
  172. color: #F79400;
  173. }
  174. }
  175. .bottom {
  176. position: fixed;
  177. left: 0;
  178. bottom: 0;
  179. width: 100vw;
  180. // height: 200rpx;
  181. padding: 24rpx 40rpx;
  182. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  183. background: #FFFFFF;
  184. box-sizing: border-box;
  185. .btn {
  186. width: 100%;
  187. padding: 14rpx 0;
  188. box-sizing: border-box;
  189. font-family: PingFang SC;
  190. font-weight: 500;
  191. font-size: 36rpx;
  192. line-height: 1.4;
  193. color: #FFFFFF;
  194. background: linear-gradient(to right, #21FEEC, #019AF9);
  195. border: 2rpx solid #00A9FF;
  196. border-radius: 41rpx;
  197. }
  198. }
  199. </style>