applyteam.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view>
  3. <public-module></public-module>
  4. <view class="box" :style="{background:`url(${indexBackgroundImage})`,backgroundSize: 'contain',backgroundRepeat: 'no-repeat'}">
  5. <view class="box-con">
  6. <uni-forms :rules="carRules" :value="personData" ref="personData" validate-trigger="bind"
  7. err-show-type="toast" label-width="100">
  8. <uni-forms-item label="姓名" required name="name">
  9. <input class="uni-input-input textColor" placeholder="输入姓名" v-model="personData.name"
  10. placeholder-style="font-size:28upx" />
  11. </uni-forms-item>
  12. <uni-forms-item label="手机号" required name="mobile">
  13. <input class="uni-input-input textColor" maxlength="11" placeholder="输入手机号" v-model="personData.mobile"
  14. placeholder-style="font-size:28upx" />
  15. </uni-forms-item>
  16. <uni-forms-item label="证件号" required name="identity">
  17. <input class="uni-input-input textColor" placeholder="输入证件号" v-model="personData.identity"
  18. placeholder-style="font-size:28upx" />
  19. </uni-forms-item>
  20. <uni-forms-item label="密码" required name="password">
  21. <input class="uni-input-input textColor" placeholder="输入密码" v-model="personData.password"
  22. placeholder-style="font-size:28upx" />
  23. </uni-forms-item>
  24. <uni-forms-item label="地址" required name="address">
  25. <input class="uni-input-input textColor" placeholder="输入地址" v-model="personData.address"
  26. placeholder-style="font-size:28upx" />
  27. </uni-forms-item>
  28. </uni-forms>
  29. </view>
  30. </view>
  31. <!-- <view class="box-con" style="margin-top:10px">
  32. <uni-forms :rules="carRules" :value="personData" ref="personData" validate-trigger="bind"
  33. err-show-type="toast" label-width="100">
  34. <uni-forms-item label="开户行">
  35. <input class="uni-input-input textColor" placeholder="输入开户行" v-model="personData.bankName"
  36. placeholder-style="font-size:28upx" />
  37. </uni-forms-item>
  38. <uni-forms-item label="开户账号">
  39. <input class="uni-input-input textColor" placeholder="输入开户账号" v-model="personData.accountno"
  40. placeholder-style="font-size:28upx" />
  41. </uni-forms-item>
  42. <view >
  43. <view>银行卡照片</view>
  44. <view class="dis j-c" >
  45. <image style="height: 95px;width: 150px;padding: 10px 0;" :src=" userfrontImg?userfrontImg:'/static/image/my/yinhangka.png'" mode=""
  46. @click="userfrontChange"></image>
  47. </view>
  48. </view>
  49. </uni-forms>
  50. </view> -->
  51. <view class="userBox" style="margin-top:10px">
  52. <text>身份证件照</text>
  53. <view class="dis j-s" style="margin: 10px 0;">
  54. <view class="imgOcr-border">
  55. <image :src=" userfrontImg?userfrontImg:'/static/image/my/shenfenzz.png'" mode=""
  56. @click="userfrontChange"></image>
  57. <view>人像面</view>
  58. </view>
  59. <view class="imgOcr-border">
  60. <image :src="userbackImg?userbackImg:'/static/image/my/shenzf.png'" mode=""
  61. @click="userbackChange"></image>
  62. <view>国徽面</view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- <view class="userBox">
  67. <u-checkbox v-model="checked"></u-checkbox>
  68. <text>同时创建我的团队</text>
  69. </view> -->
  70. <view class="submit" @click="submit()">
  71. 提交
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. // import {
  77. // mapState,
  78. // mapMutations
  79. // } from "vuex"
  80. // import store from '@/store';
  81. import indexBackgroundImage from "@/static/shenqing.png"
  82. export default {
  83. // computed: {
  84. // ...mapState(['userInfo', "userCheckInfo", ]),
  85. // },
  86. data(){
  87. return {
  88. indexBackgroundImage:indexBackgroundImage,
  89. checked:false,
  90. userfrontImg: "",
  91. userbackImg: "",
  92. personData:{
  93. name:'',
  94. mobile:'',
  95. identity:'',
  96. password:'',
  97. address:'',
  98. esmUserImageVo:[]
  99. },
  100. carRules: {
  101. name:{
  102. rules: [{
  103. required: true,
  104. errorMessage: '姓名不能为空'
  105. }]
  106. },
  107. mobile:{
  108. rules: [{
  109. required: true,
  110. errorMessage: '请输入手机号',
  111. },
  112. {
  113. pattern: /^1[3-9]\d{9}$/,
  114. errorMessage: '请输入正确的手机号',
  115. }]
  116. },
  117. identity:{
  118. rules: [{
  119. required: true,
  120. errorMessage: '请输入身份证号',
  121. },
  122. {
  123. 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)$/,
  124. errorMessage: '请输入正确的身份证号',
  125. }]
  126. },
  127. password:{
  128. rules: [{
  129. required: true,
  130. errorMessage: '请输入密码'
  131. }]
  132. },
  133. address:{
  134. rules: [{
  135. required: true,
  136. errorMessage: '请输入地址',
  137. }]
  138. },
  139. },
  140. userId:''
  141. }
  142. },
  143. async onLoad(e) {
  144. this.userId=e.userId?e.userId:''
  145. if(e.id){
  146. this.id=e.id
  147. this.$http.get('/user/' +e.id).then(res=>{
  148. if(res.code==200){
  149. this.personData={...res.data.sysUser,esmUserImageVo:[]}
  150. }
  151. else{
  152. uni.showModal({
  153. showCancel: false,
  154. title: res.msg
  155. })
  156. }
  157. })
  158. }
  159. },
  160. methods:{
  161. submit(){
  162. this.$refs.personData.validate().then(res => {
  163. if(this.id){
  164. this.$http.post('/user/updateUserInfo1/' +this.id, {
  165. esmUserImageVo: this.personData.esmUserImageVo,
  166. sysUser: this.personData,
  167. sysUserInfo:this.personData,
  168. }).then(res=>{
  169. if(res.code==200){
  170. let obj = JSON.stringify(res.data);
  171. uni.redirectTo({
  172. url: "/pages/index/result?data="+obj
  173. })
  174. }
  175. else{
  176. uni.showModal({
  177. showCancel: false,
  178. title: res.msg
  179. })
  180. }
  181. })
  182. }else{
  183. this.$http.post('/user/saveTeamLeader', {
  184. sysUser:{...this.personData,roleId:"21",referrerId:this.userId},
  185. esmUserImageVo:this.personData.esmUserImageVo
  186. }).then(res=>{
  187. if(res.code==200){
  188. let obj = JSON.stringify(res.data);
  189. uni.redirectTo({
  190. url: "/pages/index/result?data="+obj
  191. })
  192. }
  193. else{
  194. uni.showModal({
  195. showCancel: false,
  196. title: res.msg
  197. })
  198. }
  199. })
  200. }
  201. }).catch(err => {
  202. console.log('err', err);
  203. })
  204. },
  205. // submit(ref){
  206. // this.$refs[ref].validate().then(res => {
  207. // if(res){
  208. // this.$http.post('/user/saveTeamLeader', {
  209. // sysUser:{...this.personData,roleId:"21",referrerId:this.userInfo.sysUser.userId},
  210. // esmUserImageVo:this.personData.esmUserImageVo
  211. // }).then(res=>{
  212. // })
  213. // }
  214. // // if (data.code == '200') {
  215. // // }
  216. // }).catch(err => {
  217. // console.log('err', err);
  218. // })
  219. // },
  220. async userfrontChange() {
  221. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  222. count: 1,
  223. sizeType: ['compressed']
  224. });
  225. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  226. if (!size) {
  227. this.$refs.uToast.show({
  228. title: '上传图片大小不能超过 5MB!',
  229. type: 'error',
  230. })
  231. return false
  232. }
  233. if (chooseImageRes) {
  234. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  235. uni.uploadFile({
  236. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  237. filePath: chooseImageRes.tempFilePaths[0],
  238. name: "multipartFile",
  239. formData: {
  240. 'type': 'image',
  241. },
  242. // header: {
  243. // Authorization: store.state.token,
  244. // },
  245. success: (imgRes) => {
  246. let data = JSON.parse(imgRes.data);
  247. if (data.code == '200') {
  248. this.personData.esmUserImageVo.push(
  249. {
  250. imageId: data.data.id,
  251. type: "SFZ_01",
  252. }
  253. )
  254. }
  255. }
  256. });
  257. }
  258. },
  259. async userbackChange() {
  260. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  261. count: 1,
  262. sizeType: ['compressed']
  263. });
  264. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  265. if (!size) {
  266. this.$refs.uToast.show({
  267. title: '上传图片大小不能超过 5MB!',
  268. type: 'error',
  269. })
  270. return false
  271. }
  272. if (chooseImageRes) {
  273. this.userbackImg = chooseImageRes.tempFilePaths[0];
  274. uni.uploadFile({
  275. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  276. filePath: chooseImageRes.tempFilePaths[0],
  277. name: "multipartFile",
  278. formData: {
  279. 'type': 'image',
  280. },
  281. // header: {
  282. // Authorization: store.state.token,
  283. // },
  284. success: (imgRes) => {
  285. let data = JSON.parse(imgRes.data);
  286. if (data.code == '200') {
  287. this.personData.esmUserImageVo.push(
  288. {
  289. imageId: data.data.id,
  290. type: "SFZ_02",
  291. }
  292. )
  293. // this.personData.esmUserImageVo[1]=data.data
  294. }
  295. }
  296. });
  297. }
  298. },
  299. },
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. .box {
  304. height: 330px;
  305. width: 100%;
  306. background: #F9F9F9;
  307. background: url(/static/shenqing.png) no-repeat;
  308. background-size: contain;
  309. padding: 130px 15px 0 15px;
  310. // padding: 200px 16px 15px 16px;
  311. }
  312. .box-con{
  313. background: #FFFFFF;
  314. padding: 10px 15px;
  315. border-radius: 5px 5px 5px 5px;
  316. }
  317. .userBox{
  318. border-radius: 5px 5px 5px 5px;
  319. margin:10px 15px;
  320. padding: 10px 15px;
  321. background: #fff;
  322. font-size: 15px;
  323. color: #666666;
  324. .imgOcr-border {
  325. // position: relative;
  326. width: 48%;
  327. text-align: center;
  328. image {
  329. display: inline-block;
  330. height: 95px;
  331. width: 100%;
  332. }
  333. // .del_btn {
  334. // position: absolute;
  335. // cursor: pointer;
  336. // position: absolute;
  337. // top: 5rpx;
  338. // right: 0;
  339. // width: 50rpx;
  340. // height: 50rpx;
  341. // border-radius: 50%;
  342. // z-index: 20;
  343. // }
  344. }
  345. }
  346. .submit{
  347. margin: 15px;
  348. text-align: center;
  349. color: #fff;
  350. height: 46px;
  351. line-height: 46px;
  352. background: linear-gradient( 133deg, #2DD9FF 0%, #2D6DFF 100%);
  353. border-radius: 31px 31px 31px 31px;
  354. }
  355. </style>