identity.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="identity main-bg">
  3. <u-form :model="form" ref="uForm" :rules="rules">
  4. <u-form-item
  5. :leftIconStyle="{color: '#2E4F1C', fontSize: '40rpx'}"
  6. left-icon="account-fill"
  7. label-width="180"
  8. :label-position="labelPosition"
  9. prop="veteransName">
  10. <u-input
  11. v-model="form.veteransName"
  12. placeholder-style="color: #2E4F1C;"
  13. placeholder="请输入您的姓名" />
  14. </u-form-item>
  15. <u-form-item
  16. prop="veteransIdcard"
  17. label-width="180"
  18. :label-position="labelPosition">
  19. <view class="form-item">
  20. <image src="../../../static/idcard.png" class="form-img"></image>
  21. <u-input
  22. v-model="form.veteransIdcard"
  23. placeholder-style="color: #2E4F1C;"
  24. placeholder="请输入您的身份证号码" />
  25. </view>
  26. </u-form-item>
  27. <u-form-item
  28. :leftIconStyle="{color: '#2E4F1C', fontSize: '40rpx'}"
  29. left-icon="phone-fill"
  30. label-width="180"
  31. :label-position="labelPosition"
  32. >
  33. <u-input
  34. v-model="form.veteransTel"
  35. placeholder-style="color: #2E4F1C;"
  36. placeholder="请输入您的手机号码" />
  37. </u-form-item>
  38. <u-form-item
  39. :leftIconStyle="{color: '#2E4F1C', fontSize: '40rpx'}"
  40. left-icon="calendar-fill"
  41. :label-position="labelPosition"
  42. prop="levelType"
  43. label-width="180">
  44. <u-input
  45. type="select"
  46. :select-open="selectShow"
  47. v-model="levelType"
  48. placeholder="请选择身份类别"
  49. placeholder-style="color: #2E4F1C;"
  50. @click="selectShow = true" />
  51. <u-select mode="single-column" :list="selectList" v-model="selectShow" @confirm="selectConfirm"></u-select>
  52. </u-form-item>
  53. <view class="store-dis">
  54. <view class="store-address">
  55. <view class="select-address">
  56. <view style="color: #303133;" class="font-twenty">
  57. 家庭住址
  58. </view>
  59. <u-input
  60. v-model="form.address"
  61. placeholder-style="color: #2E4F1C;"
  62. placeholder="请选择地址"/>
  63. </view>
  64. </view>
  65. <view class="map-icon" @click="chooseLocation()">
  66. <image src="/static/map.png" class="icon-img"></image>
  67. </view>
  68. </view>
  69. <view class="form-upload">
  70. <view class="upload-title font-twenty font-color2">
  71. 照片上传
  72. <view class="tips font-twenty font-color5">*省外必须上传</view>
  73. </view>
  74. <view style="display: flex;">
  75. <image :src="image(form.veteransPic)" v-if='flag' style="width:160rpx; height:160rpx"></image>
  76. <u-upload
  77. v-else
  78. width="160"
  79. height="160"
  80. :action="action"
  81. max-count="1"
  82. @on-success="onSuccess">
  83. </u-upload>
  84. </view>
  85. </view>
  86. </u-form>
  87. <view class="point font-color5">
  88. {{ string }}
  89. </view>
  90. <view class="btn1" v-if='flag'>
  91. <view v-if="type === '2'" class="form-submit form-submit-nei font-thirty">您已认证</view>
  92. <view v-else-if="type === '3'" class="form-submit11 form-submit-nei font-thirty">您是军属,无法认证</view>
  93. </view>
  94. <view v-else>
  95. <view class="font-twenty-two font-color2" style="text-align: center; padding-top: 25rpx;" @click="gotoDetails">请认真阅读平台服务协议《服务及隐私协议》使用平台</view>
  96. <view class="btn">
  97. <view @click="submit('1')" class="form-submit form-submit-nei font-thirty">省内认证</view>
  98. <view @click="submit('2')" class="form-submit form-submit-wai font-thirty">省外认证</view>
  99. </view>
  100. </view>
  101. <!-- <view class="btn">
  102. <view @click="submit('1')" class="form-submit form-submit-nei font-thirty">省内认证</view>
  103. <view @click="submit('2')" class="form-submit form-submit-wai font-thirty">省外认证</view>
  104. </view> -->
  105. <u-toast ref="uToast" />
  106. </view>
  107. </template>
  108. <script>
  109. import server from "@/api/index";
  110. import http from '@/common/http.js';
  111. import amap from '@/lib/amap-wx.130.js';
  112. export default {
  113. data() {
  114. return {
  115. action: http.webUrl+`/wx/common/upload`,
  116. labelPosition: 'left',
  117. selectShow: false,
  118. userInfo: null,
  119. flag: true,
  120. levelType: null,//身份
  121. type: '',
  122. addressName: '',
  123. key:'1dc63f21c12985e199a715faf4c02f36',
  124. form: {
  125. veteransName: '',
  126. veteransIdcard: '',
  127. veteransTel: '',
  128. veteransPic:'',
  129. level: null,
  130. address: ''
  131. },
  132. selectList: [],
  133. string: '备注:1.省内军人不需要上传照片(即输入姓名与身份证号,然后点击【省内认证】即可)2.省外需要上传相关凭证(即需要上传照片,然后点击【省外认证】即可',
  134. rules: {
  135. veteransName: [
  136. {
  137. required: true,
  138. message: '请输入您的姓名!',
  139. trigger: ['change','blur'],
  140. }
  141. ],
  142. veteransIdcard: [
  143. {
  144. required: true,
  145. message: '请输入您的身份证号码!',
  146. trigger: ['change','blur']
  147. },
  148. {
  149. validator: (rule, value, callback) => {
  150. return this.$u.test.idCard(value);
  151. },
  152. message: '身份证号码格式不正确',
  153. trigger: ['change','blur'],
  154. }
  155. ]
  156. }
  157. }
  158. },
  159. onLoad(e) {
  160. this.getUploadInfoFn();
  161. if(e.name){
  162. this.form.veteransName = e.name;
  163. this.form.veteransIdcard = e.pwd;
  164. this.flag = false
  165. }else if(e.id === '123'){
  166. this.flag = false
  167. }else{
  168. this.flag = true
  169. this.userInfo = uni.getStorageSync('userInfo');
  170. if(this.userInfo){
  171. if(this.userInfo.userId){
  172. this.getRegisterFn();
  173. this.type = this.userInfo.type;
  174. }
  175. }
  176. };
  177. this.amapPulgin = new amap.AMapWX({
  178. key: this.key
  179. });
  180. },
  181. onReady() {
  182. this.$refs.uForm.setRules(this.rules);
  183. },
  184. methods: {
  185. chooseLocation(e) {
  186. uni.chooseLocation({
  187. success: (res) => {
  188. this.form.address = res.address
  189. }
  190. })
  191. },
  192. image(e) {
  193. return http.webUrl + e
  194. },
  195. getUploadInfoFn(){
  196. server.getUploadInfo({dictType: 'basics_level'}).then(res =>{
  197. console.log("999[[[[]]]]",)
  198. if(res){
  199. res.forEach(item =>{
  200. this.selectList.push({
  201. label: item.dictLabel,
  202. value: item.dictValue,
  203. })
  204. })
  205. }
  206. })
  207. },
  208. // 选择商品类型回调
  209. selectConfirm(e) {
  210. this.form.level = '';
  211. this.levelType = null;
  212. e.map((val, index) => {
  213. this.form.level = val.value;
  214. this.levelType = val.label;
  215. })
  216. },
  217. getRegisterFn(){
  218. server.getRegister(this.userInfo.userId, this.userInfo.type).then(res =>{
  219. this.form = res
  220. })
  221. },
  222. onSuccess(data, index, lists, name){
  223. this.form.veteransPic = data.fileName
  224. },
  225. gotoDetails(){
  226. uni.navigateTo({
  227. url: '/pages/soldier/home/yxDetails'
  228. })
  229. },
  230. submit(type) {
  231. let _this = this;
  232. this.$refs.uForm.validate(valid => {
  233. if (valid) {
  234. if(type === '2'){
  235. console.log('red')
  236. if(_this.form.veteransPic === ''){
  237. this.$refs.uToast.show({
  238. title: '请上传图片!',
  239. type: 'default',
  240. })
  241. return
  242. }
  243. }
  244. this.getUserIdCardFn(type)
  245. } else {
  246. }
  247. });
  248. },
  249. getUserIdCardFn(type){
  250. let _this = this;
  251. let params = this.form;
  252. params.veteransStatus = "1";
  253. params.veteransType = type;
  254. console.log(this.form,']]]')
  255. server.getUserIdCard(params).then(res =>{
  256. _this.$refs.uToast.show({
  257. title: '提交认证成功,等待审核!',
  258. type: 'default',
  259. })
  260. setTimeout(function() {
  261. uni.navigateBack({
  262. delta: 1
  263. });
  264. }, 2000);
  265. })
  266. },
  267. }
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. /deep/ .u-form-item__message{
  272. padding-left: 50rpx!important;
  273. }
  274. /deep/ .u-input__input{
  275. color: #2E4F1C!important;
  276. font-size: 28rpx;
  277. font-family: PingFangSC-Regular, PingFang SC;
  278. font-weight: 400;
  279. }
  280. /deep/ .u-border, .u-border-bottom, .u-border-left, .u-border-right, .u-border-top, .u-border-top-bottom{
  281. }
  282. /deep/ .u-form-item{
  283. display: -webkit-box;
  284. display: -webkit-flex;
  285. display: flex;
  286. -webkit-box-orient: horizontal;
  287. -webkit-box-direction: normal;
  288. -webkit-flex-direction: row;
  289. flex-direction: row;
  290. box-sizing: border-box;
  291. line-height: 96rpx;
  292. -webkit-flex-direction: column;
  293. flex-direction: column;
  294. background: rgba(46, 79, 28, 0.05);
  295. border-radius: 48rpx;
  296. height: 96rpx;
  297. margin-bottom: 60rpx;
  298. padding-left: 30rpx!important;
  299. }
  300. .store-dis{
  301. display: flex;
  302. margin-bottom: 30rpx;
  303. .store-address{
  304. width: 580rpx;
  305. padding: 16rpx 30rpx;
  306. background: rgba(46, 79, 28, 0.05);
  307. border-radius: 48rpx 0rpx 0rpx 48rpx;
  308. .select-address{
  309. display: flex;
  310. align-items: center;
  311. justify-content: space-between;
  312. }
  313. }
  314. .map-icon{
  315. width: 110rpx;
  316. background: #2E4F1C;
  317. text-align: center;
  318. border-radius: 0rpx 48rpx 48rpx 0rpx;
  319. padding-top: 31rpx;
  320. .icon-img{
  321. width: 42rpx;
  322. height: 42rpx;
  323. }
  324. }
  325. }
  326. .identity{
  327. width: 100%;
  328. height: 100vh;
  329. padding: 60rpx 30rpx 10rpx;
  330. .form-item{
  331. display: flex;
  332. .form-img{
  333. width: 40rpx;
  334. height: 40rpx;
  335. padding-top: 15rpx;
  336. padding-right: 18rpx;
  337. }
  338. }
  339. .form-upload{
  340. width: 100%;
  341. height: 300rpx;
  342. background: rgba(46, 79, 28, 0.05);
  343. border-radius: 16rpx;
  344. padding-left: 30rpx;
  345. .upload-title{
  346. height: 100rpx;
  347. line-height: 100rpx;
  348. position: relative;
  349. .tips{
  350. position: absolute;
  351. top: 0rpx;
  352. right: 30rpx;
  353. text-align: right;
  354. }
  355. }
  356. }
  357. .point{
  358. padding-top: 40rpx;
  359. line-height: 48rpx;
  360. }
  361. .btn{
  362. display: flex;
  363. padding-top: 60rpx;
  364. justify-content: space-between;
  365. }
  366. .btn1{
  367. display: flex;
  368. padding-top: 60rpx;
  369. justify-content: center;
  370. }
  371. .form-submit{
  372. width: 330rpx;
  373. height: 96rpx;
  374. line-height: 96rpx;
  375. border-radius: 46rpx;
  376. text-align: center;
  377. font-weight: 600;
  378. }
  379. .form-submit11{
  380. width: 390rpx;
  381. height: 96rpx;
  382. line-height: 96rpx;
  383. border-radius: 46rpx;
  384. text-align: center;
  385. font-weight: 600;
  386. }
  387. .form-submit-nei{
  388. background: #2E4F1C;
  389. color: #FFFFFF;
  390. }
  391. .form-submit-wai{
  392. background: #FFF;
  393. color: #2E4F1C;
  394. border: 2rpx solid #2E4F1C;
  395. }
  396. }
  397. </style>