editpersonalinformation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <view class="content">
  3. <view class='content1'>
  4. <view style='padding:5px 0 10px;border-bottom:1px solid #eee;' class="flex width100">
  5. <view style='width:100px;font-size:14px;'>姓名</view>
  6. <view class="flex">
  7. <u--input placeholder="输入姓名" inputAlign='left' border="none" v-model="dataDetails.name">
  8. </u--input>
  9. </view>
  10. </view>
  11. <view style='padding:10px 0 5px;border-bottom:1px solid #eee;' class="flex width100">
  12. <view style='width:100px;font-size:14px;'>联系电话</view>
  13. <view class="flex">
  14. <u--input disabledColor='#fff' disabled placeholder="输入联系电话" inputAlign='left' border="none"
  15. v-model="dataDetails.phone">
  16. </u--input>
  17. </view>
  18. </view>
  19. <view class="flex row" style='padding:10px 0 5px;border-bottom:1px solid #eee;'>
  20. <view style='width:100px;font-size:14px;'>性别</view>
  21. <u-radio-group v-model="dataDetails.sex" placement="row">
  22. <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
  23. :label="item.name" :name="item.name" @change="radioChange">
  24. </u-radio>
  25. </u-radio-group>
  26. </view>
  27. <view class="flex row row-ch" style='padding:10px 0 5px;'>
  28. <view style='width:100px;font-size:14px;'>称呼</view>
  29. <u--input placeholder="输入姓氏" class="ch-style" inputAlign='left' border="none"
  30. v-model="dataDetails.call">
  31. </u--input>
  32. <view class="flex align-center" v-if="dataDetails.sex=='男'">先生</view>
  33. <view class="flex align-center" v-else>女士</view>
  34. </view>
  35. </view>
  36. <view class="content2 content-other">
  37. <view class="title">上传身份证人像面</view>
  38. <view @click.stop="uploadImg(1,index)" class="picture picture1" v-if="!dataDetails.cardAddressUrl">
  39. <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
  40. <view class="text">上传身份证人像面</view>
  41. </view>
  42. <view v-if="dataDetails.cardAddressUrl" @click.stop="uploadImg(1,index)" class="preview-card-img picture">
  43. <!-- <image class="card-img" :src="dataDetails.cardAddressUrl"></image> -->
  44. <!-- <view @click.stop="delCard(1)">
  45. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  46. </image>
  47. </view> -->
  48. <image class="" :src="dataDetails.cardAddressUrl" mode="aspectFit" style=""></image>
  49. </view>
  50. <view class="title">上传身份证国徽面</view>
  51. <view @click="uploadImg(2,index)" class="picture picture2" v-if="!dataDetails.cardBackAddressUrl">
  52. <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
  53. <view class="text">上传身份证国徽面</view>
  54. </view>
  55. <view v-if="dataDetails.cardBackAddressUrl" @click.stop="uploadImg(2,index)"
  56. class="preview-card-img picture">
  57. <!-- <image class="card-img" :src="dataDetails.cardAddressUrl"></image> -->
  58. <view @click.stop="delCard(2)">
  59. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  60. </image>
  61. </view>
  62. <image class="" :src="dataDetails.cardBackAddressUrl" mode="aspectFit"></image>
  63. </view>
  64. <view class="flex row">
  65. <view class="left-text">身份证号</view>
  66. <u--input placeholder="请输入身份证号" inputAlign='left' border="none" v-model="dataDetails.cardNumber">
  67. </u--input>
  68. </view>
  69. <view class="flex row noborder">
  70. <view class="left-text">身份证截止日期</view>
  71. <view style='font-size:16px;width:50%;' class='flex flex-space-between' @click="selectValidityPeriod">
  72. <view :style="{'color':dataDetails.cardValidityDate ? '#000':'#C6CBD5'}">
  73. {{dataDetails.cardValidityDate?dataDetails.cardValidityDate:'选择身份证截止日期'}}
  74. </view>
  75. <view>
  76. <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="bz">注:个人信息审核通过后自动认证成为个人货主。</view>
  81. <u-picker :show="isShowcardValidity" ref="uPicker" :columns="validityPeriod"
  82. @confirm="confirmValidityPeriod" @change="changeHandler" @cancel="isShowcardValidity=false">
  83. </u-picker>
  84. </view>
  85. <view class="content4">
  86. <view style='margin:0 0 18px;font-size:12px;color:#999;' class='flex items-center'>
  87. <u--image style='margin-right:5px;' @click='consent'
  88. :src="checked?'../../../static/mine/duihao@2x.png':'../../../static/mine/wxz.png'" width="12px"
  89. height="12px"></u--image>
  90. 我已阅读并同意全部细则
  91. </view>
  92. <view class='line'></view>
  93. <view class="next-btn" @click="submit()">
  94. 提交
  95. </view>
  96. </view>
  97. <!-- <view class="flex flex-space-between width100">
  98. <view>收款人</view>
  99. <view class="flex">
  100. <u--input placeholder="输入收款人姓名" inputAlign='right' border="none" v-model="dataDetails.name">
  101. </u--input>
  102. </view>
  103. </view> -->
  104. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  105. @select="imgTypeSelect" @cancel='isShowimgType=false' :closeOnClickOverlay="true" :closeOnClickAction="true"
  106. @close="isShowimgType=false">
  107. </u-action-sheet>
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. mapState
  113. } from 'vuex';
  114. import upload from '@/components/upload.vue';
  115. import uploadImage from '@/components/ossutil/uploadFile.js';
  116. var _this;
  117. export default {
  118. components: {},
  119. data() {
  120. return {
  121. radioCustomStyle: {
  122. margin: '0 0 0 20rpx'
  123. },
  124. radiolist1: [{
  125. name: '男',
  126. disabled: false
  127. },
  128. {
  129. name: '女',
  130. disabled: false
  131. },
  132. ],
  133. uploadType: '',
  134. isShowimgType: false,
  135. dataDetails: {
  136. name: '',
  137. phone: '',
  138. commonId: '',
  139. cardNumber: '',
  140. cardAddressUrl: '',
  141. cardBackAddressUrl: '',
  142. cardValidityDate: '',
  143. driverSex: '男'
  144. },
  145. checked: false,
  146. isShowcardValidity: false,
  147. imagesrc: '',
  148. validityPeriod: [],
  149. isShowimgType: false,
  150. index: '',
  151. };
  152. },
  153. onLoad(options) {debugger
  154. var _this = this;
  155. this.dataDetails = options
  156. this.validityPeriod = this.$helper.makeValidityPeriod(0, '长期')
  157. this.dataDetails.phone = this.userInfo.phone
  158. this.dataDetails.commonId = this.userInfo.id
  159. },
  160. computed: {
  161. ...mapState(['hasLogin', 'userInfo']),
  162. },
  163. methods: {
  164. consent() {
  165. this.checked = !this.checked
  166. },
  167. selectValidityPeriod() {
  168. this.isShowcardValidity = true
  169. },
  170. //设置图片
  171. setImage(e) {
  172. // debugger
  173. console.log(e);
  174. //显示在页面
  175. //this.imagesrc = e.path;
  176. if (e.dotype == 'idphoto') {
  177. _this.zjzClipper(e.path);
  178. } else if (e.dotype == 'watermark') {
  179. _this.watermark(e.path);
  180. } else {
  181. _this.savePhoto(e.path);
  182. }
  183. },
  184. //保存图片到相册,方便核查
  185. savePhoto(path) {
  186. // debugger
  187. this.imagesrc = path;
  188. uploadImage(path, 'appData/',
  189. result => {
  190. // 上传成功
  191. console.log('图片地址', result)
  192. }
  193. )
  194. //保存到相册
  195. // uni.saveImageToPhotosAlbum({
  196. // filePath: path,
  197. // success: () => {
  198. // uni.showToast({
  199. // title: '已保存至相册',
  200. // duration: 2000
  201. // });
  202. // }
  203. // });
  204. },
  205. changeHandler(e) {
  206. const {
  207. columnIndex,
  208. value,
  209. values,
  210. index,
  211. picker = this.$refs.uPicker
  212. } = e
  213. // if (columnIndex === 0) {
  214. // debugger
  215. // if (e.index != 0) {
  216. // picker.setColumnValues(1, this.validityPeriod[1].shift())
  217. // }
  218. // } else if (columnIndex === 1) {
  219. // if (e.index != 0) {
  220. // picker.setColumnValues(2, this.validityPeriod[2].shift())
  221. // }
  222. // }
  223. },
  224. confirmValidityPeriod(e) {
  225. console.log('confirm', e)
  226. if (e.value[0] == '长期') {
  227. this.dataDetails.cardValidityDate = e.value[0]
  228. } else {
  229. this.dataDetails.cardValidityDate = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  230. }
  231. this.isShowcardValidity = false
  232. },
  233. uploadImg(type, index) {
  234. this.uploadType = type
  235. this.isShowimgType = true
  236. this.index = index
  237. },
  238. submit() {
  239. uni.showLoading({
  240. title: '加载中',
  241. mask: true
  242. })
  243. var _this = this
  244. this.$request.baseRequest('post', '/cargoOwnerInfo/api/addCargoOwner', _this.dataDetails).then(res => {
  245. uni.hideLoading()
  246. uni.$u.toast('提交成功')
  247. uni.$u.route('/pages/mine/cargoowner/cargoowner')
  248. })
  249. .catch(res => {
  250. uni.hideLoading()
  251. uni.showToast({
  252. title: res.message,
  253. icon: 'none',
  254. duration: 2000
  255. })
  256. });
  257. },
  258. photograph() {
  259. console.log('拍照')
  260. let that = this;
  261. uni.chooseImage({
  262. count: 1,
  263. success: function(res) {
  264. console.log(JSON.stringify(res.tempFilePaths));
  265. uploadImage(res.tempFilePaths[0], 'appData/',
  266. result => {
  267. // 上传成功
  268. console.log('图片地址', result)
  269. }
  270. )
  271. }
  272. });
  273. },
  274. imgTypeSelect(val) {
  275. debugger
  276. let that = this
  277. console.log(val)
  278. console.log(this.uploadType)
  279. if (val.name == '相册') {
  280. uni.chooseImage({
  281. count: 1,
  282. sourceType: this.$helper.chooseImage.sourceType,
  283. success: function(res) {
  284. console.log(JSON.stringify(res.tempFilePaths));
  285. uploadImage(res.tempFilePaths[0], 'appData/',
  286. result => {
  287. // 上传成功回调函数
  288. console.log('图片地址', result)
  289. debugger
  290. switch (that.uploadType) {
  291. // 身份正面
  292. case 1:
  293. that.dataDetails.cardAddressUrl = result
  294. // 识别
  295. that.$request.baseRequest('get',
  296. '/driverInfo/personShibie', {
  297. personImg: result,
  298. }).then(res => {
  299. that.dataDetails.cardNumber = res.data.recPersonNo
  300. if (!that.dataDetails.name) {
  301. that.dataDetails.name = res.data.recPerson
  302. }
  303. })
  304. .catch(res => {
  305. uni.$u.toast(res.message);
  306. });
  307. break
  308. // 身份反面
  309. case 2:
  310. that.dataDetails.cardBackAddressUrl = result
  311. break
  312. }
  313. }
  314. )
  315. }
  316. });
  317. } else {
  318. switch (this.uploadType) {
  319. case 1:
  320. uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=idcardface');
  321. console.log('身份正面')
  322. break
  323. case 2:
  324. uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=badge');
  325. console.log('身份反面')
  326. break
  327. }
  328. }
  329. },
  330. //身份证正面
  331. getImgUrl1(src) {
  332. // console.log(src)
  333. // console.log('------------res-----------')
  334. // let that = this;
  335. // that.id[0] = src
  336. // that.id1 = src
  337. // that.certificates = false
  338. // that.personImgs.personImg = that.id[0]
  339. // that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  340. // .personImgs).then(res => {
  341. // if (res.data.data.recPerson != null) {
  342. // if (res.data.data.recPerson != "") {
  343. // that.$set(that.DriverViewInfo, 'driverName', res
  344. // .data.data.recPerson)
  345. // }
  346. // }
  347. // if (res.data.data.recPersonNo != null) {
  348. // if (res.data.data.recPersonNo != "") {
  349. // that.$set(that.DriverViewInfo, 'numberCard', res
  350. // .data.data.recPersonNo)
  351. // }
  352. // }
  353. // }).catch(res => {
  354. // uni.showToast({
  355. // title: res.data.message,
  356. // icon: 'none',
  357. // duration: 2000
  358. // })
  359. // })
  360. },
  361. },
  362. };
  363. </script>
  364. <style lang="scss" scoped>
  365. // .preview-card-img {
  366. // /deep/uni-image>div, uni-image>img {
  367. // transform: scale(1.5) rotate(-90deg);
  368. // }
  369. // }
  370. .picture {
  371. margin-top: 20rpx;
  372. background: #F5F6FA;
  373. width: 212rpx;
  374. height: 212rpx;
  375. border-radius: 20rpx;
  376. display: flex;
  377. flex-direction: column;
  378. justify-content: center;
  379. align-items: center;
  380. color: #6A7282;
  381. }
  382. .content1 {
  383. background: white;
  384. margin: 20rpx;
  385. padding: 20rpx;
  386. border-radius: 20rpx;
  387. .row-ch {
  388. padding-right: 180rpx;
  389. box-sizing: border-box;
  390. // background-color: red;
  391. }
  392. }
  393. .content2 {
  394. margin: 10px 0 95px 0;
  395. .left-text {
  396. // background: red;
  397. width: 290rpx;
  398. color: #333333;
  399. display: flex;
  400. align-items: center;
  401. font-size: 14px;
  402. }
  403. .row {
  404. border-bottom: 1px solid #EEEEEE;
  405. padding-bottom: 28rpx;
  406. margin-top: 26rpx;
  407. .ch-style {
  408. text-align: left;
  409. }
  410. }
  411. .row-ch {
  412. padding-right: 180rpx;
  413. box-sizing: border-box;
  414. // background-color: red;
  415. }
  416. }
  417. .content2,
  418. .content3 {
  419. .del-bank {
  420. position: absolute;
  421. top: 0;
  422. right: 0;
  423. width: 80rpx;
  424. height: 80rpx;
  425. }
  426. .picture {
  427. width: 100%;
  428. height: 440rpx;
  429. background: red;
  430. position: relative;
  431. .text {
  432. margin-top: 20rpx;
  433. }
  434. }
  435. .picture1 {
  436. background: url(../../../static/mine/zm.png);
  437. background-size: 100% 100%;
  438. }
  439. .picture2 {
  440. background: url(../../../static/mine/gh.png);
  441. background-size: 100% 100%;
  442. }
  443. .picture3 {
  444. background: url(../../../static/mine/yhkzm.png);
  445. background-size: 100% 100%;
  446. }
  447. .xj-image {
  448. width: 100rpx;
  449. height: 100rpx;
  450. }
  451. .title {
  452. color: #999999;
  453. margin: 20rpx 0;
  454. font-size: 14px;
  455. }
  456. }
  457. .u-input {
  458. font-size: 16px;
  459. }
  460. .content4 {
  461. position: fixed;
  462. bottom: 0;
  463. background: white;
  464. width: 100%;
  465. text-align: center;
  466. left: 0;
  467. box-sizing: border-box;
  468. ;
  469. padding: 10px 15px;
  470. .line {
  471. position: absolute;
  472. left: 0;
  473. margin-top: -9px;
  474. border-top: 1px solid #eee;
  475. width: 100%;
  476. }
  477. .next-btn {
  478. background: #2772FB;
  479. width: 85%;
  480. padding: 20rpx 20rpx;
  481. text-align: center;
  482. color: white;
  483. border-radius: 50rpx;
  484. margin: 0 auto;
  485. margin-top: 10px;
  486. }
  487. }
  488. .del-card {
  489. position: absolute;
  490. top: -10rpx;
  491. right: -6rpx;
  492. width: 80rpx;
  493. height: 80rpx;
  494. z-index: 9;
  495. }
  496. .bz{
  497. font-size: 28rpx;
  498. }
  499. </style>