index.vue 35 KB

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