applyMember.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="content">
  3. <view class="tab-wrapper">
  4. <view class="tab-item">
  5. <view class="itemx">
  6. <view class="item-tit">姓名:</view>
  7. <input type="text" v-model="name" placeholder="请输入您的姓名"/>
  8. </view>
  9. <view class="itemx">
  10. <view class="item-tit">推荐人编号:</view>
  11. <input type="text" v-model="speed_id" placeholder="请输入推荐人编号"/>
  12. </view>
  13. <view class="itemx">
  14. <view class="item-tit">联系方式:</view>
  15. <input type="text" v-model="phone" placeholder="请输入您的手机号"/>
  16. </view>
  17. <!-- <view class="itemx">
  18. <view class="item-tit">验证码:</view>
  19. <input type="text" v-model="code" placeholder="请输入验证码"/>
  20. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  21. </view> -->
  22. </view>
  23. </view>
  24. <view class="up-wrapper">
  25. 身份证正反面
  26. <view class="imgs">
  27. <view class="imgs-item">
  28. <image :src="sfzz" mode="" v-if="sfzz" @click.stop="upImg('sfzz')"></image>
  29. <image src="../../static/img/add.png" mode="" v-if="!sfzz" @click.stop="upImg('sfzz')"></image>
  30. </view>
  31. <view class="imgs-item">
  32. <image :src="sfzf" mode="" v-if="sfzf" @click.stop="upImg('sfzf')"></image>
  33. <image src="../../static/img/add.png" mode="" v-if="!sfzf" @click.stop="upImg('sfzf')"></image>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="sub-ts"></view>
  38. <view class="sub-wrapper" @click="sub">
  39. 提交申请
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { register, verify } from '@/api/login.js';
  45. import { upload ,enter} from '@/api/user.js';
  46. export default {
  47. data() {
  48. return {
  49. time: '', //保存倒计时对象
  50. countDown: 0,//倒计时
  51. isStep: 1,
  52. name: '',
  53. speed_id: '',
  54. phone: '',
  55. // code: '',
  56. sfzz: '', //身份证正面
  57. sfzf: '' //身份证反面
  58. }
  59. },
  60. watch:{
  61. countDown(i) {
  62. if (i == 0) {
  63. clearInterval(this.time);
  64. }
  65. }
  66. },
  67. methods: {
  68. //发送验证码
  69. verification() {
  70. let obj = this;
  71. if (this.phone == '') {
  72. this.$api.msg('请输入电话号码');
  73. return;
  74. }
  75. if (this.phone.length < 11) {
  76. this.$api.msg('请输入正确的手机号');
  77. return;
  78. }
  79. // 判断是否在倒计时
  80. if (obj.countDown > 0) {
  81. return false;
  82. } else {
  83. obj.countDown = 60;
  84. obj.time = setInterval(() => {
  85. obj.countDown--;
  86. }, 1000);
  87. //调用验证码接口
  88. verify({
  89. phone: obj.phone,
  90. type: 'register'
  91. })
  92. .then(({ data }) => {})
  93. .catch(err => {
  94. console.log(err);
  95. });
  96. }
  97. },
  98. //上传图片
  99. upImg(item) {
  100. let obj = this;
  101. upload({
  102. filename: ''
  103. }).then(res => {
  104. console.log(res[0].url);
  105. obj[item] = res[0].url
  106. }).catch( err => {
  107. console.log(err)
  108. })
  109. },
  110. //提交
  111. sub() {
  112. let obj = this
  113. if(obj.name == '') {
  114. obj.$api.msg('请输入姓名')
  115. return
  116. }
  117. if(obj.phone == '') {
  118. obj.$api.msg('请输入联系方式')
  119. return
  120. }
  121. if (this.phone.length < 11) {
  122. this.$api.msg('请输入正确的手机号');
  123. return;
  124. }
  125. // if(obj.code == '') {
  126. // obj.$api.msg('请输入验证码')
  127. // return
  128. // }
  129. if(obj.sfzz == '') {
  130. obj.$api.msg('请上传身份证证件照')
  131. return
  132. }
  133. if(obj.sfzf == '') {
  134. obj.$api.msg('请上传身份证证件照')
  135. return
  136. }
  137. let card_id = obj.sfzz + ',' + obj.sfzf
  138. uni.showLoading({
  139. title: '提交中...',
  140. mask: true
  141. })
  142. enter({
  143. type: 0,
  144. // merchant_name: obj.merchant_name,
  145. link_user: obj.name,
  146. link_tel: obj.phone,
  147. spread_uid: obj.speed_id,
  148. // charter: obj.yyzz,
  149. card_id: card_id
  150. }).then( res => {
  151. uni.hideLoading()
  152. uni.showToast({
  153. title: '提交成功',
  154. duration: 2000
  155. });
  156. setTimeout(()=> {
  157. uni.navigateBack({})
  158. },2000)
  159. console.log(res)
  160. }).catch( err => {
  161. uni.hideLoading()
  162. console.log(err)
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .tab-wrapper {
  170. padding: 20rpx 30rpx;
  171. background-color: #f2f3f5;
  172. .itemx {
  173. margin: 0 auto;
  174. width: 100%;
  175. background-color: #fff !important;
  176. height: 100rpx;
  177. display: flex;
  178. // width: 690px;
  179. border: 1px #f4f4f4 solid;
  180. .code {
  181. width: 150rpx;
  182. flex-shrink: 0;
  183. text-align: center;
  184. font-size: 28rpx;
  185. font-family: PingFang SC;
  186. font-weight: 500;
  187. color: #FF4C4C;
  188. line-height: 100rpx;
  189. }
  190. .item-tit {
  191. height: 100rpx;
  192. line-height: 100rpx;
  193. padding-left: 30rpx;
  194. width: 250rpx;
  195. font-size: 30rpx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #666666;
  199. flex-shrink: 0;
  200. }
  201. input {
  202. width: 440rpx;
  203. padding-right: 20rpx;
  204. height: 100rpx;
  205. line-height: 100rpx;
  206. font-size: 30rpx;
  207. font-family: PingFang SC;
  208. font-weight: 500;
  209. color: #333333;
  210. }
  211. }
  212. }
  213. .up-wrapper {
  214. margin: auto;
  215. padding: 38rpx 21rpx;
  216. width: 690rpx;
  217. // height: 250rpx;
  218. background: #ffffff;
  219. border-radius: 10rpx;
  220. font-size: 28rpx;
  221. font-family: PingFang SC;
  222. font-weight: 500;
  223. color: #333333;
  224. .imgs {
  225. padding: 27rpx 70rpx;
  226. display: flex;
  227. justify-content: space-around;
  228. .imgs-item {
  229. height: 160rpx;
  230. width: 160rpx;
  231. image {
  232. width: 100%;
  233. height: 100%;
  234. }
  235. }
  236. }
  237. }
  238. .sub-ts {
  239. height: 98rpx;
  240. }
  241. .sub-wrapper {
  242. width: 750rpx;
  243. height: 98rpx;
  244. position: fixed;
  245. bottom: 0;
  246. background: linear-gradient(180deg, #FD4646, #FF3535);
  247. text-align: center;
  248. line-height: 98rpx;
  249. font-size: 36rpx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #FFFFFF;
  253. }
  254. </style>