index.vue 17 KB

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