index.vue 27 KB

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