index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <view class="deliveryOfVehicle">
  3. <view class="contentView">
  4. <view class="row">
  5. <view class="title">
  6. 接车人员
  7. </view>
  8. <view class="content">
  9. {{orderData.getName}}
  10. </view>
  11. </view>
  12. <view class="row">
  13. <view class="title">
  14. 联系电话
  15. </view>
  16. <view class="content">
  17. {{orderData.getPhone}}
  18. </view>
  19. </view>
  20. </view>
  21. <view class="videoBody">
  22. <view class="title">
  23. 全车视频
  24. </view>
  25. <image @click="chooseVideo" v-if="videoFilePath==''" :src="require('../../../../static/addVideo.png')"
  26. alt="">
  27. <view v-else class="videos">
  28. <image @click="delvideo()" class="uploadDelete"
  29. :src="require('../../../../static/uploadDelete.png')" alt="">
  30. <video class="uploadImg" :src="baseImagePath+videoFilePath"></video>
  31. </view>
  32. </view>
  33. <view class="upuploadImage">
  34. <view class="imgView" v-for="(item, index) in imgList" :key="index">
  35. <image @click="upload(index)" v-if="item.url==''" :src="item.imgBg" alt="">
  36. <view v-else class="imgs">
  37. <image @click="del(index)" class="uploadDelete"
  38. :src="require('../../../../static/uploadDelete.png')" alt="">
  39. <image class="uploadImg" :src="baseImagePath+item.url" alt="">
  40. </view>
  41. <view class="unit">
  42. <span>*</span>{{item.title}}
  43. </view>
  44. </view>
  45. </view>
  46. <view class="otherImg">
  47. <view class="imgView" v-for="(item, index) in otherImg" :key="index">
  48. <image @click="uploadOther(index)" v-if="item.url==''" :src="require('../../../../static/other.png')"
  49. alt="">
  50. <view v-else class="imgs">
  51. <image @click="delOther(index)" class="uploadDelete"
  52. :src="require('../../../../static/uploadDelete.png')" alt="">
  53. <image class="uploadImg" :src="baseImagePath+item.url" alt="">
  54. </view>
  55. <view class="unit">
  56. {{item.title}}
  57. </view>
  58. </view>
  59. </view>
  60. <view style="height: 218rpx;">
  61. </view>
  62. <view class="buttom">
  63. <view class="buttomBtn" @click="delivery">
  64. 确认提车
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. repairGetCar
  72. } from "@/api/maintain.js"
  73. export default {
  74. components: {},
  75. data() {
  76. return {
  77. baseImagePath: this.baseImagePath,
  78. otherImg: [{
  79. url: "",
  80. title: "其他1"
  81. }],
  82. imgList: [{
  83. title: "左前方",
  84. imgBg: require("../../../../static/zuoqianfang.png"),
  85. url: "",
  86. },
  87. {
  88. title: "左后方",
  89. imgBg: require("../../../../static/zuohoufang.png"),
  90. url: "",
  91. },
  92. {
  93. title: "右前方",
  94. imgBg: require("../../../../static/youqian.png"),
  95. url: "",
  96. },
  97. {
  98. title: "右后方",
  99. imgBg: require("../../../../static/youhou.png"),
  100. url: "",
  101. },
  102. {
  103. title: "里程表",
  104. imgBg: require("../../../../static/lichengbiao.png"),
  105. url: "",
  106. },
  107. {
  108. title: "交强险保单",
  109. imgBg: require("../../../../static/jiaoqiangxian.png"),
  110. url: "",
  111. },
  112. {
  113. title: "行驶证",
  114. imgBg: require("../../../../static/xingshizheng.png"),
  115. url: "",
  116. },
  117. ],
  118. videoFilePath: "",
  119. orderData: {},
  120. carVideo: "",
  121. }
  122. },
  123. onLoad(options) {
  124. this.orderData = JSON.parse(decodeURIComponent(options.data));
  125. },
  126. methods: {
  127. delivery() {
  128. if (this.imgList[0].url == "") {
  129. uni.showModal({
  130. title: '提示',
  131. showCancel:false,
  132. content: '请上传车辆左前方图片',
  133. success() {},
  134. complete() {
  135. }
  136. });
  137. return;
  138. }else if(this.imgList[1].url == ""){
  139. uni.showModal({
  140. title: '提示',
  141. showCancel:false,
  142. content: '请上传车辆左后方图片',
  143. success() {},
  144. complete() {
  145. }
  146. });
  147. return;
  148. }else if(this.imgList[2].url == ""){
  149. uni.showModal({
  150. title: '提示',
  151. showCancel:false,
  152. content: '请上传车辆右前方图片',
  153. success() {},
  154. complete() {
  155. }
  156. });
  157. return;
  158. }else if(this.imgList[3].url == ""){
  159. uni.showModal({
  160. title: '提示',
  161. showCancel:false,
  162. content: '请上传车辆右后方图片',
  163. success() {},
  164. complete() {
  165. }
  166. });
  167. return;
  168. }else if(this.imgList[4].url == ""){
  169. uni.showModal({
  170. title: '提示',
  171. showCancel:false,
  172. content: '请上传车辆里程表图片',
  173. success() {},
  174. complete() {
  175. }
  176. });
  177. return;
  178. }else if(this.imgList[5].url == ""){
  179. uni.showModal({
  180. title: '提示',
  181. showCancel:false,
  182. content: '请上传交强险保单图片',
  183. success() {},
  184. complete() {
  185. }
  186. });
  187. return;
  188. }else if(this.imgList[6].url == ""){
  189. uni.showModal({
  190. title: '提示',
  191. showCancel:false,
  192. content: '请上传车辆行驶证图片',
  193. success() {},
  194. complete() {
  195. }
  196. });
  197. return;
  198. }
  199. for (let index in this.otherImg) {
  200. if (this.carVideo == "") {
  201. this.carVideo = this.otherImg[index].url
  202. } else {
  203. this.carVideo = this.carVideo + "," + this.otherImg[index].url
  204. }
  205. }
  206. let data = {
  207. orderId: this.orderData.id,
  208. leftAnterior: this.imgList[0].url,
  209. leftRear: this.imgList[1].url,
  210. rightAnterior: this.imgList[2].url,
  211. rightRear: this.imgList[3].url,
  212. odometer: this.imgList[4].url,
  213. guaranteeSlip: this.imgList[5].url,
  214. drivingLicense: this.imgList[6].url,
  215. carVideo: this.carVideo,
  216. others: this.videoFilePath
  217. }
  218. repairGetCar(data).then((res) => {
  219. if (res.code == "00000") {
  220. uni.navigateBack({
  221. delta: 1
  222. })
  223. uni.$emit('deliveryOver', {
  224. data: "提车成功"
  225. })
  226. }
  227. })
  228. },
  229. uploadOther(index) {
  230. uni.chooseImage({
  231. count: 9, //默认9
  232. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  233. sourceType: ['album'], //从相册选择
  234. loop: true,
  235. success: res => {
  236. console.log(res);
  237. var tempFilePaths = res.tempFilePaths;
  238. var tempFiles = res.tempFiles;
  239. console.log(tempFilePaths);
  240. console.log(tempFilePaths[0]);
  241. uni.uploadFile({
  242. url: 'https://api.biaodianfuhao.net/api/common/sysFileInfo/upload',
  243. fileType: 'image',
  244. filePath: tempFilePaths[0],
  245. file: tempFiles[0],
  246. name: 'file',
  247. success: uploadFileRes => {
  248. console.log('上传图片', JSON.parse(uploadFileRes.data));
  249. this.otherImg[index].url = JSON.parse(uploadFileRes.data).data;
  250. if (this.otherImg.length < 4) {
  251. this.otherImg.push({
  252. url: "",
  253. title: "其他" + (parseInt(index) + 2)
  254. })
  255. }
  256. },
  257. fail(err) {
  258. console.log(err);
  259. }
  260. });
  261. }
  262. });
  263. },
  264. delOther(index) {
  265. this.otherImg.splice(index, 1);
  266. this.otherImg.forEach((res, index) => {
  267. this.otherImg[index].title = "其他" + (index + 1)
  268. })
  269. if (this.otherImg.length < 4) {
  270. this.otherImg.push({
  271. url: "",
  272. title: "其他" + (this.otherImg.length + 1)
  273. })
  274. }
  275. },
  276. upload(index) {
  277. uni.chooseImage({
  278. count: 9, //默认9
  279. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  280. sourceType: ['album'], //从相册选择
  281. loop: true,
  282. success: res => {
  283. console.log(res);
  284. var tempFilePaths = res.tempFilePaths;
  285. var tempFiles = res.tempFiles;
  286. console.log(tempFilePaths);
  287. console.log(tempFilePaths[0]);
  288. uni.uploadFile({
  289. url: 'https://api.biaodianfuhao.net/api/common/sysFileInfo/upload',
  290. fileType: 'image',
  291. filePath: tempFilePaths[0],
  292. file: tempFiles[0],
  293. name: 'file',
  294. success: uploadFileRes => {
  295. console.log('上传图片', JSON.parse(uploadFileRes.data));
  296. this.imgList[index].url = JSON.parse(uploadFileRes.data).data;
  297. },
  298. fail(err) {
  299. console.log(err);
  300. }
  301. });
  302. }
  303. });
  304. },
  305. del(index) {
  306. this.imgList[index].url = "";
  307. },
  308. chooseVideo() {
  309. // 上传视频
  310. uni.chooseVideo({
  311. maxDuration: 60,
  312. count: 1,
  313. camera: 'back',
  314. sourceType: ['album', 'camera'],
  315. success: (responent) => {
  316. let videoFile = responent.tempFile;
  317. uni.uploadFile({
  318. url: 'https://api.biaodianfuhao.net/api/common/sysFileInfo/upload',
  319. fileType: 'video',
  320. filePath: responent.tempFilePath,
  321. file: videoFile,
  322. name: 'file',
  323. success: uploadFileRes => {
  324. console.log('上传图片', JSON.parse(uploadFileRes.data));
  325. this.videoFilePath = JSON.parse(uploadFileRes.data).data;
  326. },
  327. fail(err) {
  328. console.log(err);
  329. }
  330. });
  331. // this.src = responent.tempFilePath; //头条
  332. }
  333. })
  334. },
  335. delvideo() {
  336. this.videoFilePath = "";
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="less">
  342. page {
  343. background: #F5F5F5;
  344. }
  345. .buttom {
  346. width: 100%;
  347. height: 170rpx;
  348. background: #FFFFFF;
  349. position: fixed;
  350. bottom: 0;
  351. .buttomBtn {
  352. width: 690rpx;
  353. height: 90rpx;
  354. background: linear-gradient(0deg, #008EFF 0%, #0036FF 100%);
  355. border-radius: 45rpx;
  356. margin: 30rpx;
  357. font-size: 32rpx;
  358. font-family: PingFang SC;
  359. font-weight: 500;
  360. color: #FFFFFF;
  361. line-height: 90rpx;
  362. text-align: center;
  363. }
  364. }
  365. .otherImg {
  366. width: 710rpx;
  367. height: 254rpx;
  368. background: #FFFFFF;
  369. border-radius: 10rpx;
  370. margin: 20rpx;
  371. display: flex;
  372. align-items: center;
  373. overflow-x: auto;
  374. .imgView {
  375. padding-left: 25rpx;
  376. image {
  377. width: 150rpx;
  378. height: 150rpx;
  379. }
  380. .imgs {
  381. position: relative;
  382. .uploadImg {
  383. width: 150rpx;
  384. height: 150rpx;
  385. border-radius: 10rpx;
  386. }
  387. .uploadDelete {
  388. width: 26rpx;
  389. height: 26rpx;
  390. border-radius: 0 8px 0 0;
  391. position: absolute;
  392. top: 0;
  393. right: 0;
  394. z-index: 9;
  395. }
  396. }
  397. .unit {
  398. font-size: 24rpx;
  399. font-family: PingFang SC;
  400. font-weight: 500;
  401. color: #333333;
  402. line-height: 24rpx;
  403. text-align: center;
  404. }
  405. }
  406. }
  407. .upuploadImage {
  408. width: 710rpx;
  409. height: 490rpx;
  410. background: #FFFFFF;
  411. border-radius: 10rpx;
  412. margin: 20rpx;
  413. display: flex;
  414. flex-wrap: wrap;
  415. align-items: center;
  416. .imgView {
  417. padding-left: 25rpx;
  418. image {
  419. width: 150rpx;
  420. height: 150rpx;
  421. }
  422. .imgs {
  423. position: relative;
  424. .uploadImg {
  425. width: 150rpx;
  426. height: 150rpx;
  427. border-radius: 10rpx;
  428. }
  429. .uploadDelete {
  430. width: 26rpx;
  431. height: 26rpx;
  432. border-radius: 0 8px 0 0;
  433. position: absolute;
  434. top: 0;
  435. right: 0;
  436. z-index: 9;
  437. }
  438. }
  439. .unit {
  440. font-size: 24rpx;
  441. font-family: PingFang SC;
  442. font-weight: 500;
  443. color: #333333;
  444. line-height: 24rpx;
  445. text-align: center;
  446. span {
  447. color: #FF5400;
  448. }
  449. }
  450. }
  451. }
  452. .contentView {
  453. width: 710rpx;
  454. height: 210rpx;
  455. background: #FFFFFF;
  456. border-radius: 10rpx;
  457. margin: 20rpx;
  458. .row {
  459. height: 100rpx;
  460. display: flex;
  461. align-items: center;
  462. margin: 0 30rpx 0 30rpx;
  463. .title {
  464. font-size: 28rpx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #666666;
  468. line-height: 55rpx;
  469. }
  470. .content {
  471. padding-left: 74rpx;
  472. font-size: 28rpx;
  473. font-family: PingFang SC;
  474. font-weight: 500;
  475. color: #333333;
  476. line-height: 55rpx;
  477. }
  478. }
  479. }
  480. .videoBody {
  481. margin: 20rpx;
  482. width: 710rpx;
  483. height: 196rpx;
  484. background: #FFFFFF;
  485. border-radius: 10rpx;
  486. display: flex;
  487. justify-content: space-between;
  488. .title {
  489. font-size: 28rpx;
  490. font-family: PingFang SC;
  491. font-weight: 500;
  492. color: #666666;
  493. line-height: 31rpx;
  494. padding: 30rpx 0 0 28rpx;
  495. }
  496. image {
  497. width: 150rpx;
  498. height: 150rpx;
  499. margin: 23rpx 25rpx 23rpx 0;
  500. }
  501. .videos {
  502. position: relative;
  503. .uploadDelete {
  504. width: 26rpx;
  505. height: 26rpx;
  506. border-radius: 0 8px 0 0;
  507. position: absolute;
  508. top: -18rpx;
  509. right: -6rpx;
  510. z-index: 9;
  511. }
  512. .uploadImg {
  513. width: 150rpx;
  514. height: 150rpx;
  515. background: #FFFFFF;
  516. border-radius: 8px;
  517. margin-right: 17rpx;
  518. margin-bottom: 21rpx;
  519. }
  520. }
  521. }
  522. </style>