addVehicle.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. <!-- 管理车辆 -->
  2. <template>
  3. <view class="content">
  4. <view class="flex s-row container">
  5. <view class="flex row">
  6. <view class="left left-text">车牌号</view>
  7. <view class="right flex">
  8. <input class="car-uumber" v-model='dataDetails.carNumber' @click.stop="handleShowKeyboard(index)"
  9. :disabled="true" placeholder="输入车牌号" name="input"></input>
  10. </view>
  11. </view>
  12. <view class="flex row">
  13. <view class="left-text">车牌颜色</view>
  14. <view class="color" @click="selectNoColor">{{dataDetails.carNumberColour}}</view>
  15. <view>></view>
  16. <u-picker :show="carColor" :columns="colorColumns" :closeOnClickOverlay='true' @close='colorClose'
  17. @cancel='colorClose' @confirm='confirmColor' @change="changeCarModel"></u-picker>
  18. </view>
  19. <view class="flex row">
  20. <view class="left-text">车型</view>
  21. <view class="color" @click="selectCarModel">{{dataDetails.carType}}</view>
  22. <view>></view>
  23. <u-picker :show="carModel" :columns="carModelColumns" :closeOnClickOverlay='true' @close='carModelClose'
  24. @cancel='carModelClose' @confirm='confirmCarModel' @change="changeCarModel"></u-picker>
  25. </view>
  26. <view class="flex row">
  27. <view class="left-text">车辆所属车主</view>
  28. <u--input placeholder="输入车主姓名" inputAlign='left' border="none" v-model="dataDetails.owner">
  29. </u--input>
  30. </view>
  31. <view class="flex row">
  32. <view class="left-text">总质量(千克)</view>
  33. <u--input placeholder="输入总质量" inputAlign='left' border="none" v-model="dataDetails.carTotalWeight">
  34. </u--input>
  35. </view>
  36. <view class="flex row">
  37. <view class="left-text">核定载质量(千克)</view>
  38. <u--input placeholder="输入核定载质量" inputAlign='left' border="none" v-model="dataDetails.carApprovedWeight">
  39. </u--input>
  40. </view>
  41. <view class="flex row noborder">
  42. <view class="left-text">外廓尺寸</view>
  43. </view>
  44. <view class="flex row noborder input-ckg">
  45. <view class="input-positon">
  46. <u--input class="input" placeholder="长" inputAlign='left' border="none"
  47. v-model="dataDetails.carLong">
  48. </u--input>
  49. <view class="position-right">
  50. mm
  51. </view>
  52. </view>
  53. <view class="star">*</view>
  54. <view class="input-positon">
  55. <u--input placeholder="宽" inputAlign='left' border="none" v-model="dataDetails.carWidth">
  56. </u--input>
  57. <view class="position-right">
  58. mm
  59. </view>
  60. </view>
  61. <view class="star">*</view>
  62. <view class="input-positon">
  63. <u--input placeholder="高" inputAlign='left' border="none" v-model="dataDetails.carHeight">
  64. </u--input>
  65. <view class="position-right">
  66. mm
  67. </view>
  68. </view>
  69. </view>
  70. <view class="flex row noborder s-row">
  71. <view class="left-text" style="width: 100%;">人车合影(车头车牌号可见)</view>
  72. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  73. name="1" multiple :maxCount="1"></u-upload>
  74. </view>
  75. <view class="level1-title">证件信息</view>
  76. <view class="title">道路运输证</view>
  77. <view @click="uploadImg(8)" class="picture picture8" v-if="!dataDetails.operationCertificate">
  78. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  79. <view class="text">上传道路运输证</view>
  80. </view>
  81. <view v-if="dataDetails.operationCertificate" @click.stop="uploadImg(1)" class="preview-card-img picture">
  82. <view @click.stop="delCard(1)">
  83. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  84. </image>
  85. </view>
  86. <image class="" :src="dataDetails.operationCertificate" mode="aspectFit"></image>
  87. </view>
  88. <view class="flex row">
  89. <view class="left-text">道路运输证号</view>
  90. <u--input placeholder="输入道路运输证号" inputAlign='right' border="none"
  91. v-model="dataDetails.operationCertificateNumber">
  92. </u--input>
  93. </view>
  94. <view class="flex row flex-space-between">
  95. <view class="left-text">道路运输证有效期</view>
  96. <view class="" @click="selectValidityPeriod(4)">
  97. {{dataDetails.operationCertificateValidityDate?dataDetails.operationCertificateValidityDate:'选择有效期>'}}
  98. </view>
  99. </view>
  100. <view v-if="sign == '挂车'">
  101. <view class="title">挂车道路运输证</view>
  102. <view @click="uploadImg(9)" class="picture picture9" v-if="!dataDetails.trailerOperationCertificate">
  103. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  104. <view class="text">上传挂车道路运输证</view>
  105. </view>
  106. <view v-if="dataDetails.trailerOperationCertificate" @click.stop="uploadImg(1)"
  107. class="preview-card-img picture">
  108. <view @click.stop="delCard(1)">
  109. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  110. </image>
  111. </view>
  112. <image class="" :src="dataDetails.trailerOperationCertificate" mode="aspectFit"></image>
  113. </view>
  114. </view>
  115. <view class="flex row" v-if="sign == '挂车'">
  116. <view class="left-text">挂车道路运输证号</view>
  117. <u--input placeholder="输入挂车道路运输证号" inputAlign='right' border="none"
  118. v-model="dataDetails.trailerOperationCertificateNumber">
  119. </u--input>
  120. </view>
  121. <view class="flex row flex-space-between" v-if="sign == '挂车'">
  122. <view class="left-text">挂车道路运输证有效期</view>
  123. <view class="" @click="selectValidityPeriod(5)">
  124. {{dataDetails.trailerOperationCertificateValidityDate?dataDetails.trailerOperationCertificateValidityDate:'选择有效期>'}}
  125. </view>
  126. </view>
  127. <view class="title">上传行驶证主页</view>
  128. <view @click="uploadImg(3)" class="picture picture3" v-if="!dataDetails.drivingLicenseHomePage">
  129. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  130. <view class="text">上传行驶证主页</view>
  131. </view>
  132. <view v-if="dataDetails.drivingLicenseHomePage" @click.stop="uploadImg(1)" class="preview-card-img picture">
  133. <view @click.stop="delCard(1)">
  134. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  135. </image>
  136. </view>
  137. <image class="" :src="dataDetails.drivingLicenseHomePage" mode="aspectFit"></image>
  138. </view>
  139. <view class="title">上传行驶证副页</view>
  140. <view @click="uploadImg(4)" class="picture picture4" v-if="!dataDetails.drivingLicenseBackPage">
  141. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  142. <view class="text">上传行驶证副页</view>
  143. </view>
  144. <view v-if="dataDetails.drivingLicenseBackPage" @click.stop="uploadImg(1)" class="preview-card-img picture">
  145. <view @click.stop="delCard(1)">
  146. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  147. </image>
  148. </view>
  149. <image class="" :src="dataDetails.drivingLicenseBackPage" mode="aspectFit"></image>
  150. </view>
  151. <view class="flex row flex-space-between">
  152. <view class="left-text">行驶证档案编号</view>
  153. <u--input placeholder="输入行驶证档案编号" inputAlign='right' border="none"
  154. v-model="dataDetails.drivingLicenseNumber">
  155. </u--input>
  156. </view>
  157. <view class="flex row flex-space-between">
  158. <view class="left-text">行驶证有效期</view>
  159. <view class="" @click="selectValidityPeriod(1)">
  160. {{dataDetails.drivingLicenseValidityDate?dataDetails.drivingLicenseValidityDate:'选择有效截止日期>'}}
  161. </view>
  162. </view>
  163. <view class="" v-if="sign == '挂车'">
  164. <view class="title">挂车行驶证主页</view>
  165. <view @click="uploadImg(5)" class="picture picture5" v-if="!dataDetails.trailerLicenseHomePage">
  166. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  167. <view class="text">上传挂车行驶证主页</view>
  168. </view>
  169. <view v-if="dataDetails.trailerLicenseHomePage" @click.stop="uploadImg(1)"
  170. class="preview-card-img picture">
  171. <view @click.stop="delCard(1)">
  172. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  173. </image>
  174. </view>
  175. <image class="" :src="dataDetails.trailerLicenseHomePage" mode="aspectFit"></image>
  176. </view>
  177. </view>
  178. <view v-if="sign == '挂车'">
  179. <view class="title">挂车行驶证副页</view>
  180. <view @click="uploadImg(6)" class="picture picture6" v-if="!dataDetails.trailerLicenseBackPage">
  181. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  182. <view class="text">上传挂车行驶证副页</view>
  183. </view>
  184. <view v-if="dataDetails.trailerLicenseBackPage" @click.stop="uploadImg(1)"
  185. class="preview-card-img picture">
  186. <view @click.stop="delCard(1)">
  187. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  188. </image>
  189. </view>
  190. <image class="" :src="dataDetails.trailerLicenseBackPage" mode="aspectFit"></image>
  191. </view>
  192. </view>
  193. <view class="flex row">
  194. <view class="left-text">挂车行驶证档案编号</view>
  195. <u--input placeholder="输入挂车行驶证档案编号" inputAlign='right' border="none"
  196. v-model="dataDetails.trailerLicenseNumber">
  197. </u--input>
  198. </view>
  199. <view class="flex row flex-space-between" v-if="sign == '挂车'">
  200. <view class="left-text">挂车行驶证有效期</view>
  201. <view class="" @click="selectValidityPeriod(2)">
  202. {{dataDetails.trailerLicenseValidityDate?dataDetails.trailerLicenseValidityDate:'选择有效截止日期>'}}
  203. </view>
  204. </view>
  205. </view>
  206. <view class="submit-btn" @click="submit">提交</view>
  207. <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
  208. :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
  209. <u-toast ref="uToast"></u-toast>
  210. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  211. @select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
  212. </u-action-sheet>
  213. <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
  214. :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
  215. </u-picker>
  216. </view>
  217. </template>
  218. <script>
  219. import uploadImage from '@/components/ossutil/uploadFile.js';
  220. import keyboard from "@/components/master-keyboard/master-keyboard.vue";
  221. var _this;
  222. import {
  223. mapState
  224. } from 'vuex';
  225. export default {
  226. data() {
  227. return {
  228. index: '',
  229. keyShow: false,
  230. carNumber: '',
  231. dataDetails: {
  232. driverId: '',
  233. carNumber: '',
  234. carNumberColour: '黄色',
  235. carType: '挂车 高栏',
  236. carTotalWeight: '',
  237. carApprovedWeight: '',
  238. carLong: '',
  239. carWidth: '',
  240. carHeight: '',
  241. addressUrl: ''
  242. },
  243. carModelColumns: [
  244. ['挂车', '非挂车'],
  245. ['高栏', '集装箱', '自卸车']
  246. ],
  247. carModelColumnData: [
  248. ['高栏', '集装箱', '自卸车'],
  249. ['重型仓栏']
  250. ],
  251. colorColumns: [
  252. ['黄色', '蓝色']
  253. ],
  254. carColor: false,
  255. carModel: false,
  256. fileList1: [],
  257. ValidityPeriodType: "",
  258. validityPeriod: [],
  259. isShowValidity: false,
  260. uploadType: '',
  261. isShowimgType: false,
  262. sign: "挂车"
  263. };
  264. },
  265. computed: {
  266. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  267. },
  268. onLoad(options) {
  269. _this = this;
  270. this.dataDetails.driverId = this.userInfo.driverId
  271. this.validityPeriod = this.$helper.makeValidityPeriod()
  272. },
  273. methods: {
  274. delCard(type) {
  275. switch (type) {
  276. case 1:
  277. _this.dataDetails.driverLicenseHomePage = ""
  278. break;
  279. case 2:
  280. _this.dataDetails.driverLicenseBackPage = ""
  281. break;
  282. case 3:
  283. _this.dataDetails.drivingLicenseHomePage = ""
  284. break;
  285. case 4:
  286. _this.dataDetails.drivingLicenseBackPage = ""
  287. break;
  288. case 5:
  289. _this.dataDetails.trailerLicenseHomePage = ""
  290. break;
  291. case 6:
  292. _this.dataDetails.trailerLicenseBackPage = ""
  293. break;
  294. case 7:
  295. _this.dataDetails.qualificationCertificate = ""
  296. break;
  297. case 8:
  298. _this.dataDetails.operationCertificate = ""
  299. break;
  300. case 9:
  301. _this.dataDetails.trailerOperationCertificate = ""
  302. break;
  303. }
  304. },
  305. uploadImg(type) {
  306. this.uploadType = type
  307. this.isShowimgType = true
  308. },
  309. selectValidityPeriod(type) {
  310. this.ValidityPeriodType = type
  311. this.isShowValidity = true
  312. },
  313. // 上传图片
  314. imgTypeSelect(val) {
  315. console.log(val)
  316. console.log(this.uploadType)
  317. if (val.name == '相册') {
  318. uni.chooseImage({
  319. count: 1,
  320. sourceType: this.$helper.chooseImage.sourceType,
  321. success: function(res) {
  322. console.log(JSON.stringify(res.tempFilePaths));
  323. uploadImage("images", res.tempFilePaths[0], 'appData/',
  324. result => {
  325. // 上传成功回调函数
  326. console.log('图片地址-----', result)
  327. switch (_this.uploadType) {
  328. case 1:
  329. _this.dataDetails.driverLicenseHomePage = result
  330. break;
  331. case 2:
  332. _this.dataDetails.driverLicenseBackPage = result
  333. break;
  334. case 3:
  335. _this.dataDetails.drivingLicenseHomePage = result
  336. break;
  337. case 4:
  338. _this.dataDetails.drivingLicenseBackPage = result
  339. break;
  340. case 5:
  341. _this.dataDetails.trailerLicenseHomePage = result
  342. break;
  343. case 6:
  344. _this.dataDetails.trailerLicenseBackPage = result
  345. break;
  346. case 7:
  347. _this.dataDetails.qualificationCertificate = result
  348. break;
  349. case 8:
  350. _this.dataDetails.operationCertificate = result
  351. break;
  352. case 9:
  353. _this.dataDetails.trailerOperationCertificate = result
  354. break;
  355. }
  356. _this.$forceUpdate()
  357. }
  358. )
  359. }
  360. });
  361. } else {
  362. }
  363. },
  364. confirmValidityPeriod(e) {
  365. console.log('confirm', e)
  366. switch (this.ValidityPeriodType) {
  367. case 0:
  368. this.dataDetails.driverLicenseValidityDate = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  369. break
  370. case 1:
  371. this.dataDetails.drivingLicenseValidityDate = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  372. break
  373. case 2:
  374. this.dataDetails.trailerLicenseValidityDate = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
  375. break
  376. case 3:
  377. this.dataDetails.qualificationCertificateValidityDate = e.value[0] + '-' + e.value[1] + '-' + e
  378. .value[2]
  379. break
  380. case 4:
  381. this.dataDetails.operationCertificateValidityDate = e.value[0] + '-' + e.value[1] + '-' + e.value[
  382. 2]
  383. break
  384. case 5:
  385. this.dataDetails.trailerOperationCertificateValidityDate = e.value[0] + '-' + e.value[1] + '-' + e
  386. .value[2]
  387. break
  388. }
  389. this.isShowValidity = false
  390. },
  391. // 车型切换
  392. changeCarModel(e) {
  393. const {
  394. columnIndex,
  395. index,
  396. // 微信小程序无法将picker实例传出来,只能通过ref操作
  397. picker = this.$refs.carTypePicker
  398. } = e
  399. if (columnIndex === 0) {
  400. // 模拟网络请求
  401. picker.setColumnValues(1, this.carModelColumnData[index])
  402. }
  403. },
  404. // 删除图片
  405. deletePic(event) {
  406. this[`fileList${event.name}`].splice(event.index, 1)
  407. },
  408. // 新增图片
  409. async afterRead(event) {
  410. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  411. let lists = [].concat(event.file)
  412. let fileListLen = this[`fileList${event.name}`].length
  413. lists.map((item) => {
  414. this[`fileList${event.name}`].push({
  415. ...item,
  416. status: 'uploading',
  417. message: '上传中'
  418. })
  419. })
  420. for (let i = 0; i < lists.length; i++) {
  421. const result = await this.uploadFilePromise(lists[i].url)
  422. let item = this[`fileList${event.name}`][fileListLen]
  423. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  424. status: 'success',
  425. message: '',
  426. url: result
  427. }))
  428. fileListLen++
  429. }
  430. },
  431. uploadFilePromise(url) {
  432. uploadImage('image', url, 'appData/',
  433. result => {
  434. // 上传成功回调函数
  435. console.log('图片地址', result)
  436. if (!this.dataDetails.addressUrl) {
  437. this.dataDetails.addressUrl = result
  438. } else {
  439. this.dataDetails.addressUrl = this.dataDetails.addressUrl + ',' + result
  440. }
  441. }
  442. )
  443. },
  444. //车牌号弹出键盘
  445. handleShowKeyboard(index) {
  446. if (this.dataDetails.carNumber == '') {
  447. this.carNumber = ''
  448. } else {
  449. this.carNumber = this.dataDetails.carNumber
  450. }
  451. if (this.$refs.keyboard.open) {
  452. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  453. } else {
  454. this.$refs.keyboard[0].open(false)
  455. }
  456. this.index = index
  457. if (this.$refs.keyboard.open) {
  458. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  459. } else {
  460. this.$refs.keyboard[0].open(true)
  461. }
  462. },
  463. //车牌号弹出键盘
  464. handleClick(e) {
  465. this.carNumber = e.value
  466. this.dataDetails.carNumber = e.value //键盘输入值
  467. },
  468. confirmColor(val) {
  469. this.dataDetails.carNumberColour = val.value[0]
  470. this.carColor = false
  471. },
  472. colorClose() {
  473. this.carColor = false
  474. },
  475. selectNoColor() {
  476. this.carColor = true
  477. },
  478. confirmCarModel(val) {
  479. this.sign = val.value[0]
  480. this.dataDetails.carType = val.value[0] + ' ' + val.value[1]
  481. this.carModel = false
  482. },
  483. carModelClose() {
  484. this.carModel = false
  485. },
  486. selectCarModel() {
  487. this.carModel = true
  488. },
  489. selectNoColor() {
  490. this.carColor = true
  491. },
  492. unloadGroupPhoto() {
  493. uni.chooseImage({
  494. count: 1,
  495. success: function(res) {
  496. console.log(JSON.stringify(res.tempFilePaths));
  497. uploadImage('image', res.tempFilePaths[0], 'appData/',
  498. result => {
  499. // 上传成功
  500. console.log('图片地址', result)
  501. }
  502. )
  503. }
  504. });
  505. },
  506. validate() {
  507. // true 为校验不通过
  508. if (uni.$u.test.isEmpty(this.dataDetails.carNumber)) {
  509. this.$refs.uToast.show({
  510. type: 'error',
  511. message: "车牌号不能为空!",
  512. })
  513. return true
  514. }
  515. if (uni.$u.test.isEmpty(this.dataDetails.carTotalWeight)) {
  516. this.$refs.uToast.show({
  517. type: 'error',
  518. message: "总质量不能为空!",
  519. })
  520. return true
  521. }
  522. if (uni.$u.test.isEmpty(this.dataDetails.carApprovedWeight)) {
  523. this.$refs.uToast.show({
  524. type: 'error',
  525. message: "核定载质量不能为空!",
  526. })
  527. return true
  528. }
  529. if (uni.$u.test.isEmpty(this.dataDetails.carLong) && uni.$u.test.isEmpty(this.dataDetails.caWidth) && uni
  530. .$u.test.isEmpty(this.dataDetails.carHeight)) {
  531. this.$refs.uToast.show({
  532. type: 'error',
  533. message: "外廓尺寸不能为空!",
  534. })
  535. return true
  536. }
  537. if (uni.$u.test.isEmpty(this.dataDetails.operationCertificate)) {
  538. this.$refs.uToast.show({
  539. type: 'error',
  540. message: "道路运输证不能为空!",
  541. })
  542. return true
  543. }
  544. if (uni.$u.test.isEmpty(this.dataDetails.operationCertificateNumber)) {
  545. this.$refs.uToast.show({
  546. type: 'error',
  547. message: "道路运输证号不能为空!",
  548. })
  549. return true
  550. }
  551. if (uni.$u.test.isEmpty(this.dataDetails.operationCertificateValidityDate)) {
  552. this.$refs.uToast.show({
  553. type: 'error',
  554. message: "道路运输证有效期不能为空!",
  555. })
  556. return true
  557. }
  558. if(this.sign == '挂车'){
  559. if (uni.$u.test.isEmpty(this.dataDetails.trailerOperationCertificate)) {
  560. this.$refs.uToast.show({
  561. type: 'error',
  562. message: "挂车道路运输证不能为空!",
  563. })
  564. return true
  565. }
  566. if (uni.$u.test.isEmpty(this.dataDetails.trailerOperationCertificateNumber)) {
  567. this.$refs.uToast.show({
  568. type: 'error',
  569. message: "挂车道路运输证号不能为空!",
  570. })
  571. return true
  572. }
  573. if (uni.$u.test.isEmpty(this.dataDetails.trailerOperationCertificateValidityDate)) {
  574. this.$refs.uToast.show({
  575. type: 'error',
  576. message: "挂车道路运输证有效期不能为空!",
  577. })
  578. return true
  579. }
  580. }
  581. if (uni.$u.test.isEmpty(this.dataDetails.drivingLicenseHomePage)) {
  582. this.$refs.uToast.show({
  583. type: 'error',
  584. message: "行驶证主页不能为空!",
  585. })
  586. return true
  587. }
  588. if (uni.$u.test.isEmpty(this.dataDetails.drivingLicenseBackPage)) {
  589. this.$refs.uToast.show({
  590. type: 'error',
  591. message: "行驶证副页不能为空!",
  592. })
  593. return true
  594. }
  595. if (uni.$u.test.isEmpty(this.dataDetails.drivingLicenseNumber)) {
  596. this.$refs.uToast.show({
  597. type: 'error',
  598. message: "行驶证档案编号不能为空!",
  599. })
  600. return true
  601. }
  602. if (uni.$u.test.isEmpty(this.dataDetails.drivingLicenseValidityDate)) {
  603. this.$refs.uToast.show({
  604. type: 'error',
  605. message: "行驶证有效期不能为空!",
  606. })
  607. return true
  608. }
  609. if (this.sign == '挂车') {
  610. if (uni.$u.test.isEmpty(this.dataDetails.trailerLicenseHomePage)) {
  611. this.$refs.uToast.show({
  612. type: 'error',
  613. message: "挂车行驶证主页不能为空!",
  614. })
  615. return true
  616. }
  617. if (uni.$u.test.isEmpty(this.dataDetails.trailerLicenseBackPage)) {
  618. this.$refs.uToast.show({
  619. type: 'error',
  620. message: "挂车行驶证副页不能为空!",
  621. })
  622. return true
  623. }
  624. if (uni.$u.test.isEmpty(this.dataDetails.trailerLicenseNumber)) {
  625. this.$refs.uToast.show({
  626. type: 'error',
  627. message: "挂车行驶证档案编号不能为空!",
  628. })
  629. return true
  630. }
  631. if (uni.$u.test.isEmpty(this.dataDetails.trailerLicenseValidityDate)) {
  632. this.$refs.uToast.show({
  633. type: 'error',
  634. message: "挂车行驶证有效期不能为空!",
  635. })
  636. return true
  637. }
  638. }
  639. return false
  640. },
  641. submit() {
  642. this.dataDetails.driverId = uni.getStorageSync("firstAuthentication").id
  643. // 校验
  644. if (this.validate()) return
  645. this.$request.baseRequest('post', '/driverCarInfo/api/addInfo', this.dataDetails).then(res => {
  646. if (res.code == '200') {
  647. this.$refs.uToast.show({
  648. type: 'success',
  649. message: "提交成功!",
  650. complete() {
  651. // uni.navigateBack({
  652. // delta: 1
  653. // });
  654. uni.$u.route('/pages/mine/manageVehicles/index');
  655. }
  656. })
  657. // this.$refs.uToast.show({
  658. // ...params
  659. // })
  660. // uni.$u.route('/pages/mine/manageVehicles/index');
  661. } else {
  662. uni.$u.toast(res.message);
  663. }
  664. })
  665. .catch(res => {
  666. uni.$u.toast(res.message);
  667. });
  668. },
  669. },
  670. }
  671. </script>
  672. <style lang="scss" scoped>
  673. .container {
  674. margin: 20rpx;
  675. background: white;
  676. padding: 0 20rpx;
  677. border-radius: 20rpx;
  678. padding-bottom: 200rpx;
  679. .left-text {
  680. // background: red;
  681. width: 290rpx;
  682. color: #333333;
  683. display: flex;
  684. align-items: center;
  685. }
  686. .row {
  687. border-bottom: 1px solid #EEEEEE;
  688. padding-bottom: 28rpx;
  689. margin-top: 26rpx;
  690. .ch-style {}
  691. }
  692. .row-ch {
  693. padding-right: 250rpx;
  694. box-sizing: border-box;
  695. }
  696. .row {
  697. border-bottom: 1px solid #EEEEEE;
  698. padding-bottom: 28rpx;
  699. margin-top: 26rpx;
  700. }
  701. .left-text {
  702. // background: red;
  703. width: 320rpx;
  704. color: #333333;
  705. display: flex;
  706. align-items: center;
  707. }
  708. .picture {
  709. position: relative;
  710. width: 100%;
  711. height: 440rpx;
  712. display: flex;
  713. justify-content: center;
  714. flex-direction: column;
  715. align-items: center;
  716. .text {
  717. margin-top: 20rpx;
  718. }
  719. }
  720. .picture1 {
  721. background: url(../../../static/images/mine/jzz.png);
  722. background-size: 100% 100%;
  723. }
  724. .picture2 {
  725. background: url(../../../static/images/mine/jzf.png);
  726. background-size: 100% 100%;
  727. }
  728. .picture3 {
  729. background: url(../../../static/images/mine/xsz.png);
  730. background-size: 100% 100%;
  731. }
  732. .picture4 {
  733. background: url(../../../static/images/mine/xsf.png);
  734. background-size: 100% 100%;
  735. }
  736. .picture5 {
  737. background: url(../../../static/images/mine/gcxsz.png);
  738. background-size: 100% 100%;
  739. }
  740. .picture6 {
  741. background: url(../../../static/images/mine/gcxsf.png);
  742. background-size: 100% 100%;
  743. }
  744. .picture7 {
  745. background: url(../../../static/images/mine/cy.png);
  746. background-size: 100% 100%;
  747. }
  748. .picture8 {
  749. background: url(../../../static/images/mine/cy.png);
  750. background-size: 100% 100%;
  751. }
  752. .picture9 {
  753. background: url(../../../static/images/mine/cy.png);
  754. background-size: 100% 100%;
  755. }
  756. .xj-image {
  757. width: 100rpx;
  758. height: 100rpx;
  759. }
  760. .title {
  761. color: #999999;
  762. margin: 20rpx 0;
  763. }
  764. }
  765. .input-ckg {
  766. height: 86rpx;
  767. margin-top: 0 !important;
  768. padding-bottom: 0 !important;
  769. .u-input {
  770. height: 100%;
  771. background: #F7F8FA;
  772. padding-left: 10rpx !important;
  773. padding-right: 85rpx !important;
  774. }
  775. .star {
  776. display: flex;
  777. align-items: center;
  778. margin: 0 10rpx;
  779. }
  780. .input-positon {
  781. position: relative;
  782. }
  783. .position-right {
  784. position: absolute;
  785. right: 20rpx;
  786. top: 0;
  787. width: 60rpx;
  788. height: 50rpx;
  789. bottom: 0;
  790. margin: auto;
  791. }
  792. }
  793. .picture {
  794. margin-top: 20rpx;
  795. background: #F5F6FA;
  796. width: 212rpx;
  797. height: 212rpx;
  798. border-radius: 10rpx;
  799. display: flex;
  800. flex-direction: column;
  801. justify-content: center;
  802. align-items: center;
  803. color: #6A7282;
  804. }
  805. .submit-btn {
  806. position: fixed;
  807. bottom: 40rpx;
  808. width: 90%;
  809. background: #2772FB;
  810. color: white;
  811. text-align: center;
  812. margin-left: 5%;
  813. padding: 30rpx 0;
  814. border-radius: 50rpx;
  815. }
  816. .del-card {
  817. position: absolute;
  818. top: -10rpx;
  819. right: -6rpx;
  820. width: 80rpx;
  821. height: 80rpx;
  822. z-index: 9;
  823. }
  824. </style>