index.vue 17 KB

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