applypartner.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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" : "97",
  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. });
  149. uni.redirectTo({
  150. url: "/pages/index/success?data=" + obj
  151. })
  152. } else {
  153. uni.showModal({
  154. showCancel: false,
  155. title: res.msg
  156. })
  157. }
  158. })
  159. }).catch(err => {
  160. console.log('err', err);
  161. })
  162. },
  163. async userfrontChange() {
  164. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  165. count: 1,
  166. sizeType: ['compressed']
  167. });
  168. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  169. if (!size) {
  170. this.$refs.uToast.show({
  171. title: '上传图片大小不能超过 5MB!',
  172. type: 'error',
  173. })
  174. return false
  175. }
  176. if (chooseImageRes) {
  177. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  178. uni.uploadFile({
  179. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  180. filePath: chooseImageRes.tempFilePaths[0],
  181. name: "multipartFile",
  182. formData: {
  183. 'type': 'image',
  184. },
  185. // header: {
  186. // Authorization: store.state.token,
  187. // },
  188. success: (imgRes) => {
  189. let data = JSON.parse(imgRes.data);
  190. if (data.code == '200') {
  191. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  192. this.personData.esmUserImageVo.map(val => {
  193. if (val.imageType == 'SFZ_01') {
  194. val.imageId = data.data.id;
  195. }
  196. })
  197. } else {
  198. this.personData.esmUserImageVo.push({
  199. imageId: data.data.id,
  200. type: "SFZ_01",
  201. })
  202. }
  203. }
  204. }
  205. });
  206. }
  207. },
  208. async userbackChange() {
  209. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  210. count: 1,
  211. sizeType: ['compressed']
  212. });
  213. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  214. if (!size) {
  215. this.$refs.uToast.show({
  216. title: '上传图片大小不能超过 5MB!',
  217. type: 'error',
  218. })
  219. return false
  220. }
  221. if (chooseImageRes) {
  222. this.userbackImg = chooseImageRes.tempFilePaths[0];
  223. uni.uploadFile({
  224. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  225. filePath: chooseImageRes.tempFilePaths[0],
  226. name: "multipartFile",
  227. formData: {
  228. 'type': 'image',
  229. },
  230. // header: {
  231. // Authorization: store.state.token,
  232. // },
  233. success: (imgRes) => {
  234. let data = JSON.parse(imgRes.data);
  235. if (data.code == '200') {
  236. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  237. this.personData.esmUserImageVo.map(val => {
  238. if (val.imageType == 'SFZ_02') {
  239. val.imageId = data.data.id;
  240. }
  241. })
  242. } else {
  243. this.personData.esmUserImageVo.push({
  244. imageId: data.data.id,
  245. type: "SFZ_02",
  246. })
  247. }
  248. }
  249. }
  250. });
  251. }
  252. },
  253. },
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .box {
  258. height: 330px;
  259. width: 100%;
  260. background: #F9F9F9;
  261. background: url(/static/image/my/shenqing.png) no-repeat;
  262. background-size: contain;
  263. padding: 130px 15px 0 15px;
  264. // padding: 200px 16px 15px 16px;
  265. }
  266. .box-con {
  267. background: #FFFFFF;
  268. padding: 10px 15px;
  269. border-radius: 5px 5px 5px 5px;
  270. }
  271. .userBox {
  272. border-radius: 5px 5px 5px 5px;
  273. margin: 10px 15px;
  274. padding: 10px 15px;
  275. background: #fff;
  276. font-size: 15px;
  277. color: #666666;
  278. .imgOcr-border {
  279. // position: relative;
  280. width: 48%;
  281. text-align: center;
  282. image {
  283. display: inline-block;
  284. height: 95px;
  285. width: 100%;
  286. }
  287. // .del_btn {
  288. // position: absolute;
  289. // cursor: pointer;
  290. // position: absolute;
  291. // top: 5rpx;
  292. // right: 0;
  293. // width: 50rpx;
  294. // height: 50rpx;
  295. // border-radius: 50%;
  296. // z-index: 20;
  297. // }
  298. }
  299. }
  300. .submit {
  301. margin: 15px;
  302. text-align: center;
  303. color: #fff;
  304. height: 46px;
  305. line-height: 46px;
  306. background: linear-gradient(133deg, #2DD9FF 0%, #2D6DFF 100%);
  307. border-radius: 31px 31px 31px 31px;
  308. }
  309. </style>