record.vue 13 KB

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