index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  1. <template>
  2. <view class="content">
  3. <u-sticky>
  4. <view class="head-no">
  5. <view>
  6. <text>{{ formData.carRegNo == null ? '' : formData.carRegNo }}</text>
  7. </view>
  8. <view>
  9. <text>{{ formData.goodsCName == null ? '' : formData.goodsCName }}</text>
  10. </view>
  11. </view>
  12. <view class="head-no-addr">
  13. <view>
  14. <text v-if="formData.loadFactory">{{formData.loadFactory}}</text>
  15. <text v-else>{{formData.loadAddr}}</text>
  16. </view>
  17. <view><text>【到】</text></view>
  18. <view>
  19. <text v-if="formData.unLoadFactory">{{formData.unLoadFactory}}</text>
  20. <text v-else>{{formData.unLoadAddr}}</text>
  21. </view>
  22. </view>
  23. </u-sticky>
  24. <u-sticky>
  25. </u-sticky>
  26. <view class="striping"></view>
  27. <view v-if="isTabs == '装卸确认'">
  28. <view class="box-box">
  29. <view class="box-two">
  30. <!-- <text style="color: red;">*</text> -->
  31. <text class="key">装车吨位</text>
  32. <input class="value-two" style="width: calc(100% - 24% - 80rpx);" selection-start="0" selection-end="9999" :disabled="disabled" type="digit"
  33. @input="checkLoadQty" v-model="formData.loadQty" />
  34. <view style="width: 80rpx; height: 60rpx; position: relative; background-color: #3c9cff; border-radius: 80rpx">
  35. <u-upload :sizeType="['compressed']"
  36. @afterRead="imgUploading($event, '装车吨位')" :disabled="disabled" @delete="deletePic" name="1" multiple :previewFullImage="true"
  37. >
  38. <uni-icons type="camera" style="position: absolute; top: 6rpx; left: 16rpx;" color="#fff" size="24"/>
  39. </u-upload>
  40. </view>
  41. </view>
  42. <view class="box-two">
  43. <text class="key">装车时间</text>
  44. <uni-datetime-picker class="value-two" :start="startDate" :end="end" :disabled="disabled"
  45. :hide-second="true" v-model="formData.loadDateString" :border="false"></uni-datetime-picker>
  46. <view class="today" @click="today('ZC')"><text>今天</text></view>
  47. </view>
  48. <view class="box-two">
  49. <text class="key">卸车吨位</text>
  50. <input class="value-two" style="width: calc(100% - 24% - 80rpx);" selection-start="0" selection-end="9999" :disabled="disabled" type="digit"
  51. @input="checkUnLoadQty" v-model="formData.unLoadQty" />
  52. <view style="width: 80rpx; height: 60rpx; position: relative; background-color: #3c9cff; border-radius: 80rpx">
  53. <u-upload :sizeType="['compressed']"
  54. @afterRead="imgUploading($event, '卸车吨位')" :disabled="disabled" @delete="deletePic" name="1" multiple :previewFullImage="true"
  55. >
  56. <uni-icons type="camera" style="position: absolute; top: 6rpx; left: 16rpx;" color="#fff" size="24"/>
  57. </u-upload>
  58. </view>
  59. </view>
  60. <view class="box-two">
  61. <text class="key">卸车时间</text>
  62. <uni-datetime-picker class="value-two" :start="formData.loadDateString" :end="end"
  63. :hide-second="true" :disabled="disabled" v-model="formData.unLoadDateString" :border="false"></uni-datetime-picker>
  64. <view class="today" @click="today('XC')"><text>今天</text></view>
  65. </view>
  66. <u-checkbox-group v-model="detour" style="margin-left: 20rpx;" placement="column">
  67. <u-checkbox :customStyle="{marginBottom: '8px'}" @change="checkboxChange" :disabled="disabled" key="1" label="行程绕路" name="行程绕路">
  68. </u-checkbox>
  69. </u-checkbox-group>
  70. <view v-if="detour.length > 0">
  71. <view class="box-two">
  72. <text class="key" style="width: 300rpx;">绕路里程空(公里)</text>
  73. <input class="value-two" selection-start="0" selection-end="9999" :disabled="disabled"
  74. @input="checkUnDetourEmptyMile" v-model="formData.detourEmptyMile" />
  75. </view>
  76. <view class="box-two">
  77. <text class="key" style="width: 300rpx;">绕路里程重(公里)</text>
  78. <input class="value-two" selection-start="0" selection-end="9999" :disabled="disabled"
  79. @input="checkUnDetourLoadMile" v-model="formData.detourLoadMile" />
  80. </view>
  81. <view class="box-two">
  82. <text class="key" style="width: 300rpx;">绕&nbsp;&nbsp;&nbsp;&nbsp;路&nbsp;&nbsp;&nbsp;&nbsp;原&nbsp;&nbsp;&nbsp;&nbsp;因</text>
  83. <input class="value-two" selection-start="0" selection-end="9999" :disabled="disabled"
  84. v-model="formData.detourDesc" />
  85. </view>
  86. </view>
  87. </view>
  88. <view class="box-box" style="margin-top: 40rpx;">
  89. <view style="margin-bottom: 20rpx;">
  90. <text style="color: #3c9cff;">单据拍照存档</text>
  91. </view>
  92. <u-upload :fileList="fileList1" :sizeType="['compressed']"
  93. @afterRead="imgUploading" :disabled="disabled" @delete="deletePic" name="1" multiple :previewFullImage="true"
  94. ></u-upload>
  95. </view>
  96. <view class="box-box">
  97. <view class="box-two">
  98. <text class="key">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</text>
  99. <input class="value-two" selection-start="0" selection-end="9999" :disabled="disabled"
  100. v-model="formData.driverassdesc" />
  101. </view>
  102. </view>
  103. <view class="attention">
  104. <view style="color: red;"><text>注意事项:</text></view>
  105. {{this.formData.remarks ? this.formData.remarks:''}}
  106. </view>
  107. </view>
  108. <view class="cushion">
  109. </view>
  110. <view class="bottom" style="z-index: 4;">
  111. <view class="row" v-if="formData.ifLoaded == 'T' && (formData.ifUnLoaded == 'T' || formData.ifUnLoaded == 'F') && (formData.ifOrder2ed == 'T' || formData.ifOrder2ed == 'F')">
  112. <view class="button" style="width: 300rpx;">
  113. <u-button iconColor="#3c9cff" shape="circle" type="primary" :disabled="disabled"
  114. @click="disabledClick" text="保存数据"></u-button>
  115. </view>
  116. <view class="button" style="width: 300rpx;">
  117. <u-button iconColor="#fe8c00;" color="#fe8c00" shape="circle" type="primary" :disabled="disabled"
  118. @click="upDisabledClick" text="卸车确认"></u-button>
  119. </view>
  120. </view>
  121. <view class="row" v-else>
  122. <view class="button">
  123. <u-button iconColor="#3c9cff" shape="circle" type="primary" :disabled="disabled"
  124. @click="disabledClick" text="保存数据"></u-button>
  125. </view>
  126. </view>
  127. </view>
  128. <!-- 遮盖罩 -->
  129. <u-loading-page :loading="loading" style="z-index: 999;"></u-loading-page>
  130. <!-- 消息提示 -->
  131. <u-toast ref="uToast"></u-toast>
  132. <!-- 删除图片弹出框 -->
  133. <u-modal :show="deleteShow" title="提示" showCancelButton @confirm="deleteImg" @cancel="deleteShow = false">
  134. <view class="slot-content">
  135. <rich-text nodes="确定删除这张图片吗?"></rich-text>
  136. </view>
  137. </u-modal>
  138. <u-modal :show="submitShow" title="提示" showCancelButton @confirm="setOrderBillsPlansByid"
  139. @cancel="submitShow = false">
  140. <view class="slot-content">
  141. <rich-text nodes="确定要提交装卸信息吗?"></rich-text>
  142. </view>
  143. </u-modal>
  144. <u-modal :show="upCancel" title="提示" showCancelButton @confirm="upReceipts"
  145. @cancel="upCancel = false">
  146. <view class="slot-content">
  147. <rich-text nodes="确定要卸车吗?"></rich-text>
  148. </view>
  149. </u-modal>
  150. </view>
  151. </template>
  152. <script>
  153. import {
  154. getOrderBillsPlansByid,
  155. putOrderBillsPlansByid,
  156. insertTmsAttachMngs,
  157. pictureUploading,
  158. deleteTmsAttachMngs,
  159. audit,
  160. submitAudit,
  161. upReceipts
  162. } from "@/api/particulars"
  163. import {
  164. getGasStations,
  165. getItems,
  166. insertLoadFeeItems,
  167. getLoadFeeItems
  168. } from "@/api/reimbursement"
  169. import {
  170. login
  171. } from "../../api/login";
  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. submitShow: false,
  198. // 提交报账单弹窗
  199. upCancel: false,
  200. // 删除的图片
  201. event: {},
  202. // 输入框禁用
  203. disabled: false,
  204. status317: 0,
  205. status376: 0,
  206. // 当前时间的前60天
  207. startDate: '',
  208. tabs: [{
  209. name: '装卸确认'
  210. }, {
  211. name: '订单信息'
  212. }],
  213. isTabs: '装卸确认',
  214. tabName: '',
  215. // 绕路选项
  216. detour: [],
  217. end: new Date() + ''
  218. };
  219. },
  220. onLoad: function(option) {
  221. this.status317 = option.status;
  222. this.status376 = option.status;
  223. this.orderNo = option.orderNo;
  224. this.tabName = option.tabName;
  225. this.getData();
  226. },
  227. onUnload() {
  228. this.formData = {};
  229. this.loading = true;
  230. this.event = {};
  231. },
  232. methods: {
  233. // 查询数据
  234. getData() {
  235. getOrderBillsPlansByid(this.orderNo).then(res => {
  236. res.data.loadQty == 0 ? res.data.loadQty = null : res.data.loadQty
  237. res.data.unLoadQty == 0 ? res.data.unLoadQty = null : res.data.unLoadQty
  238. res.data.odometerstart == 0 ? res.data.odometerstart = null : res.data.odometerstart
  239. res.data.odometerend == 0 ? res.data.odometerend = null : res.data.odometerend
  240. res.data.detourEmptyMile == 0 ? res.data.detourEmptyMile = null : res.data.detourEmptyMile
  241. res.data.detourLoadMile == 0 ? res.data.detourLoadMile = null : res.data.detourLoadMile
  242. if (res.data.ifDetour == "T") {
  243. this.detour.push("行程绕路")
  244. }
  245. for (let role of res.data.roleList) {
  246. if (role == 'DZ') {
  247. this.disabled = true;
  248. }
  249. if (role == 'JSY') {
  250. this.disabled = false;
  251. }
  252. }
  253. // // 审核中
  254. // if (res.data.ifStarted == "S") {
  255. // this.disabled = true;
  256. // }
  257. // // 审核完成
  258. // if (res.data.ifStarted == "A") {
  259. // this.disabled = true;
  260. // }
  261. // 提交报账单
  262. if (res.data.ifOrder2ed == "S" || res.data.ifOrder2ed == "O") {
  263. this.disabled = true;
  264. }
  265. this.formData = res.data;
  266. this.fileList1 = res.data.fileList1;
  267. this.loading = false;
  268. if (this.status317 == 6) {
  269. this.disabled = true;
  270. }
  271. this.startDate = this.GetTime(60)
  272. })
  273. },
  274. // 切换
  275. change(item) {
  276. this.isTabs = item.name;
  277. },
  278. // 当天日期
  279. today(type) {
  280. if (this.disabled) {
  281. return
  282. }
  283. if (type == "ZC") {
  284. this.formData.loadDateString = Date.parse(new Date());
  285. } else if (type == "XC") {
  286. this.formData.unLoadDateString = Date.parse(new Date());
  287. }
  288. },
  289. // 数据校验
  290. dataVerify() {
  291. if (this.formData.loadQty == '' || this.formData.loadQty == null || this.formData.loadQty == '0') {
  292. this.$refs.uToast.show({
  293. type: 'warning',
  294. icon: false,
  295. message: "请输入装车吨位!",
  296. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  297. })
  298. } else if (this.formData.loadDateString == '' || this.formData.loadDateString == null) {
  299. this.$refs.uToast.show({
  300. type: 'warning',
  301. icon: false,
  302. message: "请选择装车时间!",
  303. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  304. })
  305. } else if (this.formData.unLoadQty == '' || this.formData.unLoadQty == null || this.formData.unLoadQty == '0') {
  306. this.$refs.uToast.show({
  307. type: 'warning',
  308. icon: false,
  309. message: "请输入卸车吨位!",
  310. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  311. })
  312. } else if (this.formData.unLoadDateString == '' || this.formData.unLoadDateString == null) {
  313. this.$refs.uToast.show({
  314. type: 'warning',
  315. icon: false,
  316. message: "请选择卸车时间!",
  317. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  318. })
  319. }
  320. else if (this.fileList1.length < 2) {
  321. return this.$refs.uToast.show({
  322. type: 'warning',
  323. icon: false,
  324. message: "图片最少两张!",
  325. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  326. })
  327. }
  328. else {
  329. return 'ok';
  330. }
  331. },
  332. // 提交里程点击事件
  333. disabledClick() {
  334. if(this.tabName == '未装车' && (this.formData.loadQty == null || this.formData.loadQty == 0)) {
  335. this.$refs.uToast.show({
  336. type: 'warning',
  337. icon: false,
  338. message: "请输入装车吨位!",
  339. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  340. })
  341. } else if(this.tabName == '未装车' && (this.formData.loadDateString == null)) {
  342. this.$refs.uToast.show({
  343. type: 'warning',
  344. icon: false,
  345. message: "请选择装车时间!",
  346. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  347. })
  348. } else if(this.tabName == '未卸车' && (this.formData.unLoadQty == null || this.formData.unLoadQty == 0)) {
  349. this.$refs.uToast.show({
  350. type: 'warning',
  351. icon: false,
  352. message: "请输入卸车吨位!",
  353. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  354. })
  355. } else if(this.tabName == '未卸车' && (this.formData.unLoadDateString == null)) {
  356. this.$refs.uToast.show({
  357. type: 'warning',
  358. icon: false,
  359. message: "请选择卸车时间!",
  360. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  361. })
  362. } else {
  363. this.submitShow = true
  364. }
  365. // if (this.status317 == 2 && this.dataVerify() == 'ok') {
  366. // if (this.dataVerify() == 'ok') {
  367. // this.submitShow = true
  368. // } else {
  369. // this.$refs.uToast.show({
  370. // type: 'warning',
  371. // icon: false,
  372. // message: "不允许保存!",
  373. // iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  374. // })
  375. // }
  376. },
  377. // 提交报账单数据校验
  378. upDisabledClick() {
  379. if(this.dataVerify() === 'ok') {
  380. this.upCancel = true
  381. }
  382. },
  383. // 行程绕路点击事件
  384. checkboxChange() {
  385. if (this.detour.length > 0) {
  386. this.formData.detourEmptyMile = null
  387. this.formData.detourLoadMile = null
  388. this.formData.detourDesc = ""
  389. }
  390. },
  391. // 保存订单
  392. setOrderBillsPlansByid(id) {
  393. this.formData.loadQty = this.formData.loadQty == null || this.formData.loadQty == '' ? 0 : this.formData.loadQty
  394. this.formData.unLoadQty = this.formData.unLoadQty == null || this.formData.unLoadQty == '' ? 0 : this.formData.unLoadQty
  395. if(this.formData.loadDateString != null && this.formData.loadDateString != '') {
  396. this.formData.loadDateString = this.dateToStringS("yyyy-MM-dd HH:mm:ss", new Date(this.formData.loadDateString))
  397. } else {
  398. this.formData.loadDateString = null
  399. }
  400. if(this.formData.unLoadDateString != null && this.formData.unLoadDateString != '') {
  401. this.formData.unLoadDateString = this.dateToStringS("yyyy-MM-dd HH:mm:ss", new Date(this.formData.unLoadDateString))
  402. } else {
  403. this.formData.unLoadDateString = null
  404. }
  405. this.formData.odometerstart = this.formData.odometerstart == null || this.formData.odometerstart == '' ? 0 : this.formData.odometerstart
  406. this.formData.odometerend = this.formData.odometerend == null || this.formData.odometerend == '' ? 0 : this.formData.odometerend
  407. this.formData.loadmile = this.formData.loadmile == null || this.formData.loadmile == '' ? 0 : this.formData.loadmile
  408. // 行程绕路赋值
  409. if (this.detour.length > 0) {
  410. this.formData.ifDetour = "T"
  411. } else {
  412. this.formData.ifDetour = "F"
  413. }
  414. this.formData.detourEmptyMile = this.formData.detourEmptyMile == null || this.formData.detourEmptyMile == '' ? 0 : this.formData.detourEmptyMile
  415. this.formData.detourLoadMile = this.formData.detourLoadMile == null || this.formData.detourLoadMile == '' ? 0 : this.formData.detourLoadMile
  416. this.formData.detourDesc = this.formData.detourDesc == null ? '' : this.formData.detourDesc
  417. putOrderBillsPlansByid(this.formData).then(ress => {
  418. if (ress.code == 200) {
  419. getOrderBillsPlansByid(this.orderNo).then(res => {
  420. res.data.loadQty == 0 ? res.data.loadQty = null : res.data.loadQty
  421. res.data.unLoadQty == 0 ? res.data.unLoadQty = null : res.data.unLoadQty
  422. res.data.odometerstart == 0 ? res.data.odometerstart = null : res.data.odometerstart
  423. res.data.odometerend == 0 ? res.data.odometerend = null : res.data.odometerend
  424. res.data.loadmile == 0 ? res.data.loadmile = null : res.data.loadmile
  425. res.data.detourEmptyMile == 0 ? res.data.detourEmptyMile = null : res.data.detourEmptyMile
  426. res.data.detourLoadMile == 0 ? res.data.detourLoadMile = null : res.data.detourLoadMile
  427. if (res.data.ifDetour == "T") {
  428. this.detour.push("行程绕路")
  429. }
  430. for (let role of res.data.roleList) {
  431. if (role.roleKey == 'DZ') {
  432. this.disabled = true;
  433. }
  434. }
  435. // // 审核中
  436. // if (res.data.ifStarted == "S") {
  437. // this.disabled = true;
  438. // }
  439. // // 审核完成
  440. // if (res.data.ifStarted == "A") {
  441. // this.disabled = true;
  442. // }
  443. // 提交报账单
  444. if (res.data.ifOrder2ed == "S" || res.data.ifOrder2ed == "O") {
  445. this.disabled = true;
  446. }
  447. this.formData = res.data;
  448. this.fileList1 = res.data.fileList1;
  449. this.loading = false;
  450. if (this.status317 == 6) {
  451. this.disabled = true;
  452. }
  453. this.startDate = this.GetTime(60)
  454. this.submitShow = false
  455. // 保存成功弹窗提示
  456. this.$refs.uToast.show({
  457. type: 'success',
  458. message: "保存成功!",
  459. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  460. })
  461. })
  462. } else {
  463. // 保存失败消息
  464. this.$refs.uToast.show({
  465. icon: false,
  466. message: "保存失败请重试!",
  467. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  468. })
  469. }
  470. })
  471. },
  472. // 提交单据
  473. upReceipts() {
  474. this.loading = true;
  475. this.formData.loadQty = this.formData.loadQty == null || this.formData.loadQty == '' ? 0 : this.formData.loadQty
  476. this.formData.unLoadQty = this.formData.unLoadQty == null || this.formData.unLoadQty == '' ? 0 : this.formData.unLoadQty
  477. if(this.formData.loadDateString != null && this.formData.loadDateString != '') {
  478. this.formData.loadDateString = this.dateToStringS("yyyy-MM-dd HH:mm:ss", new Date(this.formData.loadDateString))
  479. } else {
  480. this.formData.loadDateString = null
  481. }
  482. //
  483. if(this.formData.unLoadDateString != null && this.formData.unLoadDateString != '') {
  484. this.formData.unLoadDateString = this.dateToStringS("yyyy-MM-dd HH:mm:ss", new Date(this.formData.unLoadDateString))
  485. } else {
  486. this.formData.unLoadDateString = null
  487. }
  488. this.formData.odometerstart = this.formData.odometerstart == null || this.formData.odometerstart == '' ? 0 : this.formData.odometerstart
  489. this.formData.odometerend = this.formData.odometerend == null || this.formData.odometerend == '' ? 0 : this.formData.odometerend
  490. this.formData.loadmile = this.formData.loadmile == null || this.formData.loadmile == '' ? 0 : this.formData.loadmile
  491. // 行程绕路赋值
  492. if (this.detour.length > 0) {
  493. this.formData.ifDetour = "T"
  494. this.formData.detourEmptyMile = this.formData.detourEmptyMile == null || this.formData.detourEmptyMile == '' ? 0 : this.formData.detourEmptyMile
  495. this.formData.detourLoadMile = this.formData.detourLoadMile == null || this.formData.detourLoadMile == '' ? 0 : this.formData.detourLoadMile
  496. } else {
  497. this.formData.ifDetour = "F"
  498. }
  499. putOrderBillsPlansByid(this.formData).then(ress => {
  500. if (ress.code == 200) {
  501. // 提交订单
  502. // actId entityId
  503. upReceipts(this.orderNo,{actId:this.formData.actId,entityId:this.formData.entityId}).then(res => {
  504. // 提交报账单成功
  505. this.$refs.uToast.show({
  506. type: 'success',
  507. message: "提交报账单成功!",
  508. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  509. })
  510. })
  511. // 获取详情数据
  512. getOrderBillsPlansByid(this.orderNo).then(res => {
  513. res.data.loadQty == 0 ? res.data.loadQty = null : res.data.loadQty
  514. res.data.unLoadQty == 0 ? res.data.unLoadQty = null : res.data.unLoadQty
  515. res.data.odometerstart == 0 ? res.data.odometerstart = null : res.data.odometerstart
  516. res.data.odometerend == 0 ? res.data.odometerend = null : res.data.odometerend
  517. res.data.loadmile == 0 ? res.data.loadmile = null : res.data.loadmile
  518. res.data.detourEmptyMile == 0 ? res.data.detourEmptyMile = null : res.data.detourEmptyMile
  519. res.data.detourLoadMile == 0 ? res.data.detourLoadMile = null : res.data.detourLoadMile
  520. if (res.data.ifDetour == "T") {
  521. this.detour.push("行程绕路")
  522. }
  523. for (let role of res.data.roleList) {
  524. if (role.roleKey == 'DZ') {
  525. this.disabled = true;
  526. }
  527. }
  528. // 审核中
  529. // if (res.data.ifStarted == "S") {
  530. // this.disabled = true;
  531. // }
  532. // // 审核完成
  533. // if (res.data.ifStarted == "A") {
  534. // this.disabled = true;
  535. // }
  536. // 提交报账单
  537. if (res.data.ifOrder2ed == "S" || res.data.ifOrder2ed == "O") {
  538. this.disabled = true;
  539. }
  540. this.formData = res.data;
  541. this.fileList1 = res.data.fileList1;
  542. this.loading = false;
  543. if (this.status317 == 6) {
  544. this.disabled = true;
  545. }
  546. this.startDate = this.GetTime(60)
  547. this.upCancel = false
  548. // upReceipts(this.orderNo).then(res => {
  549. // console.log(res,'662');
  550. // // 提交报账单成功
  551. // this.$refs.uToast.show({
  552. // type: 'success',
  553. // message: "提交报账单成功!",
  554. // iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  555. // })
  556. // })
  557. })
  558. } else {
  559. // 提交报账单失败
  560. this.$refs.uToast.show({
  561. icon: false,
  562. message: "提交失败请重试!",
  563. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  564. })
  565. }
  566. })
  567. this.loading = false;
  568. },
  569. // 点击拨打电话
  570. telFun() {
  571. if (this.formData.driver1mobile != null && this.formData.driver1mobile != '') {
  572. uni.makePhoneCall({
  573. phoneNumber: this.formData.driver1mobile, //电话号码
  574. success: function(e) {
  575. // console.log(e);
  576. },
  577. fail: function(e) {
  578. // console.log(e);
  579. }
  580. })
  581. }
  582. },
  583. // 时间计算
  584. GetTime(sky) {
  585. var date = new Date();
  586. var base = Date.parse(date); // 转换为时间戳
  587. var year = date.getFullYear(); //获取当前年份
  588. var mon = date.getMonth() + 1; //获取当前月份
  589. var day = date.getDate(); //获取当前日
  590. var oneDay = 24 * 3600 * 1000
  591. for (var i = 1; i < sky; i++) { //前sky天的时间
  592. var now = new Date(base -= oneDay);
  593. var myear = now.getFullYear();
  594. var month = now.getMonth() + 1;
  595. var mday = now.getDate()
  596. if (i == sky - 1) {
  597. var dataSky = [myear, month >= 10 ? month : '0' + month, mday >= 10 ? mday : '0' + mday]
  598. .join('-')
  599. return dataSky
  600. // + " 00:00:00"
  601. }
  602. }
  603. },
  604. // 删除图片
  605. deletePic(event) {
  606. if (this.formData.ifOrder2ed == 'S' || this.formData.ifOrder2ed == 'O') {
  607. this.$refs.uToast.show({
  608. type: 'warning',
  609. icon: false,
  610. message: "不允许修改!",
  611. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  612. })
  613. } else {
  614. for (let role of this.formData.roleList) {
  615. if (role == 'JSY') {
  616. this.event = event;
  617. this.deleteShow = true;
  618. }
  619. }
  620. }
  621. },
  622. deleteImg() {
  623. var event = this.event;
  624. var url = event.file.url;
  625. var index = url.lastIndexOf("\/");
  626. var attachId = url.substring(index + 1, url.length);
  627. deleteTmsAttachMngs(attachId).then(res => {
  628. if (res.code == 200) {
  629. this[`fileList${event.name}`].splice(event.index, 1)
  630. // 删除成功消息
  631. this.$refs.uToast.show({
  632. type: 'success',
  633. message: "删除成功!",
  634. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  635. })
  636. } else {
  637. // 删除失败消息
  638. this.$refs.uToast.show({
  639. icon: false,
  640. message: "删除失败请重试!",
  641. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
  642. })
  643. }
  644. this.event = {};
  645. this.deleteShow = false;
  646. })
  647. },
  648. // 新增图片
  649. imgUploading(event, nameType) {
  650. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  651. let lists = [].concat(event.file)
  652. let fileListLen = this[`fileList${event.name}`].length
  653. lists.map((item) => {
  654. this[`fileList${event.name}`].push({
  655. ...item,
  656. status: 'uploading',
  657. message: '上传中'
  658. })
  659. })
  660. for (let i = 0; i < lists.length; i++) {
  661. let date = this.dateToString("yyyyMMdd");
  662. let dateHHmmss = this.dateToString("yyyy-MM-dd HH:mm:ss");
  663. this.formData.date = date;
  664. let reqData = this.formData
  665. reqData.attachdesc = nameType
  666. insertTmsAttachMngs(reqData).then(res => {
  667. if (res.code == 200) {
  668. uni.compressImage({
  669. src: lists[i].url,
  670. quality: 80,
  671. complete: ress => {
  672. let data = {
  673. name: 'avatarfile',
  674. filePath: ress.tempFilePath
  675. }
  676. // 获取经纬度
  677. let longitude = '';
  678. let latitude = '';
  679. uni.getLocation({
  680. type: 'wgs84',
  681. isHighAccuracy: true,
  682. geocode: true,
  683. fail: () => {
  684. this.fileList1.pop();
  685. this.$refs.uToast.show({
  686. type: 'warning',
  687. icon: false,
  688. message: "请打开定位!",
  689. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/warning.png'
  690. })
  691. return
  692. },
  693. success: (map) => {
  694. longitude = map.longitude
  695. latitude = map.latitude
  696. let dataForm = {
  697. attachId: res.data,
  698. longitude: longitude,
  699. latitude: latitude,
  700. updateDate: dateHHmmss,
  701. carRegNo:this.formData.carRegNo
  702. }
  703. // 上传图片
  704. pictureUploading(data, dataForm).then(res => {
  705. let item = this[`fileList${event.name}`][fileListLen]
  706. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(
  707. item, {
  708. status: 'success',
  709. message: '',
  710. url: res.data
  711. }))
  712. fileListLen++
  713. })
  714. },
  715. });
  716. }
  717. })
  718. }
  719. })
  720. }
  721. },
  722. dateToString(fmt) {
  723. var date = new Date();
  724. var o = {
  725. "M+": date.getMonth() + 1, //月份
  726. "d+": date.getDate(), //日
  727. "H+": date.getHours(), //小时
  728. "m+": date.getMinutes(), //分
  729. "s+": date.getSeconds(), //秒
  730. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  731. "S": date.getMilliseconds() //毫秒
  732. };
  733. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1
  734. .length));
  735. for (var k in o)
  736. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ?
  737. (o[
  738. k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  739. return fmt;
  740. },
  741. dateToStringS(fmt, date) {
  742. var o = {
  743. "M+": date.getMonth() + 1, //月份
  744. "d+": date.getDate(), //日
  745. "H+": date.getHours(), //小时
  746. "m+": date.getMinutes(), //分
  747. "s+": date.getSeconds(), //秒
  748. "q+": Math.floor((date.getMonth() + 3) / 3), //季度
  749. "S": date.getMilliseconds() //毫秒
  750. };
  751. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1
  752. .length));
  753. for (var k in o)
  754. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ?
  755. (o[
  756. k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  757. return fmt;
  758. },
  759. uploadFilePromise(url) {
  760. insertTmsAttachMngs(this.formData).then(res => {
  761. if (res.code != 200) {
  762. return null;
  763. }
  764. let data = {
  765. name: 'avatarfile',
  766. filePath: url
  767. }
  768. let dataForm = {
  769. attachId: res.data
  770. }
  771. pictureUploading(data, dataForm).then(res => {
  772. return res.data.data;
  773. })
  774. })
  775. },
  776. // 跳转报销费用页面
  777. skipClaimExpense() {
  778. uni.navigateTo({
  779. url: '/pages/particulars/claimExpense/index?orderNo=' + this.orderNo + '&status376=' +
  780. this
  781. .status376,
  782. });
  783. },
  784. // 跳转注意事项
  785. attention() {
  786. uni.navigateTo({
  787. url: '/pages/particulars/attention/index?remarks=' + this.formData.remarks,
  788. });
  789. },
  790. //输入框小数
  791. checkLoadQty(e) {
  792. //正则表达试
  793. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  794. //重新赋值给input
  795. this.$nextTick(() => {
  796. this.formData.loadQty = e.target.value
  797. })
  798. },
  799. checkUnLoadQty(e) {
  800. //正则表达试
  801. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  802. //重新赋值给input
  803. this.$nextTick(() => {
  804. this.formData.unLoadQty = e.target.value
  805. })
  806. },
  807. checkUnLoadmile(e) {
  808. //正则表达试
  809. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  810. //重新赋值给input
  811. this.$nextTick(() => {
  812. this.formData.loadmile = e.target.value
  813. })
  814. },
  815. checkUnDetourEmptyMile(e) {
  816. //正则表达试
  817. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  818. //重新赋值给input
  819. this.$nextTick(() => {
  820. this.formData.detourEmptyMile = e.target.value
  821. })
  822. },
  823. checkUnDetourLoadMile(e) {
  824. //正则表达试
  825. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
  826. //重新赋值给input
  827. this.$nextTick(() => {
  828. this.formData.detourLoadMile = e.target.value
  829. })
  830. }
  831. }
  832. }
  833. </script>
  834. <style lang="scss">
  835. @import url("/font/iconfont.css");
  836. // 当天按钮样式
  837. .today {
  838. width: 80rpx;
  839. height: 60rpx;
  840. background-color: #3c9cff;
  841. color: #fff;
  842. border-radius: 80rpx;
  843. text-align: center;
  844. line-height: 60rpx;
  845. }
  846. // 修改布局方向为纵向布局
  847. .vertical-layout {
  848. display: flex;
  849. }
  850. .textAlign {
  851. text-align: right;
  852. // margin-left: 20rpx;
  853. }
  854. // 分割线
  855. .striping {
  856. width: 100%;
  857. height: 4rpx;
  858. background-color: #f0f0f0f0;
  859. }
  860. .box-box {
  861. padding-left: 30rpx;
  862. padding-right: 30rpx;
  863. }
  864. .a-blue {
  865. color: #3c9cff;
  866. }
  867. .content {
  868. // box-sizing: border-box;
  869. background-color: white;
  870. .head-no {
  871. // border-radius: 0 0 40rpx 40rpx;
  872. // width: 960rpx;
  873. // height: 100rpx;
  874. height: 40rpx;
  875. padding: 0 30rpx;
  876. color: #fff;
  877. vertical-align: middle;
  878. display: flex;
  879. // align-items: center;
  880. align-items: flex-end;
  881. justify-content: space-between;
  882. box-sizing: border-box;
  883. font-size: 34rpx;
  884. font-weight: 700;
  885. background-color: #3c9cff;
  886. }
  887. .head-no-addr {
  888. // width: 960rpx;
  889. height: 100rpx;
  890. // padding-left: 30rpx;
  891. padding: 0 30rpx;
  892. vertical-align: middle;
  893. color: #fff;
  894. font-size: 34rpx;
  895. font-weight: 700;
  896. display: flex;
  897. align-items: center;
  898. justify-content: space-between;
  899. box-sizing: border-box;
  900. background-color: #3c9cff;
  901. }
  902. .head {
  903. // width: 100%;
  904. height: 100rpx;
  905. padding-left: 30rpx;
  906. vertical-align: middle;
  907. display: table-cell;
  908. font-size: 34rpx;
  909. font-weight: 900;
  910. // background-color: red;
  911. }
  912. .box-two {
  913. color: #3b3b3b;
  914. overflow: hidden;
  915. height: 100rpx;
  916. // border-bottom: 2rpx solid #f0f0f0f0;
  917. padding-left: 20rpx;
  918. margin-right: 20rpx;
  919. // font-size: 30rpx;
  920. display: flex;
  921. align-items: center;
  922. .key {
  923. display: inline-block;
  924. width: 24%;
  925. color: #3c9cff;
  926. // font-weight: 700;
  927. }
  928. .value {
  929. margin-left: 20rpx;
  930. // color: #787878;
  931. color: #3b3b3b;
  932. margin-right: 20rpx;
  933. }
  934. .value-two {
  935. width: calc(100% - 24%);
  936. color: #3b3b3b;
  937. // margin-right: 20rpx;
  938. border-bottom: 2rpx dotted #000;
  939. }
  940. }
  941. .box {
  942. color: #3b3b3b;
  943. overflow: hidden;
  944. height: 100rpx;
  945. // border-bottom: 2rpx solid #f0f0f0f0;
  946. padding-left: 20rpx;
  947. // font-size: 30rpx;
  948. display: flex;
  949. align-items: center;
  950. .data {
  951. width: 50%;
  952. height: 100%;
  953. // background-color: pink;
  954. display: flex;
  955. align-items: center;
  956. .key {
  957. // background-color: indianred;
  958. width: 100%;
  959. color: #3c9cff;
  960. }
  961. .key-date {
  962. width: 40%;
  963. }
  964. .value {
  965. margin-right: 20rpx;
  966. border-bottom: 2rpx dotted #000;
  967. // color: rgb(144, 147, 153);
  968. color: #3b3b3b;
  969. }
  970. }
  971. }
  972. .bottom {
  973. position: fixed;
  974. bottom: calc(var(--window-bottom));
  975. width: 100%;
  976. height: 130rpx;
  977. background-color: white;
  978. .row {
  979. display: flex;
  980. justify-content: space-evenly;
  981. height: 130rpx;
  982. align-items: center;
  983. .button {
  984. // width: 300rpx;
  985. width: 660rpx;
  986. }
  987. }
  988. }
  989. .attention {
  990. padding: 30rpx;
  991. padding-left: 50rpx;
  992. padding-bottom: 40rpx;
  993. background-color: #f0f0f0f0;
  994. }
  995. .cushion {
  996. width: 100%;
  997. height: 104rpx;
  998. background-color: #f0f0f0f0;
  999. }
  1000. }
  1001. </style>