apply_for_reimbursement.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  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' 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. } else {
  174. uni.showModal({
  175. content: res.data.message,
  176. })
  177. this.isUseSubmit = true
  178. }
  179. })
  180. .catch(res => {
  181. uni.$u.toast(res.message);
  182. });
  183. },
  184. async getPlace() {
  185. console.log(1)
  186. //获取形势轨迹
  187. await this.$api.doRequest('post', '/CarPostionController/api/gettrack', {
  188. // startDate:uni.getStorageSync('jyStartTime'),
  189. // endDate:uni.getStorageSync('jyEndTime'),
  190. startDate: "2023-02-20 01:00:00",
  191. endDate: "2023-02-20 24:00:00",
  192. }).then(res => {
  193. console.log(res)
  194. if (res1.data.code == 200) {
  195. // uni.hideLoading()
  196. }
  197. })
  198. .catch(res => {
  199. uni.$u.toast(res.message);
  200. });
  201. },
  202. selectCon() {
  203. uni.navigateTo({
  204. url: '/pages/fuelfilling/selectContract'
  205. })
  206. },
  207. selectWare() {
  208. uni.navigateTo({
  209. url: '/pages/fuelfilling/selectWarehouse?warehouseType=1'
  210. })
  211. },
  212. ltCheck(e) {
  213. this.detailData.purpose = this.purposeList[e[0]].purpose
  214. if (this.detailData.purpose == "合同费用") {
  215. this.detailData.expensesPurpose = "1"
  216. delete this.detailData.warehouseName
  217. } else if (this.detailData.purpose == "库点费用") {
  218. this.detailData.expensesPurpose = "3"
  219. delete this.detailData.contractNo
  220. }
  221. console.log(this.detailData)
  222. },
  223. getImgUrl(res, index) {
  224. if (typeof(this.fillingDetail.addressUrl) == 'string') {
  225. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
  226. }
  227. this.fillingDetail.addressUrl.push(res.data.appendixPath)
  228. console.log(this.fillingDetail)
  229. // console.log('------------res-----------')
  230. },
  231. onError(error) {
  232. alert(error)
  233. console.log('------------error-----------')
  234. console.log(error)
  235. },
  236. onProgress(e) {
  237. console.log(e)
  238. },
  239. onRemove(index, num) {
  240. if (typeof(this.fillingDetail.addressUrl) == 'string') {
  241. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.split(',')
  242. }
  243. this.fillingDetail.addressUrl.splice(index, 1)
  244. },
  245. filterFileType(index, lists) {
  246. console.log(lists)
  247. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  248. lists.splice(index, 1);
  249. // 当前文件不支持
  250. uni.showModal({
  251. title: '暂不支持当前图片类型',
  252. showCancel: false
  253. });
  254. } else {
  255. this.isAdd = false;
  256. }
  257. },
  258. calculate(index) {
  259. this.fillingDetail.currentConsumption = (this.fillingDetail.oilConsumption * this.fillingDetail
  260. .currentOilPrice).toFixed(2)
  261. },
  262. submitApply() {
  263. var that = this
  264. if (!that.fillingDetail.oilConsumption) {
  265. uni.showToast({
  266. title: "油耗不能为空!",
  267. icon: "none"
  268. })
  269. return
  270. }
  271. if (!that.fillingDetail.currentOilPrice) {
  272. uni.showToast({
  273. title: "当前油价不能为空!",
  274. icon: "none"
  275. })
  276. return
  277. }
  278. if (that.fillingDetail.addressUrl.length == 0) {
  279. uni.showToast({
  280. title: "请上传加油凭证!",
  281. icon: "none"
  282. })
  283. return
  284. }
  285. this.show = true
  286. },
  287. submit() {
  288. uni.showLoading({
  289. title: '加载中',
  290. mask: true
  291. });
  292. this.fillingDetail.tfc = this.tfc
  293. this.fillingDetail.totalCost = this.totalCost
  294. this.fillingDetail.compId = uni.getStorageSync('pcUserInfo').compId
  295. this.fillingDetail.addressUrl = this.fillingDetail.addressUrl.toString()
  296. let _obj = {
  297. compId: uni.getStorageSync('pcUserInfo').compId,
  298. fillingDetailInfo: this.fillingDetail,
  299. carNo: this.detailData.carNo,
  300. flag: 1,
  301. remark: this.detailData.remark,
  302. amountDeadline: this.amountDeadline
  303. }
  304. console.log(_obj)
  305. this.$api.doRequest('post', '/fuelFillingInfo/api/addFilling', _obj)
  306. .then(res => {
  307. console.log(res)
  308. uni.hideLoading()
  309. uni.navigateBack()
  310. // if (res1.data.code == 200) {
  311. // this.titleBtn = "申请报销"
  312. // }
  313. })
  314. .catch(res => {
  315. uni.$u.toast(res.message);
  316. });
  317. // that.$api.doRequest('post', '/fillingDetailInfo/api/addFillingDetail',
  318. // that.fillingDetail
  319. // )
  320. // .then(res => {
  321. // uni.hideLoading()
  322. // if (res.data.code == 200) {
  323. // that.$api.msg('提交成功')
  324. // uni.navigateBack({
  325. // delta: 1
  326. // });
  327. // } else {
  328. // that.$api.msg(res.data.message)
  329. // }
  330. // })
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang='scss' scoped>
  336. .center {
  337. overflow: hidden;
  338. }
  339. page {
  340. background: #F5F6FA;
  341. }
  342. .title_b {
  343. margin: 20rpx 20rpx 0rpx 20rpx;
  344. padding: 20rpx 10rpx 20rpx 10rpx;
  345. font-weight: 550;
  346. }
  347. .c-row {
  348. display: -webkit-box;
  349. display: -webkit-flex;
  350. display: flex;
  351. -webkit-box-align: center;
  352. -webkit-align-items: center;
  353. align-items: center;
  354. padding: 20rpx 30rpx;
  355. position: relative;
  356. }
  357. .level2-title {}
  358. .level2-title {
  359. font-weight: 700;
  360. color: #000000;
  361. }
  362. .jt-icon {
  363. position: relative;
  364. top: 6rpx;
  365. width: 60rpx;
  366. margin: 0 20rpx;
  367. }
  368. .xf-iamge {
  369. width: 74rpx;
  370. height: 43rpx;
  371. position: absolute;
  372. top: -20rpx;
  373. right: 0;
  374. }
  375. .ssx {
  376. width: 20px;
  377. height: 20px;
  378. background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
  379. font-family: PingFangSC-Medium, PingFang SC;
  380. font-weight: 500;
  381. color: #FFFFFF;
  382. border-radius: 50%;
  383. display: flex;
  384. justify-content: center;
  385. align-items: center;
  386. margin-right: 5px;
  387. }
  388. .con-list {
  389. -webkit-box-flex: 1;
  390. -webkit-flex: 1;
  391. flex: 1;
  392. display: -webkit-box;
  393. display: -webkit-flex;
  394. display: flex;
  395. -webkit-box-orient: vertical;
  396. -webkit-box-direction: normal;
  397. -webkit-flex-direction: column;
  398. flex-direction: column;
  399. color: #303133;
  400. line-height: 40rpx;
  401. text-align: right;
  402. .item1,
  403. .item3 {
  404. // width: 40%;
  405. display: flex;
  406. .text {
  407. text-overflow: ellipsis;
  408. overflow: hidden;
  409. white-space: nowrap;
  410. }
  411. }
  412. .item1 .text {
  413. text-align: left;
  414. }
  415. .item3 .text {
  416. text-align: right;
  417. }
  418. }
  419. .align-center {
  420. align-items: center;
  421. justify-content: flex-end;
  422. }
  423. .wrap1 {
  424. background: #fff;
  425. margin: 10px;
  426. border-radius: 15px 10px;
  427. margin-top: 18px;
  428. input {}
  429. .tit {
  430. margin-left: 14px;
  431. width: 47px;
  432. padding-top: 10px;
  433. }
  434. .eliminate1 {
  435. max-width: 50%;
  436. width: 20px;
  437. height: 20px;
  438. font-family: PingFangSC-Medium, PingFang SC;
  439. font-weight: 500;
  440. border-radius: 50%;
  441. display: flex;
  442. justify-content: center;
  443. align-items: center;
  444. margin-right: 5px;
  445. margin-top: -20px;
  446. margin-left: 73px;
  447. }
  448. .eliminate2 {
  449. max-width: 50%;
  450. width: 20px;
  451. height: 20px;
  452. font-family: PingFangSC-Medium, PingFang SC;
  453. font-weight: 500;
  454. border-radius: 50%;
  455. display: flex;
  456. justify-content: center;
  457. align-items: center;
  458. margin-right: 5px;
  459. margin-top: -20px;
  460. margin-left: 100px;
  461. }
  462. .upload {
  463. /* margin-left: 157px; */
  464. }
  465. }
  466. .wrap {
  467. background: #fff;
  468. margin: 10px;
  469. border-radius: 15px 10px;
  470. margin-top: 18px;
  471. input {}
  472. >.title {
  473. padding: 10px 16px;
  474. }
  475. }
  476. .footer {
  477. background: #fff;
  478. width: 100%;
  479. padding: 20px 10px;
  480. position: fixed;
  481. bottom: 0;
  482. .button {
  483. background: #4089ff;
  484. width: 90%;
  485. margin: 0px auto;
  486. padding: 10px;
  487. color: #fff;
  488. text-align: center;
  489. border-radius: 30px;
  490. margin-top: 10px;
  491. }
  492. .button1 {
  493. background: #F5F6FA;
  494. width: 90%;
  495. margin: 0px auto;
  496. padding: 10px;
  497. color: #9b9fa5;
  498. text-align: center;
  499. border-radius: 30px;
  500. margin-top: 10px;
  501. }
  502. }
  503. .buns_item {
  504. display: flex;
  505. padding: 80rpx 0 50rpx 0;
  506. justify-content: space-around;
  507. }
  508. .but_css {
  509. background: #22C572;
  510. width: 40%;
  511. padding: 20rpx;
  512. color: #fff;
  513. text-align: center;
  514. border-radius: 20rpx;
  515. }
  516. /deep/.u-radio-group {
  517. flex-direction: row-reverse;
  518. }
  519. .no-boder {
  520. border: 0;
  521. }
  522. .textarea {
  523. background: #F9F9FA;
  524. border: 1px solid #EEEEEE;
  525. }
  526. .remark {
  527. position: absolute;
  528. right: 10px;
  529. bottom: 20px;
  530. color: #AFB3BF;
  531. }
  532. .voucher {
  533. margin-left: 20rpx;
  534. }
  535. .wrap1 {
  536. /* padding-bottom: 10px; */
  537. font-size: 14px;
  538. /* background: #fff; */
  539. margin: 10px;
  540. border-radius: 10px;
  541. input {
  542. font-size: 14px;
  543. }
  544. >.title {
  545. padding: 10px 16px;
  546. }
  547. }
  548. /deep/.u-list-item {
  549. width: 27vw !important;
  550. height: 27vw !important;
  551. }
  552. </style>