record.vue 13 KB

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