record.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <view class="content">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" class="mescroll"
  4. :up="upOption">
  5. <view class="top">
  6. <u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
  7. <u-search placeholder="可按编号、货主、收发地查找" v-model="searchKeyWord" @search="search" @custom="search"
  8. bgColor='#F5F6FA'></u-search>
  9. </view>
  10. <!-- <u-tabs
  11. :list="list1"
  12. lineWidth="30"
  13. lineColor="#f56c6c"
  14. :activeStyle="{
  15. color: '#303133',
  16. fontWeight: 'bold',
  17. transform: 'scale(1.05)'
  18. }"
  19. :inactiveStyle="{
  20. color: '#606266',
  21. transform: 'scale(1)'
  22. }"
  23. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
  24. >
  25. </u-tabs> -->
  26. <view class='tab-nav'>
  27. <view class='tab-item' v-for='item in list1' @click='statuschange(item)'
  28. :class='{active:item.status==searchType}'>
  29. {{item.name}}
  30. <!-- {{item.num}} -->
  31. </view>
  32. </view>
  33. <!-- <u-tabs :list="list1" @click="click"></u-tabs> -->
  34. <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
  35. @click="toDetail(good.id)">
  36. <view style="padding: 0 35rpx 20rpx 35rpx;">
  37. <view class="flex flex-space-between row1">
  38. <view class="item1">
  39. {{good.taskNo}}
  40. <!-- {{good.goodsName}} -->
  41. </view>
  42. <view class="item2 ytg-color" v-if="good.status=='已通过'">{{good.status}}</view>
  43. <view class="item2 wtg-color" v-if="good.status=='未通过'">{{good.status}}</view>
  44. <view class="item2 shz-color" v-if="good.status=='审核中'">{{good.status}}</view>
  45. <view class="item2 ygq-color" v-if="good.status=='已过期'">{{good.status}}</view>
  46. </view>
  47. <view class="flex row2">
  48. <view class="left flex">
  49. <view class="flex">
  50. <view class="ssx">
  51. {{$helper.getProvinceAbbreviation(good.sendPrivate?good.sendPrivate:good.sendCity)}}
  52. </view>
  53. <view class="level2-title">{{good.sendCity}}</view>
  54. </view>
  55. <view class="level2-title">{{good.sendArea}}</view>
  56. </view>
  57. <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'></image>
  58. <view class="right flex">
  59. <view class="flex">
  60. <view class="ssx">
  61. {{$helper.getProvinceAbbreviation(good.unloadPrivate?good.unloadPrivate:good.unloadCity)}}
  62. </view>
  63. <view class="level2-title">{{good.unloadCity}} </view>
  64. </view>
  65. <view class="level2-title">{{good.unloadArea}}</view>
  66. </view>
  67. </view>
  68. <view class="flex row3">
  69. <view class="left">
  70. <!-- <image class="hz" src="@/static/images/news/hz.png"></image> -->
  71. </view>
  72. <view class="right">
  73. <view class="flex row">
  74. <view class="flex">
  75. <!-- <image class="hz-good" src="@/static/images/order/good-img.png"></image> -->
  76. <view>{{good.goodsName}}</view>
  77. </view>
  78. <view class="sline" v-if="good.carLengthSmall&&good.carLength"></view>
  79. <view class="cc" v-if="good.carLengthSmall&&good.carLength">{{good.carLengthSmall}} -
  80. {{good.carLength}} 米
  81. </view>
  82. <view class="sline" v-if="carType(good)"></view>
  83. <view>{{carType(good)}}</view>
  84. </view>
  85. <view class="flex align-center">
  86. <view class="">运距约 {{good.distance}}km</view>
  87. <view v-if='good.weight' class="sline"></view>
  88. <view v-if='good.weight' class="">{{good.weight}}吨</view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="row4 flex flex-end align-center">
  93. <view class="time">{{good.updateDate}}</view>
  94. <!-- <view class="car">{{good.freight}}{{good.illingMethod==0?'元/吨':'元/车'}}</view> -->
  95. </view>
  96. <view class="row5 flex flex-end">
  97. <view class="normal" @click.stop="edit(good)" v-if="good.status =='未通过'">编辑</view>
  98. <!-- 只有已驳回的任务有编辑-->
  99. <view class="normal" @click.stop="del(good)">删除</view>
  100. <!-- v-if="good.status!='已通过'" -->
  101. <view class="normal" @click.stop="Refresh(good)" v-if="good.status=='已通过'">刷新</view>
  102. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='1'&&good.status=='已通过'">
  103. 隐藏</view>
  104. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='2'&&good.status=='已通过'">
  105. 显示</view>
  106. </view>
  107. </view>
  108. </view>
  109. </mescroll-body>
  110. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
  111. :closeOnClickOverlay='true' :showCancelButton='true' @confirm="$u.throttle(confirmClick, 1000)"
  112. @close="cancelClick" @cancel="cancelClick" class="modal">
  113. </u-modal>
  114. <u-toast ref="uToast"></u-toast>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. mapState
  120. } from 'vuex';
  121. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  122. import {
  123. apiGoods
  124. } from "@/api/mock.js"
  125. export default {
  126. mixins: [MescrollMixin], // 使用mixin
  127. data() {
  128. return {
  129. keyword: '',
  130. // isShowStopBtn: false,
  131. // isConfirmLoadingBtn:false,
  132. // isShowCustomerServiceBtn:false,
  133. // isConfirmUnLoadingBtn:false,
  134. // isClosedBtn:false,
  135. searchKeyWord: '',
  136. mescroll: null,
  137. id: '',
  138. confirmText: '确定',
  139. searchType: '',
  140. alertTitle: '',
  141. alertContent: "",
  142. isShowAlert: false,
  143. goods: [], // 数据列表
  144. delOrShowHidden: '',
  145. rowObj: {},
  146. list1: [{
  147. name: '全部',
  148. status: '',
  149. num: 0,
  150. }, {
  151. name: '审核中',
  152. status: '1',
  153. num: 0,
  154. }, {
  155. name: '已通过',
  156. status: '3',
  157. num: 0,
  158. }, {
  159. name: '未通过',
  160. status: '2',
  161. num: 0,
  162. }, {
  163. name: '已过期',
  164. status: '4',
  165. num: 0,
  166. }],
  167. upOption: {
  168. page: {
  169. size: 10 // 每页数据的数量,默认10
  170. },
  171. noMoreSize: 0, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  172. empty: {
  173. tip: ''
  174. }
  175. },
  176. }
  177. },
  178. computed: {
  179. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  180. },
  181. onTabItemTap(e) {
  182. // tab 点击时执行,此处直接接收单击事件
  183. uni.pageScrollTo({
  184. scrollTop: 0,
  185. duration: 300
  186. });
  187. },
  188. created() {
  189. //#ifdef APP-PLUS
  190. // this.getLngLat();
  191. //#endif
  192. },
  193. onLoad() {
  194. // let _isHave = this.$utils.getRoles('aaa')
  195. // console.log(_isHave)
  196. },
  197. onShow() {
  198. this.upCallback({
  199. size: 10,
  200. num: 1
  201. })
  202. },
  203. // onPageScroll(res) {
  204. // this.scrollTop = res.scrollTop
  205. // console.log("页面滚动了", res.scrollTop)
  206. // if (this.scrollTop > 1200) {
  207. // uni.setTabBarItem({
  208. // index: 1,
  209. // text: '返回顶部',
  210. // iconPath: 'static/images/common/top@2x.png',
  211. // selectedIconPath: 'static/images/common/top@2x.png'
  212. // })
  213. // } else {
  214. // uni.setTabBarItem({
  215. // index: 1,
  216. // text: '订单',
  217. // iconPath: 'static/images/common/dingdan@2x(1).png',
  218. // selectedIconPath: 'static/images/common/dingdan@2x.png'
  219. // })
  220. // }
  221. // },
  222. methods: {
  223. statuschange(item) {
  224. this.searchType = item.status
  225. this.upCallback({
  226. size: 10,
  227. num: 1
  228. })
  229. },
  230. mescrollInit(mescroll) {
  231. this.mescroll = mescroll;
  232. },
  233. search() {
  234. this.mescroll.resetUpScroll()
  235. },
  236. back() {
  237. uni.navigateBack()
  238. },
  239. carType(good) {
  240. let _val = '';
  241. if (good.carModel == 1) {
  242. _val = ''
  243. } else {
  244. if (good.carModel && good.carModel.includes(2)) {
  245. _val += '高栏'
  246. }
  247. if (good.carModel && good.carModel.includes(3)) {
  248. _val += '/集装箱'
  249. }
  250. if (good.carModel && good.carModel.includes(4)) {
  251. _val += '/自卸车'
  252. }
  253. }
  254. return _val
  255. },
  256. confirmDel() {
  257. let that = this
  258. that.isShowAlert = false
  259. this.$request.baseRequest('post', '/publishTaskInfo/deleteTask', {
  260. id: this.rowObj.id,
  261. }).then(res => {
  262. if (res.code == 200) {
  263. this.$refs.uToast.show({
  264. type: 'success',
  265. message: "删除成功!",
  266. complete() {
  267. that.mescroll.resetUpScroll()
  268. }
  269. })
  270. } else {
  271. this.$refs.uToast.show({
  272. type: 'success',
  273. message: "删除失败!",
  274. complete() {
  275. that.isShowAlert = false
  276. }
  277. })
  278. }
  279. })
  280. .catch(res => {
  281. uni.$u.toast(res.message);
  282. });
  283. },
  284. del(val) {
  285. this.alertTitle = '确定删除任务?'
  286. this.isShowAlert = true
  287. this.rowObj = val
  288. this.delOrShowHidden = 2
  289. },
  290. edit(item) {
  291. uni.$u.route('/pages/release/editRelease', item);
  292. },
  293. Refresh(val) {
  294. let that = this
  295. this.$request.baseRequest('post', '/publishTaskInfo/api/refresh', {
  296. id: val.id,
  297. commonId: this.userInfo.id
  298. }).then(res => {
  299. if (res.code == 200) {
  300. this.$refs.uToast.show({
  301. type: 'success',
  302. message: "刷新成功"
  303. })
  304. } else {
  305. this.$refs.uToast.show({
  306. type: 'error',
  307. message: "刷新失败",
  308. })
  309. }
  310. this.isShowAlert = false
  311. this.mescroll.resetUpScroll()
  312. })
  313. .catch(res => {
  314. uni.$u.toast(res.message);
  315. });
  316. },
  317. back() {
  318. uni.navigateBack(-1)
  319. },
  320. radioChange(n) {
  321. console.log('radioChange', n);
  322. },
  323. confirmHideShow() {
  324. let that = this
  325. this.$request.baseRequest('post', '/publishTaskInfo/api/showHidden', {
  326. id: this.rowObj.id,
  327. }).then(res => {
  328. console.log(this.rowObj)
  329. if (res.code == 200) {
  330. if (this.rowObj.showHide == 2) {
  331. this.$refs.uToast.show({
  332. type: 'success',
  333. message: "显示成功"
  334. })
  335. }
  336. this.isShowAlert = false
  337. this.mescroll.resetUpScroll()
  338. } else {
  339. this.$refs.uToast.show({
  340. type: 'error',
  341. message: "显示失败",
  342. })
  343. }
  344. })
  345. .catch(res => {
  346. uni.$u.toast(res.message);
  347. });
  348. },
  349. hideShow(val) {
  350. //隐藏 显示
  351. // =1为点击隐藏
  352. this.rowObj = val
  353. if (val.showHide == '1') {
  354. this.alertTitle = '确定隐藏任务?'
  355. this.isShowAlert = true
  356. this.delOrShowHidden = 1
  357. } else {
  358. this.confirmHideShow()
  359. }
  360. },
  361. confirmClick() {
  362. if (this.delOrShowHidden == 1) {
  363. this.confirmHideShow();
  364. } else if (this.delOrShowHidden == 2) {
  365. this.confirmDel()
  366. }
  367. },
  368. cancelClick() {
  369. this.isShowAlert = false
  370. },
  371. toDetail(id) {
  372. uni.$u.route('/pages/release/lookRelease', {
  373. id: id,
  374. });
  375. },
  376. upCallback(page) {
  377. uni.showLoading({
  378. mask: true,
  379. title: '加载中...'
  380. })
  381. this.$request.baseRequest('get', '/publishTaskInfo/selectNum', {
  382. commonId: this.userInfo.id,
  383. }).then(res => {
  384. this.list1[0].num = res.data.allNum
  385. this.list1[1].num = res.data.examieNum
  386. this.list1[2].num = res.data.passNum
  387. this.list1[3].num = res.data.noNum
  388. this.list1[4].num = res.data.overdueNum
  389. })
  390. .catch(res => {
  391. uni.$u.toast(res.message);
  392. });
  393. this.$request.baseRequest('get', '/publishTaskInfo/selectTask', {
  394. commonId: this.userInfo.id,
  395. searchKeyWord: this.searchKeyWord,
  396. searchType: this.searchType,
  397. pageSize: page.size,
  398. currentPage: page.num
  399. }).then(res => {
  400. this.mescroll.endBySize(res.data.records.length, res.data.total);
  401. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  402. this.goods = this.goods.concat(res.data.records); //追加新数据
  403. uni.hideLoading()
  404. })
  405. .catch(res => {
  406. uni.hideLoading()
  407. uni.$u.toast(res.message);
  408. });
  409. },
  410. }
  411. }
  412. </script>
  413. <style scoped lang="scss">
  414. .content {
  415. padding-top: var(--status-bar-height);
  416. // background: white;
  417. .top {
  418. display: flex;
  419. background: white;
  420. padding: 20rpx;
  421. .back {
  422. margin-right: 20rpx;
  423. }
  424. }
  425. }
  426. // .banner {
  427. // width: 100%;
  428. // position: relative;
  429. // }
  430. // .fixed,
  431. // .fixed1 {
  432. // background: white;
  433. // position: fixed;
  434. // top: var(--status-bar-height);
  435. // z-index: 999;
  436. // width: 100%;
  437. // }
  438. // .fixed {
  439. // .title {
  440. // background: white;
  441. // position: relative;
  442. // font-size: 36rpx;
  443. // font-weight: 500;
  444. // color: rgba(0, 0, 0, 0.85);
  445. // .search {
  446. // position: absolute;
  447. // right: 20rpx;
  448. // }
  449. // }
  450. // }
  451. // .fixed1 {
  452. // top: 0;
  453. // height: var(--status-bar-height);
  454. // background: white;
  455. // }
  456. // .banner-img {
  457. // width: 100%;
  458. // }
  459. // .head {
  460. // position: absolute;
  461. // width: calc(100% - 108rpx);
  462. // bottom: 0;
  463. // background: white;
  464. // margin: 0 20rpx;
  465. // border-radius: 20rpx;
  466. // .item1,
  467. // .item3 {
  468. // width: 40%;
  469. // .text {
  470. // text-overflow: ellipsis;
  471. // overflow: hidden;
  472. // white-space: nowrap;
  473. // }
  474. // }
  475. // .item1 .text {
  476. // text-align: left;
  477. // }
  478. // .item3 .text {
  479. // text-align: right;
  480. // }
  481. // }
  482. // .change-btn {
  483. // width: 86rpx;
  484. // height: 86rpx;
  485. // }
  486. .hz-good {
  487. width: 44rpx;
  488. height: 44rpx;
  489. margin: 0 30rpx;
  490. }
  491. .good-list {
  492. background-color: white;
  493. margin: 20rpx;
  494. padding: 20rpx 0rpx 0 0;
  495. border-radius: 20rpx;
  496. .row1 {
  497. font-size: 26rpx;
  498. .item1 {
  499. color: #333333;
  500. }
  501. }
  502. .row2 {
  503. margin: 30rpx 0;
  504. .left {
  505. width: calc(50% - 25rpx);
  506. align-items: center;
  507. flex-direction: column;
  508. justify-content: center;
  509. }
  510. .right {
  511. width: calc(50% - 25rpx);
  512. align-items: center;
  513. justify-content: flex-end;
  514. flex-direction: column;
  515. }
  516. }
  517. .row3 {
  518. background: #F5F6FA;
  519. padding: 20rpx;
  520. border-radius: 10rpx;
  521. color: #333333;
  522. .hz {
  523. width: 74rpx;
  524. height: 74rpx;
  525. margin-right: 30rpx;
  526. }
  527. .cc {
  528. margin-left: 10rpx;
  529. }
  530. .yj {
  531. margin-left: 30rpx;
  532. }
  533. }
  534. .row4 {
  535. margin: 20rpx 0;
  536. .time {
  537. font-size: 26rpx;
  538. color: #999999;
  539. margin-right: 20rpx;
  540. }
  541. .car {
  542. font-size: 28rpx;
  543. color: #000000;
  544. }
  545. }
  546. .row5 {
  547. margin: 20rpx 0;
  548. font-size: 28rpx;
  549. .stop {
  550. border-radius: 33px;
  551. border: 1px solid #FE6300;
  552. padding: 13rpx 31rpx;
  553. margin-right: 20rpx;
  554. color: #FE6300;
  555. }
  556. .normal {
  557. border: 1px solid #CDCDCD;
  558. border-radius: 33px;
  559. padding: 13rpx 31rpx;
  560. margin-left: 20rpx;
  561. }
  562. }
  563. }
  564. .jt-icon {
  565. position: relative;
  566. top: 6rpx;
  567. width: 60rpx;
  568. margin: 0 20rpx;
  569. }
  570. .row {
  571. margin: 10rpx 0;
  572. align-items: center;
  573. }
  574. // .item-bottom {
  575. // background: #F0F5FF;
  576. // padding: 0 30rpx;
  577. // .name {
  578. // font-size: 26rpx;
  579. // font-weight: 700;
  580. // color: #000000;
  581. // margin-left: 30rpx;
  582. // }
  583. // .hp {
  584. // margin: 30rpx;
  585. // }
  586. // .number-color {
  587. // margin: 0 10rpx;
  588. // }
  589. // .qd {
  590. // background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  591. // border-radius: 13px;
  592. // font-size: 29rpx;
  593. // font-weight: 400;
  594. // color: #FFFFFF;
  595. // padding: 10rpx 35rpx;
  596. // }
  597. // }
  598. .dw {
  599. align-items: center;
  600. }
  601. // .mescroll {
  602. // margin-top: calc(var(--status-bar-height) + 140rpx);
  603. // }
  604. .sline {
  605. height: 28rpx;
  606. width: 1px;
  607. background: black;
  608. margin: 0 20rpx;
  609. }
  610. .search-view {
  611. margin-top: var(--status-bar-height);
  612. background: white;
  613. padding: 0 20rpx;
  614. }
  615. .back-icon {
  616. margin-right: 20rpx;
  617. }
  618. .near-search-text {
  619. margin: 20rpx 0;
  620. }
  621. .item-style {
  622. background: #F5F6FA;
  623. padding: 11rpx 24rpx;
  624. margin-right: 20rpx;
  625. border-radius: 10px;
  626. font-size: 26rpx;
  627. color: #333333;
  628. }
  629. /deep/.u-modal__content {
  630. flex-direction: column;
  631. }
  632. .tab-nav {
  633. width: 100%;
  634. background: white;
  635. display: flex;
  636. }
  637. .tab-item {
  638. width: 25%;
  639. display: block;
  640. position: relative;
  641. text-align: center;
  642. padding: 10px 0;
  643. box-sizing: border-box;
  644. color: #7D8087;
  645. font-size: 14px;
  646. }
  647. .tab-item.active {
  648. color: #000;
  649. font-size: 16px;
  650. }
  651. .tab-item.active:after {
  652. position: absolute;
  653. content: '';
  654. display: block;
  655. width: 50%;
  656. left: 50%;
  657. transform: translate(-50%);
  658. height: 4px;
  659. bottom: 0;
  660. background: #2772FB;
  661. border-radius: 2px;
  662. }
  663. </style>