index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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" 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" selection-start="0" selection-end="9999" :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" selection-start="0" selection-end="9999" :disabled="disabled" v-model="formData.emptyaddr1" />
  64. </view>
  65. <view class="data">
  66. <text class="key">空车里程</text>
  67. <input class="value" selection-start="0" selection-end="9999" :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" selection-start="0" selection-end="9999" :disabled="disabled" v-model="formData.emptyaddr2" />
  75. </view>
  76. <view class="data">
  77. <text class="key">空车里程</text>
  78. <input class="value" selection-start="0" selection-end="9999" :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" selection-start="0" selection-end="9999" :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" selection-start="0" selection-end="9999" :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" @afterRead="imgUploading" @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. import {
  167. getGasStations,
  168. getItems,
  169. insertLoadFeeItems,
  170. getLoadFeeItems
  171. } from "@/api/reimbursement"
  172. export default {
  173. data() {
  174. return {
  175. // 遮盖罩
  176. loading: true,
  177. formData: {},
  178. // 表单验证
  179. rules: {
  180. loadQty: '',
  181. loadDateString: '',
  182. unLoadQty: '',
  183. unLoadDateString: '',
  184. emptyaddr1: '',
  185. odometerstart: '',
  186. emptyaddr2: '',
  187. odometerend: '',
  188. loadmile: '',
  189. remarks: ''
  190. },
  191. orderNo: '',
  192. // 照片
  193. fileList1: [],
  194. // 删除弹框
  195. deleteShow: false,
  196. // 删除的图片
  197. event: {},
  198. // 输入框禁用
  199. disabled: false,
  200. status317: 0,
  201. status376: 0
  202. };
  203. },
  204. onLoad: function(option) {
  205. this.status317 = option.status317;
  206. this.status376 = option.status376;
  207. getOrderBillsPlansByid(option.orderNo).then(res => {
  208. this.orderNo = option.orderNo;
  209. this.formData = res.data;
  210. this.fileList1 = res.data.fileList1;
  211. this.loading = false;
  212. if (this.status317 == 6) {
  213. this.disabled = true;
  214. }
  215. })
  216. },
  217. onUnload() {
  218. this.formData = {};
  219. this.loading = true;
  220. this.event = {};
  221. },
  222. methods: {
  223. // 保存订单
  224. setOrderBillsPlansByid(id) {
  225. // console.log(this.status317);
  226. if (this.status317 == 2) {
  227. if (this.formData.unLoadQty == '' || this.formData.unLoadQty == null) {
  228. this.$refs.uToast.show({
  229. type: 'warning',
  230. icon: false,
  231. message: "请输入卸车吨位!",
  232. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  233. })
  234. } else if (this.formData.unLoadDateString == '' || this.formData.unLoadDateString == null) {
  235. this.$refs.uToast.show({
  236. type: 'warning',
  237. icon: false,
  238. message: "请选择卸车时间!",
  239. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  240. })
  241. } else if (this.formData.loadmile == '' || this.formData.loadmile == null) {
  242. this.$refs.uToast.show({
  243. type: 'warning',
  244. icon: false,
  245. message: "请输入重车里程!",
  246. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  247. })
  248. } else {
  249. putOrderBillsPlansByid(this.formData).then(res => {
  250. if (res.code == 200) {
  251. // 保存成功弹窗提示
  252. this.$refs.uToast.show({
  253. type: 'success',
  254. message: "保存成功!",
  255. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  256. })
  257. } else {
  258. // 保存失败消息
  259. this.$refs.uToast.show({
  260. icon: false,
  261. message: "保存失败请重试!",
  262. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  263. })
  264. }
  265. })
  266. }
  267. } else {
  268. // this.$refs.uToast.show({
  269. // type: 'warning',
  270. // icon: false,
  271. // message: "不允许保存!",
  272. // iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  273. // })
  274. }
  275. },
  276. // 点击拨打电话
  277. telFun() {
  278. if (this.formData.driver1mobile != null && this.formData.driver1mobile != '') {
  279. uni.makePhoneCall({
  280. phoneNumber: this.formData.driver1mobile, //电话号码
  281. success: function(e) {
  282. // console.log(e);
  283. },
  284. fail: function(e) {
  285. // console.log(e);
  286. }
  287. })
  288. }
  289. },
  290. // 删除图片
  291. deletePic(event) {
  292. if (this.status317 == 6) {
  293. this.$refs.uToast.show({
  294. type: 'warning',
  295. icon: false,
  296. message: "不允许修改!",
  297. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  298. })
  299. } else if (this.status317 == 2) {
  300. this.event = event;
  301. this.deleteShow = true;
  302. }
  303. },
  304. deleteImg() {
  305. var event = this.event;
  306. var url = event.file.url;
  307. var index = url.lastIndexOf("\/");
  308. var attachId = url.substring(index + 1, url.length);
  309. deleteTmsAttachMngs(attachId).then(res => {
  310. if (res.code == 200) {
  311. this[`fileList${event.name}`].splice(event.index, 1)
  312. // 删除成功消息
  313. this.$refs.uToast.show({
  314. type: 'success',
  315. message: "删除成功!",
  316. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  317. })
  318. } else {
  319. // 删除失败消息
  320. this.$refs.uToast.show({
  321. icon: false,
  322. message: "删除失败请重试!",
  323. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  324. })
  325. }
  326. this.event = {};
  327. this.deleteShow = false;
  328. })
  329. },
  330. // 新增图片
  331. imgUploading(event) {
  332. // this.$nextTick(() => {
  333. // this.$refs.xxxxxx111.init()
  334. // })
  335. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  336. let lists = [].concat(event.file)
  337. let fileListLen = this[`fileList${event.name}`].length
  338. lists.map((item) => {
  339. this[`fileList${event.name}`].push({
  340. ...item,
  341. status: 'uploading',
  342. message: '上传中'
  343. })
  344. })
  345. for (let i = 0; i < lists.length; i++) {
  346. insertTmsAttachMngs(this.formData).then(res => {
  347. if (res.code == 200) {
  348. let data = {
  349. name: 'avatarfile',
  350. filePath: lists[i].url
  351. }
  352. let dataForm = {
  353. attachId: res.data
  354. }
  355. pictureUploading(data, dataForm).then(res => {
  356. let item = this[`fileList${event.name}`][fileListLen]
  357. // console.log("item");
  358. // console.log(item);
  359. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(
  360. item, {
  361. status: 'success',
  362. message: '',
  363. url: res.data.data
  364. }))
  365. fileListLen++
  366. })
  367. }
  368. })
  369. }
  370. },
  371. uploadFilePromise(url) {
  372. insertTmsAttachMngs(this.formData).then(res => {
  373. if (res.code != 200) {
  374. return null;
  375. }
  376. let data = {
  377. name: 'avatarfile',
  378. filePath: url
  379. }
  380. let dataForm = {
  381. attachId: res.data
  382. }
  383. pictureUploading(data, dataForm).then(res => {
  384. return res.data.data;
  385. })
  386. })
  387. },
  388. // 跳转报销费用页面
  389. skipClaimExpense() {
  390. uni.navigateTo({
  391. url: '/pages/particulars/claimExpense/index?orderNo=' + this.orderNo + '&status376=' + this.status376,
  392. });
  393. },
  394. // 跳转注意事项
  395. attention() {
  396. uni.navigateTo({
  397. url: '/pages/particulars/attention/index?remarks=' + this.formData.remarks,
  398. });
  399. },
  400. //输入框小数
  401. checkLoadQty(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.loadQty = e.target.value
  407. })
  408. },
  409. checkUnLoadQty(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.unLoadQty = e.target.value
  415. })
  416. },
  417. checkUnLoadmile(e) {
  418. //正则表达试
  419. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  420. //重新赋值给input
  421. this.$nextTick(() => {
  422. this.formData.loadmile = e.target.value
  423. })
  424. }
  425. }
  426. }
  427. </script>
  428. <style lang="scss">
  429. // 修改布局方向为纵向布局
  430. .vertical-layout {
  431. display: flex;
  432. }
  433. .textAlign {
  434. text-align: right;
  435. // margin-left: 20rpx;
  436. }
  437. // 分割线
  438. .striping {
  439. width: 100%;
  440. height: 4rpx;
  441. background-color: #f0f0f0f0;
  442. }
  443. .box-box {
  444. padding-left: 30rpx;
  445. padding-right: 30rpx;
  446. }
  447. .a-blue {
  448. color: #3c9cff;
  449. }
  450. .content {
  451. // box-sizing: border-box;
  452. background-color: white;
  453. .head-no {
  454. // border-radius: 0 0 40rpx 40rpx;
  455. // width: 500rpx;
  456. height: 100rpx;
  457. padding-left: 30rpx;
  458. vertical-align: middle;
  459. display: table-cell;
  460. font-size: 34rpx;
  461. font-weight: 900;
  462. // background-color: #3c9cff;
  463. }
  464. .head {
  465. // width: 100%;
  466. height: 100rpx;
  467. padding-left: 30rpx;
  468. vertical-align: middle;
  469. display: table-cell;
  470. font-size: 34rpx;
  471. font-weight: 900;
  472. // background-color: red;
  473. }
  474. .box-two {
  475. color: #3b3b3b;
  476. overflow: hidden;
  477. height: 100rpx;
  478. // border-bottom: 2rpx solid #f0f0f0f0;
  479. padding-left: 20rpx;
  480. margin-right: 20rpx;
  481. font-size: 30rpx;
  482. display: flex;
  483. align-items: center;
  484. .key {
  485. display: inline-block;
  486. width: 24%;
  487. color: #3c9cff;
  488. // font-weight: 700;
  489. }
  490. .value {
  491. margin-left: 20rpx;
  492. // color: #787878;
  493. color: #3b3b3b;
  494. margin-right: 20rpx;
  495. }
  496. .value-two {
  497. width: calc(100% - 24%);
  498. color: #3b3b3b;
  499. // margin-right: 20rpx;
  500. border-bottom: 2rpx dotted #000;
  501. }
  502. }
  503. .box {
  504. color: #3b3b3b;
  505. overflow: hidden;
  506. height: 100rpx;
  507. // border-bottom: 2rpx solid #f0f0f0f0;
  508. padding-left: 20rpx;
  509. font-size: 30rpx;
  510. display: flex;
  511. align-items: center;
  512. .data {
  513. width: 50%;
  514. height: 100%;
  515. // background-color: pink;
  516. display: flex;
  517. align-items: center;
  518. .key {
  519. // background-color: indianred;
  520. width: 100%;
  521. color: #3c9cff;
  522. }
  523. .key-date {
  524. width: 40%;
  525. }
  526. .value {
  527. margin-right: 20rpx;
  528. border-bottom: 2rpx dotted #000;
  529. // color: rgb(144, 147, 153);
  530. color: #3b3b3b;
  531. }
  532. }
  533. }
  534. .bottom {
  535. position: fixed;
  536. bottom: calc(var(--window-bottom));
  537. width: 100%;
  538. height: 80rpx;
  539. background-color: pink;
  540. text-align: center;
  541. line-height: 80rpx;
  542. background-color: #f0f0f0f0;
  543. color: #f0f0f0f0;
  544. // font-weight: bold;
  545. font-size: 35rpx;
  546. .onsubmit-script {
  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. .claim-expense {
  555. width: 50%;
  556. height: 100%;
  557. border-left: 2rpx solid #f0f0f0f0;
  558. border-right: 2rpx solid #f0f0f0f0;
  559. background-color: #0b68ffff;
  560. border-radius: 20rpx;
  561. }
  562. .primary {
  563. background-color: #0b68ffff;
  564. }
  565. }
  566. .attention {
  567. padding: 30rpx;
  568. padding-left: 50rpx;
  569. padding-bottom: 40rpx;
  570. background-color: #f0f0f0f0;
  571. }
  572. .cushion {
  573. width: 100%;
  574. height: 104rpx;
  575. background-color: #f0f0f0f0;
  576. }
  577. }
  578. </style>