record.vue 14 KB

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