record.vue 16 KB

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