applypartner.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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="address">
  26. <input class="uni-input-input textColor" placeholder="输入地址" v-model="personData.address"
  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. address: '',
  71. esmUserImageVo: []
  72. },
  73. rules: {
  74. name: {
  75. rules: [{
  76. required: true,
  77. errorMessage: '姓名不能为空'
  78. }]
  79. },
  80. mobile: {
  81. rules: [{
  82. required: true,
  83. errorMessage: '请输入手机号',
  84. },
  85. {
  86. pattern: /^1[3-9]\d{9}$/,
  87. errorMessage: '请输入正确的手机号',
  88. }
  89. ]
  90. },
  91. identity: {
  92. rules: [{
  93. required: true,
  94. errorMessage: '请输入身份证号',
  95. },
  96. {
  97. 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)$/,
  98. errorMessage: '请输入正确的身份证号',
  99. }
  100. ]
  101. },
  102. password: {
  103. rules: [{
  104. required: true,
  105. errorMessage: '请输入密码'
  106. }]
  107. },
  108. address: {
  109. rules: [{
  110. required: true,
  111. errorMessage: '请输入地址',
  112. }]
  113. },
  114. },
  115. grade: '', //人员等级
  116. id: '',
  117. deptSource: null, //业务来源
  118. }
  119. },
  120. computed: {
  121. ...mapState(['userInfo', "userCheckInfo"]),
  122. },
  123. async onLoad(options) {
  124. this.grade = options.grade ? options.grade : '';
  125. this.id = options.userId ? options.userId : '';
  126. this.deptSource = options.deptSource ? options.deptSource : '';
  127. },
  128. methods: {
  129. //提交注册
  130. submit() {
  131. this.$refs.personData.submit().then(res => {
  132. this.$http.post('/user/newSaveUserInfoByPartner', {
  133. sysUser: {
  134. ...this.personData,
  135. roleId: this.grade == 4 ? "21" : "108",
  136. referrerId: this.id,
  137. grade: this.grade,
  138. ...(this.deptSource != null && {
  139. deptSource: this.deptSource
  140. }),
  141. },
  142. esmUserImageVo: this.personData.esmUserImageVo
  143. }).then(res => {
  144. if (res.code == 200) {
  145. let obj = JSON.stringify({
  146. id: res.data.id,
  147. mobile: res.data.mobile,
  148. grade: this.grade,
  149. });
  150. uni.redirectTo({
  151. url: "/pages/index/success?data=" + obj
  152. })
  153. } else {
  154. uni.showModal({
  155. showCancel: false,
  156. title: res.msg
  157. })
  158. }
  159. })
  160. }).catch(err => {
  161. console.log('err', err);
  162. })
  163. },
  164. async userfrontChange() {
  165. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  166. count: 1,
  167. sizeType: ['compressed']
  168. });
  169. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  170. if (!size) {
  171. this.$refs.uToast.show({
  172. title: '上传图片大小不能超过 5MB!',
  173. type: 'error',
  174. })
  175. return false
  176. }
  177. if (chooseImageRes) {
  178. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  179. uni.uploadFile({
  180. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  181. filePath: chooseImageRes.tempFilePaths[0],
  182. name: "multipartFile",
  183. formData: {
  184. 'type': 'image',
  185. },
  186. // header: {
  187. // Authorization: store.state.token,
  188. // },
  189. success: (imgRes) => {
  190. let data = JSON.parse(imgRes.data);
  191. if (data.code == '200') {
  192. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  193. this.personData.esmUserImageVo.map(val => {
  194. if (val.imageType == 'SFZ_01') {
  195. val.imageId = data.data.id;
  196. }
  197. })
  198. } else {
  199. this.personData.esmUserImageVo.push({
  200. imageId: data.data.id,
  201. type: "SFZ_01",
  202. })
  203. }
  204. }
  205. }
  206. });
  207. }
  208. },
  209. async userbackChange() {
  210. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  211. count: 1,
  212. sizeType: ['compressed']
  213. });
  214. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  215. if (!size) {
  216. this.$refs.uToast.show({
  217. title: '上传图片大小不能超过 5MB!',
  218. type: 'error',
  219. })
  220. return false
  221. }
  222. if (chooseImageRes) {
  223. this.userbackImg = chooseImageRes.tempFilePaths[0];
  224. uni.uploadFile({
  225. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  226. filePath: chooseImageRes.tempFilePaths[0],
  227. name: "multipartFile",
  228. formData: {
  229. 'type': 'image',
  230. },
  231. // header: {
  232. // Authorization: store.state.token,
  233. // },
  234. success: (imgRes) => {
  235. let data = JSON.parse(imgRes.data);
  236. if (data.code == '200') {
  237. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  238. this.personData.esmUserImageVo.map(val => {
  239. if (val.imageType == 'SFZ_02') {
  240. val.imageId = data.data.id;
  241. }
  242. })
  243. } else {
  244. this.personData.esmUserImageVo.push({
  245. imageId: data.data.id,
  246. type: "SFZ_02",
  247. })
  248. }
  249. }
  250. }
  251. });
  252. }
  253. },
  254. },
  255. }
  256. </script>
  257. <style lang="scss" scoped>
  258. .box {
  259. height: 330px;
  260. width: 100%;
  261. background: #F9F9F9;
  262. background: url(/static/image/my/shenqing.png) no-repeat;
  263. background-size: contain;
  264. padding: 130px 15px 0 15px;
  265. // padding: 200px 16px 15px 16px;
  266. }
  267. .box-con {
  268. background: #FFFFFF;
  269. padding: 10px 15px;
  270. border-radius: 5px 5px 5px 5px;
  271. }
  272. .userBox {
  273. border-radius: 5px 5px 5px 5px;
  274. margin: 10px 15px;
  275. padding: 10px 15px;
  276. background: #fff;
  277. font-size: 15px;
  278. color: #666666;
  279. .imgOcr-border {
  280. // position: relative;
  281. width: 48%;
  282. text-align: center;
  283. image {
  284. display: inline-block;
  285. height: 95px;
  286. width: 100%;
  287. }
  288. // .del_btn {
  289. // position: absolute;
  290. // cursor: pointer;
  291. // position: absolute;
  292. // top: 5rpx;
  293. // right: 0;
  294. // width: 50rpx;
  295. // height: 50rpx;
  296. // border-radius: 50%;
  297. // z-index: 20;
  298. // }
  299. }
  300. }
  301. .submit {
  302. margin: 15px;
  303. text-align: center;
  304. color: #fff;
  305. height: 46px;
  306. line-height: 46px;
  307. background: linear-gradient(133deg, #2DD9FF 0%, #2D6DFF 100%);
  308. border-radius: 31px 31px 31px 31px;
  309. }
  310. </style>