applypartner.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <public-module></public-module>
  4. <view class="box"
  5. :style="{background:`url(${indexBackgroundImage})`,backgroundSize: 'contain',backgroundRepeat: 'no-repeat'}">
  6. <view class="box-con">
  7. <uni-forms ref="personData" :rules="rules" :value="personData" label-width="100" validate-trigger="bind"
  8. err-show-type="toast">
  9. <uni-forms-item label="姓名" required name="name">
  10. <input class="uni-input-input textColor" placeholder="输入姓名" v-model="personData.name"
  11. placeholder-style="font-size:28upx" />
  12. </uni-forms-item>
  13. <uni-forms-item label="手机号" required name="mobile">
  14. <input class="uni-input-input textColor" maxlength="11" placeholder="输入手机号"
  15. v-model="personData.mobile" placeholder-style="font-size:28upx" />
  16. </uni-forms-item>
  17. <uni-forms-item label="证件号" required name="identity">
  18. <input class="uni-input-input textColor" placeholder="输入证件号" v-model="personData.identity"
  19. placeholder-style="font-·size:28upx" />
  20. </uni-forms-item>
  21. <uni-forms-item label="密码" required name="password">
  22. <input class="uni-input-input textColor" placeholder="输入密码" v-model="personData.password"
  23. placeholder-style="font-size:28upx" />
  24. </uni-forms-item>
  25. <uni-forms-item label="地址" required name="liveAddress">
  26. <input class="uni-input-input textColor" placeholder="输入地址" v-model="personData.liveAddress"
  27. placeholder-style="font-size:28upx" />
  28. </uni-forms-item>
  29. </uni-forms>
  30. </view>
  31. </view>
  32. <view class="userBox" style="margin-top:10px">
  33. <text>身份证件照</text>
  34. <view class="dis j-s" style="margin: 10px 0;">
  35. <view class="imgOcr-border">
  36. <image :src=" userfrontImg?userfrontImg:'/static/image/my/shenfenzz.png'" mode=""
  37. @click="userfrontChange"></image>
  38. <view>人像面</view>
  39. </view>
  40. <view class="imgOcr-border">
  41. <image :src="userbackImg?userbackImg:'/static/image/my/shenzf.png'" mode="" @click="userbackChange">
  42. </image>
  43. <view>国徽面</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="submit" @click="submit()">
  48. 提交
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import indexBackgroundImage from "@/static/shenqing.png"
  54. import {
  55. mapState,
  56. mapMutations
  57. } from "vuex"
  58. export default {
  59. data() {
  60. return {
  61. indexBackgroundImage: indexBackgroundImage,
  62. checked: false,
  63. userfrontImg: "",
  64. userbackImg: "",
  65. personData: {
  66. name: '',
  67. mobile: '',
  68. identity: '',
  69. password: '',
  70. liveAddress: '',
  71. sfz1: '',
  72. sfz2: '',
  73. },
  74. rules: {
  75. name: {
  76. rules: [{
  77. required: true,
  78. errorMessage: '姓名不能为空'
  79. }]
  80. },
  81. mobile: {
  82. rules: [{
  83. required: true,
  84. errorMessage: '请输入手机号',
  85. },
  86. {
  87. pattern: /^1[3-9]\d{9}$/,
  88. errorMessage: '请输入正确的手机号',
  89. }
  90. ]
  91. },
  92. identity: {
  93. rules: [{
  94. required: true,
  95. errorMessage: '请输入身份证号',
  96. },
  97. {
  98. pattern: /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
  99. errorMessage: '请输入正确的身份证号',
  100. }
  101. ]
  102. },
  103. password: {
  104. rules: [{
  105. required: true,
  106. errorMessage: '请输入密码'
  107. }]
  108. },
  109. liveAddress: {
  110. rules: [{
  111. required: true,
  112. errorMessage: '请输入地址',
  113. }]
  114. },
  115. },
  116. grade: '', //人员等级
  117. id: '',
  118. deptSource: null, //业务来源
  119. }
  120. },
  121. computed: {
  122. ...mapState(['userInfo', "userCheckInfo"]),
  123. },
  124. async onLoad(options) {
  125. this.grade = options.grade ? options.grade : '';
  126. this.id = options.userId ? options.userId : '';
  127. this.deptSource = options.deptSource ? options.deptSource : '';
  128. },
  129. methods: {
  130. //提交注册
  131. submit() {
  132. this.$refs.personData.submit().then(res => {
  133. this.$http.post('/userInfo/newSaveUserInfoByPartner', {
  134. ...this.personData,
  135. referrerId: this.id,
  136. grade: this.grade,
  137. ...(this.deptSource != null && {
  138. deptSource: this.deptSource
  139. }),
  140. }).then(res => {
  141. if (res.code == 200) {
  142. let obj = JSON.stringify({
  143. id: res.data.id,
  144. mobile: res.data.mobile,
  145. grade: this.grade,
  146. });
  147. uni.redirectTo({
  148. url: "/pages/index/success?data=" + obj
  149. })
  150. } else {
  151. uni.showModal({
  152. showCancel: false,
  153. title: res.msg
  154. })
  155. }
  156. })
  157. }).catch(err => {
  158. console.log('err', err);
  159. })
  160. },
  161. // 正面
  162. async userfrontChange() {
  163. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  164. count: 1,
  165. sizeType: ['compressed']
  166. });
  167. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  168. if (!size) {
  169. this.$refs.uToast.show({
  170. title: '上传图片大小不能超过 5MB!',
  171. type: 'error',
  172. })
  173. return false
  174. }
  175. if (chooseImageRes) {
  176. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  177. uni.uploadFile({
  178. url: this.$base.baseUrl + '/file/upload',
  179. filePath: chooseImageRes.tempFilePaths[0],
  180. name: "file",
  181. formData: {
  182. 'type': 'image',
  183. },
  184. // header: {
  185. // Authorization: store.state.token,
  186. // },
  187. success: (imgRes) => {
  188. let data = JSON.parse(imgRes.data);
  189. if (data.code == '200') {
  190. this.personData.sfz1 = data.data.id
  191. }
  192. }
  193. });
  194. }
  195. },
  196. //反面
  197. async userbackChange() {
  198. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  199. count: 1,
  200. sizeType: ['compressed']
  201. });
  202. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  203. if (!size) {
  204. this.$refs.uToast.show({
  205. title: '上传图片大小不能超过 5MB!',
  206. type: 'error',
  207. })
  208. return false
  209. }
  210. if (chooseImageRes) {
  211. this.userbackImg = chooseImageRes.tempFilePaths[0];
  212. uni.uploadFile({
  213. url: this.$base.baseUrl + '/file/upload',
  214. filePath: chooseImageRes.tempFilePaths[0],
  215. name: "file",
  216. formData: {
  217. 'type': 'image',
  218. },
  219. // header: {
  220. // Authorization: store.state.token,
  221. // },
  222. success: (imgRes) => {
  223. let data = JSON.parse(imgRes.data);
  224. if (data.code == '200') {
  225. this.personData.sfz2 = data.data.id
  226. }
  227. }
  228. });
  229. }
  230. },
  231. },
  232. }
  233. </script>
  234. <style lang="scss" scoped>
  235. .box {
  236. height: 330px;
  237. width: 100%;
  238. background: #F9F9F9;
  239. background: url(/static/image/my/shenqing.png) no-repeat;
  240. background-size: contain;
  241. padding: 130px 15px 0 15px;
  242. // padding: 200px 16px 15px 16px;
  243. }
  244. .box-con {
  245. background: #FFFFFF;
  246. padding: 10px 15px;
  247. border-radius: 5px 5px 5px 5px;
  248. }
  249. .userBox {
  250. border-radius: 5px 5px 5px 5px;
  251. margin: 10px 15px;
  252. padding: 10px 15px;
  253. background: #fff;
  254. font-size: 15px;
  255. color: #666666;
  256. .imgOcr-border {
  257. // position: relative;
  258. width: 48%;
  259. text-align: center;
  260. image {
  261. display: inline-block;
  262. height: 95px;
  263. width: 100%;
  264. }
  265. // .del_btn {
  266. // position: absolute;
  267. // cursor: pointer;
  268. // position: absolute;
  269. // top: 5rpx;
  270. // right: 0;
  271. // width: 50rpx;
  272. // height: 50rpx;
  273. // border-radius: 50%;
  274. // z-index: 20;
  275. // }
  276. }
  277. }
  278. .submit {
  279. margin: 15px;
  280. text-align: center;
  281. color: #fff;
  282. height: 46px;
  283. line-height: 46px;
  284. background: linear-gradient(133deg, #2DD9FF 0%, #2D6DFF 100%);
  285. border-radius: 31px 31px 31px 31px;
  286. }
  287. </style>