apply_for_reimbursement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view class="center">
  3. <view>
  4. <view class='wrap'>
  5. <view class="c-row">
  6. <view class="title">车牌号</view>
  7. <view class="con-list">
  8. {{detailData.carNo}}
  9. </view>
  10. </view>
  11. <view class="c-row">
  12. <view class="title">行程轨迹</view>
  13. <view class="con-list">
  14. <view class="flex align-center">
  15. <view class="item1">
  16. <view class="ssx">{{$helper.getProvinceAbbreviation(detailData.originProvince)}}</view>
  17. <view class="level2-title" style="font-size: 5px;">
  18. {{$helper.filterUrban(detailData.originCity)}}
  19. {{$helper.filterArea(detailData.originArea)}}
  20. </view>
  21. </view>
  22. <image class="jt-icon item2" src="@/static/images/fuel/jt.png" mode='widthFix'>
  23. </image>
  24. <view class="item3">
  25. <view class="ssx">{{$helper.getProvinceAbbreviation(detailData.destinationProvince)}}
  26. </view>
  27. <view class="level2-title">{{$helper.filterUrban(detailData.destinationCity)}}
  28. {{$helper.filterArea(detailData.destinationArea)}}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class='wrap1' v-for="(item , index) in fillingDetail.fillingDetailInfoList" :Key="index">
  36. <view class="tit" style="font-size: 16px;">加油-{{index+1}}</view>
  37. <image src="../../static/img/sign/jian@2x.png" class="eliminate1" @click="delApply(index)">
  38. </image>
  39. <image src="../../static/img/sign/jia@2x.png" class="eliminate2" @click="addApply(index)">
  40. </image>
  41. <view class="c-row">
  42. <view class="title">油耗(升)</view>
  43. <view class="con-list">
  44. <input v-model='item.oilConsumption' placeholder="请输入油耗" @input='calculate(index)'></input>
  45. </view>
  46. </view>
  47. <view class="c-row">
  48. <view class="title">当前油价(元/升)</view>
  49. <view class="con-list">
  50. <input type="digit" v-model='item.currentOilPrice' placeholder="请输入当前油价"
  51. @input='calculate(index)'></input>
  52. </view>
  53. </view>
  54. <view class="c-row">
  55. <view class="title">计算金额(元)</view>
  56. <view class="con-list">
  57. <input type="digit" v-model='item.currentConsumption' placeholder="不可编辑,自动计算"
  58. :disabled="true"></input>
  59. </view>
  60. </view>
  61. <view class="c-row">
  62. <view class="title">加油凭证</view>
  63. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :size-type="['compressed']"
  64. @on-success="getImgUrl($event,index)" @on-error="onError" @on-remove="onRemove($event,index)"
  65. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  66. </view>
  67. </view>
  68. <view class="footer">
  69. <view class="c-row">
  70. <view class="title">总油耗(L)</view>
  71. <view class="con-list">
  72. <input :disabled="true" v-model='tfc' placeholder="不可编辑,自动计算" type="digit"></input>
  73. </view>
  74. </view>
  75. <view class="c-row">
  76. <view class="title">合计金额(元)</view>
  77. <view class="con-list">
  78. <input :disabled="true" v-model='totalCost' placeholder="不可编辑,自动计算" type="digit"></input>
  79. </view>
  80. </view>
  81. <view @click='submitApply' class="button">提交申请</view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import upload from '@/components/upload.vue';
  88. export default {
  89. components: {
  90. upload,
  91. },
  92. data() {
  93. return {
  94. detailData: {
  95. carNo: '辽A11111',
  96. destinationProvince: "",
  97. destinationCity: "",
  98. destinationArea: "",
  99. carNo: "",
  100. originProvince: "",
  101. originCity: "",
  102. originArea: "",
  103. },
  104. fillingDetail: {
  105. fillingDetailInfoList: [{
  106. oilConsumption: "",
  107. currentOilPrice: "",
  108. currentConsumption: "",
  109. addressUrl: [],
  110. compId: uni.getStorageSync('pcUserInfo').compId,
  111. commonId: uni.getStorageSync('pcUserInfo').userId,
  112. fillingId: "",
  113. }],
  114. tfc: "",
  115. totalCost: ""
  116. },
  117. action: this.$uploadUrl,
  118. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  119. btnLoading: false, //防止重复点击
  120. isAdd: true,
  121. tfc: "",
  122. totalCost: ""
  123. }
  124. },
  125. onLoad(options) {
  126. this.id = options.id
  127. this.fillingDetail.fillingDetailInfoList[0].fillingId = this.id
  128. },
  129. onShow() {
  130. var that = this
  131. if (this.id) {
  132. this.seeInfo()
  133. }
  134. },
  135. methods: {
  136. seeInfo() {
  137. this.$api.doRequest('get', '/fuelFillingInfo/getFilling', {
  138. id: this.id
  139. }).then(res => {
  140. if (res.data.code == 200) {
  141. this.detailData = res.data.data
  142. }
  143. })
  144. },
  145. getImgUrl(res, index) {
  146. this.fillingDetail.fillingDetailInfoList[index].addressUrl.push(res)
  147. // if(this.fillingDetail.fillingDetailInfoList[index].addressUrl){
  148. // this.fillingDetail.fillingDetailInfoList[index].addressUrl = this.fillingDetail.fillingDetailInfoList[index].addressUrl +","+res
  149. // }else{
  150. // this.fillingDetail.fillingDetailInfoList[index].addressUrl = res
  151. // }
  152. // console.log(res)
  153. // console.log('------------res-----------')
  154. },
  155. onError(error) {
  156. alert(error)
  157. console.log('------------error-----------')
  158. console.log(error)
  159. },
  160. onProgress(e) {
  161. console.log(e)
  162. },
  163. onRemove(index, num) {
  164. this.fillingDetail.fillingDetailInfoList[num].addressUrl.splice(index, 1)
  165. },
  166. filterFileType(index, lists) {
  167. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  168. lists.splice(index, 1);
  169. // 当前文件不支持
  170. uni.showModal({
  171. title: '暂不支持当前图片类型',
  172. showCancel: false
  173. });
  174. } else {
  175. this.isAdd = false;
  176. }
  177. },
  178. calculate(index) {
  179. this.fillingDetail.fillingDetailInfoList[index].currentConsumption = (this.fillingDetail
  180. .fillingDetailInfoList[index].oilConsumption * this.fillingDetail.fillingDetailInfoList[index]
  181. .currentOilPrice)
  182. .toFixed(2)
  183. this.tfc = ""
  184. this.totalCost = ""
  185. for (let i = 0; i < this.fillingDetail.fillingDetailInfoList.length; i++) {
  186. this.tfc = (Number(this.tfc) + Number(this.fillingDetail.fillingDetailInfoList[i].oilConsumption))
  187. .toFixed(2)
  188. this.totalCost = (Number(this.totalCost) + Number(this.fillingDetail.fillingDetailInfoList[i]
  189. .currentConsumption)).toFixed(2)
  190. this.$forceUpdate()
  191. }
  192. },
  193. delApply(index) {
  194. this.fillingDetail.fillingDetailInfoList.splice(index, 1)
  195. },
  196. addApply() {
  197. this.fillingDetail.fillingDetailInfoList.push({
  198. oilConsumption: "",
  199. currentOilPrice: "",
  200. currentConsumption: "",
  201. addressUrl: [],
  202. compId: uni.getStorageSync('pcUserInfo').compId,
  203. commonId: uni.getStorageSync('pcUserInfo').userId,
  204. fillingId: this.id
  205. })
  206. },
  207. submitApply() {
  208. var that = this
  209. uni.showModal({
  210. content: "确定提交申请信息?",
  211. showCancel: true,
  212. confirmText: '提交',
  213. success: function(res) {
  214. if (res.confirm) {
  215. that.fillingDetail.tfc = that.tfc
  216. that.fillingDetail.totalCost = that.totalCost
  217. for (let i = 0; i < that.fillingDetail.fillingDetailInfoList.length; i++) {
  218. that.fillingDetail.fillingDetailInfoList[i].addressUrl = that.fillingDetail
  219. .fillingDetailInfoList[i].addressUrl.toString()
  220. }
  221. that.$api.doRequest('post', '/fillingDetailInfo/api/addFillingDetail',
  222. that.fillingDetail
  223. )
  224. .then(res => {
  225. if (res.data.code == 200) {
  226. that.$api.msg('提交成功')
  227. uni.navigateTo({
  228. url: '/pages/fuelfilling/the_fuel_filling'
  229. })
  230. } else {
  231. that.$api.msg('提交失败')
  232. }
  233. })
  234. }
  235. }
  236. })
  237. },
  238. }
  239. }
  240. </script>
  241. <style lang='scss' scoped>
  242. .center {
  243. padding-bottom: 330rpx;
  244. }
  245. page {
  246. background: #F5F6FA;
  247. }
  248. .title_b {
  249. margin: 20rpx 20rpx 0rpx 20rpx;
  250. padding: 20rpx 10rpx 20rpx 10rpx;
  251. font-size: 18px;
  252. font-weight: 550;
  253. }
  254. .c-row {
  255. display: -webkit-box;
  256. display: -webkit-flex;
  257. display: flex;
  258. -webkit-box-align: center;
  259. -webkit-align-items: center;
  260. align-items: center;
  261. padding: 20rpx 30rpx;
  262. position: relative;
  263. }
  264. .level2-title {
  265. font-size: 14rpx;
  266. }
  267. .level2-title {
  268. font-weight: 700;
  269. color: #000000;
  270. }
  271. .jt-icon {
  272. position: relative;
  273. top: 6rpx;
  274. width: 60rpx;
  275. margin: 0 20rpx;
  276. }
  277. .xf-iamge {
  278. width: 74rpx;
  279. height: 43rpx;
  280. position: absolute;
  281. top: -20rpx;
  282. right: 0;
  283. }
  284. .ssx {
  285. width: 20px;
  286. height: 20px;
  287. background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
  288. font-size: 13px;
  289. font-family: PingFangSC-Medium, PingFang SC;
  290. font-weight: 500;
  291. color: #FFFFFF;
  292. border-radius: 50%;
  293. display: flex;
  294. justify-content: center;
  295. align-items: center;
  296. margin-right: 5px;
  297. }
  298. .con-list {
  299. -webkit-box-flex: 1;
  300. -webkit-flex: 1;
  301. flex: 1;
  302. display: -webkit-box;
  303. display: -webkit-flex;
  304. display: flex;
  305. -webkit-box-orient: vertical;
  306. -webkit-box-direction: normal;
  307. -webkit-flex-direction: column;
  308. flex-direction: column;
  309. color: #303133;
  310. line-height: 40rpx;
  311. text-align: right;
  312. padding-right: 20rpx;
  313. .item1,
  314. .item3 {
  315. // width: 40%;
  316. display: flex;
  317. .text {
  318. text-overflow: ellipsis;
  319. overflow: hidden;
  320. white-space: nowrap;
  321. }
  322. }
  323. .item1 .text {
  324. text-align: left;
  325. }
  326. .item3 .text {
  327. text-align: right;
  328. }
  329. }
  330. .align-center {
  331. align-items: center;
  332. margin-left: 64px;
  333. width: 83%;
  334. }
  335. .wrap1 {
  336. font-size: 14px;
  337. background: #fff;
  338. margin: 10px;
  339. border-radius: 15px 10px;
  340. margin-top: 18px;
  341. input {
  342. font-size: 14px;
  343. }
  344. .tit {
  345. margin-left: 14px;
  346. width: 47px;
  347. padding-top: 10px;
  348. }
  349. .eliminate1 {
  350. max-width: 50%;
  351. width: 20px;
  352. height: 20px;
  353. font-size: 13px;
  354. font-family: PingFangSC-Medium, PingFang SC;
  355. font-weight: 500;
  356. border-radius: 50%;
  357. display: flex;
  358. justify-content: center;
  359. align-items: center;
  360. margin-right: 5px;
  361. margin-top: -20px;
  362. margin-left: 73px;
  363. }
  364. .eliminate2 {
  365. max-width: 50%;
  366. width: 20px;
  367. height: 20px;
  368. font-size: 13px;
  369. font-family: PingFangSC-Medium, PingFang SC;
  370. font-weight: 500;
  371. border-radius: 50%;
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. margin-right: 5px;
  376. margin-top: -20px;
  377. margin-left: 100px;
  378. }
  379. .upload {
  380. margin-left: 157px;
  381. }
  382. }
  383. .wrap {
  384. font-size: 14px;
  385. background: #fff;
  386. margin: 10px;
  387. border-radius: 15px 10px;
  388. margin-top: 18px;
  389. input {
  390. font-size: 14px;
  391. }
  392. >.title {
  393. padding: 10px 16px;
  394. }
  395. }
  396. .footer {
  397. background: #fff;
  398. position: fixed;
  399. bottom: 0;
  400. width: 100%;
  401. padding: 20px 10px;
  402. z-index: 10;
  403. height: 25%;
  404. .button {
  405. background: #4089ff;
  406. width: 90%;
  407. margin: 250px auto;
  408. padding: 10px;
  409. color: #fff;
  410. text-align: center;
  411. border-radius: 30px;
  412. margin-top: 10px;
  413. }
  414. }
  415. .buns_item {
  416. display: flex;
  417. padding: 80rpx 0 50rpx 0;
  418. justify-content: space-around;
  419. }
  420. .but_css {
  421. background: #22C572;
  422. width: 40%;
  423. padding: 20rpx;
  424. color: #fff;
  425. text-align: center;
  426. border-radius: 20rpx;
  427. }
  428. /deep/.u-radio-group {
  429. flex-direction: row-reverse;
  430. }
  431. .no-boder {
  432. border: 0;
  433. }
  434. .textarea {
  435. background: #F9F9FA;
  436. border: 1px solid #EEEEEE;
  437. }
  438. </style>