apply_for_reimbursement.vue 11 KB

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