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

280 lines
6.8 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar leftClick @leftClick="$utils.navigateBack">
  4. <image class="icon-nav" src="@/pages_order/static/partner/icon-nav.png" mode="widthFix"></image>
  5. </navbar>
  6. <view class="main">
  7. <view class="advantage">
  8. <view class="flex advantage-content">
  9. <view class="flex advantage-item" v-for="(item, aIdx) in advantages" :key="aIdx">
  10. <image class="icon" src="@/static/image/icon-checkmark-circle-fill.png" mode="widthFix"></image>
  11. <view>{{ item }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="card">
  16. <view class="card-header">申请合伙人</view>
  17. <view class="form">
  18. <uv-form
  19. ref="form"
  20. :model="form"
  21. :rules="rules"
  22. errorType="toast"
  23. >
  24. <view class="form-item">
  25. <uv-form-item prop="name" :customStyle="formItemStyle">
  26. <view class="form-item-label">
  27. <image class="icon" src="@/pages_order/static/icon-require.png" mode="widthFix"></image>
  28. 姓名
  29. </view>
  30. <view class="form-item-content">
  31. <formInput v-model="form.name" :disabled="readonly"></formInput>
  32. </view>
  33. </uv-form-item>
  34. </view>
  35. <view class="form-item">
  36. <uv-form-item prop="phone" :customStyle="formItemStyle">
  37. <view class="form-item-label">
  38. <image class="icon" src="@/pages_order/static/icon-require.png" mode="widthFix"></image>
  39. 电话
  40. </view>
  41. <view class="form-item-content">
  42. <formInput v-model="form.phone" :disabled="readonly"></formInput>
  43. </view>
  44. </uv-form-item>
  45. </view>
  46. <!-- <view class="form-item">
  47. <uv-form-item prop="inviteId" :customStyle="formItemStyle">
  48. <view class="form-item-label">推荐人</view>
  49. <view class="form-item-content">
  50. <formInput v-model="form.inviteId"></formInput>
  51. </view>
  52. </uv-form-item>
  53. </view> -->
  54. </uv-form>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="bottom" v-if="!readonly">
  59. <view class="flex btn" @click="onSubmit">提交</view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import formInput from '@/pages_order/components/formInput.vue'
  65. export default {
  66. components: {
  67. formInput,
  68. },
  69. data() {
  70. return {
  71. advantages: ['收益高', '品类全', '到账快', '城市多'],
  72. form: {
  73. name: null,
  74. phone: null,
  75. // inviteId: null,
  76. },
  77. rules: {
  78. 'name': {
  79. type: 'string',
  80. required: true,
  81. message: '请输入姓名',
  82. },
  83. 'phone': {
  84. type: 'string',
  85. required: true,
  86. message: '请输入电话',
  87. },
  88. },
  89. formItemStyle: { padding: 0 },
  90. readonly: false,
  91. }
  92. },
  93. onLoad(arg) {
  94. const { readonly } = arg
  95. this.readonly = Boolean(parseInt(readonly))
  96. console.log('readonly', readonly, parseInt(readonly), this.readonly)
  97. this.fetchPartner()
  98. },
  99. methods: {
  100. async fetchPartner() {
  101. try {
  102. const result = await this.$fetch('queryPartner')
  103. const {
  104. name,
  105. phone,
  106. } = result || {}
  107. this.form = {
  108. name: name || null,
  109. phone: phone || null,
  110. }
  111. } catch (err) {
  112. }
  113. },
  114. async onSubmit() {
  115. try {
  116. await this.$refs.form.validate()
  117. const {
  118. name,
  119. phone,
  120. } = this.form
  121. const params = {
  122. name,
  123. phone,
  124. }
  125. await this.$fetch('applyPartner', params)
  126. uni.showToast({
  127. icon: 'success',
  128. title: '提交成功',
  129. });
  130. setTimeout(() => {
  131. this.$utils.navigateBack()
  132. }, 800)
  133. } catch (err) {
  134. console.log('onSave err', err)
  135. }
  136. },
  137. },
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. .page__view {
  142. min-height: 100vh;
  143. background: linear-gradient(to right, #21FEEC, #019AF9);
  144. /deep/ .nav-bar__view {
  145. position: fixed;
  146. top: 0;
  147. left: 0;
  148. }
  149. .icon-nav {
  150. width: 168rpx;
  151. height: auto;
  152. }
  153. }
  154. .main {
  155. // min-height: 100vh;
  156. // padding: calc(var(--status-bar-height) + 130rpx) 0 calc(120rpx + env(safe-area-inset-bottom)) 0;
  157. padding-top: calc(var(--status-bar-height) + 130rpx);
  158. box-sizing: border-box;
  159. }
  160. .advantage {
  161. padding: 0 40rpx 32rpx 40rpx;
  162. &-content {
  163. justify-content: space-between;
  164. padding: 16rpx;
  165. background: #1FB2FD99;
  166. border: 2rpx solid #FFFFFF4D;
  167. border-radius: 16rpx;
  168. }
  169. &-item {
  170. column-gap: 8rpx;
  171. padding-right: 16rpx;
  172. font-size: 26rpx;
  173. color: #FFFFFF;
  174. .icon {
  175. width: 40rpx;
  176. height: auto;
  177. }
  178. }
  179. }
  180. .card {
  181. width: 100%;
  182. // height: 100%;
  183. $advantage-height: 54px;
  184. // min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx) - (120rpx + env(safe-area-inset-bottom)));
  185. min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx));
  186. padding: 40rpx;
  187. box-sizing: border-box;
  188. font-family: PingFang SC;
  189. font-weight: 400;
  190. line-height: 1.4;
  191. background: linear-gradient(#DAF3FF, #FBFEFF 400rpx, #FBFEFF);
  192. border: 2rpx solid #FFFFFF;
  193. border-top-left-radius: 48rpx;
  194. border-top-right-radius: 48rpx;
  195. &-header {
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. font-size: 36rpx;
  199. line-height: 1.4;
  200. color: #191919;
  201. }
  202. }
  203. .form {
  204. &-item {
  205. margin-top: 32rpx;
  206. border-bottom: 2rpx solid #EEEEEE;
  207. &-label {
  208. font-family: PingFang SC;
  209. font-weight: 400;
  210. font-size: 26rpx;
  211. line-height: 1.4;
  212. color: #181818;
  213. .icon {
  214. margin-right: 8rpx;
  215. width: 16rpx;
  216. height: auto;
  217. }
  218. }
  219. &-content {
  220. }
  221. }
  222. }
  223. .bottom {
  224. position: fixed;
  225. left: 0;
  226. bottom: 0;
  227. width: 100vw;
  228. background: #FFFFFF;
  229. box-sizing: border-box;
  230. padding: 32rpx 40rpx;
  231. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  232. box-sizing: border-box;
  233. .btn {
  234. width: 100%;
  235. padding: 14rpx 0;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. font-size: 36rpx;
  239. line-height: 1.4;
  240. color: #FFFFFF;
  241. background: linear-gradient(to right, #21FEEC, #019AF9);
  242. border: 2rpx solid #00A9FF;
  243. border-radius: 41rpx;
  244. }
  245. }
  246. </style>