applyMember.vue 6.1 KB

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