apply_for_edit_reimbursement.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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' :clearable='false' 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.showToast({
  242. title: '编辑成功',
  243. icon: "none"
  244. })
  245. setTimeout(()=>{
  246. uni.navigateBack()
  247. })
  248. // if (res1.data.code == 200) {
  249. // this.titleBtn = "申请报销"
  250. // }
  251. })
  252. .catch(res => {
  253. uni.showToast({
  254. title: res.message,
  255. icon: "none"
  256. })
  257. // uni.$u.toast(res.message);
  258. });
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang='scss' scoped>
  264. .center {
  265. overflow: hidden;
  266. padding-bottom:200rpx;
  267. }
  268. page {
  269. background: #F5F6FA;
  270. }
  271. .title_b {
  272. margin: 20rpx 20rpx 0rpx 20rpx;
  273. padding: 20rpx 10rpx 20rpx 10rpx;
  274. font-weight: 550;
  275. }
  276. .c-row {
  277. display: -webkit-box;
  278. display: -webkit-flex;
  279. display: flex;
  280. -webkit-box-align: center;
  281. -webkit-align-items: center;
  282. align-items: center;
  283. padding: 20rpx 30rpx;
  284. position: relative;
  285. }
  286. .level2-title {}
  287. .level2-title {
  288. font-weight: 700;
  289. color: #000000;
  290. }
  291. .jt-icon {
  292. position: relative;
  293. top: 6rpx;
  294. width: 60rpx;
  295. margin: 0 20rpx;
  296. }
  297. .xf-iamge {
  298. width: 74rpx;
  299. height: 43rpx;
  300. position: absolute;
  301. top: -20rpx;
  302. right: 0;
  303. }
  304. .ssx {
  305. width: 20px;
  306. height: 20px;
  307. background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
  308. font-family: PingFangSC-Medium, PingFang SC;
  309. font-weight: 500;
  310. color: #FFFFFF;
  311. border-radius: 50%;
  312. display: flex;
  313. justify-content: center;
  314. align-items: center;
  315. margin-right: 5px;
  316. }
  317. .con-list {
  318. -webkit-box-flex: 1;
  319. -webkit-flex: 1;
  320. flex: 1;
  321. display: -webkit-box;
  322. display: -webkit-flex;
  323. display: flex;
  324. -webkit-box-orient: vertical;
  325. -webkit-box-direction: normal;
  326. -webkit-flex-direction: column;
  327. flex-direction: column;
  328. color: #303133;
  329. line-height: 40rpx;
  330. text-align: right;
  331. .item1,
  332. .item3 {
  333. // width: 40%;
  334. display: flex;
  335. .text {
  336. text-overflow: ellipsis;
  337. overflow: hidden;
  338. white-space: nowrap;
  339. }
  340. }
  341. .item1 .text {
  342. text-align: left;
  343. }
  344. .item3 .text {
  345. text-align: right;
  346. }
  347. }
  348. .align-center {
  349. align-items: center;
  350. justify-content: flex-end;
  351. }
  352. .wrap1 {
  353. background: #fff;
  354. margin: 10px;
  355. border-radius: 15px 10px;
  356. margin-top: 18px;
  357. input {}
  358. .tit {
  359. margin-left: 14px;
  360. width: 47px;
  361. padding-top: 10px;
  362. }
  363. .eliminate1 {
  364. max-width: 50%;
  365. width: 20px;
  366. height: 20px;
  367. font-family: PingFangSC-Medium, PingFang SC;
  368. font-weight: 500;
  369. border-radius: 50%;
  370. display: flex;
  371. justify-content: center;
  372. align-items: center;
  373. margin-right: 5px;
  374. margin-top: -20px;
  375. margin-left: 73px;
  376. }
  377. .eliminate2 {
  378. max-width: 50%;
  379. width: 20px;
  380. height: 20px;
  381. font-family: PingFangSC-Medium, PingFang SC;
  382. font-weight: 500;
  383. border-radius: 50%;
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. margin-right: 5px;
  388. margin-top: -20px;
  389. margin-left: 100px;
  390. }
  391. .upload {
  392. /* margin-left: 157px; */
  393. }
  394. }
  395. .wrap {
  396. background: #fff;
  397. margin: 10px;
  398. border-radius: 15px 10px;
  399. margin-top: 18px;
  400. input {}
  401. >.title {
  402. padding: 10px 16px;
  403. }
  404. }
  405. .footer {
  406. background: #fff;
  407. width: 100%;
  408. padding: 20px 10px;
  409. position: fixed;
  410. bottom: 0;
  411. .button {
  412. background: #4089ff;
  413. width: 90%;
  414. margin: 0px auto;
  415. padding: 10px;
  416. color: #fff;
  417. text-align: center;
  418. border-radius: 30px;
  419. margin-top: 10px;
  420. }
  421. }
  422. .buns_item {
  423. display: flex;
  424. padding: 80rpx 0 50rpx 0;
  425. justify-content: space-around;
  426. }
  427. .but_css {
  428. background: #22C572;
  429. width: 40%;
  430. padding: 20rpx;
  431. color: #fff;
  432. text-align: center;
  433. border-radius: 20rpx;
  434. }
  435. /deep/.u-radio-group {
  436. flex-direction: row-reverse;
  437. }
  438. .no-boder {
  439. border: 0;
  440. }
  441. .textarea {
  442. background: #F9F9FA;
  443. border: 1px solid #EEEEEE;
  444. }
  445. .remark {
  446. position: absolute;
  447. right: 10px;
  448. bottom: 8rpx;
  449. color: #AFB3BF;
  450. }
  451. /deep/.uni-textarea-textarea{
  452. height:61px;
  453. }
  454. .voucher {
  455. margin-left: 20rpx;
  456. }
  457. .wrap1 {
  458. /* padding-bottom: 10px; */
  459. font-size: 14px;
  460. /* background: #fff; */
  461. margin: 10px;
  462. border-radius: 10px;
  463. input {
  464. font-size: 14px;
  465. }
  466. >.title {
  467. padding: 10px 16px;
  468. }
  469. }
  470. /deep/.u-list-item {
  471. width: 27vw !important;
  472. height: 27vw !important;
  473. }
  474. </style>