apply_for_edit_reimbursement.vue 11 KB

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