editpersonalinformation.vue 13 KB

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