apply_for_reimbursement.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <view class="center">
  3. <view>
  4. <view class='wrap'>
  5. </view>
  6. <view class='wrap1'>
  7. <view class="c-row">
  8. <view class="title">车牌号</view>
  9. <view class="con-list">
  10. <picker :range="carNolist" range-key="carNo" @change='carnopicker($event)' mode="selector">
  11. <view>{{detailData.carNo?detailData.carNo:'请选择车牌号 >'}}</view>
  12. </picker>
  13. </view>
  14. </view>
  15. <view class="c-row">
  16. <view class="title">油耗(升)</view>
  17. <view class="con-list">
  18. <input type='digit' v-model='fillingDetail.oilConsumption' placeholder="请输入油耗"
  19. @input='calculate()'></input>
  20. </view>
  21. </view>
  22. <view class="c-row">
  23. <view class="title">当前油价(元/升)</view>
  24. <view class="con-list">
  25. <input type="digit" v-model='fillingDetail.currentOilPrice' placeholder="请输入当前油价"
  26. @input='calculate()'></input>
  27. </view>
  28. </view>
  29. <view class="c-row">
  30. <view class="title">计算金额(元)</view>
  31. <view class="con-list">
  32. <input type="digit" v-model='fillingDetail.currentConsumption' placeholder="不可编辑,自动计算"
  33. :disabled="true"></input>
  34. </view>
  35. </view>
  36. <view class="c-row">
  37. <view class="title">加油凭证</view>
  38. </view>
  39. <view class="voucher">
  40. <u-upload imageMode='aspectFill' class="upload" :ref="'upload'" name='fileName'
  41. :file-list="fillingDetail.fileList" :form-data="{companyId: pcUserInfo.compId,
  42. modelId: '',
  43. vesselId: ''}" :action="action" :max-size="maxSize" :max-count="9" :size-type="['compressed']"
  44. @on-success="getImgUrl($event)" @on-remove="onRemove($event)" :show-progress='false'
  45. :limitType="['png', 'jpg', 'jpeg', 'webp', 'gif']" @on-progress="onProgress"></u-upload>
  46. <!-- <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="9"
  47. :size-type="['compressed']" @on-success="getImgUrl($event,index)" @on-error="onError"
  48. @on-remove="onRemove($event,index)" @on-uploaded="isAdd = true" :before-upload="filterFileType"
  49. @on-progress="onProgress"></upload> -->
  50. </view>
  51. </view>
  52. <view class="c-row">
  53. <view class="left">备注</view>
  54. </view>
  55. <view style='position:relative;' class="wrap1 no-boder">
  56. <u-input ref='textarea' :clearable='false' class='textarea' v-model="detailData.remark" :type="typeRemark" :border="border"
  57. placeholder="选填,不超过150字" :height="height" :auto-height="autoHeight" maxlength="150" />
  58. <view class="remark">
  59. {{detailData.remark?detailData.remark.length:'0'}}/150个字
  60. </view>
  61. </view>
  62. <view class="footer">
  63. <!-- <view class="c-row">
  64. <view class="title">总油耗(升)</view>
  65. <view class="con-list">
  66. <input :disabled="true" v-model='tfc' placeholder="不可编辑,自动计算" type="digit"></input>
  67. </view>
  68. </view>
  69. <view class="c-row">
  70. <view class="title">合计金额(元)</view>
  71. <view class="con-list">
  72. <input :disabled="true" v-model='totalCost' placeholder="不可编辑,自动计算" type="digit"></input>
  73. </view>
  74. </view> -->
  75. <view class="button1" v-if="isUseSubmit">提交申请</view>
  76. <view @click='submitApply' class="button" v-else>提交申请</view>
  77. </view>
  78. </view>
  79. <u-modal v-model="show" @confirm='submit' content="确定提交申请信息?" :show-cancel-button='true'></u-modal>
  80. <u-toast ref="uToast" />
  81. </view>
  82. </template>
  83. <script>
  84. import * as config from '../../config'
  85. import upload from '@/components/upload.vue';
  86. export default {
  87. components: {
  88. upload,
  89. },
  90. data() {
  91. return {
  92. isUseSubmit: false,
  93. amountDeadline: "",
  94. carNolist: [],
  95. detailData: {
  96. carNo: '',
  97. destinationProvince: "",
  98. destinationCity: "",
  99. destinationArea: "",
  100. carNo: "",
  101. originProvince: "",
  102. originCity: "",
  103. originArea: "",
  104. purpose: '库点费用',
  105. remark: "",
  106. warehouseName: '选择仓库',
  107. },
  108. height: 150,
  109. autoHeight: true,
  110. typeRemark: 'textarea',
  111. border: true,
  112. show: false,
  113. show1: false,
  114. purposeList: [{
  115. purpose: "合同费用"
  116. },
  117. {
  118. purpose: "库点费用"
  119. },
  120. ],
  121. pcUserInfo: uni.getStorageSync('pcUserInfo'),
  122. fillingDetail: {
  123. serialNumber: 1,
  124. oilConsumption: "",
  125. currentOilPrice: "",
  126. currentConsumption: "",
  127. addressUrl: [],
  128. compId: uni.getStorageSync('pcUserInfo').compId,
  129. commonId: uni.getStorageSync('pcUserInfo').userId,
  130. fillingId: "",
  131. tfc: "",
  132. totalCost: ""
  133. },
  134. action: config.def().baseUrlNew + 'appendix/api/uploadFiles',
  135. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  136. btnLoading: false, //防止重复点击
  137. isAdd: true,
  138. tfc: "",
  139. totalCost: "",
  140. }
  141. },
  142. async onLoad(options) {
  143. //获取车牌号
  144. await this.$api.doRequest('get', '/carInfo/selectCars', {
  145. currentPage: 1,
  146. pageSize: 9999,
  147. compId: uni.getStorageSync('pcUserInfo').compId,
  148. })
  149. .then(res1 => {
  150. console.log(111)
  151. console.log(res1)
  152. if (res1.data.code == 200) {
  153. this.carNolist = res1.data.data.records
  154. }
  155. })
  156. .catch(res => {
  157. uni.$u.toast(res.message);
  158. });
  159. },
  160. onShow() {
  161. },
  162. methods: {
  163. carnopicker(e) {
  164. this.detailData.carNo = this.carNolist[e.target.value].carNo
  165. this.$api.doRequest('get', '/fuelFillingInfo/gettime', {
  166. carNo: this.detailData.carNo,
  167. })
  168. .then(res => {
  169. console.log(111)
  170. console.log(res)
  171. if (res.data.data) {
  172. this.amountDeadline = res.data.data
  173. this.isUseSubmit = false
  174. } else {
  175. // uni.showModal({
  176. // content: res.data.message,
  177. // })
  178. uni.showToast({
  179. title: res.data.message,
  180. icon:'none',
  181. duration:5000
  182. });
  183. this.isUseSubmit = true
  184. }
  185. })
  186. .catch(res => {
  187. uni.$u.toast(res.message);
  188. });
  189. },
  190. async getPlace() {
  191. console.log(1)
  192. //获取形势轨迹
  193. await this.$api.doRequest('post', '/CarPostionController/api/gettrack', {
  194. // startDate:uni.getStorageSync('jyStartTime'),
  195. // endDate:uni.getStorageSync('jyEndTime'),
  196. startDate: "2023-02-20 01:00:00",
  197. endDate: "2023-02-20 24:00:00",
  198. }).then(res => {
  199. console.log(res)
  200. if (res1.data.code == 200) {
  201. // uni.hideLoading()
  202. }
  203. })
  204. .catch(res => {
  205. uni.$u.toast(res.message);
  206. });
  207. },
  208. selectCon() {
  209. uni.navigateTo({
  210. url: '/pages/fuelfilling/selectContract'
  211. })
  212. },
  213. selectWare() {
  214. uni.navigateTo({
  215. url: '/pages/fuelfilling/selectWarehouse?warehouseType=1'
  216. })
  217. },
  218. ltCheck(e) {
  219. this.detailData.purpose = this.purposeList[e[0]].purpose
  220. if (this.detailData.purpose == "合同费用") {
  221. this.detailData.expensesPurpose = "1"
  222. delete this.detailData.warehouseName
  223. } else if (this.detailData.purpose == "库点费用") {
  224. this.detailData.expensesPurpose = "3"
  225. delete this.detailData.contractNo
  226. }
  227. console.log(this.detailData)
  228. },
  229. getImgUrl(res, index) {
  230. if (typeof(this.fillingDetail.addressUrl) == 'string') {
  231. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
  232. }
  233. this.fillingDetail.addressUrl.push(res.data.appendixPath)
  234. console.log(this.fillingDetail)
  235. // console.log('------------res-----------')
  236. },
  237. onError(error) {
  238. alert(error)
  239. console.log('------------error-----------')
  240. console.log(error)
  241. },
  242. onProgress(e) {
  243. console.log(e)
  244. },
  245. onRemove(index, num) {
  246. if (typeof(this.fillingDetail.addressUrl) == 'string') {
  247. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
  248. }
  249. this.fillingDetail.addressUrl.splice(index, 1)
  250. },
  251. filterFileType(index, lists) {
  252. console.log(lists)
  253. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  254. lists.splice(index, 1);
  255. // 当前文件不支持
  256. uni.showModal({
  257. title: '暂不支持当前图片类型',
  258. showCancel: false
  259. });
  260. } else {
  261. this.isAdd = false;
  262. }
  263. },
  264. calculate(index) {
  265. this.fillingDetail.currentConsumption = (this.fillingDetail.oilConsumption * this.fillingDetail
  266. .currentOilPrice).toFixed(2)
  267. },
  268. submitApply() {
  269. var that = this
  270. if (!that.fillingDetail.oilConsumption) {
  271. uni.showToast({
  272. title: "油耗不能为空!",
  273. icon: "none"
  274. })
  275. return
  276. }
  277. if (!that.fillingDetail.currentOilPrice) {
  278. uni.showToast({
  279. title: "当前油价不能为空!",
  280. icon: "none"
  281. })
  282. return
  283. }
  284. if (that.fillingDetail.addressUrl.length == 0) {
  285. uni.showToast({
  286. title: "请上传加油凭证!",
  287. icon: "none"
  288. })
  289. return
  290. }
  291. this.show = true
  292. },
  293. submit() {
  294. uni.showLoading({
  295. title: '加载中',
  296. mask: true
  297. });
  298. this.fillingDetail.tfc = this.tfc
  299. this.fillingDetail.totalCost = this.totalCost
  300. this.fillingDetail.compId = uni.getStorageSync('pcUserInfo').compId
  301. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.toString()
  302. let _obj = {
  303. compId: uni.getStorageSync('pcUserInfo').compId,
  304. fillingDetailInfo: this.fillingDetail,
  305. carNo: this.detailData.carNo,
  306. flag: 1,
  307. remark: this.detailData.remark,
  308. amountDeadline: this.amountDeadline,
  309. commonId: uni.getStorageSync('pcUserInfo').userId,
  310. }
  311. console.log(_obj)
  312. this.$api.doRequest('post', '/fuelFillingInfo/api/addFilling', _obj)
  313. .then(res => {
  314. console.log(res)
  315. uni.hideLoading()
  316. uni.navigateBack()
  317. // if (res1.data.code == 200) {
  318. // this.titleBtn = "申请报销"
  319. // }
  320. })
  321. .catch(res => {
  322. uni.showToast({
  323. title: res.message,
  324. icon: "none"
  325. })
  326. // uni.$u.toast(res.message);
  327. });
  328. // that.$api.doRequest('post', '/fillingDetailInfo/api/addFillingDetail',
  329. // that.fillingDetail
  330. // )
  331. // .then(res => {
  332. // uni.hideLoading()
  333. // if (res.data.code == 200) {
  334. // that.$api.msg('提交成功')
  335. // uni.navigateBack({
  336. // delta: 1
  337. // });
  338. // } else {
  339. // that.$api.msg(res.data.message)
  340. // }
  341. // })
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang='scss' scoped>
  347. .center {
  348. overflow: hidden;
  349. padding-bottom:200rpx;
  350. }
  351. page {
  352. background: #F5F6FA;
  353. }
  354. .title_b {
  355. margin: 20rpx 20rpx 0rpx 20rpx;
  356. padding: 20rpx 10rpx 20rpx 10rpx;
  357. font-weight: 550;
  358. }
  359. .c-row {
  360. display: -webkit-box;
  361. display: -webkit-flex;
  362. display: flex;
  363. -webkit-box-align: center;
  364. -webkit-align-items: center;
  365. align-items: center;
  366. padding: 20rpx 30rpx;
  367. position: relative;
  368. }
  369. .level2-title {}
  370. .level2-title {
  371. font-weight: 700;
  372. color: #000000;
  373. }
  374. .jt-icon {
  375. position: relative;
  376. top: 6rpx;
  377. width: 60rpx;
  378. margin: 0 20rpx;
  379. }
  380. .xf-iamge {
  381. width: 74rpx;
  382. height: 43rpx;
  383. position: absolute;
  384. top: -20rpx;
  385. right: 0;
  386. }
  387. .ssx {
  388. width: 20px;
  389. height: 20px;
  390. background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
  391. font-family: PingFangSC-Medium, PingFang SC;
  392. font-weight: 500;
  393. color: #FFFFFF;
  394. border-radius: 50%;
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. margin-right: 5px;
  399. }
  400. .con-list {
  401. -webkit-box-flex: 1;
  402. -webkit-flex: 1;
  403. flex: 1;
  404. display: -webkit-box;
  405. display: -webkit-flex;
  406. display: flex;
  407. -webkit-box-orient: vertical;
  408. -webkit-box-direction: normal;
  409. -webkit-flex-direction: column;
  410. flex-direction: column;
  411. color: #303133;
  412. line-height: 40rpx;
  413. text-align: right;
  414. .item1,
  415. .item3 {
  416. // width: 40%;
  417. display: flex;
  418. .text {
  419. text-overflow: ellipsis;
  420. overflow: hidden;
  421. white-space: nowrap;
  422. }
  423. }
  424. .item1 .text {
  425. text-align: left;
  426. }
  427. .item3 .text {
  428. text-align: right;
  429. }
  430. }
  431. .align-center {
  432. align-items: center;
  433. justify-content: flex-end;
  434. }
  435. .wrap1 {
  436. background: #fff;
  437. margin: 10px;
  438. border-radius: 15px 10px;
  439. margin-top: 18px;
  440. input {}
  441. .tit {
  442. margin-left: 14px;
  443. width: 47px;
  444. padding-top: 10px;
  445. }
  446. .eliminate1 {
  447. max-width: 50%;
  448. width: 20px;
  449. height: 20px;
  450. font-family: PingFangSC-Medium, PingFang SC;
  451. font-weight: 500;
  452. border-radius: 50%;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. margin-right: 5px;
  457. margin-top: -20px;
  458. margin-left: 73px;
  459. }
  460. .eliminate2 {
  461. max-width: 50%;
  462. width: 20px;
  463. height: 20px;
  464. font-family: PingFangSC-Medium, PingFang SC;
  465. font-weight: 500;
  466. border-radius: 50%;
  467. display: flex;
  468. justify-content: center;
  469. align-items: center;
  470. margin-right: 5px;
  471. margin-top: -20px;
  472. margin-left: 100px;
  473. }
  474. .upload {
  475. /* margin-left: 157px; */
  476. }
  477. }
  478. .wrap {
  479. background: #fff;
  480. margin: 10px;
  481. border-radius: 15px 10px;
  482. margin-top: 18px;
  483. input {}
  484. >.title {
  485. padding: 10px 16px;
  486. }
  487. }
  488. .footer {
  489. background: #fff;
  490. width: 100%;
  491. padding: 20px 10px;
  492. position: fixed;
  493. bottom: 0;
  494. .button {
  495. background: #4089ff;
  496. width: 90%;
  497. margin: 0px auto;
  498. padding: 10px;
  499. color: #fff;
  500. text-align: center;
  501. border-radius: 30px;
  502. margin-top: 10px;
  503. }
  504. .button1 {
  505. background: #F5F6FA;
  506. width: 90%;
  507. margin: 0px auto;
  508. padding: 10px;
  509. color: #9b9fa5;
  510. text-align: center;
  511. border-radius: 30px;
  512. margin-top: 10px;
  513. }
  514. }
  515. .buns_item {
  516. display: flex;
  517. padding: 80rpx 0 50rpx 0;
  518. justify-content: space-around;
  519. }
  520. .but_css {
  521. background: #22C572;
  522. width: 40%;
  523. padding: 20rpx;
  524. color: #fff;
  525. text-align: center;
  526. border-radius: 20rpx;
  527. }
  528. /deep/.u-radio-group {
  529. flex-direction: row-reverse;
  530. }
  531. .no-boder {
  532. border: 0;
  533. }
  534. .textarea {
  535. background: #F9F9FA;
  536. border: 1px solid #EEEEEE;
  537. }
  538. .remark {
  539. position: absolute;
  540. right: 10px;
  541. bottom: 8rpx;
  542. color: #AFB3BF;
  543. }
  544. /deep/.uni-textarea-textarea{
  545. height:61px;
  546. }
  547. .voucher {
  548. margin-left: 20rpx;
  549. }
  550. .wrap1 {
  551. /* padding-bottom: 10px; */
  552. font-size: 14px;
  553. /* background: #fff; */
  554. margin: 10px;
  555. border-radius: 10px;
  556. input {
  557. font-size: 14px;
  558. }
  559. >.title {
  560. padding: 10px 16px;
  561. }
  562. }
  563. /deep/.u-list-item {
  564. width: 27vw !important;
  565. height: 27vw !important;
  566. }
  567. </style>