short_distance_record.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="content1-top">
  5. <view class="top2">
  6. <view class="left">
  7. <view @click='tabcarchange(1)' class='line' :class='searchType==1?"active":""'>未完成</view>
  8. <view @click='tabcarchange(3)' class='line' :class='searchType==3?"active":""'>已完成</view>
  9. </view>
  10. <view class="right uni-button">
  11. <button v-if="searchType==3" style="line-height: 28px;margin-right: 5px;"
  12. class="right-contrent1" @click="requestFunds">请款</button>
  13. <button style="line-height: 28px;" class="right-contrent1" @click="trackAddition">添加</button>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <mescroll-body ref="mescrollRef" :down="downOption" @down="downCallback" @up="upCallback" @init="mescrollInit">
  19. <view style="display: flex;align-items: center;" v-for="(item,index) in shortDetail.shortFillingList" :key="index" @click='getInfo(item)'>
  20. <view style="width: 30px;">
  21. <label @click.stop='emptyclick'>
  22. <checkbox-group v-model="show2" class="fuxuankuang" @change="checkedChange(item,$event,index)" v-if="searchType==3">
  23. <checkbox :checked='item.checked' :value="'cd'+index" style="transform:scale(0.7)" :disabled="item.travelStatus == '已申请'" />
  24. </checkbox-group>
  25. </label>
  26. </view>
  27. <view class="good-list flex">
  28. <view style="padding: 0 35rpx 0rpx 35rpx;">
  29. <view class="flex align-center" style="width: 103%;margin-left: 12px;">
  30. <view class="item1">
  31. <view class="ssx">{{$helper.getProvinceAbbreviation(item.originProvince)}}</view>
  32. <view class="level2-title" style="font-size: 14px;">{{$helper.filterUrban(item.originCity)}}
  33. {{$helper.filterArea(item.originArea)}}
  34. </view>
  35. </view>
  36. <image class="jt-icon item2" src="@/static/images/fuel/jt.png" mode='widthFix'>
  37. </image>
  38. <view class="item3">
  39. <view class="ssx">{{$helper.getProvinceAbbreviation(item.destinationProvince)}}</view>
  40. <view class="level2-title">{{$helper.filterUrban(item.destinationCity)}}
  41. {{$helper.filterArea(item.destinationArea)}}
  42. </view>
  43. </view>
  44. <view class="wenzi audit1" v-if="item.travelStatus">{{item.travelStatus}}</view>
  45. </view>
  46. <view class="yf-style">
  47. <view style='background:#F9F9FA;padding:0 30rpx 20rpx;border-radius:10rpx;' class="left">
  48. <view style='justify-content:space-between;font-weight:600;' class="flex">
  49. <view style="min-width: 130px;margin: 10px 0;">车牌号 : {{item.carNo}}</view>
  50. <view style="width: 90px;margin: 12px 0;">里程</view>
  51. </view>
  52. <view>{{item.createDate.split(" ")[0]}}
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </mescroll-body>
  60. <view v-if='show1' class="shade">
  61. <view class="wrap1">
  62. <view class="alert-top">
  63. <view class="title1">
  64. 请款
  65. </view>
  66. <u-icon name="close" class="close" color="#8890B1" @click="close()"></u-icon>
  67. </view>
  68. <view style='overflow-y: scroll;height:740rpx;' class="content1">
  69. <view class="c-row">
  70. <view class="title2">请款金额</view>
  71. <view class="con-list">
  72. <input type="digit" style="width: 100px;margin-left: 60px;"
  73. v-model='shortDetail.amountRequested' placeholder="请输入请款金额">
  74. <view style="width: 0px;margin-left: 162px;margin-top: -20px;">元</view></input>
  75. </view>
  76. </view>
  77. <view class="c-row">
  78. <view class="title2">仓库名称</view>
  79. <view class="con-list">
  80. <view @click='show=true'>{{shortDetail.warehouseName}}</view>
  81. <u-picker :range="warehouseBaseInfoList" range-key="warehouseName"
  82. @confirm='targetLPicker($event)' v-model="show" mode="selector">
  83. </u-picker>
  84. </view>
  85. </view>
  86. <view class="c-row">
  87. <view class="title2">备注</view>
  88. </view>
  89. <view class="con-list">
  90. <u-input class='textarea' v-model="shortDetail.remark" :type="type" :border="border"
  91. :height="height" :auto-height="autoHeight" />
  92. <view style='right:10px;bottom:20px;color:#AFB3BF;'>
  93. {{shortDetail.remark.length}}/150个字
  94. </view>
  95. </view>
  96. <view class="c-row">
  97. <view class="title2">加油凭证</view>
  98. </view>
  99. <view class="voucher">
  100. <u-upload class="upload" ref="upload" name='fileName' :form-data="{companyId: pcUserInfo.compId,
  101. modelId: '',
  102. vesselId: ''}" :action="action" :show-tips="false" :max-size="maxSize" :max-count="9"
  103. :size-type="['compressed']" @on-success="getImgUrl($event,index)" @on-error="onError"
  104. @on-remove="onRemove($event,index)" @on-uploaded="isAdd = true" :limitType ="['png', 'jpg', 'jpeg', 'webp', 'gif']"
  105. @on-progress="onProgress"></u-upload>
  106. <!-- <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="9"
  107. :size-type="['compressed']" @on-success="getImgUrl($event,index)" @on-error="onError"
  108. @on-remove="onRemove($event,index)" @on-uploaded="isAdd = true" :before-upload="filterFileType"
  109. @on-progress="onProgress"></upload> -->
  110. </view>
  111. </view>
  112. <view @click="close()" class="cancel">取消</view>
  113. <view @click='requestFundsSubmit()' class="confirm">确定</view>
  114. </view>
  115. </view>
  116. <u-modal v-model="show3" @confirm='submit' content="确定提交请款信息?" :show-cancel-button='true' ></u-modal>
  117. </view>
  118. </template>
  119. <script>
  120. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  121. import * as config from '../../config'
  122. export default {
  123. mixins: [MescrollMixin],
  124. data() {
  125. return {
  126. show2: false,
  127. show3:false,
  128. searchType: 1,
  129. pageSize: 10,
  130. show1: false,
  131. show: false,
  132. currentPage: 1,
  133. canReset:"",
  134. mescroll: null,
  135. downOption: {
  136. auto: false //是否在初始化后,自动执行downCallback; 默认true
  137. },
  138. pcUserInfo :uni.getStorageSync('pcUserInfo'),
  139. shortDetail: {
  140. addressUrlArray:[],
  141. shortFillingList: [{
  142. destinationProvince: "",
  143. carNo: "",
  144. originProvince: "",
  145. createDate: "",
  146. travelStatus: "",
  147. mileage: "",
  148. sendWarehouse: "",
  149. receiveWarehouse: "",
  150. }],
  151. amountRequested: '',
  152. warehouseName: '请选择仓库名称',
  153. remark: '',
  154. },
  155. action: config.def().baseUrlNew+ 'appendix/api/uploadFiles',
  156. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  157. warehouseType: '1',
  158. warehouseBaseInfoList: [],
  159. type: 'textarea',
  160. border: true,
  161. height: 150,
  162. autoHeight: true,
  163. infoList:[],
  164. }
  165. },
  166. onLoad() {
  167. this.getWarehouse()
  168. },
  169. onShow() {
  170. this.getList()
  171. this.$nextTick(function() {
  172. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  173. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  174. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  175. });
  176. },
  177. methods: {
  178. mescrollInit(mescroll) {
  179. console.log("mescroll", mescroll)
  180. this.mescroll = mescroll;
  181. },
  182. downCallback() {
  183. this.mescroll.resetUpScroll();
  184. },
  185. emptyclick(){
  186. },
  187. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  188. upCallback(page) {
  189. // if(page.num==1) this.fuelFilling = []
  190. this.$api.doRequest('get', '/shortFillingInfo/selectShortFilling', {
  191. pageSize: page.size,
  192. currentPage: page.num,
  193. // pcFlag: 0,
  194. searchType: this.searchType,
  195. compId: uni.getStorageSync('pcUserInfo').compId,
  196. commonId: uni.getStorageSync('pcUserInfo').userId,
  197. }).then(res => {
  198. if (res.data.code == 200) {
  199. for (var i = 0; i < res.data.data.records.length; i++) {
  200. res.data.data.records[i].checked=false
  201. }
  202. let curPageData = res.data.data.records;
  203. let curPageLen = curPageData.length;
  204. let totalPage = res.data.data.total;
  205. if (page.num == 1) this.shortDetail.shortFillingList = [];
  206. this.shortDetail.shortFillingList = this.shortDetail.shortFillingList.concat(curPageData);
  207. console.log(curPageLen, totalPage)
  208. this.mescroll.endByPage(curPageLen, totalPage);
  209. // if (type == 'down') {
  210. // this.mescroll.endSuccess();
  211. // this.fuelFilling = []
  212. // }
  213. // this.mescroll.endBySize(res.data.data.records.length, res.data.data.total);
  214. // this.fuelFilling = this.fuelFilling.concat(res.data.data.records)
  215. }
  216. })
  217. //联网加载数据
  218. // this.getList(page.size, page.num, 'up')
  219. },
  220. getImgUrl(res) {
  221. this.shortDetail.addressUrlArray.push(res.data.appendixPath)
  222. // if(this.fillingDetail.fillingDetailInfoList[index].addressUrl){
  223. // this.fillingDetail.fillingDetailInfoList[index].addressUrl = this.fillingDetail.fillingDetailInfoList[index].addressUrl +","+res
  224. // }else{
  225. // this.fillingDetail.fillingDetailInfoList[index].addressUrl = res
  226. // }
  227. // console.log('------------res-----------')
  228. },
  229. onError(error) {
  230. alert(error)
  231. console.log('------------error-----------')
  232. console.log(error)
  233. },
  234. onProgress(e) {
  235. console.log(e)
  236. },
  237. onRemove(index, num) {
  238. this.shortDetail.addressUrlArray.splice(index, 1)
  239. },
  240. checkedChange(item,e,index) {
  241. if (item.travelStatus == '已报销') {
  242. this.show2 = false
  243. this.$api.msg('已报销的不可再选')
  244. return
  245. }else{
  246. if(e.detail.value[0]&&e.detail.value[0].indexOf(index)!=-1){
  247. this.shortDetail.shortFillingList[index].checked=true
  248. }else{
  249. this.shortDetail.shortFillingList[index].checked=false
  250. }
  251. }
  252. console.log(this.shortDetail.shortFillingList,)
  253. },
  254. tabcarchange(searchType) {
  255. this.searchType = searchType
  256. this.pageSize = 10
  257. this.getList()
  258. },
  259. trackAddition() {
  260. uni.navigateTo({
  261. url: '/pages/shortDistance/short_track_addition'
  262. })
  263. },
  264. getList() {
  265. this.$api.doRequest('get', '/shortFillingInfo/selectShortFilling', {
  266. pageSize: this.pageSize,
  267. currentPage: this.currentPage,
  268. // pcFlag: 0,
  269. searchType: this.searchType,
  270. compId: uni.getStorageSync('pcUserInfo').compId,
  271. commonId: uni.getStorageSync('pcUserInfo').userId,
  272. }).then(res => {
  273. if (res.data.code == 200) {
  274. for (var i = 0; i < res.data.data.records.length; i++) {
  275. res.data.data.records[i].checked=false
  276. }
  277. this.shortDetail.shortFillingList = res.data.data.records
  278. }
  279. })
  280. },
  281. getWarehouse() {
  282. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouse', {
  283. compId: uni.getStorageSync("pcUserInfo").compId,
  284. warehouseType: '1'
  285. }).then(res => {
  286. if (res.data.data.length != 0) {
  287. this.warehouseBaseInfoList = res.data.data
  288. }
  289. })
  290. },
  291. targetLPicker(e) {
  292. this.shortDetail.warehouseName = this.warehouseBaseInfoList[e[0]].warehouseName
  293. },
  294. requestFunds() {
  295. console.log(this.shortDetail.shortFillingList)
  296. var arr=this.shortDetail.shortFillingList.filter((item)=>{return item.checked==true})
  297. console.log(arr)
  298. this.infoList=arr
  299. if(arr.length==0){
  300. this.$api.msg('请选择一条要请款的条目')
  301. return
  302. }
  303. this.show1 = true
  304. },
  305. close() {
  306. this.show1 = false
  307. },
  308. getInfo(item) {
  309. if (item.travelStatus == '已结束') {
  310. return
  311. } else {
  312. uni.navigateTo({
  313. url: '/pages/shortDistance/short_track_addition?id=' + item.id
  314. })
  315. }
  316. },
  317. requestFundsSubmit() {
  318. this.show3=true
  319. },
  320. submit(){
  321. var that = this
  322. let dataInfo={}
  323. dataInfo.amountRequested = that.shortDetail.amountRequested
  324. dataInfo.warehouseName = that.shortDetail.warehouseName
  325. dataInfo.remark = that.shortDetail.remark
  326. dataInfo.addressUrl = that.shortDetail.addressUrlArray.toString()
  327. // dataInfo.compId = uni.getStorageSync('pcUserInfo').compId
  328. // dataInfo.commonId = uni.getStorageSync('pcUserInfo').userId
  329. // dataInfo.empName = uni.getStorageSync('userInfo').userName
  330. dataInfo.shortFillingInfoList = that.infoList
  331. that.$api.doRequest('post', '/shortFillingInfo/api/shortRequestFunds',
  332. dataInfo
  333. )
  334. .then(res => {
  335. if (res.data.code == 200) {
  336. that.$api.msg('提交成功')
  337. that.show3=false
  338. that.show1=false
  339. } else {
  340. that.$api.msg('提交失败')
  341. }
  342. })
  343. }
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. .content {
  349. padding-bottom: 50rpx;
  350. }
  351. .tag {
  352. background: #F5F6F9;
  353. padding: 5px;
  354. color: #333333;
  355. display: inline-flex;
  356. font-size: 22rpx;
  357. border-radius: 3px;
  358. margin: 3px;
  359. }
  360. .introduce-section .title {
  361. justify-content: space-between;
  362. align-items: flex-start;
  363. }
  364. .introduce-section .title text {
  365. font-size: 28rpx;
  366. }
  367. .introduce-section .title .title-tip {
  368. flex: 1;
  369. font-size: 28rpx;
  370. color: #FE6430;
  371. font-weight: 500;
  372. height: 50px;
  373. line-height: 50px;
  374. border-bottom: 1px solid #EEEEEE;
  375. }
  376. .introduce-section .title .title-tip-a {
  377. flex: 1;
  378. font-size: 15px;
  379. color: #AFB3BF;
  380. font-weight: 500;
  381. height: 50px;
  382. line-height: 50px;
  383. border-bottom: 1px solid #EEEEEE;
  384. }
  385. .line {
  386. display: inline-block;
  387. padding: 5px;
  388. position: relative;
  389. font-size: 17px;
  390. }
  391. .line.active {
  392. font-size: 19px;
  393. font-weight: 900;
  394. }
  395. .line.active:after {
  396. content: '';
  397. display: block;
  398. position: absolute;
  399. width: 18px;
  400. left: 50%;
  401. transform: translateX(-50%);
  402. bottom: 0;
  403. border-bottom: 3px solid #22C572;
  404. }
  405. /deep/.u-action-active {
  406. margin-right: 6px;
  407. }
  408. .content1-top {
  409. background: white;
  410. padding: 10px 16px 0 10px;
  411. border-radius: 0 0 15px 15px;
  412. padding-bottom: 10px;
  413. position:fixed;
  414. z-index:10;
  415. width:100%;
  416. }
  417. .top2 {
  418. display: flex;
  419. align-items: center;
  420. justify-content: space-between;
  421. .right.uni-button {
  422. display: flex;
  423. align-items: center;
  424. font-weight: normal;
  425. .right-contrent1 {
  426. background: #22C572;
  427. height: 25px;
  428. font-size: 14px;
  429. color: #fff;
  430. }
  431. }
  432. }
  433. .good-list {
  434. width:89%;
  435. margin-right: 10rpx;
  436. background-color: white;
  437. padding: 33px 10px 25px 0px;
  438. border-radius: 30rpx;
  439. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  440. margin-bottom: 10px;
  441. .item1,
  442. .item3 {
  443. // width: 40%;
  444. display: flex;
  445. .text {
  446. text-overflow: ellipsis;
  447. overflow: hidden;
  448. white-space: nowrap;
  449. }
  450. }
  451. .item1 .text {
  452. text-align: left;
  453. }
  454. .item3 .text {
  455. text-align: right;
  456. }
  457. }
  458. .fuxuankuang {
  459. margin-top: 10px;
  460. }
  461. .xf-iamge {
  462. width: 74rpx;
  463. height: 43rpx;
  464. position: absolute;
  465. top: -20rpx;
  466. right: 0;
  467. }
  468. .level2-title {
  469. font-size: 28rpx;
  470. width: 84px;
  471. }
  472. .jt-icon {
  473. position: relative;
  474. top: 6rpx;
  475. width: 60rpx;
  476. margin: 0 20rpx;
  477. }
  478. .ssx {
  479. width: 20px;
  480. height: 20px;
  481. background: linear-gradient(180deg, #C8D7E5 0%, #AFC1D6 100%);
  482. font-size: 13px;
  483. font-family: PingFangSC-Medium, PingFang SC;
  484. font-weight: 500;
  485. color: #FFFFFF;
  486. border-radius: 50%;
  487. display: flex;
  488. justify-content: center;
  489. align-items: center;
  490. margin-right: 5px;
  491. }
  492. .item1 .ssx{
  493. background:#22C572;
  494. }
  495. .item3 .ssx{
  496. background:#FE6430;
  497. }
  498. .level2-title {
  499. font-weight: 700;
  500. color: #000000;
  501. }
  502. .wenzi {
  503. margin-top: -65px;
  504. margin-left:-20px;
  505. text-align: right;
  506. border-radius: 5px;
  507. height: 5px;
  508. }
  509. .audit1 {
  510. color: #22C572;
  511. width:43px;
  512. // margin-right:10px;
  513. }
  514. .audit2 {
  515. color: #22C572;
  516. }
  517. .audit3 {
  518. color: #AFB3BF;
  519. }
  520. .c-row {
  521. display: flex;
  522. -webkit-box-align: center;
  523. align-items: center;
  524. // padding: 0px 15px;
  525. position: relative;
  526. }
  527. .shade {
  528. position: fixed;
  529. top: 0;
  530. left: 0;
  531. height: 100%;
  532. width: 100%;
  533. background: rgba(0, 0, 0, 0.4);
  534. z-index: 3;
  535. .wrap1 {
  536. position: absolute;
  537. left: 0;
  538. top: 0;
  539. right: 0;
  540. bottom: 0;
  541. margin: auto;
  542. background: #fff;
  543. width: calc(100% - 198rpx);
  544. height: 476px;
  545. border-radius: 20rpx;
  546. input {
  547. font-size: 14px;
  548. }
  549. .alert-top {
  550. padding: 33rpx;
  551. display: flex;
  552. justify-content: center;
  553. align-items: center;
  554. position: relative;
  555. }
  556. .title1 {
  557. font-size: 32rpx;
  558. font-weight: 600;
  559. color: #333333;
  560. }
  561. .close {
  562. position: absolute;
  563. right: 33rpx;
  564. }
  565. }
  566. .title2 {
  567. padding: 10px 16px;
  568. }
  569. .con-list {
  570. -webkit-box-flex: 1;
  571. flex: 1;
  572. display: flex;
  573. -webkit-box-orient: vertical;
  574. -webkit-box-direction: normal;
  575. flex-direction: column;
  576. color: #303133;
  577. line-height: 20px;
  578. text-align: right;
  579. padding-right: 10px;
  580. }
  581. .cancel {
  582. position: absolute;
  583. display: inline-block;
  584. width: 50%;
  585. text-align: center;
  586. bottom: 0;
  587. padding: 10px;
  588. border-top: 1px solid #eee;
  589. font-size: 34rpx;
  590. }
  591. .confirm {
  592. position: absolute;
  593. display: inline-block;
  594. width: 50%;
  595. text-align: center;
  596. bottom: 0;
  597. padding: 10px;
  598. border-top: 1px solid #eee;
  599. font-size: 34rpx;
  600. }
  601. .cancel {
  602. left: 0;
  603. border-right: 1px solid #eee;
  604. color: #ff0000;
  605. }
  606. .confirm {
  607. right: 0;
  608. color: #22C572;
  609. }
  610. .bottom-btn {
  611. width: 100%;
  612. position: fixed;
  613. bottom: 0;
  614. display: flex;
  615. z-index: 2;
  616. left: 0;
  617. background-color: #f8f8f8;
  618. flex-direction: column;
  619. .btn1,
  620. .btn2 {
  621. width: 100%;
  622. margin-bottom: 26rpx;
  623. border-radius: 90rpx;
  624. }
  625. .btn1 {
  626. background: white;
  627. color: #00C265;
  628. }
  629. }
  630. }
  631. .textarea {
  632. background: #F9F9FA;
  633. border: 1px solid #EEEEEE;
  634. margin-left: 10px;
  635. }
  636. .voucher{
  637. margin-left: 20rpx;
  638. }
  639. /deep/.mescroll-body{
  640. margin-top:50px;
  641. }
  642. </style>