index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <view class="content">
  3. <view class="head-no a-blue">
  4. <text>订单号: {{formData.orderNo}}</text>
  5. </view>
  6. <view class="striping"></view>
  7. <view class="head a-blue" @click="telFun">
  8. <text>驾驶员: {{formData.driver1Name == null ? '' : formData.driver1Name}}&nbsp;{{formData.driver1mobile == null ? '' : formData.driver1mobile}}</text>
  9. </view>
  10. <!-- <u-collapse :value="['Declaration information']"> -->
  11. <u-collapse ref="xxxxxx111">
  12. <!-- <u-collapse-item title="报单信息" name="Declaration information"> -->
  13. <view class="box-box">
  14. <!-- <view class="box">
  15. <view class="data">
  16. <text class="key">装车吨位</text>
  17. <input class="value" :disabled="disabled" inputmode="decimal" @input="checkLoadQty"
  18. v-model="formData.loadQty" />
  19. </view>
  20. <view class="data">
  21. <text class="key-date">装车时间</text>
  22. <uni-datetime-picker class="value" :disabled="disabled"
  23. v-model="formData.loadDateString">{{formData.loadDateString == null ? "请选择日期" : formData.loadDateString }}</uni-datetime-picker>
  24. </view>
  25. </view> -->
  26. <view class="box-two">
  27. <text class="key">装车吨位</text>
  28. <input class="value-two" :disabled="disabled" inputmode="decimal" @input="checkLoadQty"
  29. v-model="formData.loadQty" />
  30. </view>
  31. <view class="box-two">
  32. <text class="key">装车时间</text>
  33. <uni-datetime-picker class="value-two" :disabled="disabled"
  34. v-model="formData.loadDateString">{{formData.loadDateString == null ? "请选择日期" : formData.loadDateString }}</uni-datetime-picker>
  35. </view>
  36. <!-- <view class="box">
  37. <view class="data">
  38. <text class="key">卸车吨位</text>
  39. <input class="value" :disabled="disabled" inputmode="decimal" @input="checkUnLoadQty"
  40. v-model="formData.unLoadQty" />
  41. </view>
  42. <view class="data">
  43. <text class="key-date">卸车时间</text>
  44. <uni-datetime-picker class="value" :disabled="disabled"
  45. v-model="formData.unLoadDateString">{{formData.unLoadDateString == null ? "请选择日期" : formData.unLoadDateString }}</uni-datetime-picker>
  46. </view>
  47. </view> -->
  48. <view class="box-two">
  49. <text class="key">卸车吨位</text>
  50. <input class="value-two" :disabled="disabled" inputmode="decimal" @input="checkUnLoadQty"
  51. v-model="formData.unLoadQty" />
  52. </view>
  53. <view class="box-two">
  54. <text class="key">卸车时间</text>
  55. <uni-datetime-picker class="value-two" :disabled="disabled"
  56. v-model="formData.unLoadDateString">{{formData.unLoadDateString == null ? "请选择日期" : formData.unLoadDateString }}</uni-datetime-picker>
  57. </view>
  58. <view class="box">
  59. <view class="data">
  60. <text class="key">空载起点</text>
  61. <input class="value" :disabled="disabled" v-model="formData.emptyaddr1" />
  62. </view>
  63. <view class="data">
  64. <text class="key">空车里程</text>
  65. <input class="value" :disabled="disabled" inputmode="decimal"
  66. v-model="formData.odometerstart" />
  67. </view>
  68. </view>
  69. <view class="box">
  70. <view class="data">
  71. <text class="key">空载终点</text>
  72. <input class="value" :disabled="disabled" v-model="formData.emptyaddr2" />
  73. </view>
  74. <view class="data">
  75. <text class="key">空车里程</text>
  76. <input class="value" :disabled="disabled" inputmode="decimal" v-model="formData.odometerend" />
  77. </view>
  78. </view>
  79. <view class="box-two">
  80. <text class="key">重车里程</text>
  81. <input class="value-two" :disabled="disabled" inputmode="decimal" @input="checkUnLoadmile"
  82. v-model="formData.loadmile" />
  83. </view>
  84. <view class="box-two">
  85. <text class="key">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</text>
  86. <input class="value-two" :disabled="disabled" v-model="formData.driverassdesc" />
  87. </view>
  88. </view>
  89. <!-- </u-collapse-item> -->
  90. <u-collapse-item title="照片" name="img" ref="collapseHeight">
  91. <!-- @afterRead="imgUploading" -->
  92. <u-upload :fileList="fileList1" @delete="deletePic" name="1" multiple :previewFullImage="true"
  93. :disabled="this.status317 == 2"></u-upload>
  94. </u-collapse-item>
  95. <u-collapse-item title="订单信息" name="order information">
  96. <view class="box-two textAlign">
  97. <text class="key">货物名称</text>
  98. <text class="value">{{formData.goodsCName == null ? "" : formData.goodsCName}}</text>
  99. </view>
  100. <view class="box-two textAlign">
  101. <text class="key">装车地点</text>
  102. <text class="value">{{formData.loadAddr == null ? "" : formData.loadAddr}}</text>
  103. </view>
  104. <view class="box-two textAlign">
  105. <text class="key">装车厂家</text>
  106. <text class="value">{{formData.loadFactory == null ? "" : formData.loadFactory}}</text>
  107. </view>
  108. <view class="box-two textAlign">
  109. <text class="key">联系人电话</text>
  110. <text
  111. class="value">{{formData.loadAttn == null ? "" : formData.loadAttn}}&nbsp;{{formData.loadAttnTel == null ? "" : formData.loadAttnTel}}</text>
  112. </view>
  113. <view class="box-two textAlign">
  114. <text class="key">卸车地点</text>
  115. <text class="value">{{formData.unLoadAddr == null ? "" : formData.unLoadAddr}}</text>
  116. </view>
  117. <view class="box-two textAlign">
  118. <text class="key">卸车厂家</text>
  119. <text class="value">{{formData.unLoadFactory == null ? "" : formData.unLoadFactory}}</text>
  120. </view>
  121. <view class="box-two textAlign">
  122. <text class="key">联系人电话</text>
  123. <text
  124. class="value">{{formData.unLoadAttn == null ? "" : formData.unLoadAttn}}&nbsp;{{formData.unLoadAttnTel == null ? "" : formData.unLoadAttnTel}}</text>
  125. </view>
  126. </u-collapse-item>
  127. </u-collapse>
  128. <view class="attention">
  129. <text class="text-grey1">请查看</text>
  130. <text @click="attention()" class="text-blue">注意事项</text>
  131. </view>
  132. <view class="cushion">
  133. </view>
  134. <view class="bottom vertical-layout">
  135. <view class="onsubmit-script" @click="setOrderBillsPlansByid()">
  136. <text v-if="status317 == 2">提交里程</text>
  137. <text v-if="status317 == 6 || status317 == 0">里程信息</text>
  138. </view>
  139. <view class="claim-expense" @click="skipClaimExpense()">
  140. <text v-if="status376 == 2">报销费用</text>
  141. <text v-if="status376 == 6 || status376 == 0">查看报销</text>
  142. </view>
  143. </view>
  144. <!-- 遮盖罩 -->
  145. <u-loading-page :loading="loading"></u-loading-page>
  146. <!-- 消息提示 -->
  147. <u-toast ref="uToast"></u-toast>
  148. <!-- 删除图片弹出框 -->
  149. <u-modal :show="deleteShow" title="提示" showCancelButton @confirm="deleteImg" @cancel="deleteShow = false">
  150. <view class="slot-content">
  151. <rich-text nodes="确定删除这张图片吗?"></rich-text>
  152. </view>
  153. </u-modal>
  154. </view>
  155. </template>
  156. <script>
  157. import {
  158. getOrderBillsPlansByid,
  159. putOrderBillsPlansByid,
  160. insertTmsAttachMngs,
  161. pictureUploading,
  162. deleteTmsAttachMngs
  163. } from "@/api/particulars"
  164. export default {
  165. data() {
  166. return {
  167. // 遮盖罩
  168. loading: true,
  169. formData: {},
  170. // 表单验证
  171. rules: {
  172. loadQty: '',
  173. loadDateString: '',
  174. unLoadQty: '',
  175. unLoadDateString: '',
  176. emptyaddr1: '',
  177. odometerstart: '',
  178. emptyaddr2: '',
  179. odometerend: '',
  180. loadmile: '',
  181. remarks: ''
  182. },
  183. orderNo: '',
  184. // 照片
  185. fileList1: [],
  186. // 删除弹框
  187. deleteShow: false,
  188. // 删除的图片
  189. event: {},
  190. // 输入框禁用
  191. disabled: false,
  192. status317: 0,
  193. status376: 0
  194. };
  195. },
  196. onLoad: function(option) {
  197. this.status317 = option.status317;
  198. this.status376 = option.status376;
  199. getOrderBillsPlansByid(option.orderNo).then(res => {
  200. this.orderNo = option.orderNo;
  201. this.formData = res.data;
  202. this.fileList1 = res.data.fileList1;
  203. this.loading = false;
  204. if (res.data.billStatus == 6) {
  205. this.disabled = true;
  206. }
  207. })
  208. },
  209. onUnload() {
  210. this.formData = {};
  211. this.loading = true;
  212. this.event = {};
  213. },
  214. methods: {
  215. // 保存订单
  216. setOrderBillsPlansByid(id) {
  217. // console.log(this.status317);
  218. if (this.status317 == 2) {
  219. if (this.formData.unLoadQty == '' || this.formData.unLoadQty == null) {
  220. this.$refs.uToast.show({
  221. type: 'warning',
  222. icon: false,
  223. message: "请输入卸车吨位!",
  224. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  225. })
  226. } else if (this.formData.unLoadDateString == '' || this.formData.unLoadDateString == null) {
  227. this.$refs.uToast.show({
  228. type: 'warning',
  229. icon: false,
  230. message: "请选择卸车时间!",
  231. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  232. })
  233. } else if (this.formData.loadmile == '' || this.formData.loadmile == null) {
  234. this.$refs.uToast.show({
  235. type: 'warning',
  236. icon: false,
  237. message: "请输入重车里程!",
  238. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  239. })
  240. } else {
  241. putOrderBillsPlansByid(this.formData).then(res => {
  242. if (res.code == 200) {
  243. // 保存成功弹窗提示
  244. this.$refs.uToast.show({
  245. type: 'success',
  246. message: "保存成功!",
  247. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  248. })
  249. } else {
  250. // 保存失败消息
  251. this.$refs.uToast.show({
  252. icon: false,
  253. message: "保存失败请重试!",
  254. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  255. })
  256. }
  257. })
  258. }
  259. } else {
  260. // this.$refs.uToast.show({
  261. // type: 'warning',
  262. // icon: false,
  263. // message: "不允许保存!",
  264. // iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  265. // })
  266. }
  267. },
  268. // 点击拨打电话
  269. telFun() {
  270. if (this.formData.driver1mobile != null && this.formData.driver1mobile != '') {
  271. uni.makePhoneCall({
  272. phoneNumber: this.formData.driver1mobile, //电话号码
  273. success: function(e) {
  274. // console.log(e);
  275. },
  276. fail: function(e) {
  277. // console.log(e);
  278. }
  279. })
  280. }
  281. },
  282. // 删除图片
  283. deletePic(event) {
  284. if (this.formData.status376 == 6) {
  285. this.$refs.uToast.show({
  286. type: 'warning',
  287. icon: false,
  288. message: "不允许修改!",
  289. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  290. })
  291. } else if (this.formData.status376 == 2) {
  292. this.event = event;
  293. this.deleteShow = true;
  294. }
  295. },
  296. deleteImg() {
  297. var event = this.event;
  298. var url = event.file.url;
  299. var index = url.lastIndexOf("\/");
  300. var attachId = url.substring(index + 1, url.length);
  301. deleteTmsAttachMngs(attachId).then(res => {
  302. if (res.code == 200) {
  303. this[`fileList${event.name}`].splice(event.index, 1)
  304. // 删除成功消息
  305. this.$refs.uToast.show({
  306. type: 'success',
  307. message: "删除成功!",
  308. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  309. })
  310. } else {
  311. // 删除失败消息
  312. this.$refs.uToast.show({
  313. icon: false,
  314. message: "删除失败请重试!",
  315. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  316. })
  317. }
  318. this.event = {};
  319. this.deleteShow = false;
  320. })
  321. },
  322. // 新增图片
  323. imgUploading(event) {
  324. this.$nextTick(() => {
  325. this.$refs.xxxxxx111.init()
  326. })
  327. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  328. let lists = [].concat(event.file)
  329. let fileListLen = this[`fileList${event.name}`].length
  330. lists.map((item) => {
  331. this[`fileList${event.name}`].push({
  332. ...item,
  333. status: 'uploading',
  334. message: '上传中'
  335. })
  336. })
  337. for (let i = 0; i < lists.length; i++) {
  338. insertTmsAttachMngs(this.formData).then(res => {
  339. if (res.code == 200) {
  340. let data = {
  341. name: 'avatarfile',
  342. filePath: lists[i].url
  343. }
  344. let dataForm = {
  345. attachId: res.data
  346. }
  347. pictureUploading(data, dataForm).then(res => {
  348. let item = this[`fileList${event.name}`][fileListLen]
  349. // console.log("item");
  350. // console.log(item);
  351. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(
  352. item, {
  353. status: 'success',
  354. message: '',
  355. url: res.data.data
  356. }))
  357. fileListLen++
  358. })
  359. }
  360. })
  361. }
  362. },
  363. uploadFilePromise(url) {
  364. insertTmsAttachMngs(this.formData).then(res => {
  365. if (res.code != 200) {
  366. return null;
  367. }
  368. let data = {
  369. name: 'avatarfile',
  370. filePath: url
  371. }
  372. let dataForm = {
  373. attachId: res.data
  374. }
  375. pictureUploading(data, dataForm).then(res => {
  376. return res.data.data;
  377. })
  378. })
  379. },
  380. // 跳转报销费用页面
  381. skipClaimExpense() {
  382. uni.navigateTo({
  383. url: '/pages/particulars/claimExpense/index?orderNo=' + this.orderNo + '&status376=' + this.status376,
  384. });
  385. },
  386. // 跳转注意事项
  387. attention() {
  388. uni.navigateTo({
  389. url: '/pages/particulars/attention/index?remarks=' + this.formData.remarks,
  390. });
  391. },
  392. //输入框小数
  393. checkLoadQty(e) {
  394. //正则表达试
  395. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  396. //重新赋值给input
  397. this.$nextTick(() => {
  398. this.formData.loadQty = e.target.value
  399. })
  400. },
  401. checkUnLoadQty(e) {
  402. //正则表达试
  403. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  404. //重新赋值给input
  405. this.$nextTick(() => {
  406. this.formData.unLoadQty = e.target.value
  407. })
  408. },
  409. checkUnLoadmile(e) {
  410. //正则表达试
  411. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  412. //重新赋值给input
  413. this.$nextTick(() => {
  414. this.formData.loadmile = e.target.value
  415. })
  416. }
  417. }
  418. }
  419. </script>
  420. <style lang="scss">
  421. // 修改布局方向为纵向布局
  422. .vertical-layout {
  423. display: flex;
  424. }
  425. .textAlign {
  426. text-align: right;
  427. // margin-left: 20rpx;
  428. }
  429. // 分割线
  430. .striping {
  431. width: 100%;
  432. height: 4rpx;
  433. background-color: #f0f0f0f0;
  434. }
  435. .box-box {
  436. padding-left: 30rpx;
  437. padding-right: 30rpx;
  438. }
  439. .a-blue {
  440. color: #3c9cff;
  441. }
  442. .content {
  443. // box-sizing: border-box;
  444. background-color: white;
  445. .head-no {
  446. // border-radius: 0 0 40rpx 40rpx;
  447. // width: 500rpx;
  448. height: 100rpx;
  449. padding-left: 30rpx;
  450. vertical-align: middle;
  451. display: table-cell;
  452. font-size: 34rpx;
  453. font-weight: 900;
  454. // background-color: #3c9cff;
  455. }
  456. .head {
  457. // width: 100%;
  458. height: 100rpx;
  459. padding-left: 30rpx;
  460. vertical-align: middle;
  461. display: table-cell;
  462. font-size: 34rpx;
  463. font-weight: 900;
  464. // background-color: red;
  465. }
  466. .box-two {
  467. color: #3b3b3b;
  468. overflow: hidden;
  469. height: 100rpx;
  470. // border-bottom: 2rpx solid #f0f0f0f0;
  471. padding-left: 20rpx;
  472. margin-right: 20rpx;
  473. font-size: 30rpx;
  474. display: flex;
  475. align-items: center;
  476. .key {
  477. display: inline-block;
  478. width: 24%;
  479. color: #3c9cff;
  480. // font-weight: 700;
  481. }
  482. .value {
  483. margin-left: 20rpx;
  484. // color: #787878;
  485. color: #3b3b3b;
  486. margin-right: 20rpx;
  487. }
  488. .value-two {
  489. width: calc(100% - 24%);
  490. color: #3b3b3b;
  491. // margin-right: 20rpx;
  492. border-bottom: 2rpx dotted #000;
  493. }
  494. }
  495. .box {
  496. color: #3b3b3b;
  497. overflow: hidden;
  498. height: 100rpx;
  499. // border-bottom: 2rpx solid #f0f0f0f0;
  500. padding-left: 20rpx;
  501. font-size: 30rpx;
  502. display: flex;
  503. align-items: center;
  504. .data {
  505. width: 50%;
  506. height: 100%;
  507. // background-color: pink;
  508. display: flex;
  509. align-items: center;
  510. .key {
  511. // background-color: indianred;
  512. width: 100%;
  513. color: #3c9cff;
  514. }
  515. .key-date {
  516. width: 40%;
  517. }
  518. .value {
  519. margin-right: 20rpx;
  520. border-bottom: 2rpx dotted #000;
  521. // color: rgb(144, 147, 153);
  522. color: #3b3b3b;
  523. }
  524. }
  525. }
  526. .bottom {
  527. position: fixed;
  528. bottom: calc(var(--window-bottom));
  529. width: 100%;
  530. height: 80rpx;
  531. background-color: pink;
  532. text-align: center;
  533. line-height: 80rpx;
  534. background-color: #f0f0f0f0;
  535. color: #f0f0f0f0;
  536. // font-weight: bold;
  537. font-size: 35rpx;
  538. .onsubmit-script {
  539. width: 50%;
  540. height: 100%;
  541. border-left: 2rpx solid #f0f0f0f0;
  542. border-right: 2rpx solid #f0f0f0f0;
  543. background-color: #0b68ffff;
  544. border-radius: 20rpx;
  545. }
  546. .claim-expense {
  547. width: 50%;
  548. height: 100%;
  549. border-left: 2rpx solid #f0f0f0f0;
  550. border-right: 2rpx solid #f0f0f0f0;
  551. background-color: #0b68ffff;
  552. border-radius: 20rpx;
  553. }
  554. .primary {
  555. background-color: #0b68ffff;
  556. }
  557. }
  558. .attention {
  559. padding: 30rpx;
  560. padding-left: 50rpx;
  561. padding-bottom: 40rpx;
  562. background-color: #f0f0f0f0;
  563. }
  564. .cushion {
  565. width: 100%;
  566. height: 104rpx;
  567. background-color: #f0f0f0f0;
  568. }
  569. }
  570. </style>